/* Gir. Light theme: a squared math notebook. Dark theme: the green classroom board. Tokens in docs/DESIGN.md. */
:root {
  --paper: #f5f8f6;
  --paper-2: #edf2ef;
  --surface: #fdfefd;
  --surface-2: #ffffff;
  --ink: #1c2925;
  --muted: #55655f;
  --faint: #7d8c86;
  --grid: #dfe7e3;
  --line: #d3ddd8;
  --board: #2d6a55;
  --board-ink: #fbfdfc;
  --board-soft: #e3efe9;
  --chalk: #e9b93b;
  --chalk-soft: #fbf1d6;
  --danger: #a23b30;
  --danger-soft: #f6e4e1;
  --ok: #2d6a55;
  --meh: #9a6b12;
  --shadow-1: 0 1px 2px rgba(24, 48, 40, .07), 0 2px 6px rgba(24, 48, 40, .05);
  --shadow-2: 0 4px 12px rgba(24, 48, 40, .10), 0 16px 40px rgba(24, 48, 40, .12);
  --hi: none;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t1: 120ms; --t2: 200ms; --t3: 300ms;
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --display: "Frank Ruhl Libre", "David", serif;
  --text: "Assistant", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17221e; --paper-2: #1b2823; --surface: #1f2d28; --surface-2: #24342e;
    --ink: #e6ede9; --muted: #a3b3ac; --faint: #84958e; --grid: #22312b; --line: #2f413a;
    --board: #6fb89b; --board-ink: #0f1a16; --board-soft: #23392f; --chalk: #e9c35b; --chalk-soft: #3a3420;
    --danger: #d9786c; --danger-soft: #3b2522; --ok: #6fb89b; --meh: #d8a84a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 6px 24px rgba(0, 0, 0, .45);
    --hi: inset 0 1px 0 rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17221e; --paper-2: #1b2823; --surface: #1f2d28; --surface-2: #24342e;
  --ink: #e6ede9; --muted: #a3b3ac; --faint: #84958e; --grid: #22312b; --line: #2f413a;
  --board: #6fb89b; --board-ink: #0f1a16; --board-soft: #23392f; --chalk: #e9c35b; --chalk-soft: #3a3420;
  --danger: #d9786c; --danger-soft: #3b2522; --ok: #6fb89b; --meh: #d8a84a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 6px 24px rgba(0, 0, 0, .45);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .05);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  /* The notebook grid: 24px squares, very faint. */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--ink);
  font: 400 17px/1.65 var(--text);
  word-spacing: .05em;
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.25; margin: 0; }
h1 { font-size: 34px; }
h2 { font-size: 27px; }
h3 { font-size: 21px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.math { direction: ltr; unicode-bidi: isolate; white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--board); outline-offset: 2px; border-radius: var(--r-s); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; padding: 28px 18px 20px;
  display: flex; flex-direction: column; gap: 28px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-inline-end: 1px solid var(--line);
  backdrop-filter: none;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding-inline: 8px; }
.brand-word { font-family: var(--display); font-size: 30px; line-height: 1; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px;
  border-radius: var(--r-m); text-decoration: none; color: var(--muted); font-weight: 600;
  transition: background var(--t2) var(--ease), color var(--t2) var(--ease), transform var(--t1) var(--ease);
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a:active { transform: scale(.97); }
.nav a[aria-current="page"] { background: var(--board-soft); color: var(--board); }
.nav a[aria-current="page"] .ic { stroke-width: 2; }
.rail-foot { margin-top: auto; padding-inline: 8px; font-size: 15px; color: var(--muted); }
.rail-foot strong { display: block; color: var(--ink); font-size: 17px; }
.main { min-width: 0; padding: 40px 48px 96px; }
.page { max-width: 1060px; margin: 0 auto; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { display: block; }
  .rail { display: none; }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: 1fr 1fr; position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(24, 48, 40, .06);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center;
    text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; border-radius: var(--r-m);
    transition: transform var(--t1) var(--ease), color var(--t2) var(--ease);
  }
  .tabbar a:active { transform: scale(.95); }
  .tabbar a[aria-current="page"] { color: var(--board); }
  .tabbar a[aria-current="page"] .ic { stroke-width: 2; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
  .mobile-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
}
@media (min-width: 861px) { .mobile-brand { display: none; } }

/* ---------- icons ---------- */
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 18px; height: 18px; }
.ic.lg { width: 28px; height: 28px; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--surface-2); --fg: var(--ink); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: var(--r-s);
  background: var(--bg); color: var(--fg); border: 1px solid var(--bd);
  font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-1), var(--hi);
  transition: transform var(--t1) var(--ease), box-shadow var(--t1) var(--ease), background var(--t2) var(--ease), opacity var(--t2);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { --bg: var(--paper-2); }
