/* Spraoi — one bright, single-theme world. Layout idea: big tappable tiles on a calm sky ground, one task per screen. */
:root {
  --ink: #1d2242;          /* text, outlines */
  --sky: #eef3ff;          /* page ground */
  --paper: #ffffff;        /* cards */
  --maths: #ff6b4a;        /* coral: Maths */
  --english: #0fa99b;      /* teal: English */
  --sun: #ffc533;          /* stars, highlights */
  --violet: #6b5be6;       /* links, focus, primary action */
  --muted: #5b6185;
  --line: #d5dcf2;
  --good: #1f9d55;
  --good-bg: #e3f6ea;
  --try: #b45309;
  --try-bg: #fff3dc;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Lexend", "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
  --radius: 18px;
  --shadow: 0 4px 0 rgba(29, 34, 66, 0.12);
  --text-scale: 1;
  color-scheme: light;
}
html.big-text { --text-scale: 1.18; }
html.calm { --maths: #d9826e; --english: #4f9e96; --sun: #e9c46a; --violet: #5a5fa8; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: calc(18px * var(--text-scale));
  line-height: 1.55;
  letter-spacing: 0.01em;
}
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0 0 0.4em; }
h1 { font-size: calc(2.4rem * var(--text-scale)); letter-spacing: -0.02em; }
h2 { font-size: calc(1.6rem * var(--text-scale)); }
h3 { font-size: calc(1.2rem * var(--text-scale)); }
p { margin: 0 0 0.8em; max-width: 62ch; }
a { color: var(--violet); }
:focus-visible { outline: 4px solid var(--violet); outline-offset: 3px; border-radius: 10px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { background: var(--paper); border-bottom: 3px solid var(--line); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; }
.logo svg { width: 44px; height: 44px; }
.logo small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; }
.nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav button {
  font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--ink); text-decoration: none;
  padding: 10px 14px; border-radius: 12px; border: 0; background: transparent; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--sky); }
.nav a[aria-current="page"] { background: var(--sky); color: var(--violet); }

/* Settings panel */
.settings { background: var(--paper); border-bottom: 3px solid var(--line); }
.settings[hidden] { display: none; }
.settings .wrap { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 14px; padding-bottom: 14px; align-items: center; }
.toggle { display: flex; align-items: center; gap: 10px; background: var(--sky); padding: 10px 14px; border-radius: 12px; cursor: pointer; font-size: 0.95rem; }
.toggle input { width: 22px; height: 22px; accent-color: var(--violet); }

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 24px 0 8px; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 1.05rem; text-decoration: none;
  padding: 14px 24px; min-height: 56px; border-radius: 16px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--violet); color: #fff; border-color: var(--violet); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 0.95rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.speak { border-radius: 999px; min-width: 56px; padding: 10px 16px; }
.speak svg { width: 22px; height: 22px; }

/* Hero */
.hero { padding: 40px 0 24px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--muted); }
.hero .badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.hero .badges li { background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; font-weight: 600; }
.mascot { width: 100%; max-width: 340px; justify-self: center; }

