/* ==========================================================================
   Financial Literacy 101 — design system
   Concept: the course as a bank statement / accounting ledger.
   One vivid accent (orange coin); everything else is quiet warm paper.
   ========================================================================== */

:root {
  /* palette — committed */
  --ground:    #FEFCF9;   /* barely-there warm white — blends with the white sidebar */
  --surface:   #FFFFFF;   /* pure white card / modal */
  --surface-2: #FBF4EC;   /* alternating ledger row / input fill */
  --ink:       #2A2018;   /* warm dark ink */
  --muted:     #6B5D52;   /* secondary ink */
  --accent:    #B45309;   /* orange — the one vivid element (AA-contrast tuned) */
  --accent-2:  #E8924A;   /* amber-orange (decorative only) */
  --line:      #F0E7DC;   /* hairlines (soft, warm) */
  --line-soft: #F6F0E8;

  /* type-coding for lesson kinds (within the white/orange family) */
  --c-watch:  #B45309;    /* video */
  --c-do:     #C26A1A;    /* discussion · task · activity */
  --c-read:   #6B5D52;    /* article · pdf · external link */
  --c-assess: #3A2A20;    /* quiz · test */

  /* type */
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "SF Mono", "Roboto Mono", ui-monospace, monospace;

  /* spacing scale */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --radius: 10px;
  --radius-sm: 4px;
  --sidebar-w: 296px;
  --content-max: 1440px;
  --shadow: 0 1px 2px rgba(42, 32, 24, .06), 0 8px 24px rgba(42, 32, 24, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }

a { color: var(--accent); text-underline-offset: 3px; }

img, iframe { max-width: 100%; }

/* --- accessibility helpers ------------------------------------------------ */
.skip-link {
  position: fixed; top: -100px; left: var(--s4); z-index: 100;
  background: var(--ink); color: #fff; padding: var(--s2) var(--s4);
  border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { top: var(--s4); }

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* eyebrow / mono labels — the ledger voice */
.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ==========================================================================
   Layout
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* --- sidebar -------------------------------------------------------------- */
.sidebar {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: var(--s5) 0 var(--s4);
}

.brand {
  display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5) var(--s5);
  text-decoration: none; color: var(--ink);
}
.brand__coin {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.25rem;
  color: var(--accent);
  background: radial-gradient(circle at 35% 30%, #FBE3C4, var(--accent-2) 70%);
  border: 1.5px solid var(--accent);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__title { font-weight: 700; font-size: 1.02rem; }
.brand__num { font-family: var(--mono); color: var(--accent); }
.brand__region {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); margin-top: 3px;
}

/* sidebar tabs + settings */
.sidebar__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1);
  margin: 0 var(--s5) var(--s4);
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.sidebar__tab {
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.sidebar__tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.sidebar__pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* region / currency switcher */
.region-switch { display: flex; flex-direction: column; gap: 6px; padding: 0 var(--s5) var(--s4); }
.region-switch__label { font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.region-switch__opts { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.region-opt {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 0; cursor: pointer; font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--muted); padding: 6px 8px; border-radius: 6px; transition: color .15s ease, background .15s ease;
}
.region-opt__cur { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.region-opt:hover:not(.is-active) { color: var(--ink); }
.region-opt.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* language dropdown (shown for India only) */
.lang-switch { padding-top: 0; }
.lang-field { position: relative; }
.lang-field::after {
  content: "▾"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--muted); font-size: .7rem;
}
.lang-select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); font: inherit; font-size: .86rem; font-weight: 600;
  padding: 8px 28px 8px 10px; cursor: pointer;
}
.lang-select:hover { border-color: var(--accent); }

.toc {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 var(--s4);
}
.toc__module { margin-bottom: 6px; }
.toc__head {
  display: flex; align-items: center; gap: var(--s3); width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  min-height: 46px;
  padding: 10px var(--s3); border-radius: var(--radius-sm);
  color: var(--ink); font-family: var(--sans); font-size: 1rem; font-weight: 650;
  line-height: 1.25;
}
.toc__head:hover { background: var(--surface-2); }
.toc__head[aria-current="true"] { color: var(--accent); }
.toc__no { font-family: var(--mono); font-size: .78rem; color: var(--accent); font-weight: 700; }
.toc__name { flex: 1 1 auto; }
.toc__chev { color: var(--muted); transition: transform .2s ease; font-size: .7rem; }
.toc__module.is-open .toc__chev { transform: rotate(90deg); }

.toc__lessons { list-style: none; margin: 0 0 var(--s2); padding: 0 0 0 calc(var(--s3) + 18px); display: none; }
.toc__module.is-open .toc__lessons { display: block; }
.toc__lesson {
  display: flex; align-items: center; gap: var(--s2);
  padding: 5px var(--s3); border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-size: .84rem; line-height: 1.35;
  border-left: 2px solid var(--line-soft);
}
.toc__lesson:hover { background: var(--surface-2); color: var(--ink); }
.toc__lesson[aria-current="page"] {
  color: var(--ink); background: var(--surface-2);
  border-left-color: var(--accent); font-weight: 600;
}
.toc__tick { flex: none; width: 14px; text-align: center; color: var(--accent); font-size: .8rem; opacity: 0; }
.toc__lesson.is-done .toc__tick { opacity: 1; }
.toc__lesson.is-done .toc__txt { color: var(--muted); }

.sidebar__foot {
  padding: var(--s4) var(--s5) 0;
  border-top: 1px solid var(--line);
  min-height: 0;
  max-height: 60vh;          /* never let the profile eat the whole sidebar */
  overflow-y: auto;          /* scroll internally if the profile + settings are tall */
  overscroll-behavior: contain;
}
.settings-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  overflow: hidden;
  padding: 0 var(--s3);
}
.settings-panel__note {
  margin: var(--s1) var(--s2) 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.balance { display: flex; align-items: baseline; justify-content: space-between; }
.balance__label { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.balance__value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.2rem; color: var(--accent); }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; padding: var(--s2) 0 0; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

/* my-grades sidebar link */
.grades-link { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: .82rem; transition: border-color .15s ease, color .15s ease; }
.grades-link:hover { border-color: var(--accent); }
.grades-link[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.grades-link[hidden] { display: none; }
.grades-link__label { font-weight: 600; }
.grades-link__arrow { color: var(--muted); font-size: .9rem; }
.grades-link:hover .grades-link__arrow, .grades-link[aria-current="page"] .grades-link__arrow { color: var(--accent); }

/* --- mobile nav toggle + scrim ------------------------------------------- */
.nav-toggle { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(42,32,24,.4); z-index: 40; }

/* ==========================================================================
   Main column
   ========================================================================== */
.main {
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  max-width: none;
  padding: var(--s7) clamp(var(--s5), 3vw, var(--s7)) var(--s8);
  min-width: 0;
}
.view {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* breadcrumb */
.crumbs { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: var(--s4); font-family: var(--mono); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { opacity: .5; }

/* ==========================================================================
   Home / hero
   ========================================================================== */
.hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s7); margin-bottom: var(--s6); box-shadow: var(--shadow); }
.hero::after {
  /* a faint embossed coin, drawn with CSS */
  content: ""; position: absolute; right: -70px; top: -70px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, rgba(232,146,74,.20), rgba(232,146,74,0) 62%);
  border: 28px solid rgba(180,83,9,.05);
  pointer-events: none;
}
.hero__eyebrow { margin-bottom: var(--s4); }
.hero__title { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.02em; }
.hero__title .accent { color: var(--accent); }
.hero__lede { max-width: 54ch; color: var(--muted); font-size: 1.12rem; margin-top: var(--s4); }

.statbar { position: relative; display: flex; flex-wrap: wrap; gap: var(--s6); margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.statbar--grades { gap: var(--s8); }
.stat { display: flex; flex-direction: column; }
.stat__value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat__label { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: var(--s2); }

/* progress balance line */
.ledger-progress { margin-top: var(--s5); }
.ledger-progress__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s2); }
.ledger-progress__cap { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ledger-progress__pct { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar__fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; width: 0; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.ledger-progress__note { margin-top: var(--s2); font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--muted); }

/* teacher landing snapshot — stands in for the student progress bar */
.teacher-snapshot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s5); margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--line); }
.teacher-snapshot__stats { display: flex; flex-wrap: wrap; gap: var(--s6); }
.teacher-snapshot__cta { flex: none; }

