/* Practice Tests. Phone first. Three age themes set by html[data-grade-band]. */

:root {
  /* Greek (2026-10-22): Noto Sans carries Greek and polytonic Greek; Atkinson Hyperlegible has no Greek. */
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --base: 16px;
  --radius: 6px;
  --btn-h: 44px;
  --gutter: 16px;
  --maxw: 760px;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #17202e;
  --muted: #5b6575;
  --line: #d3d9e2;
  --primary: #1f3a68;
  --primary-text: #ffffff;
  --accent: #5b6b82;
  --chip: #eef1f6;
  --chip-on: #1f3a68;
  --chip-on-text: #ffffff;
  --good: #146c3a;
  --good-bg: #e6f4ec;
  --bad: #a52a1f;
  --bad-bg: #fbece9;
  --warn: #8a4b00;
  --focus: #1a73e8;
  --select: #1a5fd0;         /* chosen answer, the same blue in every band (ruling 15) */
  --select-bg: #eaf1fd;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --heading-weight: 650;
  --q-font: "Noto Sans", system-ui, sans-serif;
  --ancient-font: "Noto Serif", "Gentium Plus", "Times New Roman", serif;  /* polytonic Ancient Greek */
  --q-ink: #0b2350;
  --q-bg: #eef3fc;
  --q-edge: #1a5fd0;
}
.progress-table td.good { color: var(--good); font-weight: 600; }
.progress-table td.bad { color: var(--bad); font-weight: 600; }
.progress-table tr.is-current td { background: var(--select-bg); }

/* Grades 1 to 3: large type, round corners, warm and bright, playful but tidy. */
html[data-grade-band="k3"] {
  --font: ui-rounded, "Noto Sans", system-ui, sans-serif;  /* ui-rounded (Apple) has Greek; Nunito and Arial Rounded do not */
  --base: 20px;
  --radius: 18px;
  --btn-h: 56px;
  --bg: #fff8e1;
  --surface: #ffffff;
  --text: #2b2118;
  --muted: #6b5a48;
  --line: #f1d9a6;
  --primary: #e2553f;        /* coral */
  --primary-text: #ffffff;
  --accent: #2f8fd8;         /* sky */
  --chip: #fff1c7;           /* warm yellow */
  --chip-on: #2f8fd8;
  --chip-on-text: #ffffff;
  --good: #1d7a3e;
  --good-bg: #e3f6e8;
  --bad: #b23a2a;
  --bad-bg: #fdebe7;
  --shadow: 0 3px 0 rgba(226, 85, 63, 0.18);
  --heading-weight: 800;
}

/* Grades 4 to 6: bright but tidy. */
html[data-grade-band="g46"] {
  --base: 18px;
  --radius: 12px;
  --btn-h: 48px;
  --bg: #f1faf8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #56606e;
  --line: #c9e4df;
  --primary: #0f7c74;        /* teal */
  --primary-text: #ffffff;
  --accent: #e07a1f;         /* orange */
  --chip: #e5f4f1;
  --chip-on: #6a3d7a;        /* plum */
  --chip-on-text: #ffffff;
  --good: #136b3a;
  --good-bg: #e4f5ea;
  --bad: #a8321f;
  --bad-bg: #fcebe7;
  --heading-weight: 750;
}

/* Grades 7 to 12: navy, grey and white, formal. */
html[data-grade-band="g712"] {
  --base: 16px;
  --radius: 6px;
  --btn-h: 44px;
  --bg: #f4f6f9;
  --primary: #1f3a68;        /* navy */
  --chip-on: #1f3a68;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--base);
  line-height: 1.5;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.25; font-weight: var(--heading-weight); margin: 0 0 0.5em; }
h1 { font-size: 1.6em; }
h2 { font-size: 1.2em; margin-top: 1.3em; }
h3 { font-size: 1em; }
p { margin: 0 0 0.75em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.break { overflow-wrap: anywhere; }
.center { text-align: center; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); }
.hint { color: var(--muted); font-size: 0.9em; margin: 0.5em 0; }
.big-line { font-size: 1.2em; font-weight: 600; }

/* Layout */
.view, .topbar-inner {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.view { padding-top: 20px; padding-bottom: 48px; outline: none; }
h1:focus { outline: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.row.center { justify-content: center; }
.row input[type="text"], .row input[type="email"] { flex: 1 1 200px; min-width: 0; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding-top: 8px; padding-bottom: 8px;
}
.brand { font-weight: var(--heading-weight); color: var(--primary); text-decoration: none; margin-right: auto; }
.who { margin: 0; font-size: 0.9em; }
.acting-tag { color: var(--warn); font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }

/* Message bar */
.msg {
  display: flex; align-items: flex-start; gap: 10px;
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--maxw) - 2 * var(--gutter));
  margin: 12px auto 0;
  padding: 10px 14px;
  background: var(--bad-bg);
  border: 1px solid var(--bad);
  color: var(--text);
  border-radius: var(--radius);
}
.msg[data-kind="ok"], .msg[data-kind="info"] { background: var(--good-bg); border-color: var(--good); }
.msg-text { margin: 0; flex: 1; font-weight: 500; }
.msg-close {
  border: 0; background: transparent; font-size: 1.4em; line-height: 1; cursor: pointer;
  min-width: 44px; min-height: 44px; margin: -10px -10px -10px 0; color: inherit;
  border-radius: var(--radius);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-h);
  padding: 8px 18px;
  font: inherit; font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.big { min-height: calc(var(--btn-h) + 8px); padding: 10px 24px; font-size: 1.05em; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 0.85em; }