section { margin: 36px 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Class picker */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.class-btn {
  font: inherit; font-weight: 700; padding: 18px 12px; border-radius: var(--radius);
  border: 3px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; text-align: center;
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.class-btn.active { border-color: var(--ink); box-shadow: var(--shadow); }
.class-btn.active:hover { transform: translateY(-2px); }
.class-btn[aria-disabled="true"] { color: var(--muted); cursor: default; background: transparent; border-style: dashed; }
.class-btn .num { font-family: var(--font-display); font-size: 1.5rem; }
.class-btn .tag { font-size: 0.75rem; font-weight: 600; }

/* Subject buttons */
.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.subject {
  display: flex; align-items: center; gap: 20px; padding: 28px; border-radius: 24px; text-decoration: none;
  color: #fff; border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); min-height: 150px;
  transition: transform 0.12s ease;
}
.subject:hover { transform: translateY(-3px); }
.subject.maths { background: var(--maths); }
.subject.english { background: var(--english); }
.subject .big { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; line-height: 1; }
.subject .sub { font-size: 1rem; opacity: 0.95; margin-top: 6px; }
.subject svg { width: 84px; height: 84px; flex: none; }

/* Game cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); position: relative;
}
.card.ready { border-color: var(--ink); box-shadow: var(--shadow); }
.card.ready:hover { transform: translateY(-2px); }
.card .stripe { height: 8px; border-radius: 6px; background: var(--maths); }
.card.english .stripe { background: var(--english); }
.card h3 { margin: 4px 0 0; }
.card .meta { font-size: 0.85rem; color: var(--muted); }
.card .pill { align-self: flex-start; font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--sky); }
.card.ready .pill { background: var(--good-bg); color: var(--good); }
.card.soon { opacity: 0.8; border-style: dashed; }
.card .stars-mini { color: var(--sun); font-size: 1.1rem; letter-spacing: 2px; }

/* Strand / topic lists */
.strand { background: var(--paper); border-radius: 24px; border: 3px solid var(--line); padding: 22px; }
.strand + .strand { margin-top: 16px; }
.strand h2 { display: flex; align-items: center; gap: 12px; }
.strand h2 .dot { width: 18px; height: 18px; border-radius: 6px; background: var(--maths); }
.english-page .strand h2 .dot { background: var(--english); }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.topic {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px;
  border-radius: 14px; background: var(--sky); text-decoration: none; color: var(--ink); font-weight: 600; min-height: 60px;
}
.topic:hover { outline: 3px solid var(--ink); }
.topic .count { font-size: 0.8rem; font-weight: 700; background: var(--paper); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.topic .count.has { background: var(--good-bg); color: var(--good); }
.curric { font-size: 0.85rem; color: var(--muted); }

/* Parent info */
.parent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info { background: var(--paper); border-radius: var(--radius); padding: 20px; border: 3px solid var(--line); }
.info svg { width: 40px; height: 40px; }
table.progress { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
table.progress th, table.progress td { text-align: left; padding: 12px 14px; border-bottom: 2px solid var(--sky); }
table.progress th { background: var(--ink); color: #fff; font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Footer */
.site-footer { margin-top: 60px; padding: 28px 0 40px; border-top: 3px solid var(--line); background: var(--paper); font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }

/* ===== Game shell ===== */
.game { background: var(--paper); border: 3px solid var(--ink); border-radius: 28px; padding: 24px; margin-top: 12px; box-shadow: 0 6px 0 var(--ink); }
.game-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.game-top h1 { font-size: calc(2rem * var(--text-scale)); margin: 0; }
.level-tag { font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--sun); }
.learn-box { display: flex; gap: 16px; align-items: flex-start; background: var(--sky); border-radius: 18px; padding: 16px 18px; margin: 16px 0; }
.learn-box .label { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.teach { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.teach .t { border: 3px solid var(--line); border-radius: 16px; padding: 14px; }
.teach .t strong { font-family: var(--font-display); font-size: 1.2rem; display: block; }
.teach .t em { display: block; color: var(--muted); font-style: normal; font-size: 0.9rem; margin-top: 4px; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.level-btn {
  font: inherit; text-align: left; padding: 18px; border-radius: 18px; border: 3px solid var(--ink); background: var(--paper);
  cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.level-btn:hover { transform: translateY(-2px); }
.level-btn .n { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; }
.level-btn .d { font-size: 0.85rem; color: var(--muted); }
.level-btn .s { color: var(--sun); font-size: 1.3rem; letter-spacing: 3px; }
.level-btn .s .off { color: var(--line); }

/* Example demo */
.demo { border: 3px dashed var(--line); border-radius: 18px; padding: 16px; margin: 8px 0 20px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.demo .arrow { font-size: 2rem; color: var(--muted); }
.demo .why { grid-column: 1 / -1; margin: 0; color: var(--muted); }

/* Sort It */
.progress-bar { height: 14px; background: var(--sky); border-radius: 999px; overflow: hidden; margin: 14px 0; }
.progress-bar span { display: block; height: 100%; background: var(--good); width: 0; transition: width 0.3s ease; }
.tray { display: flex; flex-wrap: wrap; gap: 12px; min-height: 84px; padding: 14px; border-radius: 18px; background: var(--sky); margin-bottom: 16px; justify-content: center; }
.tile {
  font: inherit; font-weight: 600; font-size: 1.05rem; padding: 14px 18px; border-radius: 14px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink); cursor: grab; box-shadow: var(--shadow); touch-action: none; user-select: none;
  max-width: 320px; text-align: left; line-height: 1.35;
}
.tile b { background: var(--sun); padding: 0 4px; border-radius: 4px; }
.tile.selected { outline: 4px solid var(--violet); outline-offset: 2px; transform: translateY(-3px); }
.tile.dragging { opacity: 0.35; }
.tile.ghost { position: fixed; pointer-events: none; z-index: 100; opacity: 0.95; transform: rotate(-2deg) scale(1.04); cursor: grabbing; }
.tile.placed { cursor: default; box-shadow: none; border-color: var(--good); background: var(--good-bg); font-size: 0.9rem; padding: 8px 12px; }
.tile.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.bin {
  font: inherit; display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-height: 160px; padding: 12px;
  border-radius: 18px; border: 3px solid var(--ink); background: var(--paper); cursor: pointer; text-align: left;
}
.bin .bin-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; text-align: center; padding: 8px; border-radius: 12px; background: var(--sky); }
.bin.hover, .bin.ready-target { background: #f4f1ff; border-color: var(--violet); }
.bin .placed-list { display: flex; flex-wrap: wrap; gap: 6px; }
.feedback { min-height: 64px; margin: 16px 0 0; padding: 14px 18px; border-radius: 16px; font-weight: 600; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.feedback:empty { padding: 0; min-height: 64px; }
.feedback.good { background: var(--good-bg); color: var(--good); }
.feedback.try { background: var(--try-bg); color: var(--try); }
.feedback.explain { background: var(--sky); color: var(--ink); }

/* Results */
.results { text-align: center; padding: 20px 0; }
.big-stars { font-size: 4rem; letter-spacing: 8px; color: var(--sun); line-height: 1; margin: 10px 0; }
.big-stars .off { color: var(--line); }
.results .score { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.results .btn-row { justify-content: center; margin-top: 18px; }

@media (max-width: 760px) {
  h1 { font-size: calc(1.9rem * var(--text-scale)); }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .mascot { max-width: 220px; order: -1; }
  .subjects, .parent-grid, .levels { grid-template-columns: 1fr; }
  .subject { min-height: 110px; padding: 20px; }
  .subject .big { font-size: 2rem; }
  .subject svg { width: 60px; height: 60px; }
  .demo { grid-template-columns: 1fr; }
  .demo .arrow { transform: rotate(90deg); justify-self: center; }
  .game { padding: 16px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
html.no-motion *, html.no-motion *::before, html.no-motion *::after { animation: none !important; transition: none !important; }

/* ===== Place-value colours (same everywhere on the site) ===== */
:root { --pv-th: #6b5be6; --pv-h: #2f7fd8; --pv-t: #0fa99b; --pv-u: #e8590c; }

/* ===== Maths helpers ===== */
.helpers { border: 3px solid var(--violet); border-radius: 20px; padding: 16px; margin: 16px 0; background: #f7f5ff; }
.helpers[hidden] { display: none; }
.helpers-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.helper-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.helper-tabs button { font: inherit; font-size: 0.9rem; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.helper-tabs button[aria-selected="true"] { background: var(--violet); color: #fff; border-color: var(--violet); }
.helper-btn { border-color: var(--violet); color: var(--violet); }
.helper-label { font-weight: 600; margin: 0 0 8px; }
#pv-input { font: inherit; font-size: 1.4rem; font-weight: 700; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; width: 9ch; margin-bottom: 12px; letter-spacing: 0.08em; }
.pv-chart { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pv-col { display: flex; flex-direction: column; align-items: center; min-width: 64px; border-radius: 12px; overflow: hidden; border: 3px solid var(--ink); background: var(--paper); }
.pv-head { width: 100%; text-align: center; color: #fff; font-weight: 700; padding: 4px; background: var(--muted); }
.pv-digit { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.pv-th .pv-head { background: var(--pv-th); } .pv-th .pv-digit { color: var(--pv-th); }
.pv-h .pv-head { background: var(--pv-h); } .pv-h .pv-digit { color: var(--pv-h); }
.pv-t .pv-head { background: var(--pv-t); } .pv-t .pv-digit { color: var(--pv-t); }
.pv-u .pv-head { background: var(--pv-u); } .pv-u .pv-digit { color: var(--pv-u); }
.pv-dot { min-width: 24px; border: 0; background: transparent; } .pv-dot .pv-head { background: transparent; color: transparent; }
.pv-words { font-weight: 600; font-size: 1.1rem; }
.hundred { display: grid; grid-template-columns: repeat(10, minmax(28px, 1fr)); gap: 3px; max-width: 520px; margin-bottom: 10px; }
.hs { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 0; border: 2px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.hs[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); }
.tgrid { display: grid; grid-template-columns: repeat(11, minmax(26px, 1fr)); gap: 3px; max-width: 560px; }
.tg { font: inherit; font-size: 0.8rem; text-align: center; padding: 6px 0; border-radius: 6px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.tg.head { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; cursor: default; }
.tg.lit { background: #e7e3ff; } .tg.hit { background: var(--sun); border-color: var(--ink); font-weight: 800; }
.fwall { display: flex; flex-direction: column; gap: 4px; max-width: 620px; }
.frow { display: flex; gap: 4px; }
.fcell { flex: 1; font: inherit; font-size: 0.75rem; font-weight: 700; padding: 8px 0; border-radius: 6px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; min-width: 0; overflow: hidden; }
.fcell.on { background: var(--maths); color: #fff; }
.fcell.d1 { background: var(--ink); color: #fff; }
.mini-line { display: flex; gap: 4px; min-width: 640px; }
.ml { flex: 1; font: inherit; font-weight: 700; padding: 10px 0; border: 0; border-bottom: 4px solid var(--ink); background: transparent; cursor: pointer; color: var(--ink); }
.ml.on { background: var(--sun); border-radius: 8px 8px 0 0; }

/* ===== Number Line template ===== */
.nl-prompt { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 4px; font-weight: 600; }
.nl-target { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; padding: 8px 26px; border-radius: 18px; border: 3px solid var(--ink); background: var(--sun); color: var(--ink); cursor: pointer; line-height: 1.1; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; }
.frac span:first-child { border-bottom: 4px solid currentColor; padding: 0 6px 4px; }
.frac span:last-child { padding-top: 4px; }
.nl-wrap { touch-action: none; cursor: pointer; border-radius: 16px; background: var(--sky); padding: 4px 0; margin: 10px 0; }
.nl-svg { width: 100%; height: auto; display: block; }
.nl-axis { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.nl-tick { stroke: var(--ink); stroke-width: 3; }
.nl-tick.major { stroke-width: 5; }
.nl-lab { font-family: var(--font-body); font-size: 26px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.nl-lab.soft { fill: var(--muted); font-weight: 400; font-size: 20px; }
.nl-pointer path { fill: var(--violet); }
.nl-pointer line { stroke: var(--violet); stroke-width: 5; }
.nl-flag line { stroke-width: 3; stroke-dasharray: 4 4; }
.nl-flag text { font-family: var(--font-body); font-size: 22px; font-weight: 700; text-anchor: middle; }
.nl-flag.ok line { stroke: var(--good); } .nl-flag.ok text { fill: var(--good); }
.nl-flag.help line { stroke: var(--try); } .nl-flag.help text { fill: var(--try); }
.nl-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.nl-controls .btn.small { min-width: 64px; font-size: 1.1rem; }
.nl-ex { min-width: 0; }
html.maths-friendly .nl-lab { font-size: 30px; }
html.maths-friendly .pv-digit { letter-spacing: 0.06em; }
@media (max-width: 760px) {
  .nl-axis { stroke-width: 12; }
  .nl-tick { stroke-width: 6; } .nl-tick.major { stroke-width: 9; }
  .nl-lab { font-size: 58px; transform: translateY(20px); } .nl-lab.soft { font-size: 44px; }
  .nl-svg { overflow: visible; } .nl-wrap { padding: 22px 0 18px; }
  .nl-flag text { font-size: 48px; }
  .nl-pointer path, .nl-pointer line { transform: scaleX(2.2); }
  .nl-pointer line { stroke-width: 5; }
  .nl-target { font-size: 2.1rem; }
}
@media (max-width: 760px) {
  .site-header { position: static; }
  .site-header .wrap { min-height: 60px; gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .nav { margin-left: 0; gap: 2px; }
  .nav a, .nav button { padding: 8px 10px; font-size: 0.9rem; }
}
