/* =========================================================================
   Wonderpop design system
   Kid-first: huge tap targets, one idea per screen, chunky "pressable"
   surfaces, warm colours, no reading required to navigate.
   ========================================================================= */

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-latin.291a20cc77df.woff2") format("woff2-variations"),
       url("../fonts/Fredoka-latin.291a20cc77df.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --font: "Fredoka", "Nunito", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  --font-caps: Arial, Helvetica, sans-serif; /* tiny tracked-out labels read better in a plain grotesk */

  /* the play area: bright sky, white surfaces, deep-blue ink */
  --bg: #eaf7fc;
  --bg-2: #d9effc;
  --surface: #ffffff;
  --ink: #183d55;
  --ink-2: #526d7e;
  --ink-3: #7f95a5;
  --line: #dbe8ec;
  --line-2: #cfe4ef;

  /* brand + actions */
  --primary: #186fff;
  --primary-2: #0953b0;
  --primary-soft: #dcf0fe;
  --coral: #ff765c;
  --coral-2: #d8553d;
  --mango: #ffa839;
  --sun: #ffdf58;
  --sun-2: #be932b;
  --sun-soft: #fff1b8;
  --bubble: #ff7eb6;
  --bubble-2: #e6559a;
  --bubble-soft: #ffe1ef;
  --sky: var(--primary);
  --sky-2: var(--primary-2);
  --leaf: #64c8a0;
  --leaf-2: #44b18c;

  --letters: #ff6b6b;
  --letters-2: #d94e4e;
  --letters-soft: #ffe3e3;
  --numbers: #4d96ff;
  --numbers-2: #2f6fd6;
  --numbers-soft: #deebff;
  --shapes: #3cc46e;
  --shapes-2: #27a054;
  --shapes-soft: #ddf7e6;
  --listening: #9b5de5;
  --listening-2: #7a3fc7;
  --listening-soft: #ecdffb;

  --ok: #3cc46e;
  --ok-2: #27a054;
  --bad: #ff6b6b;

  --radius: 24px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow: 0 5px 0 #bed7e1, 0 10px 20px rgba(21, 87, 116, 0.05);
  --shadow-sm: 0 3px 0 #d0e5f0, 0 6px 14px rgba(21, 87, 116, 0.06);
  --tap: 64px;
  --gutter: clamp(12px, 3vw, 28px);
  --max: 1480px;

  /* the active skill world — overridden with data-skill */
  --skill: var(--primary);
  --skill-2: var(--primary-2);
  --skill-soft: var(--primary-soft);
}

