/* EDgames — the app shell. Shared by play.html and game.html, and under pages.css on the rest.

   This is design direction 3 of the three that were drawn in mockups/, built
   for real, and since October 2026 wearing the "Chunky" look picked from
   mockups/v3: every tile, chip and button is a fat toy button with a darker
   edge under it that squashes when pressed. The rules for that look are the
   last section of this file; the other three looks drawn alongside it are
   still in mockups/v3 as options. The bet it makes: the site is played on a tablet and shown on a
   phone, and it used to be laid out like a desktop page from a template — a
   wide grid of glass cards reflowed down to two narrow columns, which is what
   an unfinished site looks like on the device it is actually used on.

   So: a real app shell, phone first. A short top bar, one horizontal rail of
   subjects, content in rows rather than a wall, and a fixed bottom bar holding
   the two things a grown-up does — filter by age, search. On a wide screen the
   bottom bar becomes a side rail and the same rows simply wrap; nothing is
   designed twice.

   The canvas is neutral and the colour belongs to the subject, same as before.
   Every token the game modules read (--pos, --border, --sub-tint and the rest)
   keeps its name and its job here — only the values moved. */

:root {
  --bg:         #eef5ff;   /* a pale sky, so a white card is a real surface */
  --bg-raise:   #ffffff;
  --surface:    #ffffff;
  --border:     #d3e2f5;
  --edge:       #c3d5ec;   /* the toy edge under white chips, bars and the stage */
  --text:       #1e2a44;
  --text-muted: #8a929c;
  --text-soft:  #56657f;   /* 5.4:1 on --bg */
  --value:      #1e2a44;

  --accent:        #1c8a5a;
  --accent-strong: #16794c;  /* fill behind white text — 5.5:1 */
  --accent-ink:    #156943;  /* green text on --bg — 6.0:1 */
  --on-accent:     #ffffff;
  --pos:           #16794c;  /* games fill it and put white text on top */
  --neg:           #c43d2a;

  /* Selected-control pair, used where a control has no subject of its own. */
  --sel-tint:   #e7ebf0;
  --sel-ink:    #2b3440;

  --radius:     22px;
  --radius-sm:  14px;
  --shadow:     0 2px 10px rgba(16, 20, 24, 0.06);
  --shadow-lift: 0 10px 26px rgba(16, 20, 24, 0.12);

  --bar:        66px;   /* bottom bar height, reserved at the end of the page */
  --gutter:     18px;
}

/* Subject palette. --sub-solid is the new one: a full-strength fill that
   carries white text (all seven clear 4.5:1), which is what the covers and the
   continue card are made of. The pastel tint/ink pair stays exactly as it was,
   because badges and a dozen game modules are built on it. */