.btn:active { transform: translateY(1px) scale(.98); box-shadow: none; }
.btn.primary { --bg: var(--board); --fg: var(--board-ink); --bd: transparent; min-height: 50px; padding: 0 24px; }
.btn.primary:hover { --bg: color-mix(in srgb, var(--board) 88%, var(--ink)); }
.btn.ghost { --bg: transparent; --bd: transparent; box-shadow: none; color: var(--board); padding: 0 12px; }
.btn.ghost:hover { --bg: var(--board-soft); }
.btn.danger { --fg: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.busy { pointer-events: none; }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.done { --bg: var(--board); --fg: var(--board-ink); }
.btn.failed { animation: shake .32s var(--ease); --fg: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- common blocks ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.crumbs a { text-decoration: none; padding: 4px 2px; border-radius: 4px; }
.crumbs a:hover { color: var(--board); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 32px; }
.head p { margin-top: 6px; color: var(--muted); max-width: 62ch; }
.section { margin-top: 48px; }
.section > h2, .section > .sec-head { margin-bottom: 18px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.raised { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-1), var(--hi); }
.pad { padding: 24px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 600; background: var(--paper-2); color: var(--muted); white-space: nowrap;
}
.chip.ready { background: var(--board-soft); color: var(--board); }
.chip.done { background: transparent; color: var(--faint); border: 1px solid var(--line); }
.chip.now { background: var(--chalk-soft); color: var(--ink); }
.chip.weak { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 14px 0 6px; }
.empty p { max-width: 46ch; margin: 0 auto 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 60px;
  text-decoration: none; border-radius: var(--r-m);
  transition: background var(--t2) var(--ease), transform var(--t1) var(--ease);
}
.row:hover { background: var(--paper-2); }
.row:active { transform: scale(.99); background: var(--board-soft); }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .s { color: var(--muted); font-size: 15px; }
.row .num { font-variant-numeric: tabular-nums; color: var(--faint); font-size: 15px; min-width: 2.2em; }
.toast {
  position: fixed; z-index: 60; inset-inline: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 440px;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-m);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); font-weight: 600;
  animation: toast-in var(--t3) var(--ease);
}
.toast button { margin-inline-start: auto; background: none; border: 0; color: var(--chalk); font-weight: 700; cursor: pointer; min-height: 36px; padding: 0 8px; }
.toast.out { animation: toast-out var(--t2) var(--ease) forwards; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(16px); opacity: 0; } }
@media (min-width: 861px) { .toast { bottom: 24px; } }