/* school/product readiness layer */
.school-ready {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .52fr); gap: var(--s5);
  align-items: stretch; margin-bottom: var(--s5); padding: var(--s6);
  border: 1px solid var(--line); border-left: 4px solid #2F7A4D;
  border-radius: var(--radius); background: #F6FBF7; box-shadow: var(--shadow);
}
.school-ready__copy h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); margin: var(--s2) 0; }
.school-ready__copy p:not(.eyebrow) { max-width: 68ch; color: var(--muted); margin: 0; }
.school-ready__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.school-ready__facts { display: grid; gap: var(--s3); }
.school-ready__facts span,
.module-guide__side span,
.lesson-plan__meta span,
.map-row__meta span {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s3);
  border: 1px solid #D5E8DA; border-radius: var(--radius-sm); background: #fff;
}
.school-ready__facts b,
.module-guide__side b,
.lesson-plan__meta b,
.map-row__meta b { font-size: .95rem; line-height: 1.25; }
.school-ready__facts small,
.module-guide__side small,
.lesson-plan__meta small,
.map-row__meta small {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .11em; text-transform: uppercase; color: var(--muted);
}
.school-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.school-card {
  padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: 0 1px 2px rgba(42, 32, 24, .04);
}
.school-card__label { display: block; font-family: var(--mono); font-size: .62rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.school-card b { display: block; margin-top: var(--s2); font-size: 1.2rem; color: #245C3A; }
.school-card p { margin: var(--s2) 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.trust-strip {
  margin-bottom: var(--s6); padding: var(--s4) var(--s5); border: 1px solid #D6E3F5;
  border-left: 4px solid #285C8E; border-radius: var(--radius-sm); background: #F5F8FC;
}
.trust-strip ul, .evidence-panel ul { margin: var(--s2) 0 0; padding-left: var(--s5); color: var(--muted); }
.trust-strip li, .evidence-panel li { margin: var(--s1) 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.tag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 700;
}
.module-guide {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .38fr); gap: var(--s4);
  margin-top: var(--s5); padding: var(--s5); border: 1px solid var(--line);
  border-left: 4px solid #285C8E; border-radius: var(--radius); background: #F7FAFD;
}
.module-guide__main h2 { font-size: 1.15rem; margin: var(--s1) 0 var(--s2); }
.module-guide__main p { margin: 0; color: var(--muted); }
.module-guide__side { display: grid; gap: var(--s3); }

/* kid-friendly missions and rewards */
.kid-journey {
  margin-bottom: var(--s6); padding: var(--s5); border: 1px solid #D6E3F5;
  border-left: 4px solid #285C8E; border-radius: var(--radius); background: #F5F8FC; box-shadow: var(--shadow);
}
.kid-journey__head,
.mission-hero {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
}
.kid-journey__head h2,
.mission-hero h1 { font-size: clamp(1.45rem, 3vw, 2rem); margin: var(--s1) 0 var(--s2); }
.kid-journey__head p:not(.eyebrow),
.mission-hero p { margin: 0; color: var(--muted); max-width: 68ch; }
.section-head--compact { margin-top: var(--s5); }
.mission-grid,
.reward-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.reward-road {
  position: relative; display: grid; gap: var(--s4); margin-top: var(--s4); padding-left: 12px;
}
.reward-road::before {
  content: ""; position: absolute; top: 28px; bottom: 28px; left: 43px; width: 4px;
  border-radius: 99px; background: linear-gradient(180deg, #2F7A4D, #E8924A, #EFE2D6);
}
.mission-card,
.reward-card {
  padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: 0 1px 2px rgba(42,32,24,.04);
}
.mission-card__module {
  display: inline-flex; margin-bottom: var(--s3); padding: 3px 8px; border-radius: 999px;
  background: #F5F8FC; border: 1px solid #D6E3F5; color: #285C8E; font-size: .72rem; font-weight: 700;
}
.mission-card h3,
.reward-card h3 { font-size: 1rem; margin-bottom: var(--s2); }
.mission-card p,
.reward-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.mission-card__status {
  display: inline-flex; margin-top: var(--s3); font-family: var(--mono); font-size: .66rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.mission-card__status.is-ready { color: #2F7A4D; font-weight: 700; }
.reward-card { display: grid; grid-template-columns: 38px 1fr; gap: var(--s3); opacity: .72; }
.reward-grid--preview .reward-card__art { display: none; }
.reward-road .reward-card {
  position: relative; grid-template-columns: 62px 112px minmax(0, 1fr); align-items: center;
  min-height: 112px; padding: var(--s5); padding-left: var(--s4); opacity: .82;
}
.reward-card.is-unlocked { opacity: 1; border-color: #D5E8DA; background: #F6FBF7; }
.reward-card.is-next { opacity: 1; border-color: #E7C594; background: #FFF9EE; box-shadow: 0 12px 30px rgba(180,83,9,.1); }
.reward-card__coin {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 1.1rem;
}
.reward-road .reward-card__coin {
  position: relative; z-index: 1; width: 52px; height: 52px; border-width: 2px;
  background: #fff; color: #7B6B5E; font-family: var(--mono); font-size: .95rem; font-weight: 800;
  box-shadow: 0 0 0 8px var(--bg);
}
.reward-card.is-unlocked .reward-card__coin { background: #2F7A4D; color: #fff; border-color: #2F7A4D; animation: coin-pop .55s ease both; }
.reward-card.is-next .reward-card__coin { background: #B45309; color: #fff; border-color: #E8924A; }
.reward-card__art {
  --badge-a: #B45309; --badge-b: #E8924A; --badge-c: #FFF3D2; --badge-ink: #7A3504;
  position: relative; width: 104px; aspect-ratio: 1; border-radius: 22px; display: grid; place-items: center;
  overflow: hidden; background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.95), rgba(255,255,255,0) 32%),
    linear-gradient(145deg, var(--badge-c), color-mix(in srgb, var(--badge-b) 28%, #fff));
  border: 1px solid color-mix(in srgb, var(--badge-b) 60%, #fff);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -18px 28px rgba(42,32,24,.1),
    0 16px 28px rgba(42,32,24,.14);
}
.reward-card__art::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  background: conic-gradient(from 24deg, var(--badge-a), #fff7d6, var(--badge-b), var(--badge-a));
  opacity: .82;
}
.reward-card__art::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.46), rgba(255,255,255,0) 38%, rgba(0,0,0,.06) 100%);
  pointer-events: none;
}
.reward-card__ribbon {
  position: absolute; left: 25px; right: 25px; bottom: -1px; height: 30px; z-index: 0;
  background: linear-gradient(180deg, var(--badge-a), color-mix(in srgb, var(--badge-a) 70%, #000));
  clip-path: polygon(0 0, 100% 0, 86% 100%, 50% 72%, 14% 100%);
  opacity: .96;
}
.reward-card__art svg { position: relative; z-index: 1; width: 90px; height: 90px; color: var(--badge-ink); filter: drop-shadow(0 4px 5px rgba(42,32,24,.2)); }
.reward-card__art-bg { fill: rgba(255,255,255,.9); stroke: rgba(255,255,255,.92); stroke-width: 3; }
.reward-card__art-icon {
  fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
}
.reward-card__spark {
  fill: #fff4b8; stroke: color-mix(in srgb, var(--badge-b) 75%, #fff); stroke-width: 2;
  transform-origin: 24px 44px; opacity: .95;
}
.reward-card__art--starter { --badge-a: #D97706; --badge-b: #FBBF24; --badge-c: #FFF1B8; --badge-ink: #854D0E; }
.reward-card__art--saver { --badge-a: #15803D; --badge-b: #86EFAC; --badge-c: #DCFCE7; --badge-ink: #166534; }
.reward-card__art--budget { --badge-a: #B45309; --badge-b: #FB923C; --badge-c: #FFEDD5; --badge-ink: #9A3412; }
.reward-card__art--safety { --badge-a: #2563EB; --badge-b: #93C5FD; --badge-c: #DBEAFE; --badge-ink: #1D4ED8; }
.reward-card__art--borrow { --badge-a: #7C3AED; --badge-b: #C4B5FD; --badge-c: #EDE9FE; --badge-ink: #6D28D9; }
.reward-card__art--graduate { --badge-a: #BE123C; --badge-b: #FDA4AF; --badge-c: #FFE4E6; --badge-ink: #9F1239; }
.reward-card:not(.is-unlocked):not(.is-next) .reward-card__art {
  filter: saturate(.62); opacity: .86;
}
.reward-card.is-unlocked .reward-card__art {
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.95), rgba(255,255,255,0) 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--badge-c) 80%, #fff), color-mix(in srgb, var(--badge-b) 48%, #fff));
  border-color: color-mix(in srgb, var(--badge-b) 68%, #fff);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -18px 30px rgba(47,122,77,.1),
    0 18px 34px color-mix(in srgb, var(--badge-a) 18%, transparent);
}
.reward-card.is-next .reward-card__art {
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.95), rgba(255,255,255,0) 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--badge-c) 84%, #fff), color-mix(in srgb, var(--badge-b) 58%, #fff));
  border-color: var(--badge-b);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -18px 30px rgba(42,32,24,.12),
    0 18px 34px color-mix(in srgb, var(--badge-a) 24%, transparent);
}
.reward-card__milestone {
  display: inline-flex; margin-bottom: var(--s1); font-family: var(--mono); font-size: .66rem;
  letter-spacing: .11em; text-transform: uppercase; color: #9A5B0B;
}
.reward-card__rule { font-family: var(--mono); font-size: .68rem !important; letter-spacing: .04em; color: #285C8E !important; margin-bottom: var(--s1) !important; }
.reward-card__bar { height: 6px; margin: var(--s2) 0; border-radius: 99px; background: #EFE2D6; overflow: hidden; }
.reward-card__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #B45309, #E8924A); transition: width .45s ease; }
.reward-card.is-unlocked .reward-card__bar span { background: linear-gradient(90deg, #2F7A4D, #77B28A); }

.coin-celebrate {
  position: fixed; right: 22px; bottom: 22px; z-index: 120;
  pointer-events: none; animation: reward-in .35s ease both;
}
.coin-celebrate.is-leaving { animation: reward-out .45s ease both; }
.coin-celebrate__card {
  position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: var(--s3);
  width: min(360px, calc(100vw - 32px)); padding: var(--s4); border: 1px solid #E7C594;
  border-radius: var(--radius); background: #FFF9EE; box-shadow: 0 18px 48px rgba(42,32,24,.24);
}
.coin-celebrate__coin {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: #B45309; color: #fff; border: 2px solid #E8924A; font-weight: 800;
  animation: coin-pop .7s ease both;
}
.coin-celebrate__cap {
  margin: 0 0 2px; font-family: var(--mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: #9A5B0B;
}
.coin-celebrate h2 { margin: 0; font-size: 1.1rem; }
.coin-celebrate p:last-child { margin: 3px 0 0; color: var(--muted); font-size: .88rem; }
.coin-celebrate__burst { position: absolute; inset: auto 18px 84px auto; width: 120px; height: 90px; }
.coin-celebrate__burst span {
  position: absolute; bottom: 0; left: 52px; width: 14px; height: 14px; border-radius: 50%;
  background: #E8924A; border: 1px solid #B45309; animation: coin-spark .9s ease-out both;
}
.coin-celebrate__burst span:nth-child(2) { animation-delay: .05s; --x: -42px; --y: -52px; }
.coin-celebrate__burst span:nth-child(3) { animation-delay: .1s; --x: 34px; --y: -62px; }
.coin-celebrate__burst span:nth-child(4) { animation-delay: .14s; --x: -12px; --y: -78px; }
.coin-celebrate__burst span:nth-child(5) { animation-delay: .18s; --x: 54px; --y: -36px; }

@keyframes reward-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes reward-out { to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes coin-pop { 0% { transform: scale(.55) rotate(-14deg); } 65% { transform: scale(1.12) rotate(5deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes coin-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x, 18px), var(--y, -44px)) scale(1); }
}
.mission-hero {
  padding: var(--s6); border: 1px solid #D6E3F5; border-left: 4px solid #285C8E;
  border-radius: var(--radius); background: #F5F8FC; box-shadow: var(--shadow); margin-bottom: var(--s5);
}
.mission-hero__badge {
  flex: none; min-width: 172px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: var(--s5); border: 1px solid #D5E8DA; border-radius: var(--radius); background: #fff;
}
.mission-hero__badge span { font-size: 2rem; color: #2F7A4D; line-height: 1; }
.mission-hero__badge b { font-size: .98rem; }
.mission-hero__badge small { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; }
.reward-hero-badge {
  min-width: 220px; gap: var(--s2); background: #FFF9EE; border-color: #E7C594;
  box-shadow: 0 16px 36px rgba(42,32,24,.1);
}
.reward-hero-badge.is-unlocked { background: #F6FBF7; border-color: #B9DCC3; }
.reward-hero-badge .reward-card__art { width: 118px; }
.reward-hero-badge .reward-card__art svg { width: 104px; height: 104px; }
.reward-hero-badge .reward-card__bar { width: 100%; margin-top: var(--s2); }
.reward-hero-badge.is-unlocked .reward-card__art {
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.95), rgba(255,255,255,0) 32%),
    linear-gradient(145deg, color-mix(in srgb, var(--badge-c) 80%, #fff), color-mix(in srgb, var(--badge-b) 48%, #fff));
  border-color: color-mix(in srgb, var(--badge-b) 68%, #fff);
}
.reward-hero-badge.is-unlocked .reward-card__bar span { background: linear-gradient(90deg, #2F7A4D, #77B28A); }
.money-match {
  position: relative; overflow: hidden; max-width: 940px; margin: 0 auto var(--s5);
  padding: var(--s4); border: 1px solid #D6E3F5; border-left: 4px solid #2F7A4D;
  border-radius: var(--radius); background: linear-gradient(135deg, #FFF9EE 0%, #F7FAFD 54%, #F1FAF3 100%);
  box-shadow: 0 1px 2px rgba(42,32,24,.06), 0 14px 30px rgba(40,92,142,.08), inset 0 -4px 0 rgba(47,122,77,.08);
}
.money-match__head {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(224px, .34fr);
  align-items: center; gap: var(--s4);
}
.money-match__head h2 { font-size: 1.22rem; margin: 2px 0 4px; }
.money-match__head p:not(.eyebrow) { margin: 0; color: var(--muted); max-width: 56ch; font-size: .88rem; line-height: 1.35; }
.money-match__stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
}
.money-match__stats span {
  min-height: 52px; display: flex; flex-direction: column; justify-content: center;
  padding: 8px; border: 1px solid rgba(42,32,24,.1); border-radius: 6px;
  background: rgba(255,255,255,.82); box-shadow: inset 0 -2px 0 rgba(180,83,9,.08);
}
.money-match__stats b { font-family: var(--mono); font-size: .98rem; line-height: 1.05; color: #2F7A4D; }
.money-match__stats small {
  margin-top: 2px; font-family: var(--mono); font-size: .54rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.money-match__modes {
  position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px; margin-top: var(--s3); padding: 4px; border: 1px solid rgba(42,32,24,.1);
  border-radius: 8px; background: rgba(255,255,255,.62);
}
.mode-tab {
  min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; font: inherit; font-family: var(--mono); font-size: .68rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.mode-tab:hover { color: var(--ink); background: rgba(255,255,255,.65); }
.mode-tab.is-active {
  background: #2F7A4D; color: #fff; box-shadow: 0 5px 12px rgba(47,122,77,.18), inset 0 -2px 0 rgba(0,0,0,.12);
}
.deck-quick {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); margin-top: var(--s3); padding: 7px 9px; border: 1px solid rgba(42,32,24,.1);
  border-radius: 8px; background: rgba(255,255,255,.62);
}
.deck-quick span { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; }
.deck-quick b { font-size: .86rem; }
.deck-quick small {
  color: var(--muted); font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase;
}
.deck-quick__add { flex: none; min-height: 30px; padding: 5px 10px; }
.deck-builder {
  position: relative; z-index: 1; margin-top: var(--s3); border: 1px solid rgba(42,32,24,.1);
  border-radius: 8px; background: rgba(255,255,255,.7);
}
.deck-builder summary {
  min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 8px 10px; cursor: pointer; font-weight: 800;
}
.deck-builder summary small {
  color: var(--muted); font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
}
.deck-builder__body {
  display: grid; gap: var(--s3); padding: 0 10px 10px;
}
.deck-builder__note {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 8px 10px; border: 1px solid rgba(42,32,24,.08); border-radius: 8px;
  background: rgba(255,255,255,.64);
}
.deck-builder__note b { flex: none; font-size: .84rem; }
.deck-builder__note span { color: var(--muted); font-size: .8rem; line-height: 1.25; text-align: right; }
.custom-word-form {
  display: grid; grid-template-columns: minmax(118px, .7fr) minmax(0, 1.3fr) auto;
  gap: var(--s2); align-items: end;
}
.custom-word-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.custom-word-form label span {
  color: var(--muted); font-family: var(--mono); font-size: .62rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.custom-word-form input, .custom-word-form textarea {
  width: 100%; min-height: 38px; border: 1px solid rgba(42,32,24,.14); border-radius: 7px;
  background: rgba(255,255,255,.92); color: var(--ink); font: inherit; font-size: .86rem; line-height: 1.25;
  padding: 8px 9px; resize: vertical;
}
.custom-word-form__actions { display: flex; gap: var(--s2); align-items: center; }
.custom-word-list {
  max-height: 178px; overflow: auto; display: grid; gap: 6px; padding-right: 2px;
}
.custom-word {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s2);
  padding: 8px 9px; border: 1px solid rgba(42,32,24,.09); border-radius: 7px; background: rgba(255,255,255,.76);
}
.custom-word b { display: block; font-size: .9rem; }
.custom-word small { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; line-height: 1.25; }
.custom-word span { display: flex; gap: 5px; }
.custom-word__btn {
  min-height: 28px; border: 1px solid rgba(42,32,24,.12); border-radius: 6px; background: #fff;
  color: var(--muted); cursor: pointer; font: inherit; font-size: .72rem; font-weight: 800; padding: 4px 7px;
}
.custom-word__btn:hover { border-color: #285C8E; color: var(--ink); }
.custom-word-empty { margin: 0; color: var(--muted); font-size: .84rem; }
.money-match__bar {
  position: relative; z-index: 1; height: 8px; overflow: hidden; margin: var(--s3) 0;
  border: 1px solid #D5E8DA; border-radius: 999px; background: rgba(255,255,255,.82);
}
.money-match__bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #285C8E, #2F7A4D, #E8924A); transition: width .22s ease;
}
.game-panel { display: none; position: relative; z-index: 1; }
.game-panel.is-active { display: block; }
.flash-card {
  width: 100%; min-height: 194px; position: relative; display: grid; place-items: stretch;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer; perspective: 900px;
}
.flash-card__face {
  grid-area: 1 / 1; display: flex; flex-direction: column; justify-content: center; gap: var(--s2);
  padding: var(--s6); border: 1px solid rgba(42,32,24,.12); border-radius: 10px;
  background:
    radial-gradient(circle at 12% 16%, rgba(255,255,255,.88), rgba(255,255,255,0) 28%),
    linear-gradient(145deg, #fff, #FBEAD6);
  box-shadow: 0 4px 0 rgba(180,83,9,.12), 0 16px 28px rgba(42,32,24,.08);
  color: var(--ink); backface-visibility: hidden; transition: transform .34s ease;
}
.flash-card__face small {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.flash-card__face b { font-size: clamp(1.25rem, 3vw, 1.8rem); line-height: 1.15; }
.flash-card__back {
  background:
    radial-gradient(circle at 88% 18%, rgba(255,255,255,.86), rgba(255,255,255,0) 30%),
    linear-gradient(145deg, #F5F8FC, #F1FAF3);
  transform: rotateY(180deg);
}
.flash-card.is-flipped .flash-card__front { transform: rotateY(180deg); }
.flash-card.is-flipped .flash-card__back { transform: rotateY(360deg); }
.flash-controls { display: flex; justify-content: center; gap: var(--s2); margin-top: var(--s3); }
.flash-controls .btn { min-width: 86px; justify-content: center; }
.money-match__board {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(160px, .72fr) minmax(0, 1.28fr);
  gap: 10px; padding: 10px; border: 1px solid rgba(42,32,24,.08); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.42);
}
.money-match__col h3 {
  margin: 0 0 6px; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.money-match__stack { display: grid; gap: 7px; }
.match-card {
  width: 100%; min-height: 46px; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid rgba(42,32,24,.12); border-radius: 7px;
  background: rgba(255,255,255,.92); color: var(--ink); font: inherit; line-height: 1.25;
  text-align: left; cursor: pointer; box-shadow: 0 2px 0 rgba(42,32,24,.08), 0 8px 16px rgba(42,32,24,.04);
  transition: border-color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
}
.match-card:hover:not(:disabled) { border-color: #285C8E; transform: translateY(-2px); box-shadow: 0 4px 0 rgba(40,92,142,.16), 0 12px 18px rgba(42,32,24,.06); }
.match-card__pip {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%;
  background: #FBEAD6; border: 1px solid #E7C594; color: #9A5B0B; font-size: .62rem; font-weight: 800;
}
.match-card--term { border-color: #E7C594; font-weight: 800; font-size: .9rem; }
.match-card--clue { font-size: .82rem; }
.match-card.is-selected {
  border-color: #285C8E; background: #F5F8FC; box-shadow: 0 0 0 3px rgba(40,92,142,.14), 0 3px 0 rgba(40,92,142,.18);
}
.match-card.is-matched {
  border-color: #B9DCC3; background: #F1FAF3; color: #245D3A; cursor: default;
  animation: match-pop .28s ease both;
}
.match-card.is-matched::after {
  content: "+1"; margin-left: auto; font-family: var(--mono); font-size: .68rem; font-weight: 800; color: #2F7A4D;
}
.match-card.is-wrong {
  border-color: #C84630; background: #FFF1EE; animation: match-shake .24s ease both;
}
.match-card:disabled { opacity: 1; cursor: default; }
.quiz-mode-card {
  min-height: 242px; padding: var(--s4); border: 1px solid rgba(42,32,24,.1); border-radius: 10px;
  background: rgba(255,255,255,.62); box-shadow: inset 0 -3px 0 rgba(40,92,142,.06);
}
.quiz-mode-card h3 { margin: var(--s1) 0 var(--s3); font-size: 1.35rem; }
.quiz-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.quiz-choice {
  min-height: 58px; padding: 10px 12px; border: 1px solid rgba(42,32,24,.12); border-radius: 7px;
  background: rgba(255,255,255,.92); color: var(--ink); cursor: pointer; font: inherit; font-size: .84rem;
  line-height: 1.3; text-align: left; box-shadow: 0 2px 0 rgba(42,32,24,.08);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.quiz-choice:hover:not(:disabled) { border-color: #285C8E; transform: translateY(-1px); }
.quiz-choice.is-correct { border-color: #B9DCC3; background: #F1FAF3; color: #245D3A; }
.quiz-choice.is-correct::after { content: " +1"; font-family: var(--mono); font-weight: 800; color: #2F7A4D; }
.quiz-choice.is-wrong { border-color: #C84630; background: #FFF1EE; animation: match-shake .24s ease both; }
.quiz-choice:disabled { cursor: default; }
.quiz-next { margin-top: var(--s3); min-width: 96px; justify-content: center; }
.money-match__foot {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s3);
}
.money-match__status { min-height: 1.35em; font-weight: 800; font-size: .9rem; color: var(--ink); }
.money-match.is-complete .money-match__status { color: #2F7A4D; }
.money-match__reward {
  display: none; margin-left: auto; padding: 4px 9px; border-radius: 999px;
  background: #2F7A4D; color: #fff; font-family: var(--mono); font-size: .62rem;
  letter-spacing: .1em; text-transform: uppercase; box-shadow: 0 8px 16px rgba(47,122,77,.18);
}
.money-match.is-complete .money-match__reward { display: inline-flex; animation: reward-chip .45s ease both; }
.match-burst {
  pointer-events: none; position: absolute; right: 20px; top: 54%; width: 90px; height: 90px;
  z-index: 0; opacity: 0;
}
.match-burst span {
  position: absolute; left: 42px; top: 42px; width: 14px; height: 14px; border-radius: 50%;
  background: #E8924A; border: 1px solid rgba(154,91,11,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.match-burst span:nth-child(2) { background: #2F7A4D; }
.match-burst span:nth-child(3) { background: #285C8E; }
.match-burst span:nth-child(4) { background: #FBEAD6; }
.match-burst span:nth-child(5) { background: #77B28A; }
.match-burst span:nth-child(6) { background: #E7C594; }
.match-burst.is-burst, .match-burst.is-finale { opacity: 1; }
.match-burst.is-burst span:nth-child(1) { animation: match-coin .6s ease both; --x: -26px; --y: -28px; }
.match-burst.is-burst span:nth-child(2) { animation: match-coin .6s ease .03s both; --x: 18px; --y: -34px; }
.match-burst.is-burst span:nth-child(3) { animation: match-coin .6s ease .06s both; --x: 34px; --y: 4px; }
.match-burst.is-burst span:nth-child(4) { animation: match-coin .6s ease .09s both; --x: -18px; --y: 30px; }
.match-burst.is-burst span:nth-child(5) { animation: match-coin .6s ease .12s both; --x: 2px; --y: -48px; }
.match-burst.is-burst span:nth-child(6) { animation: match-coin .6s ease .15s both; --x: 44px; --y: -22px; }
.match-burst.is-finale span { animation: match-coin .95s cubic-bezier(.2,.8,.2,1) both; }
.match-burst.is-finale span:nth-child(1) { --x: -48px; --y: -50px; }
.match-burst.is-finale span:nth-child(2) { --x: 6px; --y: -68px; }
.match-burst.is-finale span:nth-child(3) { --x: 58px; --y: -36px; }
.match-burst.is-finale span:nth-child(4) { --x: -50px; --y: 28px; }
.match-burst.is-finale span:nth-child(5) { --x: 8px; --y: 54px; }
.match-burst.is-finale span:nth-child(6) { --x: 62px; --y: 20px; }
@keyframes match-pop {
  0% { transform: scale(.96); }
  70% { transform: scale(1.035); }
  100% { transform: scale(1); }
}
@keyframes match-coin {
  0% { opacity: 0; transform: translate(0, 0) scale(.55); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); }
}
@keyframes reward-chip {
  0% { opacity: 0; transform: translateY(6px) scale(.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes match-shake {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}
.project-panel {
  display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); gap: var(--s5);
  padding: var(--s5); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.project-panel__copy h2 { font-size: 1.35rem; margin: var(--s1) 0 var(--s3); }
.project-panel__copy p { color: var(--muted); }
.project-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.project-steps li { display: grid; grid-template-columns: 34px 1fr; gap: var(--s3); align-items: start; }
.project-steps .num {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: #FBEAD6; color: #9A5B0B; font-weight: 700;
}
.project-steps p { margin: 0; color: var(--ink); line-height: 1.45; }

/* module grid */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: var(--s7) 0 var(--s4); }
.section-head h2 { font-size: 1.05rem; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: var(--s4); }

.mod-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s5); text-decoration: none; color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-2); }
.mod-card__no { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.mod-card__rule { height: 1px; background: var(--line); margin: var(--s3) 0; }
.mod-card__name { font-size: 1.18rem; font-weight: 700; }
.mod-card__blurb { color: var(--muted); font-size: .92rem; margin-top: var(--s2); flex: 1 1 auto; }
.mod-card__due { align-self: flex-start; margin-top: var(--s3); padding: 3px 8px; border-radius: 99px; background: #FBEAD6; border: 1px solid #F0CFA3; color: #9A5B0B; font-family: var(--mono); font-size: .7rem; font-weight: 700; }
.mod-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s4); }
.mod-card__count { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mini-bar { width: 64px; height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.mini-bar__fill { height: 100%; background: var(--accent); width: 0; transition: width .5s ease; }

/* ==========================================================================
   Module view — ledger of entries
   ========================================================================== */
.mod-header { margin-bottom: var(--s5); }
.mod-header__no { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; font-size: 1rem; }
.mod-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: var(--s2); }
.mod-header__blurb { color: var(--muted); max-width: 60ch; margin-top: var(--s3); font-size: 1.05rem; }
.module-schedule { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2) var(--s3); max-width: 720px; margin-top: var(--s4); padding: var(--s3) var(--s4); border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: var(--radius-sm); }
.module-schedule__label { font-family: var(--mono); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.module-schedule b { color: var(--accent); }
.module-schedule > span:last-child { color: var(--muted); font-size: .85rem; }

.ledger { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.ledger__cap {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); background: #fff;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.entry {
  display: grid; grid-template-columns: 30px 96px 1fr auto; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-soft);
  text-decoration: none; color: var(--ink); transition: background .15s ease;
}
.entry:last-child { border-bottom: 0; }
.entry:hover { background: #F8F4EE; }
.entry__idx { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .82rem; }
.entry__title { font-weight: 600; line-height: 1.3; }
.entry__title small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.entry__meta { display: flex; align-items: center; gap: var(--s4); justify-self: end; }
.entry__pts { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .82rem; }
.entry__state { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--accent); font-size: .8rem; }
.entry.is-done .entry__state { background: var(--accent); border-color: var(--accent); color: #fff; }
/* closing balance line — the ledger totals its entries */
.ledger__foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s4) var(--s5); border-top: 2px solid var(--line); background: var(--surface-2);
  font-family: var(--mono); font-size: .82rem; letter-spacing: .04em; color: var(--muted);
}
.ledger__balance { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }

/* kind badge — quiet, mono, with a coloured leading tick */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: var(--radius-sm); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--badge-c, var(--muted)); }
.badge--watch  { --badge-c: var(--c-watch); }
.badge--do     { --badge-c: var(--c-do); }
.badge--read   { --badge-c: var(--c-read); }
.badge--assess { --badge-c: var(--c-assess); }

/* ==========================================================================
   Lesson view
   ========================================================================== */
.lesson { max-width: 820px; }
.lesson__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.lesson h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: var(--s2) 0 var(--s4); }
.lesson__note { color: var(--muted); margin: calc(-1 * var(--s2)) 0 var(--s5); font-size: 1.02rem; }
.rule { height: 1px; background: var(--line); border: 0; margin: var(--s6) 0; }
.lesson-plan {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  margin: var(--s5) 0; padding: var(--s4) var(--s5); border: 1px solid #D6E3F5;
  border-left: 4px solid #285C8E; border-radius: var(--radius-sm); background: #F5F8FC;
}
.lesson-plan p { margin: 0; color: var(--muted); font-size: .92rem; }
.lesson-plan p + p { margin-top: 4px; }
.lesson-plan__meta { flex: none; display: grid; grid-template-columns: minmax(120px, auto); gap: var(--s2); }

/* public curriculum map */
.curriculum .mod-header { max-width: 880px; }
.map-list { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s5); }
.map-row {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(210px, .36fr); gap: var(--s4);
  align-items: stretch; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.map-row__no {
  display: grid; place-items: center; border-radius: var(--radius-sm);
  background: #F5F8FC; color: #285C8E; font-size: 1.35rem; font-weight: 700;
}
.map-row__main h2 { font-size: 1.1rem; margin-bottom: var(--s2); }
.map-row__main p { margin: 0; color: var(--muted); line-height: 1.45; }
.map-row__meta { display: grid; gap: var(--s2); }
.evidence-panel {
  display: grid; grid-template-columns: minmax(0, .45fr) minmax(0, 1fr); gap: var(--s5);
  margin-top: var(--s6); padding: var(--s5); border: 1px solid #D5E8DA;
  border-left: 4px solid #2F7A4D; border-radius: var(--radius); background: #F6FBF7;
}
.evidence-panel h2 { font-size: 1.25rem; margin-top: var(--s1); }

.noscript-map { margin: var(--s5); padding: var(--s5); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.network-status {
  position: fixed; right: var(--s4); bottom: var(--s4); z-index: 90;
  max-width: min(340px, calc(100vw - 32px)); padding: var(--s3) var(--s4);
  border: 1px solid #D5E8DA; border-left: 4px solid #2F7A4D; border-radius: var(--radius-sm);
  background: #F6FBF7; color: #245C3A; font-size: .84rem; box-shadow: var(--shadow);
}
.network-status[hidden] { display: none; }

/* video embed */
.embed { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #130f0d; box-shadow: var(--shadow); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-cap { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: baseline; justify-content: space-between; margin-top: var(--s3); color: var(--muted); font-size: .92rem; }
.embed-cap__note { flex: 1 1 220px; }
.embed-cap__link { font-family: var(--mono); font-size: .8rem; letter-spacing: .03em; white-space: nowrap; }

/* prompt block (discussions / assignments) */
.prompt { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: var(--s5) var(--s6); box-shadow: var(--shadow); }
.prompt__cap { margin-bottom: var(--s3); }
.prompt :where(p, div) { margin: 0 0 var(--s3); }
.prompt :where(p, div):last-child { margin-bottom: 0; }
.prompt b, .prompt strong { color: var(--ink); }
.prompt :where(ul, ol) { margin: var(--s2) 0 var(--s4); padding-left: var(--s5); }
.prompt li { margin: var(--s1) 0; }
.prompt :where(h3, h4) { color: var(--ink); line-height: 1.3; margin: var(--s5) 0 var(--s3); }
.prompt :where(h3, h4):first-child { margin-top: 0; }
.prompt h3 { font-size: 1.1rem; }
.prompt h4 { font-size: 1rem; }
.prompt table { width: 100%; border-collapse: collapse; margin: var(--s3) 0 var(--s4); font-size: .92rem; }
.prompt :where(th, td) { border: 1px solid var(--line); padding: var(--s2) var(--s3); text-align: left; vertical-align: top; }
.prompt thead th { background: var(--surface-2); font-weight: 600; }

/* link-out card */
.linkout { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5) var(--s6); box-shadow: var(--shadow); }
.linkout__icon { flex: none; width: 52px; height: 52px; border-radius: var(--radius-sm); display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: .7rem; letter-spacing: .04em; color: #fff; background: var(--c-read); }
.linkout__icon[data-src="google-form"] { background: var(--c-assess); }
.linkout__icon[data-src="google-sheet"] { background: var(--c-do); }
.linkout__icon[data-src="external"] { background: var(--accent); }
.linkout__body { flex: 1 1 280px; }
.linkout__where { font-weight: 600; }
.linkout__sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--sans); font-weight: 600; font-size: .95rem;
  padding: var(--s3) var(--s5); border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #8F4207; }
/* .btn sets display:inline-flex, which beats the default [hidden] rule — restore it
   so a hidden button (e.g. the quiz Submit after grading) is actually removed */
.btn[hidden] { display: none; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* access note */
.notice { display: flex; gap: var(--s3); align-items: flex-start; margin-top: var(--s5); padding: var(--s3) var(--s4); border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: .86rem; background: var(--surface-2); }
.notice__mark { font-family: var(--mono); font-weight: 700; color: var(--accent); }

/* lesson footer nav */
.lesson-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); justify-content: space-between; margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); }
.pager { display: flex; gap: var(--s3); }
.pager a, .pager span { display: inline-flex; flex-direction: column; max-width: 220px; }
.pager .nav-dir { font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pager a { text-decoration: none; color: var(--ink); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager a .nav-ttl { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager .is-disabled { opacity: .35; padding: var(--s3) var(--s4); }
.pager--next a { text-align: right; align-items: flex-end; }
/* keep the pager hard-right even when the completion pill is hidden */
.lesson-foot .pager { margin-left: auto; }

/* completion indicator — lessons complete automatically, so this is a static
   badge (no manual toggle); it only shows once the lesson is done */
.lesson-status {
  display: none; align-items: center; gap: var(--s2);
  font-family: var(--sans); font-weight: 600; color: var(--accent);
  padding: var(--s3) var(--s5);
}
.lesson-status.is-done { display: inline-flex; }
.lesson-status .tick { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .7rem; }

/* ==========================================================================
   Responsive — sidebar becomes a drawer
   ========================================================================== */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; width: min(86vw, var(--sidebar-w));
    transform: translateX(-102%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(42,32,24,.25);
  }
  body.nav-open .sidebar { transform: none; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: var(--s2);
    position: fixed; top: var(--s4); left: var(--s4); z-index: 60;
    background: var(--ink); color: #fff; border: 0; cursor: pointer;
    padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
    font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
    content: ""; display: block; width: 16px; height: 2px; background: #fff; position: relative;
  }
  .nav-toggle__bars::before { position: absolute; top: -5px; }
  .nav-toggle__bars::after { position: absolute; top: 5px; }
  .main { height: 100vh; padding: calc(var(--s8) + var(--s2)) var(--s4) var(--s7); }
  /* keep the focused skip link clear of the fixed Menu toggle (same corner) */
  .skip-link:focus { left: 50%; transform: translateX(-50%); }
  .hero { padding: var(--s6) var(--s5); }
  .school-ready, .module-guide, .evidence-panel { grid-template-columns: 1fr; }
  .school-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kid-journey__head, .mission-hero { align-items: stretch; flex-direction: column; }
  .money-match__head { grid-template-columns: 1fr; }
  .money-match__board { grid-template-columns: minmax(112px, .64fr) minmax(0, 1.36fr); }
  .money-match__stats { min-width: 0; }
  .mission-grid, .reward-grid { grid-template-columns: 1fr; }
  .project-panel { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 46px minmax(0, 1fr); }
  .map-row__meta { grid-column: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lesson-plan { align-items: stretch; flex-direction: column; }
  .entry { grid-template-columns: 96px 1fr auto; gap: var(--s3); padding: var(--s4); }
  .entry__idx { display: none; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .main { padding-left: var(--s3); padding-right: var(--s3); }
  .hero, .prompt, .linkout { padding-left: var(--s4); padding-right: var(--s4); }
  .reward-road { padding-left: 0; }
  .reward-road::before { left: 25px; }
  .reward-road .reward-card {
    grid-template-columns: 52px minmax(0, 1fr); gap: var(--s3); padding: var(--s4);
  }
  .reward-road .reward-card__coin { width: 44px; height: 44px; box-shadow: 0 0 0 6px var(--bg); }
  .reward-road .reward-card__art {
    grid-column: 2; width: min(132px, 45vw); justify-self: start; margin-bottom: var(--s2);
  }
  .reward-road .reward-card__body { grid-column: 2; }
  .money-match { padding: var(--s4); }
  .money-match__modes { gap: 4px; }
  .mode-tab { min-height: 32px; font-size: .58rem; letter-spacing: .04em; }
  .deck-quick { align-items: stretch; flex-direction: column; gap: var(--s2); }
  .deck-quick span { justify-content: space-between; }
  .deck-quick__add { width: 100%; justify-content: center; }
  .deck-builder summary { align-items: flex-start; flex-direction: column; gap: 2px; }
  .deck-builder__note { align-items: flex-start; flex-direction: column; gap: 3px; }
  .deck-builder__note span { text-align: left; }
  .custom-word-form { grid-template-columns: 1fr; }
  .custom-word-form__actions .btn { flex: 1 1 0; justify-content: center; }
  .custom-word { grid-template-columns: 1fr; }
  .custom-word span { justify-content: stretch; }
  .custom-word__btn { flex: 1 1 0; }
  .money-match__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .money-match__stats span { min-height: 48px; padding: 7px; }
  .flash-card { min-height: 160px; }
  .flash-card__face { padding: var(--s4); }
  .flash-controls .btn { min-width: 0; flex: 1 1 0; }
  .match-card { min-height: 44px; padding: 8px 9px; }
  .match-card--clue { font-size: .8rem; }
  .quiz-mode-card { min-height: auto; padding: var(--s3); }
  .quiz-choice-grid { grid-template-columns: 1fr; }
  .quiz-choice { min-height: 48px; padding: 8px 9px; font-size: .8rem; }
  .match-burst { right: 6px; top: 44%; transform: scale(.82); }
  .money-match__foot { align-items: stretch; flex-direction: column; }
  .money-match__reward { justify-content: center; margin-left: 0; }
  .money-match__foot .btn { width: 100%; justify-content: center; }
  .statbar { gap: var(--s5); }
  .school-ready { padding: var(--s5); }
  .school-cards { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; }
  .map-row__no { width: 46px; height: 46px; }
  .map-row__meta { grid-column: auto; grid-template-columns: 1fr; }
  .entry { grid-template-columns: 92px 1fr; }
  .entry__meta { grid-column: 2; justify-self: start; }
  .lesson-foot { align-items: stretch; }
  .lesson-foot .pager { width: 100%; margin-left: 0; justify-content: space-between; }
  .pager a, .pager span { flex: 1 1 0; min-width: 0; max-width: calc(50% - var(--s2)); }
}

@media (max-width: 360px) {
  .money-match__board { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Account panel (sidebar foot)
   ========================================================================== */
.account { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s2); }
.account__off { margin: 0; font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; flex-direction: column; gap: var(--s1); }
.account__off small { font-family: var(--sans); letter-spacing: normal; text-transform: none; font-size: .8rem; color: var(--muted); }
.account__signin { width: 100%; justify-content: center; }
.account__blurb { margin: 0; font-size: .78rem; color: var(--muted); }
.account__who { display: flex; align-items: center; gap: var(--s3); }
.account__avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: .8rem; color: #fff; background: var(--accent); }
.account__id { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.account__name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__sync { font-size: .7rem; color: var(--accent); }
.account__actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.account__teacher { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--muted); text-decoration: none; }
.account__teacher:hover { color: var(--accent); text-decoration: underline; }

/* --- signed-in account pill (collapsed) --------------------------------- */
.acct { position: relative; }
.acct-trigger {
  width: 100%; display: flex; align-items: center; gap: var(--s2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 8px; cursor: pointer; text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.acct-trigger:hover,
.acct.is-open .acct-trigger { border-color: var(--accent); }
.acct-trigger__avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: .7rem;
  color: #fff; background: var(--accent);
}
.acct-trigger__text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.2; }
.acct-trigger__name { font-weight: 700; font-size: .9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-trigger__handle { font-family: var(--mono); font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-trigger__chev { flex: none; color: var(--muted); font-size: .8rem; transition: transform .2s ease; }
.acct.is-open .acct-trigger__chev { transform: rotate(180deg); }

/* --- account popover menu (rendered on <body>, positioned from trigger) - */
.acct-pop[hidden] { display: none; }
.acct-pop {
  position: fixed; z-index: 70;
  display: flex; flex-direction: column; gap: var(--s3);
  min-width: 248px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(42, 32, 24, .16); padding: var(--s4);
  animation: acctPop .14s ease;
}
@keyframes acctPop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.acct-pop__header { display: flex; align-items: center; gap: var(--s3); }
.acct-pop__avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: .82rem;
  color: #fff; background: var(--accent);
}
.acct-pop__id { min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.acct-pop__name { margin: 0; display: flex; align-items: center; gap: var(--s2); min-width: 0; font-weight: 700; font-size: 1rem; color: var(--ink); }
.acct-pop__nametext { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-pop__handle { margin: 0; font-family: var(--mono); font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.role-badge {
  flex: none; font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  padding: 2px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.role-badge--teacher { background: var(--accent); color: #fff; border-color: var(--accent); }

.acct-pop__body { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.acct-pop__foot { display: flex; flex-direction: column; gap: 2px; padding-top: var(--s3); border-top: 1px solid var(--line); }
.acct-shortcuts { display: flex; flex-direction: column; gap: var(--s2); }
.acct-shortcut.grades-link { margin-top: 0; padding: 8px 10px; font-size: .86rem; }
.acct-teacher-name { display: flex; flex-direction: column; gap: 5px; }
.acct-teacher-name__row { display: flex; gap: 5px; }
.acct-teacher-name__title, .acct-teacher-name__last {
  min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .82rem; padding: 7px 8px;
}
.acct-teacher-name__title { flex: 0 0 67px; }
.acct-teacher-name__last { flex: 1 1 auto; }
.acct-teacher-name__title:focus, .acct-teacher-name__last:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* region/language widgets inside the popover drop the sidebar padding */
.acct-pop .region-switch { padding: 0; }
.acct-pop .lang-field { position: relative; }
.acct-pop .lang-field > label {
  display: block; margin-bottom: 4px;
  font-family: var(--mono); font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.acct-pop .lang-field::after {
  content: "▾"; position: absolute; right: 12px; bottom: 11px;
  pointer-events: none; color: var(--muted); font-size: .7rem;
}
.acct-pop .lang-select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); font: inherit; font-size: .86rem; font-weight: 600;
  padding: 8px 28px 8px 10px; cursor: pointer;
}
.acct-pop .lang-select:hover { border-color: var(--accent); }

/* menu items: teacher dashboard link + sign out */
.acct-item {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%; background: none; border: 0; border-radius: var(--radius-sm);
  padding: 8px; margin: 0; cursor: pointer; text-align: left;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink);
  text-decoration: none; transition: background .12s ease, color .12s ease;
}
.acct-item:hover { background: var(--surface-2); }
.acct-item__ico { flex: none; width: 1.1em; text-align: center; font-size: .95em; }
.acct-item--link { color: var(--muted); }
.acct-item--link:hover { color: var(--accent); }
.acct-item--danger { color: #B42318; }
.acct-item--danger:hover { background: #FDECEA; color: #B42318; }

/* ==========================================================================
   Classroom: account-type tabs, class code, join, peers, dashboard banner
   ========================================================================== */
/* --- account-type segmented control (Create account) -------------------- */
.acct-type {
  display: flex; gap: 4px; margin-bottom: var(--s3);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px;
}
.acct-type[hidden] { display: none; }
.acct-type__opt {
  flex: 1 1 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 600; color: var(--muted);
  padding: 7px 8px; border-radius: 6px; transition: background .15s ease, color .15s ease;
}
.acct-type__opt:hover { color: var(--ink); }
.acct-type__opt.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth-hint { margin: calc(-1 * var(--s2)) 0 0; font-size: .8rem; color: var(--muted); }
.auth-hint[hidden] { display: none; }

/* --- "class created" success panel -------------------------------------- */
#authDone[hidden] { display: none; }
.auth-done__lead { margin: var(--s3) 0; color: var(--muted); }
.auth-done__code {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--radius);
  padding: var(--s4); margin-bottom: var(--s3);
}
.auth-done__code code {
  flex: 1 1 auto; font-family: var(--mono); font-weight: 700; font-size: 1.5rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
}
.auth-done__copy {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.auth-done__copy:hover { border-color: var(--accent); color: var(--accent); }
.auth-done__hint { margin: 0 0 var(--s4); font-size: .8rem; color: var(--muted); }

/* --- class section inside the account popover --------------------------- */
.acct-class { display: flex; flex-direction: column; gap: 4px; }
.acct-class__label {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.acct-class__code {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 6px 6px 10px;
}
.acct-class__code code {
  flex: 1 1 auto; font-family: var(--mono); font-weight: 700; font-size: 1rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.acct-class__copy {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.acct-class__copy:hover { border-color: var(--accent); color: var(--accent); }
.acct-class__hint { margin: 0; font-size: .72rem; color: var(--muted); }
.acct-class__name { margin: 0; font-weight: 700; color: var(--ink); }
.acct-class__leave {
  align-self: flex-start; background: none; border: 0; padding: 2px 0; cursor: pointer;
  font: inherit; font-size: .76rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.acct-class__leave:hover { color: #B42318; }

.acct-join { display: flex; flex-direction: column; gap: 4px; }
.acct-join__row { display: flex; gap: var(--s2); }
.acct-join__input {
  flex: 1 1 auto; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); font: inherit; font-size: .86rem; padding: 7px 10px;
}
.acct-join__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.acct-join__btn {
  flex: none; border: 0; background: var(--accent); color: #fff; cursor: pointer;
  font: inherit; font-size: .84rem; font-weight: 700; padding: 7px 14px; border-radius: var(--radius-sm);
}
.acct-join__btn:hover { filter: brightness(1.05); }
.acct-join__msg { margin: 0; font-size: .76rem; min-height: 1em; }
.acct-join__msg.is-error { color: #B42318; }
.acct-join__msg.is-info { color: var(--muted); }

/* --- classmates' responses on discussion lessons ------------------------ */
.peers { margin-top: var(--s5); }
.peers__cap { color: var(--muted); display: flex; align-items: center; gap: var(--s2); }
.peers__count {
  font-family: var(--mono); font-size: .68rem; font-weight: 700; color: var(--accent);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.peers__list { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.peer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.peer__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.peer__name { font-weight: 700; color: var(--ink); }
.peer__when { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.peer__text { margin: 0; color: var(--ink); white-space: pre-wrap; line-height: 1.55; }

/* --- teacher dashboard class-code banner -------------------------------- */
.class-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4);
}
.class-banner__label { font-family: var(--mono); font-size: .72rem; line-height: 1.35; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.class-banner__code { font-family: var(--mono); font-weight: 700; font-size: 1rem; line-height: 1.35; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.class-banner .link-btn { padding: 0; font-size: .82rem; line-height: 1.35; }
.class-banner__hint { font-size: .82rem; line-height: 1.35; color: var(--muted); }

/* --- due dates: module-list chip, lesson banner/editor, dashboard rows --- */
.btn--sm { padding: var(--s2) var(--s4); font-size: .85rem; }

/* read-only chip under an assignment title in the module list */
.due-chip { display: inline-block; margin-top: 4px; font-family: var(--mono); font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.due-chip.is-soon { background: #FBEAD6; border-color: #F0CFA3; color: #9A5B0B; }
.due-chip.is-overdue { background: #F8E3E0; border-color: #EEBFB8; color: #B3261E; }

/* the student's view of the due date on a lesson page */
.due-banner { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; margin: var(--s5) 0; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.due-banner.is-soon { border-left-color: #9A5B0B; }
.due-banner.is-overdue { border-left-color: #B3261E; background: #F8E3E0; }
.due-banner__cap { font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.due-banner__date { font-weight: 700; color: var(--ink); }
.due-banner__rel { color: var(--muted); font-weight: 400; }
.due-banner.is-overdue .due-banner__rel { color: #B3261E; font-weight: 600; }

/* the teacher's inline editor on a lesson page */
.due-editor { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin: var(--s5) 0; padding: var(--s3) var(--s4); border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.due-editor__cap { font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.due-editor__input, .due-row__input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.due-editor .link-btn { padding: 0; }
.due-editor__status { font-size: .82rem; color: var(--muted); }
.due-editor__status.is-soon { color: #9A5B0B; }
.due-editor__status.is-overdue { color: #B3261E; }

/* dashboard "Due dates" tab */
.schedule-card { margin-bottom: var(--s6); padding: var(--s5); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.schedule-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s5); }
.schedule-card__head .eyebrow { margin: 0; }
.schedule-card__head h2 { margin: var(--s1) 0 var(--s2); font-size: 1.35rem; }
.schedule-card__head p:not(.eyebrow) { max-width: 720px; margin: 0; color: var(--muted); }
.schedule-action { flex: none; display: flex; flex-direction: column; align-items: center; gap: var(--s2); min-width: 194px; }
.schedule-action .btn { width: 100%; justify-content: center; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.schedule-action .btn.is-applied { background: #2F7A4D; border-color: #2F7A4D; }
.schedule-confirm { margin: 0; text-align: center; color: #2F7A4D !important; font-size: .82rem; font-weight: 700; line-height: 1.35; animation: schedule-confirm-in .28s ease-out; }
.schedule-confirm span { color: var(--muted); font-size: .72rem; font-weight: 500; }
@keyframes schedule-confirm-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.schedule-fields { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .65fr) minmax(180px, 1fr); gap: var(--s4); margin-top: var(--s5); }
.schedule-fields .field { max-width: none; }
.schedule-fields input { width: 100%; }
.schedule-weeks { display: flex; align-items: center; gap: var(--s2); }
.schedule-weeks b { color: var(--muted); font-size: .82rem; }
.schedule-note { margin: var(--s3) 0 var(--s4); color: var(--muted); font-size: .84rem; }
.schedule-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.schedule-module { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s2); row-gap: 2px; padding: var(--s3); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); }
.schedule-module__no { grid-row: 1 / 3; align-self: center; font-family: var(--mono); font-weight: 700; color: var(--accent); }
.schedule-module__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: .82rem; }
.schedule-module__range, .schedule-module__count { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.schedule-module__count { grid-column: 2; }
.schedule-msg { min-height: 1.2em; margin-top: var(--s3); font-size: .84rem; color: var(--muted); }
.schedule-msg.is-success { color: #2F7A4D; font-weight: 600; }
.schedule-msg.is-error, .schedule-error { color: #B3261E; font-weight: 600; }
.due-head { color: var(--muted); margin-bottom: var(--s4); }
.due-list { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.due-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.due-row__title { font-weight: 600; flex: 1 1 220px; min-width: 0; }
.due-row__status { font-family: var(--mono); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.due-row__status.is-soon { color: #9A5B0B; }
.due-row__status.is-overdue { color: #B3261E; }
.due-row__input { background: var(--surface-2); padding: 5px 7px; }
.due-row .link-btn { padding: 0; }
@media (max-width: 800px) {
  .schedule-card { padding: var(--s4); }
  .schedule-card__head { flex-direction: column; gap: var(--s4); }
  .schedule-action { width: 100%; }
  .schedule-fields { grid-template-columns: 1fr; margin-top: var(--s4); }
  .schedule-modules { grid-template-columns: 1fr; }
}

/* --- teacher authoring: tags, edit/add bar, forms, dashboard content tab --- */
.field select, .field textarea {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3) var(--s4);
}
.field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field--narrow { max-width: 130px; }

.author-tag { font-family: var(--mono); font-size: .58rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.author-tag--new { background: #FBEAD6; border-color: #F0CFA3; color: #9A5B0B; }

.author-bar { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.author-bar--lesson { margin: var(--s5) 0; }

.author { margin: var(--s4) 0; padding: var(--s4) var(--s5); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); display: flex; flex-direction: column; gap: var(--s3); }
.author__cap { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0; }
.author__row { display: flex; flex-wrap: wrap; gap: var(--s4); }
.author__row .field { flex: 1 1 160px; }
.author__row .field--narrow { flex: 0 0 auto; }
.author__foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s4); }
.author__msg { margin: 0; font-size: .86rem; min-height: 1.1em; color: var(--muted); }
.author__msg.is-error { color: #8a2c1d; }
.author__msg.is-info { color: var(--accent); }

/* dashboard "Content" tab */
.content-mod { margin-bottom: var(--s6); }
.content-mod__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s3); }
.content-mod__head h3 { font-size: .95rem; font-weight: 700; }
.content-list { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.content-row { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: var(--s3) var(--s4); }
.content-row__main { display: flex; align-items: center; gap: var(--s3); }
.content-row__title { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.content-row .author { background: #fff; }

/* ==========================================================================
   Auth modal
   ========================================================================== */
body.modal-open { overflow: hidden; }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: var(--s4); }
.modal__scrim { position: absolute; inset: 0; background: rgba(42,32,24,.45); }
.modal__card {
  position: relative; width: min(440px, 100%); max-height: 90vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s6); box-shadow: 0 12px 48px rgba(42,32,24,.28); animation: rise .25s ease both;
}
.modal__x { position: absolute; top: var(--s3); right: var(--s3); width: 32px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--muted); border-radius: var(--radius-sm); }
.modal__x:hover { background: var(--surface-2); color: var(--ink); }
.modal__title { font-size: 1.5rem; margin: var(--s2) 0 var(--s4); }
.modal__tabs { display: flex; gap: var(--s1); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; margin-bottom: var(--s5); }
.modal__tab { flex: 1; border: 0; background: none; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 600; color: var(--muted); padding: var(--s2); border-radius: var(--radius-sm); }
.modal__tab.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(42,32,24,.08); }
.modal__form { display: flex; flex-direction: column; gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field[hidden] { display: none; }
.field > span { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field input, .select, .search {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3) var(--s4);
}
.field input:focus, .select:focus, .search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.modal__msg { margin: 0; font-size: .86rem; min-height: 1.1em; }
.modal__msg.is-error { color: #8a2c1d; }
.modal__msg.is-info { color: var(--muted); }
.modal__submit { width: 100%; justify-content: center; margin-top: var(--s1); }
.auth-reset {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding-top: var(--s2); border-top: 1px solid var(--line);
}
.auth-reset p { margin: 0; font-size: .86rem; color: var(--muted); }
.auth-reset__btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: .86rem; font-weight: 700; color: var(--accent);
  text-align: right;
}
.auth-reset__btn:hover { color: #8F4207; text-decoration: underline; }

/* ==========================================================================
   Response box (discussions / assignments)
   ========================================================================== */
.respond { margin-top: var(--s6); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c-do); border-radius: var(--radius); padding: var(--s5) var(--s6); box-shadow: var(--shadow); }
.respond__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.respond__cap { margin: 0; }
.respond__status { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-align: right; }
.respond__gate { margin: 0 0 var(--s3); font-size: .9rem; color: var(--muted); }
.respond__area { width: 100%; font: inherit; font-size: .98rem; line-height: 1.55; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s4); resize: vertical; min-height: 120px; }
.respond__area:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); background: var(--surface); }
.respond__area:disabled { opacity: .6; cursor: not-allowed; }
.respond__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); }
.respond__hint { font-size: .8rem; color: var(--muted); }
.respond__foot .btn { margin-left: auto; }

/* article worksheet — one answer field per question */
.worksheet .qa-list { margin: var(--s2) 0 0; padding-left: var(--s5); }
.worksheet .qa { margin: 0 0 var(--s5); }
.worksheet .qa:last-child { margin-bottom: 0; }
.worksheet .qa::marker { color: var(--c-do); font-weight: 700; }
.worksheet .qa__q { color: var(--ink); line-height: 1.5; margin-bottom: var(--s2); }
.worksheet .qa__a { min-height: 64px; }

/* interactive quiz */
.quiz-list { margin: var(--s2) 0 0; padding-left: var(--s5); }
.quiz-q { margin: 0 0 var(--s5); }
.quiz-q:last-child { margin-bottom: 0; }
.quiz-q::marker { color: var(--c-assess); font-weight: 700; }
.quiz-q__text { color: var(--ink); font-weight: 500; line-height: 1.5; margin-bottom: var(--s3); white-space: pre-line; }
.quiz-opts { display: flex; flex-direction: column; gap: var(--s2); }
.quiz-opt { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt input { margin: .2em 0 0; flex: none; }
.quiz-opt input:disabled { cursor: default; }
.quiz-opt:has(input:disabled) { cursor: default; }
.quiz-opt.is-correct { border-color: #2e7d32; background: color-mix(in srgb, #2e7d32 16%, var(--surface-2)); }
.quiz-opt.is-correct .quiz-opt__txt::after { content: " ✓"; color: #2e7d32; font-weight: 700; }
.quiz-opt.is-wrong { border-color: #c0392b; background: color-mix(in srgb, #c0392b 13%, var(--surface-2)); }
.quiz-opt.is-wrong .quiz-opt__txt::after { content: " ✗"; color: #c0392b; font-weight: 700; }
.quiz-score { font-weight: 700; color: var(--ink); margin-right: auto; }

/* ==========================================================================
   Teacher dashboard (admin.html)
   ========================================================================== */
/* The course app locks html/body scroll (app-shell). The admin page is a normal
   top-to-bottom document, so let its body scroll its own content. */
.admin-body { background: var(--ground); height: 100%; overflow-y: auto; }
.admin-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) var(--s6); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand--top { padding: 0; }
.admin-top__right { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.admin-top__right .link-btn { padding: 0; }
.admin-main { max-width: 1440px; margin: 0 auto; padding: var(--s7) var(--s6) var(--s8); }
.admin-back { float: right; margin-left: var(--s4); font-size: 1.05rem; padding: var(--s4) var(--s6); }
.admin-head { margin-bottom: var(--s6); }
.admin-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: var(--s2) 0; }
.statbar--admin { margin-top: var(--s5); }

/* teacher toolkit tab */
.toolkit-hero {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
  margin-bottom: var(--s5); padding: var(--s5); border: 1px solid #D5E8DA;
  border-left: 4px solid #2F7A4D; border-radius: var(--radius); background: #F6FBF7; box-shadow: var(--shadow);
}
.toolkit-hero h2 { font-size: 1.45rem; margin: var(--s1) 0 var(--s2); }
.toolkit-hero p:not(.eyebrow) { margin: 0; color: var(--muted); max-width: 74ch; }
.toolkit-actions { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: flex-end; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr) minmax(0, .85fr); gap: var(--s4); margin-bottom: var(--s6); }
.tool-panel {
  padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.tool-panel ul { margin: var(--s3) 0 0; padding-left: var(--s5); color: var(--muted); }
.tool-panel li { margin: var(--s1) 0; }
.tool-step { display: grid; grid-template-columns: 34px 1fr; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line-soft); }
.tool-step:first-of-type { border-top: 0; }
.tool-step__no {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: #F5F8FC; color: #285C8E; font-weight: 700;
}
.tool-step h3 { font-size: .98rem; margin-bottom: 2px; }
.tool-step h3 small { color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 600; }
.tool-step p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.tool-modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: var(--s4); }
.tool-module {
  padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.tool-module__head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.tool-module__head .num { color: var(--accent); font-weight: 700; }
.tool-module__head h3 { font-size: 1.02rem; }
.tool-module p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.tool-module__meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.tool-module__meta span {
  display: flex; flex-direction: column; padding: var(--s2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.tool-module__meta b { font-size: .88rem; }
.tool-module__meta small { font-family: var(--mono); font-size: .58rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.tool-module__note { margin-top: var(--s3) !important; padding-top: var(--s3); border-top: 1px dashed var(--line); }

/* gate / passcode + disabled screens */
.gate { min-height: 60vh; display: grid; place-items: center; }
.gate__card { width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s7); box-shadow: var(--shadow); }
.gate__title { font-size: 1.6rem; }
.gate__msg { color: var(--muted); margin: 0; font-size: .95rem; }
.gate__msg code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.gate__card .field { margin-top: var(--s2); }
.gate__card .btn { justify-content: center; }
.gate__back { font-family: var(--mono); font-size: .76rem; color: var(--muted); text-decoration: none; text-align: center; margin-top: var(--s1); }
.gate__back:hover { color: var(--accent); }

/* toolbar */
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.tabs { display: inline-flex; gap: var(--s1); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.tab { border: 0; background: none; cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); padding: var(--s2) var(--s4); border-radius: var(--radius-sm); }
.tab.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(42,32,24,.08); }
.admin-filters { display: flex; gap: var(--s3); flex-wrap: wrap; }
.search { min-width: 200px; }

/* roster (by student) */
.roster { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.roster__item { border-bottom: 1px solid var(--line-soft); }
.roster__item:last-child { border-bottom: 0; }
.roster__row { display: grid; grid-template-columns: 40px minmax(0,1fr) 92px 92px 76px 84px 80px 18px; align-items: center; gap: var(--s4); width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: var(--s4) var(--s5); font: inherit; color: var(--ink); }
.roster__row:hover { background: var(--surface-2); }
.roster__item.is-open > .roster__row { background: var(--surface-2); }
.roster__avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: .82rem; color: #fff; background: var(--c-assess); }
.roster__id { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.roster__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster__username { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster__metric { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.roster__metric b { font-size: 1rem; }
.roster__metric small { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.roster__metric--points b { color: var(--accent); }
.roster__bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.roster__bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.roster__chev { color: var(--muted); font-size: .8rem; text-align: center; }
.roster__detail { padding: var(--s2) var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s3); border-top: 1px dashed var(--line); }
.roster__hint { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.detail__line { margin: var(--s2) 0 0; color: var(--muted); font-size: .9rem; }
.detail__empty { margin: var(--s2) 0 0; color: var(--muted); font-style: italic; font-size: .9rem; }
.detail__missing { margin: var(--s2) 0 0; font-size: .86rem; color: var(--muted); }
.detail__cap { margin: var(--s2) 0 0; color: var(--muted); }
.detail__cap-note { font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; text-transform: none; color: var(--muted); margin-left: var(--s2); }

/* grades (per-student grade list + per-lesson score list) */
.grades { display: flex; flex-direction: column; gap: var(--s2); }
.grade-row { display: flex; align-items: center; gap: var(--s3); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: var(--s2) var(--s4); font-size: .92rem; }
.grade-row__title { font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-row__score { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.grade-row__when { font-family: var(--mono); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.grade-row__pending { font-style: italic; }
.grade-row.is-missing { opacity: .62; }
.grade-row.is-missing .grade-row__title { font-weight: 500; }
a.grade-row { color: inherit; text-decoration: none; transition: border-color .15s ease, background .15s ease; }
a.grade-row:hover { border-color: var(--accent); background: var(--surface); }

/* expandable grade row — click to reveal the student's quiz answers */
.grade-row-wrap { display: flex; flex-direction: column; }
.grade-row--btn { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.grade-row--btn:hover, .grade-row-wrap.is-open > .grade-row--btn { border-color: var(--accent); background: var(--surface); }
.grade-row-wrap.is-open > .grade-row--btn { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.grade-row__chev { color: var(--muted); font-size: .8rem; flex: none; }
/* compact, self-scrolling quiz replay — used in both the By-lesson and By-student
   tabs. padding-left on the list keeps the question numbers (1., 2.) clear of the
   left edge so they're never clipped. */
.quiz-review { border: 1px solid var(--accent); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--surface); padding: var(--s4) var(--s5); max-height: 320px; overflow-y: auto; }
.quiz-review .quiz-list { margin-top: 0; padding-left: var(--s6); }
.quiz-review .quiz-q { margin-bottom: var(--s3); }
.quiz-review .quiz-q__text { font-size: .88rem; margin-bottom: var(--s2); }
.quiz-review .quiz-opts { gap: 6px; }
.quiz-review .quiz-opt { cursor: default; padding: var(--s2) var(--s3); font-size: .85rem; }
.quiz-review .quiz-opt:hover { border-color: var(--line); }
.quiz-review .quiz-opt.is-correct:hover { border-color: #2e7d32; }
.quiz-review .quiz-opt.is-wrong:hover { border-color: #c0392b; }
.quiz-review__raw { margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: .82rem; line-height: 1.55; color: var(--ink); }
.quiz-q__note { font-weight: 500; font-size: .76rem; font-style: italic; color: var(--muted); }

/* student detail — a sidebar of assignments stuck to the left, detail on the right.
   The two columns are one bordered panel; the list and the detail each scroll on
   their own, so the assignment rail stays put while you read a long quiz. */
.sd-split { display: grid; grid-template-columns: minmax(190px, 264px) 1fr; align-items: stretch; margin-top: var(--s3); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.sd-list { display: flex; flex-direction: column; gap: 2px; max-height: 460px; overflow-y: auto; padding: var(--s2); background: var(--surface-2); border-right: 1px solid var(--line-soft); }
.sd-item { display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; background: transparent; border: 0; border-radius: var(--radius-sm); padding: var(--s2) var(--s3); transition: background .12s ease; }
.sd-item:hover { background: var(--surface); }
.sd-item.is-active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.sd-item__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .84rem; }
.sd-item__status { font-family: var(--mono); font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.sd-item__status.is-done { color: #2F7A4D; }
.sd-item__status.is-missing { color: var(--muted); opacity: .65; }
.sd-detail { background: var(--surface); padding: var(--s4) var(--s5); min-height: 220px; }
.sd-detail__empty { display: flex; align-items: center; justify-content: center; min-height: 188px; color: var(--muted); font-style: italic; text-align: center; }
.sd-detail__head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); padding-bottom: var(--s3); border-bottom: 1px dashed var(--line); }
.sd-detail__title { font-weight: 700; flex: 1 1 auto; min-width: 0; font-size: .98rem; }
.sd-detail__when { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.sd-detail__score { margin: 0 0 var(--s3); font-size: .92rem; }
/* inside the By-student panel the replay drops its own border (the panel frames it)
   but keeps the compact + scroll behaviour from the shared .quiz-review rules. */
.sd-detail .quiz-review { border: 0; border-radius: 0; padding: 0 var(--s2) 0 0; }
.sd-detail .detail__empty { margin: 0; }
.answer--detail { background: transparent; border: 0; padding: 0; }
.sd-detail .answer--detail { max-height: 320px; overflow-y: auto; padding-right: var(--s3); }
@media (max-width: 760px) {
  .sd-split { grid-template-columns: 1fr; }
  .sd-list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
}

/* grade pill — colour-coded score badge */
.grade-pill { display: inline-block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.grade-pill.is-good { background: #E7F2EA; border-color: #BFE0CB; color: #2F7A4D; }
.grade-pill.is-ok   { background: #FBEAD6; border-color: #F0CFA3; color: #9A5B0B; }
.grade-pill.is-low  { background: #F8E3E0; border-color: #EEBFB8; color: #B3261E; }
.roster__metric--grade b { font-weight: 400; }

/* answer card (a single written response) */
.answer { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); }
.answer__head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.answer__title { font-weight: 600; font-size: .92rem; flex: 1 1 auto; min-width: 0; }
.answer__when { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.answer__text { margin: 0; white-space: pre-wrap; font-size: .94rem; line-height: 1.55; color: var(--ink); }

/* lesson cards (by lesson) */
.lesson-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); margin-bottom: var(--s3); }
.lesson-card__row { display: grid; grid-template-columns: auto minmax(0,1fr) 118px 18px; align-items: center; gap: var(--s4); width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: var(--s4) var(--s5); font: inherit; color: var(--ink); }
.lesson-card__row:hover, .lesson-card.is-open > .lesson-card__row { background: var(--surface-2); }
.lesson-card__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-card__count { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.2; }
.lesson-card__count small { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.lesson-card__detail .grade-row__title { flex: 1 1 auto; }
.lesson-card__detail { padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s3); border-top: 1px dashed var(--line); }

.empty { padding: var(--s7); text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }

@media (max-width: 720px) {
  .admin-main { padding: var(--s6) var(--s4) var(--s7); }
  .admin-top { padding: var(--s3) var(--s4); }
  /* avatar | name | completed | grade | chev — hide responses (5th) + bar (6th) */
  .toolkit-hero { align-items: stretch; flex-direction: column; }
  .toolkit-actions { justify-content: stretch; }
  .toolkit-actions .btn { justify-content: center; flex: 1 1 auto; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-module__meta { grid-template-columns: 1fr; }
  .roster__row { grid-template-columns: 36px minmax(0,1fr) auto auto 18px; }
  .roster__row > :nth-child(5), .roster__row > :nth-child(6), .roster__bar { display: none; }
  .lesson-card__row { grid-template-columns: auto minmax(0,1fr) auto 18px; }
}

/* Printable classroom packs */
@media print {
  html, body { height: auto; overflow: visible; background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; height: auto; overflow: visible; }
  .sidebar, .nav-toggle, .scrim, .account, .grades-link, .school-ready__actions,
  .lesson-plan__meta .btn, .teacher-snapshot__cta, .admin-top, .admin-back,
  .admin-toolbar, .modal, .network-status { display: none !important; }
  .main, .admin-main { height: auto; overflow: visible; padding: 0; }
  .view, .lesson { width: 100%; max-width: none; margin: 0; animation: none; }
  .hero, .school-ready, .school-card, .trust-strip, .module-guide, .lesson-plan,
  .prompt, .respond, .linkout, .ledger, .map-row, .evidence-panel, .schedule-card,
  .lesson-card, .roster, .content-row, .kid-journey, .mission-card, .reward-card,
  .mission-hero, .money-match, .project-panel {
    box-shadow: none !important; border-color: #bbb !important; background: #fff !important;
    break-inside: avoid; page-break-inside: avoid;
  }
  .hero { padding: 0 0 14pt; border: 0; }
  .hero::after { display: none; }
  .school-cards { grid-template-columns: repeat(2, 1fr); }
  .map-row { grid-template-columns: 42pt 1fr 150pt; }
  .prompt, .respond, .module-guide, .lesson-plan { margin-top: 12pt; padding: 12pt; }
  .embed, .embed-cap, .peers, .pager, .lesson-status, .author-bar, .author, .mission-hero__badge { display: none !important; }
  a { color: #000; text-decoration: underline; }
  .btn { border: 1px solid #999; color: #000; background: #fff; }
}

/* ==========================================================================
   Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