/* --sub-edge is the Chunky look's: the darker band under a subject's tile. */
[data-subject="letters"]  { --sub-solid: #0f8ea0; --sub-edge: #0a6876; --sub-tint: #d6edf1; --sub-ink: #1d6a76; }
[data-subject="numbers"]  { --sub-solid: #2f6ae8; --sub-edge: #2150b8; --sub-tint: #ddeefb; --sub-ink: #2b6a96; }
[data-subject="shapes"]   { --sub-solid: #e8621c; --sub-edge: #b64a10; --sub-tint: #ffe7d6; --sub-ink: #a1552a; }
[data-subject="memory"]   { --sub-solid: #7c4ced; --sub-edge: #5a30c2; --sub-tint: #e9e2f8; --sub-ink: #6046a3; }
[data-subject="nature"]   { --sub-solid: #1c9a57; --sub-edge: #13733f; --sub-tint: #d9f0e4; --sub-ink: #23684d; }
[data-subject="music"]    { --sub-solid: #d98a00; --sub-edge: #a66800; --sub-tint: #fbf0cf; --sub-ink: #85661a; }
[data-subject="computer"] { --sub-solid: #52607c; --sub-edge: #3a4660; --sub-tint: #e3e6ec; --sub-ink: #4e5a6b; }
[data-subject="fairytale"] { --sub-solid: #d6337a; --sub-edge: #a3205a; --sub-tint: #fde2ee; --sub-ink: #9e2860; }
[data-subject="english"]  { --sub-solid: #d9416a; --sub-edge: #a62c4e; --sub-tint: #fce3ea; --sub-ink: #9c2d4c; }
[data-subject="math"]     { --sub-solid: #2583c9; --sub-edge: #1a6299; --sub-tint: #dbeefa; --sub-ink: #1f6596; }
[data-subject="logic"]    { --sub-solid: #6f5bd8; --sub-edge: #4e3eaa; --sub-tint: #e8e4fb; --sub-ink: #54449f; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Fredoka", "Heebo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Only the home screen carries the fixed bottom bar, so only it has to leave
   room at the end of the page for it. */
body.app { padding-bottom: calc(var(--bar) + 18px); }

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.015em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.shell { max-width: 1180px; margin: 0 auto; }
.content { min-width: 0; }

/* ---- App bar ---- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 245, 247, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.appbar-in {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--gutter);
  max-width: 1180px;
  margin: 0 auto;
}

.avatar {
  width: 38px; height: 38px;
  border-radius: 13px;
  background: var(--text);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.1rem;
  flex: none;
}
/* The game page's app bar is back-button then language toggle, and the toggle
   carries its own dir (it reads in the language it switches to), so an auto
   margin on the toggle would be resolved against the wrong side. Pushing from
   the back button instead is direction-correct in both. */
.appbar-in .btn { margin-inline-end: auto; }

.hello { flex: 1; min-width: 0; }
/* The site's name is the page's h1 and the greeting is the bigger of the two —
   the heading order is for a screen reader, the size order is for a parent. */
.hello .small {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-soft);
  line-height: 1.2;
}
.hello .big { font-weight: 800; font-size: 1.02rem; line-height: 1.25; }

/* ---- The bottom bar, which is a side rail on a wide screen ---- */

.tabs {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 30;
  height: var(--bar);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
  position: relative;
}
.tab .ico { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--text); }

/* A tab whose filter is switched on says so without being the current tab:
   the dot is the only way to tell, from the bar, that results are narrowed. */
.tab[data-on="true"] { color: var(--accent-ink); }
.tab[data-on="true"]::after {
  content: "";
  position: absolute;
  inset-block-start: 7px;
  inset-inline-end: 50%;
  margin-inline-end: -16px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
}

/* ---- Sheets: the age filter and the search box ----
   They open from the bottom bar, so on a phone they sit just above it where a
   thumb already is. On a wide screen the bar is a side rail and they become
   ordinary blocks at the top of the content. */

.sheet {
  position: fixed;
  inset-inline: 0;
  inset-block-end: var(--bar);
  z-index: 25;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(16, 20, 24, 0.10);
  padding: 14px var(--gutter) 16px;
  margin-bottom: env(safe-area-inset-bottom);
}
.sheet[hidden] { display: none; }
.sheet-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 9px;
}
.sheet-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---- Chips: age, sets, the language toggle, clear ---- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 15px;
  min-height: 44px;           /* comfortable for small fingers */
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip .ico { width: 18px; height: 18px; flex: none; }

/* Selected chips change weight as well as hue, so the state does not rest on
   colour alone. */
.chip[aria-pressed="true"] {
  background: var(--sub-solid, var(--text));
  border-color: var(--sub-solid, var(--text));
  color: #fff;
  font-weight: 700;
}
.chip[aria-pressed="true"] .mark,
.chip[aria-pressed="true"] .ico { color: #fff; }

.chip--clear {
  border-style: dashed;
  color: var(--text-soft);
  margin-inline-start: auto;
}
.chip--clear[hidden] { display: none; }

/* ---- The subject rail ---- */

.rail {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px var(--gutter);
  scroll-snap-type: x proximity;
}
.rail::-webkit-scrollbar { display: none; }
.rail .chip { flex: none; scroll-snap-align: start; }
.rail .mark { width: 20px; height: 20px; color: var(--sub-solid); flex: none; }

/* A subject with no finished game behind it recedes the same way an unfinished
   tile does. It stays selectable — the games behind it are meant to be visible
   — and the word rides on the label for anyone not seeing colour. */
.chip[data-status="soon"] { color: var(--text-soft); }
.chip[data-status="soon"] .mark { opacity: 0.5; }

/* ---- Section heads ---- */

.shelf { padding-top: 16px; }
.head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 var(--gutter) 10px;
}
.head h2 { margin: 0; font-size: 1.12rem; }
.head .more {
  margin-inline-start: auto;
  font-size: 0.88rem;
  color: var(--text-soft);
  font-weight: 500;
}

/* ---- The continue card ----
   The one big card: the last game this browser opened. On a phone it is most
   of the first screen, which is the point — the commonest thing a child wants
   is the game they were playing yesterday. */

.continue {
  margin: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--sub-solid);
  color: #fff;
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: var(--shadow-lift);
  position: relative;
  overflow: hidden;
}
.continue .ghost {
  position: absolute;
  width: 190px;
  inset-block-start: -42px;
  inset-inline-start: -46px;
  opacity: 0.15;
  color: #fff;
}
.continue .scene-main { width: 58px; flex: none; position: relative; z-index: 1; }
.continue .txt { position: relative; z-index: 1; min-width: 0; }
.continue .kicker { font-size: 0.78rem; opacity: 0.85; font-weight: 500; }
.continue h3 { margin: 1px 0 3px; font-size: 1.3rem; line-height: 1.2; }
.continue p {
  margin: 0;
  font-size: 0.87rem;
  opacity: 0.9;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Rows of tiles ----
   Fixed-width tiles that snap, which is what makes a row feel native rather
   than like a grid that overflowed. The results view uses the same tile in a
   grid that wraps, so a filtered page is the same object, laid out flat. */

.row, .tiles {
  list-style: none;
  margin: 0;
  padding: 2px var(--gutter) 6px;
}
.row {
  display: flex;
  gap: 13px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.row::-webkit-scrollbar { display: none; }
.row > li { flex: none; width: 148px; scroll-snap-align: start; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px 13px;
  align-items: start;
}
.tiles[hidden], .browse[hidden] { display: none; }

.tile { display: block; }
.cover {
  aspect-ratio: 1;
  border-radius: 22px;
  background: var(--sub-solid);
  color: #fff;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.tile:hover .cover,
.tile:focus-visible .cover { transform: translateY(-3px) scale(1.015); box-shadow: var(--shadow-lift); }
.cover .scene { width: 58%; position: relative; z-index: 1; }

/* The picture on the field is the game's own (EDScenes); the field it sits on
   belongs to the subject. The composition — which corner the ghost mark bleeds
   from, which way it leans, what pattern sits behind it — comes off the game's
   id, so a row that IS one subject still has some variety in it rather than
   nineteen pictures on one flat colour. See EDGlyphs.variant. */
.cover .ghost { position: absolute; width: 112%; opacity: 0.15; color: #fff; }
.cover[data-variant="0"] .ghost { inset-block-start: -28%; inset-inline-start: -36%; transform: rotate(-8deg); }
.cover[data-variant="1"] .ghost { inset-block-end: -30%;   inset-inline-end:  -32%; transform: rotate(13deg); }
.cover[data-variant="2"] .ghost { inset-block-start: -24%; inset-inline-end:  -38%; transform: rotate(6deg); }
.cover[data-variant="3"] .ghost { inset-block-end: -26%;   inset-inline-start: -34%; transform: rotate(-15deg); }

.cover::before { content: ""; position: absolute; inset: 0; }
.cover[data-variant="1"]::before {
  background: radial-gradient(circle at 20% 24%, rgba(255,255,255,0.2) 0 27%, transparent 27.5%);
}
.cover[data-variant="2"]::before {
  background: radial-gradient(rgba(255,255,255,0.3) 1.6px, transparent 1.7px) 0 0 / 15px 15px;
  opacity: 0.55;
}
.cover[data-variant="3"]::before {
  background: repeating-linear-gradient(128deg, rgba(255,255,255,0.13) 0 11px, transparent 11px 30px);
}
.cover[data-variant="1"], .cover[data-variant="3"] {
  background-image: linear-gradient(150deg, rgba(0,0,0,0.18), rgba(0,0,0,0) 72%);
}
/* Field weight, on a second axis from the composition — see EDGlyphs.tone. */
.cover[data-tone="1"] { box-shadow: var(--shadow), inset 0 0 0 200px rgba(0, 0, 0, 0.11); }
.cover[data-tone="2"] { box-shadow: var(--shadow), inset 0 0 0 200px rgba(255, 255, 255, 0.09); }
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(205deg, rgba(255,255,255,0.18), transparent 60%);
}

.tile h3 {
  margin: 9px 2px 1px;
  font-size: 0.97rem;
  line-height: 1.3;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile .meta { margin: 0 2px; font-size: 0.8rem; color: var(--text-soft); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }

.tile[data-status="soon"] .cover { opacity: 0.4; }

/* ---- The soon list ----
   A wide, low row, because a square cover would give unfinished work the same
   weight on the page as finished work. */

.list { padding: 0 var(--gutter); display: grid; gap: 9px; margin: 0; list-style: none; }
.item {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
}
.item .chip-cover {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  flex: none;
  background: var(--sub-solid);
  color: #fff;
  display: grid; place-items: center;
  opacity: 0.55;
}
.item .chip-cover .scene { width: 30px; }
.item .txt { min-width: 0; }
.item h3 { margin: 0; font-size: 0.98rem; font-weight: 700; }
.item p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.soon-tag {
  margin-inline-start: auto;
  flex: none;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---- Search ---- */

.search { position: relative; flex: 1 1 200px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding-block: 12px;
  padding-inline-start: 46px;     /* room for the icon at the start */
  padding-inline-end: 18px;
  text-align: start;
}
.search input::placeholder { color: var(--text-muted); }
.search .ico {
  position: absolute;
  inset-inline-start: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px; height: 19px;
  color: var(--text-soft);
  pointer-events: none;
}

/* ---- Result line and empty state ---- */

.result-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 6px var(--gutter) 10px;
}
.result-bar[hidden] { display: none; }
.result-line { margin: 0; color: var(--text-soft); font-size: 0.92rem; }
.result-count { font-weight: 800; color: var(--text); }

.empty {
  margin: 10px var(--gutter);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 44px 20px;
}
.empty .ico { width: 44px; height: 44px; color: var(--text-muted); }
.empty h2 { margin: 12px 0 6px; font-size: 1.2rem; }
.empty p { margin: 0 0 20px; color: var(--text-soft); }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  background: var(--accent-strong);
  color: var(--on-accent);
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 46px;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:hover  { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* The arrow glyph points left, which is already "back" in LTR. In RTL back is
   the other way, so mirror it there and only there. */
.icon-back { display: inline-block; }
[dir="rtl"] .icon-back { transform: scaleX(-1); }

/* ---- Drawn marks ---- */

.mark, .ico, .scene {
  display: inline-block;
  vertical-align: middle;
  color: currentColor;
}
.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* A scene whose meaning is its direction — see EDScenes.FLIP. Same mirror the
   back arrow above gets, so the picture on the tile runs the way the board it
   opens runs. */
[dir="rtl"] .scene-turns { transform: scaleX(-1); }

/* ---- Game host page ---- */

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px var(--gutter);
  flex-wrap: wrap;
}
.game-header .game-mark {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--sub-solid);
  color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.game-header .game-mark .scene { width: 34px; }
.game-header h1 { font-size: 1.25rem; margin: 0; }
.game-header .badges { margin: 0; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 11px;
  background: var(--sub-tint);
  color: var(--sub-ink);
}
.badge--age { background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); }

/* Set picker: which run of the game is on screen. It sits between the header
   and the stage rather than inside a game, because it belongs to the grown-up
   deciding what to play, not to the round in progress. */
.game-sets { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 var(--gutter) 14px; }
.game-sets[hidden] { display: none; }   /* display:flex would otherwise win */
.game-sets-label { font-weight: 700; font-size: 0.8rem; color: var(--text-soft); }
.game-sets-chips { display: flex; gap: 9px; flex-wrap: wrap; }
/* Starts the step on screen over; sits at the far end of the step chips. */
.game-reset { margin-inline-start: auto; gap: 6px; }
.game-reset .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.game-reset[hidden] { display: none; }
.game-sets-label[hidden] { display: none; }

/* A game running in the home screen's layer: the language belongs to the
   home screen, which reloads to change it. */
.embedded #lang-toggle { display: none; }

/* ---- The game layer (assets/player.js) ----
   Games open over the home screen and stay alive behind it when the child
   goes back, so the one they return to is still where they left it. */
.player { position: fixed; inset: 0; z-index: 100; background: var(--bg); }
.player[hidden] { display: none; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }
.player iframe[hidden] { display: none; }
body.playing { overflow: hidden; }

.stage {
  min-height: 440px;
  display: flex;
  flex-direction: column;
  margin: 0 var(--gutter);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.stage-note { text-align: center; padding: 60px 20px; margin: auto; }
.stage-note .emoji { font-size: 58px; }
.stage-note h2 { margin: 14px 0 8px; }
.stage-note p { color: var(--text-soft); margin: 0 0 22px; }

.site-footer {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding: 26px var(--gutter) 10px;
}

/* ---- Wide screens: the same app, given room ---- */

@media (min-width: 900px) {
  body.app { padding-bottom: 0; }

  /* Only the home screen has a nav column to put beside the content — the game
     page is one column at any width. */
  body.app .shell { display: grid; grid-template-columns: 232px 1fr; align-items: start; }

  .tabs {
    position: sticky;
    top: 68px;
    inset-inline: auto;
    inset-block-end: auto;
    align-self: start;
    height: auto;
    width: 232px;
    border-top: 0;
    border-inline-end: 1px solid var(--border);
    background: transparent;
    backdrop-filter: none;
    flex-direction: column;
    gap: 4px;
    padding: 18px 14px;
  }
  .tab {
    flex: none;
    grid-auto-flow: column;
    justify-content: start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.96rem;
    width: 100%;
  }
  .tab[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
  .tab[data-on="true"]::after { position: static; margin: 0 4px; }

  /* The sheets stop being sheets: there is room for them in the column, and a
     full-width panel holding three chips is mostly empty white. */
  .sheet {
    position: static;
    width: fit-content;
    min-width: 280px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    margin: 4px var(--gutter) 0;
    padding: 14px 16px;
  }

  .content { padding-bottom: 40px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }

  /* A rail is right on a phone and wrong on a desktop: a row that runs off the
     side of a 1000px column reads as broken rather than as swipeable. So on a
     wide screen every row becomes the same wrapping grid the results view uses,
     and the subject rail wraps too. It is the one thing that has to differ
     between the two shapes. */
  .row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 16px 13px;
    overflow: visible;
  }
  .row > li { width: auto; }
  .rail { flex-wrap: wrap; overflow: visible; }
}

/* ---- Quality floor ---- */

:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; border-radius: 12px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==== The Chunky look ====
   Picked from the four looks in mockups/v3 (October 2026). Everything a child
   presses is a toy button: a darker edge sits under it and squashes when it is
   pressed, so a tap feels like pushing something. Rounder letters (Fredoka),
   brighter subject colours, tiles that pop in one after another. These rules
   restyle the shell above; they do not change its layout. */

body {
  background:
    radial-gradient(circle, #d9e7fa 1.4px, transparent 1.6px) 0 0 / 22px 22px,
    var(--bg);
}
h1, h2, h3 { font-weight: 700; letter-spacing: 0; }

.appbar { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0; box-shadow: 0 4px 0 var(--edge); }
img.avatar { width: 44px; height: 44px; border-radius: 0; background: none; box-shadow: none; transform: rotate(-6deg); }
.hello .big { font-size: 1.2rem; font-weight: 700; }
.hello .small { font-weight: 500; }

.chip { border: 2px solid var(--border); box-shadow: 0 4px 0 var(--edge); font-weight: 600; min-height: 46px; transition: transform .08s, box-shadow .08s, background .15s; }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.chip[aria-pressed="true"] { box-shadow: 0 4px 0 var(--sub-edge, #0f1626); border-color: var(--sub-solid, var(--text)); }
.chip--clear { box-shadow: none; }
.rail { padding-block: 14px 16px; }

.head h2 { font-size: 1.3rem; }
.head .more { background: #fff; border: 2px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; }

.row { padding-bottom: 14px; }
.cover { border-radius: 26px; box-shadow: 0 7px 0 var(--sub-edge); transition: transform .1s, box-shadow .1s; }
.cover[data-tone] { box-shadow: 0 7px 0 var(--sub-edge); }
.tile:hover .cover, .tile:focus-visible .cover { transform: translateY(-3px); box-shadow: 0 10px 0 var(--sub-edge); }
.tile:active .cover { transform: translateY(5px); box-shadow: 0 2px 0 var(--sub-edge); }
.tile h3 { text-align: center; font-size: 1.02rem; font-weight: 600; margin-top: 14px; }
.tile .meta { text-align: center; }
.tile .meta .num { background: #fff; border: 2px solid var(--border); border-radius: 999px; padding: 0 8px; font-weight: 600; color: var(--text); }

.row > li, .tiles > li { animation: pop-in .45s cubic-bezier(.3,1.6,.5,1) backwards; }
.row > li:nth-child(2) { animation-delay: .05s; }
.row > li:nth-child(3) { animation-delay: .1s; }
.row > li:nth-child(4) { animation-delay: .15s; }
.row > li:nth-child(5) { animation-delay: .2s; }
.row > li:nth-child(n+6) { animation-delay: .25s; }
@keyframes pop-in { from { transform: scale(.7) translateY(14px); opacity: 0; } }

.continue { border-radius: 28px; box-shadow: 0 8px 0 var(--sub-edge); padding-inline-end: 84px; }
.continue::after { content: "▶"; position: absolute; inset-inline-end: 18px; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; background: #fff; color: var(--sub-solid); display: grid; place-items: center; font-size: 22px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.continue h3 { font-size: 1.45rem; }

.tabs { inset-inline: 12px; inset-block-end: calc(10px + env(safe-area-inset-bottom)); height: 68px; border-radius: 24px; border: 2px solid var(--border); box-shadow: 0 5px 0 var(--edge); background: #fff; padding-bottom: 0; padding-inline: 6px; gap: 4px; align-items: center; backdrop-filter: none; -webkit-backdrop-filter: none; }
.tab { border-radius: 18px; height: 56px; font-weight: 600; font-size: .78rem; }
.tab[aria-current="page"] { background: #ffc531; color: #5a3b00; box-shadow: 0 4px 0 #d49a00; }
.sheet { inset-inline: 12px; inset-block-end: calc(88px + env(safe-area-inset-bottom)); border-radius: 24px; border: 2px solid var(--border); box-shadow: 0 6px 0 var(--edge); margin-bottom: 0; }
body.app { padding-bottom: 110px; }

.btn { box-shadow: 0 4px 0 #0f5c39; font-weight: 600; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0f5c39; }
.btn--ghost { box-shadow: 0 4px 0 var(--edge); border: 2px solid var(--border); }
.btn--ghost:active { box-shadow: 0 1px 0 var(--edge); }
.game-header .game-mark { border-radius: 16px; box-shadow: 0 4px 0 var(--sub-edge); width: 56px; height: 56px; }
.game-header h1 { font-size: 1.5rem; }
.badge { font-weight: 600; }
.stage { border: 2px solid var(--border); box-shadow: 0 8px 0 var(--edge); border-radius: 30px; }
.empty { border: 2px solid var(--border); box-shadow: 0 6px 0 var(--edge); }
.item { border: 2px solid var(--border); box-shadow: 0 4px 0 var(--edge); }

@media (min-width: 900px) {
  .tabs { inset: auto; height: auto; border-radius: 24px; margin: 18px 14px; width: 204px; position: sticky; top: 84px; }
  .tab { height: auto; }
  .sheet { inset: auto; margin: 4px var(--gutter) 0; }
  body.app { padding-bottom: 0; }
}

/* ---- Covers: the illustrated picture of each game (assets/covers.js) ----
   Full bleed inside the tile, so the field, ghost mark and pattern behind a
   line scene step aside; the subject's colour stays as the toy edge under it. */
.cover--art::before, .cover--art::after { display: none; }
.cover .art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover--art { background: var(--sub-tint); }
.continue .art-main { width: 76px; height: 76px; flex: none; border-radius: 20px; position: relative; z-index: 1; box-shadow: 0 4px 0 rgba(0,0,0,.18); background: #fff; }
.game-header .game-mark { overflow: hidden; }
.game-header .game-mark .art { width: 100%; height: 100%; display: block; }

/* ---- The sound switch (assets/music.js) ---- */
.sound-toggle { gap: 6px; padding: 0 13px; }
.sound-toggle .ico { width: 20px; height: 20px; }
.sound-toggle[data-state="all"] { background: #ffc531; border-color: #ffc531; color: #5a3b00; box-shadow: 0 4px 0 #d49a00; }
.sound-toggle[data-state="off"] { color: var(--text-soft); }
@media (max-width: 480px) {
  .sound-toggle span { display: none; }
  .sound-toggle { padding: 0; width: 46px; justify-content: center; }
  .appbar-in { gap: 8px; }
}
@media (max-width: 480px) {
  .hello .big { font-size: 1.05rem; }
  .lang-toggle { padding: 0 12px; }
}

/* ---- Plans: the account button, locked tiles, the dialog a locked tile opens ---- */
.account-chip { gap: 6px; padding: 0 13px; flex: none; }
@media (max-width: 480px) {
  .account-chip span { display: none; }
  .account-chip { padding: 0; width: 46px; justify-content: center; }
  /* Only the home screen has a greeting that needs the room. The button keeps its name as its aria-label. */
  body.app .lang-toggle span { display: none; }
  body.app .lang-toggle { padding: 0; width: 46px; justify-content: center; }
}

.lock-pill {
  position: absolute;
  z-index: 2;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  background: #1e2a44;
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.5;
}
.lock-pill .ico { width: 13px; height: 13px; stroke-width: 2.6; }

.lock-dialog {
  width: min(92vw, 380px);
  border: 2px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 8px 0 var(--edge);
  padding: 22px;
  text-align: center;
  color: var(--text);
}
.lock-dialog::backdrop { background: rgba(30, 42, 68, .45); }
.lock-cover { width: 112px; height: 112px; margin: 0 auto; border-radius: 22px; overflow: hidden; }
.lock-cover .art { display: block; width: 100%; height: 100%; }
.lock-dialog h2 { margin: 14px 0 6px; font-size: 1.25rem; line-height: 1.3; }
.lock-dialog p { margin: 0 0 18px; color: var(--text-soft); }
.lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ==== Console Deck (ED-Deck) & Kid Website Themes (October 2026) ====
   Direction 1 from mockups/v4: the home screen (play.html) is structured as a
   tactile handheld play console with a top hardware instrument bar, a 2-column
   inner bezel (Spotlight Active Game Stage + Numbered Cartridge Deck), and a
   bottom subject channel dock.
   Includes the Settings modal where a child or parent can switch the website
   shell between Studio Console (default), Princess & Fairytales, and Spider-Man
   (affecting the website shell only, never game.html or the games). */

:root {
  --console-shell: #20242e;
  --console-screen: #f4f2ec;
  --console-ink: #f4f6fb;
  --console-card-ink: #151821;
  --console-muted: #525866;
  --console-accent: #ff5722;
  --console-launch: #d34215;
  --console-highlight: #ffc400;
}

html[data-kid-theme="princess"],
body[data-kid-theme="princess"] {
  --console-shell: #4a1c40;
  --console-screen: #fff6fb;
  --console-card-ink: #43183d;
  --console-muted: #7c4473;
  --console-accent: #c92a81;
  --console-launch: var(--console-accent);
  --console-highlight: #ffd166;
}

html[data-kid-theme="spiderman"],
body[data-kid-theme="spiderman"] {
  --console-shell: #0b1536;
  --console-screen: #eef4ff;
  --console-card-ink: #0b132b;
  --console-muted: #334673;
  --console-accent: #e62429;
  --console-launch: var(--console-accent);
  --console-highlight: #ffd60a;
}

/* Website shell pages (index.html, account.html) also honour the chosen theme */
body.page[data-kid-theme="princess"] {
  --bg: #fdf2f9;
  --border: #f0c4df;
  --edge: #e29ec9;
  --text: #43183d;
  --text-soft: #7c4473;
  --accent: #c92a81;
  --accent-strong: #ad1f6d;
  --accent-ink: #9e1960;
  background:
    radial-gradient(circle, #f7d4e8 1.5px, transparent 1.7px) 0 0 / 22px 22px,
    var(--bg);
}

body.page[data-kid-theme="spiderman"] {
  --bg: #e8f0ff;
  --border: #0b132b;
  --edge: #0b132b;
  --text: #0b132b;
  --text-soft: #2c3e6b;
  --accent: #e62429;
  --accent-strong: #c8191e;
  --accent-ink: #b81419;
  background:
    radial-gradient(circle, rgba(29, 78, 216, 0.14) 1.5px, transparent 1.8px) 0 0 / 18px 18px,
    var(--bg);
}

/* Console Home Screen (body.app) & Console Game Frame (body.game-deck) */
body.app,
body.game-deck {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--console-shell);
  color: var(--console-ink);
  font-family: "Heebo", "Fredoka", system-ui, sans-serif;
  overflow-x: hidden;
}

.player,
.player iframe {
  background: var(--console-shell);
}

.console-chassis {
  max-width: 1360px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  gap: 12px;
}

.console-chassis--game {
  max-width: 1180px;
}

/* Top Hardware Instrument Bar */
.console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 8px 14px;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.console-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--console-accent);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
  flex: none;
}
body[data-kid-theme="princess"] .console-logo {
  background: linear-gradient(135deg, #ff69b4, #9d4edd);
}
body[data-kid-theme="spiderman"] .console-logo {
  background: #e62429;
}
.console-logo img {
  width: 26px;
  height: 26px;
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-kicker {
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0;
  color: #ffb74d;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.led-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  flex: none;
}

.brand-name {
  font-size: 1.06rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  line-height: 1.15;
}

/* Active Kid Theme Badge on Top Bar */
.kid-crust {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
body[data-kid-theme="princess"] .kid-crust--princess {
  display: inline-flex;
  background: linear-gradient(135deg, #ffdde1, #f3d1ff);
  color: #6a1b5d;
  border: 1.5px solid #ffd166;
}
body[data-kid-theme="spiderman"] .kid-crust--spiderman {
  display: inline-flex;
  background: #ffd60a;
  color: #0b132b;
  border: 2px solid #0b132b;
}

/* Hardware Controls (Age Dial + Sound + Lang + Account + Settings) */
.console-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.age-segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.age-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.age-btn:hover {
  color: #ffffff;
}
.age-btn[aria-pressed="true"] {
  background: #ffffff;
  color: #151821;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.hw-btn {
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
}
.hw-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
.hw-btn .ico {
  width: 17px;
  height: 17px;
  flex: none;
}
.hw-btn.sound-toggle[data-state="all"] {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(74, 222, 128, 0.5);
  color: #ffffff;
  box-shadow: none;
}
.hw-btn.sound-toggle[data-state="off"] {
  color: rgba(255, 255, 255, 0.65);
}
.hw-btn--settings {
  background: var(--console-highlight);
  color: #151821;
  border-color: var(--console-highlight);
  font-weight: 800;
}
.hw-btn--settings:hover {
  background: #ffd03b;
}

/* Inner Console Screen Bezel */
.console-screen {
  flex: 1;
  background: var(--console-screen);
  color: var(--console-card-ink);
  border-radius: 26px;
  padding: 18px;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

body[data-kid-theme="princess"] .console-screen {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 182, 225, 0.45), transparent 40%),
    linear-gradient(180deg, #fff3fa 0%, #fdf6ff 100%);
  border: 3px solid #ffd166;
}

body[data-kid-theme="spiderman"] .console-screen {
  background:
    radial-gradient(circle, rgba(29, 78, 216, 0.11) 1.5px, transparent 2px) 0 0 / 16px 16px,
    linear-gradient(180deg, #e6f0ff 0%, #f5f8ff 100%);
  border: 3px solid #e62429;
}

/* 2-Column Deck Layout */
.deck-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  flex: 1;
}

/* Spotlight Active Game Stage */
.spotlight-stage {
  background: #ffffff;
  border-radius: 22px;
  border: 2px solid rgba(21, 24, 33, 0.1);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 12px 28px rgba(21, 24, 33, 0.07);
  position: relative;
}
body[data-kid-theme="princess"] .spotlight-stage {
  border: 2.5px solid #e899c8;
  box-shadow: 0 10px 24px rgba(201, 42, 129, 0.12);
}
body[data-kid-theme="spiderman"] .spotlight-stage {
  border: 3px solid #0b132b;
  box-shadow: 6px 6px 0 #0b132b;
}

.spotlight-art-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  background: var(--sub-tint, #eef2f8);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
}
.spotlight-art-wrap svg.art {
  width: 100%;
  height: 100%;
  display: block;
}
.spotlight-art-wrap svg.scene {
  width: 56%;
  height: auto;
  color: var(--sub-solid, #2f6ae8);
}

.spotlight-tag-row {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 2;
}
.spot-pill {
  background: rgba(21, 24, 33, 0.84);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}
.spot-num {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: rgba(255, 255, 255, 0.94);
  color: #151821;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.spot-recent-badge {
  position: absolute;
  bottom: 10px;
  inset-inline-start: 10px;
  background: #ffc400;
  color: #151821;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.spotlight-info h2 {
  margin: 0 0 6px;
  font-size: 1.52rem;
  font-weight: 900;
  line-height: 1.15;
}
.spotlight-info p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--console-muted);
  line-height: 1.45;
}

.spotlight-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.play-launch-btn {
  flex: 1;
  min-height: 52px;
  border-radius: 16px;
  border: 0;
  background: var(--console-launch);
  color: #ffffff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease, background-color 0.12s ease;
  cursor: pointer;
}
.play-launch-btn:hover {
  background-color: color-mix(in srgb, var(--console-launch) 96%, black);
}
.play-launch-btn:active {
  transform: translateY(3px);
}
.bumper-btn {
  width: 48px;
  height: 52px;
  border-radius: 14px;
  border: 1.5px solid rgba(21, 24, 33, 0.15);
  background: #f3f4f7;
  color: #151821;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bumper-btn:hover {
  background: #e5e8ef;
}
[dir="ltr"] .bumper-btn .bumper-glyph {
  transform: scaleX(-1);
}

/* Cartridge Bay */
.cartridge-bay {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.bay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.bay-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
}
.bay-count {
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(21, 24, 33, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}
.bay-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hw-clear-btn {
  appearance: none;
  border: 1.5px dashed rgba(21, 24, 33, 0.28);
  background: rgba(255, 255, 255, 0.75);
  color: var(--console-card-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  cursor: pointer;
}
.hw-clear-btn[hidden] {
  display: none;
}

.bay-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid rgba(21, 24, 33, 0.14);
  border-radius: 12px;
  padding: 0 10px;
  height: 38px;
}
.bay-search .ico {
  width: 17px;
  height: 17px;
  color: var(--console-muted);
  flex: none;
}
.bay-search input {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  color: inherit;
  width: 155px;
}

/* Switch-style Cartridge Grid */
.cartridge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  max-height: 430px;
  overflow-y: auto;
  padding: 4px 2px 8px;
}
.cartridge-grid[hidden] {
  display: none;
}

.cartridge {
  appearance: none;
  font: inherit;
  color: inherit;
  background: #ffffff;
  border: 2px solid rgba(21, 24, 33, 0.12);
  border-radius: 18px;
  padding: 8px 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: start;
  gap: 6px;
  position: relative;
  transition: transform 0.14s cubic-bezier(.3,1.5,.5,1), border-color 0.14s ease, box-shadow 0.14s ease;
  min-width: 0;
}
.cartridge::before {
  content: "";
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(21, 24, 33, 0.14);
  margin: 0 auto 2px;
}
.cartridge:hover {
  transform: translateY(-3px);
}
.cartridge[aria-selected="true"] {
  border-color: var(--console-accent);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.22), 0 8px 18px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}
body[data-kid-theme="princess"] .cartridge {
  border: 2px solid #f0b8da;
}
body[data-kid-theme="princess"] .cartridge[aria-selected="true"] {
  border-color: #c92a81;
  box-shadow: 0 0 0 3px rgba(201, 42, 129, 0.22), 0 8px 18px rgba(201, 42, 129, 0.12);
}
body[data-kid-theme="spiderman"] .cartridge {
  border: 2.5px solid #0b132b;
  box-shadow: 3px 3px 0 #0b132b;
}
body[data-kid-theme="spiderman"] .cartridge[aria-selected="true"] {
  border-color: #e62429;
  box-shadow: 0 0 0 3px rgba(230, 36, 41, 0.28), 4px 4px 0 #0b132b;
}

.cart-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--sub-tint, #eef2f8);
  position: relative;
  display: grid;
  place-items: center;
}
.cart-art svg.art {
  width: 100%;
  height: 100%;
  display: block;
}
.cart-art svg.scene {
  width: 58%;
  height: auto;
  color: var(--sub-solid, #2f6ae8);
}

.cart-num {
  position: absolute;
  top: 6px;
  inset-inline-End: 6px;
  background: rgba(21, 24, 33, 0.78);
  color: #ffffff;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  z-index: 2;
}

.cart-title {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.72rem;
  color: #636978;
  font-weight: 700;
}

/* Bottom Channel Switcher Dock */
.channel-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px 2px;
  scrollbar-width: none;
}
.channel-dock::-webkit-scrollbar {
  display: none;
}

.channel-key {
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  padding: 7px 13px;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}
.channel-key:hover {
  background: rgba(255, 255, 255, 0.15);
}
.channel-key[aria-pressed="true"] {
  background: #ffffff;
  color: #151821;
  border-color: #ffffff;
  font-weight: 800;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}
.channel-key svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.channel-key span {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}
.channel-key[data-status="soon"] {
  opacity: 0.6;
}

/* Settings & Kid Theme Picker Dialog */
.settings-dialog {
  width: min(94vw, 560px);
  border: 2px solid #1e2024;
  border-radius: 26px;
  background: #ffffff;
  color: #141619;
  padding: 24px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  font-family: inherit;
}
.settings-dialog::backdrop {
  background: rgba(12, 15, 24, 0.6);
  backdrop-filter: blur(6px);
}
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.settings-head h2 {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  background: #f4f4f6;
  color: #141619;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.settings-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #525866;
  margin-bottom: 10px;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.theme-option {
  appearance: none;
  font: inherit;
  color: inherit;
  background: #f7f7f9;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 18px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-option:hover {
  transform: translateY(-2px);
}
.theme-option[aria-checked="true"] {
  border-color: var(--console-accent, #2563eb);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2);
}
.theme-art {
  width: 100%;
  aspect-ratio: 120 / 74;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.theme-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.theme-txt b {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}
.theme-txt small {
  display: block;
  font-size: 0.74rem;
  color: #646977;
  margin-top: 2px;
  line-height: 1.25;
}
.theme-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: #141619;
}
/* --console-launch, not --console-accent: this is 11 px white text on a fill,
   and the accent orange only reaches 3.2:1 behind white (WCAG AA wants 4.5:1).
   --console-launch is the theme's darker companion already used behind the
   white launch button, and it is the accent itself in the two kid themes,
   which pass as they are. */
.theme-option[aria-checked="true"] .theme-badge {
  background: var(--console-launch, #2563eb);
  color: #ffffff;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.settings-link-btn {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(0, 0, 0, 0.16);
  background: #f4f4f6;
  color: #141619;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Child-sized tap areas, grown-up-sized look.
   The hardware buttons, the age chips, the channel keys and the dialog's own
   buttons are drawn between 30 and 40 px tall, under the 44 px a small finger
   needs (measured by scripts/check-shell-a11y.mjs). A transparent box centred
   on each one stretches what a tap counts as, without moving or resizing
   anything that is drawn - the overlay is a child of the control, so a press
   anywhere on it is a press on the control. It never grows past 44 px, so two
   neighbours in a row 8 px apart cannot cover each other.
   Scoped to the console pages on purpose: game.html's fullscreen deck bar sits
   tight against the stage, where an overlay could swallow a tap meant for the
   game. */
body.app .console-top .hw-btn,
body.app .console-logo,
body.app .age-btn,
body.app .channel-key,
body.app .settings-close,
body.app .settings-link-btn {
  position: relative;
}
body.app .console-top .hw-btn::after,
body.app .console-logo::after,
body.app .age-btn::after,
body.app .channel-key::after,
body.app .settings-close::after,
body.app .settings-link-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
/* The age chips are the one row with no gap between them - they share the
   edges of one segmented control - so theirs grows downward only. Widening it
   would take the 1 px edge off the chip next door. */
body.app .age-btn::after {
  width: 100%;
}

@media (max-width: 920px) {
  .console-chassis {
    padding: 10px;
    gap: 10px;
  }
  .console-screen {
    padding: 14px;
  }
  .deck-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .spotlight-art-wrap {
    aspect-ratio: 16 / 9;
  }
  .cartridge-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }
  .channel-dock {
    position: sticky;
    bottom: 6px;
    z-index: 25;
    background: rgba(24, 24, 27, 0.96);
    backdrop-filter: blur(10px);
    padding: 8px 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  }
  body[data-kid-theme="princess"] .channel-dock {
    background: rgba(74, 21, 75, 0.96);
  }
  body[data-kid-theme="spiderman"] .channel-dock {
    background: rgba(11, 19, 43, 0.96);
  }
}

@media (max-width: 520px) {
  .theme-grid {
    grid-template-columns: 1fr;
  }
  .theme-option {
    flex-direction: row;
    text-align: start;
  }
  .theme-art {
    width: 84px;
    flex: none;
  }
  .theme-badge {
    margin-inline-start: auto;
  }
  .console-controls .sound-toggle span,
  .console-controls .lang-toggle span,
  .console-controls .account-chip span {
    display: none;
  }
  .console-controls .sound-toggle,
  .console-controls .lang-toggle,
  .console-controls .account-chip {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 440px) {
  .console-top {
    padding: 8px 10px;
  }
  .brand-name {
    font-size: 0.96rem;
  }
  .bay-tools {
    width: 100%;
  }
  .bay-search {
    flex: 1;
  }
  .bay-search input {
    width: 100%;
  }
  .cartridge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .spotlight-info h2 {
    font-size: 1.28rem;
  }
}

/* ---- Console Game Frame (game.html outer shell around #stage) ---- */
.hw-btn--back {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  font-weight: 800;
  padding: 0 14px;
}
.hw-btn--back:hover {
  background: rgba(255, 255, 255, 0.22);
}

.game-console-screen {
  padding: 16px 18px 20px;
  gap: 14px;
}

.game-deck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 2px solid rgba(21, 24, 33, 0.1);
  border-radius: 18px;
  padding: 10px 16px;
  box-shadow: 0 4px 14px rgba(21, 24, 33, 0.05);
}
body[data-kid-theme="princess"] .game-deck-bar {
  border: 2px solid #e899c8;
  box-shadow: 0 4px 14px rgba(201, 42, 129, 0.08);
}
body[data-kid-theme="spiderman"] .game-deck-bar {
  border: 2.5px solid #0b132b;
  box-shadow: 4px 4px 0 #0b132b;
}

body.game-deck .game-header {
  padding: 0;
  gap: 12px;
}
body.game-deck .game-header .game-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  box-shadow: none;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
}
.game-header-text {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body.game-deck .game-header h1 {
  font-size: 1.32rem;
  font-weight: 900;
  color: var(--console-card-ink);
  margin: 0;
}

body.game-deck .game-sets {
  padding: 0;
  gap: 8px;
  margin-inline-start: auto;
}
body.game-deck .game-sets-chips .chip {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 800;
  border: 1.5px solid rgba(21, 24, 33, 0.14);
  background: #f4f5f8;
  color: #151821;
  box-shadow: none;
}
body.game-deck .game-sets-chips .chip:hover {
  background: #e9ecf2;
}
body.game-deck .game-sets-chips .chip[aria-pressed="true"] {
  background: var(--console-accent);
  border-color: var(--console-accent);
  color: #ffffff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

.hw-reset-btn {
  appearance: none;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1.5px solid rgba(21, 24, 33, 0.18);
  background: #ffffff;
  color: #151821;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hw-reset-btn:hover {
  background: #f3f4f7;
}
.hw-reset-btn[hidden] {
  display: none;
}

/* The inner stage (#stage) stays a clean white canvas with standard game tokens
   so all 43 games look and behave identically inside the console screen. */
body.game-deck .stage {
  margin: 0;
  flex: 1;
  background: #ffffff;
  color: var(--text);
  border: 2px solid rgba(21, 24, 33, 0.1);
  border-radius: 20px;
  box-shadow: 0 10px 26px rgba(21, 24, 33, 0.06);
  padding: 20px;
}
body.game-deck[data-kid-theme="princess"] .stage {
  border: 2px solid #e899c8;
}
body.game-deck[data-kid-theme="spiderman"] .stage {
  border: 2.5px solid #0b132b;
  box-shadow: 5px 5px 0 #0b132b;
}

@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
  .game-deck-kicker {
    display: none;
  }
  .game-console-screen {
    padding: 10px;
    gap: 10px;
  }
  .game-deck-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  body.game-deck .game-header {
    flex-wrap: nowrap;
    gap: 8px;
  }
  body.game-deck .game-header .game-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
  body.game-deck .game-header h1 {
    font-size: 1.08rem;
  }
  body.game-deck .game-sets {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  body.game-deck .game-sets-chips .chip,
  .hw-reset-btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
  }
  body.game-deck .stage {
    padding: 12px;
    min-height: 380px;
  }
}

/* Chatty channel (2026-11-11): English lessons on their own site, paid plans. */
.channel-key--chatty { background: rgba(255, 201, 60, 0.16); border-color: rgba(255, 201, 60, 0.55); }
.channel-key--chatty:hover { background: rgba(255, 201, 60, 0.28); }
.channel-key--chatty svg:last-child:not(:first-child) { width: 14px; height: 14px; opacity: .8; }
.channel-key--chatty[data-err] { border-color: #ff8a7d; }
.chatty-cover { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: #5EC4FF; color: #1E2A4A; font: 700 1.1rem Fredoka, system-ui, sans-serif; }

/* Opt-in full-screen game shell (catalog.js `fullscreen: true`, e.g. whispering-woods).
   Other games keep the standard Console Deck frame unchanged. */
body.game-deck.game-fullscreen {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  margin: 0;
  background: #04121b;
}
body.game-deck.game-fullscreen .console-chassis--game {
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: #04121b;
  display: flex;
  flex-direction: column;
}
body.game-deck.game-fullscreen .console-top {
  min-height: 40px;
  padding: 4px 10px;
  gap: 8px;
  background: #06131c;
  border-bottom: 1px solid rgba(255, 215, 120, 0.14);
  flex: none;
}
body.game-deck.game-fullscreen .game-deck-kicker,
body.game-deck.game-fullscreen .kid-crust {
  display: none !important;
}
body.game-deck.game-fullscreen .hw-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
  border-radius: 10px;
}
body.game-deck.game-fullscreen .game-console-screen {
  flex: 1;
  min-height: 0;
  padding: 0;
  gap: 0;
  border-radius: 0;
  background: #04121b;
  display: flex;
  flex-direction: column;
}
body.game-deck.game-fullscreen .game-deck-bar {
  flex: none;
  padding: 4px 10px;
  gap: 6px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 215, 120, 0.14);
  background: rgba(8, 22, 32, 0.96);
  box-shadow: none;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
body.game-deck.game-fullscreen .game-deck-bar::-webkit-scrollbar { display: none; }
body.game-deck.game-fullscreen .game-header {
  display: none;
}
body.game-deck.game-fullscreen .game-sets {
  width: 100%;
  margin-inline-start: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}
body.game-deck.game-fullscreen .game-sets-label {
  display: none !important;
}
body.game-deck.game-fullscreen .game-sets-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}
body.game-deck.game-fullscreen .game-sets-chips .chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e6f2f0;
  box-shadow: none;
}
body.game-deck.game-fullscreen .game-sets-chips .chip[aria-pressed="true"] {
  background: #f59e0b;
  border-color: #fde68a;
  color: #1c1004;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}
body.game-deck.game-fullscreen .hw-reset-btn {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 0.78rem;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e6f2f0;
  flex: none;
}
body.game-deck.game-fullscreen .stage {
  flex: 1;
  min-height: 0 !important;
  width: 100%;
  height: 100%;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #04121b !important;
  overflow: hidden;
  display: flex;
}
@media (max-width: 640px) {
  body.game-deck.game-fullscreen .game-deck-bar {
    overflow-x: visible;
    padding: 4px 8px;
  }
  body.game-deck.game-fullscreen .game-sets {
    align-items: center;
    gap: 5px;
  }
  body.game-deck.game-fullscreen .game-sets-chips {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    gap: 4px;
  }
  body.game-deck.game-fullscreen .hw-reset-btn {
    min-width: 36px;
    min-height: 32px;
    padding: 0 8px;
    justify-content: center;
  }
  body.game-deck.game-fullscreen .hw-reset-btn span {
    display: none;
  }
  body.game-deck.game-fullscreen .game-sets-chips .chip {
    min-height: 28px;
    padding: 0 7px;
    font-size: 0.74rem;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  body.game-deck.game-fullscreen .hw-reset-btn span {
    display: none;
  }
  body.game-deck.game-fullscreen .game-sets-chips .chip {
    padding: 0 8px;
    font-size: 0.75rem;
  }
}
.chatty-cover svg { width: 56px; height: 56px; }

/* Phone header (Almon's pick, 26 Nov 2026): on a phone the title, badges, step
   chips and reset took about 240 px, nearly half the screen above most games.
   Now it is one row: title, a button naming the step on screen (the
   steps open under it), and reset as an icon. Badges are hidden there, since
   the home card already shows age and subject. Full-screen games keep their
   own strip, and wider screens are unchanged. */
.game-sets-toggle { display: none; }
@media (max-width: 640px), (max-height: 520px) and (orientation: landscape) {
  body.game-deck:not(.game-fullscreen) .game-deck-bar {
    position: relative;
    flex-wrap: nowrap;
    padding: 6px 8px;
    gap: 6px;
  }
  body.game-deck:not(.game-fullscreen) .game-header { flex: 1 1 auto; min-width: 0; }
  /* The picture is the one the child just tapped on the home screen; the row
     needs its room for the title and the step. */
  body.game-deck:not(.game-fullscreen) .game-header .game-mark { display: none; }
  body.game-deck:not(.game-fullscreen) .game-header { padding-inline-start: 4px; }
  body.game-deck:not(.game-fullscreen) .game-header-text { min-width: 0; flex-wrap: nowrap; }
  body.game-deck:not(.game-fullscreen) .game-header h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.game-deck:not(.game-fullscreen) .game-header .badges { display: none; }
  body.game-deck:not(.game-fullscreen) .game-sets {
    width: auto;
    flex: none;
    flex-wrap: nowrap;
    margin-inline-start: 0;
    gap: 6px;
  }
  body.game-deck:not(.game-fullscreen) .game-sets-label { display: none; }
  body.game-deck:not(.game-fullscreen) .game-sets-toggle:not([hidden]) {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 46vw;
    min-height: 40px;
    padding: 0 8px 0 10px;
    border-radius: 12px;
    border: 1.5px solid var(--console-accent);
    background: var(--console-accent);
    color: #ffffff;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
  }
  .game-sets-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .game-sets-current .emoji { margin-inline-end: 4px; }
  .game-sets-toggle .ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
  .game-sets.is-open .game-sets-toggle .ico { transform: rotate(180deg); }
  body.game-deck:not(.game-fullscreen) .game-sets-chips { display: none; }
  body.game-deck:not(.game-fullscreen) .game-sets.is-open .game-sets-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 6px);
    z-index: 20;
    padding: 10px;
    background: #ffffff;
    border: 2px solid rgba(21, 24, 33, 0.1);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(21, 24, 33, 0.18);
  }
  body.game-deck:not(.game-fullscreen) .game-sets.is-open .game-sets-chips .chip { min-height: 44px; font-size: 0.86rem; }
  body.game-deck:not(.game-fullscreen) .hw-reset-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
    flex: none;
  }
  body.game-deck:not(.game-fullscreen) .hw-reset-btn span { display: none; }
  /* The theme badge pushed the top bar onto a second row; the theme still
     shows in the colours, as it does in the full-screen games. */
  body.game-deck .kid-crust { display: none !important; }
}

/* Full screen + phone held sideways (Almon, 27 Nov 2026). On a phone in
   landscape the browser bar and our two header rows left the Bear game about
   half the height, so the picture was cut top and bottom.
   1. A full-screen button sits in the top bar (game-host.js shows it only
      where the browser can do it). It shows as an icon on its own.
   2. On short, wide screens the full-screen games put the top bar and the
      step row on ONE thin row, buttons as icons, so the game gets the rest. */
.fullscreen-toggle .ico-exit { display: none; }
.is-fullscreen .fullscreen-toggle .ico-enter { display: none; }
.is-fullscreen .fullscreen-toggle .ico-exit { display: block; }
.fullscreen-toggle span { display: none; }
@media (max-height: 520px) and (orientation: landscape) {
  body.game-deck.game-fullscreen .console-chassis--game {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0;
  }
  body.game-deck.game-fullscreen .game-console-screen { display: contents; }
  body.game-deck.game-fullscreen .console-top {
    flex: none;
    min-height: 0;
    height: 40px;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 215, 120, 0.14);
  }
  body.game-deck.game-fullscreen .console-top .brand-cluster,
  body.game-deck.game-fullscreen .console-top .console-controls { gap: 6px; }
  body.game-deck.game-fullscreen .game-deck-bar {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;
    padding: 4px 8px;
  }
  body.game-deck.game-fullscreen .stage {
    flex: 1 1 100%;
    height: calc(100dvh - 40px);
  }
  body.game-deck.game-fullscreen .console-top .hw-btn,
  body.game-deck.game-fullscreen .hw-reset-btn {
    min-height: 32px;
    padding: 0 8px;
  }
  /* Icons only; each button keeps its name for screen readers. */
  body.game-deck.game-fullscreen .console-top .hw-btn--back span,
  body.game-deck.game-fullscreen .console-top .sound-toggle span,
  body.game-deck.game-fullscreen .hw-reset-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  body.game-deck.game-fullscreen .game-sets-chips .chip {
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.78rem;
  }
}

/* Every other game on a phone held sideways (Almon, 27 Nov 2026): the game
   started about 250 px down a 310-390 px screen, so a child saw only the top of
   it. Now the top bar and the title row share one thin row (the phone header
   above: title, step button, reset icon), the game takes the rest, and
   game-host.js shrinks the game (CSS zoom) until all of it fits, so nothing
   needs scrolling. */
@media (max-height: 520px) and (orientation: landscape) {
  body.game-deck:not(.game-fullscreen) { min-height: 0; height: 100dvh; overflow: hidden; }
  body.game-deck:not(.game-fullscreen) .console-chassis--game {
    max-width: none;
    min-height: 0;
    height: 100dvh;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: stretch;
    padding: 6px 8px 8px;
    gap: 6px;
  }
  body.game-deck:not(.game-fullscreen) .game-console-screen { display: contents; }
  body.game-deck:not(.game-fullscreen) .console-top {
    flex: none;
    flex-wrap: nowrap;
    height: 46px;
    padding: 3px 6px;
    gap: 6px;
    border-radius: 14px;
  }
  body.game-deck:not(.game-fullscreen) .console-top .brand-cluster,
  body.game-deck:not(.game-fullscreen) .console-top .console-controls { gap: 6px; flex-wrap: nowrap; }
  body.game-deck:not(.game-fullscreen) .game-deck-kicker { display: none; }
  body.game-deck:not(.game-fullscreen) .console-top .hw-btn { min-height: 36px; padding: 0 9px; }
  body.game-deck:not(.game-fullscreen) .console-top .hw-btn--back span,
  body.game-deck:not(.game-fullscreen) .console-top .sound-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  body.game-deck:not(.game-fullscreen) .game-deck-bar {
    flex: 1 1 0;
    min-width: 0;
    height: 46px;
    padding: 3px 8px;
    border-radius: 14px;
  }
  body.game-deck:not(.game-fullscreen) .game-sets-toggle:not([hidden]) { min-height: 36px; }
  body.game-deck:not(.game-fullscreen) .hw-reset-btn { min-width: 36px; min-height: 36px; }
  body.game-deck:not(.game-fullscreen) .stage {
    flex: 1 1 100%;
    min-height: 0;
    height: calc(100dvh - 66px);
    padding: 8px;
    border-radius: 16px;
    overflow: auto;
  }
}

/* Bigger top buttons on touch screens (Almon, 30 Nov 2026). The games check
   measured Back, Sound, Language, Full screen, Reset and the step chips at
   28-40 px on phones; small fingers miss them. On any touch screen they are now
   at least 44 px (the usual phone minimum), and the thin sideways rows grow to
   hold them. Looks stay the same, only the size changes. :not(#_) lets this
   beat the per-size rules above without !important. */
@media (pointer: coarse) {
  body.game-deck .console-top .hw-btn:not(#_),
  body.game-deck .game-sets-toggle:not([hidden]):not(#_),
  body.game-deck .hw-reset-btn:not(#_) {
    min-height: 44px;
    min-width: 44px;
  }
  body.game-deck .game-sets-chips .chip:not(#_) { min-height: 44px; }
}
@media (pointer: coarse) and (max-height: 520px) and (orientation: landscape) {
  body.game-deck:not(.game-fullscreen) .console-top:not(#_),
  body.game-deck:not(.game-fullscreen) .game-deck-bar:not(#_) { height: 52px; }
  body.game-deck:not(.game-fullscreen) .stage:not(#_) { height: calc(100dvh - 72px); }
  body.game-deck.game-fullscreen .console-top:not(#_),
  body.game-deck.game-fullscreen .game-deck-bar:not(#_) { height: 50px; padding-block: 3px; }
  body.game-deck.game-fullscreen .stage:not(#_) { height: calc(100dvh - 50px); }
}
/* The taller buttons add ~8 px to the phone header; win it back from the
   frame's padding so the tightest games (Keyboard Keys) still fit unscrolled. */
@media (pointer: coarse) and (max-width: 640px) and (orientation: portrait) {
  body.game-deck:not(.game-fullscreen) .console-chassis--game:not(#_) { padding-top: 6px; padding-bottom: 6px; }
  body.game-deck:not(.game-fullscreen) .game-console-screen:not(#_) { padding-top: 6px; padding-bottom: 6px; }
}
/* Full-screen games on an upright phone: at 44 px the step chips wrapped to a
   second row and pushed the game down; they stay on one row that slides. */
@media (pointer: coarse) and (max-width: 640px) {
  body.game-deck.game-fullscreen .game-sets-chips:not(#_) {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-block: 2px;
  }
  body.game-deck.game-fullscreen .game-sets-chips .chip:not(#_) { flex: none; }
}
@media (pointer: coarse) and (max-width: 640px) {
  body.game-deck.game-fullscreen .game-sets-chips.has-more {
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 44px);
    mask-image: linear-gradient(to left, transparent 0, #000 44px);
  }
  body.game-deck.game-fullscreen .game-sets-chips.has-prev {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px);
    mask-image: linear-gradient(to right, transparent 0, #000 44px);
  }
  [dir="rtl"] body.game-deck.game-fullscreen .game-sets-chips.has-more {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px);
    mask-image: linear-gradient(to right, transparent 0, #000 44px);
  }
  [dir="rtl"] body.game-deck.game-fullscreen .game-sets-chips.has-prev {
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 44px);
    mask-image: linear-gradient(to left, transparent 0, #000 44px);
  }
  body.game-deck.game-fullscreen .game-sets-chips.has-prev.has-more,
  [dir="rtl"] body.game-deck.game-fullscreen .game-sets-chips.has-prev.has-more {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%);
  }
}