/* ---------- chalk signature ---------- */
.chalk-line { stroke: var(--chalk); stroke-width: 5; fill: none; stroke-linecap: round; filter: url(#chalk); }
.chalk-draw { stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); animation: draw 900ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- opening + setup ---------- */
.intro { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--paper); cursor: pointer; animation: intro-out 400ms var(--ease) 2.6s forwards; }
.intro .word { font-family: var(--display); font-size: clamp(72px, 14vw, 128px); line-height: 1; text-align: center; clip-path: inset(0 0 0 100%); animation: write 1.1s var(--ease) .2s forwards; }
.intro .tag { text-align: center; color: var(--muted); font-size: 19px; margin-top: 10px; opacity: 0; animation: fade 500ms var(--ease) 1.7s forwards; }
.intro svg { display: block; margin: 4px auto 0; width: min(320px, 70vw); height: 34px; overflow: visible; }
.intro .chalk-draw { animation-delay: 1.1s; }
@keyframes write { to { clip-path: inset(0 0 0 0); } }
@keyframes fade { to { opacity: 1; } }
@keyframes intro-out { to { opacity: 0; visibility: hidden; } }

.setup { max-width: 640px; margin: 0 auto; padding: 48px 0 64px; }
.setup .lead { color: var(--muted); font-size: 19px; margin: 10px 0 36px; }
.step { margin-bottom: 36px; }
.step h3 { margin-bottom: 4px; }
.step > p { color: var(--muted); margin-bottom: 14px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 15px; }
.input, select.input, textarea.input {
  min-height: 48px; padding: 10px 14px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(24, 48, 40, .05);
  transition: border-color var(--t2) var(--ease), box-shadow var(--t2) var(--ease);
}
.input:focus { outline: none; border-color: var(--board); box-shadow: 0 0 0 3px color-mix(in srgb, var(--board) 20%, transparent); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
.picks { display: flex; flex-wrap: wrap; gap: 10px; }
.pick {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600;
  transition: background var(--t2) var(--ease), border-color var(--t2) var(--ease), transform var(--t1) var(--ease), color var(--t2);
}
.pick:active { transform: scale(.96); }
.pick[aria-pressed="true"] { background: var(--board); border-color: var(--board); color: var(--board-ink); }
.where { padding: 20px 22px; }
.where strong { font-family: var(--display); font-size: 21px; }
.where ul { margin: 10px 0 0; padding-inline-start: 20px; color: var(--muted); }
.choice { display: grid; gap: 10px; margin-top: 16px; }
.choice label {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  transition: border-color var(--t2) var(--ease), background var(--t2) var(--ease);
}
.choice label:has(input:checked) { border-color: var(--board); background: var(--board-soft); }
.choice input { accent-color: var(--board); width: 20px; height: 20px; margin-top: 3px; flex: none; }
.setup-foot { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 24px; }

.ready-moment { text-align: center; padding: 72px 16px; }
.ready-moment svg { width: 96px; height: 96px; }
.ready-moment .big { font-family: var(--display); font-size: 44px; font-variant-numeric: tabular-nums; }

/* ---------- year ---------- */
.next {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 20px 32px; align-items: end;
  padding: 28px 32px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-2), var(--hi);
}
.next h2 { view-transition-name: lesson-title; }
.next .k { color: var(--muted); font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.next h2 { font-size: 34px; margin: 6px 0 8px; }
.next .meta { color: var(--muted); }
.next .acts { display: flex; gap: 6px; margin-top: 14px; color: var(--muted); }
@media (max-width: 700px) { .next { grid-template-columns: 1fr; padding: 22px 20px; } .next h2 { font-size: 28px; } .next .btn.primary { width: 100%; } }
.stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 28px; }
.stat .v { font-family: var(--display); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 15px; margin-top: 4px; }
.bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--board); border-radius: 3px; transform-origin: right; transition: transform 900ms var(--ease); }

.chart { position: relative; padding: 34px 20px 14px; overflow-x: auto; }
.chart-grid { position: relative; display: grid; grid-template-columns: 132px repeat(10, minmax(64px, 1fr)); min-width: 820px; }
.chart .mh { font-size: 14px; color: var(--muted); font-weight: 600; padding: 0 6px 10px; border-inline-start: 1px dashed var(--line); }
.chart .mh.cur { color: var(--ink); }
.chart .sl { font-size: 14px; font-weight: 600; color: var(--muted); padding: 10px 0; align-self: start; }
.chart .lane { grid-column: 2 / -1; position: relative; display: grid; grid-template-columns: repeat(10, 1fr); height: 40px; }
.chart .lane .cell { border-inline-start: 1px dashed var(--line); }
.chart .tb {
  position: absolute; top: 5px; height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 10px;
  border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); text-decoration: none; overflow: hidden;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--ink);
  transition: transform var(--t1) var(--ease), box-shadow var(--t2) var(--ease), border-color var(--t2);
}
.chart .tb:hover { box-shadow: var(--shadow-1); border-color: var(--board); z-index: 2; }
.chart .tb:active { transform: scale(.98); }
.chart .tb .fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--board) 22%, var(--surface)); border-inline-end: 2px solid var(--board); z-index: 0; }
.chart .tb .fill[style*="width:0%"] { border: 0; }
.chart .tb span { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; }
.chart .tb.weak { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.chart .strand-sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 6px 0; }
.chart .now { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; z-index: 3; }
.chart .now svg { position: absolute; top: 18px; bottom: 0; height: calc(100% - 18px); width: 14px; inset-inline-start: -7px; overflow: visible; }
.chart .now .lbl { position: absolute; top: -26px; transform: translateX(50%); font-size: 12px; font-weight: 700; background: var(--chalk); color: #1c2925; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }

.months { display: none; }
@media (max-width: 860px) {
  .chart { display: none; }
  .months { display: block; }
}
.month { padding: 4px 0; }
.month > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer;
  min-height: 52px; padding: 0 4px; font-weight: 700; font-size: 18px;
}
.month > summary::-webkit-details-marker { display: none; }
.month > summary > span { display: inline-flex; align-items: center; gap: 8px; }
.month > summary .chev { transition: transform var(--t2) var(--ease); color: var(--muted); }
.month[open] > summary .chev { transform: rotate(-90deg); }
.month + .month { border-top: 1px solid var(--line); }

