:root,
[data-theme="light"] {
  --bg: #eef1f6;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel-hover: #f5f7fa;
  --line: #dce1ea;
  --text: #1a2332;
  --text-muted: #5a6a7e;
  --accent: #2c5ea8;
  --accent-light: #3a72c4;
  --accent-dim: rgba(44, 94, 168, 0.08);
  --red: #c93a3a;
  --red-dim: rgba(201, 58, 58, 0.08);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10);
  --font: Inter, Arial, Helvetica, sans-serif;
  --font-he: Arial, "Segoe UI", Helvetica, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg2: #1a2233;
  --panel: #1c1f2e;
  --panel-hover: #243350;
  --line: #2a2d3e;
  --text: #e4e6f0;
  --text-muted: #8b91ab;
  --accent: #4a8fe8;
  --accent-light: #5da0f5;
  --accent-dim: rgba(74, 143, 232, 0.12);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.10);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.20);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.30);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }

.brand-he { color: var(--text-muted); font-family: var(--font-he); font-size: 16px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.updated {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.icon-btn:hover { background: var(--panel-hover); }

/* ------------------------------------------------------------------- wall */

.wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 24px;
  max-width: 1720px;
  margin: 0 auto;
}

.col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 18px 12px;
  min-width: 0;
}

.col[dir="rtl"] { font-family: var(--font-he); }

.col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-family: var(--font);
}

.col-title {
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.col[dir="rtl"] .col-title { text-transform: none; letter-spacing: 0; }

.col-count { margin-inline-start: auto; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.items { list-style: none; margin: 0; padding: 0; }

.item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px dashed var(--line);
}

.item:last-child { border-bottom: 0; }

.item a {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.item a:hover { color: var(--accent-light); }

.item.fresh a { color: var(--red); }

.item .age {
  flex: none;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  padding-top: 3px;
  white-space: nowrap;
}

.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.more:hover { color: var(--accent-light); }

.empty { color: var(--text-muted); font-size: 13px; padding: 12px 2px; }

/* ---------------------------------------------------------------- tooltip */

.tip {
  position: fixed;
  z-index: 20;
  max-width: 420px;
  padding: 12px 14px;
  background: #fff8e1;
  color: #1a2332;
  border: 1px solid #efd27a;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
}

.tip[dir="rtl"] { font-family: var(--font-he); }

.tip .tip-meta {
  margin-top: 6px;
  font-size: 11px;
  color: #6b6f88;
  font-family: var(--mono);
}

[data-theme="dark"] .tip { background: #2a2610; color: #f1e9c8; border-color: #6d5c1e; }
[data-theme="dark"] .tip .tip-meta { color: #b3ab8a; }

/* ------------------------------------------------------------ reader panel */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 31;
  width: 560px;
  max-width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.22s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-source {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.panel-head .icon-btn { margin-inline-start: auto; font-size: 22px; line-height: 1; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  font-size: 16px;
  line-height: 1.65;
}

.panel-body[dir="rtl"] { font-family: var(--font-he); }

.panel-body h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
}

.panel-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 18px;
}

.panel-text p { margin: 0 0 14px; overflow-wrap: anywhere; }

.panel-text .note {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--text-muted);
  font-size: 14px;
}

.panel-text .loading { color: var(--text-muted); font-size: 14px; }

.panel-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 700;
}

.panel-link:hover { color: var(--accent-light); text-decoration: underline; }

.panel[hidden], .scrim[hidden] { display: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .wall { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .tip { display: none; }
  .panel { width: 100vw; border-left: 0; }
  .panel-body { padding: 16px 16px 28px; }
}

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .brand-he { display: none; }
  .wall { padding: 12px; gap: 12px; }
  .col { padding: 14px 14px 10px; border-radius: 10px; }
  body { font-size: 16px; }
}

@media (min-width: 1421px) {
  .wall { gap: 24px; padding: 28px 32px; }
}
