/* ============================================================
   Python Notes — Learning Platform Stylesheet
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --bg-sidebar: #101828;
  --bg-card: #ffffff;
  --bg-code: #0f172a;
  --border: #e4e7ef;
  --border-soft: #eef0f6;
  --text: #1f2430;
  --text-muted: #5b6478;
  --text-sidebar: #cbd5e1;
  --text-sidebar-muted: #8896a8;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-border: #c7d2fe;
  --success: #16a34a;
  --success-soft: #e9f9ef;
  --warning: #b45309;
  --warning-soft: #fef5e7;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e6f6fa;
  --purple: #7c3aed;
  --purple-soft: #f3ecfe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 4px 6px -1px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .15);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, .15);
  margin-bottom: 16px;
}

.sidebar-brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 18px;
}

.sidebar-brand .name { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.25; }
.sidebar-brand .sub { font-size: 11px; color: var(--text-sidebar-muted); letter-spacing: .04em; text-transform: uppercase; }

.sidebar-progress {
  padding: 14px 20px 6px;
}

.sidebar-progress .progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sidebar);
  margin-bottom: 6px;
}

.sidebar-progress .progress-top span:last-child { color: #a5b4fc; }

.progress-bar {
  height: 8px;
  background: #1e293b;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 99px;
  transition: width .4s ease;
}

.sidebar-progress .progress-note {
  font-size: 11px;
  color: var(--text-sidebar-muted);
  margin-top: 6px;
}

.sidebar-nav { padding: 6px 12px; }

.sidebar-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-sidebar-muted);
  padding: 10px 10px 6px;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-sidebar);
  font-size: 13.5px;
  line-height: 1.35;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: rgba(148, 163, 184, .12); color: #fff; text-decoration: none; }

.nav-link .num {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  width: 26px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.nav-link.active {
  background: rgba(99, 102, 241, .18);
  color: #fff;
}

.nav-link.active .num { color: #a5b4fc; }

.nav-link.done { color: #94a3b8; }
.nav-link.done .num { color: #34d399; }
.nav-link.done::after {
  content: "✓";
  margin-left: auto;
  color: #34d399;
  font-weight: 700;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 80px;
}

.content {
  max-width: 860px;
  margin: 0 auto;
}

/* ---------- Top bar / mobile ---------- */

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-sidebar);
  color: #fff;
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
}

.topbar .menu-btn {
  background: none;
  border: 1px solid rgba(148,163,184,.4);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}

/* ---------- Home page ---------- */

.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4f46e5 100%);
  color: #fff;
  border-radius: 18px;
  padding: 40px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
}