/* ---------- topic + lesson ---------- */
.prior { padding: 18px 20px; border-radius: var(--r-m); background: var(--chalk-soft); }
.prior .label { color: var(--muted); }
.reveal { margin-top: 8px; }
.reveal summary { cursor: pointer; color: var(--board); font-weight: 600; min-height: 36px; display: inline-flex; align-items: center; }
.reveal summary::-webkit-details-marker { display: none; }

.lesson-head h1 { font-size: 40px; view-transition-name: lesson-title; }
@media (max-width: 700px) { .lesson-head h1 { font-size: 30px; } }
.goal { font-size: 19px; margin-top: 8px; max-width: 62ch; }
.why { display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--r-m); background: var(--board-soft); margin-top: 24px; }
.why p { max-width: 70ch; }
.why .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.timeline { margin-top: 32px; }
.tl { display: flex; gap: 3px; height: 54px; }
.tl a {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; text-decoration: none;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 14px; min-width: 0; overflow: hidden;
  transition: transform var(--t1) var(--ease), border-color var(--t2);
}
.tl a:hover { border-color: var(--board); }
.tl a:active { transform: scale(.98); }
.tl a[data-phase="teach"] { background: var(--board-soft); }
.tl a[data-phase="close"] { background: var(--chalk-soft); }
.tl .m { font-variant-numeric: tabular-nums; }
.tl-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; }

.seg { display: grid; grid-template-columns: 86px 1fr; gap: 20px; padding: 28px 0; border-top: 1px solid var(--line); scroll-margin-top: 20px; }
.seg:first-child { border-top: 0; }
.seg .when { text-align: center; }
.seg .when .min { font-family: var(--display); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.seg .when .u { font-size: 13px; color: var(--muted); }
.seg .badge { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 12px; color: var(--board); font-size: 13px; font-weight: 700; }
.seg .phase { color: var(--muted); font-size: 14px; font-weight: 600; }
.seg h3 { margin: 2px 0 6px; }
.seg .purpose { color: var(--muted); max-width: 66ch; }
.say { position: relative; margin: 14px 0; padding: 12px 18px; border-inline-start: 0; background: var(--paper-2); border-radius: var(--r-s); font-size: 18px; max-width: 66ch; }
.say::before { content: "לומר לכיתה"; display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.steps { margin: 12px 0 0; padding-inline-start: 22px; max-width: 70ch; }
.steps li { margin: 6px 0; }
.steps li::marker { color: var(--board); font-weight: 700; }
.qs { margin-top: 14px; }
.qs ol { margin: 8px 0 0; padding-inline-start: 22px; }
.qs li { margin: 8px 0; }
.qs .a { color: var(--board); font-weight: 600; }
.qs.hidden-answers .a { display: none; }
.seg .seg-tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 640px) { .seg { grid-template-columns: 1fr; gap: 8px; } .seg .when { display: flex; align-items: baseline; gap: 6px; text-align: start; } .seg .badge { flex-direction: row; margin: 0 10px; } }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 700px) { .two { grid-template-columns: 1fr; } }
.box { padding: 20px 22px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); }
.box h3 { font-size: 19px; margin-bottom: 8px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.checks input { width: 20px; height: 20px; accent-color: var(--board); margin-top: 3px; flex: none; }
.checks li:has(input:checked) span { color: var(--faint); text-decoration: line-through; }

.lesson-bar {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 40px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 12px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2), var(--hi);
}
.lesson-bar .spacer { flex: 1; }
@media (max-width: 860px) { .lesson-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } .lesson-bar .btn.primary { flex: 1; } }