.btn.warn { border-color: var(--bad); color: var(--bad); }
.btn.warn.armed { background: var(--bad); color: #ffffff; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(0.95); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Form fields */
input[type="text"], input[type="email"], input[type="number"], select {
  font: inherit;
  min-height: var(--btn-h);
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  max-width: 100%;
}
input:focus-visible, select:focus-visible { border-color: var(--focus); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.field label { font-weight: 600; font-size: 0.9em; }
.grade-input { width: 5.5em; }
fieldset.options { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.opt input { width: 22px; height: 22px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  font: inherit; font-size: 0.95em;
  color: var(--text);
  background: var(--chip);
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  overflow-wrap: anywhere;
}
html[data-grade-band="g712"] .chip { border-radius: var(--radius); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-text); }
.chip[aria-pressed="true"]::before { content: "\2713"; font-weight: 700; }
.chip.partial { border-color: var(--chip-on); }
.chip.topic-chip { font-weight: 700; }
.chip.choice-chip { font-weight: 600; }
.chip-sel { cursor: default; background: var(--surface); border-color: var(--line); padding: 2px 4px 2px 12px; min-height: 40px; font-size: 0.85em; }
.chip-x {
  border: 0; background: transparent; color: inherit; font-size: 1.25em; line-height: 1;
  min-width: 36px; min-height: 36px; border-radius: 999px; cursor: pointer;
}
.chip-x:hover { background: var(--chip); }
.tag {
  display: inline-block; font-size: 0.72em; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap;
}
.tag-match { background: var(--good-bg); color: var(--good); }
.tag-own { background: var(--chip); color: var(--text); }

/* Builder */
.summary {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
  max-height: 90px; overflow-y: auto;   /* ruling 12 */
}
.summary-title { font-weight: 700; margin: 0; }
.summary .chips { margin: 4px 0 0; gap: 6px; }
.summary .chip-sel { min-height: 36px; }
.link-btn {
  font: inherit; font-weight: 600; color: var(--select); background: transparent; border: 0;
  text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 6px;
}
.block { display: block; }
.confirm { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.added-line { margin: 10px 0 0; }
.added-line:empty { display: none; }
.round-err:empty { display: none; }
.round-err { margin-top: 10px; font-weight: 600; }
/* Ruling 25: the course chip shows the short label and the NYS name under it, both at body size. */
.chip.course-chip { font-size: 1em; }
.course-text { display: flex; flex-direction: column; }
.course-nys { font-weight: 400; }
.chapter {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 0 10px;
}
.chapter > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 10px 14px; cursor: pointer; font-weight: 600; list-style: none;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::before { content: "+"; font-weight: 700; width: 1em; color: var(--accent); }
.chapter[open] > summary::before { content: "\2212"; }
.ch-name { flex: 1; }
.count { font-size: 0.8em; color: var(--good); white-space: nowrap; }
.chapter-body { padding: 0 14px 12px; }
.topic { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.start-row { margin: 24px 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }

/* Mix slider: left number multiple choice, right number short answer */
.mix { margin: 8px 0 4px; }
.mix-labels { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.mix-num.right { text-align: right; margin-left: auto; }
input[type="range"] {
  width: 100%; height: 44px; margin: 4px 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 12px; border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--fill, 70%), var(--accent) var(--fill, 70%));
}
input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-progress { height: 12px; border-radius: 999px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 32px; height: 32px; margin-top: -10px;
  border-radius: 50%; background: #ffffff; border: 3px solid var(--text);
}
input[type="range"]::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%; background: #ffffff; border: 3px solid var(--text);
}

/* Home */
.home-actions { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
@media (min-width: 560px) { .home-actions { grid-template-columns: 1fr 1fr; } }

/* Building */
.progress-line { font-weight: 600; font-size: 1.1em; }
.spinner {
  width: 44px; height: 44px; margin: 16px auto; border-radius: 50%;
  border: 5px solid var(--chip); border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Test */
.test-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.test-head h1 { margin-bottom: 0.15em; }
.progress { margin: 10px 0 16px; }
.bar { height: 10px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.3s ease; }
.progress-text { margin: 4px 0 0; font-weight: 600; font-size: 0.9em; color: var(--muted); }
/* The question and its choices are what the eye should find (Dr. M, 2026-10-16): their own typeface,
   larger, a deep ink colour, and a tinted panel; the counters and labels around them step back. */
.q-num { font-size: 0.78em; color: var(--muted); margin: 0 0 0.4em; font-weight: 600; letter-spacing: 0.02em; opacity: 0.8; }
.progress-text { opacity: 0.8; }
.stem {
  font-family: var(--q-font); font-size: 1.32em; line-height: 1.45; font-weight: 600; color: var(--q-ink);
  background: var(--q-bg); border-left: 5px solid var(--q-edge); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.choice { font-family: var(--q-font); font-size: 1.15em; font-weight: 500; color: var(--q-ink); }
.choices { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--btn-h);
  padding: 10px 14px;
  font: inherit; text-align: left; color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.choice .letter {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 1.9em; height: 1.9em; border-radius: 50%; background: var(--chip); font-weight: 700;
}
.choice-text { flex: 1; overflow-wrap: anywhere; }
.choice[aria-checked="true"] { border-color: var(--select); background: var(--select-bg); box-shadow: inset 0 0 0 1px var(--select); }
.choice[aria-checked="true"] .letter { background: var(--select); color: #ffffff; }
/* Only after checking: green for right, red for not right. */
.choice.is-right { border-color: var(--good); background: var(--good-bg); box-shadow: inset 0 0 0 1px var(--good); }
.choice.is-right .letter { background: var(--good); color: #ffffff; }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad); }
.choice.is-wrong .letter { background: var(--bad); color: #ffffff; }
.choice:disabled { cursor: default; }
.choice.tried { opacity: 0.45; background: var(--bg); text-decoration: line-through; }
.choice.tried .tag { text-decoration: none; }
.sa-box { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.sa-input { width: 100%; font-size: 1.05em; }
.given { font-weight: 600; overflow-wrap: anywhere; }
.result { font-size: 1.1em; }
.saved { color: var(--muted); font-weight: 600; }
.explain { display: grid; gap: 10px; margin: 10px 0; }
.explain > div { border-left: 4px solid var(--accent); padding: 6px 12px; background: var(--bg); border-radius: 0 var(--radius) var(--radius) 0; }
.explain .explain-rule { border-left-color: var(--primary); }
.explain h3 { font-size: 0.9em; margin: 0 0 0.2em; }
.explain p { margin: 0; }
.retry { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.retry-title { font-weight: 700; margin-bottom: 0.3em; }
.nav-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 12px 0 24px; }
.nav-row .hint { flex-basis: 100%; }
@media (min-width: 700px) {
  .nav-row { justify-content: flex-end; }
  .nav-row .hint { flex-basis: auto; margin-right: auto; }
}

/* Score */
.score { font-size: 3em; font-weight: 800; margin: 12px 0; color: var(--primary); }
.score-zoom { animation: score-zoom 1.4s ease-in-out 1; }
@keyframes score-zoom {
  0% { transform: scale(0.6); opacity: 0; }
  45% { transform: scale(1.15); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}
html[data-effects="off"] .score-zoom { animation: none; }
.pop { animation: pop 0.45s ease-out 1; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
html[data-effects="off"] .pop { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .score-zoom, .spinner, .pop { animation: none; }
  .bar span { transition: none; }
}

/* Review */
.round-box { text-align: center; }
.round-box .btn { width: 100%; }
@media (min-width: 560px) { .round-box .btn { width: auto; } }

/* Upload */
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.note { font-size: 0.9em; color: var(--muted); border-left: 4px solid var(--line); padding-left: 10px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.thumb { position: relative; margin: 0; width: 96px; }
.thumb img { width: 96px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); display: block; }
.thumb .chip-x { position: absolute; top: 2px; right: 2px; background: var(--surface); box-shadow: var(--shadow); }

/* Print options */
.pdf-out { margin-top: 12px; }

/* Admin */
.user-name { margin: 0; }
.history { margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 8px 0; table-layout: fixed; }
.table th, .table td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }
.table th { font-weight: 700; color: var(--muted); }
.add-user { margin-top: 16px; }

/* Sign in */
.gbtn { display: flex; justify-content: center; min-height: 44px; margin: 16px 0; }
.dev-login { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); text-align: left; }
.dev-login label { font-weight: 600; font-size: 0.9em; }

/* Grades 1 to 3: small decorations drawn in CSS, no mascot. */
html[data-grade-band="k3"] h1::before {
  content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.35em;
  background: var(--accent); border-radius: 50%;
  box-shadow: 0.9em 0 0 -0.1em #f6c445, 1.6em 0 0 -0.2em var(--primary);
  vertical-align: 0.05em; margin-right: 1.9em;
}
/* A centred title (the score page) puts the dots on their own line, so «Η βαθμολογία σου» never leaves «σου» alone. */
html[data-grade-band="k3"] .card.center h1::before { display: block; margin: 0 auto 0.3em; position: relative; left: -0.7em; }
.card.center h1 { text-wrap: balance; }
html[data-grade-band="k3"] .card { border-width: 2px; }
html[data-grade-band="k3"] .choice:not([aria-checked="true"]) .letter { background: #fff1c7; }
html[data-grade-band="k3"] .btn.primary { box-shadow: 0 4px 0 var(--btn-edge, #b53e2c); }
html[data-grade-band="k3"] .btn.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--btn-edge, #b53e2c); }
html[data-grade-band="k3"] .progress .bar { height: 14px; }
html[data-grade-band="k3"] .bar span { background: linear-gradient(90deg, var(--primary), #f6c445); }

/* Grades 4 to 6 */
html[data-grade-band="g46"] h1 { color: var(--primary); }
html[data-grade-band="g46"] .bar span { background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* Grades 7 to 12: plain and formal */
html[data-grade-band="g712"] .card { box-shadow: none; }
html[data-grade-band="g712"] .score { color: var(--text); }

/* Progress page (cards for phones) */
.prog p { margin: 4px 0; }
.prog-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.prog-q { border-bottom: 1px solid var(--line); padding: 8px 2px; }
.prog-q p { margin: 2px 0; }
.prog-q.is-current { background: var(--select-bg); }
.prog-q .good { color: var(--good); font-weight: 700; }
.prog-q .bad { color: var(--bad); font-weight: 700; }
.prog-q .now { color: var(--select); font-weight: 700; }

.topic-search { width: 100%; min-height: var(--btn-h); padding: 8px 12px; font: inherit; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.topic-search:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-note { margin: 6px 0 10px; }

/* Requests to join */
.req-mark { display: inline-flex; width: 1.6em; height: 1.6em; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; background: var(--chip); }
.req.pending .req-mark { background: var(--warn); color: #fff; }
.req.accepted .req-mark { background: var(--good); color: #fff; }
.req.rejected .req-mark { background: var(--bad); color: #fff; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted; }
.kid-row input.kid-name { flex: 1 1 10em; }

textarea { font: inherit; }

/* Regents questions: the printed images, and four numbered answer buttons */
.stem-media { padding: 10px; background: #ffffff; }
.stem-media img { display: block; width: 100%; height: auto; margin: 0 0 10px; border-radius: 4px; }
.stem-media img.regents-ctx { border: 1px solid var(--line); }
.regents-src { font-family: var(--font); font-size: 0.72rem; font-weight: 500; color: var(--muted); margin: 0; }
.choices.numbered { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.choices.numbered .choice { justify-content: center; }
.choices.numbered .letter { width: 2.4em; height: 2.4em; font-size: 1.1em; }

/* "How hard?": a colour per level, and a clear "Choose one" until a level is picked */
.level-chip { border: 2px solid transparent; font-weight: 700; }
.level-chip.level-basic { background: #e3f6e8; border-color: #1d7a3e; color: #14532d; }
.level-chip.level-advanced { background: #f1e8fb; border-color: #7b3fc4; color: #4c1d95; }
.level-chip.level-regents { background: #e7eefb; border-color: #1f3a68; color: #1f3a68; }
.level-chip.level-basic[aria-pressed="true"] { background: #1d7a3e; color: #ffffff; }
.level-chip.level-advanced[aria-pressed="true"] { background: #7b3fc4; color: #ffffff; }
.level-chip.level-regents[aria-pressed="true"] { background: #1f3a68; color: #ffffff; }
.level-row.unset { outline: 3px dashed var(--warn); outline-offset: 6px; border-radius: 12px; }
.level-need { color: var(--warn); font-weight: 700; margin: 0 0 8px; }

/* ----- Flashcards (2026-10-17) ----- */
.deck { perspective: 1200px; margin: 12px 0; }
.flashcard { position: relative; width: 100%; min-height: 260px; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform 0.25s ease, opacity 0.25s ease; outline-offset: 4px; }
.flashcard.fly-right { transform: translateX(120%) rotate(8deg); opacity: 0; }
.flashcard.fly-left { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.flip-inner { position: relative; width: 100%; min-height: 260px; transform-style: preserve-3d; transition: transform 0.45s ease; }
.flashcard.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 22px; border-radius: 16px; background: var(--surface, #fff); border: 2px solid var(--line, #ccc); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: auto; }
.face.back { transform: rotateY(180deg); border-color: var(--accent); }
.face-label { margin: 0; font-size: 0.85em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.face .stem { font-size: 1.15em; margin: 0; }
.card-choices { margin: 0; padding-left: 1.2em; }
.card-answer { font-size: 1.4em; font-weight: 700; margin: 0; }
.card-rule { margin: 0; }
.grade-row { display: flex; gap: 12px; justify-content: center; margin: 8px 0 4px; flex-wrap: wrap; }
.grade-row .result { width: 100%; text-align: center; margin: 0; }
.grade-row .explain { width: 100%; }
.btn.grade-no, .btn.grade-yes { color: #fff; border: 0; min-width: 44%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.grade-no { background: #c62828; }
.btn.grade-yes { background: #2e7d32; }
.btn.grade-no:disabled, .btn.grade-yes:disabled { opacity: 0.45; }
.btn .mark { font-weight: 900; font-size: 1.1em; }
.hint.center { text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .flip-inner, .flashcard { transition: none; }
}

/* ----- Game: pop the balloon (2026-10-17) ----- */
.game-question .stem { font-size: 1.15em; margin: 0; }
.sky { position: relative; height: min(58vh, 520px); margin: 10px 0; border-radius: 16px; background: linear-gradient(#dff1ff, #f7fbff); overflow: hidden; border: 1px solid var(--line, #ccc); }
.balloon { position: absolute; left: 0; top: 0; margin: 0; border: 0; padding: 10px 12px 22px; color: #1b1b1b; background: var(--c); border-radius: 50% 50% 50% 50% / 45% 45% 55% 55%; box-shadow: inset -10px -14px 0 rgba(0, 0, 0, 0.08); display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; will-change: transform; font: inherit; }
.balloon::after { content: ""; position: absolute; left: 50%; bottom: -24px; width: 2px; height: 24px; background: #777; transform: translateX(-50%); }
.balloon-text { font-weight: 700; font-size: 1em; line-height: 1.2; overflow-wrap: anywhere; }
.balloon.pop { animation: pop 0.35s ease forwards; }
.balloon.shake { animation: shake 0.4s ease; }
.balloon.dim { opacity: 0.45; cursor: default; }
.sky-done { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; font-weight: 700; }
@keyframes pop { to { opacity: 0; filter: blur(2px); } }
@keyframes shake { 0%, 100% { margin-left: 0; } 25% { margin-left: -8px; } 75% { margin-left: 8px; } }
@media (prefers-reduced-motion: reduce) { .balloon.pop, .balloon.shake { animation: none; } .balloon.pop { opacity: 0; } }
.card-question { margin: 0; font-size: 0.95em; color: var(--muted, #555); }
.game-hint { margin: 10px 0 0; font-weight: 700; }
.game-hint.bad { color: var(--bad, #b3261e); }
.game-hint:empty { display: none; }
/* ----- Games: garden, feed, river, picture (2026-10-30, from KIDS with its phone and outside-read fixes) ----- */
/* The scene sits between the question and the choices, so nothing covers the question. Movement only with
   .moving (motion allowed); without it every change happens at once. */
.stage { margin: 10px 0 0; --stage-h: min(34vh, 300px); }
/* At 100% the bar's rider sits past the bar's end and pushed an iPhone page 5px sideways (KIDS walk 2026-10-29). */
.scene-game .progress { margin-right: 12px; }
/* Phones: a smaller scene, so a long question, the scene and the choices fit on one screen. */
@media (max-width: 699px) { .stage { --stage-h: 24vh; } }
.stage-svg { display: block; margin: 0 auto; height: auto; border-radius: 16px; border: 1px solid var(--line, #ccc); }
.stage-line { margin: 6px 0 0; text-align: center; font-weight: 700; min-height: 1.3em; }
.picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.pick { display: flex; align-items: center; gap: 8px; min-height: 56px; margin: 0; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-align: left; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); min-width: 0; }
.pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pick-icon { flex: none; font-size: 1.5em; line-height: 1; }
.pick-text { flex: 1; min-width: 0; overflow-wrap: break-word; hyphens: auto; line-height: 1.25; }
.pick[aria-disabled="true"] { cursor: default; }
.pick.dim { opacity: 0.4; box-shadow: none; }
.pick.right { border-color: var(--good); background: var(--good-bg); opacity: 1; }
.pick.shake { animation: shake 0.4s ease; }
.pick-garden { border-color: #8ce99a; }
.pick-river { border-color: #a5d8ff; }
.pick-picture { border-color: #d0bfff; }
.pick-feed { border-color: #ffd8a8; }
@media (max-width: 360px) { .picks { grid-template-columns: 1fr; } }
@media (max-width: 699px) { .picks.long { grid-template-columns: 1fr; } }
/* Garden: a seed in each bed; a finished question opens its flower. */
.bed .plant, .bed .drops { transform-box: fill-box; transform-origin: 50% 100%; }
.bed .plant { transform: scale(0); }
.bed.grown .plant { transform: scale(1); }
.bed.grown .seed, .bed .drops, .bed .ring { opacity: 0; }
.bed.next .ring { opacity: 1; }
.moving .bed .plant { transition: transform 0.7s cubic-bezier(.3, 1.5, .5, 1) 0.45s; }
.moving .bed.water .drops { animation: drops 0.6s ease-in 1; }
@keyframes drops { 0% { opacity: 1; transform: translateY(-6px); } 100% { opacity: 0; transform: translateY(22px); } }
/* River: stones already crossed look wet and dark; the next stone is ringed; the stone the animal stands on is
   drawn bigger with a dark rim, so the animal is clearly ON it (KIDS outside read 2026-10-29). */
.stone.passed .top { fill: #adb5bd; }
.stone.next .top { fill: #fff3bf; stroke: #f59f00; stroke-width: 1.5; }
.stone.here { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(1.45); }
.stone.here .top { fill: #e9ecef; stroke: #495057; stroke-width: 1.2; }
/* Feed the animal. */
.feed-field { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 150px; padding: 8px 8px 6px; border-radius: 16px; border: 1px solid var(--line, #ccc); overflow: hidden; background: linear-gradient(#e7f5ff 0 55%, #b2f2bb 55%); }
.feed-spot { position: relative; }
.feed-animal { display: inline-block; font-size: 84px; line-height: 1.05; transform-origin: 50% 90%; }
.feed-say { position: absolute; left: 100%; top: 0; margin-left: -6px; padding: 4px 10px; border-radius: 14px; background: #fff; color: #17202e; border: 2px solid var(--line); font-weight: 700; white-space: nowrap; opacity: 0; }
.feed-say.on { opacity: 1; }
.feed-tummy { min-height: 1.4em; font-size: 14px; line-height: 1.3; text-align: center; max-width: 100%; overflow-wrap: anywhere; color: var(--text); }
.feed-tummy.none { visibility: hidden; }
.feed-eaten-label { font-weight: 700; }
.feed-eaten-items { opacity: 0.6; font-size: 13px; letter-spacing: -1px; }
.feed-fly { position: fixed; z-index: 50; font-size: 1.5em; line-height: 1; pointer-events: none; }
@media (max-width: 699px) { .feed-field { min-height: 0; height: 24vh; } .feed-animal { font-size: min(64px, 11vh); } }
/* Confetti stays behind the question, the scene and the buttons in these games (KIDS outside read 2026-10-29): the
   confetti canvas sits on the body, the page content above it. */
body:has(.scene-game) > canvas { z-index: 0 !important; }
/* Picture: the parts not yet earned are hidden; the newest one pops in. Fully opaque back: confetti must not show through. */
.layer { opacity: 0; }
.layer.on { opacity: 1; }
.pic-back { opacity: 1; }
.moving .layer.new { animation: part-in 0.6s cubic-bezier(.3, 1.4, .5, 1); transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes part-in { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .moving .bed .plant, .moving .bed.water .drops, .moving .layer.new, .pick.shake { transition: none; animation: none; } }

/* Report this question (2026-10-18) */
.report { margin-top: 12px; }
.report-form { border: 1px solid var(--line, #ccc); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
.report-form legend { font-weight: 600; padding: 0 4px; }
.report-reason { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.report-note { width: 100%; box-sizing: border-box; }
.report-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report-q img { max-width: 100%; }
.ref-tables { margin: 8px 0 12px; }
.badge { display: inline-block; min-width: 1.4em; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #c62828; color: #fff; font-weight: 700; font-size: 0.85em; line-height: 1.5; text-align: center; }
.book-picker { margin: 8px 0 12px; }
.chapter > summary { flex-wrap: wrap; }
.book-tag { order: 3; flex-basis: 100%; padding-left: calc(1em + 10px); font-size: 0.8em; color: var(--muted, #667); font-weight: 400; margin-top: -4px; }
.term-chips { margin-top: 6px; }
.book-q { margin: 0; font-weight: 600; }
.grade-switch { margin: 4px 0 8px; }
.grade-switch > summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; }
.grade-switch > summary::-webkit-details-marker { display: none; }
.grade-switch.other { border: 2px solid var(--accent); border-radius: 12px; padding: 4px 12px 8px; background: var(--card, #fff); }
.grade-body { display: grid; gap: 8px; }
.grade-other { min-height: 44px; font: inherit; max-width: 16em; }

/* Leave a test, deck or game (2026-10-18): every answer is already saved. */
.test-head .leave-btn { flex: none; }
.test-head > .btn + .btn { margin-left: -4px; }

/* Flashcards: terms and definitions (2026-10-18) */
.card-term { font-size: 1.9em; font-weight: 800; text-align: center; margin: 0.6em 0; overflow-wrap: anywhere; }
.face.term .card-answer { font-size: 1.25em; line-height: 1.35; }
.explain-wait { display: flex; align-items: center; gap: 0.4em; }
.explain-wait .pencil { display: inline-block; animation: write 0.9s ease-in-out infinite alternate; }
@keyframes write { from { transform: rotate(-12deg) translateX(-2px); } to { transform: rotate(8deg) translateX(3px); } }

/* Fun for grades 1 to 4 (2026-10-18): praise that floats up, a wobble on a miss, stars on the score page,
   and a rocket riding the progress bar. All off with Effects off or reduced motion. */
.float-word {
  position: fixed; left: 50%; bottom: 22%; z-index: 50; pointer-events: none;
  font-size: 2rem; font-weight: 900; color: var(--primary); white-space: nowrap;
  text-shadow: 0 2px 0 #fff, 0 0 12px rgba(255, 255, 255, 0.9);
  animation: float-up 1.5s ease-out forwards;
}
.float-word.streak { color: #e8590c; font-size: 2.3rem; }
@keyframes float-up {
  0% { transform: translate(-50%, 20px) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, 0) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, -110px) scale(1); opacity: 0; }
}
.wobble { animation: wobble 0.5s ease-in-out; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-2deg); } 40% { transform: rotate(2deg); } 60% { transform: rotate(-1.2deg); } 80% { transform: rotate(1deg); } }
.stars { font-size: 2.6rem; letter-spacing: 0.15em; margin: 0.2em 0 0.4em; line-height: 1; }
.stars .star { color: #d9d9d9; display: inline-block; }
.stars .star.on { color: #f6b400; text-shadow: 0 2px 0 #c98a00; animation: star-in 0.5s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(0.3s + var(--i) * 0.25s); }
@keyframes star-in { from { transform: scale(0) rotate(-120deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
html[data-young="1"][data-effects="on"] .progress .bar { overflow: visible; position: relative; }
/* At the last question the runner stood 0.9em past the bar's end, 2 px past a phone's edge (full walk 2026-10-30). */
html[data-young="1"][data-effects="on"] .progress { padding-right: 1rem; }
html[data-young="1"][data-effects="on"] .progress .bar span { position: relative; border-radius: 999px; }
html[data-young="1"][data-effects="on"] .progress .bar span::after {
  content: ""; position: absolute; right: -0.9em; top: 50%; transform: translateY(-55%);
  width: 1.7rem; height: 1.7rem; background: var(--runner, url("/themes/1F680.svg")) center / contain no-repeat;
}
@media (prefers-reduced-motion: reduce) {
  .float-word, .wobble, .stars .star.on, .explain-wait .pencil { animation: none; }
}
html[data-effects="off"] .float-word, html[data-effects="off"] .stars .star.on { animation: none; }

/* Grades 1 to 4, round two (owner, 2026-10-18: more often, bigger). */
html[data-young="1"] .float-word { font-size: 2.6rem; }
html[data-young="1"] .float-word.streak { font-size: 3rem; }
.float-word.gentle { color: #1c7ed6; font-size: 2rem !important; }
.float-word.milestone { color: #ae3ec9; bottom: 40%; }
.hello-pet { display: inline-block; font-size: 1.3em; animation: wave 1.6s ease-in-out infinite; transform-origin: 70% 90%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(12deg); } }
html[data-young="1"] .flashcard.flipped .face.back { animation: pop 0.35s ease-out; }

#kid-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; display: none; }
html[data-young="1"][data-effects="on"] body:is([data-view="home"], [data-view="score"], [data-view="review"]) #kid-sky { display: block; }
#kid-sky span { position: absolute; bottom: -60px; left: calc(4% + var(--i) * 9.5%); font-size: calc(22px + (var(--i) * 7px) % 20px); opacity: 0.35;
  animation: drift calc(14s + var(--i) * 1.7s) linear infinite; animation-delay: calc(var(--i) * -2.3s); }
@keyframes drift { from { transform: translate(0, 0) rotate(-6deg); } 50% { transform: translate(18px, -55vh) rotate(6deg); } to { transform: translate(-10px, -115vh) rotate(-6deg); } }
main, #view, .topbar, #msg { position: relative; z-index: 1; }

/* Review animals: a naughty one points at each mistake, a happy one sleeps on each right answer. */
.review-item.has-critter { position: relative; margin-top: 46px; overflow: visible; }
.critter { position: absolute; top: -40px; right: 10px; display: flex; align-items: flex-end; gap: 4px; z-index: 2; pointer-events: none; }
.critter-face { display: grid; place-items: center; width: 62px; height: 62px; font-size: 40px; line-height: 1; border-radius: 50%;
  background: var(--c); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18), 0 0 0 4px #fff; }
.critter.naughty { flex-direction: row; }
.critter.naughty .critter-face { animation: cheeky 1.4s ease-in-out infinite; }
.critter-point { font-size: 30px; align-self: flex-end; margin-bottom: -18px; animation: point 0.8s ease-in-out infinite alternate; order: 2; }
.critter-say { order: -1; align-self: center; background: #fff; color: #c92a2a; font-weight: 800; font-size: 0.85rem; padding: 4px 9px;
  border-radius: 14px; border: 2px solid var(--c); white-space: nowrap; margin-right: 2px; }
.critter.naughty.fixed .critter-say { color: #2b8a3e; }
.critter.naughty.fixed .critter-face { animation: hop 0.9s ease-in-out infinite; }
@keyframes cheeky { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-3px); } }
@keyframes point { from { transform: translateY(0); } to { transform: translateY(7px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } }
.review-right { border-color: #b2f2bb; background: #f4fff6; }
.critter.sleepy .critter-face { width: 52px; height: 52px; font-size: 32px; animation: breathe 3s ease-in-out infinite; filter: saturate(0.9); }
.zzz { position: absolute; top: -18px; left: -14px; font-weight: 800; color: #4dabf7; font-style: normal; }
.zzz i { position: absolute; font-style: normal; opacity: 0; animation: zz 3s ease-in-out infinite; }
.zzz i:nth-child(1) { font-size: 12px; animation-delay: 0s; }
.zzz i:nth-child(2) { font-size: 16px; animation-delay: 1s; }
.zzz i:nth-child(3) { font-size: 20px; animation-delay: 2s; }
@keyframes zz { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(-16px, -26px); opacity: 0; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.right-head { margin-top: 28px; }
@media (prefers-reduced-motion: reduce) {
  .hello-pet, .critter *, .zzz i, #kid-sky span { animation: none !important; }
  .zzz i { opacity: 1; }
  .zzz i:nth-child(2) { transform: translate(-8px, -12px); } .zzz i:nth-child(3) { transform: translate(-16px, -24px); }
}
html[data-effects="off"] .hello-pet, html[data-effects="off"] .critter *, html[data-effects="off"] .zzz i { animation: none !important; }
html[data-effects="off"] .zzz i { opacity: 1; }

/* Builder steps (owner, 2026-10-18): each part is its own soft panel, every other one a shade darker,
   with a thin rule between. The panel padding replaces the heading's top margin, so the page is no longer. */
.step { padding: 8px 12px 2px; margin: 0 -12px; border-radius: var(--radius); border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.step.alt { background: color-mix(in srgb, var(--chip) 60%, transparent); border-top-color: transparent; }
.step + .step.alt, .step.alt + .step { border-top-color: transparent; }
.step > h2:first-child { margin-top: 0; }
.step .chips { margin-bottom: 4px; }
.settings { margin-top: 0; }

/* Start tapped too early: the missing step gets a thick moving rainbow ring until it is chosen. */
.btn.primary.inactive { opacity: 0.55; }
.need-ring { position: relative; z-index: 0; }
.need-ring::before {
  content: ""; position: absolute; inset: -8px; border-radius: calc(var(--radius) + 8px); padding: 7px; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, #ff4d4d, #ff9f1a, #ffe600, #3ddc84, #2fa8ff, #8a5cff, #ff4dc4, #ff4d4d);
  background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: rainbow 2.2s linear infinite, ring-in 0.5s ease-out;
}
@keyframes rainbow { to { background-position: 300% 0; } }
@keyframes ring-in { from { transform: scale(1.06); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .need-ring::before { animation: none; } }

/* The mix slider: each side named in its own track colour, with a picture of what it looks like. */
.mix-labels { align-items: flex-start; }
.mix-side { display: flex; flex-direction: column; gap: 2px; }
.mix-side.sa { align-items: flex-end; text-align: right; }
.mix-side.mc .mix-num, .mix-side.mc .mix-kind { color: var(--primary); }
.mix-side.sa .mix-num, .mix-side.sa .mix-kind { color: var(--accent); }
.mix-kind { font-size: 0.8em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.mix-pic { display: inline-flex; gap: 3px; font-size: 0.75em; font-weight: 700; }
.mix-pic i { font-style: normal; display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%;
  border: 2px solid var(--primary); color: var(--primary); background: var(--surface); }
.mix-pic.type { color: var(--accent); }
.mix-pic.type u { text-decoration: none; border-bottom: 2px dashed var(--accent); padding: 0 6px; }
.mix-side.zero { opacity: 0.45; }
.mix-presets { margin-top: 10px; }
.chip.mini { min-height: 36px; padding: 4px 12px; font-size: 0.9em; }
.mix-kind { display: inline-flex; align-items: center; gap: 5px; }
.mix-presets { margin-top: 8px; margin-bottom: 2px; flex-wrap: nowrap; }
.mix-presets .chip.mini { flex: 1 1 0; justify-content: center; text-align: center; white-space: nowrap; padding: 4px 6px; }
.mix-pic i { width: 1.45em; height: 1.45em; }

/* Reading help (2026-10-18): bigger text, calm screens, and a "Read it to me" button. */
html[data-reading="1"] body { font-size: calc(var(--base) * 1.18); line-height: 1.6; }
html[data-reading="1"] .stem { font-size: 1.15em; }
html[data-reading="1"] #kid-sky { display: none !important; }
html[data-reading="1"] .critter *, html[data-reading="1"] .hello-pet, html[data-reading="1"] .zzz i { animation: none !important; }
html[data-reading="1"] .zzz i { opacity: 1; }
.stem-wrap { display: flex; flex-direction: column; gap: 6px; }
.read-btn { align-self: flex-start; min-height: 40px; padding: 4px 14px; font-weight: 700; }
.read-row { display: flex; justify-content: center; margin: 8px 0 0; }
.reading-help { margin: -4px 0 10px; }
.reading-help summary { cursor: pointer; color: var(--muted); }
.reading-help-body { padding: 6px 0 2px; }
.reading-tag { align-self: center; }
html[data-reading="1"] .progress .bar span::after { display: none; }

/* Short science videos (2026-10-20): "Watch this first" beside a missed question, optional ones at the top of a chapter. */
.reel-btn { display: flex; align-items: center; gap: 0.6em; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 10px 14px; border: 2px solid var(--primary); border-radius: var(--radius); background: var(--bg); min-height: 48px; }
.reel-btn:hover, .reel-btn:focus-visible { background: color-mix(in srgb, var(--primary) 12%, var(--bg)); }
.reel-play { flex: none; display: grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.95em; }
.chapter-reels { display: grid; gap: 8px; margin: 4px 0 12px; }
.chapter-reels p { margin: 0; }
.reel-shade { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.82); display: grid; place-items: center; padding: 12px; }
.reel-box { display: grid; gap: 10px; justify-items: center; width: min(100%, 460px); }
.reel-box video { width: 100%; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); aspect-ratio: 9 / 16; background: #000; border-radius: 12px; object-fit: contain; }

/* ---------- Greek (Track B, 2026-10-22) ---------- */
/* Ancient Greek text: the polytonic serif. Use class="ancient" on any element, or data-ancient="1" on a
   view (app.js sets it for an Ancient Greek course), which sets only the question text in the serif. */
.ancient,
[data-ancient="1"] .stem,
[data-ancient="1"] .choice-text,
[data-ancient="1"] .card-term,
[data-ancient="1"] .card-question,
[data-ancient="1"] .card-answer,
[data-ancient="1"] .card-choices,
[data-ancient="1"] .balloon-text,
[data-ancient="1"] .given strong {
  font-family: var(--ancient-font);
  font-feature-settings: "kern" 1;
}
/* Greek words run longer than English ones: let chips and buttons wrap instead of running off a phone. */
.btn, .chip { overflow-wrap: break-word; hyphens: auto; }
.test-head .btn { white-space: nowrap; }
/* Full walk 2026-10-30: on a phone the title, «PDF» and «Έξοδος» did not fit one row at the grades 1-3 type size,
   and «Έξοδος» sat past the right edge (Galaxy S9+, iPhone SE, iPhone 13); Android then let the whole page slide
   sideways. On a narrow screen the title takes its own row and the buttons share the row under it, on the right. */
@media (max-width: 480px) {
  .test-head { flex-wrap: wrap; row-gap: 8px; }
  .test-head > div:first-child { flex: 1 0 100%; min-width: 0; }
  .test-head > .btn:nth-child(2) { margin-left: auto; }
}
/* Text-like buttons and the «θέμα» / «βοήθεια ανάγνωσης» rows were 24-30 px high: a child's finger needs 44. */
button.linkish, summary.linkish { min-height: 44px; }
summary.linkish { padding-block: 10px; }
.mix-presets .chip.mini { white-space: normal; }
/* Grade selects show the Greek school name ("Γʹ Γυμνασίου"), longer than the old number box. */
select.grade-input { width: auto; min-width: 10.5em; }

/* Picture themes, grades 1-6 (DECISION_LOG 21, 23). Colours come in as variables set by applyTheme() in app.js;
   these rules only place the pictures and the picker cards. */
#kid-sky span img { width: 1.6em; height: 1.6em; display: block; }
.hello-pet .pet-img { width: 1.4em; height: 1.4em; vertical-align: -0.25em; }
.score-pic { display: block; width: 96px; height: 96px; margin: 0 auto 4px; }
.theme-picker { margin-top: 10px; }
.theme-picker .theme-new { color: var(--primary); font-weight: 700; }
.theme-picker .theme-head { font-weight: 700; margin: 8px 0 4px; }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 96px;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--card-bg); color: var(--text);
  font: inherit; font-size: 0.85em; cursor: pointer; }
.theme-card img { width: 48px; height: 48px; }
.theme-card.on { border-color: var(--card-edge); box-shadow: 0 0 0 2px var(--card-edge); font-weight: 700; }
.theme-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.label-like { font-weight: 600; margin: 0 0 4px; }

/* The animal that comes towards the child at the end of a test (heroRun in app.js). It starts far away (deep on the
   z axis, so small), comes forward and grows, then passes the viewer and fades. Its gait runs on the picture. */
.hero-stage { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; perspective: 700px; pointer-events: auto; }
.hero-come { animation: hero-come 3.2s cubic-bezier(.35,.05,.6,1) both; transform-style: preserve-3d; }
.hero-img { width: 140px; height: 140px; display: block; filter: drop-shadow(0 10px 8px rgba(0,0,0,.25)); }
/* The Lottie animal (heroRun): the same approach, the legs and wings from the animation itself, so no gait class. */
.hero-lottie { width: 220px; height: 220px; }
@keyframes hero-come {
  0%   { transform: translate3d(0, -22vh, -2400px); opacity: 0; }
  12%  { opacity: 1; }
  78%  { transform: translate3d(0, 6vh, 260px); opacity: 1; }
  100% { transform: translate3d(0, 14vh, 520px); opacity: 0; }
}
/* Gaits (owner, 2026-10-24: the first version shook). One smooth movement per gait, no fast rotation: a walker
   hops along with a squash on landing, a swimmer glides on a slow wave, a flyer sweeps in a wide curve. The
   hero-path layer adds a gentle side-to-side drift so the animal does not come in on a straight line. */
.hero-path { animation: hero-path 3.2s ease-in-out both; }
@keyframes hero-path { 0% { transform: translateX(-60px); } 50% { transform: translateX(40px); } 100% { transform: translateX(-10px); } }
.hero-img { transform-origin: 50% 100%; }
.move-walk { animation: gait-walk 0.64s cubic-bezier(.45,0,.55,1) infinite; }
.move-swim { animation: gait-swim 1.6s ease-in-out infinite; }
.move-fly  { animation: gait-fly 1.8s ease-in-out infinite; }
@keyframes gait-walk { 0% { transform: translateY(0) scale(1.06, 0.94); } 15% { transform: translateY(-4px) scale(1, 1); }
  50% { transform: translateY(-22px) scale(0.98, 1.03); } 85% { transform: translateY(-4px) scale(1, 1); } 100% { transform: translateY(0) scale(1.06, 0.94); } }
@keyframes gait-swim { 0%, 100% { transform: translateY(10px) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
@keyframes gait-fly  { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-24px) rotate(3deg); } }
.hero-backdrop { position: absolute; top: 12vh; left: 50%; width: 180px; height: 180px; margin-left: -90px;
  animation: backdrop-rise 3.2s ease-out both; }
@keyframes backdrop-rise { 0% { transform: translateY(40px) scale(0.6); opacity: 0; } 25% { opacity: 0.9; } 80% { opacity: 0.9; } 100% { transform: translateY(0) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero-stage { display: none; } }
html[data-reading="1"] .hero-stage, html[data-effects="off"] .hero-stage { display: none; }
/* N6 (2026-10-27): on the score page the animal lands in a space kept above the score (.hero-dock) and stays there,
   so it never covers the score or the buttons. It comes from far away and grows to its place, without passing the
   viewer; a tap on it sends it away. */
.hero-dock { position: relative; height: 140px; margin: -8px 0 0; }
.hero-stage.hero-docked { position: absolute; inset: 0; z-index: 2; overflow: visible; cursor: pointer; }
.hero-docked .hero-come { animation-name: hero-land; }
.hero-docked .hero-path { animation-name: hero-path-land; }
.hero-docked .hero-img { width: 110px; height: 110px; }
.hero-docked .hero-lottie { width: 136px; height: 136px; }
.hero-docked .hero-backdrop { top: 0; width: 130px; height: 130px; margin-left: -65px; animation-name: backdrop-land; }
.hero-docked.settled .hero-img { animation: none; }
@keyframes hero-land {
  0%   { transform: translate3d(0, -40px, -2400px); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translate3d(0, 0, 0); opacity: 1; }
}
@keyframes hero-path-land { 0% { transform: translateX(-60px); } 50% { transform: translateX(40px); } 100% { transform: translateX(0); } }
@keyframes backdrop-land { 0% { transform: translateY(30px) scale(0.6); opacity: 0; } 30% { opacity: 0.9; } 100% { transform: translateY(0) scale(1); opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .hero-dock { display: none; } }

/* Book unit numbers and the chapter-row button (owner 2026-10-25, from KIDS): one square button per book unit,
   the chosen units named underneath; «Όλα τα θέματα» on each chapter row */
.book-nums { margin: 8px 0; }
.chip.book-num { min-width: 48px; justify-content: center; font-weight: 700; }
.book-chosen ul { margin: 4px 0 8px; padding-left: 1.2em; }
.book-chosen li { margin: 2px 0; }
.chapter > summary .review-chip { min-height: 36px; padding: 4px 14px; font-size: 0.9em; font-weight: 700; }
/* N29 (navigation read 2026-10-27): on a phone the chapter name keeps the whole row, the «Όλα τα θέματα» button goes
   under it, and the «Πρώτη προσπάθεια» tag goes under the struck-out first answer instead of squeezing it. */
@media (max-width: 600px) {
  .chapter > summary .ch-name { flex: 1 1 calc(100% - 1em - 20px); }
  .chapter > summary .review-chip { margin-left: calc(1em + 10px); }
  .choice.tried { flex-wrap: wrap; }
  .choice.tried .choice-text { flex: 1 1 calc(100% - 1.9em - 12px); }
  .choice.tried .tag { margin-left: calc(1.9em + 12px); }
}

/* N9 (2026-10-27): the small labelled way home (or back to the children) at the foot of a page. */
.home-row { margin-top: 16px; }
.accents-note { margin: 4px 0 0; }

/* Question animations (the «Δες το» button; player in anim.js). The picture keeps its own light sky in the dark theme. */
.anim-wrap { margin: 4px 0 10px; }
.anim-btn { min-height: 40px; padding: 4px 14px; font-weight: 700; }
.anim-box { margin-top: 8px; }
.anim-box[hidden] { display: none; }
.anim-box .stage { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid #dde2ec; background: #eaf6ff; }
.anim-box .stage svg.scene { display: block; width: 100%; height: auto; }
.anim-box .guide { position: absolute; left: 6px; top: 6px; width: 15%; max-width: 64px; }
.anim-box .guide svg { display: block; width: 100%; height: auto; }
.anim-box .cap { min-height: 3em; margin: 8px 2px; font-size: 1.1rem; font-weight: 600; }