[data-skill="letters"] { --skill: var(--letters); --skill-2: var(--letters-2); --skill-soft: var(--letters-soft); }
[data-skill="numbers"] { --skill: var(--numbers); --skill-2: var(--numbers-2); --skill-soft: var(--numbers-soft); }
[data-skill="shapes"] { --skill: var(--shapes); --skill-2: var(--shapes-2); --skill-soft: var(--shapes-soft); }
[data-skill="listening"] { --skill: var(--listening); --skill-2: var(--listening-2); --skill-soft: var(--listening-soft); }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sky-2); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.4em; font-weight: 600; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; border-radius: 8px; }
.emoji { font-family: var(--font-emoji); font-style: normal; line-height: 1; }
.tappable { touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

/* ---------- layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.stack > * + * { margin-top: var(--flow, 1rem); }
.cluster { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.hide-mobile { display: none; }
@media (min-width: 720px) { .hide-mobile { display: initial; } }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-shadow: rgba(38, 48, 77, 0.15);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0.55em 1.3em;
  border: 0; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: 1.05rem; text-decoration: none; line-height: 1.1;
  box-shadow: 0 5px 0 var(--btn-shadow);
  transform: translateY(0);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-shadow); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-shadow: var(--primary-2); }
.btn-skill { --btn-bg: var(--skill); --btn-fg: #fff; --btn-shadow: var(--skill-2); }
.btn-bubble { --btn-bg: var(--bubble); --btn-fg: #fff; --btn-shadow: var(--bubble-2); }
.btn-sky { --btn-bg: var(--sky); --btn-fg: #fff; --btn-shadow: var(--sky-2); }
.btn-ok { --btn-bg: var(--ok); --btn-fg: #fff; --btn-shadow: var(--ok-2); }
.btn-ghost { --btn-bg: transparent; --btn-shadow: transparent; box-shadow: inset 0 0 0 3px var(--line); }
.btn-ghost:active { transform: none; }
.btn-secondary { --btn-bg: var(--bg-2); --btn-fg: var(--ink); --btn-shadow: #b9d6e6; }
.btn-danger { --btn-bg: var(--bad); --btn-fg: #fff; --btn-shadow: var(--letters-2); }
.btn-big { min-height: var(--tap); font-size: clamp(1.25rem, 3vw, 1.6rem); padding: 0.5em 1.6em; }
.btn-block { width: 100%; }
.btn .emoji { font-size: 1.3em; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); font-size: 1.6rem; text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.is-speaking { animation: pulse 0.8s ease-in-out infinite; background: var(--sun-soft); }


/* =========================================================================
   Kid pages: header, rail, welcome, shelf
   ========================================================================= */
body.kid { background: var(--bg); }

.topbar {
  height: 84px; display: flex; align-items: center; gap: 26px; padding: 0 clamp(14px, 3vw, 35px);
  background: var(--surface); border-bottom: 1px solid #dbeaf0; position: sticky; top: 0; z-index: 20; min-width: 0;
}
.brand {
  display: inline-flex; align-items: center; font-size: 34px; letter-spacing: -1.6px; font-weight: 650; line-height: 1;
  color: #0c4861; text-decoration: none; white-space: nowrap;
}
.brand > span:not(.brand-spark) { color: var(--coral); }
.brand-spark { color: var(--mango); font-size: 40px; margin-right: 7px; }
.brand i { font-size: 10px; color: #ffb336; font-style: normal; align-self: flex-start; margin-top: 4px; margin-left: 2px; }
.brand-line { color: #6c8796; font-size: 15px; padding-top: 5px; }
.header-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; min-width: 0; flex-shrink: 1; }
.icon-button {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: #f0f8fc; border-radius: 50%; border: 0; font-size: 1.25rem; color: var(--ink);
}
.icon-button[aria-pressed="false"] { background: #fde7e1; }
.grownup-button {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: #526b7b; background: transparent;
  border: 0; min-height: 44px; padding: 0 6px; border-radius: 12px;
}
.grownup-button:hover { background: #f0f8fc; }
.profile {
  display: inline-flex; align-items: center; gap: 9px; border: 0; background: none; border-left: 1px solid #e1ebef;
  padding: 2px 4px 2px 18px; font-size: 17px; font-weight: 550; color: var(--ink); min-height: 44px; border-radius: 0 12px 12px 0;
  min-width: 0; flex-shrink: 1;
}
.profile > .emoji {
  display: grid; place-items: center; background: #fff0d7; border: 3px solid #fff; outline: 1px solid #f6dfbc;
  border-radius: 50%; height: 42px; width: 42px; font-size: 24px;
}
.profile .name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-layout { display: flex; min-height: calc(100dvh - 84px); }
.rail {
  width: 106px; flex-shrink: 0; display: flex; align-items: center; flex-direction: column; gap: 13px;
  padding: 32px 12px 24px; background: #f8fcfe; border-right: 1px solid #dcecf4;
}
.rail > a, .rail > button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 78px; height: 76px; border: 0; background: transparent; border-radius: 20px; color: #658599;
  font-size: 12px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.rail .emoji { font-size: 24px; line-height: 1; }
.rail > a.active, .rail > button.active { color: #1268b2; background: var(--primary-soft); box-shadow: inset 0 -3px 0 #cae4f8; }
.rail-spacer { flex: 1; min-height: 60px; }

.playground { max-width: var(--max); width: 100%; padding: 29px clamp(14px, 3vw, 34px) 10px; margin: 0 auto; min-width: 0; }

.welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { font-family: var(--font-caps); font-size: 11px; font-weight: 750; letter-spacing: 1.8px; color: #65879a; }
.eyebrow-link { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.welcome h1 {
  font-size: 32px; font-weight: 550; letter-spacing: -0.5px; line-height: 1.25; margin: 6px 0 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.welcome h1 .welcome-text { display: inline; }
.hello-button {
  background: #d7eef9; border: 0; border-radius: 50%; display: grid; place-items: center; width: 40px; height: 40px;
  flex-shrink: 0; color: #4a88a8; font-size: 1.05rem;
}
.surprise-button, .soft-button, .primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 14px;
  padding: 12px 19px; font-size: 16px; font-weight: 500; min-height: 46px; text-decoration: none; color: var(--ink);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s; cursor: pointer;
}
.surprise-button:active, .soft-button:active, .primary-button:active { transform: translateY(2px); }
.surprise-button { background: #fff; color: #3c6378; box-shadow: 0 3px 0 #d0e5f0; white-space: nowrap; }
.soft-button { background: #ecf4f8; color: #3c6378; }
.primary-button { color: #fff; background: #1678e7; box-shadow: 0 4px 0 #0953b0; font-size: 20px; padding: 15px 25px; }
.primary-button:disabled, .control-button:disabled { opacity: 0.45; cursor: default; transform: none; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.filters > button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: #fff9; color: #517387;
  border-radius: 24px; padding: 11px 18px; font-size: 14px; min-height: 42px; cursor: pointer;
}
.filters > button .emoji { font-size: 1.05rem; }
.filters > button.selected { background: #143f59; color: #fff; border-color: #143f59; box-shadow: 0 3px 0 #cce4f0; }

/* ---------- the shelf ---------- */
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.game-grid.mosaic { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 240px; }
.game-card {
  position: relative; border-radius: 24px; overflow: hidden; min-width: 0; border: 4px solid #fff;
  box-shadow: 0 5px 0 #bed7e1, 0 10px 20px #1557740c; transition: transform 0.2s, box-shadow 0.2s;
  min-height: 235px;
}
.game-card[hidden] { display: none; }
.game-card.featured { grid-column: span 2; grid-row: span 2; }
.game-card:hover { box-shadow: 0 7px 0 #9dbed0, 0 13px 25px #15577425; transform: translateY(-3px); }
.launch-game {
  display: block; width: 100%; height: 100%; background: transparent; text-align: left; border: 0; padding: 0;
  position: relative; color: #fff; min-height: 235px; text-decoration: none;
}
.game-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.game-card:hover .game-art { transform: scale(1.035); }
.card-caption {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 33px 17px 16px; background: linear-gradient(transparent, rgba(8, 30, 48, 0.85)); gap: 8px;
}
.card-caption-text { display: grid; gap: 3px; min-width: 0; }
.card-title { font-size: 23px; font-weight: 550; line-height: 1.05; letter-spacing: -0.3px; text-shadow: 0 2px 2px #0002; display: block; }
.card-subtitle { font-size: 17px; margin-top: 6px; color: #fffd; display: block; }
.skill-label { font-family: var(--font-caps); font-size: 11px; letter-spacing: 0.1px; font-weight: 600; color: #ffffffe0; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.card-meta .stars { display: inline-flex; gap: 1px; font-size: 14px; color: #ffffff66; }
.card-meta .stars .star.on { color: var(--sun); }
.level-pill { font-size: 11px; background: #ffffff33; border-radius: 8px; padding: 2px 7px; color: #fff; font-weight: 600; }
.play-disc {
  display: grid; place-items: center; width: 37px; height: 37px; background: #fff; color: #214e6a; border-radius: 50%;
  flex-shrink: 0; padding-left: 3px; font-size: 14px;
}
.featured .card-caption { padding: 100px 27px 27px; }
.featured .card-title { font-size: 39px; }
.featured .skill-label { font-size: 13px; }
.featured .play-disc { width: 62px; height: 62px; background: var(--sun); color: #305569; box-shadow: 0 4px 0 var(--sun-2); font-size: 22px; }
.game-tag {
  position: absolute; top: 20px; left: 20px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 9px; background: #fff1b8; color: #805021; font-family: var(--font-caps); font-size: 11px; font-weight: 800;
  letter-spacing: 0.5px; transform: rotate(-4deg);
}
.favorite-button {
  position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #fff5;
  display: grid; place-items: center; color: #fff; background: #12435e38; backdrop-filter: blur(6px); font-size: 20px;
  cursor: pointer; z-index: 2;
}
.favorite-button.saved { color: #fc637e; background: #fff; }
.together-card {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 25px; background: #fff8e8; border: 2px solid #ffedc2;
  border-radius: 24px; padding: 28px;
}
.together-card[hidden] { display: none; }
.together-card h2 { font-size: 29px; font-weight: 500; margin: 8px 0; }
.together-card p { font-size: 17px; color: #688096; margin: 0; }
.together-card .soft-button { margin-left: auto; background: #fff0c3; white-space: nowrap; }
.together-icon { font-size: 80px; color: #ffb845; line-height: 1; transform: rotate(-12deg); }
.footer { display: flex; align-items: center; gap: 25px; justify-content: space-between; padding: 28px 0 20px; color: #56788a; font-size: 13px; flex-wrap: wrap; }
.footer > span { display: inline-flex; align-items: center; gap: 6px; }
.footer a { color: #3c6378; }
.empty-shelf {
  grid-column: 1 / -1; background: #fff8; text-align: center; padding: 60px 24px; border-radius: 25px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-shelf[hidden] { display: none; }
.empty-shelf .emoji { font-size: 44px; color: #fc637e; }
.empty-shelf h2 { font-size: 28px; margin: 0; }
.empty-shelf p { margin: 0; color: #5f7c8e; }

/* ---------- stickers ---------- */
.sticker-shelf { display: grid; gap: 18px; }
.shelf-intro { color: #5f7c8e; margin: 0; max-width: 60ch; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.sticker-slot {
  display: grid; justify-items: center; gap: 6px; padding: 22px 14px 18px; background: #ffffffb3; border-radius: 22px;
  border: 2px dashed #bfd9e6; color: var(--ink); text-decoration: none; text-align: center;
}
.sticker-slot .sticker-art { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; display: none; border: 5px solid #fff; box-shadow: 0 4px 0 #cfe3ee; }
.sticker-slot .sticker-empty { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: #eaf3f8; color: #9ab6c7; font-size: 44px; }
.sticker-slot.earned { background: #fff; border-style: solid; border-color: #ffd86e; }
.sticker-slot.earned .sticker-art { display: block; }
.sticker-slot.earned .sticker-empty { display: none; }
.sticker-title { font-weight: 550; font-size: 17px; }
.sticker-slot small { color: #6e8a9b; }

/* ---------- grown-ups sheet: settings ---------- */
.parent-dialog { gap: 1rem; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting-row strong { display: block; font-size: 17px; }
.setting-row p { margin: 2px 0 0; color: #5f7c8e; font-size: 14px; }
.switch {
  flex-shrink: 0; width: 56px; height: 32px; border-radius: 999px; border: 0; background: #c9d9e2; position: relative;
  cursor: pointer; transition: background 0.15s;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px #0002; transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }
.parent-choice { border-top: 1px solid var(--line); padding-top: 12px; }
.parent-choice > strong { display: block; margin-bottom: 8px; }
.choice-buttons { display: flex; gap: 8px; }
.choice-buttons > button { flex: 1; min-height: 46px; border-radius: 12px; border: 2px solid #d6e5ee; background: #fff; font-weight: 500; cursor: pointer; }
.choice-buttons > button[aria-pressed="true"] { background: #143f59; color: #fff; border-color: #143f59; }
.choice-buttons > button:disabled { opacity: 0.5; cursor: default; }
.parent-choice > p { margin: 8px 0 0; color: #5f7c8e; font-size: 13px; }
.coplay-tip { background: #fff8e8; border: 2px solid #ffedc2; border-radius: 16px; padding: 12px 14px; }
.coplay-tip strong { display: block; margin-bottom: 4px; }
.coplay-tip p { margin: 0; color: #5f6f7a; font-size: 15px; }
.play-notes h3 { margin: 0 0 8px; font-size: 16px; }
.play-note { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.play-note strong span { color: #7f95a5; font-weight: 400; font-size: 12px; margin-left: 4px; }
.play-note p { margin: 2px 0; }
.play-note small { color: #7f95a5; }
.parent-note { font-size: 13px; color: #5f7c8e; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1150px) {
  .brand-line { display: none; }
  .rail { width: 86px; padding-left: 4px; padding-right: 4px; }
  .game-grid.mosaic { grid-auto-rows: 210px; gap: 16px; }
  .card-title { font-size: 21px; }
  .featured .card-title { font-size: 34px; }
  .together-card { padding: 22px; gap: 15px; }
  .together-card h2 { font-size: 25px; }
  .together-icon { display: none; }
  .together-card .soft-button { white-space: normal; }
  .welcome h1 { font-size: 29px; }
}
@media (max-width: 880px) {
  .topbar { padding: 0 16px; height: 72px; gap: 12px; }
  .brand { font-size: 28px; }
  .brand-spark { font-size: 32px; }
  .grownup-button span:not(.emoji) { display: none; }
  .profile { padding-left: 10px; }
  .profile .name { max-width: 6em; }
  .rail { width: 76px; }
  .rail > a, .rail > button { width: 67px; font-size: 11px; }
  .playground { padding: 20px 16px; }
  .welcome { align-items: flex-start; }
  .welcome h1 { font-size: 26px; }
  .surprise-button { padding: 12px; font-size: 14px; }
  .filters { gap: 7px; }
  .filters > button { padding: 10px 12px; font-size: 13px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .game-grid.mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 200px; }
  .game-card.featured { grid-column: 1 / -1; grid-row: span 2; }
  .together-card { min-height: 0; }
}
@media (max-width: 640px) {
  .app-layout { flex-direction: column; min-height: 0; }
  .rail {
    width: auto; flex-direction: row; justify-content: space-around; gap: 4px; padding: 8px 6px;
    border-right: 0; border-bottom: 1px solid #dcecf4; position: sticky; top: 72px; z-index: 19;
  }
  .rail > a, .rail > button { width: auto; min-width: 70px; height: 58px; gap: 3px; }
  .rail .emoji { font-size: 20px; }
  .rail-spacer { display: none; }
  .welcome { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 16px; }
  .welcome h1 { font-size: 23px; }
  .welcome .eyebrow { font-size: 9px; letter-spacing: 1px; }
  .surprise-button { flex-shrink: 0; font-size: 12px; padding: 10px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
  .filters > button { flex-shrink: 0; min-height: 44px; }
  .game-grid, .game-grid.mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; gap: 12px; }
  .game-card, .launch-game { min-height: 190px; }
  .card-caption { padding: 38px 10px 12px; }
  .card-title { font-size: 19px; }
  .card-caption .play-disc { display: none; }
  .featured .card-caption .play-disc { display: grid; width: 48px; height: 48px; }
  .game-card.featured { grid-row: auto; min-height: 215px; }
  .featured .card-caption { padding: 60px 18px 18px; }
  .featured .card-title { font-size: 28px; }
  .together-card { flex-direction: column; align-items: flex-start; }
  .together-card .soft-button { margin-left: 0; }
  .footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .sticker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .sticker-slot .sticker-art, .sticker-slot .sticker-empty { width: 96px; height: 96px; }
}
@media (min-width: 641px) and (max-width: 880px) {
  .game-grid.mosaic .game-card:not(.featured) { min-height: 200px; }
}
@media (max-width: 480px) {
  .brand { font-size: 24px; letter-spacing: -1px; }
  .brand-spark { font-size: 26px; margin-right: 4px; }
  .header-actions { gap: 6px; }
  .profile { border-left: 0; padding-left: 4px; }
  .profile .name { display: none; }
}

/* =========================================================================
   The play screen: one frame for every game
   ========================================================================= */
body.play { background: var(--bg); }
.game-room { max-width: 1120px; margin: 0 auto; padding: 14px clamp(10px, 2.5vw, 24px) 10px; display: grid; gap: 0; }
.game-room-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-room-title { text-align: center; min-width: 0; }
.game-room-title h1 { font-size: clamp(20px, 3.4vw, 30px); line-height: 1.2; font-weight: 550; margin: 2px 0 0; }
.game-room-title > span { font-size: 12px; color: #577e92; }
.pace-label { font-size: 13px; color: #5e8190; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pace-label > span { color: #f6ad37; font-size: 21px; }

.game-prompt {
  background: var(--surface); border-radius: 22px 22px 0 0; display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border: 1px solid #dceaf1; border-bottom: 0;
}
.game-prompt .host { font-size: clamp(2rem, 6vmin, 3rem); flex: none; }
.game-prompt img.host { width: clamp(44px, 9vmin, 64px); height: clamp(44px, 9vmin, 64px); border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 3px 0 #cfe3ee; }
.game-prompt .host.talking { animation: wiggle 0.6s ease-in-out infinite; }
.prompt-text { flex: 1; min-width: 0; }
.game-prompt h2 { font-size: clamp(1.15rem, 3.2vmin, 1.7rem); font-weight: 500; margin: 0; line-height: 1.2; }
.game-prompt h2 .big { font-size: 1.5em; font-weight: 700; color: var(--skill-2); }
.game-prompt h2 .emoji { font-size: 1.35em; }
.game-prompt p { font-size: 15px; color: #567a8f; margin: 4px 0 0; }
.game-prompt p[hidden] { display: none; }
.replay-prompt {
  background: #e9f5fc; color: #397594; border: 0; border-radius: 14px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 12px 16px; flex-shrink: 0; min-height: 46px; cursor: pointer;
}
.replay-prompt.is-speaking { animation: pulse 0.8s ease-in-out infinite; background: var(--sun-soft); }

.stage {
  position: relative; overflow: hidden; isolation: isolate; padding: 10px;
  height: max(300px, min(calc(100dvh - 330px), 560px));
  background: #dbf4f6; border: 5px solid #fff; box-shadow: 0 5px 0 #c9e1ed; border-radius: 0 0 24px 24px;
}
.stage-inner { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 10px; min-height: 0; }
.dots-row { display: flex; justify-content: center; padding: 12px 0 0; min-height: 40px; }
.dots { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.dots span {
  width: 26px; height: 26px; border-radius: 50%; background: #d9eaf2; border: 2px solid #c6dfe9; color: #6b91a4;
  font-size: 12px; display: grid; place-items: center; transition: transform 0.2s, background 0.2s;
}
.dots span.done { background: var(--leaf); border-color: var(--leaf-2); color: #fff; }
.dots span.now { border-color: var(--skill); box-shadow: 0 0 0 4px var(--skill-soft); }
.game-feedback { min-height: 22px; text-align: center; margin: 4px 0 6px; color: #54768a; font-size: 14px; line-height: 1.5; }
.communication-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 0; padding: 14px 0 6px;
  border-top: 1px solid var(--line-2); flex-wrap: wrap;
}
.communication-bar > button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 51px; background: #fff; border: 1px solid #d9e8f0;
  border-radius: 15px; padding: 12px 18px; color: #41647c; font-size: 16px; box-shadow: 0 2px 0 #d0e3ed; cursor: pointer;
}
.communication-bar > button .emoji { font-size: 1.2rem; }
.communication-bar > button:first-child { background: #fff6dc; border-color: #f4dfa4; color: #6d4e13; }
.communication-note { color: #7f95a5; font-size: 13px; margin-left: 8px; }

@media (max-width: 640px) {
  .finish-card { gap: 0.4rem; padding: 0.9rem 1rem; }
  .finish-card .finish-sticker { width: 88px; }
  .finish-card .actions { margin-top: 0.2rem; gap: 0.45rem; }
  .finish-card .actions .btn { min-height: 50px; font-size: 1.1rem; }
  .finish-card .break-button { padding: 2px; font-size: 14px; }
  .game-room-header { gap: 8px; }
  .game-room-header > .soft-button { padding: 10px; font-size: 13px; }
  .game-sound { width: 46px; height: 46px; flex-shrink: 0; }
  .game-sound #sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pace-label { display: none; }
  .game-room-title { flex: 1; text-align: center; }
  .game-room-title h1 { font-size: 18px; }
  .game-room-title > span { display: none; }
  .game-prompt { padding: 10px 12px; gap: 10px; }
  .replay-prompt span:not(.emoji) { display: none; }
  .replay-prompt { padding: 12px; }
  .communication-bar { gap: 6px; }
  .communication-bar > button { padding: 12px 10px; font-size: 14px; }
  .communication-note { width: 100%; text-align: center; margin: 4px 0 0; }
  .stage { height: max(280px, min(calc(100dvh - 330px), 520px)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .game-room { padding-top: 6px; }
  .game-room-header { margin-bottom: 6px; }
  .game-prompt { padding: 8px 12px; }
  .game-prompt .host { font-size: 1.6rem; }
  .stage { height: calc(100dvh - 210px); }
  .dots-row { padding-top: 6px; min-height: 30px; }
  .communication-bar { padding: 8px 0 4px; }
  .communication-bar > button { min-height: 44px; padding: 8px 12px; }
}

/* ---------- start / finish cards ---------- */
.overlay-card .card-art { width: clamp(96px, 26vmin, 160px); height: auto; border-radius: 28px; border: 4px solid #fff; box-shadow: 0 4px 0 #cfe3ee; }
.overlay-card .eyebrow:empty { display: none; }
.finish-card .finish-sticker { width: clamp(96px, 26vmin, 150px); height: auto; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 5px 0 #ffd86e, 0 8px 20px #1557741f; animation: bob 1.8s ease-in-out infinite; }
.finish-card .finish-sticker[hidden], .big-stars[hidden] { display: none; }
.finish-stretch { display: grid; justify-items: center; gap: 8px; width: 100%; }
.break-button { border: 0; background: transparent; color: #4a88a8; font-size: 15px; text-decoration: underline; cursor: pointer; padding: 6px; }
.stretch-note { margin: 0; background: #fff8e8; border: 2px solid #ffedc2; border-radius: 14px; padding: 10px 14px; font-size: 15px; }
.stretch-note[hidden] { display: none; }

/* =========================================================================
   Open-ended activity scenes
   ========================================================================= */
.scene { position: relative; flex: 1; min-height: 0; border-radius: 16px; overflow: hidden; isolation: isolate; background: #dbf4f6; }
.scene-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.3; filter: blur(2px); transform: scale(1.06); pointer-events: none; }
.scene-pill {
  position: absolute; top: 12px; left: 12px; padding: 8px 12px; background: #fffef6; border-radius: 10px; font-size: 13px;
  font-weight: 500; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 4px #173e6120; z-index: 8;
}
.scene-controls { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 0 0; flex: none; flex-wrap: wrap; }
.control-button {
  display: inline-flex; align-items: center; justify-content: center; height: 64px; width: 84px; border: 2px solid #d4e6f0;
  background: #fff; color: #2d607d; border-radius: 17px; box-shadow: 0 4px 0 #c3dce9; touch-action: none; user-select: none;
  -webkit-user-select: none; font-size: 28px; cursor: pointer;
}
.control-button:active:not(:disabled), .control-button.held { transform: translateY(3px); box-shadow: 0 1px 0 #c3dce9; background: #eaf5fb; }
.hint-glow { outline: 4px solid #ffd25c; outline-offset: 4px; animation: hint-glow 1s ease-in-out infinite; }

/* Rainbow Rally: a little neighborhood built through purposeful deliveries. */
.rally-neighborhood { background: #dcefc1; container-type: size; }
.rally-neighborhood [hidden] { display: none; }
.rally-neighborhood svg, .rally-controls svg { display: block; width: 100%; height: 100%; }
.rally-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.rally-roads { position: absolute; inset: 0; pointer-events: none; }
.rally-home { position: absolute; top: 2%; width: 27%; height: 44%; border: 0; padding: 0; border-radius: 25%; background: transparent; transform: translateX(-50%); z-index: 3; cursor: pointer; color: #493f35; }
.rally-home:disabled { cursor: default; opacity: 1; }
.rally-home-art { display: block; width: 100%; height: 100%; filter: drop-shadow(0 4px 2px #657b5620); }
.rally-home.selected::before { content: ""; position: absolute; inset: 8% 5% 2%; background: #ffffff7d; border: 3px solid var(--house-color); border-radius: 24px; z-index: -1; }
.rally-resident { position: absolute; bottom: 13%; left: 62%; width: 27%; max-width: 48px; aspect-ratio: 1; background: #fff8e8; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 4px #51593730; }
.rally-home-name { position: absolute; left: 50%; bottom: -2%; transform: translateX(-50%); padding: 2px 10px; border-radius: 10px; background: #fff9e9; font-size: clamp(12px, 2.8cqw, 16px); line-height: 1.3; font-weight: 700; box-shadow: 0 2px 0 #b7c994; }
.rally-truck { position: absolute; width: clamp(54px, 11cqw, 82px); height: auto; aspect-ratio: 2 / 3; z-index: 5; transform: translate(-50%, -50%) rotate(var(--truck-turn, 0deg)) scale(var(--truck-scale, 1)); filter: drop-shadow(0 5px 3px #304b3e35); pointer-events: none; }
.rally-truck-art { display: block; width: 100%; height: 100%; }
.rally-truck-cargo { position: absolute; top: 57%; left: 22%; width: 56%; height: 29%; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 1px; }
.rally-cargo-slot { width: 44%; max-width: 28px; aspect-ratio: 1; border: 1px dashed #8caa9a; border-radius: 4px; background: #e0edb877; }
.rally-cargo-slot.filled { border-color: transparent; background: transparent; }
.rally-loaded-picture { display: block; width: 100%; height: 100%; }
.rally-neighborhood[data-phase="load"] .rally-truck { left: 50% !important; top: 73% !important; width: clamp(74px, 16cqw, 110px); }
.rally-neighborhood[data-phase="ready"] .rally-truck { transition: left .25s ease; }
.rally-delivery-badge, .rally-address { position: absolute; bottom: 10px; padding: 6px 10px; border: 2px solid #fff; background: #fff9e8; border-radius: 14px; color: #576347; box-shadow: 0 2px 5px #395c391c; font-size: 13px; font-weight: 700; z-index: 6; }
.rally-delivery-badge { left: 10px; }
.rally-address { right: 10px; display: flex; align-items: center; gap: 5px; padding: 3px 8px; }
.rally-address-face { display: block; width: 31px; height: 31px; }
.rally-address b { font-size: 22px; line-height: 1; }
.rally-reward { position: absolute; left: 50%; top: 48%; width: 23%; max-width: 140px; transform: translateX(-50%); z-index: 4; pointer-events: none; }
.rally-reward-art { display: block; aspect-ratio: 16 / 11; filter: drop-shadow(0 3px 3px #3c5a2920); }
.rally-visit-count { display: block; color: #d65b62; font-size: 17px; text-align: center; line-height: 1; text-shadow: 0 1px white; }
.rally-arrival { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); z-index: 7; padding: 8px 18px; white-space: nowrap; background: #fff9e8; border: 3px solid #fff; box-shadow: 0 4px 0 #b5c794; border-radius: 20px; color: #684c33; font-weight: 700; font-size: clamp(18px, 4cqw, 24px); }
.rally-neighborhood[data-phase="arrived"] .rally-truck { visibility: hidden; }
.rally-controls { flex: none; display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 108px; padding: 3px 0 5px; }
.rally-parcels, .rally-loading { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.rally-parcel, .rally-load-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: clamp(85px, 19vw, 130px); min-height: 100px; gap: 1px; padding: 7px 13px; border: 3px solid #d4e2ba; border-radius: 19px; background: #fffbed; box-shadow: 0 4px 0 #b1c3a3; cursor: pointer; color: #514b38; font-size: 15px; font-weight: 700; }
.rally-parcel { border-color: var(--parcel-color); box-shadow: 0 4px 0 color-mix(in srgb, var(--parcel-color) 70%, #8d8c67); }
.rally-cargo-picture { display: block; width: 58px; height: 58px; }
.rally-parcel-friend { position: absolute; top: -10px; right: -5px; width: 33px; height: 33px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 #d4dfbd; }
.rally-parcel-shape { position: absolute; top: 4px; left: 7px; font-size: 17px; color: var(--parcel-color); }
.rally-load-item.loaded { opacity: .35; box-shadow: none; }
.rally-controls .go-button { min-width: 140px; }
.rally-controls .go-button.rally-ready { box-shadow: 0 4px 0 #348148, 0 0 0 4px #e5edac; background: #4a9d60; }
.rally-hint { outline: 4px solid #e9b82f; outline-offset: 3px; }
.rally-thankful .rally-resident { animation: rally-wave .8s ease-in-out 2; }
@keyframes rally-wave { 25% { transform: rotate(-12deg) scale(1.15); } 75% { transform: rotate(12deg) scale(1.15); } }
@media (max-width: 520px) {
  .rally-controls { min-height: 99px; gap: 10px; }
  .rally-parcels, .rally-loading { gap: 10px; }
  .rally-parcel, .rally-load-item { width: 86px; min-height: 91px; padding: 5px 8px; font-size: 14px; }
  .rally-cargo-picture { width: 52px; height: 52px; }
  .rally-home { width: 31%; }
  .rally-neighborhood[data-homes="2"] .rally-home { width: 39%; }
  .rally-delivery-badge { font-size: 11px; padding: 5px 7px; left: 6px; bottom: 7px; }
  .rally-address { font-size: 12px; right: 6px; bottom: 7px; }
  .rally-controls .control-button { width: 64px; height: 60px; }
  .rally-controls .go-button { min-width: 120px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .rally-controls { min-height: 64px; }
  .rally-parcel, .rally-load-item { min-height: 60px; height: 60px; flex-direction: row; width: 120px; padding: 3px; }
  .rally-cargo-picture { width: 43px; height: 43px; }
  .rally-parcel-shape { display: none; }
  .rally-home { height: 51%; }
  .rally-resident, .rally-home-name { display: none; }
  .rally-truck { width: 36px; }
  .rally-neighborhood[data-phase="load"] .rally-truck { width: 48px; }
  .rally-controls .control-button { height: 50px; }
  .rally-delivery-badge, .rally-address { bottom: 4px; font-size: 11px; padding: 2px 6px; }
  .rally-address-face { width: 24px; height: 24px; }
  .rally-arrival { bottom: 8%; font-size: 16px; padding: 4px 10px; }
  .rally-reward { top: 45%; width: 15%; max-width: 80px; }
}

/* Snack Safari */
.snack-scene { display: grid; place-items: center; }
.snack-scene .scene-art { opacity: 0.45; filter: none; }
.hungry-friend { position: relative; z-index: 2; border: 0; background: transparent; display: grid; justify-items: center; gap: 10px; padding: 12px; cursor: pointer; border-radius: 30px; }
.hungry-friend:disabled { cursor: default; }
.friend-face { width: clamp(120px, 34vmin, 220px); height: clamp(120px, 34vmin, 220px); border-radius: 50%; object-fit: cover; border: 6px solid #fff; box-shadow: 0 6px 0 #d7c2cf; transition: transform 0.3s; }
.hungry-friend.ready .friend-face { animation: pulse 0.9s ease-in-out infinite; }
.hungry-friend.eating .friend-face { transform: scale(1.06) rotate(-4deg); }
.snack-bubble { background: #fff; border-radius: 18px; padding: 10px 16px; font-size: 20px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 3px 0 #dbe8ec; }
.snack-bubble .emoji { font-size: 28px; }
.feed-button { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; border-radius: 14px; padding: 10px 16px; font-size: 16px; box-shadow: 0 4px 0 var(--primary-2); }
.snack-celebration { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font-size: 56px; color: #fc637e; animation: heart-pop 1.1s ease-out both; pointer-events: none; z-index: 5; }
.snack-tray, .piece-tray { display: flex; justify-content: center; gap: 12px; padding: 8px 0 0; flex: none; flex-wrap: wrap; }
.food-button, .piece-button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px; min-height: 96px; padding: 10px 14px; background: #fff;
  border: 3px solid #d9e8f0; border-radius: 18px; font-size: 16px; font-weight: 500; color: var(--ink); box-shadow: 0 4px 0 #d0e3ed; cursor: pointer;
}
.food-button > .emoji { font-size: 44px; }
.food-button.picked, .piece-button.picked { border-color: var(--primary); background: #e8f2ff; box-shadow: 0 4px 0 #9cc3f4; }

/* Bubble Buddies */
.bubble-scene .scene-art { opacity: 0.5; filter: none; }
.bubble-target {
  position: absolute; width: clamp(72px, 20vmin, 118px); height: clamp(72px, 20vmin, 118px); transform: translate(-50%, -50%); border-radius: 50%;
  border: 0; cursor: pointer; z-index: 3; display: grid; place-items: center; color: #fff; font-size: 34px;
  background: radial-gradient(circle at 32% 30%, #ffffffee, #bfe6ffcc 45%, #7cc7ff99 75%, #4aa8f5aa);
  box-shadow: inset 0 0 0 3px #ffffff99, 0 6px 14px #1a5c9420; animation: bubble-float 3.2s ease-in-out infinite; animation-delay: var(--bubble-delay, 0s);
}
.bubble-target > span { font-size: 22px; color: #ffffffcc; }
.bubble-target.popped { background: transparent; box-shadow: none; animation: none; color: #ffd25c; font-size: 46px; pointer-events: none; }
.bubble-target.popped > span { font-size: 46px; color: #ffd25c; animation: popin 0.3s ease both; }
.bubble-count { position: absolute; right: 12px; bottom: 12px; background: #fff; border-radius: 18px; padding: 8px 16px; display: grid; justify-items: center; box-shadow: 0 3px 0 #cfe3ee; z-index: 4; }
.bubble-count strong { font-size: 40px; line-height: 1; color: var(--primary); }
.bubble-count span { font-size: 12px; color: #6b8799; }

/* Little Builder */
.build-scene { background: linear-gradient(#e9f1ff, #ddebff); }
.build-scene .scene-art { opacity: 0.35; }
.workshop-friend { position: absolute; left: 14px; bottom: 44px; width: clamp(70px, 20vmin, 130px); height: clamp(70px, 20vmin, 130px); border-radius: 50%; overflow: hidden; border: 5px solid #fff; box-shadow: 0 4px 0 #c2cfe9; z-index: 2; }
.workshop-friend img { width: 100%; height: 100%; object-fit: cover; }
.building-zone {
  position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); width: min(60%, 260px); height: calc(100% - 70px);
  border: 4px dashed #9cc3f4; border-radius: 18px; background: #ffffff66; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; z-index: 3; padding: 0;
}
.building-zone:disabled { cursor: default; border-color: #c7d9ea; }
.building-zone.ready { border-color: var(--primary); background: #e8f2ff99; }
.building-piece { width: 60%; height: clamp(34px, 9vmin, 56px); background: var(--piece-color); border-radius: 8px; box-shadow: 0 4px 0 #0002; animation: popin 0.3s ease both; }
.building-piece.arch { border-radius: 40% 40% 8px 8px; }
.building-piece.roof { clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; width: 72%; }
.build-target { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #4a7fa8; font-size: 18px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; pointer-events: none; }
.place-label { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; border-radius: 12px; padding: 6px 12px; font-size: 14px; pointer-events: none; }
.building-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: #8fd07a; border-top: 6px solid #6fbf57; z-index: 1; }
.builder-car { position: absolute; bottom: 8px; left: -120px; font-size: 52px; z-index: 4; line-height: 1; }
.builder-car.drive-through { animation: drive-through 2s ease-in-out both; }
.mini-piece { width: 44px; height: 30px; background: #62ceda; border-radius: 6px; }
.mini-piece.arch { border-radius: 40% 40% 6px 6px; background: #ffa163; }
.mini-piece.roof { clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #b88eec; border-radius: 0; }

/* Star Hop */
.hop-scene { background: linear-gradient(#1a2a5e, #3b4f9a 70%, #24427a); }
.hop-scene .scene-art { opacity: 0.22; filter: blur(1px); }
.hop-world { position: absolute; inset: 0; }
.hop-platform { position: absolute; height: 22px; background: #ffb570; border-radius: 12px; box-shadow: 0 5px 0 #c97e3b; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 12px; }
.hop-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 13%; background: #6dcf7a; border-top: 5px solid #4caf5f; }
.hop-star { position: absolute; transform: translate(-50%, -50%); font-size: clamp(30px, 8vmin, 46px); color: #ffd25c; text-shadow: 0 0 12px #ffd25c99; animation: twinkle 1.6s ease-in-out infinite; }
.hop-star.collected { opacity: 0; transform: translate(-50%, -50%) scale(2); transition: opacity 0.4s, transform 0.4s; animation: none; }
.hop-player { position: absolute; width: 5%; font-size: clamp(36px, 10vmin, 60px); line-height: 1; transform: translateY(-100%); z-index: 3; display: grid; place-items: center; }
.hop-player.jumping { filter: drop-shadow(0 8px 6px #0004); }
.hop-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 0; flex: none; }
.direction-controls { display: flex; gap: 10px; }
.jump-button { min-width: 140px; }
.hop-start-hint { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); background: #fff; color: var(--ink); padding: 8px 16px; border-radius: 16px; font-size: 17px; z-index: 5; pointer-events: none; box-shadow: 0 3px 0 #cfe3ee; }
/* Star Hop levels: scrolling worlds, numbered stars in order, springs and sliders */
.hop-world.scrolls { will-change: transform; }
.hop-platform.moving { background: #8fd3ff; box-shadow: 0 5px 0 #3f8fc2; }
.hop-platform.spring { background: repeating-linear-gradient(135deg, #ff9ad5 0 10px, #ff6fc0 10px 20px); box-shadow: 0 5px 0 #b33f86; font-size: 11px; letter-spacing: 0.04em; }
.hop-star.numbered {
  width: clamp(38px, 9vmin, 54px); height: clamp(38px, 9vmin, 54px); border-radius: 50%; background: #ffd25c; color: #7a4a00;
  display: grid; place-items: center; font-weight: 700; font-size: clamp(16px, 4.2vmin, 24px); text-shadow: none; border: 3px solid #fff;
  box-shadow: 0 0 14px #ffd25c99, 0 3px 0 #be932b;
}
.hop-star.later { opacity: 0.55; animation: none; }
.hop-star.next { box-shadow: 0 0 0 5px #fff8, 0 0 18px 6px #ffd25c; }
.hop-star.bump { animation: shake 0.45s ease; }
.hop-player.boing { filter: drop-shadow(0 0 10px #ff9ad5); }
html.quiet .hop-star.numbered { animation: none; }

/* Arcade scenes on a short landscape phone: controls beside the scene, so the
   world, the snake board and the block board keep the whole stage height. */
@media (orientation: landscape) and (max-height: 480px) {
  .stage:has(> .stage-inner > :is(.hop-scene, .snake-scene, .block-scene)) { height: calc(100dvh - 190px); min-height: 160px; }
  .stage-inner:has(> :is(.hop-scene, .snake-scene, .block-scene)) { flex-direction: row; align-items: stretch; gap: 8px; }
  .stage-inner:has(> :is(.hop-scene, .snake-scene, .block-scene)) > .scene { flex: 1; height: 100%; }
  .hop-controls, .hop-assisted-controls, .snake-controls, .block-controls { flex: none; flex-direction: column; justify-content: center; align-content: center; gap: 8px; padding: 0; }
  .hop-controls .control-button, .block-btn { height: 50px; width: 62px; }
  .hop-controls .jump-button { min-width: 134px; min-height: 50px; }
  .hop-assisted-controls { max-width: 150px; }
  .hop-forward-button { min-height: 50px; font-size: 18px; }
  .snake-btn { width: 56px; height: 44px; }
  .block-controls .direction-controls { gap: 6px; }
  .block-drop { min-width: 120px; min-height: 48px; }
  .block-scene { padding: 6px; gap: 6px; }
  .block-side { width: 70px; }
  .block-next { margin-top: 4px; padding: 4px; }
  .block-mini { grid-template-columns: repeat(var(--w), 10px); grid-template-rows: repeat(var(--h), 10px); }
  .hop-star.numbered { width: 28px; height: 28px; font-size: 14px; border-width: 2px; }
  .hop-start-hint { font-size: 13px; padding: 4px 10px; }
}

/* Dino Match presentation (Memory Match) */
.memory-scene { display: flex; flex-direction: column; padding: clamp(8px, 2vmin, 16px); } /* .cards needs a definite height */
.memory-scene .scene-art { opacity: 0.4; filter: none; }
.memory-scene .cards { position: relative; z-index: 2; }
[data-scene="memory-match"] .card3d .front { background: linear-gradient(135deg, #a9e08a, #6cc46f); border: 4px solid #fff; }
[data-scene="memory-match"] .card3d .front::after { content: "🦕"; font-size: 0.6em; }

/* ---------- quiet play: less decorative movement, essentials keep working ---------- */
html.quiet *, html.quiet *::before, html.quiet *::after { animation: none !important; transition: none !important; }
html.quiet .game-card:hover, html.quiet .game-card:hover .game-art { transform: none; }
html.quiet .builder-car.drive-through { animation: drive-through 2s linear both !important; }
html.quiet .hop-star.collected { transition: opacity 0.2s !important; }
html.quiet .bubble-target { animation: none !important; }

@keyframes heart-pop { 0% { transform: translateX(-50%) scale(0.4); opacity: 0; } 30% { transform: translateX(-50%) scale(1.2); opacity: 1; } 100% { transform: translateX(-50%) translateY(-60px) scale(1); opacity: 0; } }
@keyframes bubble-float { 0%, 100% { transform: translate(-50%, -50%) translateY(0); } 50% { transform: translate(-50%, -50%) translateY(-10px); } }
@keyframes drive-through { from { left: -120px; } to { left: calc(100% + 40px); } }
@keyframes hint-glow { 0%, 100% { outline-color: #ffd25c; } 50% { outline-color: #ffb300; } }
@keyframes twinkle { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.15); } }

/* choice grid: sized by count and orientation */
.choices { display: grid; gap: clamp(8px, 2vmin, 18px); width: 100%; height: 100%; align-content: center; justify-content: center; }
.choices[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices[data-count="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (orientation: landscape) {
  .choices[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choices[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (orientation: portrait) and (max-width: 480px) {
  .choices[data-count="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choices[data-count="3"] > :last-child { grid-column: 1 / -1; justify-self: center; width: 50%; }
}
.choice {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; width: 100%; max-height: 100%; min-height: var(--tap);
  border: 5px solid var(--skill-soft); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--skill) 35%, white);
  font-weight: 700; font-size: clamp(2.4rem, 16vmin, 7rem); line-height: 1;
  transition: transform 0.1s, border-color 0.15s, opacity 0.2s;
  animation: popin 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden; padding: 6%;
}
.choice .emoji { font-size: 1em; }
.choice svg { width: 78%; height: 78%; }
.choice:active { transform: translateY(4px) scale(0.98); }
.choice.correct { border-color: var(--ok); background: #f1fff5; animation: bounce 0.6s ease; }
.choice.wrong { animation: shake 0.45s ease; opacity: 0.45; pointer-events: none; }
.choice.hint { animation: wiggle 0.7s ease-in-out 3; border-color: var(--sun); box-shadow: 0 0 0 6px var(--sun-soft), 0 6px 0 var(--sun-2); }
.choice.locked { pointer-events: none; }
.choice .caption { position: absolute; bottom: 4%; left: 0; right: 0; font-size: 0.22em; font-weight: 600; color: var(--ink-2); text-align: center; }
.choice.small-glyph { font-size: clamp(1.8rem, 10vmin, 4rem); }
.choice.text-only { font-size: clamp(1.2rem, 5vmin, 2rem); text-align: center; }

.choices > .choice:nth-child(2) { animation-delay: 0.06s; }
.choices > .choice:nth-child(3) { animation-delay: 0.12s; }
.choices > .choice:nth-child(4) { animation-delay: 0.18s; }
.choices > .choice:nth-child(5) { animation-delay: 0.24s; }
.choices > .choice:nth-child(6) { animation-delay: 0.30s; }
.choices > .choice:nth-child(7) { animation-delay: 0.36s; }
.choices > .choice:nth-child(8) { animation-delay: 0.42s; }

/* a focal "look at this" panel above the choices (prompt picture, pattern strip...) */
.focus-panel {
  display: flex; align-items: center; justify-content: center; gap: clamp(6px, 2vmin, 16px);
  padding: clamp(8px, 2vmin, 16px); background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); flex: none; min-height: 90px;
  font-size: clamp(2rem, 9vmin, 4.5rem); font-weight: 700; line-height: 1;
}
.focus-panel .slot {
  width: 1.1em; height: 1.1em; border-radius: 18%; border: 4px dashed var(--skill);
  display: flex; align-items: center; justify-content: center; color: var(--skill); font-size: 0.7em;
}
.focus-panel .item { font-size: 1em; }
.stage-inner.has-panel .choices { height: auto; flex: 1; min-height: 0; }
.stage-inner.has-panel .choice { max-height: 100%; }

/* object field for counting */
.field {
  display: grid; gap: clamp(6px, 2vmin, 14px); justify-content: center; align-content: center;
  flex: 1; min-height: 0; padding: 0.5rem;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  max-width: 720px; margin-inline: auto; width: 100%; justify-items: center;
}
.obj {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1;
  font-size: clamp(2rem, 10vmin, 4.5rem); border-radius: 22%; background: var(--surface);
  box-shadow: var(--shadow-sm); border: 4px solid transparent; position: relative;
  transition: transform 0.15s, border-color 0.15s; animation: popin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  min-width: var(--tap); min-height: var(--tap); width: 100%; max-width: 170px;
}
.obj.counted { border-color: var(--skill); transform: scale(0.94); }
.obj .count-badge {
  position: absolute; top: -8px; right: -8px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--skill); color: #fff; font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--skill-2);
  animation: popin 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* two-sided comparison */
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 3vmin, 24px); flex: 1; min-height: 0; }
.side {
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 4%;
  border: 5px solid var(--skill-soft); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--skill) 35%, white); padding: 6%;
  font-size: clamp(1.6rem, 8vmin, 3.5rem); line-height: 1.1; cursor: pointer; position: relative;
  transition: transform 0.1s; animation: popin 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.side:active { transform: translateY(4px); }
.side.correct { border-color: var(--ok); background: #f1fff5; animation: bounce 0.6s ease; }
.side.wrong { animation: shake 0.45s ease; opacity: 0.45; pointer-events: none; }
.side.hint { animation: wiggle 0.7s ease-in-out 3; border-color: var(--sun); }
.side .item { width: 30%; text-align: center; }

/* sorting bins */
.sort-layout { display: grid; grid-template-rows: 1fr auto; gap: 0.6rem; flex: 1; min-height: 0; }
.sort-items { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: clamp(8px, 2vmin, 16px); min-height: 0; }
.sort-item {
  display: flex; align-items: center; justify-content: center; width: clamp(64px, 16vmin, 110px); aspect-ratio: 1;
  font-size: clamp(2rem, 9vmin, 4rem); background: var(--surface); border-radius: 22%; box-shadow: var(--shadow-sm);
  border: 4px solid transparent; touch-action: none; cursor: grab; position: relative; z-index: 1;
  transition: transform 0.12s, border-color 0.12s, opacity 0.2s; animation: popin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sort-item.selected { border-color: var(--sun); transform: scale(1.08); box-shadow: 0 0 0 5px var(--sun-soft); }
.sort-item.dragging { position: fixed; z-index: 50; pointer-events: none; transform: scale(1.15); transition: none; box-shadow: var(--shadow); }
.sort-item.placed { animation: popin 0.3s ease both; }
.sort-item.wrong { animation: shake 0.45s ease; }
.bins { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 3vmin, 24px); }
.bin {
  min-height: clamp(110px, 24vmin, 170px); border: 5px dashed var(--skill); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, transparent); display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 0.3rem; padding: 0.5rem; cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.bin .bin-label { font-weight: 700; font-size: clamp(1rem, 3vmin, 1.4rem); color: var(--skill-2); display: flex; align-items: center; gap: 0.35rem; }
.bin .bin-label .emoji, .bin .bin-label svg { font-size: 1.5em; width: 1.5em; height: 1.5em; }
.bin .bin-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: clamp(1.4rem, 5vmin, 2.2rem); }
.bin.over { background: var(--skill-soft); transform: scale(1.03); }
.bin.correct { border-color: var(--ok); background: #f1fff5; }
.bin.wrong { animation: shake 0.45s ease; border-color: var(--bad); }

/* memory cards */
.cards { display: grid; gap: clamp(8px, 2vmin, 16px); flex: 1; min-height: 0; align-content: center; justify-content: center; }
.cards[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cards[data-count="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (orientation: portrait) {
  .cards[data-count="8"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards[data-count="6"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards[data-count="10"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards[data-count="12"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Dino Match faces: a word under its picture, a letter with its small twin, a written word */
.card3d .back { flex-direction: column; gap: 2%; }
.card3d .back .emoji { line-height: 1; }
.card3d .face-picture-word .emoji { font-size: 70%; }
.card-word { font-family: inherit; font-weight: 700; color: var(--ink); font-size: 34%; line-height: 1.1; letter-spacing: 0.02em; }
.card-word.big { font-size: 46%; letter-spacing: 0.05em; }
.card-word b { color: #e0562f; }
.card-letter { font-weight: 700; color: var(--ink); line-height: 1; display: inline-flex; align-items: baseline; gap: 0.08em; }
.card-letter small { font-size: 62%; font-weight: 700; color: #e0562f; }
.card3d.matched .card-word b, .card3d.matched .card-letter small { color: var(--ok); }
.card3d { perspective: 800px; aspect-ratio: 1; max-height: 100%; min-height: var(--tap); border: 0; padding: 0; background: transparent; }
.card3d .inner { position: relative; width: 100%; height: 100%; transition: transform 0.45s; transform-style: preserve-3d; }
.card3d.flipped .inner { transform: rotateY(180deg); }
.card3d .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius); overflow: hidden;
  font-size: clamp(2rem, 12vmin, 5rem);
}
.card3d .front { background: linear-gradient(150deg, var(--skill), var(--skill-2)); color: #fff; box-shadow: 0 6px 0 var(--skill-2); }
.card3d .front::after { content: "?"; font-weight: 700; opacity: 0.85; }
.card3d .back { transform: rotateY(180deg); background: var(--surface); border: 5px solid var(--skill-soft); }
.card3d.matched .back { border-color: var(--ok); background: #f1fff5; }
.card3d.matched { animation: bounce 0.6s ease; }
.card3d.wrong .inner { animation: shake 0.45s ease; }

/* echo (simon) pads */
.pads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 3vmin, 24px); flex: 1; min-height: 0; align-content: center; max-width: 620px; margin-inline: auto; width: 100%; }
@media (orientation: landscape) { .pads { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1000px; } }
.pad {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; max-height: 100%;
  font-size: clamp(3rem, 16vmin, 7rem); border-radius: 26%; background: var(--surface);
  border: 6px solid var(--pad, var(--skill)); box-shadow: 0 8px 0 var(--pad, var(--skill));
  transition: transform 0.1s, background 0.1s, filter 0.1s; opacity: 0.85;
}
.pad.lit { background: var(--pad, var(--skill)); transform: scale(1.06); opacity: 1; filter: brightness(1.05); }
.pad:active { transform: translateY(6px); }
.pads.locked .pad { pointer-events: none; }
.pad.wrong { animation: shake 0.45s ease; }

/* tracing canvas */
.trace-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.trace-wrap canvas { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); touch-action: none; max-width: 100%; max-height: 100%; }
.trace-wrap canvas.trace-canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.trace-wrap.is-done canvas { box-shadow: 0 0 0 4px var(--shapes-soft), var(--shadow-sm); }

/* writing room: the tracing card beside the numeral / letter and its pictures */
.write-room { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; height: 100%; min-height: 0; }
.write-room .trace-wrap { height: 100%; }
.write-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; overflow: hidden; }
.number-badge, .letter-badge { display: flex; flex-direction: column; align-items: center; line-height: 1; color: var(--skill-2); }
.number-badge .numeral, .letter-badge .glyph { font-size: clamp(2.6rem, 11vmin, 5rem); font-weight: 700; color: var(--ink); }
.letter-badge .glyph.small { font-size: clamp(2.2rem, 9vmin, 4.2rem); }
.number-badge .number-word, .letter-badge .letter-name { font-size: 0.95rem; font-weight: 600; margin-top: 4px; }
.ten-frame { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 6px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); width: min(100%, 300px); }
.ten-frame[data-size="5"] { width: min(100%, 220px); }
.ten-cell { aspect-ratio: 1; border: 2px dashed var(--line-2); border-radius: 10px; display: flex; align-items: center; justify-content: center; min-width: 0; }
.ten-item {
  position: relative; width: 100%; height: 100%; border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: clamp(1.3rem, 5vmin, 2.2rem); animation: popin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ten-item.counted { background: var(--skill-soft); }
.ten-item .count-badge { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--skill); color: #fff; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.zero-note { margin: 0; text-align: center; color: var(--ink-2); font-weight: 600; }
.tens { display: flex; flex-direction: column; gap: 4px; align-items: center; width: 100%; }
.tens .ten-frame { width: min(100%, 220px); gap: 3px; padding: 4px; }
.tens .ten-item { font-size: clamp(1rem, 3.6vmin, 1.5rem); }
.word-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.word-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 6px 8px; border: 3px solid var(--skill-soft); border-radius: 14px;
  background: var(--surface); cursor: pointer; font: inherit; color: var(--ink-2); font-weight: 600; font-size: 0.8rem; box-shadow: var(--shadow-sm);
}
.word-chip .emoji { font-size: 1.7rem; line-height: 1; }
.word-chip:active { transform: translateY(2px); }
@media (orientation: portrait) {
  .write-room { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .write-room .write-side { order: -1; flex-direction: row; justify-content: center; gap: 12px; }
  .write-room .ten-frame { width: min(60%, 260px); }
  .write-room .word-row { flex-wrap: nowrap; }
  .write-room .word-chip { min-width: 52px; padding: 4px 6px; }
  .write-room .word-chip .emoji { font-size: 1.4rem; }
  .number-badge .numeral, .letter-badge .glyph { font-size: clamp(2rem, 8vmin, 3.4rem); }
}
@media (max-width: 400px) and (orientation: portrait) {
  .write-room .word-chip:nth-child(3) { display: none; }
}
.trace-tools { display: flex; justify-content: center; gap: 0.6rem; flex: none; }
.progress-track { height: 14px; border-radius: 7px; background: var(--surface); overflow: hidden; box-shadow: inset 0 0 0 2px var(--skill-soft); }
.progress-track .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--skill), var(--skill-2)); transition: width 0.15s; border-radius: 7px; }

/* How Many?: the group to count, and the number strip under it */
.count-panel { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px; }
.count-row { flex: none; }
.ten-frame.big { width: min(100%, 460px); gap: 6px; padding: 8px; }
.ten-frame.big .ten-item { font-size: clamp(1.6rem, 7vmin, 3rem); }
.dot-card.dice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: min(60%, 260px); aspect-ratio: 1; padding: 10px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm); border: 4px solid var(--skill-soft); }
.pip-cell { display: flex; align-items: center; justify-content: center; min-width: 0; }
.pip { position: relative; width: 78%; aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--ink); cursor: pointer; padding: 0; animation: popin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; min-width: 26px; min-height: 26px; }
.ten-frame .pip { width: 70%; }
.pip.counted { background: var(--skill); }
.pip .count-badge { position: absolute; top: -8px; right: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--sun); color: var(--ink); font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.number-strip { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 5px; width: min(100%, 560px); margin-inline: auto; flex: none; }
.strip-number {
  height: clamp(44px, 12vmin, 64px); border-radius: 12px; border: 3px solid var(--skill-soft); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; font-size: clamp(1rem, 4.6vmin, 1.7rem); cursor: pointer; box-shadow: 0 4px 0 color-mix(in srgb, var(--skill) 30%, white); padding: 0; min-width: 0;
  transition: transform 0.1s, background 0.15s;
}
@media (max-width: 480px) { .number-strip[data-n="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.strip-number:active { transform: translateY(3px); }
.strip-number.correct { background: var(--sun); border-color: var(--sun-2); animation: bounce 0.6s ease; }
.strip-number.wrong { animation: shake 0.45s ease; }
.strip-number.hint { animation: wiggle 0.7s ease-in-out 3; border-color: var(--sun); box-shadow: 0 0 0 5px var(--sun-soft); }
.number-strip.locked .strip-number { pointer-events: none; }

/* Missing Numbers: a number path with one empty box */
.number-train { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 6px; width: min(100%, 560px); margin-inline: auto; flex: none; container-type: inline-size; }
.train-cell {
  aspect-ratio: 5 / 4; min-height: 34px; border-radius: 12px; border: 3px solid var(--skill-soft); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; font-size: clamp(0.95rem, 5cqw, 1.6rem); cursor: pointer; padding: 0; min-width: 0; display: flex; align-items: center; justify-content: center;
  animation: popin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.train-cell.dim { opacity: 0.55; }
.train-cell.gap { border-style: dashed; border-color: var(--skill); background: var(--skill-soft); color: var(--skill-2); }
.train-cell.gap.hint { animation: wiggle 0.7s ease-in-out 3; box-shadow: 0 0 0 5px var(--sun-soft); }
.train-cell.filled { background: var(--sun); border-color: var(--sun-2); animation: bounce 0.6s ease; }
.number-train.wagons { gap: 10px 8px; }
.number-train.wagons .train-cell { position: relative; border-radius: 12px 12px 8px 8px; margin-bottom: 10px; }
.number-train.wagons .train-cell::after {
  content: ""; position: absolute; left: 15%; right: 15%; bottom: -11px; height: 10px;
  background: radial-gradient(circle 5px at 25% 50%, var(--ink) 4.4px, transparent 5px), radial-gradient(circle 5px at 75% 50%, var(--ink) 4.4px, transparent 5px);
}
.choices.compact .choice.text-only { font-size: clamp(1.6rem, 7vmin, 3rem); }

/* Number Snake */
.snake-scene { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; background: linear-gradient(#e9f8dc, #d3efc4); }
.snake-top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; flex: none; min-height: 34px; }
.snake-scene .scene-pill { position: static; flex: none; }
.snake-scene .scene-pill[hidden] { display: none; }
.snake-word { display: flex; justify-content: center; gap: 4px; flex: 1; flex-wrap: wrap; z-index: 2; }
.snake-word[hidden] { display: none; }
.snake-letter { min-width: 30px; text-align: center; padding: 3px 5px; border-radius: 9px; background: #fff; font-weight: 700; font-size: 15px; color: var(--ink-3); border: 2px solid var(--line-2); }
.snake-letter.wanted { border-color: var(--sun-2); background: var(--sun-soft); color: var(--ink); }
.snake-letter.eaten { background: var(--shapes-soft); color: var(--shapes-2); border-color: var(--shapes); }
.snake-board-wrap { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; container-type: size; }
.snake-board {
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr); gap: 2px;
  width: min(100cqw, calc(100cqh * var(--cols) / var(--rows))); aspect-ratio: var(--cols) / var(--rows);
  background: #bfe3ad; border-radius: 14px; padding: 4px; touch-action: none; box-shadow: inset 0 0 0 3px #a6d590;
}
.snake-board.dizzy { animation: shake 0.5s ease; }
.snake-cell { border-radius: 4px; background: #e2f4d6; display: grid; place-items: center; font-weight: 700; color: #5a3d00; font-size: clamp(0.7rem, 3.2cqh, 1.3rem); min-width: 0; min-height: 0; }
.snake-cell.snake { background: #58b368; border-radius: 7px; box-shadow: inset 0 -3px 0 #3d9a4e; }
.snake-cell.head { background: radial-gradient(circle at 32% 38%, #fff 16%, #183d55 17%, #183d55 24%, transparent 25%), radial-gradient(circle at 68% 38%, #fff 16%, #183d55 17%, #183d55 24%, transparent 25%), #3d9a4e; border-radius: 45%; box-shadow: none; }
.snake-cell.food { background: #ffd25c; border-radius: 50%; box-shadow: 0 2px 0 #be932b; }
.snake-cell.food.wanted { background: #ff765c; color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 12px #ff765c; animation: pulse 1s ease-in-out infinite; }
.snake-cell.food.decoy { background: #e6eef2; color: var(--ink-3); box-shadow: 0 2px 0 #c3d4dc; }
.snake-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: clamp(3rem, 18cqh, 6rem); color: var(--sun-2); text-shadow: 0 0 16px #fff; pointer-events: none; animation: pulse 0.8s ease-in-out infinite; }
.snake-hint[hidden] { display: none; }
.snake-controls { flex: none; padding: 6px 0 0; display: flex; justify-content: center; }
.snake-pad { display: grid; gap: 6px; justify-items: center; }
.snake-pad-row { display: flex; gap: 6px; }
.snake-btn { width: 64px; height: 50px; font-size: 1.4rem; }
html.quiet .snake-cell.food.wanted, html.quiet .snake-hint { animation: none; }

/* Block Party */
.block-scene { display: flex; align-items: stretch; justify-content: center; gap: 10px; padding: 8px; background: linear-gradient(#e6ecff, #d3dcff); }
.block-board-wrap { flex: 0 1 auto; height: 100%; aspect-ratio: 7 / 12; max-width: calc(100% - 110px); min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.block-board {
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr); gap: 2px;
  height: min(100cqh, calc(100cqw * var(--rows) / var(--cols))); aspect-ratio: var(--cols) / var(--rows);
  background: #b9c6ec; border-radius: 12px; padding: 4px; box-shadow: inset 0 0 0 3px #9fb0e0;
}
.block-board.cleared { animation: pulse 0.4s ease; }
.block-cell { background: #e7ecfb; border-radius: 3px; min-width: 0; min-height: 0; }
.block-cell.locked, .block-cell.piece { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.block-cell.ghost { opacity: 0.35; }
.block-cell.clearing { background: #fff !important; animation: pulse 0.26s ease; }
.block-cell.c-blue { background: #4d96ff; } .block-cell.c-green { background: #3cc46e; } .block-cell.c-red { background: #ff6b6b; }
.block-cell.c-yellow { background: #ffd25c; } .block-cell.c-purple { background: #9b5de5; }
.block-side { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; flex: none; }
.block-side .scene-pill { position: static; }
.block-side-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.block-next { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 8px; padding: 6px; background: #fff8; border-radius: 10px; }
.block-next[hidden] { display: none; }
.block-next-label { font-size: 11px; color: var(--ink-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.block-mini { display: grid; grid-template-columns: repeat(var(--w), 16px); grid-template-rows: repeat(var(--h), 16px); gap: 2px; }
.block-mini .block-cell.empty { background: transparent; }
.block-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 0; flex: none; }
.block-btn { width: 58px; height: 50px; font-size: 1.4rem; }
.block-drop { min-width: 130px; }
@media (max-width: 480px) { .block-side { width: 74px; } .block-btn { width: 52px; } .block-drop { min-width: 110px; padding: 12px 16px; } }
html.quiet .block-board.cleared, html.quiet .block-cell.clearing { animation: none; }

/* dot-to-dot board */
.stage-inner.has-board { container-type: size; align-items: center; }
.dots-board {
  position: relative; width: min(100%, 100cqh); aspect-ratio: 1; container-type: size;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.dots-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.dots-shape { opacity: 0; transition: opacity 0.6s; stroke-width: 2.5; stroke-linejoin: round; }
.dots-joined { stroke: var(--skill); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.dots-details { opacity: 0; transition: opacity 0.6s 0.3s; }
.dots-board.is-done .dots-shape, .dots-board.is-done .dots-details { opacity: 1; }
.dot {
  position: absolute; transform: translate(-50%, -50%); z-index: 1; padding: 0; cursor: pointer;
  width: clamp(32px, 12cqw, 50px); height: clamp(32px, 12cqw, 50px); border-radius: 50%;
  border: 3px solid var(--ink); background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: clamp(0.85rem, 4.4cqw, 1.25rem);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 rgba(24, 61, 85, 0.18);
  transition: background 0.15s, transform 0.2s, opacity 0.3s;
}
.dot.start { border-color: #ff5a5a; background: #ffe3e3; }
.dot.end::after { content: "★"; position: absolute; top: -0.75em; right: -0.7em; color: var(--sun-2); font-size: 1em; text-shadow: 0 1px 0 #fff; }
.dot.done { background: var(--skill); border-color: var(--skill-2); color: #fff; }
.dot.next { animation: dot-pulse 1s ease-in-out infinite; box-shadow: 0 0 0 4px var(--sun-soft), 0 0 0 7px var(--sun); }
.dot.wrong { animation: shake 0.45s ease; }
.dot.locked { pointer-events: none; }
.dots-board.is-done .dot { opacity: 0.75; transform: translate(-50%, -50%) scale(0.72); }
.dots-board.is-done .dot.next { animation: none; box-shadow: none; }
@keyframes dot-pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--sun-soft), 0 0 0 7px var(--sun); } 50% { box-shadow: 0 0 0 7px var(--sun-soft), 0 0 0 12px var(--sun); } }

/* overlays */

.overlay {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: color-mix(in srgb, #eaf7fc 82%, transparent); backdrop-filter: blur(4px);
  animation: fadein 0.25s ease both;
}
.overlay[hidden] { display: none; }
.overlay-card {
  width: min(100%, 520px); max-height: 100%; overflow: auto; text-align: center;
  background: var(--surface); border-radius: 32px; padding: clamp(1rem, 4vmin, 2rem);
  box-shadow: var(--shadow); display: grid; gap: 0.6rem; justify-items: center;
}
.overlay-card .host-big { font-size: clamp(3.5rem, 14vmin, 6rem); animation: bob 1.6s ease-in-out infinite; }
.overlay-card h2 { font-size: clamp(1.5rem, 5vmin, 2.2rem); margin: 0; font-weight: 700; }
.overlay-card .goal { font-size: clamp(1.1rem, 3.5vmin, 1.5rem); color: var(--ink-2); margin: 0; }
.overlay-card .actions { display: grid; gap: 0.6rem; width: 100%; min-width: 0; margin-top: 0.4rem; grid-template-columns: minmax(0, 1fr); }
/* labels may wrap ("Level 2: Little letters", long game names) instead of pushing the card wider */
.overlay-card .actions .btn { white-space: normal; min-width: 0; max-width: 100%; text-align: center; line-height: 1.15; padding-inline: 1em; overflow-wrap: anywhere; }
.overlay-card .actions .btn .emoji { flex: none; }
@media (min-width: 480px) { .overlay-card .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } .overlay-card .actions .btn-block { grid-column: 1 / -1; } }
.overlay-card { overflow-x: hidden; }
.overlay-card .level-tag { font-size: 0.95rem; color: var(--skill-2); background: var(--skill-soft); padding: 0.2em 0.9em; border-radius: var(--radius-pill); font-weight: 600; }

.big-stars { display: flex; gap: 0.4rem; font-size: clamp(3rem, 12vmin, 5rem); line-height: 1; }
.big-stars .star { color: #e6dfd0; transform: scale(0.8); transition: transform 0.3s; }
.big-stars .star.on { color: var(--sun); text-shadow: 0 4px 0 var(--sun-2); animation: starpop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.big-stars .star:nth-child(2).on { animation-delay: 0.25s; }
.big-stars .star:nth-child(3).on { animation-delay: 0.5s; }

.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 9; }

/* floating praise word */
.praise.streak { color: #d98a00; font-size: clamp(1.6rem, 7vmin, 3rem); animation-duration: 1.4s; }
.praise.streak::before { content: "⭐ "; }
.praise {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 8;
  font-size: clamp(2rem, 9vmin, 4rem); font-weight: 700; color: var(--skill-2);
  text-shadow: 0 4px 0 #fff, 0 6px 16px rgba(0, 0, 0, 0.12); pointer-events: none;
  animation: praise 0.9s ease-out both;
}

/* =========================================================================
   Grown-up pages

   ========================================================================= */
body.grown { font-size: 17px; }
.grown-header { background: var(--surface); border-bottom: 2px solid var(--line); }
.grown-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.grown-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.grown-nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; padding: 0.4rem 0.8rem; border-radius: var(--radius-pill); }
.grown-nav a.active, .grown-nav a:hover { background: var(--bg); color: var(--ink); }
.page { padding: 1.5rem 0 3rem; }
.page-title { display: flex; align-items: center; gap: 0.6rem; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: clamp(1rem, 3vw, 1.5rem); }
.card + .card { margin-top: 1rem; }
.card-title { font-size: 1.3rem; margin-bottom: 0.6rem; }
.card-body > :last-child { margin-bottom: 0; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.stat { display: grid; gap: 0.1rem; padding: 0.8rem 1rem; background: var(--bg); border-radius: var(--radius-sm); }
.stat .value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat .label { color: var(--ink-2); font-size: 0.9rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.skill-row { display: grid; gap: 0.4rem; padding: 0.8rem 0; border-top: 2px solid var(--line); }
.skill-row:first-of-type { border-top: 0; }
.skill-row .head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.skill-row .head .name { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.skill-row .head .name .emoji { font-size: 1.5rem; }
.meter { height: 12px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 6px; background: var(--skill); transition: width 0.4s; }
.stage-tag { font-size: 0.8rem; font-weight: 700; padding: 0.15em 0.7em; border-radius: var(--radius-pill); background: var(--bg-2); color: var(--ink-2); }
.stage-tag[data-stage="Practicing"] { background: var(--sun-soft); color: #7a5a00; }
.stage-tag[data-stage="Growing"] { background: var(--numbers-soft); color: var(--numbers-2); }
.stage-tag[data-stage="Strong"] { background: var(--shapes-soft); color: var(--shapes-2); }
.stage-tag[data-stage="Explored"] { background: var(--listening-soft); color: var(--listening-2); }
.stage-tag[data-stage="Getting it"] { background: var(--numbers-soft); color: var(--numbers-2); }
.stage-tag[data-stage="Got it"] { background: var(--shapes-soft); color: var(--shapes-2); }

/* learning map: readiness skills by area */
.learning-map { margin: 1rem 0 1.4rem; padding: 1rem; border-radius: var(--radius); background: var(--bg); }
.learning-map h3 { margin: 0 0 0.2rem; }
.map-areas { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 0.8rem; }
.map-area h4 { margin: 0 0 0.3rem; font-size: 1rem; }
.objective-row { display: grid; gap: 0.3rem; padding: 0.55rem 0; border-top: 2px solid var(--line); }
.objective-row:first-of-type { border-top: 0; }
.objective-row .head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.objective-row .head .name { font-weight: 700; }
.objective-row .meter { height: 8px; }
.objective-row .meter .fill { background: var(--primary); }
.objective-row[data-stage="Not started"] .meter .fill { background: var(--line-2); }
.objective-row[data-stage="Explored"] .meter .fill { background: var(--listening); min-width: 8%; }
.objective-row[data-stage="Got it"] .meter .fill { background: var(--shapes); }
.objective-foot { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.practice-link { font-weight: 700; white-space: nowrap; }
.game-rows { display: grid; gap: 0.3rem; margin-top: 0.3rem; }
.game-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.5rem; font-size: 0.95rem; padding: 0.35rem 0.6rem; background: var(--bg); border-radius: var(--radius-sm); }
.game-row .levels { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.game-row .lvl { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.8rem; color: var(--ink-2); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-2); font-weight: 600; font-size: 0.85rem; }
.table-wrap { overflow-x: auto; }
.child-card { display: grid; gap: 1rem; }
.child-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.child-head .avatar { font-size: 2.6rem; }
.child-head h2 { margin: 0; }
.child-head .actions { margin-left: auto; display: flex; gap: 0.4rem; }
.suggest { display: grid; gap: 0.5rem; }
.suggest a { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); background: var(--skill-soft); font-weight: 600; }
.suggest a .emoji { font-size: 1.4rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--ink-2); }
.empty .emoji { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.callout { border-left: 6px solid var(--sun); background: var(--sun-soft); padding: 0.8rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.5rem; }
.avatar-grid label {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; font-size: 2rem;
  background: var(--bg); border-radius: var(--radius-sm); border: 3px solid transparent; cursor: pointer;
}
.avatar-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.avatar-grid input:checked + label, .avatar-grid label:has(input:checked) { border-color: var(--sky); background: var(--numbers-soft); }
.avatar-grid label:focus-within { outline: 3px solid var(--sky); }

/* form controls (also styles django-allauth / crispy output) */
.form-label, label { font-weight: 600; display: block; margin-bottom: 0.3rem; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; min-height: 52px; padding: 0.6rem 0.9rem; border: 3px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 1.05rem; transition: border-color 0.15s;
}
.form-control:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin: 0.4rem 0; }
.form-check-input, input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--sky); }
.form-check-label { margin: 0; font-weight: 500; }
.form-text { color: var(--ink-2); font-size: 0.9rem; margin-top: 0.3rem; }
.mb-3, .form-group { margin-bottom: 1.1rem; }
.invalid-feedback, .errorlist { color: var(--letters-2); font-size: 0.92rem; margin: 0.3rem 0 0; padding: 0; list-style: none; display: block; }
.is-invalid { border-color: var(--bad); }
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--bg-2); border: 2px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.alert-success { background: var(--shapes-soft); border-color: var(--shapes); }
.alert-error, .alert-danger { background: var(--letters-soft); border-color: var(--letters); }
.alert-warning { background: var(--sun-soft); border-color: var(--sun); }
.alert-info { background: var(--numbers-soft); border-color: var(--numbers); }
.btn-close { border: 0; background: transparent; font-size: 1.3rem; line-height: 1; padding: 0.2rem 0.5rem; }
.btn-close::before { content: "×"; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.2em 0.6em; border-radius: var(--radius-pill); background: var(--bg-2); }
.badge.bg-success { background: var(--shapes-soft); color: var(--shapes-2); }
.badge.bg-warning { background: var(--sun-soft); color: #7a5a00; }
.badge.bg-danger { background: var(--letters-soft); color: var(--letters-2); }
.badge.bg-primary { background: var(--numbers-soft); color: var(--numbers-2); }
.badge.bg-secondary { background: var(--bg-2); color: var(--ink-2); }
.entrance { max-width: 460px; margin: 2rem auto; }
.entrance h1 { text-align: center; }
.entrance form { display: grid; gap: 0.2rem; }
.entrance .btn { margin-top: 0.4rem; }
.entrance p { text-align: center; color: var(--ink-2); }
.account-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.d-flex { display: flex; } .justify-content-center { justify-content: center; }
.form-horizontal .btn { margin-top: 0.5rem; }
section > .card { margin-bottom: 1rem; }

/* parent gate */
.gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(38, 48, 77, 0.55); }
.gate[hidden] { display: none; }
.gate-card { width: min(100%, 400px); background: var(--surface); border-radius: 28px; padding: 1.5rem; text-align: center; box-shadow: var(--shadow); display: grid; gap: 0.8rem; }
.gate-card h2 { margin: 0; }
.gate-card .question { font-size: 1.6rem; font-weight: 700; }
.gate-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.gate-pad button { min-height: 52px; border-radius: var(--radius-sm); border: 0; background: var(--bg); font-size: 1.3rem; font-weight: 700; }
.gate-pad button:active { background: var(--bg-2); }
.gate-card .oops { color: var(--letters-2); min-height: 1.4em; font-weight: 600; }

/* profile picker sheet */
.sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; background: rgba(38, 48, 77, 0.45); }
.sheet[hidden] { display: none; }
.sheet-card { width: min(100%, 560px); background: var(--surface); border-radius: 28px 28px 0 0; padding: 1.2rem 1.2rem 2rem; display: grid; gap: 0.8rem; max-height: 85dvh; overflow: auto; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-card { border-radius: 28px; padding-bottom: 1.2rem; } }
.sheet-card h2 { margin: 0; text-align: center; }
.profile-list { display: grid; gap: 0.5rem; }
.profile-row { display: flex; align-items: center; gap: 0.7rem; min-height: 60px; padding: 0.4rem 0.8rem; border-radius: var(--radius-sm); border: 3px solid var(--line); background: var(--surface); font-size: 1.15rem; font-weight: 600; text-align: left; width: 100%; }
.profile-row .emoji { font-size: 1.8rem; }
.profile-row.active { border-color: var(--sky); background: var(--numbers-soft); }
.profile-row .check { margin-left: auto; color: var(--sky-2); }
.new-profile { display: grid; gap: 0.5rem; }
.new-profile .emoji-row { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.new-profile .emoji-row button { width: 48px; height: 48px; border-radius: 12px; border: 3px solid transparent; background: var(--bg); font-size: 1.5rem; }
.new-profile .emoji-row button.on { border-color: var(--sky); background: var(--numbers-soft); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 120; background: var(--ink); color: #fff; padding: 0.6rem 1.1rem; border-radius: var(--radius-pill); font-weight: 600; box-shadow: var(--shadow); animation: fadein 0.2s ease both; }

/* ---------- animations ---------- */
@keyframes popin { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounce { 0% { transform: scale(1); } 30% { transform: scale(1.12); } 55% { transform: scale(0.96); } 80% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes starpop { 0% { transform: scale(0.3) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes praise { 0% { transform: translate(-50%, -30%) scale(0.6); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- game-specific bits ---------- */
.choice .pic { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1em; width: 100%; height: 100%; }
.choice .pic .caption { position: static; font-size: 0.28em; }
.choice .group { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 0.15em; width: 100%; line-height: 1.1; font-size: 0.42em; }
.choice .group.dense { font-size: 0.3em; }
.choice.group-card { padding: 8%; }
.sort-item.big { width: clamp(84px, 22vmin, 140px); font-size: clamp(2.6rem, 12vmin, 5.2rem); }
.sort-item.small { width: clamp(52px, 12vmin, 80px); font-size: clamp(1.4rem, 6vmin, 2.6rem); }
.bin .bin-items .placed { animation: popin 0.3s ease both; }

/* ---------- size glyphs to their card, not the viewport ----------
   Container-query units resolve against the nearest ancestor container, so the
   card is the container and its child (glyph, picture, group) gets the size. */
.choice, .obj, .card3d, .pad, .sort-item { container-type: inline-size; }
@supports (font-size: 1cqw) {
  .choice > * { font-size: 46cqw; }
  .choice > .pic { font-size: 36cqw; }
  .choice > .group { font-size: 19cqw; }
  .choice > .group.dense { font-size: 14cqw; }
  .choice.text-only > * { font-size: 12cqw; }
  .obj > .emoji { font-size: 62cqw; }
  /* never taller than the rows allow (landscape phones) */
  .field { container-type: size; }
  .obj { max-width: min(170px, calc(100cqh / var(--rows, 1) - 10px)); }
  .card3d .face { font-size: 52cqw; }
  .pad > .emoji { font-size: 52cqw; }
  .sort-item > * { font-size: 58cqw; }
}
/* a short row of answer cards under a big playing field (Count It) */
.choices.compact { height: auto; flex: none; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); max-width: 520px; margin-inline: auto; }
.choices.compact > .choice { max-height: 22vh; }
.choices.compact > :last-child { grid-column: auto; width: 100%; }
@media (orientation: landscape) { .choices.compact > .choice { max-height: 30vh; } }
/* bigger sort pieces on phones */
.sort-item { width: clamp(72px, 26vmin, 140px); }
.sort-item.big { width: clamp(92px, 32vmin, 170px); }
.sort-item.small { width: clamp(56px, 18vmin, 96px); }
.bin { min-height: clamp(120px, 28vmin, 200px); }

/* ---------- short landscape screens (phones held sideways) ---------- */
.cards { container-type: size; justify-items: center; align-items: center; }
@supports (height: 1cqh) {
  .cards[data-count="4"] .card3d { max-width: calc(50cqh - 8px); }
  .cards[data-count="6"] .card3d { max-width: calc(33cqh - 8px); }
  .cards[data-count="8"] .card3d { max-width: calc(25cqh - 8px); }
  .cards[data-count="10"] .card3d { max-width: calc(20cqh - 8px); }
  .cards[data-count="12"] .card3d { max-width: calc(25cqh - 8px); }
  @media (orientation: landscape) {
    .cards[data-count] .card3d { max-width: calc(50cqh - 8px); }
    .cards[data-count="12"] .card3d { max-width: calc(33cqh - 8px); }
  }
  /* a phone held sideways: two rows of six, so every card stays a tap target */
  @media (orientation: landscape) and (max-height: 480px) {
    .cards[data-count="12"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .cards[data-count="12"] .card3d { max-width: calc(50cqh - 8px); }
  }
}
.card3d { width: 100%; }
@media (orientation: landscape) and (max-height: 480px) {
  .obj { min-width: 44px; min-height: 44px; }
  .choices.compact > .choice { max-height: 24vh; }
  .sort-item { width: clamp(52px, 15vmin, 90px); }
  .sort-item.big { width: clamp(64px, 19vmin, 110px); }
  .sort-item.small { width: clamp(40px, 11vmin, 64px); }
  .bin { min-height: 76px; }
  .icon-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  .overlay-card .host-big { font-size: 2.6rem; }
  .overlay-card { gap: 0.35rem; padding: 0.8rem 1rem; }
  .overlay-card .actions { margin-top: 0.1rem; gap: 0.4rem; }
  .btn-big { min-height: 48px; font-size: 1.1rem; }
}

/* ---------- small utilities used by templates ---------- */
.m-0 { margin: 0; }
.ml-auto { margin-left: auto; }
.items-start { align-items: start; }
.text-lg { font-size: 1.1rem; }
.text-danger { color: var(--letters-2); }
.list-tight { padding-left: 1.1em; margin: 0; }
.entrance-wide { max-width: 560px; }
.entrance-wider { max-width: 640px; }
.empty-compact { padding: 1rem; }
.page-center { text-align: center; padding: 3rem 0; }
.icon-huge { font-size: 5rem; }


/* A clear next target also remains visible when decorative motion is reduced. */
.hungry-friend.ready, .building-zone.ready { outline: 4px solid #f5bb37; outline-offset: 3px; }
.level-tag[hidden] { display: none; }
.level-options { width: 100%; text-align: left; font-size: 14px; }
.level-options summary { min-height: 44px; display: list-item; padding: 12px 4px; cursor: pointer; color: #41647c; }
.level-options label { margin-top: 8px; }
.level-options p { margin: 8px 0 0; font-size: 13px; color: #567a8f; }
@media (max-width: 640px) {
  #intro .card-art { width: 100px; }
  #intro .overlay-card { gap: 8px; padding: 16px; }
}

/* Star Hop: single-action support is separate from the default arrow controls. */
.hop-controls[hidden], .hop-assisted-controls[hidden] { display: none; }
.hop-assisted-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 8px 4px 0; flex: none; }
.hop-mode-label { width: 100%; text-align: center; color: var(--ink); font-size: 14px; font-weight: 600; }
.hop-forward-button { min-height: 60px; min-width: min(230px, 100%); font-size: 22px; }
.hop-forward-button:disabled { cursor: default; opacity: 0.65; }
.hop-arrows-button { min-height: 48px; }

/* Bubble Buddies learning missions. Append after the original bubble styles. */
.stage[data-scene="bubble-buddies"] { height: auto; min-height: 360px; }
.stage[data-scene="bubble-buddies"] .stage-inner { height: auto; }
.bubble-learning { flex: none; min-height: 350px; background: #e2f5fc; }
.bubble-learning .scene-art { opacity: .16; object-position: center; }
.bubble-learning-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 18px; }
.bubble-mission-heading { display: flex; flex-direction: column; gap: 4px; text-align: center; color: #225474; }
.bubble-mission-heading > strong { font-size: clamp(23px, 4vw, 30px); line-height: 1.2; }
.bubble-mission-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.bubble-learning-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 20px; }
.bubble-pool { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-content: center; justify-items: center; padding: 10px 0; }
.bubble-learning .bubble-target {
  position: relative; left: auto; top: auto; width: min(100%, 72px); height: auto; min-height: 48px; aspect-ratio: 1; transform: none; animation: none;
  border: 2px solid #fff; background: radial-gradient(circle at 30% 25%, #fff 0%, #cbf3ff 28%, #7dd8f8 68%, #71b8f0 100%);
  box-shadow: inset 0 -4px 8px #4d99d438, 0 4px 0 #95ccdd; touch-action: manipulation;
}
.bubble-learning .bubble-target > span { font-size: 26px; font-weight: 800; color: #236897; }
.bubble-learning .bubble-target:focus-visible, .bubble-tray-slot:focus-visible, .bubble-number-choice:focus-visible { outline: 4px solid #edb828; outline-offset: 3px; }
.bubble-learning .bubble-target.caught { border: 3px solid #4f9fd6; box-shadow: 0 3px 0 #7fb8dc; background: radial-gradient(circle at 30% 25%, #fff 0%, #dff5ff 30%, #9fe0fb 70%, #74c4f3 100%); }
.bubble-learning .bubble-target.caught > span { color: #1d5a8a; font-size: 32px; animation: popin 0.25s ease both; }
.bubble-learning .bubble-target.popped { background: #fff4be; box-shadow: 0 3px 0 #e8cf7c; border-color: #ffe08a; opacity: 1; }
.bubble-learning .bubble-target.popped > span { color: #b47a06; font-size: 34px; animation: popin 0.3s ease both; }
.bubble-learning[data-level="1"] .bubble-learning-body { display: block; }
.bubble-learning[data-level="1"] .bubble-pool { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; min-height: 130px; }
.bubble-learning[data-level="1"] .bubble-target { width: clamp(68px, 15vw, 104px); min-height: 68px; }
.bubble-learning-count { align-self: center; display: flex; align-items: center; gap: 10px; padding: 7px 17px; border: 2px solid #c9e8f5; border-radius: 18px; background: #fff; color: #285977; }
.bubble-learning-count[hidden] { display: none; }
.bubble-learning-count strong { font-size: 34px; line-height: 1; }
.bubble-learning-count span { font-size: 13px; font-weight: 600; }
.bubble-tray-panel { min-width: 0; padding: 12px; border: 2px solid #d0e6e5; border-radius: 22px; background: #fffdf3e8; box-shadow: 0 4px 0 #c8dfdf; }
.bubble-tray-label { display: block; color: #52758a; font-size: 13px; text-align: center; margin-bottom: 8px; }
.bubble-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; min-height: 96px; }
.bubble-tray-slot { display: grid; place-items: center; position: relative; width: 100%; min-width: 0; min-height: 44px; aspect-ratio: 1; border: 2px solid transparent; border-radius: 50%; background: transparent; padding: 0; touch-action: manipulation; }
.bubble-tray-slot:disabled { opacity: 1; }
.bubble-tray-slot.filled { background: radial-gradient(circle at 25% 25%, #fff, #aae4fb 45%, #7ec4f0); border-color: #fff; box-shadow: 0 2px 0 #82bed6; cursor: pointer; }
.bubble-tray-slot > span { color: #1d5a8a; font-size: 21px; font-weight: 800; line-height: 1; }
.bubble-tray-slot > small { position: absolute; right: -2px; bottom: -2px; min-width: 19px; border-radius: 7px; background: #fff; color: #215472; font-size: 12px; font-weight: 800; }
.bubble-tray-slot > small:empty { display: none; }
.bubble-tray.show-counting-guide { border-radius: 10px; background: #eff3e6; outline: 2px solid #c2d8ce; outline-offset: 3px; }
.show-counting-guide .bubble-tray-slot:not(.filled) { border: 2px dashed #b7cfc9; }
.bubble-tray-slot.burst { background: #fff4be; box-shadow: none; }
.bubble-tray-slot.burst > span { color: #b47a06; }
.bubble-number-choices { display: flex; justify-content: center; gap: 14px; }
.bubble-number-choices[hidden] { display: none; }
.bubble-number-choice { width: 76px; min-height: 70px; border: 3px solid #acd2e4; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 #b3d4df; font-size: 35px; font-weight: 800; color: #245b7c; cursor: pointer; }
.bubble-number-choice.tried { background: #edf4f7; box-shadow: none; color: #7794a3; }
.bubble-check, .bubble-next { align-self: center; max-width: 100%; min-height: 56px; white-space: normal; text-align: center; }
.bubble-check:disabled { opacity: .65; }
.bubble-learning[data-phase="celebrate"] .bubble-check, .bubble-learning[data-phase="celebrate"] .bubble-number-choices { display: none; }
.bubble-mission-reward { display: flex; justify-content: center; align-items: center; gap: 12px; color: #3c6754; text-align: center; }
.bubble-mission-reward .emoji { font-size: 42px; }
@media (max-width: 640px) {
  .stage[data-scene="bubble-buddies"] { padding: 6px; }
  .bubble-learning-content { padding: 14px 8px; gap: 12px; }
  .bubble-learning-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bubble-pool { width: min(100%, 320px); justify-self: center; padding: 4px 0; gap: 8px; }
  .bubble-learning .bubble-target { min-height: 52px; }
  .bubble-tray-panel { width: min(100%, 320px); box-sizing: border-box; justify-self: center; padding: 6px; }
  .bubble-learning[data-level="1"] .bubble-pool { width: 100%; gap: 15px; }
  .bubble-number-choice { width: 68px; min-height: 66px; }
}


/* Count It only: a growing board keeps the 8–20 range usable on small screens. */
.stage:has(.count-learning) { height: auto; min-height: 300px; }
.stage-inner:has(> .count-learning) { height: auto; }
.count-learning { width: 100%; display: grid; justify-items: center; gap: 16px; padding: 14px 4px 6px; color: #345875; }
.count-learning .count-board {
  --count-cell: clamp(48px, 11vw, 72px);
  display: grid; grid-template-columns: repeat(var(--count-cols), var(--count-cell));
  grid-template-rows: repeat(var(--count-rows), var(--count-cell)); gap: 5px;
  max-width: 100%; padding: 10px; border: 3px solid transparent; border-radius: 24px;
  background: #f6fbfc; box-shadow: 0 3px 0 #bcd6df;
}
.count-learning .count-object {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-width: 48px; min-height: 48px;
  padding: 3px; border: 3px solid transparent; border-radius: 15px; background: transparent; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.count-learning .count-art { display: block; width: 100%; height: 100%; pointer-events: none; }
.count-learning .count-art svg { display: block; width: 100%; height: 100%; }
.count-learning .count-object.counted { background: #d9ede1; border-color: #8fc0a1; }
.count-learning .count-object.count-next { background: #fff0a8; border-color: #bc8617; box-shadow: 0 0 0 3px #ffde74; }
.count-learning .count-object:disabled { opacity: 1; cursor: default; }
.count-learning .count-badge {
  position: absolute; right: -5px; bottom: -5px; min-width: 24px; height: 24px; border-radius: 999px; padding: 0 4px;
  display: grid; place-items: center; background: #296c4a; border: 2px solid #fff; color: white; font: 700 13px/1 system-ui, sans-serif;
}
.count-learning .count-board.count-complete { border-color: #559574; background: #edf8f0; }
.count-learning .count-answers { display: grid; grid-template-columns: repeat(var(--count-choices), minmax(0, 1fr)); width: min(100%, 420px); gap: 12px; }
.count-learning .count-answer {
  min-height: 68px; padding: 6px 12px; border: 3px solid #b5d4e8; border-radius: 20px;
  background: #fff; color: #315b7a; box-shadow: 0 4px 0 #aac8da; font: 750 clamp(32px, 6vw, 46px)/1.15 system-ui, sans-serif;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.count-learning .count-answer:active { transform: translateY(2px); box-shadow: 0 2px 0 #aac8da; }
.count-learning .count-answer.correct { background: #dbf0df; border-color: #569b70; }
.count-learning .count-answer:disabled { opacity: 1; cursor: default; }
.count-learning .count-support { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.count-learning .count-aid { min-height: 48px; padding: 9px 16px; border: 2px solid #b7cedb; border-radius: 15px; background: #edf6fa; color: #355b73; font: 650 16px/1.2 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.count-learning .count-status { margin: 0; max-width: 240px; min-height: 24px; font: 600 17px/1.4 system-ui, sans-serif; text-align: center; }
.count-learning button:focus-visible { outline: 4px solid #315b88; outline-offset: 3px; }
@media (max-width: 360px) {
  .count-learning { padding-inline: 0; gap: 12px; }
  .count-learning .count-board { gap: 2px; padding: 4px; }
  .count-learning .count-answers { gap: 8px; }
}


/* Number Trail — all controls stay at least 48px, including short landscape screens. */
.number-trail { width: 100%; max-width: 650px; margin: auto; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 12px; min-height: min-content; color: #514638; }
.nt-discovery { display: flex; align-items: center; justify-content: center; gap: 14px; flex: none; }
.nt-art { position: relative; width: clamp(110px, 29vw, 180px); aspect-ratio: 2; flex: none; }
.nt-art svg { display: block; width: 100%; height: 100%; }
.nt-art-outline, .nt-art-color { position: absolute; inset: 0; }
.nt-art-outline { filter: grayscale(1); opacity: .14; }
.nt-art-color { clip-path: inset(calc(100% - var(--nt-reveal)) 0 0); transition: clip-path .22s ease; }
.nt-caption { display: block; font-size: 15px; line-height: 1.25; max-width: 155px; }
.nt-counter { display: inline-block; margin-top: 5px; padding: 3px 10px; border-radius: 12px; background: #fff7dc; color: #765b34; font-size: 15px; font-weight: 600; }
.nt-grid { position: relative; display: grid; grid-template-columns: repeat(2, minmax(48px, 1fr)); grid-auto-rows: 52px; gap: 10px 24px; padding: 10px 12px; width: 100%; max-width: 410px; align-self: center; flex: none; }
.nt-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.nt-checkpoint, .nt-answer { position: relative; z-index: 1; justify-self: center; width: 52px; min-width: 48px; height: 52px; min-height: 48px; padding: 0; display: grid; place-items: center; border: 3px solid #E4D1AA; border-radius: 50%; background: #FFFCED; color: #5B4A36; box-shadow: 0 3px 0 #C8B68F; font: inherit; font-size: 25px; font-weight: 600; line-height: 1; cursor: pointer; touch-action: manipulation; }
.nt-checkpoint:focus-visible, .nt-answer:focus-visible { outline: 4px solid #376AA6; outline-offset: 3px; }
.nt-checkpoint.nt-visited, .nt-answer.nt-visited { background: #D3E9D3; border-color: #78A584; box-shadow: 0 2px 0 #72917A; color: #365A40; opacity: 1; cursor: default; }
.nt-checkpoint.nt-help, .nt-answer.nt-help { outline: 4px solid #E2AC34; outline-offset: 4px; }
.nt-checkpoint.nt-retry, .nt-answer.nt-retry { border-color: #D58B7E; }
.nt-sequence { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 24px 0; }
.nt-sequence-tile { width: 64px; min-height: 68px; display: grid; place-items: center; border-radius: 17px; border: 3px solid #C8DAE0; background: #E9F4F5; font-size: 29px; font-weight: 600; }
.nt-blank { border-style: dashed; border-color: #B5A577; background: #FFF9E1; }
.nt-blank.nt-filled { border-style: solid; background: #D3E9D3; border-color: #78A584; }
.nt-answers { display: flex; justify-content: center; gap: 20px; padding: 4px 0 18px; }
.nt-answer { width: 62px; height: 62px; border-radius: 18px; font-size: 28px; }
html.quiet .nt-art-color, [data-quiet="true"] .nt-art-color { transition: none; }
@media (prefers-reduced-motion: reduce) { .nt-art-color { transition: none; } }
@media (min-width: 600px), (orientation: landscape) {
  .nt-grid { grid-template-columns: repeat(5, minmax(48px, 1fr)); max-width: 620px; gap: 15px 12px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .number-trail { gap: 3px; padding-top: 0; padding-bottom: 8px; }
  .nt-art { width: 96px; }
  .nt-discovery { gap: 9px; }
  .nt-discovery-copy { display: flex; align-items: center; gap: 10px; }
  .nt-caption { font-size: 13px; }
  .nt-counter { margin-top: 0; font-size: 13px; }
  .nt-grid { grid-auto-rows: 48px; gap: 8px 10px; padding: 4px 8px; }
  .nt-checkpoint { width: 48px; height: 48px; font-size: 23px; }
  .nt-sequence { padding: 4px 0; gap: 12px; }
  .nt-sequence-tile { min-height: 49px; width: 59px; font-size: 25px; }
  .nt-answers { padding: 4px 0; }
  .nt-answer { width: 52px; height: 48px; font-size: 24px; }
}


/* Quantity and numeral practice share large, stable visual supports. */
.trace-quantity { display: flex; flex: none; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 5px 12px; border-radius: 15px; background: #fff9e9; }
.trace-quantity-label { color: #6b604b; font-size: 15px; font-weight: 600; }
.trace-dot-frames { display: flex; gap: 10px; }
.trace-dot-frame { display: grid; grid-template-columns: repeat(5, 13px); grid-template-rows: repeat(2, 13px); gap: 4px; padding: 5px; background: white; border: 2px solid #d7e6d3; border-radius: 8px; }
.trace-dot { width: 13px; height: 13px; border-radius: 50%; background: #72a88b; }
.trace-dot.trace-dot-empty { background: #f0f4eb; }
.number-hunt-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(10px, 2vw, 20px); width: min(110px, 100%); padding: 12px 5px; justify-items: center; }
.number-hunt-dot { display: block; width: clamp(18px, 5vw, 32px); aspect-ratio: 1; border-radius: 50%; background: #eb9676; box-shadow: inset 2px 3px 0 #ffffff50, 0 2px 0 #c77566; }
.number-hunt-group[data-layout="scattered"] .number-hunt-dot { transform: translateY(var(--dot-offset)); }
.quantity-group-card { min-height: 180px; }
.practice-response-note { display: block; margin-top: 5px; line-height: 1.5; color: #547281; }
.learning-paths { display: grid; gap: 12px; margin: 16px 0; }
.learning-path { display: block; padding: 14px 16px; border: 2px solid #d9e8dc; border-radius: 15px; background: #f8fcf4; text-decoration: none; color: #294e54; }
.learning-path strong, .learning-path span { display: block; }
.learning-path span { margin-top: 3px; font-size: 14px; }
@media (max-width: 420px) {
  .trace-quantity { gap: 6px; padding: 4px; }
  .trace-quantity-label { font-size: 12px; }
  .trace-dot-frames { gap: 5px; }
  .trace-dot-frame { grid-template-columns: repeat(5, 10px); grid-template-rows: repeat(2, 10px); gap: 3px; padding: 4px; }
  .trace-dot { width: 10px; height: 10px; }
  .quantity-group-card { min-height: 145px; }
}


/* First Sounds: clear model and a large, repeatable picture-name control. */
.first-sounds-panel { flex-wrap: wrap; justify-content: space-evenly; gap: 10px 20px; }
.fs-model { display: flex; align-items: center; justify-content: center; gap: 12px; }
.fs-model .fs-model-picture { font-size: clamp(36px, 8vmin, 60px); line-height: 1; }
.fs-model-word { color: var(--skill-2); font-size: clamp(22px, 4.8vmin, 34px); line-height: 1.15; }
.fs-listen-label { font-size: clamp(16px, 3.8vmin, 22px); line-height: 1.2; max-width: 125px; }
.fs-hear-pictures { min-height: 48px; min-width: 165px; display: inline-flex; justify-content: center; align-items: center; gap: 9px; padding: 9px 13px; border: 2px solid #ADC4D6; border-radius: 16px; background: #EDF5FA; color: #355D79; box-shadow: 0 3px 0 #BDCED9; font: inherit; font-size: 16px; font-weight: 600; line-height: 1.15; cursor: pointer; touch-action: manipulation; }
.fs-hear-pictures:focus-visible { outline: 4px solid #376AA6; outline-offset: 3px; }
.fs-hear-pictures:disabled { cursor: default; opacity: .65; }
.fs-speaker { width: 23px; height: 23px; flex: none; }
.fs-speaker svg { display: block; width: 100%; height: 100%; }
.choice.first-sounds-choice .fs-picture-card { gap: .15em; padding: 7px; }
.choice.first-sounds-choice .caption { font-size: max(15px, .28em); line-height: 1.15; }
@media (orientation: landscape) and (max-height: 480px) {
  .first-sounds-panel { min-height: 66px; padding: 7px 12px; }
  .fs-model .fs-model-picture { font-size: 36px; }
  .fs-model-word { font-size: 23px; }
  .fs-listen-label { font-size: 17px; max-width: none; }
  .fs-hear-pictures { font-size: 15px; padding: 6px 11px; }
}

/* The instruction gets a steady visual cue before and during its voice. */
.instruction-cue-slot { min-height: 25px; margin-bottom: 4px; }
.instruction-cue { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; padding: 2px 9px; background: #fff1b9; color: #634a17; border-radius: 9px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.instruction-cue[hidden] { display: none; }
.instruction-cue > span:first-child { font-size: 17px; }
.instruction-waves { display: block; width: 15px; height: 16px; fill: currentColor; }
.instruction-waves rect { transform-box: fill-box; transform-origin: center; }
[data-prompt-state="speaking"] .instruction-waves rect { animation: instruction-wave .65s ease-in-out infinite alternate; }
[data-prompt-state="speaking"] .instruction-waves rect:nth-child(2) { animation-delay: -.3s; }
[data-prompt-state="waiting"] .game-prompt, [data-prompt-state="speaking"] .game-prompt { box-shadow: inset 0 0 0 3px #efc75b; background: #fffdf4; }
[data-prompt-state="muted"] .instruction-cue { background: #edf2f6; color: #586f7d; }
[data-prompt-state="muted"] .instruction-waves { display: none; }
.intro-listen-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 4px 0; color: #5b7182; font-size: 15px; }
.intro-listen-note > span { font-size: 22px; }
[data-sound="false"] .intro-listen-note { display: none; }
@keyframes instruction-wave { to { transform: scaleY(.45); } }

/* Listen first: while the instruction is on its way the play area waits. A tap
   on it only bobs the pill; the words below the prompt light up as they are said. */
[data-listening="true"] .stage-inner { opacity: .72; filter: saturate(.7); transition: opacity .25s, filter .25s; }
[data-listening="true"] .stage { cursor: wait; }
.instruction-cue.nudge { animation: cue-nudge .6s ease-out; }
@keyframes cue-nudge { 25% { transform: translateY(-4px) scale(1.08); } 55% { transform: translateY(2px); } }
.quiet .instruction-cue.nudge { animation: none; box-shadow: 0 0 0 3px #efc75b; }

.speech-caption {
  margin: 6px 0 0; font-size: clamp(16px, 2.6vmin, 19px); line-height: 1.35; font-weight: 500;
  color: #a2adbd; overflow-wrap: anywhere;
}
.speech-caption[hidden] { display: none; }
.speech-caption .cap-word { transition: color .12s; border-radius: 6px; padding: 0 1px; }
.speech-caption .cap-word.said { color: #303c60; }
.speech-caption .cap-word.now { color: var(--skill-2, #51409e); background: var(--skill-soft, #eeebfc); font-weight: 700; }
[data-sound="false"] .speech-caption .cap-word { color: #303c60; }
.game-room .game-prompt .speech-caption { font-size: clamp(16px, 2.2vw, 19px); color: #a2adbd; }
.game-room .game-prompt .speech-caption .cap-word.said { color: #303c60; }
.game-room .game-prompt .speech-caption .cap-word.now { color: var(--skill-2, #51409e); }
@media (max-width: 700px) {
  .speech-caption, .game-room .game-prompt .speech-caption { font-size: 15px; margin-top: 4px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .speech-caption, .game-room .game-prompt .speech-caption { font-size: 14px; margin-top: 2px; }
}
html.quiet .instruction-waves rect, [data-quiet="true"] .instruction-waves rect { animation: none; }
@media (prefers-reduced-motion: reduce) { .instruction-waves rect { animation: none !important; } }
@media (max-width: 600px) {
  .game-prompt .replay-prompt { flex-direction: column; gap: 3px; padding: 9px; min-width: 54px; font-size: 12px; }
  .game-prompt .replay-prompt span:not(.emoji) { display: inline; }
  .instruction-cue-slot { min-height: 23px; }
  .instruction-cue { font-size: 12px; padding: 2px 6px; }
}

/* Let the start card grow rather than burying Play inside a scrollable card. */
.stage:has(> #intro:not([hidden])) { height: auto; min-height: 360px; }
/* the empty play area must not keep its 100% height, or the start card lands below the clipped stage */
.stage:has(> #intro:not([hidden])) > .stage-inner { height: auto; }
#intro:not([hidden]) { position: relative; inset: auto; min-height: 330px; }
#intro .overlay-card { max-height: none; }
#intro .card-art { width: clamp(86px, 20vmin, 110px); }

/* Little Builder: a visible garage, meaningful choices, and room for a word. */
.stage[data-scene="little-builder"] { height: auto; min-height: 340px; background: #e9e8fa; }
.stage[data-scene="little-builder"] .stage-inner { height: auto; }
.little-builder-game { width: 100%; padding: 12px; display: grid; gap: 12px; border-radius: 20px; background: #faf6ed; color: #3d5365; }
.lb-project-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 7px; }
.lb-project-name { font-size: 16px; font-weight: 600; }
.lb-parts-count { flex: none; padding: 5px 10px; border-radius: 12px; background: #e4ecdf; color: #4d6856; font-size: 13px; font-weight: 550; }
.lb-world { width: 100%; height: clamp(180px, 30vw, 300px); border-radius: 17px; overflow: hidden; background: #dff1f2; }
.lb-world > svg { display: block; width: 100%; height: 100%; }
.lb-controls { display: grid; gap: 10px; width: min(100%, 760px); margin: 0 auto; }
.lb-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lb-choices[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lb-choice { border: 3px solid #d5d9ec; border-radius: 22px; background: #fff; color: #394b67; box-shadow: 0 4px 0 #b8c2dc; min-height: 120px; padding: 9px 12px; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; font: inherit; cursor: pointer; touch-action: manipulation; }
.lb-choice:hover { border-color: #9b9ada; }
.lb-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 #b8c2dc; }
.lb-choice-art { display: block; width: 100%; max-width: 120px; height: 80px; }
.lb-choice-art svg, .lb-model-art svg, .lb-word-art svg { display: block; width: 100%; height: 100%; }
.lb-choice-name { font-size: 19px; line-height: 1.1; font-weight: 550; }
.lb-choice.lb-help { border-color: #e2b045; outline: 4px solid #ffdb72; outline-offset: 2px; }
.lb-choice.lb-try-again { border-color: #d7bfa5; }
.lb-request-model { display: flex; align-items: center; justify-content: center; gap: 10px; color: #645c85; background: #f1edf9; border-radius: 14px; padding: 4px 12px; font-weight: 600; font-size: 18px; }
.lb-model-art { display: block; width: 55px; height: 42px; }
.lb-word-turn { display: flex; justify-content: center; gap: 22px; }
.lb-word-model { display: flex; align-items: center; justify-content: center; gap: 9px; }
.lb-word-art { display: block; width: 82px; height: 65px; }
.lb-word-model strong { font-size: 26px; font-weight: 550; }
.lb-word-invitation { margin: 0; text-align: center; color: #687285; font-size: 15px; }
.lb-word-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.lb-hear, .lb-next { display: inline-flex; align-items: center; justify-content: center; border-radius: 15px; padding: 13px 20px; min-height: 52px; border: 2px solid #cbd9e5; background: #eef6fc; color: #3b6079; font: inherit; font-weight: 550; cursor: pointer; touch-action: manipulation; }
.lb-next { border-color: #6d6ade; background: #726cec; color: #fff; box-shadow: 0 3px 0 #534dba; }
.lb-next:active { transform: translateY(2px); box-shadow: 0 1px 0 #534dba; }
.lb-finish { justify-self: center; }
.lb-choice:focus-visible, .lb-next:focus-visible, .lb-hear:focus-visible { outline: 4px solid #2575af; outline-offset: 4px; }
.lb-paused *, html.quiet .little-builder-game *, .little-builder-game[data-quiet="true"] * { animation-play-state: paused !important; }
@media (max-width: 600px) {
  .little-builder-game { padding: 8px; gap: 8px; }
  .lb-project-heading { padding: 0 2px; }
  .lb-project-name { font-size: 13px; }
  .lb-parts-count { font-size: 11px; padding: 5px 7px; }
  .lb-choices { gap: 8px; }
  .lb-choice { min-height: 106px; border-radius: 17px; padding: 8px 4px; }
  .lb-choice-art { height: 65px; }
  .lb-choice-name { font-size: 16px; }
  .lb-word-art { width: 55px; height: 50px; }
  .lb-word-model { gap: 5px; }
  .lb-word-turn { gap: 12px; }
  .lb-word-model strong { font-size: 20px; }
  .lb-word-invitation { font-size: 13px; }
  .lb-hear, .lb-next { padding: 12px 14px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .little-builder-game * { animation: none !important; transition: none !important; } }

/* Little Builder's SVG art only. All interactions remain with the controller. */
.lb-world .lb-scene-svg { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 22px; }
.lb-piece-svg, .lb-action-svg { display: block; width: 100%; height: 100%; max-width: 150px; margin: auto; overflow: visible; }
.lb-world .lb-scene-svg[data-car="driving"] .lb-art-road-dashes { animation: lb-art-road .8s linear infinite; }
.lb-world .lb-scene-svg[data-car="driving"] .lb-art-car-bob { animation: lb-art-bob .42s ease-in-out infinite alternate; }
@keyframes lb-art-road { to { stroke-dashoffset: 77; } }
@keyframes lb-art-bob { from { transform: translateY(0); } to { transform: translateY(-2.5px); } }
html.quiet .lb-world .lb-art-road-dashes, html.quiet .lb-world .lb-art-car-bob,
[data-quiet="true"] .lb-world .lb-art-road-dashes, [data-quiet="true"] .lb-world .lb-art-car-bob { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .lb-world .lb-art-road-dashes, .lb-world .lb-art-car-bob { animation: none !important; }
}

/* Snack Safari: a picnic, an editable plate, and three short orders. */
.stage[data-scene="snack-safari"] { height: auto; min-height: 340px; background: #e2eee4; }
.stage[data-scene="snack-safari"] .stage-inner { height: auto; }
.snack-safari-game { width: 100%; padding: 13px; display: grid; gap: 10px; border-radius: 20px; background: #fff9ee; color: #354e46; }
.sf-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 0 7px; }
.sf-picnic-title { font-size: 16px; font-weight: 600; }
.sf-round { font-size: 12px; font-weight: 550; background: #e4edcf; border-radius: 15px; padding: 6px 11px; }
.sf-world { width: 100%; height: clamp(135px, 23vw, 220px); border-radius: 18px; overflow: hidden; background: #e9f2d9; }
.sf-world > svg, .sf-world .sf-scene-svg { display: block; width: 100%; height: 100%; }
.sf-controls { width: min(100%, 730px); margin: auto; display: grid; gap: 10px; }
.sf-controls:focus { outline: none; }
.sf-order-model { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 10px; background: #f7edcd; border-radius: 14px; min-height: 48px; }
.sf-model-label { font-size: 14px; font-weight: 550; }
.sf-model-foods { display: flex; align-items: center; gap: 3px; }
.sf-model-food { width: 37px; height: 37px; display: block; }
.sf-model-arrow { font-size: 20px; color: #8d7850; }
.sf-food-tray { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.sf-food-tray[data-count="3"] { grid-template-columns: repeat(3,minmax(0,1fr)); }
.sf-food-card { position: relative; min-height: 100px; padding: 6px 14px 9px; background: #fff; border: 2px solid #dbcbaa; border-radius: 20px; box-shadow: 0 4px 0 #d8c7a2; color: #475444; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; cursor: pointer; touch-action: manipulation; }
.sf-food-card:hover { border-color: #8da985; }
.sf-food-card:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8c7a2; }
.sf-food-card.sf-selected { border-color: #539274; background: #f1f9e9; }
.sf-food-art { display: block; width: 90px; height: 66px; max-width: 100%; }
.sf-food-name { font-size: 17px; font-weight: 550; line-height: 1.2; }
.sf-add-mark { position: absolute; top: 8px; right: 9px; width: 22px; height: 22px; border-radius: 50%; background: #edf4e6; color: #54764f; display: grid; place-items: center; font-size: 18px; line-height: 1; }
.sf-plate-area { position: relative; background: #f2e7d5; border-radius: 20px; padding: 7px 13px 8px; display: grid; gap: 4px; }
.sf-plate-label { text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: #796851; }
.sf-plate { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 83px; padding: 5px 12px; background: #fffdfa; border: 4px solid #dfebe6; border-radius: 60px; box-shadow: inset 0 0 0 2px #bed3c9, 0 3px 0 #d2c5b1; }
.sf-plate-empty { color: #8a8c7a; font-size: 15px; }
.sf-plate-food { position: relative; flex: 0 1 76px; min-width: 44px; min-height: 54px; border: 0; background: transparent; padding: 3px; border-radius: 16px; cursor: pointer; touch-action: manipulation; }
.sf-plate-food:hover { background: #f6ebd8; }
.sf-plate-food-art { display: block; height: 62px; width: 100%; }
.sf-remove-mark { position: absolute; right: -1px; top: -1px; width: 19px; height: 19px; display: grid; place-items: center; background: #f2e1c9; color: #715c42; border: 1px solid #d9c7ae; border-radius: 50%; font-size: 17px; }
.sf-order-index { position: absolute; bottom: -3px; left: -1px; border-radius: 50%; background: #567b70; color: #fff; width: 19px; height: 19px; display: grid; place-items: center; font-size: 11px; }
.sf-plate-tip { text-align: center; font-size: 12px; color: #807059; padding-top: 2px; }
.sf-serve, .sf-next, .sf-hear { min-height: 50px; padding: 12px 22px; border-radius: 16px; border: 2px solid #4c8069; background: #528c72; box-shadow: 0 3px 0 #39654e; color: #fff; font: inherit; font-size: 17px; font-weight: 550; cursor: pointer; touch-action: manipulation; }
.sf-serve { width: min(100%, 320px); justify-self: center; }
.sf-next:active, .sf-serve:active, .sf-hear:active { transform: translateY(2px); box-shadow: 0 1px 0 #39654e; }
.sf-help { outline: 4px solid #f5c55a; outline-offset: 2px; }
.sf-thank-you { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 17px; font-weight: 550; }
.sf-friend-mini { width: 48px; height: 46px; display: block; }
.sf-word-foods { display: flex; gap: 8px; justify-content: center; }
.sf-word-food { display: block; width: 70px; height: 65px; }
.sf-word-label { font-size: 24px; text-align: center; font-weight: 550; }
.sf-word-invite { font-size: 14px; text-align: center; color: #737a66; margin: 0; }
.sf-word-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sf-hear { background: #fff7e4; border-color: #d7c9a9; box-shadow: 0 3px 0 #d8c7a2; color: #715f43; }
.sf-picnic-guests { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.sf-guest-card { min-width: 0; padding: 10px; border: 2px solid #d9dfc9; border-radius: 18px; background: #fff; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sf-guest-art { display: block; width: 85px; height: 75px; max-width: 100%; }
.sf-guest-foods { display: flex; justify-content: center; flex-wrap: wrap; }
.sf-picnic-food { border: 0; background: #f5efdf; padding: 2px; border-radius: 12px; cursor: pointer; min-height: 44px; min-width: 44px; }
.sf-picnic-food-art { display: block; width: 45px; height: 42px; }
.sf-finish { justify-self: center; }
.sf-food-art svg, .sf-model-food svg, .sf-plate-food-art svg, .sf-word-food svg, .sf-friend-mini svg, .sf-guest-art svg, .sf-picnic-food-art svg { display: block; width: 100%; height: 100%; }
.sf-controls button:focus-visible { outline: 4px solid #316b9e; outline-offset: 3px; }
.sf-paused *, html.quiet .snack-safari-game *, .snack-safari-game[data-quiet="true"] * { animation-play-state: paused !important; }
@media (max-width: 600px) {
  .snack-safari-game { padding: 8px; gap: 8px; }
  .sf-heading { padding: 0 2px; }
  .sf-picnic-title { font-size: 13px; }
  .sf-round { font-size: 10px; padding: 5px 8px; }
  .sf-controls { gap: 9px; }
  .sf-food-tray { gap: 8px; }
  .sf-food-card { min-height: 91px; padding: 5px 3px 8px; border-radius: 16px; }
  .sf-food-art { height: 58px; width: 75px; }
  .sf-food-name { font-size: 14px; }
  .sf-add-mark { width: 18px; height: 18px; font-size: 15px; top: 4px; right: 4px; }
  .sf-model-label { font-size: 12px; }
  .sf-model-food { width: 30px; height: 32px; }
  .sf-order-model { gap: 7px; padding: 3px 8px; }
  .sf-plate-area { padding: 6px 7px; }
  .sf-plate { min-height: 70px; gap: 3px; padding: 4px; }
  .sf-plate-food { flex-basis: 52px; padding: 1px; }
  .sf-plate-food-art { height: 49px; }
  .sf-plate-empty { font-size: 13px; }
  .sf-plate-tip { font-size: 10px; }
  .sf-serve, .sf-next, .sf-hear { font-size: 15px; min-height: 48px; padding: 11px 16px; }
  .sf-thank-you { font-size: 15px; }
  .sf-word-label { font-size: 21px; }
  .sf-word-invite { font-size: 12px; }
  .sf-word-food { width: 57px; height: 51px; }
  .sf-picnic-guests { gap: 6px; }
  .sf-guest-card { padding: 7px 3px; font-size: 13px; }
  .sf-guest-art { height: 60px; }
}
@media (prefers-reduced-motion: reduce) { .snack-safari-game * { animation: none !important; transition: none !important; } }

/* Snack Safari art only: interactions, labels and progress belong to the game. */
.sf-scene-svg { display: block; width: 100%; height: auto; overflow: hidden; border-radius: 24px; }
.sf-food-svg, .sf-friend-svg { display: block; width: 100%; height: 100%; max-width: 170px; margin: auto; overflow: visible; }
.sf-scene-svg[data-happy="true"] .sf-art-active-friend .sf-art-character,
.sf-friend-svg[data-happy="true"] .sf-art-character { animation: sf-art-happy-hop .65s ease-out 1; }
.sf-scene-svg[data-happy="true"] .sf-art-active-friend .sf-art-eyes,
.sf-friend-svg[data-happy="true"] .sf-art-eyes { transform-box: fill-box; transform-origin: center; animation: sf-art-happy-blink .7s ease-out 1; }
@keyframes sf-art-happy-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } 65% { transform: translateY(0); } 82% { transform: translateY(-2px); } }
@keyframes sf-art-happy-blink { 0%, 30%, 64%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.13); } }
html.quiet .sf-art-character, html.quiet .sf-art-eyes,
[data-quiet="true"] .sf-art-character, [data-quiet="true"] .sf-art-eyes { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .sf-art-character, .sf-art-eyes { animation: none !important; }
}

/* Picture names are highlighted only while their audio is actually playing. */
.hear-picture-options {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: center; gap: 8px; min-height: 48px; padding: 10px 15px;
  border: 2px solid #adc4d6; border-radius: 16px; background: #edf5fa;
  color: #355d79; box-shadow: 0 3px 0 #bdced9; cursor: pointer;
  font: inherit; font-size: clamp(14px, 3vmin, 16px); font-weight: 600;
  line-height: 1.2; touch-action: manipulation;
}
.hear-picture-options:focus-visible { outline: 4px solid #376aa6; outline-offset: 3px; }
.hear-picture-options:disabled { opacity: .65; cursor: default; }
.focus-panel.is-narrating { box-shadow: inset 0 0 0 3px #377ab5, var(--shadow-sm); }
.choice.is-narrating {
  border-color: #377ab5; background: #eef7ff;
  box-shadow: inset 0 0 0 3px #b9dcf6, 0 6px 0 #aacbe2;
}
.choice.is-narrating::after {
  content: "♪"; position: absolute; top: 7px; right: 9px;
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: #377ab5; color: white;
  font-size: 22px; line-height: 1;
}
.rhyme-model-panel { flex-wrap: wrap; justify-content: space-evenly; gap: 10px 20px; }
.rhyme-model { display: flex; align-items: center; justify-content: center; gap: 12px; }
.rhyme-model-picture { font-size: clamp(36px, 8vmin, 60px); line-height: 1; }
.rhyme-model-word { color: var(--skill-2); font-size: clamp(22px, 4.8vmin, 34px); line-height: 1.15; }
.choice.rhyme-choice .caption { font-size: max(15px, .28em); line-height: 1.15; }
@media (orientation: landscape) and (max-height: 480px) {
  .rhyme-model-panel { min-height: 66px; padding: 7px 12px; }
  .rhyme-model-picture { font-size: 36px; }
  .rhyme-model-word { font-size: 23px; }
  .hear-picture-options { font-size: 14px; padding: 6px 10px; }
}

/* The next-game suggestion reuses the game card and keeps all choices available. */
.game-card:not(.featured) .card-subtitle { display: none; }
.recommendation-badge {
  position: absolute; top: 20px; left: 20px; max-width: calc(100% - 86px);
  padding: 9px 14px; border-radius: 13px; background: #fff1b8; color: #5b4917;
  box-shadow: 0 3px 0 #e9cd7d; font-size: 16px; font-weight: 700; line-height: 1.2;
}
.featured:has(.recommendation-badge) .game-tag { display: none; }
.recommendation-details { margin: -8px 0 20px; color: #547081; font-size: 14px; }
.recommendation-details summary { width: fit-content; min-height: 36px; padding: 8px 0; cursor: pointer; }
.recommendation-details p { max-width: 760px; margin: 5px 0 9px; line-height: 1.5; }
.recommendation-details .small { font-size: 12px; }
@media (max-width: 480px) {
  .recommendation-badge { top: 13px; left: 13px; font-size: 14px; padding: 8px 11px; }
  .featured .card-subtitle { font-size: 15px; }
}

/* Spell It: a picture with one slot per letter, and a row of letter tiles to tap in order. */
.stage:has(.spell-learning) { height: auto; min-height: 300px; }
.stage-inner:has(> .spell-learning) { height: auto; }
.spell-learning { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: clamp(14px, 3vmin, 26px); padding: 12px 4px 8px; }
.spell-word {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: clamp(10px, 3vmin, 22px); max-width: 100%;
  padding: clamp(10px, 2.5vmin, 18px) clamp(12px, 3vmin, 26px); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); border: 4px solid transparent; transition: border-color .2s, background .2s;
}
.spell-word.correct { border-color: var(--ok); background: #f1fff5; animation: bounce 0.6s ease; }
.spell-picture { font-size: clamp(2.6rem, 11vmin, 5rem); line-height: 1; }
.spell-slots { --spell-size: clamp(44px, 10vmin, 74px); display: flex; gap: clamp(6px, 1.6vmin, 12px); max-width: 100%; }
/* long words get smaller slots so the whole word still fits on one line */
.spell-slots[data-n="5"], .spell-slots[data-n="6"] { --spell-size: clamp(40px, 8.5vmin, 66px); }
.spell-slots[data-n="7"], .spell-slots[data-n="8"] { --spell-size: clamp(34px, 7vmin, 58px); }
.spell-slot {
  position: relative; display: flex; align-items: center; justify-content: center; width: var(--spell-size); height: calc(var(--spell-size) * 1.15);
  border: 4px dashed var(--skill-soft); border-radius: 16px; background: #fffdf7; color: var(--ink);
  font-weight: 800; font-size: calc(var(--spell-size) * 0.66); line-height: 1; transition: border-color .15s, background .15s, box-shadow .15s;
}
.spell-slot .spell-guide { color: color-mix(in srgb, var(--skill) 38%, white); }
.spell-slot.filled { border-style: solid; border-color: var(--skill); background: var(--surface); animation: bounce 0.5s ease; }
.spell-slot.saying { border-color: var(--sun-2); background: var(--sun-soft); box-shadow: 0 0 0 5px var(--sun-soft); }
.spell-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 2vmin, 14px); width: 100%; max-width: 640px; }
.spell-tile {
  --spell-tile: clamp(52px, 12vmin, 82px);
  display: flex; align-items: center; justify-content: center; width: var(--spell-tile); height: var(--spell-tile); padding: 0;
  border: 5px solid var(--skill-soft); border-radius: 18px; background: var(--surface); color: var(--ink);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--skill) 35%, white); font: inherit; font-weight: 800; font-size: calc(var(--spell-tile) * 0.6);
  line-height: 1; cursor: pointer; transition: transform 0.1s, opacity 0.2s; animation: popin 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.spell-tile:active { transform: translateY(4px) scale(0.98); }
.spell-tile.wrong { animation: shake 0.45s ease; border-color: #f0a08b; }
.spell-tile.hint { animation: wiggle 0.7s ease-in-out 3; border-color: var(--sun); box-shadow: 0 0 0 6px var(--sun-soft), 0 6px 0 var(--sun-2); }
.spell-tile.used { opacity: 0.18; transform: scale(0.85); box-shadow: none; pointer-events: none; }
.spell-tile:disabled:not(.used) { cursor: default; }
.spell-tile:focus-visible { outline: 4px solid #307bac; outline-offset: 3px; }
.spell-tiles > .spell-tile:nth-child(2) { animation-delay: 0.05s; }
.spell-tiles > .spell-tile:nth-child(3) { animation-delay: 0.1s; }
.spell-tiles > .spell-tile:nth-child(4) { animation-delay: 0.15s; }
.spell-tiles > .spell-tile:nth-child(5) { animation-delay: 0.2s; }
.spell-tiles > .spell-tile:nth-child(6) { animation-delay: 0.25s; }
.spell-tiles > .spell-tile:nth-child(7) { animation-delay: 0.3s; }
.spell-tiles > .spell-tile:nth-child(8) { animation-delay: 0.35s; }
.spell-tiles > .spell-tile:nth-child(9) { animation-delay: 0.4s; }
@media (max-width: 480px) {
  .spell-slots { --spell-size: clamp(38px, 12vw, 54px); gap: 5px; }
  .spell-slots[data-n="5"], .spell-slots[data-n="6"] { --spell-size: clamp(34px, 11vw, 46px); }
  .spell-slots[data-n="7"], .spell-slots[data-n="8"] { --spell-size: clamp(30px, 9vw, 38px); gap: 4px; }
  .spell-slot { border-width: 3px; border-radius: 12px; }
  .spell-tile { --spell-tile: clamp(48px, 15vw, 64px); border-width: 4px; border-radius: 14px; }
  .spell-tiles { gap: 8px; }
  .spell-picture { font-size: clamp(2.2rem, 12vw, 3.4rem); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .stage:has(.spell-learning) { min-height: 0; }
  .spell-learning { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 6px 4px; }
  .spell-word { padding: 6px 12px; gap: 10px; }
  .spell-slots { --spell-size: clamp(34px, 9vmin, 46px); }
  .spell-slots[data-n="7"], .spell-slots[data-n="8"] { --spell-size: clamp(30px, 7vmin, 40px); }
  .spell-picture { font-size: 2rem; }
  .spell-tile { --spell-tile: clamp(44px, 11vmin, 54px); }
  .spell-tiles { max-width: none; gap: 6px; }
}
.quiet .spell-tile, [data-quiet="true"] .spell-tile, .quiet .spell-slot, [data-quiet="true"] .spell-slot, .quiet .spell-word, [data-quiet="true"] .spell-word { animation: none; }

/* Count It level four: two little groups with a plus between them (the middle grid row). */
.count-learning[data-layout="adding"] .count-board { grid-template-rows: var(--count-cell) 34px var(--count-cell); align-items: center; }
.count-learning .count-plus {
  display: grid; place-items: center; height: 34px; color: #2e816d; font-size: 28px; font-weight: 800; line-height: 1;
  background: linear-gradient(to right, transparent, #d5e7dc 20%, #d5e7dc 80%, transparent) center / 100% 3px no-repeat;
}
.count-learning .count-plus::before { content: "+"; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #e4f5ea; border: 2px solid #b5dcc5; }
.count-learning .count-plus { font-size: 0; }
.count-learning .count-plus::before { font-size: 24px; }

/* More or Less level four: two plain numbers */
.choice.number-card { font-size: clamp(2.8rem, 18vmin, 7.5rem); font-variant-numeric: tabular-nums; }

/* ---- Immersive play: on a phone the game room becomes a viewport-sized "book",
   like Story time. No page chrome, the game's own art blurred into a dark
   atmosphere, round glass tools at the top, the picture in the middle, the words
   in a parchment panel below with a page track and a dock of pill buttons.
   core/immersive.js adds `immersive` to <body> on phones (and in full screen
   anywhere). Portrait stacks the rows; a landscape phone keeps the panel and
   dock beside the picture. Games keep their own scene CSS; only the frame moves.
   (lesson-room.css lays the quiz room out with `#game-root[data-kind]` rules of
   ID strength and pins the Help bar to the bottom; the structural declarations
   here carry !important so the book layout wins whenever `body.immersive` is on.) */
body.immersive { overflow: hidden; background: #182d31; }
body.immersive .game-room {
  --glass: rgba(24, 43, 47, .65); --glass-line: #ffffff26; --paper: #fffbedf2; --paper-ink: #173b43; --paper-soft: #58706b; --glow: #ffda68;
  position: fixed; inset: var(--play-viewport-top, 0px) 0 auto; width: 100%; max-width: none !important; height: 100vh; height: var(--play-viewport-height, 100dvh) !important; min-height: 0 !important; margin: 0;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
  display: grid !important; gap: 8px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto auto !important;
  grid-template-areas: "head" "stage" "prompt" "dots" "feedback" "dock";
  color: #fff9e9; background: #1c3234; isolation: isolate; overflow: clip;
}
body.immersive .game-room::before {
  content: ""; position: absolute; inset: -60px; z-index: -2;
  background: linear-gradient(#162d34a6, #15272ab3), var(--ambient-image, none) center / cover; filter: blur(32px); transform: scale(1.15);
}
body.immersive .game-room::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, transparent 20%, #081d2461 100%); }
body.immersive .game-playfield { display: contents !important; }
body.immersive .game-room-header { grid-area: head; min-height: 46px; margin: 0; gap: 8px; }
body.immersive .game-room-header > .soft-button, body.immersive .game-focus {
  width: 46px; height: 46px; min-width: 46px; min-height: 46px; padding: 0; border-radius: 50%; font-size: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 0;
  background: var(--glass); color: #fff9e9; border: 1px solid var(--glass-line); box-shadow: none;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: background .2s, transform .2s;
}
body.immersive .game-room-header > .soft-button:hover, body.immersive .game-focus:hover { background: #ffffff30; transform: translateY(-1px); }
body.immersive .game-room-header > .soft-button :is(.emoji, .ui-icon, svg), body.immersive .game-focus svg { font-size: 21px; width: 21px; height: 21px; display: block; }
body.immersive .game-room-header > .soft-button .emoji[hidden] { display: none; }
body.immersive #sound-label { display: none; }
body.immersive .game-room-title { text-align: center; min-width: 0; }
body.immersive .game-room-title h1 { color: #fff9e9; font-size: 18px; font-weight: 500; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.immersive .game-room-title > span { display: block; color: #e9e2c1c9; font-size: 10px; letter-spacing: 2.2px; text-transform: uppercase; }
.game-focus { display: none; }
.game-focus svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.game-focus[aria-pressed="true"] .focus-expand, .game-focus:not([aria-pressed="true"]) .focus-shrink { display: none; }
body.immersive .game-focus, body.can-focus .game-focus { display: inline-flex; }

/* the picture: the stage fills what the panel and dock leave (its own scene sizing
   rules are more specific than this frame, hence the priorities); tall scenes scroll inside */
body.immersive .game-room .stage {
  grid-area: stage; height: 100% !important; min-height: 0 !important; max-height: none !important;
  border: 0; border-radius: 22px; box-shadow: 0 18px 40px #05161b66; padding: 10px; overflow: auto; overscroll-behavior: contain;
  background: #eef3fb;
}
body.immersive .game-room .stage { color: var(--ink, #183d55); } /* the page is the dark part; the picture keeps its ink */
body.immersive .game-room .stage:has(> #intro:not([hidden])) { background: transparent; box-shadow: none; padding: 0; color: #fff9e9; }
body.immersive .game-room .stage:has(> #finish:not([hidden])) { background: #fbf7ee; }
body.immersive .game-room .stage-inner { min-height: 100%; }

/* the words: a parchment panel with the instruction and its lit-up words; the
   listening pill sits on its top edge; the Listen button is a round teal tool */
body.immersive .game-room .game-prompt {
  grid-area: prompt; position: relative; min-height: 0; margin: 6px 0 0; padding: 14px 16px 12px; gap: 12px; align-items: center;
  background: var(--paper); border: 1px solid #ffffffc9; border-radius: 22px; box-shadow: 0 12px 40px #041e2933; color: var(--paper-ink);
}
body.immersive .game-room:is([data-prompt-state="waiting"], [data-prompt-state="speaking"]) .game-prompt { background: var(--paper); box-shadow: 0 12px 40px #041e2933, inset 0 0 0 2px #ffda6880; }
body.immersive .game-room .game-prompt .host { font-size: 30px; }
body.immersive .game-room .game-prompt img.host { width: 40px; height: 40px; border-width: 2px; box-shadow: 0 2px 0 #d9d2b8; }
body.immersive .game-room .game-prompt h2 { color: var(--paper-ink); font-size: 19px; font-weight: 600; line-height: 1.2; }
body.immersive .game-room .game-prompt h2 .big { font-size: 1.45em; }
body.immersive .game-room .game-prompt p#prompt-detail { display: none; }
body.immersive .game-room .game-prompt .speech-caption {
  margin-top: 4px; font-size: clamp(17px, 4.6vw, 22px); line-height: 1.35; font-weight: 500; color: #9aa89f; letter-spacing: -.2px;
  max-height: calc(3 * 1.35em + 4px); overflow: hidden; scroll-behavior: smooth; /* a long instruction scrolls like a teleprompter */
}
body.immersive .game-room .game-prompt .speech-caption .cap-word { padding: 0 2px; border-radius: 6px; border-bottom: 3px solid transparent; }
body.immersive .game-room .game-prompt .speech-caption .cap-word.said { color: var(--paper-ink); }
body.immersive .game-room .game-prompt .speech-caption .cap-word.now { color: #132f38; background: var(--glow); border-bottom-color: #d69b29; font-weight: 600; }
body.immersive[data-sound="false"] .speech-caption .cap-word, body.immersive .game-room[data-sound="false"] .speech-caption .cap-word { color: var(--paper-ink); }
body.immersive .instruction-cue-slot { position: absolute; top: -15px; left: 0; right: 0; min-height: 0; margin: 0; display: flex; justify-content: center; pointer-events: none; }
body.immersive .instruction-cue { background: #12262a; color: #fff9e9; border: 1px solid #ffffff26; box-shadow: 0 6px 18px #04161b55; font-size: 12px; min-height: 28px; padding: 3px 12px; border-radius: 14px; }
body.immersive .game-room[data-prompt-state="muted"] .instruction-cue { background: #12262a; color: #d7dcc8; }
body.immersive .game-room .replay-prompt {
  width: 52px; height: 52px; min-width: 52px; min-height: 52px; padding: 0; border-radius: 50%; font-size: 0; gap: 0; flex-direction: row;
  background: #2e8075; color: #fff9e9; border: 1px solid #3a9587; box-shadow: 0 4px 0 #205e56;
}
body.immersive .game-room .replay-prompt.is-speaking { background: #ffda68; color: #3b2f0b; border-color: #e6c14f; box-shadow: 0 4px 0 #cfa22b; animation: none; }
body.immersive .game-room .replay-prompt :is(.emoji, .ui-icon, svg) { font-size: 22px; width: 22px; height: 22px; }
body.immersive .game-room .replay-prompt span:not(.emoji) { display: none; }

/* the page track and the dock */
body.immersive .game-room .dots-row { grid-area: dots; min-height: 0; padding: 4px 0 0; }
body.immersive .game-room .dots-row:has(.dots:empty) { display: none; }
body.immersive .game-room .dots { display: flex; gap: 5px; width: min(100%, 290px); flex-wrap: nowrap; }
body.immersive .game-room .dots span {
  flex: 1; width: auto; height: 4px; min-width: 0; border: 0; border-radius: 10px; background: #ffffff29; color: transparent; font-size: 0; box-shadow: none;
}
body.immersive .game-room .dots span.done { background: #fff5cc7a; }
body.immersive .game-room .dots span.now { background: #ffe094; box-shadow: 0 0 10px #ffc24755; }
body.immersive .game-room .game-feedback { grid-area: feedback; min-height: 0; padding: 0 8px; margin: 0; color: #efe8caaa; font-size: 13px; line-height: 1.35; }
body.immersive .game-room .communication-bar {
  grid-area: dock; position: static !important; inset: auto !important; z-index: auto; margin: 0 !important; padding: 2px 0 0 !important;
  border: 0 !important; background: transparent !important; box-shadow: none !important; gap: 8px; flex-wrap: nowrap; justify-content: center; min-height: 0;
}
body.immersive .game-room .communication-bar > button { max-width: none; }
body.immersive .game-room .communication-bar > button {
  flex: 1 1 0; min-width: 0; min-height: 50px; padding: 8px 6px; border-radius: 26px; justify-content: center; gap: 6px; font-size: 13px; white-space: nowrap;
  background: var(--glass); color: #fff9e9; border: 1px solid var(--glass-line); box-shadow: none;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
body.immersive .game-room .communication-bar > button:first-child { background: #ffda6826; border-color: #ffda6866; color: #fff3c4; }
body.immersive .game-room .communication-bar > button :is(.emoji, .ui-icon, svg) { font-size: 19px; width: 19px; height: 19px; }
body.immersive .game-room .communication-note { display: none; }

/* opening and finishing on the same dark stage */
body.immersive .game-room #intro:not([hidden]) { min-height: 100%; padding: 18px 20px; background: transparent; }
body.immersive .game-room #intro .game-welcome { max-width: 440px; gap: 18px; }
body.immersive .game-room #intro h2 { color: #fff9e9; font-size: clamp(26px, 7vw, 40px); }
body.immersive .game-room #intro .level-tag { background: #ffffff1c; border-color: #ffffff3a; color: #fff3c4; }
body.immersive .game-room .intro-listen-note { color: #e9e2c1c9; }
body.immersive .game-room .welcome-art { width: min(52%, 220px); }
body.immersive .game-room .welcome-art::before { background: #ffffff1f; }
body.immersive .game-room #intro .card-art { border-width: 5px; border-color: #fff9e9; box-shadow: 0 8px 0 #0b1f2466, 0 25px 35px #03121644; }
body.immersive .game-room .welcome-spark { color: #ffda68; }
body.immersive .game-room #start-btn { --btn-bg: #2e8075; --btn-shadow: #205e56; box-shadow: 0 6px 0 #205e56, 0 12px 20px #03121655; }
body.immersive .game-room .level-options, body.immersive .game-room .level-options summary { color: #efe8caaa; }
body.immersive .game-room .level-options[open] { background: #ffffff14; color: #fff9e9; }
body.immersive .game-room #finish:not([hidden]) { min-height: 100%; }

/* content-driven scenes tighten up so a phone's page holds them without scrolling */
body.immersive .bubble-learning-content { padding: 10px 8px; gap: 8px; }
body.immersive .bubble-mission-heading > strong { font-size: 20px; }
body.immersive .bubble-mission-label { font-size: 11px; }
body.immersive .bubble-pool { gap: 6px; padding: 2px 0; }
body.immersive .bubble-learning .bubble-target { width: min(100%, 58px); min-height: 44px; }
body.immersive .bubble-learning .bubble-target > span { font-size: 22px; }
body.immersive .bubble-tray-panel { padding: 8px; }
body.immersive .bubble-tray-label { margin-bottom: 4px; font-size: 12px; }
body.immersive .bubble-tray { min-height: 0; gap: 4px; }
body.immersive .bubble-tray-slot { min-height: 36px; }
body.immersive .bubble-check, body.immersive .bubble-next { min-height: 50px; }

/* a landscape phone — and a wide screen in Focus — keep the words and the dock beside the picture */
@media (orientation: landscape) and (max-height: 560px), (orientation: landscape) and (min-width: 900px) {
  body.immersive .game-room {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 30%); grid-template-rows: auto minmax(0, 1fr) auto auto auto !important; column-gap: 12px; row-gap: 6px;
    grid-template-areas: "head head" "stage prompt" "stage dots" "stage feedback" "stage dock";
  }
  body.immersive .game-room .game-prompt {
    margin: 8px 0 0; padding: 12px 12px 10px; min-height: 0; gap: 6px 8px;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; grid-template-areas: "host . listen" "text text text";
    align-self: start; max-height: 100%; align-items: start; overflow: auto; overscroll-behavior: contain; /* hugs its words at the top; a long instruction scrolls */
  }
  body.immersive .game-room .game-prompt .prompt-text { grid-area: text; min-height: 0; }
  body.immersive .instruction-cue-slot { position: static; margin: 0 0 6px; }
  body.immersive .game-room .game-prompt .host { grid-area: host; font-size: 26px; }
  body.immersive .game-room .game-prompt h2 { font-size: 17px; }
  body.immersive .game-room .game-prompt .speech-caption { font-size: 15px; max-height: none; }
  body.immersive .game-room .game-prompt img.host { width: 32px; height: 32px; }
  body.immersive .game-room .replay-prompt { grid-area: listen; width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  body.immersive .game-room .communication-bar { flex-direction: column; gap: 6px; }
  body.immersive .game-room .communication-bar > button { flex: none; width: 100%; min-height: 44px; font-size: 13px; }
  body.immersive .game-room .stage { margin-top: 0; }
  body.immersive .game-room-header { min-height: 40px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  body.immersive .game-room .game-feedback { display: none; } /* grown-up hints give the words their room on a short screen */
  body.immersive .game-room-header > .soft-button, body.immersive .game-focus { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
}
@media (orientation: landscape) and (min-width: 900px) {
  body.immersive .game-room { grid-template-columns: minmax(0, 1fr) clamp(300px, 28vw, 400px); column-gap: 20px; row-gap: 10px; padding: 16px 24px 18px !important; max-width: 1500px !important; margin: 0 auto; left: 0; right: 0; }
  body.immersive .game-room-header { min-height: 52px; }
  body.immersive .game-room-header > .soft-button, body.immersive .game-focus { width: 48px; height: 48px; min-width: 48px; min-height: 48px; }
  body.immersive .game-room-title h1 { font-size: 22px; }
  body.immersive .game-room .game-prompt { padding: 18px 18px 16px; gap: 10px 12px; margin-top: 10px; }
  body.immersive .game-room .game-prompt h2 { font-size: 24px; }
  body.immersive .game-room .game-prompt .speech-caption { font-size: 21px; }
  body.immersive .game-room .game-prompt img.host { width: 44px; height: 44px; }
  body.immersive .game-room .game-prompt .host { font-size: 34px; }
  body.immersive .game-room .replay-prompt { width: 54px; height: 54px; min-width: 54px; min-height: 54px; }
  body.immersive .game-room .communication-bar > button { min-height: 52px; font-size: 16px; }
  body.immersive .game-room .game-feedback { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  body.immersive .game-room-header > .soft-button, body.immersive .game-focus { transition: none; }
}