/* building */
.building { padding: 28px; }
.building .stage { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.building .stage .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chalk); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }
.skel { margin-top: 20px; display: grid; gap: 10px; }
.skel .r { display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 0 16px; border-radius: var(--r-m); background: var(--paper-2); animation: rise var(--t3) var(--ease) both; }
.skel .r.wait { background: linear-gradient(90deg, var(--paper-2), var(--surface-2), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; color: transparent; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.err { display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--r-m); background: var(--danger-soft); color: var(--ink); }
.err .ic { color: var(--danger); }

/* ---------- present (always the board) ---------- */
.present {
  position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: auto 1fr auto;
  background: #17221e; color: #e8efeb; padding: 24px 40px calc(24px + env(safe-area-inset-bottom));
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .04), transparent 60%);
}
.present .top { display: flex; align-items: center; gap: 20px; justify-content: space-between; color: #a3b3ac; }
.present .dots { display: flex; gap: 6px; }
.present .dots i { width: 28px; height: 6px; border-radius: 3px; background: #2f413a; transition: background var(--t2); }
.present .dots i.on { background: #e9c35b; }
.present .dots i.past { background: #6fb89b; }
.present .stagec { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: center; min-height: 0; }
.present .what { min-width: 0; }
.present .what .k { color: #e9c35b; font-weight: 700; font-size: 20px; }
.present .what h2 { font-size: clamp(36px, 5vw, 64px); color: #f4f7f5; margin: 6px 0 16px; }
.present .what .say { background: rgba(255, 255, 255, .05); color: #e8efeb; font-size: clamp(20px, 2.2vw, 28px); }
.present .what .say::before { color: #a3b3ac; }
.present .what .steps { font-size: 19px; color: #c7d3cd; }
.present .q { margin-top: 20px; font-size: clamp(24px, 3vw, 40px); }
.present .q .a { color: #e9c35b; margin-top: 10px; }
.present .clock { text-align: center; }
.present .clock svg { width: 260px; height: 260px; }
.present .clock .ring-bg { stroke: #2f413a; }
.present .clock .ring { stroke: #e9c35b; transition: stroke-dashoffset 1s linear; }
.present .clock .ring.over { stroke: #d9786c; }
.present .clock .tm { font-family: var(--display); font-size: 64px; font-variant-numeric: tabular-nums; fill: #f4f7f5; }
.present .clock .tl2 { font-size: 16px; fill: #a3b3ac; }
.present .ctl { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.present .btn { --bg: #24342e; --fg: #e8efeb; --bd: #2f413a; box-shadow: none; }
.present .btn:hover { --bg: #2b3e37; }
.present .btn.primary { --bg: #6fb89b; --fg: #0f1a16; }
.present .seg-in { animation: seg-in var(--t3) var(--ease); }
@keyframes seg-in { from { opacity: 0; transform: translateX(-16px); } }
@media (max-width: 900px) {
  .present { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .present .stagec { grid-template-columns: 1fr; gap: 16px; align-content: center; }
  .present .clock { order: -1; }
  .present .clock svg { width: 150px; height: 150px; }
}

/* ---------- reflect ---------- */
.overall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.overall button {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 700;
  transition: transform var(--t1) var(--ease), background var(--t2), border-color var(--t2), color var(--t2);
}
.overall button:active { transform: scale(.97); }
.overall button[aria-pressed="true"] { background: var(--board); border-color: var(--board); color: var(--board-ink); }
.overall svg { width: 40px; height: 40px; }
.rate { display: flex; align-items: center; gap: 14px; padding: 12px 0; flex-wrap: wrap; }
.rate + .rate { border-top: 1px solid var(--line); }
.rate .grow { flex: 1; min-width: 180px; }
.seg3 { display: inline-grid; grid-template-columns: repeat(3, auto); padding: 3px; gap: 2px; border-radius: 999px; background: var(--paper-2); }
.seg3 button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); transition: background var(--t2) var(--ease), color var(--t2); }
.seg3 button[aria-pressed="true"][data-v="yes"] { background: var(--board); color: var(--board-ink); }
.seg3 button[aria-pressed="true"][data-v="meh"] { background: var(--surface-2); color: var(--ink); box-shadow: var(--shadow-1); }
.seg3 button[aria-pressed="true"][data-v="no"] { background: var(--danger); color: #fff; }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface-2); }
.stepper button { width: 46px; height: 46px; border: 0; background: none; cursor: pointer; font-size: 22px; color: var(--board); border-radius: var(--r-s); }
.stepper button:active { background: var(--board-soft); }
.stepper input { width: 64px; text-align: center; border: 0; background: none; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.saved { text-align: center; padding: 56px 16px; }
.saved svg { width: 88px; height: 88px; }
.saved ul { list-style: none; padding: 0; margin: 18px auto; max-width: 52ch; color: var(--muted); }

/* ---------- class ---------- */
.meter { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 14px; padding: 10px 0; }
.meter .nm { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.meter .track { height: 12px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 6px; background: var(--board); transform-origin: right; animation: grow 900ms var(--ease) both; }
.meter.low .track i { background: var(--danger); }
.meter .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; text-align: end; }
@keyframes grow { from { transform: scaleX(0); } }
@media (max-width: 560px) { .meter { grid-template-columns: 110px 1fr 48px; } }
.privacy { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 15px; padding: 14px 16px; border-radius: var(--r-m); border: 1px dashed var(--line); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { font-size: 14px; color: var(--muted); font-weight: 600; }
.score-in { width: 72px; min-height: 40px; text-align: center; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; transition: background var(--t2) var(--ease); flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--t2) var(--ease); }
.switch input:checked { background: var(--board); }
.switch input:checked::after { transform: translateX(-20px); }

/* sheet */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(15, 26, 22, .45); animation: fade var(--t2) var(--ease) both; opacity: 0; }
.sheet {
  position: fixed; z-index: 51; inset-inline: 0; bottom: 0; margin: 0 auto; max-width: 640px; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: var(--shadow-2);
  padding: 10px 24px calc(24px + env(safe-area-inset-bottom)); animation: sheet-in var(--t3) var(--ease);
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet.out { animation: sheet-out var(--t2) var(--ease) forwards; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }
@media (min-width: 861px) { .sheet { bottom: auto; top: 8vh; border-radius: var(--r-l); } }

/* ---------- motion ---------- */
.enter > * { animation: rise var(--t3) var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: 30ms; } .enter > *:nth-child(3) { animation-delay: 60ms; }
.enter > *:nth-child(4) { animation-delay: 90ms; } .enter > *:nth-child(5) { animation-delay: 120ms; }
.enter > *:nth-child(6) { animation-delay: 150ms; } .enter > *:nth-child(n+7) { animation-delay: 180ms; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--t3); animation-timing-function: var(--ease); }
html[data-dir="forward"]::view-transition-old(root) { animation-name: vt-out-fwd; }
html[data-dir="forward"]::view-transition-new(root) { animation-name: vt-in-fwd; }
html[data-dir="back"]::view-transition-old(root) { animation-name: vt-out-back; }
html[data-dir="back"]::view-transition-new(root) { animation-name: vt-in-back; }
@keyframes vt-out-fwd { to { opacity: 0; transform: translateX(12px); } }
@keyframes vt-in-fwd { from { opacity: 0; transform: translateX(-12px); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateX(-12px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(12px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .intro { display: none; }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }

/* ---------- print: the worksheet / the lesson, black on white ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 13pt; }
  .rail, .tabbar, .lesson-bar, .crumbs, .seg-tools, .no-print, .toast { display: none !important; }
  .main { padding: 0; }
  .raised, .box, .why, .prior, .say { box-shadow: none; background: #fff; border: 1px solid #999; }
  .qs.hidden-answers .a { display: none; }
  .print-only { display: block !important; }
  .seg { break-inside: avoid; }
}
.print-only { display: none; }

/* offline: a quiet, persistent note at the top */
.offline-note { display: none; }
html[data-offline="1"] .offline-note {
  display: block; position: fixed; z-index: 40; top: calc(8px + env(safe-area-inset-top)); inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px);
  padding: 6px 14px; border-radius: 999px; background: var(--chalk-soft); color: var(--ink); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-1);
}
