/* Python for AI Lab
   Direction: a study workbench. Quiet teal ink on cool paper, with one saffron
   "highlighter" colour that marks where you are and what to do next (Run, Continue,
   the current lesson). The 3-part lab meter is the recurring signature element.
   Type: Bricolage Grotesque for headings, Atkinson Hyperlegible (designed for
   readability) for everything people read, JetBrains Mono only inside code.
   Layout: course map on the left, one lesson at a time on the right; the lesson
   "why it matters" note sits in the margin beside the text on wide screens. */

:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #e8efed;
  --ink: #13292b;
  --muted: #4d6264;
  --line: #d2dddb;
  --primary: #0e6b66;
  --primary-ink: #ffffff;
  --highlight: #f5c842;
  --highlight-soft: #fcf0c4;
  --highlight-ink: #2e2400;
  --code-bg: #0f2426;
  --code-fg: #e3eeec;
  --code-muted: #7d9794;
  --code-line: #20393b;
  --ok: #1d7a4c;
  --ok-soft: #dcf0e5;
  --bad: #b0352e;
  --bad-soft: #f8e2df;
  --lvl-b: #23845a;
  --lvl-i: #a96b12;
  --lvl-a: #5552c4;
  --shadow: 0 1px 2px rgba(19, 41, 43, 0.06), 0 8px 24px rgba(19, 41, 43, 0.06);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, Consolas, monospace;

  /* type scale (px): 13 · 15 · 17 · 21 · 26 · 34 · 44 */
  --t-xs: 0.8125rem; --t-sm: 0.9375rem; --t-md: 1.0625rem; --t-lg: 1.3125rem;
  --t-xl: 1.625rem; --t-2xl: 2.125rem; --t-3xl: 2.75rem;
  --radius-lg: 16px; --radius: 10px; --radius-sm: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1819; --surface: #122224; --surface-2: #19302f; --ink: #e4efed; --muted: #95aca9;
    --line: #253b3c; --primary: #5cc4ba; --primary-ink: #062221;
    --highlight: #f5c842; --highlight-soft: #3a3213; --highlight-ink: #2a2000;
    --code-bg: #081415; --code-fg: #e3eeec; --code-muted: #6f8986; --code-line: #1b3133;
    --ok: #5bcb8f; --ok-soft: #12301f; --bad: #ff8a80; --bad-soft: #3b1816;
    --lvl-b: #5bcb8f; --lvl-i: #e8aa4b; --lvl-a: #a09cf2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1819; --surface: #122224; --surface-2: #19302f; --ink: #e4efed; --muted: #95aca9;
  --line: #253b3c; --primary: #5cc4ba; --primary-ink: #062221;
  --highlight: #f5c842; --highlight-soft: #3a3213; --highlight-ink: #2a2000;
  --code-bg: #081415; --code-fg: #e3eeec; --code-muted: #6f8986; --code-line: #1b3133;
  --ok: #5bcb8f; --ok-soft: #12301f; --bad: #ff8a80; --bad-soft: #3b1816;
  --lvl-b: #5bcb8f; --lvl-i: #e8aa4b; --lvl-a: #a09cf2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--t-md); line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--primary); }
code { font-family: var(--font-code); font-size: 0.86em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; border-radius: 4px; }
svg.icon { width: 18px; height: 18px; flex: none; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: #0e6b66; /* fixed brand tile, same in both themes */ display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { font-family: var(--font-display); font-weight: 800; font-size: var(--t-lg); letter-spacing: -0.02em; line-height: 1; }
.brand small { display: block; color: var(--muted); font-size: var(--t-xs); margin-top: 3px; }
.status { display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--lvl-i); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lvl-i) 25%, transparent); }
.status.ready i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.top-progress { display: flex; align-items: center; gap: 10px; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { width: 120px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .5s ease; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.theme-toggle button { border: 0; background: transparent; width: 32px; height: 28px; border-radius: 99px; display: grid; place-items: center; color: var(--muted); }
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.theme-toggle svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); padding: 9px 16px; font-weight: 700; font-size: var(--t-sm);
  border: 1px solid transparent; line-height: 1.2; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, var(--ink)); }
