/* Spell Bee — website styles.
 * Desktop/tablet-first: wide multi-column layouts, generous type, real page
 * chrome. It scales down to a phone, but it is not designed as a phone app. */

/* ── Themes ───────────────────────────────────────────────────────────────
 * Four worlds. The theme follows the page, not a switch:
 *   bee    — the landing page: honey and cream, the Spell Bee badge
 *   safari — Grade 1: green jungle, gold and leaf (Spell Safari artwork)
 *   galaxy — Grade 2: deep space, the same gold, starlight (Word Galaxy art)
 *   garden — Grade 3: a rainbow garden, sky and flowers
 * All four share the logos' gold, which is what ties the site together.
 * Every component reads these variables, so a theme restyles the whole page —
 * including the dark one — without any theme-specific component CSS. */
:root,
[data-theme="bee"] {
  --honey: #f2b40b;
  --amber: #e07b06;
  --ink: #3a2e5c;
  --leaf: #2fbf71;
  --berry: #e5484d;
  --sky: #2f9fc7;
  --cream: #fff9ec;
  --card: #ffffff;
  --page-1: #ffeec2;
  --page-2: #fff9ec;
  --hero-1: #ffe6ad;
  --hero-2: #fff9ec;
  --header-bg: color-mix(in srgb, var(--cream) 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 12%, transparent);
  --on-honey: #3a2e5c;   /* dark text on gold reads far better than white */
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #fff9ec;
  --overlay: rgba(40, 30, 62, .48);
  --footer-bg: #3a2e5c;
  --logo: url('../assets/logo.png');
  --logo-sm: url('../assets/logo.png');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 14%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 10%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}

