/* ============================================================
   The Rusty School design system
   Warm, dark-by-default, rust-orange accents. Light mode via
   [data-theme="light"] on <html>.
   ============================================================ */

:root {
  --bg: #191310;
  --bg-soft: #211a15;
  --surface: #271f19;
  --surface-2: #2f251d;
  --border: #3d3026;
  --text: #f4ebe2;
  --text-muted: #b9a897;
  --accent: #f74c00;
  --accent-bright: #ff6a26;
  --accent-soft: #ffb454;
  --green: #8fce5f;
  --red: #ff6b6b;
  --blue: #6fb7ff;
  --code-bg: #14100d;
  --code-border: #33281f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* syntax colors */
  --tok-kw: #ff7b4f;
  --tok-str: #a5d68a;
  --tok-com: #8a7a6b;
  --tok-mac: #ffb454;
  --tok-typ: #7fc8e8;
  --tok-num: #d8a7f0;
  --tok-fn: #f0d27a;
  --tok-life: #f79bd3;
  --tok-attr: #9a8a7a;
}

/* Primary-button colors are deliberately independent of the accent
   palette: the accent orange is bright enough that white text on it
   falls below the WCAG AA contrast minimum. These darker values keep
   the button unmistakably orange while passing at 4.9:1. */
:root {
  --btn-grad-a: #c23b00;
  --btn-grad-b: #cc3f00;
}

[data-theme="light"] {
  --bg: #faf5ef;
  --bg-soft: #f3ebe2;
  --surface: #ffffff;
  --surface-2: #f7efe6;
  --border: #e3d6c6;
  --text: #2c211a;
  --text-muted: #71604f;
  --accent: #d63c00;
  --accent-bright: #cc3f00;
  --accent-soft: #b96a00;
  --green: #457e1c;
  --red: #c92a2a;
  --blue: #1971c2;
  --code-bg: #241c15;
  --code-border: #3a2d21;
  --shadow: 0 10px 30px rgba(90, 60, 30, 0.12);
  --tok-com: #93836f;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16.5px;
  transition: background 0.25s ease, color 0.25s ease;
}
img, svg { max-width: 100%; }
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); margin: 0.2em 0 0.4em; }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); margin: 2.2em 0 0.6em; }
h3 { font-size: 1.18rem; margin: 1.8em 0 0.5em; }
p { margin: 0.8em 0; }
::selection { background: var(--accent); color: #fff; }

.container { max-width: 1060px; margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 820px; }

/* ---------- keyboard accessibility ----------
   Everything interactive must show where focus is. :focus-visible means
   mouse users never see a ring they did not ask for, while keyboard and
   switch users always know their position. */
:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 4px;
}
[data-theme="light"] :focus-visible { outline-color: var(--accent); }

/* Skip link: first thing a keyboard user reaches, so they can jump past
   the nav instead of tabbing through it on all thirty-odd pages. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--accent); border-radius: 0 0 var(--radius-sm) 0;
  padding: 12px 20px; font-weight: 700; text-decoration: none;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 18px;
  height: 62px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.06rem; color: var(--text);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo img { width: 40px; height: 28px; }
.logo .crate { color: var(--accent-bright); }
.main-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.main-nav a {
  color: var(--text-muted); font-weight: 600; font-size: 0.94rem;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a.active { color: var(--accent-bright); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.theme-toggle {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; font-size: 1rem; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.theme-toggle:hover { border-color: var(--accent); }
.nav-burger {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 1.2rem;
  width: 38px; height: 36px; cursor: pointer;
}
@media (max-width: 960px) {
  .nav-burger { display: block; margin-left: auto; }
  .main-nav {
    display: none; position: absolute; top: 62px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    padding: 10px 16px 14px; margin: 0;
  }
  .main-nav.open { display: flex; }
  .theme-toggle { margin-left: 0; }
}

/* ---------- hero ---------- */
.hero { padding: 64px 0 30px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 30px; align-items: center; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { order: -1; max-width: 240px; margin: 0 auto; } }
.kicker {
  display: inline-block; font-weight: 700; font-size: 0.82rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-soft); margin-bottom: 8px;
}
.hero h1 .grad, .grad {
  background: linear-gradient(92deg, var(--accent-bright), var(--accent-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 1.16rem; color: var(--text-muted); max-width: 34em; }
.hero-art { text-align: center; }
.hero-art img { width: min(320px, 80%); filter: drop-shadow(0 18px 30px rgba(247, 76, 0, 0.25)); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { .hero-art img { animation: none; } }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.98rem;
  padding: 12px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(92deg, var(--btn-grad-a), var(--btn-grad-b));
  color: #fff; box-shadow: 0 6px 18px rgba(247, 76, 0, 0.35);
}
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-small { padding: 8px 16px; font-size: 0.88rem; }

/* ---------- sections & cards ---------- */
.section { padding: 34px 0; }
.section-head { max-width: 640px; margin-bottom: 18px; }
.section-head p { color: var(--text-muted); }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid.cols-3, .grid.cols-2, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card h3 { margin-top: 0.2em; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0; }
.card .emoji { font-size: 1.7rem; display: block; margin-bottom: 6px; }
a.card { display: block; color: var(--text); }
a.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }

/* showcase logos/names */
.chip-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 10px 0; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 5px 13px; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
  color: var(--text);
}
.chip small { color: var(--text-muted); font-weight: 500; }
a.chip { color: var(--text); }
a.chip:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; font-size: 0.74rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; vertical-align: middle;
}
.badge.l0 { background: rgba(216, 167, 240, 0.16); color: var(--tok-num); }
.badge.l1 { background: rgba(143, 206, 95, 0.16); color: var(--green); }
.badge.l2 { background: rgba(255, 180, 84, 0.16); color: var(--accent-soft); }
.badge.l3 { background: rgba(111, 183, 255, 0.16); color: var(--blue); }