.btn-highlight { background: var(--highlight); color: var(--highlight-ink); }
.btn-highlight:hover { background: color-mix(in srgb, var(--highlight) 88%, #000); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--primary); color: var(--primary); }
.btn-text { background: transparent; color: var(--ink); border-color: var(--line); padding: 7px 12px; font-weight: 400; }
.btn-text:hover { border-color: var(--primary); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 28px; max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }
main { min-width: 0; }

/* course map */
.map { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
.map details > summary { display: none; }
.map-group { margin-bottom: 20px; }
.map-group h3 { font-family: var(--font-body); font-size: var(--t-xs); font-weight: 700; color: var(--c, var(--muted)); margin: 0 0 6px 10px; letter-spacing: 0.01em; }
.map a {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: var(--t-sm); line-height: 1.3;
}
.map a:hover { background: var(--surface-2); }
.map a[aria-current="page"] { background: var(--highlight-soft); font-weight: 700; }
.num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.num.done { background: var(--ok); color: var(--surface); }
.map a[aria-current="page"] .num:not(.done) { background: var(--highlight); color: var(--highlight-ink); }

/* the 3-part lab meter: the signature element */
.meter3 { display: inline-grid; grid-template-columns: repeat(3, 10px); gap: 3px; }
.meter3 i { height: 5px; border-radius: 3px; background: var(--line); }
.meter3 i.on { background: var(--ok); }
.meter3.lg { grid-template-columns: repeat(3, 22px); gap: 4px; }
.meter3.lg i { height: 6px; }

/* ---------- lesson page ---------- */
.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: clamp(22px, 4vw, 44px); display: grid; gap: 26px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: var(--t-sm); color: var(--muted); }
.level { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--c); }
.level::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.meta .labs-count { display: inline-flex; align-items: center; gap: 8px; }
.page h1 { font-size: clamp(1.9rem, 4.2vw, var(--t-3xl)); font-weight: 800; letter-spacing: -0.03em; }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; }
.prose { display: grid; gap: 14px; max-width: 66ch; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.why { border-left: 2px solid var(--primary); padding: 2px 0 2px 16px; display: grid; gap: 6px; font-size: var(--t-sm); color: var(--muted); }
.why h2 { font-family: var(--font-body); font-size: var(--t-sm); font-weight: 700; color: var(--primary); letter-spacing: 0; }
@media (max-width: 1080px) { .lesson-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; } .why { order: -1; max-width: 66ch; } }

