/* ============================================
   LLM Lounge — Shared Stylesheet
   ============================================ */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2333;
  --surface3: #21262d;
  --border: #30363d;
  --border-light: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #7a8490;
  --accent: #58a6ff;
  --accent2: #3fb950;
  --accent3: #bc8cff;
  --accent4: #d29922;
  --yellow: #d29922;
  --red: #f85149;
  --sidebar-w: 280px;
  --topbar-h: 68px;
}

/* ——— Light Theme ——— */
html[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface2: #eaeef2;
  --surface3: #d0d7de;
  --border: #d0d7de;
  --border-light: #e1e4e8;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-dim: #8b949e;
  --accent: #0969da;
  --accent2: #1a7f37;
  --accent3: #8250df;
  --accent4: #bf8700;
  --yellow: #bf8700;
  --red: #cf222e;
}

html[data-theme="light"] pre { background: #f6f8fa; border-color: #d0d7de; }
html[data-theme="light"] pre code { color: #1f2328; }
html[data-theme="light"] code { background: #eaeef2; color: #8250df; }

/* ——— Mono Theme — Pure black & white ——— */
html[data-theme="mono"] {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface2: #ebebeb;
  --surface3: #d4d4d4;
  --border: #d4d4d4;
  --border-light: #e5e5e5;
  --text: #171717;
  --text-muted: #525252;
  --text-dim: #737373;
  --accent: #171717;
  --accent2: #404040;
  --accent3: #525252;
  --accent4: #737373;
  --yellow: #737373;
  --red: #dc2626;
}
html[data-theme="mono"] pre { background: #fafafa; border-color: #d4d4d4; }
html[data-theme="mono"] pre code { color: #171717; }
html[data-theme="mono"] code { background: #f0f0f0; color: #171717; }
html[data-theme="mono"] h1 { background: none; -webkit-background-clip: unset; -webkit-text-fill-color: #171717; }
html[data-theme="mono"] h2 { color: #171717; border-bottom-color: #d4d4d4; }
html[data-theme="mono"] h3 { color: #404040; }
html[data-theme="mono"] h4 { color: #525252; }
html[data-theme="mono"] .callout { background: #fafafa; border-left-color: #a3a3a3; }
html[data-theme="mono"] .callout-info { background: #fafafa; border-left-color: #171717; }
html[data-theme="mono"] .callout-success { background: #fafafa; border-left-color: #404040; }
html[data-theme="mono"] .callout-danger { background: #fef2f2; border-left-color: #dc2626; }
html[data-theme="mono"] .badge-green { background: #f0f0f0; color: #404040; }
html[data-theme="mono"] .badge-blue { background: #f0f0f0; color: #171717; }
html[data-theme="mono"] .badge-purple { background: #f0f0f0; color: #525252; }
html[data-theme="mono"] .badge-orange { background: #f0f0f0; color: #737373; }
html[data-theme="mono"] .badge-red { background: #fef2f2; color: #dc2626; }
html[data-theme="mono"] .module-card:hover { border-color: #171717; }
html[data-theme="mono"] .section-link.active { color: #171717; border-left-color: #171717; background: rgba(0,0,0,0.03); }
html[data-theme="mono"] .module-header.active .module-num,
html[data-theme="mono"] .module-header.has-progress .module-num { background: #171717; color: #ffffff; }
html[data-theme="mono"] .continue-banner { background: #fafafa; border-color: #171717; }
html[data-theme="mono"] .continue-banner-btn { background: #171717; color: #ffffff; }
html[data-theme="mono"] .quiz-btn { background: #171717; color: #ffffff; }
html[data-theme="mono"] .quiz-option.selected { border-color: #171717; background: rgba(0,0,0,0.04); }
html[data-theme="mono"] .quiz-option.correct { border-color: #404040; background: rgba(0,0,0,0.04); }
html[data-theme="mono"] .quiz-score-number.pass { color: #171717; }
html[data-theme="mono"] .quiz-score-fill.pass { background: #171717; }
html[data-theme="mono"] .nav-mode-btn.active { background: #171717; color: #ffffff; }
html[data-theme="mono"] .news-filter-pill.active { background: #171717; color: #ffffff; border-color: #171717; }
html[data-theme="mono"] .news-highlight-card { border-color: #171717; }
html[data-theme="mono"] .news-page-num.active { background: #171717; color: #ffffff; border-color: #171717; }
html[data-theme="mono"] .flashcard-filter-btn.active { background: #171717; color: #ffffff; border-color: #171717; }
html[data-theme="mono"] #topbar .logo { background: none; -webkit-background-clip: unset; -webkit-text-fill-color: #171717; }
html[data-theme="mono"] .news-highlight-label { color: #525252; }
html[data-theme="mono"] .news-card-source { color: #171717; }

/* ——— Warm Ember Theme ——— */
html[data-theme="warm"] {
  --bg: #1a1510;
  --surface: #231e17;
  --surface2: #2d2519;
  --surface3: #382f22;
  --border: #4a3f2f;
  --border-light: #2d2519;
  --text: #f0e6d6;
  --text-muted: #b8a88e;
  --text-dim: #8a7a62;
  --accent: #e8a855;
  --accent2: #7ec47e;
  --accent3: #d4a0e0;
  --accent4: #e8a855;
  --yellow: #e8a855;
  --red: #e07060;
}
html[data-theme="warm"] pre { background: #231e17; border-color: #4a3f2f; }
html[data-theme="warm"] pre code { color: #f0e6d6; }
html[data-theme="warm"] code { background: #2d2519; color: #d4a0e0; }
html[data-theme="warm"] .callout { background: #2a2015; }
html[data-theme="warm"] .callout-info { background: #1f2218; }
html[data-theme="warm"] .callout-success { background: #1a2218; }
html[data-theme="warm"] .callout-danger { background: #2a1815; }
html[data-theme="warm"] .badge-green { background: #1a2a1a; }
html[data-theme="warm"] .badge-blue { background: #2a2215; }
html[data-theme="warm"] .badge-purple { background: #2a1a2a; }
html[data-theme="warm"] .badge-orange { background: #2a2015; }
html[data-theme="warm"] .badge-red { background: #2a1515; }

/* ——— Ocean Theme ——— */
html[data-theme="ocean"] {
  --bg: #0b1622;
  --surface: #0f1d2e;
  --surface2: #142638;
  --surface3: #1a2f44;
  --border: #1e3a5f;
  --border-light: #142638;
  --text: #d6e8f7;
  --text-muted: #7ea8c9;
  --text-dim: #4e7a9e;
  --accent: #38bdf8;
  --accent2: #34d399;
  --accent3: #a78bfa;
  --accent4: #fbbf24;
  --yellow: #fbbf24;
  --red: #fb7185;
}
html[data-theme="ocean"] pre { background: #0f1d2e; border-color: #1e3a5f; }
html[data-theme="ocean"] pre code { color: #d6e8f7; }
html[data-theme="ocean"] code { background: #142638; color: #a78bfa; }
html[data-theme="ocean"] .callout { background: #1a2515; }
html[data-theme="ocean"] .callout-info { background: #0d1f33; }
html[data-theme="ocean"] .callout-success { background: #0f2218; }
html[data-theme="ocean"] .callout-danger { background: #1f1018; }
html[data-theme="ocean"] .badge-green { background: #0f2a1a; }
html[data-theme="ocean"] .badge-blue { background: #0d2238; }
html[data-theme="ocean"] .badge-purple { background: #1a1533; }
html[data-theme="ocean"] .badge-orange { background: #2a1f0f; }
html[data-theme="ocean"] .badge-red { background: #2a1111; }

/* ——— Forest Theme ——— */
html[data-theme="forest"] {
  --bg: #0f1a0f;
  --surface: #152215;
  --surface2: #1a2c1a;
  --surface3: #213521;
  --border: #2d4a2d;
  --border-light: #1a2c1a;
  --text: #d6f0d6;
  --text-muted: #88b888;
  --text-dim: #5a8a5a;
  --accent: #4ade80;
  --accent2: #86efac;
  --accent3: #c4b5fd;
  --accent4: #fbbf24;
  --yellow: #fbbf24;
  --red: #f87171;
}
html[data-theme="forest"] pre { background: #152215; border-color: #2d4a2d; }
html[data-theme="forest"] pre code { color: #d6f0d6; }
html[data-theme="forest"] code { background: #1a2c1a; color: #c4b5fd; }
html[data-theme="forest"] .callout { background: #1a2015; }
html[data-theme="forest"] .callout-info { background: #0f1a22; }
html[data-theme="forest"] .callout-success { background: #0f2210; }
html[data-theme="forest"] .callout-danger { background: #22100f; }
html[data-theme="forest"] .badge-green { background: #0f2a0f; }
html[data-theme="forest"] .badge-blue { background: #0f1a2a; }
html[data-theme="forest"] .badge-purple { background: #1a152a; }
html[data-theme="forest"] .badge-orange { background: #2a200f; }
html[data-theme="forest"] .badge-red { background: #2a0f0f; }

/* ——— Rose Theme ——— */
html[data-theme="rose"] {
  --bg: #1a0f15;
  --surface: #24141d;
  --surface2: #2e1a26;
  --surface3: #3a2030;
  --border: #4e2d40;
  --border-light: #2e1a26;
  --text: #f5e0ec;
  --text-muted: #c48aa8;
  --text-dim: #8a5a72;
  --accent: #f472b6;
  --accent2: #6ee7b7;
  --accent3: #c4b5fd;
  --accent4: #fbbf24;
  --yellow: #fbbf24;
  --red: #fb7185;
}
html[data-theme="rose"] pre { background: #24141d; border-color: #4e2d40; }
html[data-theme="rose"] pre code { color: #f5e0ec; }
html[data-theme="rose"] code { background: #2e1a26; color: #c4b5fd; }
html[data-theme="rose"] .callout { background: #2a1a1a; }
html[data-theme="rose"] .callout-info { background: #1a1525; }
html[data-theme="rose"] .callout-success { background: #15221a; }
html[data-theme="rose"] .callout-danger { background: #2a1015; }
html[data-theme="rose"] .badge-green { background: #152a1a; }
html[data-theme="rose"] .badge-blue { background: #151a2a; }
html[data-theme="rose"] .badge-purple { background: #201530; }
html[data-theme="rose"] .badge-orange { background: #2a200f; }
html[data-theme="rose"] .badge-red { background: #2a1015; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ——— Typography ——— */
h1 { font-size: 2.6em; font-weight: 900; margin-bottom: 0.5rem; letter-spacing: -0.04em; background: linear-gradient(135deg, var(--accent), var(--accent3)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h2 { color: var(--accent); margin: 2.5rem 0 1.2rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); font-size: 1.75em; font-weight: 700; letter-spacing: -0.03em; }
h3 { color: var(--accent3); margin: 1.75rem 0 0.75rem; font-size: 1.35em; font-weight: 600; letter-spacing: -0.02em; }
h4 { color: var(--accent4); margin: 1.25rem 0 0.6rem; font-size: 1.15em; font-weight: 600; }
h5 { color: var(--text-muted); margin: 0.8rem 0 0.4rem; text-transform: uppercase; font-size: 0.82em; letter-spacing: 0.07em; font-weight: 600; }
p  { margin-bottom: 1rem; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent3);
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.87em;
  line-height: 1.6;
}
pre code { background: none; padding: 0; color: var(--text); }

/* ——— Tables ——— */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
td, th { padding: 0.55rem 0.8rem; border: 1px solid var(--border); text-align: left; font-size: 0.92em; }
th { background: var(--surface2); color: var(--accent); font-weight: 600; }
tr:nth-child(even) { background: var(--surface); }

/* ——— Badges ——— */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.78em; font-weight: 600; }
.badge-green  { background: #1a3a2a; color: var(--accent2); }
.badge-blue   { background: #152238; color: var(--accent); }
.badge-purple { background: #231533; color: var(--accent3); }
.badge-orange { background: #2a1f0f; color: var(--accent4); }
.badge-red    { background: #2a1111; color: var(--red); }
html[data-theme="light"] .badge-green  { background: #d1f5d8; }
html[data-theme="light"] .badge-blue   { background: #dbeafe; }
html[data-theme="light"] .badge-purple { background: #ede9fe; }
html[data-theme="light"] .badge-orange { background: #fef3c7; }
html[data-theme="light"] .badge-red    { background: #fee2e2; }

/* ——— Callouts ——— */
.callout         { border-left: 4px solid var(--yellow);   background: #1a1a0f; padding: 1rem; margin: 1rem 0; border-radius: 0 8px 8px 0; }
.callout-info    { border-left-color: var(--accent);       background: #0f1a2a; }
.callout-success { border-left-color: var(--accent2);      background: #0f1a0f; }
.callout-danger  { border-left-color: var(--red);          background: #1a0f0f; }
html[data-theme="light"] .callout         { background: #fffbeb; }
html[data-theme="light"] .callout-info    { background: #eff6ff; }
html[data-theme="light"] .callout-success { background: #f0fdf4; }
html[data-theme="light"] .callout-danger  { background: #fef2f2; }

/* ——— Continue banner ——— */
.continue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #0f1e2e 0%, #121c2b 100%);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.5rem;
  flex-wrap: wrap;
}
.continue-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.continue-banner-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.continue-banner-title {
  font-size: 1em;
  font-weight: 600;
  color: var(--text);
}
.continue-banner-pct {
  font-size: 0.8em;
  color: var(--accent);
}
.continue-banner-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.continue-banner-btn:hover { opacity: 0.85; }
html[data-theme="light"] .continue-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: var(--accent);
}
html[data-theme="light"] .continue-banner-label { color: #6b7280; }
html[data-theme="light"] .continue-banner-title { color: #111827; }
html[data-theme="light"] .continue-banner-btn { color: #fff; }

/* ——— TOC (inside modules) ——— */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; margin: 1.5rem 0; }
.toc ol { padding-left: 1.5rem; }
.toc li { margin: 0.3rem 0; }
.toc a  { color: var(--text-muted); }
.toc a:hover { color: var(--accent); }

/* ——— Misc ——— */
.sep  { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.subtitle { color: var(--text-muted); margin-bottom: 0.7rem; font-size: 1.15em; line-height: 1.6; }
.last-updated { color: var(--text-muted); font-size: 0.82em; margin-bottom: 2rem; opacity: 0.7; font-style: italic; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }

ol { padding-left: 1.5rem; }
ul { padding-left: 1.5rem; }
li { margin: 0.25rem 0; }

/* ============================================
   LEARNING APP LAYOUT
   ============================================ */

/* ——— Top Bar ——— */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 100;
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border), 0 2px 16px rgba(0,0,0,0.18);
}
#topbar > * { flex-shrink: 0; }
#search-wrap { order: 5; }

#topbar .logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.15s;
}
#topbar .logo:hover { opacity: 0.85; text-decoration: none; }
.logo-icon { flex-shrink: 0; }
.logo-text {
  font-weight: 800;
  font-size: 1.1em;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
}
#search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.85rem 0.5rem 2.4rem;
  color: var(--text);
  font-size: 0.9em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,0.1); }
#search-input::placeholder { color: var(--text-dim); }
#search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
#search-results.visible { display: block; }
.search-result {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface2); }
.search-result .res-title { font-weight: 600; font-size: 0.9em; color: var(--text); }
.search-result .res-module { font-size: 0.78em; color: var(--accent); margin-bottom: 0.2rem; }
.search-result .res-excerpt { font-size: 0.82em; color: var(--text-muted); }

/* ——— Reading Progress Bar ——— */
#reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}
#reading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--accent), var(--accent3));
  transition: width 0.1s linear, opacity 0.3s ease;
  opacity: 0;
}
#reading-bar.active #reading-bar-fill {
  opacity: 1;
}

/* ——— Theme Picker ——— */
#theme-picker-wrap {
  position: relative;
  flex-shrink: 0;
}
#theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface2);
}
#theme-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  min-width: 160px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
#theme-dropdown.visible { display: block; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.theme-option:hover {
  background: var(--surface2);
  color: var(--text);
}
.theme-option.active {
  color: var(--accent);
  font-weight: 600;
}
.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}
.theme-section-label {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.4rem 0.65rem 0.15rem;
  font-weight: 700;
}
.theme-section-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.4rem;
}

#menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
}
#menu-btn:hover { background: var(--surface2); }

/* ——— App Shell ——— */
#app {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ——— Sidebar ——— */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.25s ease;
}

.sidebar-module { padding: 0.4rem 0; }
.module-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.module-header:hover { background: var(--surface2); }
.module-header.active { background: var(--surface2); }
.module-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.72em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.module-header.active .module-num,
.module-header.has-progress .module-num {
  background: var(--accent);
  color: var(--bg);
}
.module-title { font-size: 0.87em; font-weight: 600; color: var(--text); flex: 1; }
.module-chevron { color: var(--text-dim); font-size: 0.75em; transition: transform 0.2s; }
.module-header.open .module-chevron { transform: rotate(90deg); }

.module-sections { display: none; padding-bottom: 0.25rem; }
.module-sections.open { display: block; }
.section-link {
  display: block;
  padding: 0.3rem 1rem 0.3rem 2.6rem;
  font-size: 0.8em;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.1s, background 0.1s;
  border-left: 2px solid transparent;
  margin-left: 1px;
}
.section-link:hover { color: var(--accent); background: var(--surface2); }
.section-link.active { color: var(--accent); border-left-color: var(--accent); background: rgba(88,166,255,0.05); }

.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; }

.progress-bar-wrap {
  padding: 0.3rem 1rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.progress-bar-bg {
  flex: 1;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.progress-label { font-size: 0.7em; color: var(--text-dim); white-space: nowrap; }
.reading-time { font-size: 0.68em; color: var(--text-dim); white-space: nowrap; opacity: 0.75; margin-left: auto; }

/* ——— Sidebar Resize Handle ——— */
#sidebar-resize {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: calc(var(--sidebar-w) - 2px);
  width: 4px;
  cursor: col-resize;
  z-index: 60;
  background: transparent;
  transition: background 0.15s;
}
#sidebar-resize:hover,
#sidebar-resize.dragging {
  background: rgba(88, 166, 255, 0.25);
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.3);
}

/* ——— Main Content ——— */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

#content-area {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem 2.5rem;
}

/* ——— Loading state ——— */
#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 0.95em;
}

/* ——— Welcome screen ——— */
#welcome { padding: 3.5rem 0; }
#welcome h2 { border: none; margin-bottom: 0.5rem; }
.module-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.module-card:hover { border-color: var(--card-color, var(--accent)); transform: translateY(-3px); box-shadow: 0 4px 16px rgba(88, 166, 255, 0.12); }
.module-card .card-num { font-size: 0.75em; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.module-card .card-title { font-weight: 700; font-size: 1.2em; margin-bottom: 0.65rem; color: var(--text); letter-spacing: -0.02em; line-height: 1.3; }
.module-card .card-desc { font-size: 0.9em; color: var(--text-muted); line-height: 1.65; }
.module-card .card-topics { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.module-card .topic-tag { background: var(--surface2); color: var(--text-dim); font-size: 0.72em; padding: 2px 7px; border-radius: 10px; }

/* ——— Back to top ——— */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  transition: color 0.15s, border-color 0.15s;
  z-index: 99;
}
#back-to-top:hover { color: var(--accent); border-color: var(--accent); }
#back-to-top.visible { display: flex; }

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 540px) {
  .topbar-nav-btn span { display: none; }
  #topbar-nav { position: static; transform: none; }
}

@media (max-width: 768px) {
  #menu-btn { display: flex; align-items: center; justify-content: center; }
  #topbar-nav { position: static; transform: none; }
  #sidebar {
    transform: translateX(-100%);
    width: min(var(--sidebar-w), 85vw);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-resize { display: none; }
  #main { margin-left: 0; }
  #content-area { padding: 1.5rem 1rem 3rem 1rem; }
  .module-cards { grid-template-columns: 1fr; }
  #back-to-top { bottom: 1rem; right: 1rem; }
}

/* ——— Overlay for mobile sidebar ——— */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}
#sidebar-overlay.visible { display: block; }

/* ============================================
   LEARNING FEATURES — Quiz, Flashcards, Progress
   ============================================ */

/* ——— 3-State Progress Labels ——— */
.progress-label.state-learned {
  color: var(--accent2);
  font-weight: 600;
}
.progress-label.state-read {
  color: var(--accent);
}

/* ——— Quiz Section ——— */
.quiz-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}
.quiz-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.quiz-header h2 {
  border: none;
  margin: 0;
  padding: 0;
  font-size: 1.3em;
}
.quiz-subtitle {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 1.5rem;
}

.quiz-question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.quiz-q-number {
  font-size: 0.75em;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.quiz-q-text {
  font-size: 1.05em;
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.92em;
}
.quiz-option:hover {
  border-color: var(--accent);
  background: var(--surface3);
}
.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.1);
}
.quiz-option.correct {
  border-color: var(--accent2);
  background: rgba(63, 185, 80, 0.12);
}
.quiz-option.incorrect {
  border-color: var(--red);
  background: rgba(248, 81, 73, 0.1);
  opacity: 0.7;
}
.quiz-option.correct-reveal {
  border-color: var(--accent2);
  background: rgba(63, 185, 80, 0.12);
}
.quiz-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.quiz-option.selected .quiz-radio {
  border-color: var(--accent);
}
.quiz-option.selected .quiz-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.quiz-option.correct .quiz-radio {
  border-color: var(--accent2);
  background: var(--accent2);
}
.quiz-option.correct .quiz-radio::after {
  content: '✓';
  color: #0d1117;
  font-size: 10px;
  font-weight: 700;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
}
.quiz-option.incorrect .quiz-radio {
  border-color: var(--red);
}
.quiz-option.incorrect .quiz-radio::after {
  content: '✗';
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
}
.quiz-option.disabled {
  pointer-events: none;
}
.quiz-explanation {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: rgba(63, 185, 80, 0.06);
  border-left: 3px solid var(--accent2);
  border-radius: 0 6px 6px 0;
  font-size: 0.88em;
  color: var(--text-muted);
  line-height: 1.5;
  display: none;
}
.quiz-explanation.visible {
  display: block;
}
.quiz-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
}
.quiz-btn {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.2rem;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.quiz-btn:hover { opacity: 0.85; }
.quiz-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.quiz-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.quiz-btn-secondary:hover {
  border-color: var(--accent);
  opacity: 1;
}

/* Quiz Score Summary */
.quiz-score {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  margin-top: 1.5rem;
}
.quiz-score-number {
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.quiz-score-number.pass { color: var(--accent2); }
.quiz-score-number.fail { color: var(--accent4); }
.quiz-score-label {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 0.75rem;
}
.quiz-score-message {
  font-size: 0.95em;
  margin-bottom: 1rem;
}
.quiz-score-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem auto;
  max-width: 300px;
}
.quiz-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.quiz-score-fill.pass { background: var(--accent2); }
.quiz-score-fill.fail { background: var(--accent4); }

/* ——— Flashcard Mode ——— */
.flashcard-container {
  padding: 2rem 0;
}
.flashcard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.flashcard-filter {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.flashcard-filter-btn {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78em;
  cursor: pointer;
  transition: all 0.15s;
}
.flashcard-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.flashcard-filter-btn.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.flashcard-progress {
  font-size: 0.82em;
  color: var(--text-muted);
}

.flashcard {
  perspective: 800px;
  max-width: 560px;
  margin: 0 auto 1.5rem;
  height: 260px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.flashcard-front {
  background: var(--surface);
}
.flashcard-back {
  background: var(--surface2);
  transform: rotateY(180deg);
}
.flashcard-term {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.flashcard-hint {
  font-size: 0.8em;
  color: var(--text-dim);
}
.flashcard-definition {
  font-size: 1.05em;
  line-height: 1.6;
  color: var(--text);
}
.flashcard-module-tag {
  font-size: 0.72em;
  color: var(--text-dim);
  margin-top: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.flashcard-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.flashcard-btn {
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
}
.flashcard-btn-got-it {
  background: rgba(63, 185, 80, 0.12);
  color: var(--accent2);
  border-color: var(--accent2);
}
.flashcard-btn-got-it:hover { background: rgba(63, 185, 80, 0.22); }
.flashcard-btn-miss {
  background: rgba(248, 81, 73, 0.1);
  color: var(--red);
  border-color: var(--red);
}
.flashcard-btn-miss:hover { background: rgba(248, 81, 73, 0.2); }

.flashcard-done {
  text-align: center;
  padding: 3rem 1rem;
}
.flashcard-done h2 {
  border: none;
  color: var(--accent2);
}
.flashcard-done p {
  color: var(--text-muted);
}

/* ——— Sidebar Flashcard & Stats ——— */
.sidebar-learn-section {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-learn-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82em;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-decoration: none;
}
.sidebar-learn-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.sidebar-stats {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.sidebar-stat {
  font-size: 0.72em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.sidebar-stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.sidebar-stat-dot.read { background: var(--accent); }
.sidebar-stat-dot.learned { background: var(--accent2); }

/* ——— Welcome page learning stats ——— */
.welcome-stats {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.welcome-stat-card {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.welcome-stat-value {
  font-size: 1.8em;
  font-weight: 700;
}
.welcome-stat-value.blue { color: var(--accent); }
.welcome-stat-value.green { color: var(--accent2); }
.welcome-stat-value.purple { color: var(--accent3); }
.welcome-stat-label {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

/* ——— Module card status badges ——— */
.card-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72em;
  font-weight: 600;
  margin-left: 0.5rem;
}
.card-status-read {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
}
.card-status-learned {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent2);
}

html[data-theme="light"] .quiz-option.correct { background: rgba(26, 127, 55, 0.1); }
html[data-theme="light"] .quiz-option.incorrect { background: rgba(207, 34, 46, 0.08); }
html[data-theme="light"] .quiz-explanation { background: rgba(26, 127, 55, 0.06); }
html[data-theme="light"] .flashcard-btn-got-it { background: rgba(26, 127, 55, 0.1); }
html[data-theme="light"] .flashcard-btn-miss { background: rgba(207, 34, 46, 0.08); }

/* ============================================
   TOP-LEVEL NAVIGATION (Learn / News)
   ============================================ */
/* ——— Top Nav (Home / Learn / News) ——— */
#topbar-nav {
  display: flex;
  gap: 0.25rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.topbar-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95em;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.topbar-nav-btn:hover {
  color: var(--text);
  background: var(--surface2);
}
.topbar-nav-btn.active {
  color: var(--accent);
  background: rgba(88,166,255,0.1);
  font-weight: 700;
}
.topbar-nav-btn svg { flex-shrink: 0; width: 17px; height: 17px; }

/* ============================================
   NEWS FEED
   ============================================ */
#news-app {
  display: none;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
#news-app.active { display: block; }
body.news-mode #app { display: none; }
body.news-mode #news-app { display: block; }
body.news-mode #sidebar { display: none; }
body.news-mode #sidebar-resize { display: none; }
body.news-mode #main { margin-left: 0; }

body.home-mode #sidebar { display: none; }
body.home-mode #sidebar-resize { display: none; }
body.home-mode #main { margin-left: 0; }

.news-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 5rem;
}

.news-header {
  margin-bottom: 2rem;
}
.news-header h1 {
  font-size: 2em;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.news-header h1 {
  font-size: 1.6em;
  margin-bottom: 0.3rem;
}
.news-last-updated {
  font-size: 0.8em;
  color: var(--text-dim);
}

/* Highlights strip */
.news-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.news-highlight-card {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  text-decoration: none;
  display: block;
}
.news-highlight-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
}
.news-highlight-label {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.news-highlight-title {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.news-highlight-summary {
  font-size: 0.8em;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Filter bar */
.news-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.news-filter-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.news-filter-label {
  font-size: 0.72em;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.2rem;
  font-weight: 600;
  min-width: 50px;
}
.news-filter-pill {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78em;
  cursor: pointer;
  transition: all 0.15s;
}
.news-filter-pill:hover { border-color: var(--accent); color: var(--text); }
.news-filter-pill.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}

/* Date section */
.news-date-section {
  margin-bottom: 1.5rem;
}
.news-date-heading {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* News card */
.news-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  text-decoration: none;
}
.news-card:hover {
  border-color: var(--accent);
  transform: translateX(2px);
  text-decoration: none;
}
.news-card-body { flex: 1; min-width: 0; }
.news-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.news-card-source {
  font-size: 0.75em;
  color: var(--accent);
  font-weight: 600;
}
.news-card-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-dim);
}
.news-card-date {
  font-size: 0.75em;
  color: var(--text-dim);
}
.news-card-title {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  letter-spacing: -0.015em;
  margin-bottom: 0.4rem;
}
.news-card-summary {
  font-size: 0.92em;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 0.35rem;
}
.news-card-tags {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.news-tag {
  font-size: 0.7em;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.news-tag-category {
  background: var(--surface2);
  color: var(--accent3);
  border: 1px solid var(--border);
}
.news-tag-module {
  background: var(--surface2);
  color: var(--text-dim);
}
.news-tag-trending {
  background: rgba(248, 81, 73, 0.12);
  color: var(--red);
  border: 1px solid var(--red);
}

/* Source tier indicator */
.news-tier {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}
.news-tier-1 { background: var(--accent); }
.news-tier-2 { background: var(--accent3); }
.news-tier-3 { background: var(--accent4); }
.news-tier-4 { background: var(--text-dim); }

/* Pagination */
.news-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.news-pagination-top {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.news-page-info {
  font-size: 0.78em;
  color: var(--text-dim);
}
.news-page-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.news-page-btn {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.15s;
}
.news-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.news-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.news-page-nums {
  display: flex;
  gap: 0.25rem;
}
.news-page-num {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 0.82em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.news-page-num:hover { border-color: var(--border); color: var(--text); }
.news-page-ellipsis { color: var(--text-dim); font-size: 0.9em; padding: 0 0.25rem; display: flex; align-items: center; }
.news-page-num.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  font-weight: 700;
}

/* Empty state */
.news-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ============================================
   FOOTER
   ============================================ */
#site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 2rem 1.5rem;
  margin-top: 2rem;
}
body.news-mode #site-footer { margin-left: 0; }
.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}
.footer-brand {
  margin-bottom: 0.75rem;
}
.footer-logo {
  font-weight: 700;
  font-size: 0.95em;
  color: var(--text);
  letter-spacing: -0.02em;
}
.footer-by {
  font-size: 0.82em;
  color: var(--text-dim);
  margin-left: 0.3rem;
}
.footer-by a {
  color: var(--accent);
  text-decoration: none;
}
.footer-by a:hover { text-decoration: underline; }
.footer-links {
  margin-bottom: 0.6rem;
}
.footer-links a {
  font-size: 0.78em;
  color: var(--text-muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-sep {
  color: var(--text-dim);
  margin: 0 0.5rem;
  font-size: 0.78em;
}
.footer-note {
  font-size: 0.72em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.footer-copy {
  font-size: 0.7em;
  color: var(--text-dim);
  opacity: 0.7;
}

@media (max-width: 768px) {
  .news-container { padding: 1.5rem 1rem 3rem; }
  .news-highlights { grid-template-columns: 1fr; }
}