.hero .badge {
  display: inline-block;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero h1 { margin: 0 0 10px; font-size: 34px; line-height: 1.25; font-weight: 800; }
.hero p { margin: 0; font-size: 16.5px; color: #dbe4ff; max-width: 620px; }

.hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.hero-stats .stat .v { font-size: 22px; font-weight: 800; }
.hero-stats .stat .l { font-size: 12.5px; color: #aab8ff; }

.home-section { margin-bottom: 36px; }

.home-section h2 {
  font-size: 21px;
  margin: 0 0 14px;
  color: var(--text);
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.roadmap-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform .15s, box-shadow .15s;
}

.roadmap-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.roadmap-card .rm-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.roadmap-card .rm-title { font-weight: 700; font-size: 15.5px; line-height: 1.4; }
.roadmap-card .rm-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

.roadmap-card.done-card .rm-num::after { content: " ✓"; color: var(--success); }

.learning-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.learning-steps .step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.learning-steps .step .n { color: var(--accent); font-weight: 800; margin-right: 4px; }

/* ---------- Topic header ---------- */

.topic-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.topic-header .crumbs {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.topic-header .crumbs a { color: var(--text-muted); }
.topic-header .crumbs a:hover { color: var(--accent); }

.topic-header h1 { margin: 0 0 12px; font-size: 27px; line-height: 1.3; }

.topic-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--text);
}

.meta-chip .lbl { color: var(--text-muted); font-size: 12px; }

.meta-chip.bad { background: var(--success-soft); border-color: #b9e4c6; }
.meta-chip.time { background: var(--info-soft); border-color: #b4e2ec; }
.meta-chip.prereq { background: var(--purple-soft); border-color: #d9c7f7; }

/* ---------- Content blocks ---------- */

.topic-body h2 {
  font-size: 22px;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-soft);
}

.topic-body h3 { font-size: 18px; margin: 28px 0 10px; }
.topic-body h4 { font-size: 16px; margin: 22px 0 8px; color: var(--text); }

.topic-body p { margin: 12px 0; }

.topic-body ul, .topic-body ol { margin: 10px 0; padding-left: 24px; }
.topic-body li { margin: 6px 0; }
.topic-body li::marker { color: var(--accent); }

strong { color: var(--text); }
code.inline, .topic-body code:not(pre code) {
  font-family: var(--font-mono);
  background: #eef0f8;
  color: #4338ca;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .88em;
}

.hl-term { background: var(--accent-soft); border: 1px solid var(--accent-border); color: #3730a3; }

/* ---------- Callout boxes ---------- */

.callout {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 18px 0;
  border-left: 5px solid;
  line-height: 1.65;
}

.callout .callout-title {
  font-weight: 800;
  font-size: 14.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout p { margin: 8px 0; }
.callout p:first-of-type { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout code:not(pre code) { background: rgba(0,0,0,.06); }

.callout.concept { background: var(--info-soft); border-color: #0e7490; }
.callout.concept .callout-title { color: #0e7490; }

.callout.deepdive { background: var(--purple-soft); border-color: #7c3aed; }
.callout.deepdive .callout-title { color: #7c3aed; }

.callout.codeexample { background: #f4f6ff; border-color: #4f46e5; }
.callout.codeexample .callout-title { color: #4f46e5; }

.callout.warning { background: var(--warning-soft); border-color: #d97706; }
.callout.warning .callout-title { color: #b45309; }

.callout.mistake { background: var(--danger-soft); border-color: #dc2626; }
.callout.mistake .callout-title { color: #dc2626; }

.callout.think { background: #eef6ec; border-color: #15803d; }
.callout.think .callout-title { color: #15803d; }

.callout.practice { background: #fff7ed; border-color: #ea580c; }
.callout.practice .callout-title { color: #ea580c; }

.callout.tip { background: #f0fdf4; border-color: #22c55e; }
.callout.tip .callout-title { color: #15803d; }

/* ---------- Code blocks ---------- */

pre {
  background: var(--bg-code);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 14px 0;
  font-size: 14px;
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}

pre code { background: none; color: inherit; padding: 0; font-family: var(--font-mono); }

.code-wrap { position: relative; }

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}

.code-wrap:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

.output {
  background: #06283d;
  border-left: 4px solid #0ea5e9;
  border-radius: 0 10px 10px 0;
  color: #bae6fd;
  padding: 14px 18px;
  margin: 14px 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow-x: auto;
}

.output .prompt { color: #7dd3fc; user-select: none; }

/* Syntax highlighting tokens */
.tok-kw { color: #c792ea; font-weight: 600; }
.tok-bif { color: #82aaff; }
.tok-str { color: #c3e88d; }
.tok-num { color: #f78c6c; }
.tok-com { color: #6b7280; font-style: italic; }
.tok-fn { color: #82aaff; }
.tok-dec { color: #f07178; }

/* ---------- Tables ---------- */

.topic-body table, .data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14.5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.topic-body th, .data-table th {
  background: var(--accent-soft);
  color: #3730a3;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--accent-border);
}

.topic-body td, .data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.topic-body tr:last-child td, .data-table tr:last-child td { border-bottom: none; }
.topic-body tbody tr:hover, .data-table tbody tr:hover { background: #fafbff; }

.table-wrap { overflow-x: auto; }

/* ---------- Concept cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.concept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.concept-card h4 { margin: 0 0 6px; font-size: 15px; }
.concept-card p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

.concept-card.c1 { border-top-color: #4f46e5; }
.concept-card.c2 { border-top-color: #0ea5e9; }
.concept-card.c3 { border-top-color: #f59e0b; }
.concept-card.c4 { border-top-color: #10b981; }

/* ---------- Dry run table ---------- */

.dryrun caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 0;
  color: var(--text);
}

.dryrun th { background: var(--bg-code); color: #e2e8f0; border-color: #334155; }
.dryrun td { font-family: var(--font-mono); font-size: 13.5px; }
.dryrun .hlrow td { background: var(--accent-soft); }

/* ---------- Practice questions ---------- */

.practice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.q-cat {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 99px;
  padding: 3px 11px;
  margin-bottom: 10px;
}

.q-text { font-size: 15px; margin: 0 0 12px; }

.q-code { font-size: 13.5px; }

.q-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.q-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: var(--font-sans);
}

.q-btn:hover { border-color: var(--accent); color: var(--accent); }
.q-btn.open { background: var(--accent); border-color: var(--accent); color: #fff; }

.q-reveal {
  display: none;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px dashed var(--border);
  font-size: 14.5px;
}

.q-reveal.show { display: block; animation: fadein .25s ease; }

.q-reveal.hint-r { background: var(--warning-soft); border-color: #f3d9a8; }
.q-reveal.solution-r { background: var(--success-soft); border-color: #b9e4c6; }
.q-reveal.explain-r { background: var(--info-soft); border-color: #b4e2ec; }

@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Flow diagram ---------- */

.flow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
  overflow-x: auto;
}

.flow .flow-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; }

.flow-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
}

.flow-box {
  background: var(--accent-soft);
  border: 2px solid var(--accent-border);
  color: #3730a3;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}

.flow-box.decision { border-radius: 16px; background: var(--warning-soft); border-color: #f3d9a8; color: #92400e; }
.flow-box.out { background: var(--success-soft); border-color: #b9e4c6; color: #14532d; }
.flow-box.action { background: var(--info-soft); border-color: #b4e2ec; color: #155e75; }
.flow-box.err { background: var(--danger-soft); border-color: #f3c1c1; color: #7f1d1d; }

.flow-arrow { text-align: center; color: var(--text-muted); font-size: 15px; line-height: 1; }

.flow-horizontal {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
}

.flow-horizontal .flow-col { flex-direction: row; align-items: center; gap: 0; }
.flow-horizontal .flow-col .flow-box { white-space: nowrap; }
.flow-horizontal .flow-arrow { padding: 0 8px; align-self: center; }

/* ---------- Level boxes ---------- */

.level-box {
  border-left: 4px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 18px 12px;
  margin: 20px 0 8px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.level-box.l1 { border-left-color: #10b981; }
.level-box.l2 { border-left-color: #0ea5e9; }
.level-box.l3 { border-left-color: #f59e0b; }
.level-box.l4 { border-left-color: #ef4444; }

.level-box .lv {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.level-box.l1 .lv { color: #059669; }
.level-box.l2 .lv { color: #0284c7; }
.level-box.l3 .lv { color: #d97706; }
.level-box.l4 .lv { color: #dc2626; }

/* ---------- Buttons / navigation ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background .15s, transform .1s;
  text-decoration: none;
}

.btn:hover { background: #4338ca; text-decoration: none; color: #fff; transform: translateY(-1px); }
.btn:active { transform: none; }

.btn.ghost { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.success { background: var(--success); }
.btn.success:hover { background: #15803d; }
.btn.success.done { background: #bbf7d0; color: #14532d; }

.topic-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.topic-nav .spacer { flex: 1; }

.nav-prev-next {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .15s, color .15s;
}

.mini-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.mini-link .cap { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.mini-link .dir { font-weight: 700; }
.mini-link.disabled { opacity: .4; pointer-events: none; }

/* ---------- Progress summary ---------- */

.progress-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.progress-summary .big { font-size: 24px; font-weight: 800; color: var(--accent); }
.progress-summary .small { font-size: 13px; color: var(--text-muted); }

/* ---------- Misc ---------- */

.divider { border: none; border-top: 2px solid var(--border-soft); margin: 32px 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: #3730a3;
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

footer.page-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 30;
}

.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 45; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .mobile-overlay.show { display: block; }
  .main { padding: 20px 18px 60px; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 26px; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .topic-header { padding: 20px; }
  .topic-header h1 { font-size: 22px; }
  .topic-nav { flex-direction: column; align-items: stretch; }
  .topic-nav .spacer { display: none; }
  .hero-stats { gap: 18px; }
}