/* lab tabs */
.labs { display: grid; }
.lab-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 12px; }
.lab-tab {
  background: transparent; border: 0; border-radius: 8px; padding: 10px 14px; text-align: left;
  display: grid; gap: 2px; color: var(--muted); min-width: 0;
}
.lab-tab small { font-size: var(--t-xs); display: flex; align-items: center; gap: 6px; }
.lab-tab span { font-weight: 700; font-size: var(--t-sm); color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-tab:hover { color: var(--ink); }
.lab-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.lab-tab .tick { color: var(--ok); display: inline-flex; }
.lab-tab .tick svg { width: 14px; height: 14px; }
@media (max-width: 620px) { .lab-tabs { grid-template-columns: 1fr; } .lab-tab span { white-space: normal; } }
.lab-panel { display: grid; gap: 16px; padding-top: 18px; }

.task { display: grid; gap: 8px; padding: 18px 20px; border-radius: 12px; background: var(--highlight-soft); }
.task-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.task h2 { font-size: var(--t-lg); font-weight: 800; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 700; color: var(--ok); }
.badge svg { width: 14px; height: 14px; }

/* code bench (dark in both themes) */
.bench { border-radius: 12px; overflow: hidden; background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--code-line); }
.bench-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--code-line); }
.bench-bar .file { font-family: var(--font-code); font-size: 0.78rem; color: var(--code-muted); margin-right: auto; }
.run { display: inline-flex; align-items: center; gap: 7px; background: var(--highlight); color: var(--highlight-ink); border: 0; border-radius: 8px; padding: 7px 16px; font-weight: 700; font-size: var(--t-sm); }
.run svg { width: 14px; height: 14px; }
.run:hover { background: color-mix(in srgb, var(--highlight) 88%, #fff); }
.run:disabled { opacity: .6; cursor: wait; }
.code-btn { background: transparent; border: 1px solid var(--code-line); color: var(--code-fg); border-radius: 8px; padding: 6px 12px; font-size: var(--t-xs); }
.code-btn:hover { border-color: var(--code-muted); }
.editor { display: grid; grid-template-columns: auto minmax(0, 1fr); font-family: var(--font-code); font-size: 0.875rem; line-height: 1.65; }
.gutter { padding: 14px 10px 14px 14px; color: var(--code-muted); text-align: right; user-select: none; white-space: pre; font-variant-numeric: tabular-nums; opacity: .8; }
.gutter .err { color: #ff8a80; font-weight: 600; opacity: 1; }
.editor textarea {
  width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--code-fg); caret-color: var(--highlight);
  font: inherit; line-height: inherit; padding: 14px 14px 14px 6px; white-space: pre; overflow-x: auto; overflow-y: hidden; tab-size: 4;
}
.editor textarea:focus-visible { outline: none; box-shadow: inset 2px 0 0 var(--highlight); border-radius: 0; }
.inputs { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--code-line); font-size: var(--t-xs); color: var(--code-muted); }
.inputs input { flex: 1 1 220px; min-width: 0; background: rgba(255,255,255,.05); color: var(--code-fg); border: 1px solid var(--code-line); border-radius: 6px; padding: 7px 10px; font-family: var(--font-code); font-size: 0.85rem; }
.console { border-top: 1px solid var(--code-line); background: rgba(255,255,255,0.025); }
.console-head { font-size: var(--t-xs); color: var(--code-muted); padding: 9px 14px 0; }
.console pre { margin: 0; padding: 6px 14px 16px; font-family: var(--font-code); font-size: 0.86rem; white-space: pre-wrap; word-break: break-word; min-height: 3.2em; color: #cdeee4; }
.console pre .placeholder { color: var(--code-muted); }
.console pre .errline { color: #ff9e95; }
.explain { margin: 0 14px 14px; background: #2b1716; border: 1px solid #5b2a26; color: #ffdcd8; border-radius: 8px; padding: 10px 14px; font-family: var(--font-body); font-size: var(--t-sm); line-height: 1.5; }
.explain b { color: #fff; }
.explain code { background: rgba(255,255,255,.08); color: #fff; }

.check-row { display: grid; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { background: var(--surface-2); border-radius: var(--radius); padding: 12px 16px; font-size: var(--t-sm); }
.result { border-radius: var(--radius); padding: 11px 16px; font-weight: 700; font-size: var(--t-sm); display: flex; gap: 10px; align-items: flex-start; }
.result svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.result.ok { background: var(--ok-soft); color: var(--ok); }
.result.bad { background: var(--bad-soft); color: var(--bad); }
.takeaway { font-size: var(--t-sm); color: var(--muted); }
.lesson-done { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 12px 16px; font-weight: 700; }

.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--line); }
.pager .btn { flex-direction: column; align-items: flex-start; gap: 0; max-width: 48%; text-align: left; }
.pager .btn small { font-weight: 400; font-size: var(--t-xs); opacity: .8; }
.pager .next { margin-left: auto; align-items: flex-end; text-align: right; }

/* ---------- home dashboard ---------- */
.home { display: grid; gap: 22px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.25rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.hero p { color: var(--muted); max-width: 52ch; font-size: var(--t-md); }
.hero-copy { display: grid; gap: 16px; align-content: start; }
.continue { background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-lg); padding: 22px; display: grid; gap: 14px; }
.continue .label { color: var(--code-muted); font-size: var(--t-sm); }
.continue h2 { font-size: var(--t-xl); font-weight: 800; color: #fff; }
.continue .sub { color: var(--code-muted); font-size: var(--t-sm); }
.continue .btn { justify-self: start; }
.continue pre { margin: 0; font-family: var(--font-code); font-size: 0.8rem; color: #cdeee4; background: rgba(255,255,255,.04); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lvl-progress { display: grid; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.lvl-progress header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lvl-progress header span { font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.lvl-progress .track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lvl-progress .track i { display: block; height: 100%; background: var(--c); border-radius: 99px; transition: width .5s ease; }
.lvl-progress p { font-size: var(--t-sm); color: var(--muted); }
@media (max-width: 760px) { .summary { grid-template-columns: minmax(0, 1fr); } }

.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-title h2 { font-size: var(--t-xl); font-weight: 800; }
.section-title p { color: var(--muted); font-size: var(--t-sm); }

.path { display: grid; gap: 18px; }
.path-level { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: start; }
.path-level > h3 { font-size: var(--t-md); color: var(--c); padding-top: 12px; }
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.station {
  display: grid; grid-template-columns: 30px 1fr; gap: 4px 10px; align-items: center; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, background-color .15s ease;
}
.station:hover { border-color: var(--c); }
.station .num { width: 30px; height: 30px; grid-row: span 2; }
.station b { font-size: var(--t-sm); line-height: 1.25; }
.station .meter3 { grid-column: 2; }
.station.current { border-color: var(--highlight); background: var(--highlight-soft); }
@media (max-width: 760px) { .path-level { grid-template-columns: minmax(0, 1fr); gap: 8px; } .path-level > h3 { padding-top: 0; } }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-size: var(--t-sm); display: grid; gap: 4px; }
.steps li::before { content: counter(s); font-family: var(--font-display); font-weight: 800; font-size: var(--t-xl); color: var(--primary); line-height: 1; }
@media (max-width: 860px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.skills div { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: var(--t-sm); }

/* ---------- training playground ---------- */
.sim { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 14px; background: var(--bg); }
.sim h2 { font-size: var(--t-lg); font-weight: 800; }
.sim-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .sim-grid { grid-template-columns: minmax(0, 1fr); } }
.sim canvas { width: 100%; height: auto; aspect-ratio: 16 / 10; max-width: 100%; display: block; background: var(--surface); border-radius: 8px; border: 1px solid var(--line); }
.sim label { display: grid; gap: 2px; font-size: var(--t-sm); color: var(--muted); }
.sim label output { font-family: var(--font-code); color: var(--ink); font-size: var(--t-sm); }
.sim input[type=range] { width: 100%; accent-color: var(--primary); }
.sim-meter { font-family: var(--font-display); font-size: var(--t-2xl); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.sim-meter small { display: block; font-family: var(--font-body); font-size: var(--t-xs); color: var(--muted); font-weight: 400; margin-top: 4px; }
.sim-controls { display: grid; gap: 12px; }

/* ---------- glossary drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(6, 16, 17, 0.5); display: flex; justify-content: flex-end; }
.drawer-panel { width: min(440px, 100%); height: 100%; background: var(--surface); padding: calc(24px + env(safe-area-inset-top, 0px)) 22px calc(24px + env(safe-area-inset-bottom, 0px)); overflow: auto; display: grid; gap: 14px; align-content: start; border-left: 1px solid var(--line); }
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; }
.drawer-panel h2 { font-size: var(--t-xl); font-weight: 800; }
.drawer dl { margin: 0; display: grid; gap: 14px; }
.drawer dt { font-weight: 700; display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.drawer dt span { font-size: var(--t-xs); font-weight: 400; color: var(--c); }
.drawer dd { margin: 2px 0 0; color: var(--muted); font-size: var(--t-sm); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .inner { max-width: 1280px; margin: 0 auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; }
.powered { font-size: var(--t-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.powered strong { font-family: var(--font-display); font-weight: 800; color: var(--ink); font-size: var(--t-md); letter-spacing: -0.01em; }
.powered::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--highlight); }
.site-footer .fine { font-size: var(--t-xs); color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .map { position: static; max-height: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 8px; }
  .map details > summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 10px 6px; font-weight: 700; list-style: none; }
  .map details > summary::-webkit-details-marker { display: none; }
  .map details:not([open]) .map-body { display: none; }
  .bar { width: 80px; }
  .brand small, .status span { display: none; }
}
@media (max-width: 640px) {
  .top-inner { gap: 10px; padding: 8px 16px; }
  .top-progress { display: none; }
  .brand b { font-size: var(--t-md); }
  .theme-toggle button { width: 28px; }
  #openGlossary .lbl { display: none; }
  #openGlossary { padding: 7px 9px; }
}
@media (max-width: 520px) {
  .page { padding: 20px 16px; border-radius: 12px; }
  .pager .btn { max-width: 100%; width: 100%; }
  .pager .next { align-items: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