/* ---------- code ---------- */
code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0.12em 0.38em; border-radius: 6px;
}
pre {
  position: relative;
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: var(--radius-sm); padding: 16px 18px;
  overflow-x: auto; line-height: 1.55; margin: 1.1em 0;
}
pre code {
  background: none; border: none; padding: 0;
  font-size: 0.86rem; color: #e8ddd0; display: block; min-width: max-content;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255, 255, 255, 0.06); color: #cbbba9;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px;
  font-size: 0.74rem; font-weight: 600; padding: 4px 10px; cursor: pointer;
  opacity: 0; transition: opacity 0.15s ease;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #fff; border-color: var(--accent); }
.copy-btn.copied { color: var(--green); border-color: var(--green); opacity: 1; }
/* syntax token colors */
.tok-kw { color: var(--tok-kw); font-weight: 600; }
.tok-str { color: var(--tok-str); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-mac { color: var(--tok-mac); }
.tok-typ { color: var(--tok-typ); }
.tok-num { color: var(--tok-num); }
.tok-fn { color: var(--tok-fn); }
.tok-life { color: var(--tok-life); font-style: italic; }
.tok-attr { color: var(--tok-attr); }
/* terminal-style blocks */
pre.term code { color: #d5e8d0; }
pre.term::before {
  content: "terminal"; display: block; font-family: var(--mono);
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: #7a8a72; margin-bottom: 8px;
}
/* compiler output blocks */
pre.compiler::before {
  content: "compiler says"; display: block; font-family: var(--mono);
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: #c98a6a; margin-bottom: 8px;
}
pre.compiler code { color: #eec9b0; }

/* ---------- playground & run buttons ---------- */
.run-btn { right: 76px; }
.run-out {
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: var(--radius-sm); padding: 12px 18px;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  margin: -0.7em 0 1.1em;
}
.run-out .run-ok { color: #d5e8d0; display: block; }
.run-out .run-warn { color: #d8c08a; display: block; margin-top: 6px; }
.run-out .run-err { color: #ffb4a8; display: block; }
.run-out .run-hint { color: var(--tok-com); margin-top: 8px; font-style: italic; }
.pg-toolbar { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
.pg-select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 0.92rem; padding: 8px 12px;
}
.pg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .pg-grid { grid-template-columns: 1fr; } }
.pg-editor {
  font-family: var(--mono); font-size: 0.9rem; line-height: 1.55; tab-size: 4;
  background: var(--code-bg); color: #e8ddd0;
  border: 1px solid var(--code-border); border-radius: var(--radius-sm);
  padding: 16px 18px; width: 100%; min-height: 440px; resize: vertical;
}
.pg-editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.pg-output-wrap { display: flex; flex-direction: column; }
.pg-output-label { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; margin: 0 0 6px 2px; }
.pg-output { flex: 1; min-height: 440px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.pg-output .run-ok { color: #d5e8d0; display: block; }
.pg-output .run-warn { color: #d8c08a; display: block; margin-top: 6px; }
.pg-output .run-err { color: #ffb4a8; display: block; }
.pg-output .run-hint { color: var(--tok-com); margin-top: 8px; font-style: italic; }

/* ---------- project workshop ---------- */
.badge.build { background: rgba(111, 183, 255, 0.16); color: var(--blue); }
.spec {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius); padding: 20px 24px; margin: 1.4em 0;
}
.spec h3 { margin-top: 0; }
.spec ul { margin-bottom: 0; }
.hint {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin: 10px 0; background: var(--surface);
}
.hint summary {
  cursor: pointer; font-weight: 700; font-size: 0.93rem;
  padding: 11px 16px; list-style: none; user-select: none;
  display: flex; align-items: center; gap: 8px; color: var(--accent-bright);
}
.hint summary::-webkit-details-marker { display: none; }
.hint summary::before { content: "💡"; }
.hint[open] summary { border-bottom: 1px solid var(--border); }
.hint summary:hover { background: var(--surface-2); }
.hint .hint-body { padding: 4px 18px 14px; font-size: 0.95rem; }
.hint .hint-body > :first-child { margin-top: 10px; }
.hint-ladder { margin: 1.2em 0; }
.hint-ladder .muted { font-size: 0.86rem; }
.difficulty { display: inline-flex; gap: 3px; vertical-align: middle; }
.difficulty span { color: var(--accent-soft); }
.difficulty span.off { opacity: 0.25; }
.project-card .meta {
  display: flex; gap: 12px; align-items: center;
  font-size: 0.82rem; color: var(--text-muted); margin-top: 8px;
}

/* ---------- the Rust Dojo ---------- */
.belt-badge {
  display: inline-block; font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 5px 14px; border-radius: 999px; border: 2px solid transparent;
  vertical-align: middle;
}
.belt-white  { background: #efe9e2; color: #3a2f26; }
.belt-yellow { background: #ffd75e; color: #4a3500; }
.belt-orange { background: var(--accent); color: #fff; }
.belt-green  { background: #5a9e33; color: #fff; }
.belt-brown  { background: #8a5a34; color: #fff; }
.belt-black  { background: #111; color: #f4ebe2; border-color: #4a4a4a; }
.belt-badge.earned { box-shadow: 0 0 0 3px var(--accent-soft); }
.belt-badge.earned::after { content: " ★"; }
.belt-count { margin-left: 6px; }

.dojo-card { margin: 14px 0; }
.dojo-card.solved { border-color: var(--green); }
.dojo-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dojo-head h3 { margin: 0; }
.dojo-type {
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-soft);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.dojo-task { margin: 8px 0 10px; font-size: 0.96rem; }
.dojo-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 4px; }
.dojo-actions .hint { flex: 1 1 100%; margin: 0; }
.dojo-solved-btn.is-solved { border-color: var(--green); color: var(--green); }

/* ---------- glossary ---------- */
.gloss-filter {
  width: 100%; font: inherit; font-size: 1rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 12px 20px; margin: 6px 0 4px;
}
.gloss-filter:focus { border-color: var(--accent); }
.gloss { margin: 10px 0 0; }
.gloss dt {
  font-weight: 800; font-size: 1.02rem; color: var(--accent-soft);
  margin-top: 20px; scroll-margin-top: 80px;
}
.gloss dd {
  margin: 4px 0 0; padding-left: 0; color: var(--text-muted);
  font-size: 0.96rem; line-height: 1.6;
}
.gloss dd a { font-weight: 600; }
.gloss dt[hidden], .gloss dd[hidden] { display: none; }

/* ---------- callouts ---------- */
.callout {
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 1.2em 0; font-size: 0.96rem;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .co-title { font-weight: 800; display: block; margin-bottom: 4px; }
.callout.tip { border-left-color: var(--green); }
.callout.warn { border-left-color: var(--accent-soft); }
.callout.danger { border-left-color: var(--red); }
.callout.info { border-left-color: var(--blue); }

/* ---------- exercises ---------- */
.exercise {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin: 1.4em 0;
}
.exercise .ex-label {
  font-weight: 800; color: var(--accent-soft);
  font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.exercise h3 { margin: 4px 0 8px; font-size: 1.08rem; }
details.solution { margin-top: 12px; }
details.solution summary {
  cursor: pointer; font-weight: 700; color: var(--accent-bright);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.88rem; user-select: none;
}
details.solution summary::-webkit-details-marker { display: none; }
details.solution summary::before { content: "🔒"; }
details.solution[open] summary::before { content: "🔓"; }
details.solution summary:hover { border-color: var(--accent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 9px 13px; border: 1px solid var(--border); }
th { background: var(--surface-2); font-size: 0.85rem; }
td code { white-space: nowrap; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 55%, transparent); }

/* ---------- tabs (setup page) ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.tab-btn {
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  font-weight: 700; font-size: 0.93rem; padding: 9px 18px; cursor: pointer;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn.active {
  background: linear-gradient(92deg, var(--accent), var(--accent-bright));
  color: #fff; border-color: transparent;
}
.tab-panel { display: none; padding-top: 6px; }
.tab-panel.active { display: block; }

/* ---------- checklist ---------- */
ul.checklist { list-style: none; padding-left: 0; }
ul.checklist li { padding-left: 30px; position: relative; margin: 8px 0; }
ul.checklist li::before { content: "✅"; position: absolute; left: 0; }

/* ---------- steps ---------- */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li {
  counter-increment: step; position: relative;
  padding-left: 52px; margin: 18px 0;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 2px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #fff; font-weight: 800; font-size: 1rem;
}
ol.steps > li > strong:first-child { display: block; font-size: 1.05rem; margin-bottom: 2px; }

/* ---------- lesson pages ---------- */
.lesson-header { padding: 34px 0 6px; }
.breadcrumb { font-size: 0.88rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-bright); }
.lesson-header h1 { margin-top: 0.35em; }
.lesson-body { padding-bottom: 30px; }
.lesson-nav {
  display: flex; justify-content: space-between; gap: 14px;
  margin: 40px 0 10px; flex-wrap: wrap;
}
.lesson-nav a {
  flex: 1; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; color: var(--text);
}
.lesson-nav a:hover { text-decoration: none; border-color: var(--accent); }
.lesson-nav .dir { display: block; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.lesson-nav .next { text-align: right; }
.complete-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--border); border-radius: 999px;
  font-weight: 700; font-size: 0.95rem; padding: 10px 20px; cursor: pointer;
  margin: 26px 0 4px;
}
.complete-btn:hover { border-color: var(--green); }
.complete-btn.done { border-color: var(--green); color: var(--green); background: rgba(143, 206, 95, 0.1); }

/* lesson cards on curriculum page */
.lesson-card { display: flex; gap: 14px; align-items: flex-start; }
.lesson-card .num {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 0.95rem;
}
.lesson-card.done .num { background: rgba(143, 206, 95, 0.15); border-color: var(--green); color: var(--green); }
.lesson-card.done .num::after { content: " ✓"; }
.lesson-card h3 { font-size: 1.03rem; margin: 0 0 3px; }
.lesson-card p { font-size: 0.88rem; }

.progress-wrap { margin: 18px 0 8px; }
.progress-bar {
  height: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(92deg, var(--accent), var(--accent-soft));
  border-radius: 999px; transition: width 0.5s ease;
}
.progress-label { font-size: 0.88rem; color: var(--text-muted); margin-top: 6px; }

/* ---------- quiz ---------- */
.quiz-card { max-width: 720px; }
.quiz-q { font-size: 1.12rem; font-weight: 700; margin: 4px 0 14px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  text-align: left; font: inherit; font-size: 0.97rem;
  background: var(--surface-2); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; cursor: pointer; transition: border-color 0.12s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:disabled { cursor: default; opacity: 0.85; }
.quiz-opt.correct { border-color: var(--green); background: rgba(143, 206, 95, 0.12); opacity: 1; }
.quiz-opt.wrong { border-color: var(--red); background: rgba(255, 107, 107, 0.1); }
.quiz-explain {
  border-left: 4px solid var(--blue); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 14px; font-size: 0.94rem;
}
.quiz-meta { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 10px; }
.quiz-score { text-align: center; padding: 10px 0 4px; }
.quiz-score .big { font-size: 3rem; font-weight: 800; }
.quiz-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.best-score { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- cheat sheet ---------- */
.sheet h2 { border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 820px) { .sheet-grid { grid-template-columns: 1fr; } }
.sheet-grid .card { break-inside: avoid; }
.sheet-grid pre { margin: 0.6em 0 0.2em; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 50px;
  padding: 30px 0 40px; color: var(--text-muted); font-size: 0.92rem;
}
.site-footer .cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-footer h2 { margin: 0 0 8px; color: var(--text); font-size: 0.95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 5px 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent-bright); }
.license-line {
  margin: 26px 0 0; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-muted);
}

/* ---------- confetti ---------- */
.confetti-piece {
  position: fixed; font-size: 1.4rem; pointer-events: none; z-index: 100;
  animation: confetti-fall 1.3s ease-out forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(140px) rotate(340deg) scale(0.6); opacity: 0; }
}

/* ---------- misc ---------- */
.pill-stat { display: flex; gap: 14px; flex-wrap: wrap; margin: 22px 0 4px; }
.impact-banner { color: var(--text-muted); font-size: 0.95rem; margin-top: 14px; }
.impact-banner strong { color: var(--accent-soft); }
.impact-banner[hidden] { display: none; }
.pill-stat .stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px; min-width: 130px;
}
.stat .n { font-size: 1.5rem; font-weight: 800; color: var(--accent-bright); display: block; }
.stat .l { font-size: 0.82rem; color: var(--text-muted); }
hr.soft { border: none; border-top: 1px solid var(--border); margin: 34px 0; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.small { font-size: 0.88rem; }

/* ---------- print (cheat sheets) ---------- */
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; color: #111; font-size: 12px; }
  .card, pre { border-color: #ccc; box-shadow: none; }
  pre, pre code { background: #f6f2ec; color: #222; }
  a { color: inherit; }
}
