:root {
  --cmg-bg: #f4f4fc;
  --cmg-ink: #19183b;
  --cmg-ink-soft: #484864;
  --cmg-line: #deddf2;
  --cmg-cyan: #5632bf;
  --cmg-cyan-deep: #45259d;
  --cmg-tangerine: #ac410f;
  --cmg-max: 1216px;
}

body.cmg-body { background: var(--cmg-bg); }
.header-inner { gap: .65rem; }
.header-actions .mobile-only { display: none; }
.skip-link:not(:focus) { clip-path: inset(50%); }
.primary-nav { background: #242049; color: #f9f8ff; }
.nav-inner a { border-radius: 10px; padding: .45rem .65rem; }
.nav-inner a.is-active, .nav-inner a:hover { background: #ebe3ff; color: #2a185b; }
.nav-sound { display: none; }
.btn-primary { border-color: var(--cmg-cyan-deep); }
.btn-secondary { border-color: #87300a; }
.hero { padding: clamp(.75rem, 2vw, 1.8rem) 0 0; }
.hero .hero-inner {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 3.25rem);
  border: 1px solid #413976;
  border-radius: 30px;
  padding: clamp(1.25rem, 4vw, 3.5rem);
  color: #fff;
  background: radial-gradient(ellipse at 85% 0%, #4f2788, transparent 65%), #201b43;
}
.hero .eyebrow { color: #d4fb80; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1; }
.hero .lead { color: #ece5ff; max-width: 38ch; }
.hero .btn-primary { background: #d4fb80; color: #251a40; border-color: #d4fb80; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: #9e8ec4; }
.hero-art {
  display: block;
  overflow: hidden;
  border: 1px solid #8974cc;
  border-radius: 20px;
  background: #171432;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 12px 32px #0e0a2670;
}
.hero-art img { display: block; border: 0; border-radius: 0; aspect-ratio: 16/9; height: auto; }
.hero-art span { display: block; padding: .75rem 1rem; font-weight: 700; }
.hero-art:hover span { text-decoration: underline; }
.section-head h2, .family-callout h2 { font: 600 clamp(1.65rem, 3.5vw, 2.5rem)/1.1 var(--cmg-font-display); }
.game-card, .category-card, .grade-card, .faq-list details, .table-wrap { border: 1px solid var(--cmg-line); }
.game-card { transition: transform .2s ease, box-shadow .2s ease; }
.game-card:hover { transform: translateY(-3px); box-shadow: 0 13px 24px #24195021; }
.game-card-media { overflow: hidden; display: block; }
.game-card-media img { display: block; height: auto; }
.game-card-title { font-size: 1.35rem; }
.game-card-body { display: flex; flex: 1; flex-direction: column; }
.game-card-body p { margin: 0; }
.card-actions { margin-top: auto; padding-top: .35rem; }
.card-actions .btn { min-height: 44px; }
.meta-row li { background: #f0ebff; }
.family-callout, .practice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid #c9baef;
  border-radius: 22px;
  background: #efe8ff;
}
.family-callout h2, .family-callout p { margin: 0; }
.practice-panel { display: grid; justify-content: stretch; max-width: 740px; }
.practice-panel :is(h2, p) { margin: 0; }
.practice-panel form { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.practice-panel label { display: grid; gap: .35rem; font-weight: 700; flex: 1 1 12rem; }
.practice-panel :is(select, input) { min-height: 44px; width: 100%; padding: .45rem .65rem; border: 1px solid #716792; border-radius: 10px; background: #fff; }
.practice-panel [data-practice-feedback] { min-height: 2rem; }
.practice-panel .practice-link { justify-self: start; }
.live-list { display: grid; gap: .5rem; padding: 0; list-style: none; }
.live-list li { padding: .7rem 1rem; border-radius: 12px; background: #fff; border: 1px solid var(--cmg-line); overflow-wrap: anywhere; }
.score-table th { background: #ede6ff; }
.site-footer { background: #242049; color: #fff; }
.site-footer img { filter: grayscale(1) invert(1); }
.site-footer .muted, .site-footer .footer-bottom { color: #e6dfff; }
.game-shell [data-game-overlay] .btn { max-width: 100%; }
.game-shell .game-stage {
  background: linear-gradient(145deg, #221e46ad, #221e46db), var(--game-art) center/cover;
  aspect-ratio: auto;
  min-height: clamp(325px, 44vw, 540px);
}
.game-shell .game-dom-layer { position: relative; height: auto; min-height: inherit; display: block; padding: 0; }
.game-shell .game-dom-layer:empty { display: none; }
.arcade-round {
  --round-progress: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(.4rem, 1.4vw, .9rem);
  text-align: center;
  align-items: center;
  min-height: inherit;
  position: relative;
  padding: .85rem;
  color: #fff;
  background: linear-gradient(160deg, #17364fd9, #102138eb), var(--game-art) center/cover;
}
.arcade-round::before {
  content: "";
  height: 6px;
  width: var(--round-progress);
  position: absolute;
  top: 0;
  left: 0;
  background: #e1fa82;
}
.arcade-prompt {
  margin: 0;
  max-width: 30ch;
  font: 600 clamp(1.25rem, 4vw, 2.7rem)/1.15 var(--cmg-font-display);
}
.arcade-tip { margin: 0; }
.arcade-round button {
  background: #fff;
  color: #201c46;
  font-weight: 700;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid #eee6ff;
  border-radius: 9px;
  cursor: pointer;
}
.arcade-round button:disabled { opacity: 1; }
.arcade-round .arcade-target, .arcade-round[data-result="success"] .fit-grid { filter: drop-shadow(0 0 8px #caff79); }
.leap-track {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  width: min(100%, 700px);
  position: relative;
  margin-block: clamp(.7rem, 4vw, 3rem);
}
.leap-track::before { content: ""; position: absolute; top: 50%; height: 4px; width: 100%; background: #9eece8; }
.arcade-round .leap-track button { position: relative; width: clamp(30px, 9vw, 68px); min-width: 0; padding: 0; }
.leap-track [data-land] { animation: leap-land .38s ease; }
@keyframes leap-land { 50% { transform: translateY(-24px); } }
.rally-road {
  display: flex;
  width: min(96%, 570px);
  gap: .6rem;
  background: repeating-linear-gradient(0deg, #a78cd8 0 10px, transparent 10px 26px) center/4px 100% no-repeat, #2e2754;
  padding: .5rem;
  border: 2px solid #ae9cf5;
  border-radius: 16px;
}
.rally-road button {
  display: grid;
  align-content: space-between;
  justify-items: center;
  gap: .4rem;
  width: 50%;
  padding: .5rem;
  font-size: clamp(1.05rem, 3vw, 1.45rem);
}
.rally-road button::after {
  content: '';
  display: block;
  width: 28px;
  height: 40px;
  background: linear-gradient(#ff9b68 26%, #474775 26% 44%, #ff9b68 44% 84%, #ff6348 84%);
  border: 2px solid #3a265b;
  border-radius: 9px 9px 6px 6px;
}
.rally-road [data-drive]::after { animation: rally-drive .4s ease; }
@keyframes rally-drive { 50% { transform: translateY(-20px) scale(.72); } }
.fit-display { min-height: 110px; display: grid; place-items: center; }
.fit-grid { display: grid; grid-template-columns: repeat(var(--columns), clamp(9px, 2.1vw, 19px)); gap: 2px; }
.fit-grid i { aspect-ratio: 1; background: #a9dcff; border: 1px solid #5598c6; border-radius: 3px; }
.fit-round label { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .55rem; }
.fit-round input { accent-color: #d4fb80; min-height: 44px; }
.arcade-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6rem; }
.arcade-controls label { display: flex; gap: .35rem; align-items: center; }
.arcade-controls input, .arcade-controls select {
  width: 4rem; min-height: 44px; text-align: center;
  background: #fff; color: #19183b; border: 1px solid #c9baef; border-radius: 8px;
}
.clock-dial {
  position: relative; width: clamp(120px, 34vw, 212px); aspect-ratio: 1;
  border: 6px solid #facb76; border-radius: 50%; background: #fff2cd; color: #292047;
}
.clock-dial b { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); font-size: .85rem; }
.clock-dial i {
  position: absolute; left: calc(50% - 3px); bottom: 50%;
  width: 6px; border-radius: 6px; transform-origin: bottom; transition: transform .2s;
}
.clock-hour { height: 23%; background: #2d224b; transform: rotate(var(--hour)); }
.clock-minute { height: 34%; background: #a0304f; transform: rotate(var(--minute)); }
.mixer-glasses { display: flex; gap: 1rem; align-items: end; margin-block: .4rem; }
.mixer-glasses div {
  display: flex; justify-content: center; align-items: center;
  width: 84px; height: clamp(64px, 20vw, 145px);
  border: 3px solid #fff; border-radius: 8px 8px 22px 22px; background: #291f4b;
  background-image: linear-gradient(to top, var(--drink) var(--fill), transparent var(--fill));
  text-shadow: 1px 1px 3px #241944; font-weight: 700;
}
.spinner-dial {
  position: relative; width: clamp(114px, 32vw, 200px); aspect-ratio: 1;
  border: 5px solid #ded0ff; border-radius: 50%; transition: transform .65s ease-out;
}
.spinner-dial span { position: absolute; transform: translate(-50%, -50%); font-size: .8rem; font-weight: 700; }
.spinner-arrow { text-align: center; height: 1rem; line-height: 1; color: #ffda92; }
.memory-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: clamp(.3rem, 1vw, .7rem);
}
.memory-grid button {
  min-height: clamp(42px, 7vw, 88px);
  background: linear-gradient(145deg, #583cb7, #2c2151);
  color: white; border: 1px solid #b5a2ef;
}
.memory-grid button[data-face="answer"] { background: #f4ecff; color: #292047; }
.memory-grid button[data-face="matched"] { background: #d4fb80; color: #292047; }

@media (max-width: 540px) {
  .header-inner { padding-block: .4rem; }
  .brand-name { font-size: 1.16rem; }
  .brand-mark { width: 32px; height: 32px; }
  .header-actions { gap: .2rem; }
  .header-actions .icon-btn { padding: .35rem .55rem; }
  .header-actions [data-sound-toggle] { display: none; }
  .nav-sound { display: inline-flex; }
  .section { padding-block: 1.35rem; }
}
@media (max-width: 900px) {
  .header-actions .mobile-only { display: inline-flex; }
  .mobile-search form { display: flex; gap: .5rem; padding-block: .6rem; }
  .mobile-search input { flex: 1; min-width: 0; border: 1px solid #9183ae; border-radius: 999px; padding-inline: .75rem; }
}
.game-shell .game-toolbar select { width: auto; min-width: 7rem; }
.game-shell .game-toolbar { align-items: center; }
.game-shell:fullscreen { overflow-y: auto; }
.game-shell:fullscreen .game-stage { height: auto; min-height: min(48vh, 440px); }
.game-shell .game-overlay {
  color: #fff;
  background: linear-gradient(90deg, #161332e8, #161332c9), var(--game-art) center/cover;
  justify-items: center;
  overflow: auto;
  place-content: safe center;
}
.game-overlay h2 { margin: 0; font: 600 clamp(2rem, 6vw, 4.3rem)/1 var(--cmg-font-display); }
.game-overlay [data-overlay-text] { max-width: 46ch; font-size: 1.1rem; }
.arcade-round { background: linear-gradient(145deg, #151831e0, #171b3bfa), var(--game-art) center/cover; }
.arcade-round button[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 13px 5px #cbf268; }
.arcade-round[data-result="success"]::before { background: #9ce581; }
.arcade-round[data-result="miss"]::before { background: #ffab80; }
.arcade-controls label { min-height: 44px; }
.arcade-controls :is(button, select, input, output) { padding-inline: .55rem; }
.arcade-controls input[type="range"] { width: min(44vw,220px); padding: 0; accent-color: #d4fb80; }
.arcade-tip { max-width: 64ch; }
.game-status { min-height: 3rem; }

.rush-track, .blaster-field, .prime-reserve, .place-bubbles, .factory-bins, .rally-road {
  width: min(100%, 690px);
}
.rush-track {
  position: relative; display: flex; justify-content: space-around; align-items: start;
  height: clamp(125px,25vw,225px); padding: 1rem .35rem;
  border: 3px solid #a78af3; border-radius: 22px;
  background: repeating-linear-gradient(90deg,#6353a8 0 2%,#353163 2% 32%,#7664ad 32% 34%);
}
.rush-track .rush-gate { z-index: 1; width: 26%; border: 3px solid #fdc769; background: #f9e7aa; font-size: 1.2rem; }
.rush-kart {
  --lane: 1; position: absolute; bottom: 7%; left: calc(15% + var(--lane)*33%);
  width: clamp(28px,10vw,75px); height: clamp(44px,12vw,98px); transform: translateX(-50%);
  background: linear-gradient(90deg,#2a2847 10%,transparent 10% 90%,#2a2847 90%), linear-gradient(#e5fc81 25%,#526488 25% 50%,#b3ea5e 50% 85%,#fc804c 85%);
  border: 3px solid #111627; border-radius: 45% 45% 25% 25%;
  transition: left .24s cubic-bezier(.12,.74,.55,1), bottom .55s;
}
.rush-kart.launch { bottom: 68%; }

.pizza-pie {
  position: relative; width: min(100%, clamp(265px, 45vw, 290px)); aspect-ratio: 1; border-radius: 50%;
  background: #f8c16e; border: 11px solid #b96b32; box-shadow: 0 6px 1px #713820,0 0 0 8px #ffe89730;
}
.arcade-round .pizza-slice {
  position: absolute; transform: translate(-50%,-50%); width: 44px; min-height: 44px; border-radius: 50%;
  border: 2px dashed #884b36; background: #fff4c4;
}
.pizza-slice[aria-pressed="true"] { background: #d54d5a; }

.blaster-field {
  position: relative; display: grid; grid-template-columns: repeat(4,1fr); gap: .45rem; align-items: start;
  height: clamp(145px,28vw,230px); padding: 1rem .45rem;
  border: 1px solid #6b71ca; border-radius: 18px;
  background: radial-gradient(circle at 15% 20%,#d6e8fa 1px,transparent 2px),radial-gradient(circle at 45% 65%,#c9a8fd 1px,transparent 2px),#221b55;
  background-size: 47px 43px,76px 62px,100%;
}
.arcade-round .blaster-target { position: relative; background: #c7dcff; border: 3px solid #7296f6; border-radius: 45% 45% 30% 30%; animation: arcade-float 2s var(--delay) ease-in-out infinite; }
.arcade-round .blaster-target:is(:hover,:focus-visible) { animation-play-state: paused; }
.arcade-round .blaster-target.hit { animation: arcade-hit .55s; background: #d6fa80; }
.arcade-round[data-result] .blaster-target:not(.hit) { animation-play-state: paused; }
.blaster-ship {
  position: absolute; left: calc(50% - 17px); bottom: 10px; width: 34px; height: 44px;
  background: linear-gradient(90deg,#9beffc,#dbe7ff,#8ca6ef); clip-path: polygon(50% 0%,100% 83%,68% 74%,50% 100%,32% 74%,0 83%);
}
.blaster-field[data-shot]::after {
  content: ''; position: absolute; left: 50%; bottom: 30px; width: 4px; height: 52%;
  background: #b7faff; transform-origin: bottom; transform: rotate(var(--beam)); animation: arcade-flash .5s ease-out both; pointer-events: none;
}
.blaster-field[data-shot="0"] { --beam:-53deg; }
.blaster-field[data-shot="1"] { --beam:-24deg; }
.blaster-field[data-shot="2"] { --beam:24deg; }
.blaster-field[data-shot="3"] { --beam:53deg; }

.factory-bins { display: flex; align-items: end; justify-content: center; gap: .35rem; }
.factory-bin {
  display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; padding: 6px;
  width: min(21%,70px); min-height: 96px; border: 3px solid #92dfec; border-top: 0;
  background: #173f64; border-radius: 0 0 10px 10px;
}
.gear { display: block; width: 19px; height: 15px; background: #ffc466; clip-path: polygon(20% 0,35% 10%,65% 10%,80% 0,100% 30%,90% 50%,100% 70%,80% 100%,65% 90%,35% 90%,20% 100%,0 70%,10% 50%,0 30%); }

.balance-beam { position: relative; display: flex; gap: 2rem; padding-bottom: .55rem; border-bottom: 5px solid #b6aaff; }
.balance-beam::after { content:''; position:absolute; top:100%; left:calc(50% - 16px); width:32px; height:28px; background:#b6aaff; clip-path:polygon(50% 0,100% 100%,0 100%); }
.balance-pan { min-width: min(30vw,125px); border-radius: 10px; padding: .75rem .6rem; background: #ad80fc; color: #19163a; font-size:1.3rem; font-weight:700; }
.balance-beam + output { margin-top: 1.65rem; }

.prime-reserve { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .6rem; max-width: 400px; }
.arcade-round .prime-creature {
  background: radial-gradient(circle at 28% 30%,#fff 0 5%,transparent 6%),radial-gradient(circle at 72% 30%,#fff 0 5%,transparent 6%),hsl(var(--hue) 74% 69%);
  height: clamp(51px,9vw,80px); border-radius: 34% 34% 24% 24%; border: 0;
}

.angle-sky { --trajectory: min(26vw, 123px); position:relative; width: min(100%, 410px); height:clamp(145px, 37vw, 180px); border-radius: 13px; background: #24234f; }
.angle-sky i { display:block; position:absolute; left:50%; bottom:13%; transform-origin:left center; }
.angle-axis { width: 42%; height: 2px; background: #c4b4f4; }
.angle-star { width: var(--trajectory); height: 5px; transform: rotate(var(--target)); }
.angle-star::after { content:'✦'; font-style:normal; position:absolute; left:100%; top:-15px; color:#ffe584; font-size:24px; }
.angle-ray { width: 42px; height: 6px; border-radius: 8px; transform:rotate(var(--aim)); background:#aee8ff; }
.angle-sky.fired .angle-ray { width: var(--trajectory); box-shadow:0 0 13px #a0dfff; transition:width .35s; }
.angle-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: .5rem; width: min(100%, 360px); }
.angle-controls label { display: grid; justify-items: center; }
.angle-controls input { width: 100%; min-height: 44px; margin: 0; accent-color: #d4fb80; }

.market-receipt {
  display: grid; gap: .4rem; min-width: min(85%,250px); max-width: 100%; padding: .8rem 1.1rem;
  background:#fff0bc; color:#2c2449; border-bottom: 7px dashed #a373cf;
}
.market-receipt strong { font-size: 1.2rem; }
.market-receipt b { justify-self:center; padding:.15rem .45rem; border-radius:9px; background:#a53958; color:#fff; }

.place-bubbles { display:flex; justify-content:center; gap: clamp(.3rem, 1vw, .8rem); }
.arcade-round .place-bubble {
  font-size:clamp(1.1rem,5vw,2.4rem); width:clamp(44px,13vw,108px); aspect-ratio: 1;
  border:2px solid #bbfbfd; border-radius:50%;
  background: radial-gradient(circle at 26% 22%,#fff 2%,#e5fdff 13%,#b7e5ff 25%,#a9a1fd 68%,#6155b3 92%);
  animation: arcade-float 2.3s var(--delay) ease-in-out infinite;
}
.arcade-round .place-bubble.popped { animation: arcade-pop .5s ease-out; }

.duel-arena { display:grid; justify-items:center; gap:.7rem; width:min(96%,340px); }
.duel-bot { background:#90ceeb; color:#25204b; border:5px solid #55449c; border-radius:22px; padding:.5rem 1rem; font-size:1.6rem; box-shadow:0 6px #33265f; }
.duel-meter { width:var(--round-progress); justify-self:start; height:10px; border-radius:8px; background:#f1b274; }
.duel-arena.sent .duel-bot { transform:scale(1.1); transition: transform .3s; }

.operation-machine, .pattern-strip, .decimal-route, .decimal-gates {
  display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:.35rem;
  padding:.6rem; border-radius:15px; background:#261c4b; border:2px solid #7564be;
}
.operation-machine { padding:.75rem; font:600 clamp(1.45rem,5vw,2.55rem)/1.1 var(--cmg-font-display); }
.arcade-round .op-key { padding:0 .65rem; color:#2f2260; background:#efdaff; }
.operation-machine.unlocked { border-color:#d4fb80; }
.decimal-gates,.decimal-route { width:min(100%,515px); min-height:55px; }
.decimal-token { border-radius:12px; padding:.4rem; min-width:58px; font-weight:700; color:#2c1551; background:#b9f2f7; border:2px solid #83c8fa; }
.arcade-round .decimal-token { background:#dfcdfc; }
.decimal-route .decimal-token { animation:arcade-hit .3s; }

.coordinate-board, .sudoku-board {
  display:grid; width: min(48vw,196px); aspect-ratio:1; gap:2px; padding:3px; background:#a2aae6; border-radius:8px;
  grid-template-columns:repeat(var(--squares,4),minmax(0,1fr));
}
.coordinate-board span { position:relative; background:#2a315e; border-radius:2px; }
.coordinate-board .axis { background:#464e97; }
.coordinate-rover {
  position:absolute; inset:10%; border-radius:6px; background:linear-gradient(90deg,#69cd98 30%,#d3fd9a 30% 70%,#69cd98 70%);
  animation:arcade-hit .24s ease-in-out;
}
.pattern-tile { display:grid; place-items:center; min-width:30px; min-height:39px; font-size:1.4rem; font-weight:700; background:#f6e8fc; color:#31184f; border-radius:9px; padding-inline:.3rem; }
.arcade-round button.pattern-tile { min-width:44px; }
.shape-0 { color:#a71f57 !important; }
.shape-1 { color:#124495 !important; }
.shape-2 { color:#256142 !important; }
.shape-3 { color:#6521a1 !important; }
.shape-4 { color:#8a390d !important; }
.factor-press { padding:.65rem 1.25rem; background:#42327a; border:3px solid #a29ce3; border-radius:13px; font-size:1.55rem; font-weight:700; }
.arcade-round .factor-block { min-width:43px; background:#ffeda9; }
.factor-rollers { padding:.5rem; border-top:3px dotted #e2b981; border-bottom:3px dotted #e2b981; }
.factor-block:disabled { opacity:.42 !important; }

.sample-chart { display:flex; width:min(100%,430px); height:clamp(140px,26vw,230px); padding:.6rem .45rem 0; background:#231e54; border:1px solid #9991dd; border-radius:12px; }
.chart-axis { display:grid; grid-template-rows:repeat(6,minmax(0,1fr)); align-items:start; padding-right:.35rem; line-height:1; }
.chart-columns {
  display:grid; grid-template-columns:repeat(4,1fr); gap:.3rem; flex:1;
  background:repeating-linear-gradient(to top,transparent 0 calc(16.666% - 1px),#7c78a4 calc(16.666% - 1px) 16.666%);
}
.chart-column { display:grid; min-width:0; }
.arcade-round .chart-bar {
  display: grid;
  align-content: end;
  min-width: 0;
  padding: 0 .1rem .12rem;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(to top, hsl(var(--tone) 75% 78%) var(--bar), transparent var(--bar));
  border: 0;
  overflow-wrap: anywhere;
  font-size: clamp(.74rem, 2.5vw, 1rem);
}
.chart-bar[data-marked] { animation:arcade-hit .4s; }

.memory-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.4rem; width:min(100%,360px); }
.arcade-round .memory-grid button { min-height:44px; background:#5b429f; color:#fff; }
.arcade-round .memory-grid button[data-face="expression"] { background:#beaaef; color:#201645; }
.arcade-round .memory-grid button[data-face="answer"] { background:#f8efd2; color:#201645; }
.arcade-round .memory-grid button[data-face="matched"] { background:#d4fb80; color:#201645; }
.sudoku-board { width:min(100%, clamp(190px, 55vw, 213px)); background:#7d6db0; gap:1px; }
.sudoku-cell { display:grid; place-content:center; border-radius:0; background:#352960; min-width:0; min-height:0; }
.arcade-round .sudoku-cell.editable { min-height:0; border-radius:0; border:0; }
.sudoku-cell:nth-child(4n + 2) { border-right:3px solid #a494d0 !important; }
.sudoku-cell:nth-child(n + 5):nth-child(-n + 8) { border-bottom:3px solid #a494d0 !important; }
.arcade-round .sudoku-cell[aria-pressed="true"] { box-shadow:inset 0 0 0 3px #b178dc; background:#efdcff; }

.money-tray {
  display:flex; flex-wrap:wrap; justify-content:center; gap:3px; width:min(100%,390px); min-height:55px;
  max-height:105px; overflow:auto; padding:.5rem;
  border:3px solid #b6abd8; border-radius:14px; background:#2b2354;
}
.change-token { display:grid; place-content:center; min-width:32px; height:32px; padding:.12rem; border-radius:50%; background:#f4cd83; color:#392547; animation:arcade-hit .25s; font-weight:700; }
.arcade-round .coin-1,.arcade-round .coin-25 { background:#f4cd83; }
.arcade-round .coin-5,.arcade-round .coin-10 { background:#e0e8f9; }
.arcade-round .coin-100 { background:#c6f3ab; }

.sort-belt { display:grid; place-items:center; width:min(100%,520px); min-height:77px; background:repeating-linear-gradient(90deg,#413955 0 18px,#57506c 18px 22px); border:3px solid #9987bf; border-radius:15px; }
.sort-parcel { padding:.3rem .85rem; border-radius:5px; background:#ffc58b; color:#292047; font-weight:700; font-size:1.4rem; box-shadow:0 4px #a15d62; }
.sort-parcel.arrive { animation:parcel-in .35s ease-out; }
.sort-targets { display:flex; flex-wrap:wrap; justify-content:center; gap:.4rem; }
.sort-targets button { padding-inline:.55rem; }
.story-note { max-width:38ch; margin:0; padding: .55rem .9rem; background:#fcebd0; color:#2c1e48; border-radius:11px; font-size:clamp(1rem,3.5vw,1.35rem); }
.arcade-round .route-sign { min-width:44px; font-size:1.25rem; background:#dbf4e5; }

@keyframes arcade-float { 50% { transform:translateY(-8px); } }
@keyframes arcade-hit { 50% { transform:scale(1.1); } }
@keyframes arcade-flash { from { opacity:1; } to { opacity:0; } }
@keyframes arcade-pop { 50% { transform:scale(1.18); opacity:.18; } }
@keyframes parcel-in { from { transform: translateX(-70%); opacity:.2; } }
@media (max-width:540px) {
  .game-shell .game-stage { min-height: 325px; }
  .game-toolbar .btn { padding:.35rem .65rem; }
  .arcade-round { padding:.55rem; }
  .arcade-prompt { font-size:clamp(1.25rem,5.3vw,1.7rem); }
  .arcade-tip { font-size:.96rem; }
  .factory-bin { min-height:75px; }
  .gear { width:16px; height:11px; }
  .game-intro .lead { margin-block:.4rem; }
}

@media (pointer: coarse) {
  body[data-page="game"] .site-header { position: static; }
  .game-shell .game-stage { scroll-margin-top: .5rem; }
  .game-shell button, .game-shell select { touch-action: manipulation; }
  .game-shell :is(input, select) { font-size: max(16px, 1rem); }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .game-shell .game-stage { min-height: 255px; }
  .arcade-round { gap: .45rem; }
  .arcade-prompt { font-size: 1.5rem; }
}

@media (pointer: coarse) and (orientation: landscape) and (min-width: 570px) and (max-height: 500px) {
  [data-game-id="fraction-pizza"] .arcade-round,
  [data-game-id="coordinate-quest"] .arcade-round,
  [data-game-id="sudoku-mini"] .arcade-round,
  [data-game-id="probability-spinner"] .arcade-round {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(265px, 46%);
    justify-items: center;
    align-content: center;
  }
  [data-game-id="fraction-pizza"] .arcade-round > *,
  [data-game-id="coordinate-quest"] .arcade-round > *,
  [data-game-id="sudoku-mini"] .arcade-round > *,
  [data-game-id="probability-spinner"] .arcade-round > * { grid-column: 1; }
  .arcade-round > :is(.pizza-pie, .coordinate-board, .sudoku-board, div:has(> .spinner-dial)) {
    grid-column: 2;
    grid-row: 1 / span 4;
  }
}
