/* Smart Brains trainers (engine v2). All colours via the tokens of cabinet.css; game colours (Stroop inks, coins, wood) stay fixed */
body.play { min-height: 100vh; display: flex; flex-direction: column; }
.play-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.play-head .wrap { max-width: 1000px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding-top: 10px; padding-bottom: 10px; }
.play-logo { flex: none; }
.back { display: flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; min-height: 44px; color: var(--brand-ink); }
.play-title { font-family: var(--display); font-size: 20px; font-weight: 700; flex: 1 1 auto; min-width: 0; }
.play-stats { margin: 0; display: flex; gap: 24px; }
.play-stats div { display: flex; flex-direction: column; align-items: center; }
.play-stats dt { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.play-stats dd { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.play-bar { height: 6px; background: var(--line); }
.play-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s linear; }
.play-main { flex: 1 1 auto; max-width: 760px; width: 100%; padding-top: 32px; padding-bottom: 48px; }

/* intro */
.intro { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.intro h1 { font-size: 42px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.intro .about { font-size: 18px; line-height: 1.55; color: var(--fg-2); max-width: 600px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; font-size: 15px; font-weight: 600; }
.steps li span { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.intro-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; color: var(--fg-2); }
.options { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.options:empty { display: none; }
.btn-xl { font-size: 20px; padding: 16px 44px; border-radius: 16px; min-width: 240px; min-height: 60px; }

/* stage */
.stage { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.hint { text-align: center; font-size: 15px; color: var(--muted); }
.prompt { text-align: center; font-size: 20px; font-weight: 700; color: var(--fg-2); }
.flash-ok { animation: ok .35s; } .flash-bad { animation: bad .35s; }
@keyframes ok { 0% { box-shadow: 0 0 0 0 rgba(43,174,41,.6); } 100% { box-shadow: 0 0 0 14px rgba(43,174,41,0); } }
@keyframes bad { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.big-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.big-btns.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bbtn { font: inherit; min-height: 72px; border-radius: 18px; border: 1px solid var(--field); background: var(--surface); color: var(--fg); font-size: 22px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; }
.bbtn:active { transform: scale(.98); }
.bbtn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.bbtn.good { background: var(--good-soft); border-color: var(--good); }
.bbtn.bad { background: var(--bad-soft); border-color: var(--bad); }
.bbtn:disabled { opacity: .5; cursor: default; }
.kbd { font-size: 13px; font-weight: 600; color: var(--muted); }

/* grids */
.grid { display: grid; gap: 10px; background: var(--surface); padding: 14px; border-radius: 24px; width: 100%; max-width: 560px; margin: 0 auto; }
.cell { font: inherit; aspect-ratio: 1 / 1; min-height: 44px; border-radius: 14px; border: 1px solid var(--field); background: var(--surface); font-size: clamp(18px, 4.5vw, 28px); font-weight: 800; color: var(--fg); cursor: pointer; transition: background .15s, transform .1s; padding: 0; }
.cell.lit { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }
.cell.done { background: var(--line-2); color: var(--muted); border-color: var(--line-2); cursor: default; opacity: .75; }
.cell.red { color: #C0341A; }
.cell.wrong { background: var(--bad-soft); border-color: var(--bad); }
.cell.ok { background: var(--good-soft); border-color: var(--good); }
.cell:active { transform: scale(.96); }

/* corsi field */
.field-area { position: relative; background: var(--surface); border-radius: 24px; width: 100%; max-width: 560px; aspect-ratio: 1 / 1; margin: 0 auto; }
.field-area .cell { position: absolute; width: 17%; height: 17%; aspect-ratio: auto; background: var(--cell-idle); border: 0; }
.field-area .cell.lit { background: var(--yellow); }
.field-area .cell.ok { background: var(--good); }

/* gonogo */
.signal { width: min(60vw, 240px); height: min(60vw, 240px); border-radius: 50%; margin: 10px auto; background: var(--line-2); border: 0; cursor: pointer; display: block; }
.signal.go { background: #1F8A3B; } .signal.stop { background: #D2421B; }

/* words */
.word-big { font-size: clamp(34px, 8vw, 56px); font-weight: 800; letter-spacing: -.5px; min-height: 1.3em; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; width: 100%; }
.choice { font: inherit; font-size: 17px; font-weight: 700; padding: 14px 10px; min-height: 54px; border-radius: 14px; border: 1px solid var(--field); background: var(--surface); color: var(--fg); cursor: pointer; }
.choice.picked { background: var(--brand-soft); border: 2px solid var(--brand); }
.choice.ok { background: var(--good-soft); border-color: var(--good); }
.choice.bad { background: var(--bad-soft); border-color: var(--bad); }
.choice.missed { border: 2px dashed var(--good); }

/* compare */
.expr-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.expr { font: inherit; background: var(--surface); border: 1px solid var(--field); border-radius: 20px; min-height: 120px; font-size: clamp(26px, 6vw, 40px); font-weight: 800; cursor: pointer; color: var(--fg); }
.eq { font: inherit; border-radius: 20px; border: 1px solid var(--field); background: var(--line-2); color: var(--fg); font-weight: 800; font-size: 18px; padding: 0 16px; cursor: pointer; }

/* reading */
.rsvp-box { background: var(--surface); border-radius: 24px; min-height: 220px; display: flex; align-items: center; justify-content: center; position: relative; padding: 20px; }
.rsvp-box::before, .rsvp-box::after { content: ''; position: absolute; left: 50%; width: 2px; height: 18px; background: var(--yellow); }
.rsvp-box::before { top: 28px; } .rsvp-box::after { bottom: 28px; }
.rsvp-word { font-size: clamp(30px, 7vw, 48px); font-weight: 700; text-align: center; }
.reader { background: var(--surface); border-radius: 24px; padding: 28px clamp(18px, 4vw, 40px); font-size: 19px; line-height: 1.7; text-align: left; }
.reader h2 { font-size: 22px; margin-bottom: 12px; }
.reader p { margin: 0 0 14px; }
.reader .w { cursor: pointer; border-radius: 4px; }
.reader .w.found { background: var(--yellow); color: var(--on-yellow); }
.reader .w.miss { background: var(--bad-soft); }
.targets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.find-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.targets span { font-weight: 800; padding: 8px 14px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); }
.targets span.got { background: var(--good-soft); color: var(--good); text-decoration: line-through; }
.question { background: var(--surface); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.question b { font-size: 18px; }
.question .choices { grid-template-columns: 1fr; }
.question .choice { text-align: left; }
.wedge-box { background: var(--surface); border-radius: 24px; height: 200px; position: relative; overflow: hidden; }
.wedge-box .dot { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #C0341A; }
.wedge-box .num { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 34px; font-weight: 800; }
.speed-pick { display: flex; align-items: center; gap: 12px; font-weight: 700; flex-wrap: wrap; justify-content: center; }
.speed-pick select { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--fg); }


/* fixed-height status line: text changes never move the board */
.status { min-height: 30px; text-align: center; font-size: 18px; font-weight: 700; color: var(--fg-2); }
.status.ok { color: var(--good); } .status.bad { color: var(--bad); }

/* digit boxes (remember number) */
.digits { display: flex; justify-content: center; gap: clamp(4px, 1.5vw, 10px); min-height: 84px; align-items: center; }
.digit { width: clamp(34px, 9vw, 58px); height: clamp(48px, 12vw, 76px); border-radius: 12px; border: 2px solid var(--field); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: clamp(24px, 6vw, 38px); font-weight: 800; font-variant-numeric: tabular-nums; }
.digit.cur { border-color: var(--brand); }
.digit.ok { background: var(--good-soft); border-color: var(--good); }
.digit.bad { background: var(--bad-soft); border-color: var(--bad); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 420px; margin: 0 auto; }
.keypad .bbtn { min-height: 62px; font-size: 26px; }

/* math sheet */
.sheet { background: var(--surface); border-radius: 24px; padding: 10px 18px; width: 100%; max-width: 460px; margin: 0 auto; }
.sheet .row-m { display: grid; grid-template-columns: 1fr auto 34px; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; font-size: clamp(16px, 4.4vw, 28px); font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet .row-m:last-child { border-bottom: 0; }
.sheet .ans { min-width: 72px; height: 50px; border-radius: 12px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; }
.sheet .row-m.cur .ans { border-color: var(--brand); background: var(--brand-soft); }
.sheet .row-m.ok .ans { border-color: var(--good); background: var(--good-soft); }
.sheet .row-m.bad .ans { border-color: var(--bad); background: var(--bad-soft); }
.sheet .mark { font-size: 15px; font-weight: 700; color: var(--bad); text-align: right; }

/* cards (find pair) */
.cards { display: grid; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; perspective: 900px; }
.card-f { position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .35s; }
.card-f .face, .card-f .back { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; }
.card-f .back { background: var(--brand); color: rgba(255,255,255,.55); font-size: 28px; font-weight: 800; }
.card-f .face { background: #fff; border: 2px solid var(--line); transform: rotateY(180deg); }
.card-f .face img { width: 62%; height: 62%; object-fit: contain; }
.card-f.open { transform: rotateY(180deg); }
.card-f.done .face { border-color: var(--good); background: var(--good-soft); }
.card-f.miss .face { border-color: var(--bad); background: var(--bad-soft); }
.card-f:disabled { cursor: default; }

/* color memory */
.cgrid { display: grid; gap: 8px; width: 100%; max-width: 520px; margin: 0 auto; background: var(--surface); padding: 12px; border-radius: 24px; }
.cgrid .c { aspect-ratio: 1 / 1; border-radius: 10px; border: 0; background: var(--cell-idle); cursor: pointer; padding: 0; transition: background .15s; }
.cgrid .c:disabled { cursor: default; }
.cgrid .c.err { outline: 3px solid var(--bad); outline-offset: -3px; }

/* stroop */
.stroop-word { font-size: clamp(30px, 10vw, 88px); font-weight: 800; letter-spacing: 1px; min-height: 1.2em; white-space: nowrap; }

/* 2048 */
.board-2048 { position: relative; width: 100%; max-width: 440px; aspect-ratio: 1 / 1; margin: 0 auto; background: var(--board-2048); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.t2048 { border-radius: 12px; background: var(--tile-2048); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: clamp(20px, 6vw, 34px); color: #1c1828; font-variant-numeric: tabular-nums; }
.t2048.v2 { background: #fff; } .t2048.v4 { background: #FFF4D1; } .t2048.v8 { background: #FDDB7A; } .t2048.v16 { background: #FDC109; }
.t2048.v32 { background: #F7A43B; color: #fff; } .t2048.v64 { background: #EE7D2B; color: #fff; } .t2048.v128 { background: #cbbcea; font-size: clamp(18px, 5vw, 30px); }
.t2048.v256 { background: #9a7fd6; color: #fff; font-size: clamp(18px, 5vw, 30px); } .t2048.v512 { background: #5b34a6; color: #fff; font-size: clamp(18px, 5vw, 30px); }
.t2048.v1024 { background: #3b2172; color: #fff; font-size: clamp(15px, 4.2vw, 24px); } .t2048.big { background: #1f8a4c; color: #fff; font-size: clamp(14px, 4vw, 22px); }
.t2048.pop { animation: pop .14s ease-out; }
@keyframes pop { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
.arrows { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 440px; margin: 0 auto; }
.arrows .bbtn { min-height: 56px; }


/* shelf (what is missing) */
.cabinet-box { width: 100%; max-width: 560px; margin: 0 auto; background: #8A5A35; border-radius: 18px; padding: 12px; position: relative; }
.cabinet-box .shelf-row { display: grid; gap: 8px; background: #F4E6D4; border-bottom: 10px solid #6E4526; padding: 10px 10px 6px; height: clamp(84px, 20vw, 112px); align-items: end; }
.cabinet-box .shelf-row + .shelf-row { margin-top: 10px; }
.cabinet-box .shelf-row { grid-auto-rows: 100%; }
.cabinet-box .slot { height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.cabinet-box .slot img { width: 88%; height: 88%; object-fit: contain; object-position: bottom; }
.cabinet-box .slot.gone { background: repeating-linear-gradient(45deg, rgba(192,52,26,.12) 0 6px, transparent 6px 12px); border-radius: 8px; outline: 2px dashed #C0341A; outline-offset: -4px; }
.cabinet-box .doors { position: absolute; inset: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; pointer-events: none; }
.cabinet-box .doors i { background: #A86E42; border-radius: 6px; box-shadow: inset 0 0 0 6px #946036; }
.pick-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; }
.pick-items .bbtn { aspect-ratio: 1 / 1; min-height: 0; padding: 10px; }
.pick-items .bbtn img { width: 80%; height: 80%; object-fit: contain; }

/* touch: no double-tap zoom, no text selection, no grey flash */
.stage button, .stage .cell, .stage .c, .stage .w, .result .btn, .stage .trail-dot, .stage .dict-cell, .stage .money { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.stage button, .stage .cell, .stage .digit, .stage .t2048 { -webkit-user-select: none; user-select: none; }
.signal { color: #fff; font: inherit; font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.signal.stop { border-radius: 22%; }


/* wave 1: switcher */
.sw-frame { width: min(56vw, 210px); aspect-ratio: 1 / 1; margin: 0 auto; border: 12px solid var(--line); border-radius: 30px; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.sw-frame.par { border-color: #1F5FD1; } .sw-frame.mag { border-color: #F07A12; }
.sw-num { font-size: clamp(64px, 18vw, 100px); font-weight: 800; line-height: 1; }
.sw-btn { flex-direction: column; gap: 2px; min-height: 84px; }
.sw-btn span { font-size: 15px; font-weight: 600; color: var(--muted); }
.sw-btn span.on { font-size: 21px; font-weight: 800; color: var(--fg); }

/* trail */
.trail-area { position: relative; background: var(--surface); border-radius: 24px; width: 100%; max-width: 560px; aspect-ratio: 1 / 1; margin: 0 auto; }
.trail-area svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.trail-dot { position: absolute; width: 13%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid var(--field); background: var(--surface); font: inherit; font-size: clamp(16px, 4.6vw, 24px); font-weight: 800; color: var(--ink); cursor: pointer; padding: 0; }
.trail-dot.letter { color: #1F5FD1; }
.trail-dot.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.trail-dot.wrong { background: var(--bad-soft); border-color: var(--bad); }

/* cipher */
.ckey { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; background: var(--surface); border-radius: 16px; padding: 8px; }
.ckey div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border-radius: 8px; background: var(--bg); }
.ckey svg { width: 70%; max-width: 34px; height: auto; color: var(--fg); }
.ckey b { font-size: 17px; }
.csym svg { width: min(36vw, 130px); height: auto; color: var(--fg); }

/* anagram */
.slots { width: 100%; display: flex; justify-content: center; gap: 6px; min-height: 70px; flex-wrap: nowrap; }
.slot-l { font: inherit; max-width: 54px; min-width: 0; height: clamp(44px, 12vw, 64px); border-radius: 12px; border: 2px dashed var(--field); background: var(--surface); font-size: clamp(20px, 6vw, 30px); font-weight: 800; text-transform: uppercase; cursor: pointer; padding: 0; color: var(--ink); }
.slot-l.full { border-style: solid; border-color: var(--brand); }
.tiles { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tile-l { font: inherit; width: clamp(44px, 11vw, 60px); height: clamp(48px, 12vw, 64px); border-radius: 14px; border: 1px solid var(--field); background: var(--surface); font-size: clamp(22px, 6vw, 30px); font-weight: 800; text-transform: uppercase; cursor: pointer; color: var(--ink); }
.tile-l.used { visibility: hidden; }

/* series */
.terms { font-size: clamp(20px, 6.2vw, 44px); font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.terms .q { color: var(--brand-ink); }

/* rotate */
.rot-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rot-box { background: var(--surface); border-radius: 20px; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 10%; }
.rot-box svg { width: 100%; height: 100%; }

/* dictation */
.dict-arrow { height: 88px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.dict-arrow b { font-size: 64px; line-height: 1; color: var(--brand-ink); }
.dict-grid { display: grid; gap: 6px; width: 100%; max-width: 440px; margin: 0 auto; background: var(--surface); padding: 10px; border-radius: 20px; }
.dict-cell { font: inherit; aspect-ratio: 1 / 1; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dict-cell.start { box-shadow: inset 0 0 0 3px var(--brand-soft); }
.dict-cell .chip { width: 62%; aspect-ratio: 1 / 1; border-radius: 50%; background: var(--yellow); }
.dict-cell.ok { background: var(--good-soft); border-color: var(--good); }
.dict-cell.bad { background: var(--bad-soft); border-color: var(--bad); }
.dict-cell:disabled { cursor: default; }

/* odd word: explanation box keeps its height */
.odd-btn { font-size: clamp(16px, 4.6vw, 20px); overflow-wrap: anywhere; hyphens: auto; }
.odd-why { min-height: 4.6em; margin: 0; text-align: center; font-size: 16px; font-weight: 600; color: var(--fg-2); }
.odd-why.ok { color: var(--good); } .odd-why.bad { color: var(--bad); }
.tiles { min-height: 136px; align-content: flex-start; }
.trail-dot { width: max(44px, 13%); }
@media (max-width: 480px) { .ckey { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (hover: none) { .kbd-hint { display: none; } }


/* wave 2: tower */
.tw-goal { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tw-goal .tw-board { transform: scale(.55); transform-origin: center; margin: -40px -60px; pointer-events: none; }
.tw-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 440px; margin: 0 auto; }
.tw-peg { font: inherit; position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; height: min(230px, 26vh); padding: 10px 0 14px; display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; cursor: pointer; }
.tw-peg::before { content: ''; position: absolute; bottom: 14px; left: 50%; width: 8px; margin-left: -4px; background: var(--field); border-radius: 4px; height: var(--h); }
.tw-peg.sel { border-color: var(--brand); background: var(--brand-soft); }
.tw-ball { position: relative; width: min(56px, 6.4vh); height: min(56px, 6.4vh); border-radius: 50%; box-shadow: inset -6px -6px 0 rgba(0,0,0,.12); }
.tw-ball.up { transform: translateY(-16px); outline: 3px solid var(--fg); outline-offset: 2px; }

/* ufov */
.uf-field { position: relative; background: var(--surface); border-radius: 24px; width: 100%; max-width: min(480px, 48vh); aspect-ratio: 1 / 1; margin: 0 auto; overflow: hidden; }
.uf-field .c { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 22%; }
.uf-field .p { position: absolute; transform: translate(-50%, -50%); width: 11%; }
.uf-field .mask { position: absolute; inset: 0; background: repeating-conic-gradient(#9a94aa 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.uf-field .spot { font: inherit; position: absolute; transform: translate(-50%, -50%); width: 16%; aspect-ratio: 1 / 1; border-radius: 50%; border: 2px solid var(--field); background: var(--surface); cursor: pointer; }
.uf-field .spot.ok { background: var(--good-soft); border-color: var(--good); } .uf-field .spot.bad { background: var(--bad-soft); border-color: var(--bad); }
.uf-field .fix { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 36px; font-weight: 800; color: var(--muted); }
.uf-pick svg { width: 64px; height: auto; }

/* fluency */
.fl-theme { font-family: var(--display); font-size: clamp(26px, 7vw, 36px); font-weight: 800; color: var(--brand-ink); }
.fl-form { display: flex; gap: 8px; width: 100%; }
.fl-form input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 20px; padding: 12px 14px; border: 2px solid var(--field); border-radius: 12px; background: var(--surface); color: var(--fg); }
.fl-form input:focus { outline: none; border-color: var(--brand); }
.fl-words { height: 150px; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; background: var(--surface); border-radius: 16px; padding: 10px; }
.fl-words span { padding: 6px 12px; border-radius: 99px; background: var(--ok-soft); color: var(--ok-ink); font-weight: 700; }

/* emotions */
.face svg { width: min(56vw, 26vh, 220px); height: auto; }
.big-btns.emo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.big-btns.emo .bbtn { font-size: 19px; min-height: 60px; }

/* scales */
.sc-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.sc-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; background: var(--surface); border-radius: 16px; padding: 10px 14px; }
.sc-row img { width: 46px; height: 46px; object-fit: contain; justify-self: center; transition: transform .2s; }
.sc-row svg { width: 100%; height: 40px; }
.sc-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-height: 152px; align-content: start; }
.sc-opts .bbtn img { width: 46px; height: 46px; object-fit: contain; }

/* sorter */
.so-refs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.so-card { font: inherit; aspect-ratio: 3 / 4; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 4px; padding: 6px; cursor: pointer; }
.so-card svg { width: 38%; height: auto; }
.so-card.ok { border-color: var(--good); background: var(--good-soft); } .so-card.bad { border-color: var(--bad); background: var(--bad-soft); }
.so-current { width: 34%; max-width: 150px; margin: 0 auto; cursor: default; }

/* change */
.ch-info { font-size: clamp(18px, 5vw, 24px); font-weight: 700; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.ch-info b { color: var(--brand-ink); }
.ch-tray { height: 124px; overflow-y: auto; width: 100%; background: var(--surface); border-radius: 16px; padding: 10px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
.money { font: inherit; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #1E2A33; padding: 0; }
.money.coin { width: 54px; height: 54px; border-radius: 50%; background: #E8C66B; box-shadow: inset 0 0 0 4px #CDA43E; font-size: 17px; }
.money.coin.small { width: 46px; height: 46px; background: #D9A066; box-shadow: inset 0 0 0 4px #B97F45; }
.money.note { width: 84px; height: 46px; border-radius: 8px; background: #B9DCC4; box-shadow: inset 0 0 0 3px #7FB394; font-size: 17px; }
.money.note.n100 { background: #E7C9A5; box-shadow: inset 0 0 0 3px #C9A57A; } .money.note.n500 { background: #CBB7E3; box-shadow: inset 0 0 0 3px #A78CCB; }
.ch-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* matrix */
.mx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: min(380px, 34vh); margin: 0 auto; background: var(--surface); padding: 10px; border-radius: 20px; }
.mx-cell { aspect-ratio: 1 / 1; border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.mx-cell.q { border: 3px dashed var(--brand); font-size: 36px; font-weight: 800; color: var(--brand-ink); }
.mx-cell svg, .mx-opt svg { width: 86%; height: 86%; }
.mx-opts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 560px; margin: 0 auto; }
.mx-opt { font: inherit; aspect-ratio: 1 / 1; border-radius: 14px; border: 2px solid var(--field); background: var(--surface); padding: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mx-opt.good { border-color: var(--good); background: var(--good-soft); } .mx-opt.bad { border-color: var(--bad); background: var(--bad-soft); }

@media (max-width: 480px) { .mx-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: min(380px, 40vh); } }

/* assortment */
.mix-card { min-height: 280px; justify-content: center; }
.mix-card .tag { font-size: 18px; padding: 8px 16px; }
.mix-hint { font-size: 18px; color: var(--fg-2); max-width: 460px; margin: 0; }
.mix-count { font-family: var(--display); font-size: 56px; font-weight: 800; color: var(--brand-ink); line-height: 1; }
.tag.mix { background: var(--accent-soft); color: var(--accent-ink); }

/* result */
.result { display: flex; flex-direction: column; gap: 20px; }
.res-hero { background: var(--brand); color: #fff; border-radius: 24px; padding: 30px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.res-badge { font-size: 13px; font-weight: 800; padding: 6px 14px; border-radius: 99px; background: var(--yellow); color: var(--on-yellow); }
.res-game { font-size: 18px; font-weight: 700; }
.res-score { font-family: var(--display); font-size: 76px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.res-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.res-tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; text-align: center; }
.res-tiles b { display: block; font-size: 24px; font-weight: 800; }
.res-bars { height: 110px; display: flex; align-items: flex-end; gap: 10px; }
.res-bars div { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 12px; font-weight: 700; color: var(--fg-2); }
.res-bars i { display: block; width: 100%; max-width: 56px; border-radius: 8px 8px 0 0; background: var(--bar-soft); min-height: 3px; }
.res-bars i.cur { background: var(--yellow); }
.res-actions { display: flex; flex-direction: column; gap: 10px; }
.res-actions .btn-xl { width: 100%; }
.res-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

@media (max-width: 640px) {
  .play-head .wrap { gap: 6px 14px; }
  .back span { display: none; }
  .play-stats { gap: 14px; width: 100%; justify-content: space-around; }
  .play-stats dd { font-size: 19px; }
  .intro h1 { font-size: 30px; }
  .intro .about { font-size: 16px; }
  .steps { grid-template-columns: 1fr; }
  .steps li { flex-direction: row; text-align: left; }
  .reader { font-size: 17px; }
  .res-score { font-size: 56px; }
  .expr { min-height: 96px; }
}

/* Hover only on devices with a real mouse: on touch screens hover sticks after a tap */
@media (hover: hover) and (pointer: fine) {
  .bbtn:hover { border-color: var(--brand); }
  .expr:hover { border-color: var(--brand); }
  .reader .w:hover { background: var(--brand-soft); }
}

/* ---------- theme helpers ---------- */
:root { --board-2048: #d9d0ec; --tile-2048: rgba(255,255,255,.5); }
:root[data-sb-theme="dark"] { --board-2048: #2f2a40; --tile-2048: rgba(255,255,255,.06); }
.res-h { font-size: 18px; }
.intro .tag { font-size: 13px; padding: 5px 12px; }

/* Dark theme: games whose own colours assume a light board (Stroop inks, black/red numbers, dark shapes, light masks)
   are played on a light «board» inside the dark page — the light tokens are redefined for the stage only */
:root[data-sb-theme="dark"] .stage:has(.stroop-word, .cell.red, .so-card, .rot-row, .sc-row, .uf-field, .trail-area, .mx-grid) {
  color-scheme: light;
  --brand: #5b34a6; --brand-ink: #4a2a8c; --brand-soft: #efe9fa; --brand-hover: #472982;
  --yellow-soft: #fff4d1; --yellow-ink: #7a5a00;
  --bg: #f8f7fb; --surface: #fff; --fg: #1c1828; --fg-2: #3d3650; --muted: #625c72; --line: #e3dfec; --line-2: #efecf5; --field: #cfc8de;
  --ok: #1f8a4c; --ok-soft: #e3f4ea; --ok-ink: #17703d; --bad: #c2410c; --bad-soft: #fbe8de; --bad-line: #e7b9a3;
  --bar-soft: #cbbcea; --cell-idle: #e4def0;
  background: var(--bg); color: var(--fg); border-radius: 24px; padding: 16px;
}
@supports not selector(:has(a)) {
  :root[data-sb-theme="dark"] .stage {
    color-scheme: light;
    --brand: #5b34a6; --brand-ink: #4a2a8c; --brand-soft: #efe9fa; --brand-hover: #472982;
    --yellow-soft: #fff4d1; --yellow-ink: #7a5a00;
    --bg: #f8f7fb; --surface: #fff; --fg: #1c1828; --fg-2: #3d3650; --muted: #625c72; --line: #e3dfec; --line-2: #efecf5; --field: #cfc8de;
    --ok: #1f8a4c; --ok-soft: #e3f4ea; --ok-ink: #17703d; --bad: #c2410c; --bad-soft: #fbe8de; --bad-line: #e7b9a3;
    --bar-soft: #cbbcea; --cell-idle: #e4def0;
    background: var(--bg); color: var(--fg); border-radius: 24px; padding: 16px;
  }
}

/* ---------- large mode (60+): text, buttons and game boards ~+20–25% ---------- */
html.large .play-title { font-size: 23px; }
html.large .play-stats dt { font-size: 14px; }
html.large .play-stats dd { font-size: 29px; }
html.large .back { font-size: 18px; min-height: 52px; }
html.large .play-main { max-width: 900px; }
html.large .intro h1 { font-size: 50px; }
html.large .intro .about { font-size: 21px; }
html.large .steps li { font-size: 18px; padding: 20px 14px; }
html.large .steps li span { width: 44px; height: 44px; font-size: 20px; }
html.large .intro-meta { font-size: 19px; }
html.large .btn-xl { font-size: 23px; min-height: 72px; padding: 18px 48px; }
html.large .hint, html.large .kbd { font-size: 18px; }
html.large .prompt { font-size: 24px; }
html.large .status { font-size: 21px; min-height: 36px; }
html.large .bbtn { min-height: 88px; font-size: 26px; border-radius: 20px; }
html.large .grid, html.large .field-area, html.large .cards, html.large .trail-area, html.large .cabinet-box, html.large .pick-items { max-width: 680px; }
html.large .cell { min-height: 54px; font-size: clamp(22px, 5.4vw, 34px); }
html.large .cgrid { max-width: 640px; }
html.large .board-2048, html.large .arrows, html.large .dict-grid, html.large .tw-board { max-width: 540px; }
html.large .t2048 { font-size: clamp(24px, 7.2vw, 41px); }
html.large .keypad { max-width: 510px; }
html.large .keypad .bbtn { min-height: 76px; font-size: 31px; }
html.large .digit { width: clamp(40px, 10.8vw, 70px); height: clamp(58px, 14.4vw, 92px); font-size: clamp(29px, 7.2vw, 46px); }
html.large .choice { font-size: 21px; min-height: 66px; }
html.large .choices { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
html.large .word-big { font-size: clamp(40px, 9.6vw, 68px); }
html.large .expr { min-height: 144px; font-size: clamp(31px, 7.2vw, 48px); }
html.large .eq { font-size: 22px; }
html.large .reader { font-size: 23px; }
html.large .rsvp-word { font-size: clamp(36px, 8.4vw, 58px); }
html.large .question b { font-size: 22px; }
html.large .sheet { max-width: 560px; }
html.large .sheet .row-m { font-size: clamp(19px, 5.2vw, 34px); }
html.large .sheet .ans { min-width: 86px; height: 60px; }
html.large .stroop-word { font-size: clamp(36px, 12vw, 104px); }
html.large .sw-frame { width: min(64vw, 252px); }
html.large .sw-num { font-size: clamp(76px, 21vw, 120px); }
html.large .sw-btn span { font-size: 18px; } html.large .sw-btn span.on { font-size: 25px; }
html.large .trail-dot { font-size: clamp(19px, 5.4vw, 29px); }
html.large .ckey b { font-size: 20px; }
html.large .slot-l { max-width: 64px; height: clamp(52px, 14vw, 76px); font-size: clamp(24px, 7vw, 36px); }
html.large .tile-l { width: clamp(52px, 13vw, 72px); height: clamp(56px, 14vw, 76px); font-size: clamp(26px, 7vw, 36px); }
html.large .terms { font-size: clamp(24px, 7.4vw, 53px); }
html.large .fl-form input { font-size: 23px; min-height: 60px; }
html.large .fl-words span { font-size: 18px; }
html.large .odd-btn { font-size: clamp(19px, 5.4vw, 24px); }
html.large .odd-why { font-size: 19px; }
html.large .big-btns.emo .bbtn { font-size: 22px; min-height: 72px; }
html.large .mx-opts { max-width: 680px; }
html.large .ch-info { font-size: clamp(21px, 6vw, 29px); }
html.large .mix-hint { font-size: 21px; }
html.large .mix-count { font-size: 68px; }
html.large .res-score { font-size: 88px; }
html.large .res-game { font-size: 21px; }
html.large .res-tiles b { font-size: 29px; }
html.large .res-bars div { font-size: 15px; }
html.large .speed-pick select { font-size: 19px; min-height: 52px; }
@media (max-width: 640px) {
  html.large .intro h1 { font-size: 34px; }
  html.large .intro .about { font-size: 19px; }
  html.large .play-stats dd { font-size: 23px; }
  html.large .res-score { font-size: 66px; }
  html.large .bbtn { min-height: 80px; font-size: 23px; }
}

/* ---------- smooth hovers ---------- */
.bbtn, .choice, .expr, .eq, .mx-opt, .so-card, .tile-l, .slot-l, .trail-dot, .tw-peg, .dict-cell, .back { transition: border-color var(--hov) var(--ease), background-color .25s var(--ease), color .25s var(--ease), transform .2s var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .choice:hover, .eq:hover, .mx-opt:hover, .so-card:hover, .tile-l:hover, .tw-peg:hover { border-color: var(--brand); }
  .back:hover { color: var(--brand); }
  .stage .cell:not(.done):not(.lit):not(.ok):not(.wrong):hover { border-color: var(--brand); }
}
