/* Ausgeology · The carbon cycle and Earth's spheres (Year 9 Science)
   The shared lesson design system: one reading column (about 68 characters)
   inside a 1080px frame; models, the globe and charts use the full frame.
   Sea blue is the accent; graphite carbon is the one dark highlight. Each
   sphere keeps one colour throughout: sky, sea, leaf and rock. */

:root {
  --bg: #eef0ec;
  --surface: #fbfcfa;
  --surface-2: #e2e7e2;
  --ink: #1a2124;
  --ink-2: #4a565a;
  --line: #c6cec9;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --accent-soft: #d6e5ef;
  --ochre: #b4501c;
  --ochre-band: #a5481a;
  --ochre-soft: #f6e2d4;
  --carbon: #1d2124;
  --carbon-ink: #ffffff;
  --sp-atm: #5b9fd0;
  --sp-atm-soft: #d9ebf7;
  --sp-hyd: #1f6f8a;
  --sp-hyd-soft: #d2e7ec;
  --sp-bio: #4f8a35;
  --sp-bio-soft: #dcecd2;
  --sp-geo: #9a5a2b;
  --sp-geo-soft: #efdcc9;
  --good: #2b7449;
  --good-soft: #dcefe3;
  --bad: #b3261e;
  --bad-soft: #f7dedc;
  --focus: #d99a00;
  --pop-bg: #1a2124;
  --pop-ink: #f2f4f2;
  --shadow: 0 1px 2px rgba(20, 30, 34, 0.06), 0 8px 24px rgba(20, 30, 34, 0.07);
  /* chart roles (validated with the dataviz palette script) */
  --viz-surface: #fbfcfa;
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-3: #1baf7a;
  --viz-dim: #b9b8ae;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-muted: #6f6e68;
  /* type */
  --font-display: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --scale: 1;
  --radius: 12px;
  --steps: 10;
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.4 16.6 4.8 12l-1.6 1.6 6.2 6.2L21 8.2l-1.6-1.6z'/%3E%3C/svg%3E");
  --i-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.4 4.2 12 10.6 5.6 4.2 4.2 5.6l6.4 6.4-6.4 6.4 1.4 1.4 6.4-6.4 6.4 6.4 1.4-1.4-6.4-6.4 6.4-6.4z'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111517;
    --surface: #182024;
    --surface-2: #212a2f;
    --ink: #e6ebeb;
    --ink-2: #a9b5b8;
    --line: #2f3a3f;
    --accent: #7fb9e4;
    --accent-ink: #0b1822;
    --accent-soft: #1d3446;
    --ochre: #ec8a52;
    --ochre-band: #a5481a;
    --ochre-soft: #3d2416;
    --carbon: #0b0e10;
    --carbon-ink: #f2f4f2;
    --sp-atm: #7fb6dc;
    --sp-atm-soft: #1b3447;
    --sp-hyd: #5aa6bf;
    --sp-hyd-soft: #163640;
    --sp-bio: #7fb861;
    --sp-bio-soft: #1f3618;
    --sp-geo: #c98a55;
    --sp-geo-soft: #3d2816;
    --good: #66c792;
    --good-soft: #17372a;
    --bad: #f38b84;
    --bad-soft: #43201e;
    --focus: #ffcc4d;
    --pop-bg: #e6ebeb;
    --pop-ink: #111517;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --viz-surface: #182024;
    --viz-1: #3987e5;
    --viz-2: #d95926;
    --viz-3: #199e70;
    --viz-dim: #5d6a6e;
    --viz-grid: #263034;
    --viz-axis: #3a464b;
    --viz-muted: #95a2a6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111517;
  --surface: #182024;
  --surface-2: #212a2f;
  --ink: #e6ebeb;
  --ink-2: #a9b5b8;
  --line: #2f3a3f;
  --accent: #7fb9e4;
  --accent-ink: #0b1822;
  --accent-soft: #1d3446;
  --ochre: #ec8a52;
  --ochre-band: #a5481a;
  --ochre-soft: #3d2416;
  --carbon: #0b0e10;
  --carbon-ink: #f2f4f2;
  --sp-atm: #7fb6dc;
  --sp-atm-soft: #1b3447;
  --sp-hyd: #5aa6bf;
  --sp-hyd-soft: #163640;
  --sp-bio: #7fb861;
  --sp-bio-soft: #1f3618;
  --sp-geo: #c98a55;
  --sp-geo-soft: #3d2816;
  --good: #66c792;
  --good-soft: #17372a;
  --bad: #f38b84;
  --bad-soft: #43201e;
  --focus: #ffcc4d;
  --pop-bg: #e6ebeb;
  --pop-ink: #111517;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --viz-surface: #182024;
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
  --viz-dim: #5d6a6e;
  --viz-grid: #263034;
  --viz-axis: #3a464b;
  --viz-muted: #95a2a6;
  color-scheme: dark;
}