/* Grade 1 — a proper green jungle, to match the Spell Safari artwork. */
[data-theme="safari"] {
  --honey: #eda60c;
  --amber: #d2760a;
  --ink: #17331b;              /* deep leaf-green ink */
  --leaf: #3f8f2b;
  --berry: #d8452c;
  --sky: #1f8fb5;
  --cream: #e9f6dc;            /* the page: soft jungle light */
  --card: #f9fdf4;
  --page-1: #c9e7ac;
  --page-2: #e9f6dc;
  --hero-1: #b9e096;
  --hero-2: #e9f6dc;
  --header-bg: color-mix(in srgb, var(--cream) 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --on-honey: #17331b;
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #e9f6dc;
  --overlay: rgba(16, 40, 20, .5);
  --footer-bg: #17331b;
  --logo: url('../assets/themes/safari-logo.webp');
  --logo-sm: url('../assets/themes/safari-logo-sm.webp');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 16%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 11%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}

[data-theme="galaxy"] {
  --honey: #fccc24;
  --amber: #fca800;
  --ink: #eef1ff;              /* text is light on this theme */
  --leaf: #3ddc97;
  --berry: #ff6b6b;
  --sky: #55d6ff;
  --cream: #0a0a2b;            /* the page itself */
  --card: #1b1b57;             /* raised surfaces */
  --page-1: #14143f;
  --page-2: #0a0a2b;
  --hero-1: #191952;
  --hero-2: #0a0a2b;
  --header-bg: color-mix(in srgb, #0a0a2b 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --on-honey: #1a1a3f;
  --on-leaf: #06251a;
  --on-sky: #05263a;
  --on-berry: #2e0606;
  --on-ink: #0a0a2b;     /* --ink is light here, so text on it must be dark */
  --overlay: rgba(2, 2, 16, .64);
  --footer-bg: #05051c;
  --logo: url('../assets/themes/galaxy-logo.webp');
  --logo-sm: url('../assets/themes/galaxy-logo-sm.webp');
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .35);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}


/* Grade 3 — the Rainbow Garden. Bright daylight rather than jungle shade: a
 * clear sky overhead, a rainbow behind the page, and flowers along the foot.
 * The ink stays a deep leafy brown-green so long sentences are still restful
 * to read against all that colour. */
[data-theme="garden"] {
  --honey: #ffb703;
  --amber: #f97316;
  --ink: #33324e;
  --leaf: #22b573;
  --berry: #ef4d7a;
  --sky: #2ba6e0;
  --violet: #8e7dff;
  --cream: #f4fbff;            /* the page: a clean, sunny sky-white */
  --card: #ffffff;
  --page-1: #cdeeff;
  --page-2: #f4fbff;
  --hero-1: #b9e7ff;
  --hero-2: #f4fbff;
  --header-bg: color-mix(in srgb, var(--cream) 90%, transparent);
  --line: color-mix(in srgb, var(--ink) 13%, transparent);
  --on-honey: #33324e;
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #f4fbff;
  --overlay: rgba(32, 40, 60, .5);
  --footer-bg: #2f3a52;
  --logo: url('../assets/themes/garden-logo.svg');
  --logo-sm: url('../assets/themes/garden-logo.svg');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 15%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 10%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}


/* Grade 4 — the Enchanted Kingdom. Dusk over a castle: deep violet sky, gold
 * torchlight, and the same honey the rest of the site is tied together with.
 * Light text, so it shares the Galaxy's rule that --ink is the pale colour
 * here and anything sitting *on* --ink has to be dark. */
[data-theme="kingdom"] {
  --honey: #f6c445;
  --amber: #e8912b;
  --ink: #f3ecff;              /* text is light on this theme */
  --leaf: #4ad6a0;
  --berry: #ff6b8b;
  --sky: #7cc4ff;
  --violet: #a678ff;
  --cream: #1a1230;            /* the page itself */
  --card: #2b1f4d;             /* raised surfaces */
  --page-1: #241a42;
  --page-2: #1a1230;
  --hero-1: #2d2057;
  --hero-2: #1a1230;
  --header-bg: color-mix(in srgb, #1a1230 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --on-honey: #2a1c14;
  --on-leaf: #06251a;
  --on-sky: #05263a;
  --on-berry: #33060f;
  --on-ink: #1a1230;     /* --ink is light here, so text on it must be dark */
  --overlay: rgba(10, 5, 24, .66);
  --footer-bg: #130c24;
  --logo: url('../assets/themes/kingdom-logo.webp');
  --logo-sm: url('../assets/themes/kingdom-logo-sm.webp');
  --shadow: 0 10px 34px rgba(0, 0, 0, .5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .38);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}


/* Grade 5 — the Ancient World. Sandstone and papyrus with lapis blue and
 * gold: warm and light, the opposite of Grade 4's dusk, so moving up a grade
 * feels like stepping out of the castle into the sun. Dark text on a pale
 * ground, like the Safari and the Garden. */
[data-theme="ancient"] {
  --honey: #d9a220;
  --amber: #b9741b;
  --ink: #3b2f22;              /* dark sepia ink on papyrus */
  --leaf: #2f8f6f;
  --berry: #c0452f;
  --sky: #2a6fa8;
  --lapis: #1f4e9c;
  --cream: #f6eeda;            /* the page: aged papyrus */
  --card: #fffaf0;
  --page-1: #ead9b6;
  --page-2: #f6eeda;
  --hero-1: #e3cfa6;
  --hero-2: #f6eeda;
  --header-bg: color-mix(in srgb, var(--cream) 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 16%, transparent);
  --on-honey: #3b2f22;
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #f6eeda;
  --overlay: rgba(48, 36, 22, .52);
  --footer-bg: #3b2f22;
  --logo: url('../assets/themes/ancient-logo.webp');
  --logo-sm: url('../assets/themes/ancient-logo-sm.webp');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 18%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 12%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}


/* Grade 6 — the Academic World. Ink and paper under a brass study lamp:
 * warm white, deep ink blue, brass and a reading-room green. The calmest of
 * the six worlds on purpose, because by Grade 6 the questions are doing the
 * work and the page should stay out of the way. */
[data-theme="scholar"] {
  --honey: #c8901f;
  --amber: #a5641a;
  --ink: #1f2a44;              /* deep ink blue */
  --leaf: #2f7d5c;
  --berry: #b33a3a;
  --sky: #2f6fa8;
  --brass: #b98b2e;
  --cream: #f7f4ec;            /* the page: warm paper */
  --card: #ffffff;
  --page-1: #ece5d5;
  --page-2: #f7f4ec;
  --hero-1: #e4dcc8;
  --hero-2: #f7f4ec;
  --header-bg: color-mix(in srgb, var(--cream) 93%, transparent);
  --line: color-mix(in srgb, var(--ink) 15%, transparent);
  --on-honey: #1f2a44;
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #f7f4ec;
  --overlay: rgba(24, 32, 52, .52);
  --footer-bg: #1f2a44;
  --logo: url('../assets/themes/scholar-logo.webp');
  --logo-sm: url('../assets/themes/scholar-logo-sm.webp');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 16%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 11%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}

/* Grade 7 — the Global Word Expedition. A chart spread on a table: map paper,
 * ocean teal, brass from the compass and one warm orange for the route. Dark
 * ink on light, like Grades 5 and 6, because by this level the page is a
 * paper and not a playground. */
[data-theme="expedition"] {
  --honey: #c2861f;
  --amber: #b45f18;
  --ink: #16384a;              /* deep sea ink */
  --leaf: #2f8f6f;
  --berry: #b8453f;
  --sky: #2b7fa8;
  --brass: #b8863b;
  --cream: #f6f1e4;            /* the page: map paper */
  --card: #fffdf7;
  --page-1: #e7ddc7;
  --page-2: #f6f1e4;
  --hero-1: #ded2b6;
  --hero-2: #f6f1e4;
  --header-bg: color-mix(in srgb, var(--cream) 93%, transparent);
  --line: color-mix(in srgb, var(--ink) 15%, transparent);
  --on-honey: #16384a;
  --on-leaf: #ffffff;
  --on-sky: #ffffff;
  --on-berry: #ffffff;
  --on-ink: #f6f1e4;
  --overlay: rgba(14, 40, 54, .52);
  --footer-bg: #16384a;
  --logo: url('../assets/themes/expedition-logo.webp');
  --logo-sm: url('../assets/themes/expedition-logo-sm.webp');
  --shadow: 0 10px 30px color-mix(in srgb, var(--ink) 16%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in srgb, var(--ink) 11%, transparent);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}


/* Grade 8 — the Time Traveler's Word Quest. A lantern in a deep mine: warm
 * gold on wet rock, with the timber and the ore-cart iron behind it. The only
 * world besides Grade 4 with LIGHT text on a dark page, which is why its veil
 * darkens rather than lifting. */
[data-theme="timequest"] {
  --honey: #f0b32e;
  --amber: #e08a1e;
  --ink: #f6ecd8;              /* lantern light on the page */
  --leaf: #5aa87f;
  --berry: #d0624f;
  --sky: #63a8c4;
  --brass: #c79a3f;
  --cream: #241a12;            /* the page: wet rock in shadow */
  --card: #33261a;
  --page-1: #1a120c;
  --page-2: #241a12;
  --hero-1: #2e2116;
  --hero-2: #1a120c;
  --header-bg: color-mix(in srgb, #1a120c 92%, transparent);
  --line: color-mix(in srgb, var(--ink) 18%, transparent);
  --on-honey: #241a12;
  --on-leaf: #16120c;
  --on-sky: #16120c;
  --on-berry: #ffffff;
  --on-ink: #241a12;
  --overlay: rgba(10, 7, 4, .62);
  --footer-bg: #14100a;
  --logo: url('../assets/themes/timequest-logo.webp');
  --logo-sm: url('../assets/themes/timequest-logo-sm.webp');
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .35);
  --radius: 22px;
  --maxw: 1180px;
  --font: 'Fredoka', 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--page-2);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Themed backdrop. Safari gets a warm sky wash with soft canopy blobs;
   Galaxy gets a night sky with a scatter of stars. Both are pure CSS, fixed
   behind the content, and never intercept clicks. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: linear-gradient(170deg, var(--page-1) 0%, var(--page-2) 55%);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .55;
}
/* Bee (landing): soft honey warmth in the corners. */
body::after,
[data-theme="bee"] body::after {
  background:
    radial-gradient(150px 110px at 5% 14%, color-mix(in srgb, #ffc93c 42%, transparent), transparent 70%),
    radial-gradient(170px 120px at 96% 18%, color-mix(in srgb, #ffb703 32%, transparent), transparent 70%),
    radial-gradient(150px 110px at 4% 82%, color-mix(in srgb, #ffd45c 34%, transparent), transparent 70%),
    radial-gradient(190px 130px at 98% 86%, color-mix(in srgb, #ffb703 26%, transparent), transparent 70%);
}

/* Safari (Grade 1): the painted jungle clearing. The artwork frames the page —
 * trees, vines and the animals live in the margins, and the clearing in the
 * middle is where the content sits. The veil on top lifts that middle back
 * towards cream so body text keeps its contrast over the painting; without it
 * the greens are strong enough to fight the ink. */
[data-theme="safari"] body::after {
  opacity: 1;
  background:
    radial-gradient(closest-side at 50% 42%,
      color-mix(in srgb, var(--cream) 82%, transparent),
      color-mix(in srgb, var(--cream) 34%, transparent) 62%,
      transparent 100%),
    url('../assets/themes/jungle-bg.webp') center center / cover no-repeat;
}
/* Phones only ever see the middle of the painting, where there is nothing to
 * look at, so drop it for the plain wash and save the download. */
@media (max-width: 620px) {
  [data-theme="safari"] body::after {
    background:
      radial-gradient(200px 130px at 2% 6%, color-mix(in srgb, #2f7d1e 45%, transparent), transparent 72%),
      radial-gradient(240px 160px at 99% 8%, color-mix(in srgb, #1f5e14 42%, transparent), transparent 72%),
      radial-gradient(200px 140px at 1% 92%, color-mix(in srgb, #3f8f2b 38%, transparent), transparent 72%),
      radial-gradient(240px 170px at 99% 96%, color-mix(in srgb, #1f5e14 34%, transparent), transparent 72%);
  }
}

[data-theme="galaxy"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 28% 62%, #cfe4ff, transparent),
    radial-gradient(1.8px 1.8px at 46% 12%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 63% 78%, #ffe9a8, transparent),
    radial-gradient(1.7px 1.7px at 78% 32%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 88% 68%, #cfe4ff, transparent),
    radial-gradient(1.5px 1.5px at 8% 88%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 36% 92%, #ffe9a8, transparent),
    radial-gradient(1.6px 1.6px at 94% 8%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 20% 40%, #fff, transparent),
    radial-gradient(1.1px 1.1px at 55% 48%, #cfe4ff, transparent),
    radial-gradient(1.4px 1.4px at 70% 6%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 4% 56%, #ffe9a8, transparent),
    radial-gradient(1.5px 1.5px at 84% 88%, #fff, transparent),
    radial-gradient(1.1px 1.1px at 40% 30%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 66% 58%, #cfe4ff, transparent);
  animation: sb-twinkle 5.5s ease-in-out infinite;
}

/* Deep space, layer two. The starfield above lives on <body>; the nebulae and
 * the planets live on <html>, so they can drift on their own clock without
 * disturbing the stars. Both sit behind everything and swallow no clicks.
 *
 * Note the selector: data-theme is set ON <html>, so these have to be
 * html[data-theme=…]::before. A descendant selector would never match, since
 * the root element is not a descendant of itself. */
html[data-theme="galaxy"]::before,
html[data-theme="galaxy"]::after {
  content: ''; position: fixed; z-index: -1; pointer-events: none;
}
/* The nebulae are drawn oversized so they can drift without an edge sliding
   into view; the planets are pinned to the viewport, because they are objects
   with a place rather than a wash. */
html[data-theme="galaxy"]::before { inset: -12%; }
html[data-theme="galaxy"]::after  { inset: 0; }
/* Nebulae: three coloured clouds breathing very slowly across the sky. */
html[data-theme="galaxy"]::before {
  background:
    radial-gradient(38vw 30vw at 16% 24%, rgba(124, 58, 237, .34), transparent 68%),
    radial-gradient(34vw 26vw at 84% 32%, rgba(14, 116, 233, .30), transparent 68%),
    radial-gradient(42vw 30vw at 52% 92%, rgba(219, 39, 119, .22), transparent 70%),
    radial-gradient(26vw 20vw at 74% 76%, rgba(6, 182, 212, .18), transparent 70%);
  filter: blur(6px);
  animation: sb-nebula 26s ease-in-out infinite alternate;
}
/* Two planets and a distant ringed world, parked in the corners where the
   content is not. */
html[data-theme="galaxy"]::after {
  background-image:
    radial-gradient(circle 58px at calc(100% - 110px) 172px,
      #ffb703 0 46%, #e07b06 46% 76%, rgba(224,123,6,.22) 76% 100%, transparent 100%),
    radial-gradient(circle 32px at 84px calc(100% - 130px),
      #7dd3fc 0 52%, #3b82f6 52% 82%, rgba(59,130,246,.2) 82% 100%, transparent 100%),
    radial-gradient(circle 18px at calc(100% - 230px) calc(100% - 96px),
      #f0abfc 0 60%, rgba(240,171,252,.18) 60% 100%, transparent 100%);
  background-repeat: no-repeat;
  animation: sb-drift 30s ease-in-out infinite alternate;
}
/* A comet crosses now and then — long gaps, so it stays a surprise rather
   than a tic in the corner of the eye. */
[data-theme="galaxy"] .site-header::after {
  content: ''; position: fixed; top: 16vh; left: -18vw; z-index: -1;
  width: 16vw; height: 2px; pointer-events: none; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #fff9, #fff);
  box-shadow: 0 0 12px 2px rgba(255, 255, 255, .55);
  animation: sb-comet 14s linear infinite;
}
@keyframes sb-twinkle { 0%, 100% { opacity: .95; } 50% { opacity: .55; } }
@keyframes sb-nebula {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(2.5%, -2%, 0) scale(1.08); }
}
@keyframes sb-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-10px, 12px, 0); }
}
@keyframes sb-comet {
  0%      { transform: translate3d(0, 0, 0) rotate(14deg); opacity: 0; }
  4%      { opacity: 1; }
  22%     { transform: translate3d(140vw, 34vh, 0) rotate(14deg); opacity: 0; }
  100%    { transform: translate3d(140vw, 34vh, 0); opacity: 0; }
}

/* ── Garden (Grade 3): the rainbow, the sun and the flower bed ────────────
 * All painted, no artwork to download. The rainbow is a set of concentric
 * bands from a circle centred below the page, so only its arc shows; the
 * flowers are soft blobs along the bottom edge, well clear of the text. */
[data-theme="garden"] body::before {
  background:
    linear-gradient(178deg, #bfe9ff 0%, #e6f7ff 46%, #f4fbff 74%, #eaf9e4 100%);
}
[data-theme="garden"] body::after {
  opacity: 1;
  background:
    /* sun, top right */
    radial-gradient(220px 220px at 88% 6%, rgba(255, 214, 84, .55), transparent 68%),
    /* The rainbow arc. The circle is centred well below the page and drawn
       large, so only the top of it shows — an arc across the upper half,
       behind the content rather than under the footer. */
    radial-gradient(circle 165vh at 50% 152%,
      transparent 0 60.5%,
      rgba(139, 92, 246, .34) 60.5% 63%,
      rgba(59, 130, 246, .34) 63% 65.5%,
      rgba(34, 197, 94, .32)  65.5% 68%,
      rgba(250, 204, 21, .36) 68% 70.5%,
      rgba(249, 115, 22, .34) 70.5% 73%,
      rgba(239, 68, 68, .32)  73% 75.5%,
      transparent 75.5% 100%),
    /* clouds */
    radial-gradient(120px 54px at 18% 12%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(90px 44px at 26% 16%, rgba(255,255,255,.8), transparent 70%),
    radial-gradient(140px 58px at 72% 20%, rgba(255,255,255,.72), transparent 70%),
    /* the flower bed along the foot of the page */
    radial-gradient(70px 42px at 6% 100%, rgba(34, 197, 94, .40), transparent 72%),
    radial-gradient(90px 50px at 22% 101%, rgba(22, 163, 74, .34), transparent 72%),
    radial-gradient(80px 46px at 44% 100%, rgba(74, 222, 128, .34), transparent 72%),
    radial-gradient(96px 52px at 68% 101%, rgba(34, 197, 94, .34), transparent 72%),
    radial-gradient(76px 44px at 92% 100%, rgba(22, 163, 74, .36), transparent 72%),
    radial-gradient(13px 13px at 12% 94%, rgba(239, 77, 122, .85), transparent 70%),
    radial-gradient(11px 11px at 31% 96%, rgba(250, 204, 21, .85), transparent 70%),
    radial-gradient(12px 12px at 52% 94%, rgba(139, 92, 246, .80), transparent 70%),
    radial-gradient(11px 11px at 76% 96%, rgba(249, 115, 22, .82), transparent 70%),
    radial-gradient(12px 12px at 88% 93%, rgba(43, 166, 224, .80), transparent 70%);
}
/* Petals drifting down. Slow and few — a garden, not a snowstorm. */
html[data-theme="garden"]::before {
  content: ''; position: fixed; inset: -20% 0 0 0; z-index: -1;
  pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(6px 4px at 10% 10%, rgba(239, 77, 122, .8), transparent 70%),
    radial-gradient(5px 4px at 34% 26%, rgba(250, 204, 21, .75), transparent 70%),
    radial-gradient(6px 4px at 58% 8%, rgba(139, 92, 246, .7), transparent 70%),
    radial-gradient(5px 3px at 78% 30%, rgba(249, 115, 22, .75), transparent 70%),
    radial-gradient(6px 4px at 92% 14%, rgba(43, 166, 224, .7), transparent 70%);
  animation: sb-petals 18s linear infinite;
}
@keyframes sb-petals {
  from { transform: translate3d(0, -8vh, 0) rotate(0deg); }
  to   { transform: translate3d(-3vw, 108vh, 0) rotate(24deg); }
}

/* Phones: keep the rainbow and the sun, drop the fiddly flower detail. */
@media (max-width: 620px) {
  html[data-theme="garden"]::before { display: none; }
}

/* Nothing above should move for a child who has asked for stillness. */
@media (prefers-reduced-motion: reduce) {
  [data-theme="galaxy"] body::after,
  html[data-theme="galaxy"]::before,
  html[data-theme="galaxy"]::after,
  html[data-theme="garden"]::before { animation: none; }
  [data-theme="galaxy"] .site-header::after { display: none; }
}

img { max-width: 100%; display: block; }
/* color: inherit matters — a <button> does NOT inherit colour by default
   (the UA gives it near-black `buttontext`). The card tiles, menu items and
   letter keys are all buttons, so without this their text stays dark and
   vanishes on the Galaxy theme. */
button { font-family: inherit; cursor: pointer; border: none; background: none;
  color: inherit; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 16px;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 22px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav a, .nav button {
  padding: 9px 16px; border-radius: 20px; font-size: 15px; font-weight: 500;
  color: var(--ink); transition: background .15s;
}
.nav a:hover, .nav button:hover { background: color-mix(in srgb, var(--honey) 25%, transparent); }
.nav .cta {
  background: var(--honey); color: var(--on-honey); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.nav .cta:hover { background: var(--amber); }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 22px; background: var(--card);
  box-shadow: var(--shadow-sm); font-weight: 600; font-size: 15px;
}
.user-chip .av { font-size: 22px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 26px; border-radius: 30px; font-size: 17px; font-weight: 600;
  color: var(--on-honey); background: var(--honey); box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.leaf { background: var(--leaf); color: var(--on-leaf); }
.btn.sky { background: var(--sky); color: var(--on-sky); }
.btn.berry { background: var(--berry); color: var(--on-berry); }
.btn.ink { background: var(--ink); color: var(--on-ink); }
.btn.ghost { background: var(--card); color: var(--ink); border: 2px solid color-mix(in srgb, var(--ink) 12%, transparent); box-shadow: none; }
.btn.big { padding: 16px 34px; font-size: 19px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Landing: hero ──────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--hero-1) 0%, var(--hero-2) 62%);
  padding: 70px 0 60px;
}
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 52px; line-height: 1.08; margin-bottom: 18px; }
.hero h1 .hl { color: var(--amber); }
.hero p.lead { font-size: 20px; color: color-mix(in srgb, var(--ink) 80%, transparent); margin-bottom: 28px; max-width: 34ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art {
  display: flex; align-items: center; justify-content: center;
}
.hero-art img { width: 320px; height: 320px; filter: drop-shadow(0 20px 40px color-mix(in srgb, var(--ink) 18%, transparent)); }

.stats-strip {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px;
}
.stat-pill {
  background: var(--card); border-radius: 18px; padding: 14px 20px; box-shadow: var(--shadow-sm);
  min-width: 120px;
}
.stat-pill b { display: block; font-size: 26px; }
.stat-pill span { font-size: 13px; color: color-mix(in srgb, var(--ink) 60%, transparent); }

/* ── Sections ───────────────────────────────────────────────────────────── */
section.block { padding: 64px 0; }
section.block.alt { background: var(--card); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head .eyebrow {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 10px;
}
.section-head h2 { font-size: 36px; margin-bottom: 12px; }
.section-head p { font-size: 17px; color: color-mix(in srgb, var(--ink) 72%, transparent); }

.prose { max-width: 760px; margin: 0 auto; }
.prose p { font-size: 17px; color: color-mix(in srgb, var(--ink) 82%, transparent); margin-bottom: 16px; }

/* Feature / practice cards */
.grid { display: grid; gap: 20px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.feature {
  background: var(--card); border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent);
}
.feature .ico { font-size: 40px; margin-bottom: 12px; }
.feature h3 { font-size: 20px; margin-bottom: 8px; }
.feature p { font-size: 15px; color: color-mix(in srgb, var(--ink) 70%, transparent); }

/* ── Grade cards ────────────────────────────────────────────────────────── */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.grade-card {
  position: relative; display: block; text-align: center;
  background: var(--card); border-radius: var(--radius); padding: 30px 20px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.grade-card.live { cursor: pointer; }
.grade-card.live:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--honey); }
.grade-card .num { font-size: 44px; font-weight: 700; color: var(--amber); }
.grade-card .label { font-size: 17px; font-weight: 600; margin-top: 4px; }
.grade-card .sub { font-size: 13px; color: color-mix(in srgb, var(--ink) 55%, transparent); margin-top: 6px; }
.grade-card.soon { opacity: .6; }
.grade-card .badge {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); color: color-mix(in srgb, var(--ink) 60%, transparent);
}
.grade-card.live .badge { background: color-mix(in srgb, var(--leaf) 18%, transparent); color: var(--leaf); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--footer-bg); color: #fff6e2; padding: 40px 0; margin-top: 40px; }
.site-footer .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-footer .brand { color: #fff6e2; }
.site-footer small { margin-left: auto; opacity: .7; }

/* ── Grade hub ──────────────────────────────────────────────────────────── */
.hub { display: grid; grid-template-columns: 260px 1fr; gap: 32px; padding: 32px 0 60px; align-items: start; }
.side {
  position: sticky; top: 96px;
  background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.side .who { text-align: center; padding-bottom: 16px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); margin-bottom: 16px; }
.side .who .av { font-size: 54px; }
.side .who .nm { font-size: 20px; font-weight: 700; margin-top: 6px; }
.side .who .sub { font-size: 13px; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.side .menu { list-style: none; }
.side .menu button {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; font-size: 15px; font-weight: 500; color: var(--ink);
  transition: background .12s;
}
.side .menu button:hover, .side .menu button.active { background: color-mix(in srgb, var(--honey) 24%, transparent); }
.side .menu .ico { font-size: 20px; }
.side .mini-stats { display: flex; gap: 8px; margin-top: 16px; }
.side .mini-stats div { flex: 1; text-align: center; background: color-mix(in srgb, var(--honey) 14%, transparent); border-radius: 12px; padding: 10px 4px; }
.side .mini-stats b { display: block; font-size: 18px; }
.side .mini-stats span { font-size: 11px; color: color-mix(in srgb, var(--ink) 55%, transparent); }

.panel-title { font-size: 26px; margin-bottom: 6px; }
.panel-sub { font-size: 15px; color: color-mix(in srgb, var(--ink) 66%, transparent); margin-bottom: 22px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.cat {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent; text-align: left;
  transition: transform .12s, box-shadow .15s, border-color .15s; cursor: pointer;
  display: flex; flex-direction: column; min-height: 150px;
}
.cat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--c, var(--honey)); }
.cat .ico { font-size: 34px; margin-bottom: 8px; }
.cat h4 { font-size: 17px; margin-bottom: 4px; }
.cat p { font-size: 13px; color: color-mix(in srgb, var(--ink) 78%, transparent); flex: 1; }
.cat .meta { font-size: 12px; font-weight: 600; color: var(--c, var(--amber)); margin-top: 8px; }

.hero-cat {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 20px; padding: 24px 28px;
  border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s;
}
.hero-cat:hover { transform: translateY(-2px); }
.hero-cat .ico { font-size: 46px; }
.hero-cat h4 { font-size: 22px; color: #fff; }
.hero-cat p { font-size: 14px; color: color-mix(in srgb, var(--card) 90%, transparent); }
.hero-cat .arrow { margin-left: auto; font-size: 30px; }

/* ── Play screen ────────────────────────────────────────────────────────── */
/* Compact on purpose: the earlier layout wasted space at the top and pushed
 * the Next button below the fold. Tighter paddings keep the whole question,
 * options and Next on one screen. */
/* position: relative so the buddy can hang in the gutter beside it. */
.play-wrap { max-width: 760px; margin: 0 auto; padding: 12px 0 24px; position: relative; }
.play-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.play-bar .back { font-size: 15px; font-weight: 600; color: var(--ink); padding: 8px 12px; border-radius: 14px; }
.play-bar .back:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.progress-track { flex: 1; height: 10px; background: var(--card); border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent); }
.progress-fill { height: 100%; background: var(--honey); width: 0; transition: width .3s; }
.progress-label { font-size: 13px; color: color-mix(in srgb, var(--ink) 60%, transparent); white-space: nowrap; }

.qcard {
  background: var(--card); border-radius: 22px; padding: 18px 24px; box-shadow: var(--shadow);
  text-align: center; margin-bottom: 14px;
}
.qcard .subprompt { font-size: 17px; font-weight: 600; color: color-mix(in srgb, var(--ink) 85%, transparent); margin-bottom: 2px; }
.qcard .qemoji { font-size: 56px; margin: 4px 0; line-height: 1; }
.qcard .prompt { font-size: 28px; font-weight: 600; margin: 6px 0 2px; }
.qcard .prompt.long { font-size: 20px; }
.qcard .prompt.jumble { letter-spacing: 6px; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 18px 20px; border-radius: 18px; background: var(--card); border: 2px solid var(--honey);
  box-shadow: var(--shadow-sm); font-size: 21px; font-weight: 500; color: var(--ink);
  transition: transform .1s, background .15s;
}
.opt:hover:not(:disabled) { transform: translateY(-2px); }
.opt .badge { width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: color-mix(in srgb, var(--honey) 26%, transparent); font-size: 15px; font-weight: 600; }
.opt.right { background: var(--leaf); color: var(--on-leaf); border-color: var(--leaf); }
.opt.wrong { background: var(--berry); color: var(--on-berry); border-color: var(--berry); }
.opt.dim { opacity: .45; }
.opt.right .badge, .opt.wrong .badge { background: color-mix(in srgb, var(--card) 25%, transparent); color: #fff; }

.explain { margin-top: 14px; padding: 14px 18px; border-radius: 18px; text-align: center; }
.explain.ok { background: color-mix(in srgb, var(--leaf) 14%, transparent); }
.explain.no { background: color-mix(in srgb, var(--berry) 14%, transparent); }
.explain h3 { font-size: 18px; margin-bottom: 4px; }
.explain.ok h3 { color: var(--leaf); }
.explain.no h3 { color: var(--berry); }
.explain p { font-size: 15px; color: color-mix(in srgb, var(--ink) 75%, transparent); }

/* ── Jungle friends ───────────────────────────────────────────────────────
 * Grade 1 only. The baby animal that sits beside the question and reacts to
 * the answer, the one that laughs on the score card, and the monkey that runs
 * across the foot of the screen between questions.
 *
 * All three are the same thing underneath: a <canvas> that buddies.js paints
 * a video into with the backdrop cut away. The canvas carries the animal's
 * own shape, so it takes a drop-shadow like any cut-out would — which is the
 * whole point of keying it rather than showing a boxed video.
 *
 * They are decoration: aria-hidden, never clickable, and losing them costs
 * the page nothing. */
.buddy-canvas {
  display: block; width: 100%; height: auto;
  pointer-events: none; user-select: none;
}

/* The buddy lives in the gutter beside the question, so it costs the question
 * card no width. Below 1100px there is no gutter left to put it in, and it is
 * dropped rather than allowed to overlap the options. */
.buddy {
  position: absolute; right: -196px; bottom: 0; width: 176px;
  pointer-events: none;
  filter: drop-shadow(0 12px 22px color-mix(in srgb, var(--ink) 26%, transparent));
}
@media (max-width: 1100px) { .buddy { display: none; } }

/* The animal that laughs on the score card. */
.result-buddy {
  width: 156px; margin: 0 auto 2px;
  filter: drop-shadow(0 10px 20px color-mix(in srgb, var(--ink) 24%, transparent));
}

/* The runner crosses the foot of the screen and leaves. Its travel is a Web
 * Animation set up in buddies.js, because where it starts depends on the
 * window width; what stays here is only what never varies. */
.buddy-runner {
  position: fixed; left: 0; bottom: 4vh; z-index: 60;
  width: 150px; pointer-events: none;
  filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--ink) 22%, transparent));
}
@media (max-width: 620px) { .buddy-runner { width: 108px; } }

/* buddies.js already declines to start anything when motion is reduced; this
   is the belt to that pair of braces. */
@media (prefers-reduced-motion: reduce) {
  .buddy-runner { display: none; }
}

/* The Next / action bar sticks to the bottom of the screen, so it is always in
 * reach no matter how tall the question is. The fade keeps content from
 * showing through as it scrolls under. */
.action-bar {
  display: flex; gap: 14px; justify-content: center; align-items: center;
  position: sticky; bottom: 0; z-index: 5; margin-top: 14px; padding: 14px 0 10px;
  background: linear-gradient(transparent, var(--page-2) 45%);
}

/* Round controls (speaker buttons) */
.round-controls { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 10px 0 2px; }
.circle-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; }
.circle-btn .circle {
  width: 64px; height: 64px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  border: 3px solid var(--c, var(--amber)); box-shadow: var(--shadow-sm); font-size: 26px;
  transition: transform .1s, background .15s;
}
.circle-btn:hover .circle { transform: translateY(-2px); }
.circle-btn.active .circle { background: var(--c, var(--amber)); color: var(--card); }
.circle-btn .lbl { font-size: 12.5px; color: color-mix(in srgb, var(--ink) 72%, transparent); text-align: center; }
.circle-btn.pulse .circle { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* Answer boxes + on-screen keyboard */
.answer-strip { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.abox {
  width: 44px; height: 54px; border-radius: 12px; background: var(--card); border: 2px solid color-mix(in srgb, var(--ink) 15%, transparent);
  display: grid; place-items: center; font-size: 26px; font-weight: 600;
}
.abox.filled { background: color-mix(in srgb, var(--honey) 20%, transparent); border-color: var(--amber); }
.abox.extra { border-color: var(--berry); }
.abox.right { background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); }
.abox.wrong { background: var(--berry); border-color: var(--berry); color: var(--on-berry); }
.abox.lit { background: var(--honey); border-color: var(--amber); color: var(--on-honey); }

.keyboard { display: flex; flex-direction: column; gap: 7px; align-items: center; margin-top: 10px; }
.krow { display: flex; gap: 7px; }
.key {
  width: 46px; height: 48px; border-radius: 11px; background: var(--card); border: 1.6px solid color-mix(in srgb, var(--honey) 70%, transparent);
  font-size: 19px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .06s, background .12s;
}
.key:hover { transform: translateY(-1px); background: #fffdf5; }
.heard { font-size: 13px; color: color-mix(in srgb, var(--ink) 70%, transparent); background: rgba(76,201,240,.12); padding: 7px 12px; border-radius: 14px; display: inline-block; margin-top: 10px; }

/* mic panel */
.mic-panel { border: 2px solid color-mix(in srgb, var(--honey) 60%, transparent); border-radius: 22px; padding: 20px; margin: 16px 0; text-align: center; }
.mic-panel.rec { border-color: var(--berry); background: rgba(229,72,77,.06); }
.mic-panel.listen { border-color: var(--sky); background: rgba(76,201,240,.08); }

/* ── Report ─────────────────────────────────────────────────────────────── */
.report-hero { background: var(--card); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); text-align: center; border: 2px solid; }
.report-hero .big { font-size: 52px; font-weight: 700; }
.report-hero .small { font-size: 20px; color: color-mix(in srgb, var(--ink) 70%, transparent); }
.report-bar { height: 12px; border-radius: 8px; overflow: hidden; margin: 12px 0 8px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.report-bar > span { display: block; height: 100%; }

.overall-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 20px 0; }
.overall-grid .cell { background: var(--card); border-radius: 16px; padding: 14px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.overall-grid .cell .em { font-size: 20px; }
.overall-grid .cell b { display: block; font-size: 18px; }
.overall-grid .cell span { font-size: 11px; color: color-mix(in srgb, var(--ink) 55%, transparent); }

.round-row {
  display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--shadow-sm); margin-bottom: 10px; text-align: left; width: 100%;
}
.round-row.clickable { cursor: pointer; transition: transform .1s; }
.round-row.clickable:hover { transform: translateX(3px); }
.round-row .stripe { width: 8px; height: 36px; border-radius: 4px; }
.round-row .info { flex: 1; }
.round-row .info b { font-size: 15px; }
.round-row .info span { display: block; font-size: 12px; color: color-mix(in srgb, var(--ink) 55%, transparent); }
.round-row .score { font-size: 18px; font-weight: 700; }

.mode-row { background: var(--card); border-radius:16px; padding:14px 16px; box-shadow:var(--shadow-sm); margin-bottom:10px; }
.mode-row .top { display:flex; align-items:center; gap:10px; }
.mode-row .top b { flex:1; font-size:16px; }
.mode-row .pill { padding:4px 10px; border-radius:12px; font-size:14px; font-weight:700; }
.mode-row .track { height:7px; border-radius:6px; background:color-mix(in srgb, var(--ink) 10%, transparent); overflow:hidden; margin:8px 0 6px; }
.mode-row .track > span { display:block; height:100%; }
.mode-row .sub { font-size:12px; color:color-mix(in srgb, var(--ink) 55%, transparent); }

/* Review rows */
.rev-row { background: var(--card); border-radius:18px; padding:14px 16px; box-shadow:var(--shadow-sm); border:2px solid; margin-bottom:9px; cursor:pointer; }
.rev-row .head { display:flex; align-items:center; gap:11px; }
.rev-row .n { width:28px; height:28px; border-radius:50%; display:grid; place-items:center; font-size:12.5px; font-weight:700; flex:none; }
.rev-row .q { flex:1; }
.rev-row .q b { font-size:15px; }
.rev-row .q span { display:block; font-size:11.5px; color:color-mix(in srgb, var(--ink) 50%, transparent); }
.rev-row .mark { font-size:22px; }
.rev-body { margin-top:10px; padding-top:10px; border-top:1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.rev-line { display:flex; gap:10px; margin-bottom:5px; font-size:15px; }
.rev-line .k { width:70px; color:color-mix(in srgb, var(--ink) 55%, transparent); font-size:12.5px; }
.rev-line b { font-weight:600; }
.filter-chips { display:flex; gap:9px; margin:14px 0; flex-wrap:wrap; }
.chip { padding:8px 14px; border-radius:18px; background: var(--card); border:1.8px solid; font-size:13.5px; font-weight:600; }

.cat-tally { background: var(--card); border-radius:18px; padding:16px 18px; box-shadow:var(--shadow-sm); margin-bottom:16px; }
.cat-tally h4 { font-size:15px; margin-bottom:12px; }
.cat-tally .row { display:flex; align-items:center; gap:10px; margin-bottom:9px; }
.cat-tally .row .nm { flex:1; font-size:13.5px; }
.cat-tally .row .tr { width:90px; height:7px; border-radius:5px; background:color-mix(in srgb, var(--ink) 8%, transparent); overflow:hidden; }
.cat-tally .row .tr > span { display:block; height:100%; }
.cat-tally .row .sc { width:44px; text-align:right; font-size:13px; font-weight:700; }

/* ── Modal (profile / result) ───────────────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.modal-back.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); border-radius: 28px; padding: 30px; max-width: 460px; width: 100%;
  box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto; text-align: center;
  transform: translateY(12px); transition: transform .18s;
}
.modal-back.show .modal { transform: none; }
.modal h2 { font-size: 24px; margin-bottom: 8px; }
.modal p.sub { color: color-mix(in srgb, var(--ink) 66%, transparent); margin-bottom: 18px; }
.field { width: 100%; padding: 14px 16px; border-radius: 16px; border: none; background: var(--card);
  font-family: inherit; font-size: 18px; font-weight: 600; text-align: center; color: var(--ink);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 6%, transparent); }
.field:focus { outline: 2px solid var(--honey); }
.avatars { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0; }
.avatars button { width: 54px; height: 54px; border-radius: 15px; background: var(--card); font-size: 27px;
  border: 2.5px solid color-mix(in srgb, var(--ink) 10%, transparent); transition: transform .1s; }
.avatars button.sel { background: color-mix(in srgb, var(--honey) 32%, transparent); border-color: var(--amber); }
.avatars button:hover { transform: translateY(-2px); }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 24px; font-size: 15px;
  box-shadow: var(--shadow); z-index: 200; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* ── Confetti ───────────────────────────────────────────────────────────── */
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 90; pointer-events: none; border-radius: 2px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .hero-cta, .stats-strip { justify-content: center; }
  .hero-art { order: -1; }
  .hero-art img { width: 220px; height: 220px; }
  .hero h1 { font-size: 40px; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .hub { grid-template-columns: 1fr; }
  .side { position: static; }
  .overall-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .hero h1 { font-size: 32px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .opts { grid-template-columns: 1fr; }
  .nav a, .nav button { padding: 8px 12px; font-size: 14px; }
  .nav .hide-sm { display: none; }
  .overall-grid { grid-template-columns: repeat(2, 1fr); }
  .section-head h2 { font-size: 28px; }
  /* Ten fixed-width keys plus their gaps are wider than a phone, so the top
     row was running off both edges. Let the keys share the width instead —
     they still cap at their desktop size on a wide phone. */
  .keyboard { width: 100%; }
  .krow { gap: 5px; width: 100%; }
  .key {
    width: auto; flex: 1 1 0; min-width: 0; max-width: 40px;
    height: 46px; font-size: 16px; padding: 0;
  }
  .key.wide { flex: 0 0 auto; width: auto; max-width: none; padding: 0 16px; font-size: 15px; }
}

/* ── Logo-led hero ────────────────────────────────────────────────────────
 * The chosen world's artwork is the hero image, so the page and the logo
 * always belong to each other. */
.hero-art .theme-logo {
  width: min(400px, 78vw); height: auto; border-radius: 24px;
  filter: drop-shadow(0 18px 44px color-mix(in srgb, var(--ink) 30%, transparent));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .hero-art .theme-logo { animation: none; } }

/* Each grade card previews its world. */
.grade-card .world {
  width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 16px;
  filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--ink) 22%, transparent));
}
.grade-card .world-name {
  margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--amber);
}

/* The brand mark in the header follows the theme too. */
.brand .mark {
  width: 44px; height: 44px; border-radius: 12px; background-size: cover;
  background-position: center; background-image: var(--logo-sm);
  box-shadow: var(--shadow-sm);
}
[data-theme="galaxy"] .brand .mark { background-color: #0a0a2b; }

/* Section headings get a themed rule under them. */
.section-head h2::after {
  content: ''; display: block; width: 76px; height: 5px; margin: 12px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--honey), var(--leaf));
}

/* Cards lift a little more on the dark theme so they read as raised. */
[data-theme="kingdom"] .feature,
[data-theme="kingdom"] .grade-card,
[data-theme="kingdom"] .cat,
[data-theme="kingdom"] .qcard,
[data-theme="kingdom"] .side,
[data-theme="kingdom"] .opt {
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
[data-theme="kingdom"] .site-header { border-bottom-color: color-mix(in srgb, var(--ink) 16%, transparent); }
[data-theme="kingdom"] .brand .mark { background-color: #1a1230; }

[data-theme="galaxy"] .feature,
[data-theme="galaxy"] .grade-card,
[data-theme="galaxy"] .cat,
[data-theme="galaxy"] .qcard,
[data-theme="galaxy"] .side,
[data-theme="galaxy"] .opt {
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
[data-theme="galaxy"] .site-header { border-bottom-color: color-mix(in srgb, var(--ink) 16%, transparent); }

/* Settings row inside the profile modal. */
.opt-row {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin: 4px 0 14px; font-size: 14.5px; cursor: pointer;
  color: color-mix(in srgb, var(--ink) 80%, transparent);
}
.opt-row input { width: 20px; height: 20px; accent-color: var(--leaf); cursor: pointer; }


/* ── Kingdom (Grade 4): the painted scenes ───────────────────────────────
 * Grade 4 is the only world with real artwork behind it, and it has three
 * scenes rather than one. Which one shows depends on where in the kingdom the
 * child is standing: the castle town while they choose a place, the woods
 * inside Whispering Woods and Dragon Cave, the flower meadow inside the
 * Enchanted Garden and Music Meadow. app.js sets `data-scene` on <html>; every
 * other grade ignores all of this.
 *
 * The scrim is the part that matters. This theme has light text, and the
 * paintings are bright daylight, so the veil is darkest through the middle
 * band where the cards and the questions sit and thins out towards the edges,
 * leaving the artwork vivid where nothing is written over it. */
[data-theme="kingdom"] {
  --kingdom-scene: url('../assets/themes/kingdom-castle.webp');
}
html[data-theme="kingdom"][data-scene="forest"] {
  --kingdom-scene: url('../assets/themes/kingdom-forest.webp');
}
html[data-theme="kingdom"][data-scene="meadow"] {
  --kingdom-scene: url('../assets/themes/kingdom-meadow.webp');
}

[data-theme="kingdom"] body::before {
  background: linear-gradient(178deg, #3a2470 0%, #241a42 46%, #1a1230 100%);
}
[data-theme="kingdom"] body::after {
  opacity: 1;
  background-image:
    /* the veil */
    radial-gradient(closest-side at 50% 44%,
      rgba(20, 12, 36, .93) 0%,
      rgba(20, 12, 36, .84) 52%,
      rgba(20, 12, 36, .60) 100%),
    /* and a little extra under the header and along the foot */
    linear-gradient(to bottom,
      rgba(20, 12, 36, .78) 0, rgba(20, 12, 36, 0) 18%,
      rgba(20, 12, 36, 0) 78%, rgba(20, 12, 36, .6) 100%),
    var(--kingdom-scene);
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center 30%;
  background-repeat: no-repeat;
  /* The scene changes when the child walks into a different place, so give it
     a moment rather than snapping. */
  transition: background-image .35s ease;
}

/* Phones see almost none of a wide painting and pay for all of it, so they
   get the plain dusk wash instead. */
@media (max-width: 620px) {
  [data-theme="kingdom"] body::after {
    background-image:
      radial-gradient(300px 220px at 12% 8%, rgba(124, 79, 212, .5), transparent 70%),
      radial-gradient(320px 240px at 92% 16%, rgba(246, 196, 69, .22), transparent 72%),
      radial-gradient(420px 260px at 50% 104%, rgba(246, 196, 69, .2), transparent 72%);
    background-size: auto;
    background-position: center;
  }
}


/* ── Ancient (Grade 5): the painted scenes ──────────────────────────────
 * Like Grade 4, Grade 5 has real artwork behind it and three scenes rather
 * than one, chosen by where in the world the child is: the great temple while
 * they pick a place, the overgrown ruins inside the Word Ruins, the Secret
 * Chamber and the Code Vault, and the jungle path at the Explorer's Map.
 * app.js sets `data-scene`; every other grade ignores all of this.
 *
 * The veil works the other way round from Grade 4's. This theme has *dark*
 * text on papyrus, and the paintings are deep green jungle, so the middle
 * band is lifted towards cream rather than pushed towards black — the same
 * trick the Grade 1 jungle uses, for the same reason.
 */
[data-theme="ancient"] {
  --ancient-scene: url('../assets/themes/ancient-temple.webp');
}
html[data-theme="ancient"][data-scene="ruins"] {
  --ancient-scene: url('../assets/themes/ancient-ruins.webp');
}
html[data-theme="ancient"][data-scene="jungle"] {
  --ancient-scene: url('../assets/themes/ancient-jungle.webp');
}

[data-theme="ancient"] body::before {
  background: linear-gradient(176deg, #f3e3c0 0%, #f6eeda 48%, #ecd9b4 100%);
}
[data-theme="ancient"] body::after {
  opacity: 1;
  background-image:
    /* the veil: cream through the middle where the text sits, thinning at the
       edges so the painting stays vivid where nothing is written over it */
    radial-gradient(closest-side at 50% 40%,
      color-mix(in srgb, var(--cream) 80%, transparent) 0%,
      color-mix(in srgb, var(--cream) 62%, transparent) 54%,
      color-mix(in srgb, var(--cream) 26%, transparent) 100%),
    /* A stronger band across the top, because the only dark text sitting
       directly on the painting is up there — the panel headings and the
       progress line. Everything below is inside an opaque card. */
    linear-gradient(to bottom,
      color-mix(in srgb, var(--cream) 88%, transparent) 0,
      color-mix(in srgb, var(--cream) 72%, transparent) 26%,
      transparent 46%),
    var(--ancient-scene);
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center 38%;
  background-repeat: no-repeat;
  /* The scene changes when the child walks into a different place, so give it
     a moment rather than snapping. */
  transition: background-image .35s ease;
}

/* Phones see almost none of a wide painting and pay for all of it. */
@media (max-width: 620px) {
  [data-theme="ancient"] body::after {
    background-image:
      radial-gradient(260px 200px at 88% 6%, rgba(217, 162, 32, .40), transparent 70%),
      radial-gradient(300px 220px at 6% 14%, rgba(185, 116, 27, .18), transparent 72%),
      radial-gradient(360px 240px at 50% 102%, rgba(47, 143, 111, .16), transparent 72%);
    background-size: auto;
    background-position: center;
  }
}

/* Academic World (Grade 6): seven paintings, the most of any world, because
 * this is the last grade and the campus is meant to feel large. The hub looks
 * down on the whole school from the air; each subject building is somewhere
 * you walk into.
 *
 * The veil lifts towards cream, the same way round as Grade 5's and the
 * opposite of Grade 4's, because this theme has dark ink on warm paper.
 *
 * Unlike the other worlds, the veil is not one fixed recipe. These seven
 * paintings run from a bright green valley in full daylight to a near-black
 * reactor hall, and a single strength cannot serve both: strong enough to
 * keep ink readable over the reactor washes the valley out completely. So
 * each scene carries its own three stops — centre, middle, edge — and the
 * darker the painting, the more cream goes over it. */
[data-theme="scholar"] {
  --scholar-scene: url('../assets/themes/scholar-campus.webp');
  --scholar-veil-1: 74%;   /* behind the cards, where the questions sit */
  --scholar-veil-2: 56%;   /* the middle band */
  --scholar-veil-3: 20%;   /* the edges, where the painting is allowed to show */
}
html[data-theme="scholar"][data-scene="domes"] {
  --scholar-scene: url('../assets/themes/scholar-domes.webp');
}
/* Daylight interiors: mid-toned, so a little more cream than the outdoor two. */
html[data-theme="scholar"][data-scene="library"] {
  --scholar-scene: url('../assets/themes/scholar-library.webp');
  --scholar-veil-1: 82%; --scholar-veil-2: 64%; --scholar-veil-3: 26%;
}
html[data-theme="scholar"][data-scene="museum"] {
  --scholar-scene: url('../assets/themes/scholar-museum.webp');
  --scholar-veil-1: 82%; --scholar-veil-2: 64%; --scholar-veil-3: 26%;
}
/* Night and lamplight: the ink needs the most help here. */
html[data-theme="scholar"][data-scene="observatory"] {
  --scholar-scene: url('../assets/themes/scholar-observatory.webp');
  --scholar-veil-1: 89%; --scholar-veil-2: 76%; --scholar-veil-3: 40%;
}
html[data-theme="scholar"][data-scene="lab"] {
  --scholar-scene: url('../assets/themes/scholar-lab.webp');
  --scholar-veil-1: 90%; --scholar-veil-2: 78%; --scholar-veil-3: 44%;
}
html[data-theme="scholar"][data-scene="future"] {
  --scholar-scene: url('../assets/themes/scholar-future.webp');
  --scholar-veil-1: 90%; --scholar-veil-2: 78%; --scholar-veil-3: 44%;
}

[data-theme="scholar"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(closest-side at 50% 40%,
      color-mix(in srgb, var(--cream) var(--scholar-veil-1), transparent) 0%,
      color-mix(in srgb, var(--cream) var(--scholar-veil-2), transparent) 54%,
      color-mix(in srgb, var(--cream) var(--scholar-veil-3), transparent) 100%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--cream) 90%, transparent) 0,
      color-mix(in srgb, var(--cream) 72%, transparent) 26%,
      transparent 46%),
    var(--scholar-scene);
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center 42%;
  background-repeat: no-repeat;
  transition: background-image .35s ease;
}

/* Phones see almost none of a wide painting and pay for all of it. */
@media (max-width: 620px) {
  [data-theme="scholar"] body::after {
    background-image:
      radial-gradient(260px 200px at 90% 8%, rgba(200, 144, 31, .30), transparent 70%),
      radial-gradient(300px 220px at 6% 16%, rgba(47, 111, 168, .16), transparent 72%),
      radial-gradient(360px 240px at 50% 102%, rgba(47, 125, 92, .14), transparent 72%);
    background-size: auto;
    background-position: center;
  }
}

/* Expedition (Grade 7): six paintings, cut from the one collage the brief
 * supplied. The hub looks down into the globe hall; each stop on the
 * expedition is somewhere else in the world.
 *
 * The veil lifts towards cream, as on Grades 5 and 6, because this theme has
 * dark ink on map paper. It is per-scene for the same reason Grade 6's is:
 * five of these are bright daylight and the sixth is the world at night, and
 * one strength cannot serve both.
 *
 * These panels came out of the collage at about 750x330, so they are the
 * softest artwork on the site. Behind the veil that reads as haze rather than
 * as blur, but a larger original would be better if one ever arrives. */
[data-theme="expedition"] {
  --expedition-scene: url('../assets/themes/expedition-hall.webp');
  --expedition-veil-1: 78%;   /* behind the cards */
  --expedition-veil-2: 60%;   /* the middle band */
  --expedition-veil-3: 24%;   /* the edges, where the painting shows */
}
html[data-theme="expedition"][data-scene="islands"] {
  --expedition-scene: url('../assets/themes/expedition-islands.webp');
}
html[data-theme="expedition"][data-scene="plaza"] {
  --expedition-scene: url('../assets/themes/expedition-plaza.webp');
}
html[data-theme="expedition"][data-scene="signpost"] {
  --expedition-scene: url('../assets/themes/expedition-signpost.webp');
  --expedition-veil-1: 80%; --expedition-veil-2: 62%; --expedition-veil-3: 26%;
}
/* Warm lamplight on a wooden table: a shade more cream than the daylight. */
html[data-theme="expedition"][data-scene="desk"] {
  --expedition-scene: url('../assets/themes/expedition-desk.webp');
  --expedition-veil-1: 84%; --expedition-veil-2: 66%; --expedition-veil-3: 30%;
}
/* The world at night, and the only dark painting in the set. */
html[data-theme="expedition"][data-scene="night"] {
  --expedition-scene: url('../assets/themes/expedition-night.webp');
  --expedition-veil-1: 86%; --expedition-veil-2: 70%; --expedition-veil-3: 34%;
}

[data-theme="expedition"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(closest-side at 50% 40%,
      color-mix(in srgb, var(--cream) var(--expedition-veil-1), transparent) 0%,
      color-mix(in srgb, var(--cream) var(--expedition-veil-2), transparent) 54%,
      color-mix(in srgb, var(--cream) var(--expedition-veil-3), transparent) 100%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--cream) 90%, transparent) 0,
      color-mix(in srgb, var(--cream) 72%, transparent) 26%,
      transparent 46%),
    var(--expedition-scene);
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center 42%;
  background-repeat: no-repeat;
  transition: background-image .35s ease;
}

/* Phones see almost none of a wide painting and pay for all of it, so they
   keep the chart drawn in CSS: sun in one corner, ocean at the foot. */
@media (max-width: 620px) {
  [data-theme="expedition"] body::after {
    background-image:
      radial-gradient(280px 220px at 90% 6%,
        color-mix(in srgb, #e0952b 24%, transparent), transparent 70%),
      radial-gradient(520px 260px at 50% 106%,
        color-mix(in srgb, #2b7fa8 22%, transparent), transparent 72%);
    background-size: auto;
    background-position: center;
  }
}

/* Time Quest (Grade 8): four paintings of the same mine, deeper each time.
 *
 * The veil works like Grade 4's and unlike Grades 5 to 7: this theme has light
 * text on a dark page, so the veil DARKENS the painting rather than lifting it
 * towards cream. It is heaviest through the middle band, where the cards and
 * the questions sit, and thinner at the edges so the lantern light and the
 * timber still read.
 *
 * The four panels arrived at 765x509, so like Grade 7 they are on the soft
 * side; the darkening veil hides that better than a lifting one does. */
[data-theme="timequest"] {
  --timequest-scene: url('../assets/themes/timequest-mine.webp');
}
html[data-theme="timequest"][data-scene="cavern"] {
  --timequest-scene: url('../assets/themes/timequest-cavern.webp');
}
html[data-theme="timequest"][data-scene="temple"] {
  --timequest-scene: url('../assets/themes/timequest-temple.webp');
}
html[data-theme="timequest"][data-scene="vault"] {
  --timequest-scene: url('../assets/themes/timequest-vault.webp');
}

[data-theme="timequest"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(closest-side at 50% 42%,
      rgba(16, 11, 6, .90) 0%,
      rgba(16, 11, 6, .78) 56%,
      rgba(16, 11, 6, .46) 100%),
    linear-gradient(to bottom,
      rgba(16, 11, 6, .92) 0,
      rgba(16, 11, 6, .74) 24%,
      rgba(16, 11, 6, .34) 48%),
    var(--timequest-scene);
  background-size: 100% 100%, 100% 100%, cover;
  background-position: center, center, center 45%;
  background-repeat: no-repeat;
  transition: background-image .35s ease;
}

/* Phones see almost none of a wide painting and pay for all of it, so they
   get lantern glow on plain rock instead. */
@media (max-width: 620px) {
  [data-theme="timequest"] body::after {
    background-image:
      radial-gradient(300px 240px at 84% 8%, rgba(240, 179, 46, .26), transparent 70%),
      radial-gradient(340px 260px at 8% 22%, rgba(224, 138, 30, .16), transparent 72%),
      radial-gradient(420px 280px at 50% 104%, rgba(99, 168, 196, .12), transparent 74%);
    background-size: auto;
    background-position: center;
  }
}

/* The typed answer box — Grade 8's Rapid Spell Arena, where the word is
   spoken and never shown, so there is nothing to choose between. */
.typed { display: flex; gap: 12px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 4px; }
.typed input {
  flex: 1 1 280px; max-width: 420px; min-width: 0;
  font-family: var(--font); font-size: 22px; font-weight: 600;
  letter-spacing: .5px; text-align: center; color: var(--ink);
  background: var(--card); border: 2px solid var(--line);
  border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow-sm);
}
.typed input:focus { outline: none; border-color: var(--honey); }
.typed.right input { border-color: var(--leaf); }
.typed.wrong input { border-color: var(--berry); text-decoration: line-through; }
.typed input:disabled { opacity: 1; }
.typed-was { margin-top: 2px; opacity: .85; }
@media (max-width: 620px) {
  .typed input { font-size: 19px; padding: 12px 14px; }
}

/* ── Level Quest ──────────────────────────────────────────────────────────
 * The ladder screen and the timed word challenge behind it. Everything reads
 * the theme variables, so the quest is a rainbow garden on Grade 3 and would
 * be a night sky on any later grade that grows a ladder of its own. */
.play-wrap.wide { max-width: 860px; }

.lv-summary { display: flex; gap: 12px; margin: 0 0 20px; }
.lv-summary div {
  flex: 1; text-align: center; background: var(--card); border-radius: 16px;
  padding: 12px 8px; box-shadow: var(--shadow-sm);
}
.lv-summary b { display: block; font-size: 22px; }
.lv-summary span { font-size: 12px; color: color-mix(in srgb, var(--ink) 58%, transparent); }

.lv-list { display: grid; gap: 12px; }
.lv-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: var(--card); border-radius: 20px; padding: 14px 18px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.lv-card:hover:not(:disabled) {
  transform: translateX(4px); border-color: var(--honey); box-shadow: var(--shadow);
}
.lv-card:disabled { opacity: .5; cursor: not-allowed; }
.lv-card .lv-num {
  width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid;
  place-items: center; font-size: 23px; font-weight: 700;
  background: color-mix(in srgb, var(--honey) 26%, transparent); color: var(--ink);
}
.lv-card.champ .lv-num {
  background: linear-gradient(135deg, var(--honey), var(--amber)); color: var(--on-honey);
}
.lv-card .lv-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lv-card .lv-body b { font-size: 17px; }
.lv-card .lv-diff { font-size: 12.5px; color: color-mix(in srgb, var(--ink) 58%, transparent); }
.lv-card .lv-stars { font-size: 15px; letter-spacing: 2px; margin-top: 2px; }
.lv-card .lv-stars i { font-style: normal; color: color-mix(in srgb, var(--ink) 20%, transparent); }
.lv-card .lv-stars i.on { color: var(--honey); }
.lv-card .lv-side { flex: none; }
.lv-card .lv-go { font-weight: 700; color: var(--amber); font-size: 15px; }
.lv-card .lv-best { font-weight: 700; font-size: 17px; color: var(--leaf); }
.lv-card .lv-lock { font-size: 20px; }

/* The strip above a word: which rung, and the running score. */
.lv-strip { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.lv-pill {
  padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--honey) 22%, transparent); color: var(--ink);
}
.lv-pill.score { background: color-mix(in srgb, var(--leaf) 18%, transparent); color: var(--leaf); }

/* The clock. It turns amber with ten seconds left and red with five, so the
 * pressure is visible before it is a surprise. */
.clock { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.clock-track {
  flex: 1; height: 12px; border-radius: 8px; overflow: hidden; background: var(--card);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
}
.clock-fill { height: 100%; background: var(--leaf); transition: width 1s linear; }
.clock-fill.warn { background: var(--amber); }
.clock-fill.low { background: var(--berry); animation: sb-clock-pulse .8s ease-in-out infinite; }
.clock-label {
  font-size: 14px; font-weight: 700; min-width: 42px; text-align: right;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
}
.clock.stopped .clock-fill { animation: none; opacity: .35; }
@keyframes sb-clock-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.lv-card-q .qemoji.big { font-size: 76px; }
.lv-sentence {
  font-size: 18px; font-weight: 500; margin: 6px auto 2px; max-width: 46ch;
  color: color-mix(in srgb, var(--ink) 82%, transparent);
}

/* A letter the child was given, rather than one they worked out. */
.abox.given {
  background: color-mix(in srgb, var(--sky) 16%, transparent);
  border-color: color-mix(in srgb, var(--sky) 55%, transparent);
}

.key.wide { width: auto; padding: 0 16px; font-size: 15px; }
.key.go { background: var(--leaf); color: var(--on-leaf); }

.lv-result-stars { font-size: 42px; letter-spacing: 6px; }
.lv-result-stars i { font-style: normal; color: color-mix(in srgb, var(--ink) 18%, transparent); }
.lv-result-stars i.on { color: var(--honey); }
.lv-result-score { font-size: 46px; font-weight: 700; margin: 6px 0; }

@media (max-width: 620px) {
  .lv-card { padding: 12px 14px; gap: 12px; }
  .lv-card .lv-num { width: 44px; height: 44px; font-size: 19px; }
  .lv-summary b { font-size: 18px; }
  .lv-card-q .qemoji.big { font-size: 58px; }
}

/* Galaxy: the same lift the other cards get, so the quest belongs to the
   night sky too. */
[data-theme="galaxy"] .lv-card,
[data-theme="galaxy"] .lv-summary div,
[data-theme="galaxy"] .clock-track {
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}

/* Grade 3's practice panel is laid out as four rows of three rather than
   packed by width, because the twelve games are grouped in threes by what
   they ask: find the error, take the word apart, use it in a sentence, and
   so on. Below 900px it falls back to packing, where the grouping cannot
   survive anyway. */
.cat-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .cat-grid.three { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* A Grade 4 card is a place on the map: the location leads, and the game it
   holds is named underneath in the card's own accent colour. */
.cat.place .game {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--c, var(--amber)); margin: -2px 0 6px;
}

/* Some worlds carry a line saying what they are, not just what they are
   called. It sits quietly under the world name on the grade card. */
.grade-card .world-tag {
  margin-top: 4px; font-size: 11.5px; line-height: 1.35;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
}

/* The word a Context Clues question is about, picked out in its sentence so
   the child is not left hunting for it. */
.qcard .prompt mark {
  background: color-mix(in srgb, var(--honey) 34%, transparent);
  color: inherit; padding: 0 .18em; border-radius: 6px; font-weight: 700;
}

/* Grammar Temple and Scroll Hall offer whole sentences as answers, not single
   words. Two to a row would set them in columns barely wider than the text,
   so those questions stack their options instead. */
.opts.stack { grid-template-columns: 1fr; }
.opts.stack .opt { text-align: left; }

/* ── Mock tests ───────────────────────────────────────────────────────────
 * The list of papers, the score card at the end of one, the answer key, and
 * the report sheet that gathers them all up. Everything reads the theme
 * variables, so the papers look like whichever world the child is in. */
.mt-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: var(--card); border-radius: 20px; padding: 14px 18px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.mt-card:hover:not(:disabled) {
  transform: translateX(4px); border-color: var(--honey); box-shadow: var(--shadow);
}
/* A locked paper fades what is printed on it, not the card itself. Fading the
   whole card used to show the world's painting straight through it, and on
   Grades 4 to 6 a locked title stopped being readable. */
.mt-card:disabled { cursor: not-allowed; background: color-mix(in srgb, var(--card) 92%, transparent); }
.mt-card:disabled > * { opacity: .5; }
.mt-card .mt-num {
  width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid;
  place-items: center; font-size: 26px;
  background: color-mix(in srgb, var(--honey) 24%, transparent);
}
.mt-card.champ .mt-num {
  background: linear-gradient(135deg, var(--honey), var(--amber)); color: var(--on-honey);
}
.mt-card .mt-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mt-card .mt-body b { font-size: 17px; }
.mt-card .mt-meta { font-size: 12.5px; color: color-mix(in srgb, var(--ink) 58%, transparent); }
.mt-card .mt-focus { font-size: 12.5px; color: color-mix(in srgb, var(--ink) 74%, transparent); }
.mt-card .mt-stars { font-size: 14px; letter-spacing: 1px; margin-top: 2px; }
.mt-card .mt-stars i { font-style: normal; color: color-mix(in srgb, var(--ink) 20%, transparent); }
.mt-card .mt-stars i.on { color: var(--honey); }
.mt-card .mt-side { flex: none; }
.mt-card .mt-go { font-weight: 700; color: var(--amber); font-size: 15px; }
.mt-card .mt-best { font-weight: 700; font-size: 17px; color: var(--leaf); }
.mt-card .mt-lock { font-size: 20px; }

/* The banner naming the round a championship question belongs to. */
.round-banner {
  text-align: center; font-size: 14px; margin: 0 0 10px;
  padding: 7px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--honey) 20%, transparent);
}

/* The score card at the end of a paper. */
.mt-result-stars { font-size: 34px; letter-spacing: 4px; }
.mt-result-stars i { font-style: normal; color: color-mix(in srgb, var(--ink) 18%, transparent); }
.mt-result-stars i.on { color: var(--honey); }
.mt-scoreline { display: flex; gap: 10px; margin: 14px 0 8px; }
.mt-scoreline div {
  flex: 1; background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 14px; padding: 10px 6px;
}
.mt-scoreline b { display: block; font-size: 21px; }
.mt-scoreline span { font-size: 11.5px; color: color-mix(in srgb, var(--ink) 58%, transparent); }
.mt-tally { display: flex; gap: 14px; justify-content: center; font-size: 14px; font-weight: 600; }
.mt-tally .ok { color: var(--leaf); }
.mt-tally .no { color: var(--berry); }
.mt-ranout { color: var(--berry); font-weight: 600; }
.mt-unlock {
  margin: 12px 0 2px; font-weight: 700; color: var(--amber); font-size: 16px;
}

/* The answer key. A wrong answer is struck through so the right one is what
   the eye lands on. */
.ak-list { display: grid; gap: 10px; }
.ak-row {
  background: var(--card); border-radius: 16px; padding: 12px 16px;
  box-shadow: var(--shadow-sm); border-left: 5px solid var(--leaf);
}
.ak-row.no { border-left-color: var(--berry); }
.ak-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ak-head .ak-n {
  width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid;
  place-items: center; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
}
.ak-head .ak-q { flex: 1; font-size: 14.5px; font-weight: 600; }
.ak-head .ak-mark { font-size: 17px; }
.ak-line { display: flex; gap: 10px; font-size: 14px; margin-top: 3px; }
.ak-line .k {
  width: 84px; flex: none; font-size: 12.5px;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
}
.ak-line b.wrong { color: var(--berry); text-decoration: line-through; }
.ak-line b.right { color: var(--leaf); }

/* The report sheet. */
.score-sheet {
  background: var(--card); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.score-sheet h3 { font-size: 17px; margin-bottom: 14px; }
.ss-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.ss-grid div {
  text-align: center; background: color-mix(in srgb, var(--honey) 13%, transparent);
  border-radius: 13px; padding: 10px 4px;
}
.ss-grid b { display: block; font-size: 18px; }
.ss-grid span { font-size: 10.5px; color: color-mix(in srgb, var(--ink) 58%, transparent); }
.ss-skills { margin-top: 14px; display: grid; gap: 5px; }
.ss-skill { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.ss-skill span { flex: 1; }
.ss-skill b { letter-spacing: 1px; }
.ss-skill b i { font-style: normal; color: color-mix(in srgb, var(--ink) 18%, transparent); }
.ss-skill b i.on { color: var(--honey); }
.ss-skill em {
  font-style: normal; width: 42px; text-align: right; font-size: 12.5px;
  color: color-mix(in srgb, var(--ink) 58%, transparent);
}
.ss-best {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; font-size: 14px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
}
.ss-best span { color: color-mix(in srgb, var(--ink) 58%, transparent); }
.ss-best b { flex: 1; }
.ss-best em { font-style: normal; color: var(--leaf); font-weight: 700; }
.score-sheet .btn { margin-top: 14px; }

.btn.amber { background: var(--amber); color: #fff; }

@media (max-width: 760px) {
  .ss-grid { grid-template-columns: repeat(3, 1fr); }
  .mt-card { padding: 12px 14px; gap: 12px; }
  .mt-card .mt-num { width: 44px; height: 44px; font-size: 21px; }
  .ak-line { flex-direction: column; gap: 2px; }
  .ak-line .k { width: auto; }
}

/* In Spelling Detective the answer is the misspelt word, so it is shown as
   something to recognise rather than something to copy. */
.ak-line b.hunt { color: var(--amber); text-decoration: line-through; }

/* The championship card is the one the child is working towards, so it is
   allowed to look like it. */
.mt-result.champ .mt-result-stars { font-size: 40px; }
.mt-result.champ h2 { color: var(--amber); }