/* ---------- base ---------- */
html { font-size: calc(100% * var(--scale)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
p { margin: 0; }
.ul { text-decoration: underline; text-decoration-thickness: 0.09em; text-underline-offset: 0.16em; text-decoration-skip-ink: none; }

.wrap {
  max-width: 1080px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 0.85em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: 0.4em; }
.small { font-size: 0.92rem; color: var(--ink-2); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 8px;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding-block: 12px 10px; }
.brand {
  font-family: var(--font-display); font-weight: 800; font-stretch: 118%;
  font-size: 1.2rem; letter-spacing: -0.01em; line-height: 1;
}
.brand i { font-style: normal; color: var(--ochre); }
.back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.92rem; font-weight: 600; text-decoration: none; margin-right: auto;
}
.back:hover { text-decoration: underline; }
.back svg { width: 18px; height: 18px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.tool:hover { border-color: var(--accent); }
.tool svg { width: 18px; height: 18px; flex: none; }
.tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tool-val { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; }

.rail-nav { padding-block: 2px 12px; }
.rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--steps, 10), minmax(0, 1fr)); gap: 4px; }
.rail-btn {
  width: 100%; display: grid; gap: 5px; padding: 4px 0; border: 0; background: none;
  text-align: left; cursor: pointer; color: var(--ink-2); border-radius: 4px;
}
.rail-bar { height: 6px; border-radius: 3px; background: var(--surface-2); transition: background-color 0.2s; }
.rail-btn:hover .rail-bar { background: var(--line); }
.rail-btn.is-done .rail-bar { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.rail-btn[aria-current="step"] .rail-bar { background: var(--accent); box-shadow: none; }
.rail-t { font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.25; letter-spacing: 0.02em; }
.rail-t b { display: block; font-weight: 600; color: var(--ink); }
.rail-btn[aria-current="step"] .rail-t { color: var(--ink); }
.rail-now { display: none; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); margin-top: 6px; }
.rail-now b { color: var(--ink); font-weight: 600; }

/* ---------- screens ---------- */
.js .screen:not(.is-active) { display: none; }
.screen { padding-block: 36px 56px; }
.screen-inner { display: grid; gap: 28px; }
.screen-inner > *, .section > *, .hero > *, .checks > *, .lab-body > * { min-width: 0; }
.screen-head { display: grid; gap: 8px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-2);
}
.display {
  font-family: var(--font-display); font-weight: 800; font-stretch: 116%;
  letter-spacing: -0.015em; line-height: 1; margin: 0; text-wrap: balance;
}
h1.display { font-size: clamp(2.7rem, 1.3rem + 5.6vw, 5.4rem); line-height: 0.95; }
h2.display { font-size: clamp(2rem, 1.25rem + 2.8vw, 3.1rem); }
h2.display:focus, h1.display:focus { outline: none; }
h3 {
  font-family: var(--font-display); font-weight: 750; font-stretch: 108%;
  font-size: 1.32rem; line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -0.005em;
}
.display .dot { color: var(--ochre); }
.lede { font-size: 1.28rem; line-height: 1.5; max-width: 60ch; }
.section { display: grid; gap: 14px; }

/* ---------- hero ---------- */
.hero { display: grid; gap: 20px; padding-bottom: 8px; }
.fig-tag {
  position: absolute; right: 8px; top: 8px; font-family: var(--font-mono); font-size: 0.66rem;
  letter-spacing: 0.06em; text-transform: uppercase; background: rgba(0, 0, 0, 0.45); color: #fff;
  padding: 2px 6px; border-radius: 4px;
}
.country {
  max-width: 76ch; background: var(--surface-2); border-radius: var(--radius);
  padding: 16px 18px; font-size: 1rem; display: grid; gap: 6px;
}
.country b { font-weight: 700; }

.goals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.goal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.goal-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.goal-card li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: start; line-height: 1.45; }
.sc-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  border: 1.5px solid var(--accent); color: var(--accent); margin-top: 1px;
}
.label {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-2);
}

/* ---------- teaching blocks ---------- */
.key-idea {
  max-width: 68ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px 18px; display: grid; gap: 6px;
}
.key-idea .label { display: inline-flex; align-items: center; gap: 8px; }
.key-idea .label::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--accent); }
.key-idea p { font-size: 1.26rem; font-weight: 700; line-height: 1.4; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 72ch; counter-reset: step; }
.steps > li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; counter-increment: step; }
.steps > li::before {
  content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ochre-band); color: #fff; font-family: var(--font-mono); font-weight: 600; font-size: 0.85rem; margin-top: 1px;
}
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 1rem; line-height: 1.45; }
caption { text-align: left; padding: 12px 14px 0; font-weight: 700; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
thead th {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-2); background: var(--surface-2);
}
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 700; }
td.time, th.time { font-variant-numeric: tabular-nums; }

details.more { max-width: 72ch; border: 1px dashed var(--line); border-radius: var(--radius); padding: 0 18px; background: transparent; }
details.more > summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: "+"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--accent); color: var(--accent); font-family: var(--font-mono); font-size: 0.95rem; line-height: 1;
}
details.more[open] > summary::before { content: "\2212"; }
details.more > .more-body { padding: 0 0 18px; display: grid; gap: 12px; }
details.reveal > summary { list-style: none; width: fit-content; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary { display: none; }
.tag-ext { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }

/* ---------- labs ---------- */
.lab { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.lab-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lab-head h3 { font-size: 1.15rem; }
.lab-head .label { color: var(--accent); }
.lab-body { padding: 16px 18px 18px; display: grid; gap: 14px; }
.lab-body > p.small { max-width: 72ch; }
.lab canvas { display: block; width: 100%; border-radius: 10px; background: #2a1810; }
.lab .canvas-light { background: #cfe3ec; }
.lab-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status {
  margin: 0; min-height: 3.3em; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); font-size: 1rem; line-height: 1.5;
}
.model-note { font-size: 0.92rem; color: var(--ink-2); max-width: 75ch; }
.model-note b { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 16px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1rem; font-weight: 650; line-height: 1.2; cursor: pointer; text-align: left; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn small { font-weight: 500; font-size: 0.82rem; opacity: 0.85; }

.slider-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.slider-row .label { white-space: nowrap; }
input[type="range"] { width: 100%; accent-color: var(--ochre); height: 32px; cursor: pointer; }
.stage-name { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: 1.3rem; }

/* ---------- checks for understanding ---------- */
.checks { display: grid; gap: 16px; }
.check {
  max-width: 780px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px 20px; display: grid; gap: 12px;
}
.check-head { display: flex; justify-content: space-between; gap: 12px; }
.check-q { font-weight: 700; font-size: 1.12rem; line-height: 1.45; }
.check-opts { display: grid; gap: 8px; }
.opt {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 14px 12px 48px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); line-height: 1.45; font-size: 1.02rem;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt::before {
  content: attr(data-letter); position: absolute; left: 13px; top: 11px; width: 24px; height: 24px;
  border-radius: 50%; border: 1.5px solid var(--ink-2); color: var(--ink-2);
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; line-height: 21px; text-align: center;
}
.opt.is-right { border-color: var(--good); background: var(--good-soft); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-right::before, .opt.is-wrong::before { content: ""; border: 0; border-radius: 0; }
.opt.is-right::before { background: var(--good); -webkit-mask: var(--i-check) center / 22px no-repeat; mask: var(--i-check) center / 22px no-repeat; }
.opt.is-wrong::before { background: var(--bad); -webkit-mask: var(--i-cross) center / 20px no-repeat; mask: var(--i-cross) center / 20px no-repeat; }
.opt:disabled { cursor: default; }
.opt:disabled:not(.is-right):not(.is-wrong) { opacity: 0.6; }
.fb { padding: 12px 14px; border-radius: 10px; font-size: 1rem; line-height: 1.5; background: var(--surface-2); }
.fb.is-right { background: var(--good-soft); }
.fb.is-wrong { background: var(--bad-soft); }
.fb strong { font-weight: 800; }
.fb.is-right strong { color: var(--good); }
.fb.is-wrong strong { color: var(--bad); }

/* ---------- exit check and results ---------- */
.results { max-width: 820px; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 16px; padding: 18px 20px; display: grid; gap: 12px; }
.results-score { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: 2rem; line-height: 1.1; }
.sc-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sc-results li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; line-height: 1.45; }
.sc-icon { width: 24px; height: 24px; border-radius: 50%; margin-top: 1px; }
.sc-icon.ok { background: var(--good); -webkit-mask: var(--i-check) center / 20px no-repeat; mask: var(--i-check) center / 20px no-repeat; }
.sc-icon.todo { border: 2px solid var(--line); }
.sc-review { font-size: 0.95rem; }
.offline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.offline-links { display: flex; flex-wrap: wrap; gap: 8px; }
.teacher { max-width: 80ch; }
.teacher .more-body h3 { font-size: 1.05rem; margin-top: 6px; }
.teacher blockquote { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-style: italic; }
.teacher ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- screen navigation ---------- */
.screen-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.screen-nav .next { margin-left: auto; }
.screen-nav .btn { max-width: 100%; }

/* ---------- glossary ---------- */
.term { cursor: help; border-bottom: 2px dotted var(--accent); border-radius: 2px; }
.term:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.term:hover, .term[aria-expanded="true"] { color: var(--accent); }
.term-pop {
  position: absolute; z-index: 60; width: max-content; max-width: min(340px, calc(100vw - 32px));
  background: var(--pop-bg); color: var(--pop-ink); border-radius: 12px; padding: 12px 14px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); font-size: 0.98rem; line-height: 1.45; display: grid; gap: 4px;
}
.term-pop b { font-size: 1.02rem; }
.term-pop button { justify-self: start; margin-top: 4px; background: none; border: 0; padding: 4px 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: 0.9rem; }
dialog.glossary {
  border: 0; border-radius: 18px; padding: 0; width: min(680px, calc(100vw - 32px)); max-height: min(84vh, 760px);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
dialog.glossary::backdrop { background: rgba(10, 14, 16, 0.55); }
.gl-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.gl-head h2 { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: 1.5rem; margin: 0; }
.gl-list { margin: 0; padding: 12px 20px 20px; display: grid; gap: 12px; }
.gl-list dt { font-weight: 800; }
.gl-list dd { margin: 2px 0 0; color: var(--ink-2); line-height: 1.5; }

/* read aloud */
.is-reading { background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); border-radius: 4px; }

.site-foot { border-top: 1px solid var(--line); background: var(--surface); }
.site-foot .wrap { padding-block: 18px 24px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; font-size: 0.9rem; color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .goals { grid-template-columns: minmax(0, 1fr); }
  .rail-t { display: none; }
  .rail-now { display: block; }
  .offline { grid-template-columns: minmax(0, 1fr); }
  .tool-label { display: none; }
  .tool { padding: 6px 10px; }
}
@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .screen { padding-block: 26px 44px; }
  .lab-head, .lab-body { padding-left: 14px; padding-right: 14px; }
  .check { padding: 16px; }
  .slider-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .slider-row input { grid-column: 1 / -1; grid-row: 1; }
  .slider-row .hi { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- The water cycle (Year 4): lesson tokens and shared blocks ----------
   Water blue is the accent, the sun is the warm highlight. Scene colours are
   tokens too, so the illustrations stay readable in dark mode. Type and
   targets are a step larger than the secondary lessons: these readers are nine. */
:root {
  --accent: #1565a8;
  --accent-ink: #ffffff;
  --accent-soft: #d7e8f5;
  --sun: #e9a83a;
  --sun-soft: #fdf0d2;
  --drop: #2f85cf;
  --drop-ink: #ffffff;
  --vap: #4d9ad8;
  --sc-sky: #cfe8f8;
  --sc-sky-2: #a9d4f0;
  --sc-sea: #2f7fb9;
  --sc-sea-2: #1f6397;
  --sc-cloud: #ffffff;
  --sc-cloud-2: #d9e4ec;
  --sc-grass: #8cbb63;
  --sc-grass-2: #6fa14b;
  --sc-sand: #e2c48a;
  --sc-soil: #a97c4f;
  --sc-soil-2: #7d5a38;
  --sc-rock: #9c8a78;
  --sc-snow: #f6f9fb;
  --sc-house: #f3e9d8;
  --sc-roof: #c75b3f;
  --sc-trunk: #7a5637;
  --sc-asphalt: #8d9299;
  --sc-asphalt-2: #6f757c;
  --sc-ink: #1a2124;
  --sc-glass: rgba(255, 255, 255, 0.55);
  --sc-shadow: rgba(20, 30, 40, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #7cb8ea; --accent-ink: #0b1822; --accent-soft: #1b3348;
    --sun: #f0b94f; --sun-soft: #3d3014; --drop: #5aa7e6; --drop-ink: #0b1822; --vap: #8cc4f2;
    --sc-sky: #27465c; --sc-sky-2: #1c3447; --sc-sea: #2b6c9b; --sc-sea-2: #1d4f73;
    --sc-cloud: #dfe7ee; --sc-cloud-2: #aebbc6; --sc-grass: #5f8f45; --sc-grass-2: #4a7536;
    --sc-sand: #b89a63; --sc-soil: #7d5a38; --sc-soil-2: #5b4128; --sc-rock: #6f6358; --sc-snow: #e6edf2;
    --sc-house: #d8cfbf; --sc-roof: #a84a33; --sc-trunk: #5e4229; --sc-asphalt: #5a6066; --sc-asphalt-2: #464c52;
    --sc-ink: #e6ebeb; --sc-glass: rgba(255, 255, 255, 0.28); --sc-shadow: rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --accent: #7cb8ea; --accent-ink: #0b1822; --accent-soft: #1b3348;
  --sun: #f0b94f; --sun-soft: #3d3014; --drop: #5aa7e6; --drop-ink: #0b1822; --vap: #8cc4f2;
  --sc-sky: #27465c; --sc-sky-2: #1c3447; --sc-sea: #2b6c9b; --sc-sea-2: #1d4f73;
  --sc-cloud: #dfe7ee; --sc-cloud-2: #aebbc6; --sc-grass: #5f8f45; --sc-grass-2: #4a7536;
  --sc-sand: #b89a63; --sc-soil: #7d5a38; --sc-soil-2: #5b4128; --sc-rock: #6f6358; --sc-snow: #e6edf2;
  --sc-house: #d8cfbf; --sc-roof: #a84a33; --sc-trunk: #5e4229; --sc-asphalt: #5a6066; --sc-asphalt-2: #464c52;
  --sc-ink: #e6ebeb; --sc-glass: rgba(255, 255, 255, 0.28); --sc-shadow: rgba(0, 0, 0, 0.35);
}

/* a step larger for Year 4 readers */
body { font-size: 1.2rem; line-height: 1.62; }
.lede { font-size: 1.34rem; line-height: 1.5; max-width: 56ch; }
.prose { max-width: 62ch; }
h3 { font-size: 1.38rem; }
.btn { min-height: 48px; padding: 10px 18px; font-size: 1.04rem; }
.tool { min-height: 42px; }
.check-q { font-size: 1.18rem; }
.opt { font-size: 1.08rem; padding: 14px 14px 14px 52px; }
.opt::before { top: 13px; }
.key-idea p { font-size: 1.3rem; }
.small { font-size: 0.96rem; }
.label { font-size: 0.76rem; }
input[type="range"] { height: 40px; }
.status { font-size: 1.06rem; min-height: 3.6em; }
.fb { font-size: 1.04rem; }
.screen-head { gap: 10px; }
.eyebrow { font-size: 0.82rem; }

/* the hero scene */
.hero-fig { position: relative; margin: 0; border-radius: 18px; overflow: hidden; background: var(--sc-sky); box-shadow: var(--shadow); }
.hero-fig svg { display: block; width: 100%; height: auto; }
.hero-fig figcaption { padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); font-size: 0.98rem; color: var(--ink-2); }

/* the three big words, shown as a strip on the start screen */
.words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 820px; border-radius: 14px; overflow: hidden; }
.word { color: #fff; padding: 18px 16px 14px; display: grid; gap: 2px; align-content: end; min-height: 96px; }
.word b { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: 1.16rem; line-height: 1.15; }
.word span { font-size: 0.92rem; line-height: 1.3; opacity: 0.96; }
.word.w-evap { background: #c6711f; } .word.w-cond { background: #4a7fa6; } .word.w-prec { background: #1f5f8b; }

/* 5E phase chip on each screen head */
.phase { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 4px 12px 4px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.9rem; font-weight: 700; }
.phase i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: #fff; background: var(--accent); }
.phase.p-engage i { background: #c6711f; } .phase.p-explore i { background: #2b7449; } .phase.p-explain i { background: #1565a8; } .phase.p-elaborate i { background: #6c4fa8; } .phase.p-evaluate i { background: #9a3d6b; }

/* field notebook boxes */
.note { display: grid; gap: 6px; max-width: 72ch; }
.note label, .note .field-label { font-weight: 700; line-height: 1.4; }
.note .hint { font-size: 0.96rem; color: var(--ink-2); font-weight: 400; }
.note textarea, .note input[type="text"] {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 1.06rem;
  color: var(--ink); background-color: var(--surface);
}
.note textarea {
  min-height: 6.2em; resize: vertical; line-height: 2rem; padding-top: 6px;
  background-image: repeating-linear-gradient(180deg, transparent 0 calc(2rem - 1px), var(--line) calc(2rem - 1px) 2rem);
  background-attachment: local; background-position: 0 6px;
}
.note textarea:focus, .note input[type="text"]:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.notebook { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 20px; max-width: 820px; }
.notebook > h3 { display: flex; align-items: center; gap: 10px; }
.notebook > h3::before {
  content: ""; width: 20px; height: 22px; flex: none; border-radius: 3px 5px 5px 3px; background: var(--accent);
  box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.3);
}
fieldset.note { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.note legend { padding: 0; margin-bottom: 6px; }
.choice-row { display: grid; gap: 8px; }
.choice-row label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; line-height: 1.4; font-weight: 500; }
.choice-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.selfcheck { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.selfcheck label { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; cursor: pointer; font-weight: 500; }
.selfcheck input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--good); flex: none; }
.readback { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 1.02rem; line-height: 1.45; max-width: 72ch; }
.readback:empty { display: none; }
.key-idea p.label { font-size: 0.76rem; font-weight: 600; line-height: 1.3; }

/* try it at home / in class */
.tryit { max-width: 76ch; display: grid; gap: 10px; background: var(--sun-soft); border: 1px solid var(--line); border-left: 6px solid var(--sun); border-radius: 6px 16px 16px 6px; padding: 16px 20px 18px; }
.tryit h3 { font-size: 1.15rem; }
.tryit ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.tryit .small { color: var(--ink-2); }

/* word cards on the explain screen */
.wordcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.wordcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; display: grid; gap: 6px; border-top: 6px solid var(--accent); }
.wordcard b { font-family: var(--font-display); font-weight: 800; font-stretch: 110%; font-size: 1.15rem; }
.wordcard p { font-size: 1rem; line-height: 1.45; }
.wordcard.w-evap { border-top-color: #c6711f; } .wordcard.w-cond { border-top-color: #4a7fa6; } .wordcard.w-prec { border-top-color: #1f5f8b; }
.wordcard.w-run { border-top-color: #2b7449; } .wordcard.w-soak { border-top-color: #7d5a38; } .wordcard.w-sea { border-top-color: #2f7fb9; }

/* cards */
.country-card { max-width: 76ch; display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--ochre-band); border-radius: 6px 16px 16px 6px; padding: 18px 20px; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 76ch; }
.facts li { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: 0; }
.facts b { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding-top: 3px; }

/* charts (dataviz specs: thin marks, hairline grid, text in ink tokens) */
.rain-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.96rem; color: var(--ink-2); }
.rain-key span { display: inline-flex; align-items: center; gap: 8px; }
.rain-key i { display: inline-block; width: 18px; height: 12px; border-radius: 3px; }
.rain-key i.s1 { background: var(--viz-1); } .rain-key i.s2 { background: var(--viz-2); }
.rain-key i.k-wet { background: var(--accent-soft); border: 1px solid var(--viz-1); }
.rain-plot { position: relative; background: var(--viz-surface); border-radius: 10px; }
.tw-svg { display: block; max-width: none; overflow: visible; }
.tw-svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.rc-grid { stroke: var(--viz-grid); stroke-width: 1; }
.rc-axis { stroke: var(--viz-axis); stroke-width: 1; }
.rc-tick, .rc-month { font-family: var(--font-mono); font-size: 12px; fill: var(--viz-muted); font-variant-numeric: tabular-nums; }
.rc-value { font-family: var(--font-body); font-weight: 700; font-size: 13px; fill: var(--ink); }
.tw-bar.s1 { fill: var(--viz-1); } .tw-bar.s2 { fill: var(--viz-2); }
.tw-wet { fill: var(--accent-soft); opacity: 0.7; }
.tw-col.is-active .rc-month { fill: var(--ink); font-weight: 700; }
.tw-col.is-active .tw-hl { opacity: 0.08; }
.tw-hl { fill: var(--ink); opacity: 0; }
.rc-hit { fill: transparent; cursor: pointer; }
.rc-tip {
  position: absolute; z-index: 5; pointer-events: none; display: grid; gap: 1px; min-width: 130px; max-width: 240px;
  padding: 8px 10px; border-radius: 8px; background: var(--pop-bg); color: var(--pop-ink); font-size: 0.9rem; line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.rc-tip b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.tip-row { padding-left: 20px; position: relative; font-variant-numeric: tabular-nums; }
.tip-row::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 14px; height: 8px; border-radius: 2px; background: var(--viz-1); }
.tip-row.s2::before { background: var(--viz-2); }
.rain-src { font-size: 0.9rem; color: var(--ink-2); }
.rain-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Water cycle labs: scenes and interactives ---------- */
.stage { position: relative; border-radius: 12px; overflow: hidden; background: var(--sc-sky); }
.stage svg { display: block; width: 100%; height: auto; }
.picker { display: grid; gap: 6px; }
.bl-hint { min-height: 1.5em; font-weight: 600; color: var(--ink); }
.btn-goggles[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: #1a2124; }

/* scene colour tokens */
.g-sky-fill { fill: var(--sc-sky); }
.g-sky-a { stop-color: var(--sc-sky-2); } .g-sky-b { stop-color: var(--sc-sky); }
.g-sea-a { stop-color: var(--sc-sea); } .g-sea-b { stop-color: var(--sc-sea-2); }
.g-glow-a { stop-color: var(--sun); stop-opacity: 0.35; } .g-glow-b { stop-color: var(--sun); stop-opacity: 0; }
.sc-sun { fill: var(--sun); }
.sc-rays path { fill: var(--sun); opacity: 0.75; }
.sc-rays { animation: sc-spin 60s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
.sc-bird { fill: none; stroke: var(--sc-ink); stroke-width: 2; opacity: 0.55; }
.sc-far { fill: var(--sc-rock); opacity: 0.45; }
.sc-mount { fill: var(--sc-rock); }
.sc-mount-shade { fill: var(--sc-ink); opacity: 0.12; }
.sc-snow { fill: var(--sc-snow); }
.sc-stream { fill: none; stroke: var(--drop); stroke-width: 3; stroke-linecap: round; opacity: 0.9; }
.sc-hill-2 { fill: var(--sc-grass-2); }
.sc-plain { fill: var(--sc-grass); }
.sc-sand { fill: var(--sc-sand); }
.sc-soil { fill: var(--sc-soil); }
.sc-subsoil { fill: var(--sc-soil-2); }
.sc-gw { fill: var(--sc-sea-2); opacity: 0.55; }
.sc-gw-dots circle { fill: var(--sc-sky); opacity: 0.8; }
.sc-bedrock { fill: var(--sc-rock); }
.sc-note { font-family: var(--font-mono); font-size: 13px; fill: #fff; letter-spacing: 0.04em; opacity: 0.85; }
.sc-wave { fill: none; stroke: #fff; stroke-width: 2; opacity: 0.35; }
.sc-waves { animation: sc-waves 5s linear infinite; }
@keyframes sc-waves { to { transform: translateX(60px); } }
.sc-lake { fill: var(--sc-sea); }
.sc-river { fill: none; stroke: var(--sc-sea); stroke-width: 12; stroke-linecap: round; }
.sc-river-hl { fill: none; stroke: #fff; stroke-width: 2; opacity: 0.3; stroke-dasharray: 14 22; animation: sc-flow 3s linear infinite; }
@keyframes sc-flow { to { stroke-dashoffset: -36; } }
.sc-wall { fill: var(--sc-house); }
.sc-roof { fill: var(--sc-roof); } .sc-roof-2 { fill: #8a6d4a; }
.sc-door { fill: var(--sc-trunk); } .sc-window { fill: var(--sc-sky-2); }
.sc-trunk { stroke: var(--sc-trunk); stroke-width: 6; stroke-linecap: round; fill: none; }
.sc-leaf { fill: var(--sc-grass-2); }
.sc-tank rect, .sc-tank path { fill: #7f8b93; }
.sc-pipe { fill: none; stroke: #5d676e; stroke-width: 3; }
.sc-cloud ellipse { fill: var(--sc-cloud); }
.sc-cloud-grey ellipse { fill: var(--sc-cloud-2); }
.sc-cloud-form ellipse { opacity: 0.85; }
.sc-cloud-form { animation: sc-drift 14s ease-in-out infinite alternate; }
.sc-cloud-grey { }
@keyframes sc-drift { to { transform: translate(30px, 0); } }
.sc-rain-in line { stroke: var(--drop); stroke-width: 2.5; stroke-linecap: round; opacity: 0.8; }
.sc-rain-in { animation: sc-rain 0.9s linear infinite; }
@keyframes sc-rain { from { transform: translateY(0); opacity: 1; } to { transform: translateY(40px); opacity: 0.2; } }
.vapour circle { fill: var(--vap); }
.sc-drop-path { fill: none; stroke: none; }
.sc-drop path { fill: var(--drop); stroke: #fff; stroke-width: 2; }
.sc-drop-hl { fill: #fff; opacity: 0.8; }
.sc-drop.is-hidden { display: none; }

/* the puddle */
.pd-wall { fill: var(--sc-house); } .pd-roof { fill: var(--sc-roof); }
.pd-window { fill: var(--sc-sky-2); stroke: #fff; stroke-width: 3; }
.pd-fence rect { fill: #b9a98f; }
.pd-asphalt { fill: var(--sc-asphalt); } .pd-kerb { stroke: var(--sc-asphalt-2); stroke-width: 4; }
.pd-shadow { fill: var(--sc-ink); }
.pd-damp { fill: var(--sc-asphalt-2); }
.pd-pool { fill: var(--sc-sea); opacity: 0.9; }
.pd-gloss { fill: #fff; opacity: 0.6; }
.pd-leaves path { fill: var(--sc-grass-2); animation: pd-leaf 2.4s ease-in-out infinite alternate; }
@keyframes pd-leaf { to { transform: translate(40px, 10px); } }
.pd-wind path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: 0.7; stroke-dasharray: 60 30; animation: sc-flow 1.6s linear infinite; }
.pd-clouds .sc-cloud ellipse { fill: var(--sc-cloud-2); }

/* the cold glass */
.gl-wall { fill: var(--surface-2); }
.gl-frame { fill: var(--sc-house); } .gl-bars { stroke: var(--sc-house); stroke-width: 6; fill: none; }
.gl-label { font-family: var(--font-mono); font-size: 13px; fill: var(--ink-2); letter-spacing: 0.04em; }
.gl-therm { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.gl-therm-fill { fill: var(--bad); }
.gl-table { fill: var(--sc-trunk); } .gl-table-edge { fill: var(--sc-soil); } .gl-floor { fill: var(--surface); }
.gl-ring { fill: var(--sc-sea); opacity: 0; }
.gl-glass { fill: var(--sc-glass); stroke: rgba(255, 255, 255, 0.85); stroke-width: 3; }
.gl-shine { stroke: #fff; stroke-width: 4; opacity: 0.55; stroke-linecap: round; }
.gl-liquid { fill: var(--sc-sea); opacity: 0.85; } .gl-liquid-red { fill: #c8313a; opacity: 0.9; }
.gl-ice rect { fill: #e8f6ff; opacity: 0.9; stroke: #fff; stroke-width: 1.5; }
.gl-can { fill: #4a5a66; } .gl-can-top { fill: #9aa7b0; } .gl-can-label { fill: #d8e2e8; } .gl-can-text { font-family: var(--font-mono); font-size: 11px; font-weight: 700; fill: #2a3a44; letter-spacing: 0.1em; }
.gl-drops circle { fill: #dff3ff; stroke: #fff; stroke-width: 0.8; }
.gl-runs path { fill: none; stroke: #dff3ff; stroke-width: 2.5; stroke-linecap: round; }
.gl-rain line { stroke: var(--drop); }

/* the bag */
.bg-night { fill: #0b1830; } .bg-moon { fill: #f3f0d8; } .bg-stars circle { fill: #fff; }
.bg-shade { fill: #1a2124; }
.bg-bag { fill: rgba(255, 255, 255, 0.35); stroke: rgba(255, 255, 255, 0.9); stroke-width: 3; }
.bg-zip { fill: rgba(255, 255, 255, 0.7); } .bg-zip-line { stroke: #8da0ad; stroke-width: 2; stroke-dasharray: 6 4; }
.bg-pool { fill: var(--sc-sea); opacity: 0.85; }
.bg-mist { fill: #fff; }
.bg-drops circle { fill: #e9f6ff; stroke: #fff; stroke-width: 0.8; }
.bg-runs path { fill: none; stroke: #e9f6ff; stroke-width: 2.5; stroke-linecap: round; }
.bg-marker path, .bg-marker circle { fill: none; stroke: #2b2b2b; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.bg-marker .bg-marker-blue { stroke: #1f5f8b; }
.bg-tape { fill: #f0e6b8; opacity: 0.9; }

/* label the cycle */
.cy-arrowhead { fill: #fff; }
.cy-arrow { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.cy-badge { cursor: pointer; }
.cy-badge circle { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.cy-badge text { font-family: var(--font-mono); font-size: 20px; font-weight: 700; fill: #1a2124; pointer-events: none; }
.cy-badge.is-target circle { stroke: var(--sun); stroke-width: 5; animation: cy-pulse 1s ease-in-out infinite alternate; }
@keyframes cy-pulse { to { r: 26; } }
.cy-badge.is-filled circle { fill: var(--accent); } .cy-badge.is-filled text { fill: #fff; }
.cy-badge.is-right circle { fill: var(--good); stroke: var(--good); } .cy-badge.is-right text { fill: #fff; }
.cy-badge.is-wrong circle { fill: var(--bad); stroke: var(--bad); } .cy-badge.is-wrong text { fill: #fff; }
.cy-tag rect { fill: #1a2124; opacity: 0.85; } .cy-tag text { font-family: var(--font-body); font-weight: 700; font-size: 16px; fill: #fff; }
.cy-slots { display: none; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cy-slot { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 6px; min-height: 48px; padding: 6px 8px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); text-align: left; font-size: 0.92rem; line-height: 1.2; cursor: pointer; }
.cy-slot b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--accent); font-family: var(--font-mono); font-size: 0.85rem; }
.cy-slot.is-filled b { background: var(--accent); color: #fff; }
.cy-slot.is-target { border-color: var(--sun); box-shadow: 0 0 0 2px var(--sun-soft); }
.cy-slot.is-right { border-color: var(--good); background: var(--good-soft); } .cy-slot.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.cy-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.cy-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px 8px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.04rem; font-weight: 700; cursor: pointer; }
.cy-chip-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); }
.cy-chip.is-placed { border-color: var(--accent); } .cy-chip.is-placed .cy-chip-n { background: var(--accent); color: #fff; }
.cy-chip.is-selected { background: var(--sun); border-color: var(--sun); color: #1a2124; }
.cy-chip.is-selected .cy-chip-n { background: #1a2124; color: #fff; }
.cy-list { display: none; }
.cy-empty { color: var(--ink-2); font-weight: 400; }

/* towns */
.tw-layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.tw-mapbox { position: relative; border-radius: 12px; overflow: hidden; background: var(--sc-sky); }
.tw-mapbox svg { display: block; width: 100%; height: auto; }
.tw-land { fill: var(--sc-sand); stroke: var(--sc-soil); stroke-width: 1.2; stroke-linejoin: round; }
.tw-dot { cursor: pointer; }
.tw-dot-hit { fill: transparent; }
.tw-dot-mark { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.tw-dot.is-active .tw-dot-mark { fill: var(--sun); r: 8; }
.tw-dot-name { font-family: var(--font-body); font-weight: 700; font-size: 13px; fill: var(--sc-ink); paint-order: stroke; stroke: var(--sc-sky); stroke-width: 3px; }
.tw-dot.is-active .tw-dot-name { font-size: 14px; }
.tw-side { display: grid; gap: 8px; align-content: start; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tw-chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.96rem; font-weight: 650; cursor: pointer; }
.tw-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* the desert river */
.jy-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.jy-mapbox { position: relative; border-radius: 12px; overflow: hidden; background: var(--sc-sand); }
.jy-mapbox svg { display: block; width: 100%; height: auto; }
.jy-land { fill: var(--sc-sand); }
.jy-dune { fill: none; stroke: var(--sc-soil); stroke-width: 1.2; opacity: 0.25; }
.jy-border { fill: none; stroke: var(--sc-soil-2); stroke-width: 1.5; stroke-dasharray: 8 6; opacity: 0.8; }
.jy-state { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.14em; fill: var(--sc-soil-2); opacity: 0.8; }
.jy-chan path { fill: none; stroke: var(--sc-sea); stroke-width: 3; opacity: 0.55; stroke-linecap: round; }
.jy-bed { fill: none; stroke: var(--sc-soil-2); stroke-width: 3; stroke-dasharray: 6 8; opacity: 0.6; stroke-linecap: round; }
.jy-flow { fill: none; stroke: var(--sc-sea); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset 1.2s ease; }
.jy-front { fill: #fff; stroke: var(--sc-sea); stroke-width: 3; }
.jy-salt { fill: var(--sc-snow); stroke: var(--sc-soil); stroke-width: 1.5; }
.jy-water { fill: var(--sc-sea); }
.jy-deep ellipse { fill: var(--sc-sea-2); }
.jy-lake-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; fill: var(--sc-ink); paint-order: stroke; stroke: var(--sc-snow); stroke-width: 4px; }
.jy-river-name { font-family: var(--font-body); font-style: italic; font-size: 13px; fill: var(--sc-sea-2); }
.jy-town { fill: var(--sc-ink); } .jy-town-name { font-family: var(--font-body); font-size: 13px; font-weight: 600; fill: var(--sc-ink); paint-order: stroke; stroke: var(--sc-sand); stroke-width: 3px; }
.jy-rain { transition: opacity 0.6s; }
.jy-birds { fill: none; stroke: var(--sc-ink); stroke-width: 2; }
.jy-inset-bg { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.jy-inset-box { fill: var(--sun); opacity: 0.35; stroke: var(--sun); stroke-width: 4; }
.jy-panel { display: grid; gap: 10px; align-content: start; }
.jy-when { font-family: var(--font-mono); font-size: 0.86rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.jy-head { font-family: var(--font-display); font-weight: 800; font-stretch: 110%; font-size: 1.5rem; line-height: 1.15; }
.jy-text { font-size: 1.08rem; line-height: 1.55; }
.jy-days { font-family: var(--font-mono); font-size: 0.86rem; color: var(--ink-2); }
.jy-steps { display: flex; gap: 8px; flex-wrap: wrap; }

/* where your water comes from */
.sr-layout { display: grid; gap: 16px; }
.sr-town { font-family: var(--font-display); font-weight: 800; font-stretch: 110%; font-size: 1.5rem; }
.sr-trail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.sr-step { display: grid; gap: 8px; align-content: start; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 14px; position: relative; }
.sr-step svg { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--sc-sky); }
.sr-step b { font-size: 1.02rem; }
.sr-step p { font-size: 0.96rem; line-height: 1.45; color: var(--ink-2); }
.sr-step .label { color: var(--accent); }
.sr-bars { display: grid; gap: 8px; }
.sr-bar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: 1rem; }
.sr-bar i { display: block; height: 16px; border-radius: 8px; background: var(--accent); }
.sr-bar i.is-gw { background: var(--sc-soil); } .sr-bar i.is-desal { background: var(--sc-sea-2); } .sr-bar i.is-river { background: var(--sc-grass-2); } .sr-bar i.is-tank { background: var(--sun); }
.sr-bar span:last-child { font-family: var(--font-mono); font-size: 0.9rem; text-align: right; }
.sr-icons { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sr-icon { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 12px 8px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); font-size: 0.96rem; font-weight: 600; line-height: 1.3; }
.sr-icon svg { width: 72px; height: 72px; }
.sr-icon[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.sr-icon.is-right { border-color: var(--good); background: var(--good-soft); } .sr-icon.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.seasons { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 18px; align-items: center; }
.seasons svg { width: 100%; height: auto; display: block; }
.sn-seg { cursor: pointer; }
.sn-seg path { stroke: var(--surface); stroke-width: 3; }
.sn-seg.is-active path { stroke: var(--ink); stroke-width: 4; }
.sn-seg text { stroke: none; }
.sn-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; fill: #fff; pointer-events: none; }
.sn-months { font-family: var(--font-mono); font-size: 11px; fill: #fff; opacity: 0.95; pointer-events: none; }
.sn-center { font-family: var(--font-body); font-weight: 700; font-size: 14px; fill: var(--ink); }
.sn-list { display: grid; gap: 6px; }
.sn-item { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1.5px solid transparent; text-align: left; color: var(--ink); cursor: pointer; font-size: 1rem; line-height: 1.4; }
.sn-item i { width: 14px; height: 14px; border-radius: 4px; margin-top: 5px; }
.sn-item.is-active { border-color: var(--ink); }
.sn-item b { font-weight: 800; }

.only-narrow { display: none; }
/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .jy-layout { grid-template-columns: minmax(0, 1fr); }
  .seasons { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tw-layout { grid-template-columns: minmax(0, 1fr); }
  .tw-mapbox { max-width: 360px; }
  .sr-trail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .words { grid-template-columns: minmax(0, 1fr); }
  .word { min-height: 0; padding: 12px 16px; }
}
@media (max-width: 600px) {
  .cy-slots { display: grid; }
  .cy-stage { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .only-narrow { display: block; }
  .cy-stage svg { min-width: 760px; }
  .cy-badge { transform: scale(1.35); transform-box: fill-box; transform-origin: center; }
  .cy-tag { display: none; }
  .sr-bar { grid-template-columns: minmax(0, 1fr) 54px; }
  .sr-bar span:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .sr-trail { grid-template-columns: minmax(0, 1fr); }
  .jy-head { font-size: 1.3rem; }
}
@media print {
  .site-head, .screen-nav, .tools, .btn, .rail-nav, .site-foot { display: none !important; }
  .screen { display: block !important; page-break-after: always; }
}
