@font-face { font-family: 'Fredoka One'; src: url('./fonts/fredoka-one-400-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('./fonts/nunito-400-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('./fonts/nunito-400-latin-ext.woff2') format('woff2'); font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --teal: #2ee6c0; --coral: #ff8585; --amber: #ffcf5e; --violet: #9b6bff;
  --ink: #1e2433; --paper: #fffaf0; --night: #17162e; --glass: rgba(23, 22, 46, .78);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink);
  font-family: Nunito, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.ki { width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: currentColor; }

/* ── HUD ─────────────────────────────────────────────────────────────── */
#hud { position: fixed; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; pointer-events: none; z-index: 5; }
.hud-left { display: flex; gap: 8px; align-items: center; flex: 1 1 auto; min-width: 0; }
.hud-right { display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.pill { background: var(--glass); color: #fff; border-radius: 999px; padding: 6px 14px; font-family: 'Fredoka One', sans-serif; font-size: 16px;
  white-space: nowrap; }
.pill.place { font-size: 22px; padding: 4px 14px; color: var(--amber); }
.pill.time { color: #fff; min-width: 4.2em; text-align: center; }
.pill.rights-pill { display: inline-flex; align-items: center; gap: 7px; }
.pill.rights-pill svg { width: 16px; height: 16px; }
.rights { color: var(--teal); font-size: 18px; }
.hud-right button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--glass); display: grid; place-items: center; padding: 0; }
.hud-right svg { width: 22px; height: 22px; fill: #fff; stroke: #fff; stroke-width: 0; }
#mute-btn .wave { stroke-width: 2; stroke-linecap: round; }
#mute-btn[aria-pressed="true"] .wave { display: none; }
#mute-btn[aria-pressed="true"] svg { opacity: .5; }

#banner { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none;
  background: var(--amber); color: var(--ink); border-radius: 14px; padding: 6px 16px; font: 20px 'Fredoka One', sans-serif;
  box-shadow: 0 6px 18px rgba(0,0,0,.3); animation: pop .25s ease-out; white-space: nowrap; }
#banner.turbo { background: #5fd0ff; }
#count { position: fixed; left: 0; right: 0; top: 26%; text-align: center; z-index: 6; pointer-events: none;
  font: 96px 'Fredoka One', sans-serif; color: #fff; text-shadow: 0 6px 0 rgba(0,0,0,.35); animation: pop .3s ease-out; }
#count.go { color: var(--teal); }
@keyframes pop { from { transform: translateX(var(--tx, 0)) scale(.6); opacity: 0; } }
#banner { --tx: -50%; }

/* name tags over the cars */
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); padding: 2px 9px; border-radius: 999px;
  font: 13px 'Fredoka One', sans-serif; color: var(--ink); background: #fff; white-space: nowrap; border: 3px solid var(--c, #fff);
  box-shadow: 0 2px 6px rgba(0,0,0,.25); will-change: transform; }
.tag.me { background: var(--teal); border-color: #fff; font-size: 14px; }

/* ── question card ───────────────────────────────────────────────────── */
#card { position: fixed; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); z-index: 8;
  width: min(680px, calc(100vw - 20px)); background: var(--paper); border-radius: 20px; padding: 12px 12px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); border: 4px solid var(--teal); transition: border-color .15s; }
#card.right { border-color: #2ec27e; }
#card.wrong { border-color: var(--amber); }
#card.turbo { border-color: #5fd0ff; }
.card-q { font-family: 'Fredoka One', sans-serif; font-size: 24px; line-height: 1.25; margin: 0 0 10px; text-align: center; min-height: 1.3em; }
.card-q .gap.long { font-size: 19px; }
.card-q .blank.ask { color: var(--ink); background: var(--amber); border-radius: 6px; padding: 0 6px; }
.card-q .trio { display: flex; align-items: stretch; gap: 4px; max-width: 460px; margin: 0 auto; }
.card-q .slot { flex: 1 1 0; min-width: 0; text-align: center; border-radius: 10px; padding: 3px 4px 2px; border: 3px solid #e3dccb; background: #fff; }
.card-q .slot b { display: block; font-weight: 400; font-size: 21px; white-space: nowrap; overflow: hidden; }
.card-q .trio.len-l .slot b { font-size: 16px; line-height: 26px; }
.card-q .trio.len-xl .slot b { font-size: 13.5px; line-height: 26px; }
.card-q .trio.len-xxl .slot b { font-size: 11.5px; line-height: 26px; }
.card-q .slot small { display: block; font: 700 11px Nunito, sans-serif; color: #6a7080; }
.card-q .slot.ask { background: var(--amber); border-color: var(--ink); animation: askpulse 1s ease-in-out infinite alternate; }
.card-q .slot.ask small { color: var(--ink); }
.card-q .slot.later b, .card-q .slot.later small { color: #b8bcc8; }
.card-q .trio .arrow { align-self: center; color: #9aa0b0; }
@keyframes askpulse { to { transform: scale(1.05); } }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 52px; padding: 4px 6px;
  border-radius: 14px; border: 3px solid #e3dccb; background: #fff; font: 20px 'Fredoka One', sans-serif; color: var(--ink);
  box-shadow: 0 3px 0 #e3dccb; transition: transform .08s; }
.chip:active { transform: translateY(2px); }
.chip .word { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.chips[data-len="l"] .chip { font-size: 17px; }
.chips[data-len="xl"] .chip { font-size: 14.5px; }
.chips[data-len="xxl"] .chip { font-size: 12.5px; }
.chip kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 6px; background: #c8f5ea; font: 13px Nunito, sans-serif; font-weight: 800; }
.chip.is-right { background: #c9f5e2; border-color: #2ec27e; box-shadow: 0 3px 0 #2ec27e; }
.chip.is-wrong { background: #ffd9d9; border-color: var(--coral); box-shadow: 0 3px 0 var(--coral); text-decoration: line-through; }
.chip:disabled { cursor: default; }
.card-foot { min-height: 0; text-align: center; font-size: 15px; font-weight: 700; color: #5a6072; }
.card-foot:not(:empty) { margin-top: 8px; }
.card-foot .reveal { font-family: 'Fredoka One', sans-serif; font-weight: 400; color: var(--ink); font-size: 18px; }
.card-foot .teach { display: block; font-weight: 600; margin-top: 2px; }
.card-foot b { color: #2ec27e; }
#card.wrong .card-foot b { color: #c27a00; }
#card.idle .chips { opacity: .35; }

@media (max-width: 560px) {
  .chips { grid-template-columns: repeat(2, 1fr); }
  .chip { min-height: 50px; font-size: 20px; }
  .card-q { font-size: 22px; }
  #banner { top: 94px; }
  .pill.place { font-size: 19px; padding: 5px 11px; }
  .pill.time { min-width: 3.6em; padding: 6px 9px; }
}

/* ── menus ───────────────────────────────────────────────────────────── */
#menu, #pause, #results { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10;
  padding: 16px; }
#pause { background: rgba(23, 22, 46, .45); }
body[data-state="pause"] #card { visibility: hidden; }   /* no thinking while the clock stands */
#results { align-items: flex-end; padding-bottom: calc(16px + var(--safe-b)); }
.menu-card { position: relative; width: min(440px, 100%); background: var(--paper); border-radius: 24px; padding: 22px 22px 18px;
  text-align: center; box-shadow: 0 14px 40px rgba(0,0,0,.4); }
.menu-card.small { width: min(320px, 100%); }
.menu-card h1 { font: 40px 'Fredoka One', sans-serif; margin: 10px 0 2px; color: var(--ink); }
.menu-card h2 { font: 30px 'Fredoka One', sans-serif; margin: 2px 0 10px; }
.tagline { margin: 0 0 14px; font-weight: 700; color: #5a6072; }
.lang-switch { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; }
.lang-switch button { border: 2px solid #e3dccb; background: #fff; border-radius: 8px; padding: 2px 7px; font-size: 12px; font-weight: 800; color: #6a7080; }
.lang-switch button.on { border-color: var(--ink); color: var(--ink); background: #fff3cf; }
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.track-btn { border: 3px solid #e3dccb; background: #fff; border-radius: 16px; padding: 8px 6px 6px; font: 18px 'Fredoka One', sans-serif; color: var(--ink); }
.track-btn svg { display: block; width: 100%; height: 54px; margin-bottom: 4px; }
.track-btn.on { border-color: var(--ink); background: #fff3cf; }
.primary, .menu-card button:not(.track-btn):not([data-lang]):not(.music-toggle):not([data-v]) { display: block; width: 100%; border: 0; border-radius: 16px; padding: 12px;
  font: 22px 'Fredoka One', sans-serif; background: #ece5d4; color: var(--ink); margin-top: 8px; box-shadow: 0 4px 0 #d3cab4; }
.menu-card .primary { background: var(--teal); box-shadow: 0 4px 0 #1fb596; }
.keys, .goal { margin: 10px 0 0; font-size: 14px; color: #5a6072; font-weight: 700; }
.goal { margin-top: 2px; }
.figure-link { display: inline-block; margin-top: 10px; font-weight: 800; color: #1a8f7a; text-decoration: none; font-size: 14px; }

.results-card { width: min(460px, 100%); padding: 14px 16px 14px; }
#res-place { font-size: 34px; margin: 0 0 6px; color: var(--ink); }
#res-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
#res-list li { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 6px; border-radius: 12px; background: #fff; border: 2px solid #eee6d4;
  font-weight: 800; font-size: 15px; }
#res-list li.me { background: #d9fbf2; border-color: var(--teal); }
#res-list .n { width: 22px; font-family: 'Fredoka One', sans-serif; font-weight: 400; font-size: 18px; color: #6a7080; }
#res-list img { width: 30px; height: 30px; border-radius: 50%; background: #eee6d4; object-fit: cover; }
#res-list .c { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#res-list .name { flex: 1 1 auto; text-align: left; }
#res-list .t { color: #5a6072; font-variant-numeric: tabular-nums; }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.res-stats div { background: #fff; border-radius: 12px; padding: 4px 4px; border: 2px solid #eee6d4; }
.res-stats small { display: block; font-size: 11px; font-weight: 800; color: #6a7080; }
.res-stats b { font: 20px 'Fredoka One', sans-serif; font-weight: 400; }
.new-best { margin: 8px 0 0; font: 18px 'Fredoka One', sans-serif; color: #c27a00; }
.shells { font: 18px 'Fredoka One', sans-serif; color: #1a8f7a; }
.res-extra { margin: 6px 0 0; display: flex; justify-content: center; gap: 16px; }
.res-extra:not(:has(:not([hidden]))) { display: none; }
.res-extra .coins { font: 18px 'Fredoka One', sans-serif; color: #b07800; display: inline-flex; align-items: center; gap: 4px; }
.coin-ic { width: 1.1em; height: 1.1em; }
.res-buttons { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 4px; }
@media (max-height: 700px) and (max-width: 560px) {
  #res-list img { width: 24px; height: 24px; }
  #res-list li { padding: 1px 8px 1px 4px; }
}

/* wide screens: menu and results stand beside the 3D scene; tall ones: below it */
#menu { align-items: flex-end; padding-bottom: calc(16px + var(--safe-b)); }
@media (min-width: 860px) and (orientation: landscape) {
  #menu, #results { align-items: center; justify-content: flex-end; padding-right: 4vw; }
}
.menu-card { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
@media (max-height: 700px) {
  .menu-card h1 { font-size: 32px; margin-top: 18px; }
  .tagline { margin-bottom: 8px; }
  .track-btn svg { height: 40px; }
}
.primary:disabled { opacity: .6; cursor: default; }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--night); color: #fff; z-index: 20;
  font: 22px 'Fredoka One', sans-serif; transition: opacity .3s; }
#loading.gone { opacity: 0; pointer-events: none; }

/* ── polish (2026-11-28): speed lines, mini map, coins, place flashes, line-up ── */
#speed { position: fixed; inset: -10%; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .25s;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0) 0deg 4deg, rgba(255,255,255,.55) 4deg 4.6deg, rgba(255,255,255,0) 4.6deg 9deg);
  -webkit-mask: radial-gradient(ellipse at 50% 45%, transparent 38%, #000 78%); mask: radial-gradient(ellipse at 50% 45%, transparent 38%, #000 78%); }
#minimap { position: fixed; right: 12px; top: 60px; width: 230px; height: 230px; z-index: 5; pointer-events: none;
  background: rgba(23,22,46,.42); border: 3px solid rgba(255,255,255,.85); border-radius: 22px; padding: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,.25); backdrop-filter: blur(3px); }
#minimap svg { width: 100%; height: 100%; display: block; }
body:not([data-state="race"]):not([data-state="count"]):not([data-state="finish"]) #minimap { display: none; }
.pill.coins { display: inline-flex; align-items: center; gap: 5px; color: var(--amber); }
.pill.coins.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.25); } }
.pill.place.up { animation: placeUp .9s ease-out; }
.pill.place.down { animation: placeDown .9s ease-out; }
@keyframes placeUp { 0%, 60% { background: #2ec27e; color: #fff; transform: scale(1.18); } }
@keyframes placeDown { 0%, 60% { background: var(--coral); color: #fff; } }
#banner.turbo { animation: pop .25s ease-out, glow 1s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 22px 4px rgba(95,208,255,.8); } }
#count { text-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 30px rgba(255,207,94,.8); }

#lineup { position: fixed; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); z-index: 7; text-align: center; padding: 0 10px; }
#lineup h2 { margin: 0 0 8px; font: 22px 'Fredoka One', sans-serif; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
#lineup .cards { display: grid; grid-template-columns: repeat(4, minmax(0, 170px)); justify-content: center; gap: 10px; }
.lu { background: var(--paper); border-radius: 16px; border: 4px solid var(--c); box-shadow: 0 8px 20px rgba(0,0,0,.3); padding: 6px 6px 4px;
  opacity: 0; animation: luIn .45s cubic-bezier(.2,1.4,.4,1) forwards; overflow: hidden; }
.lu.me { background: #e6fff8; }
.lu .who { display: flex; align-items: center; gap: 6px; }
.lu .face { width: 38px; height: 38px; border-radius: 50%; background: #eee6d4; object-fit: cover; flex: none; border: 3px solid var(--c); }
.lu b { font: 18px 'Fredoka One', sans-serif; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lu .car { display: block; width: 100%; aspect-ratio: 22 / 13; object-fit: contain; margin-top: 2px; }
@keyframes luIn { from { opacity: 0; transform: translateY(40px) scale(.8) rotate(-4deg); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  #minimap { top: 58px; width: 150px; height: 150px; padding: 6px; border-radius: 18px; }
  #lineup .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lu .car { aspect-ratio: 22 / 11; }
}
@media (max-height: 640px) { #minimap { width: 160px; height: 160px; } }
@media (max-height: 640px) and (max-width: 560px) { #minimap { width: 128px; height: 128px; } }

/* ── drag race button, music toggle, rating (2026-11-29) ── */
.track-btn.wide { grid-column: span 2; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 10px; }
.track-btn.wide svg { width: 120px; height: 40px; margin: 0; flex: none; }
.music-toggle { position: absolute; top: 10px; left: 12px; width: 34px; height: 34px; border-radius: 10px; border: 2px solid #e3dccb;
  background: #fff; color: var(--ink); display: grid; place-items: center; padding: 0; margin: 0 !important; box-shadow: none !important; }
.music-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.music-toggle[aria-pressed="true"] { opacity: .45; }
.music-toggle[aria-pressed="true"]::after { content: ''; position: absolute; width: 26px; height: 3px; background: var(--coral); transform: rotate(-40deg); border-radius: 2px; }
#rate-slot .k-rate { margin: 4px 0 2px !important; font-size: 13px !important; }
#rate-slot .k-rate button { min-height: 38px !important; min-width: 38px !important; }
@media (max-height: 700px) { .track-btn.wide svg { height: 30px; width: 90px; } }

/* ── drag race: rev dial and start lights (2026-11-29) ── */
#tacho { position: fixed; left: 12px; top: 58px; width: 150px; height: 150px; z-index: 5; pointer-events: none; }
#tacho svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); }
#tacho .needle { transform-origin: 50px 54px; transform-box: view-box; transition: transform .06s linear; }
#tacho b { position: absolute; left: 0; right: 0; top: 64%; text-align: center; font: 26px 'Fredoka One', sans-serif; color: #fff; }
#tacho.green svg > circle { stroke: #2ec27e; stroke-width: 5; }
#tacho.red svg > circle { stroke: #ff5a5a; stroke-width: 5; animation: redline .25s steps(2) infinite; }
@keyframes redline { 50% { stroke: #fff; } }
#count.lights { display: flex; justify-content: center; gap: 18px; top: 18%; animation: none; }
#count.lights i { width: 54px; height: 54px; border-radius: 50%; background: #2f3444; border: 5px solid #1e2433; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); }
#count.lights i.y { background: #ffcf5e; box-shadow: 0 0 28px 6px rgba(255,207,94,.8); }
#count.lights i.g { background: #2ec27e; box-shadow: 0 0 34px 8px rgba(46,194,126,.85); }
@media (max-width: 560px) { #tacho { top: 58px; width: 118px; height: 118px; } #tacho b { font-size: 21px; } #count.lights i { width: 44px; height: 44px; } }
#minimap.off { display: none !important; }

/* ── game UI kit (2026-11-29) ────────────────────────────────────────────────
   Word Rally uses the shared kit (/lib/game-ui/, docs/game-ui-kit.md) for loading, start menu,
   level screen, top bar, question card, pause menu and end screen. These are the game's own
   overrides ("a guide, not a cage"); the kit file is never edited. Told to the master session. */
/* start menu + level screen: a light scrim, the card at the side (wide) or bottom (tall), so the
   cars and the figures on the grid stay in view */
body[data-state="menu"] .kg-screen:not(.kg-screen--solid)::before { opacity: .18; }
.kg-root.wr-results .kg-screen::before { opacity: 0; }                  /* results: the podium stays bright */
@media (min-aspect-ratio: 1/1) {
  body[data-state="menu"] .kg-screen:not(.kg-screen--solid), .kg-root.wr-results .kg-screen { justify-content: flex-end; padding-right: 4vw; }
}
@media (max-aspect-ratio: 1/1) {
  body[data-state="menu"] .kg-screen:not(.kg-screen--solid), .kg-root.wr-results .kg-screen { align-items: flex-end; }
}
/* top bar middle (game slot): place + progress (+ coins once one is caught) */
.wr-mid { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wr-mid .kg-progress { min-width: 0; flex: 1 1 auto; max-width: 280px; }
.wr-place { font-family: var(--font-display); font-size: 1.15rem; }
.wr-place.up { animation: wrUp .9s ease-out; }
.wr-place.down { animation: wrDown .9s ease-out; }
@keyframes wrUp { 0%, 60% { background: var(--k-main); transform: scale(1.15); } }
@keyframes wrDown { 0%, 60% { background: var(--k-acc); color: var(--k-surface); } }
/* standings on the end screen (the kit has no slot for game lines yet) */
.wr-standings ol { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.wr-standings li { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 6px; border-radius: 12px;
  border: 2px solid var(--k-ink-22, rgba(0,0,0,.15)); font-weight: 800; font-size: .95rem; }
.wr-standings li.me { border-color: var(--k-main); }
.wr-standings .n { width: 18px; font-family: var(--font-display); }
.wr-standings .c { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.wr-standings img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.wr-standings .name { flex: 1 1 auto; text-align: left; }
.wr-standings .tm { font-variant-numeric: tabular-nums; opacity: .75; }
.wr-best { margin: 2px 0 6px; font-weight: 800; font-size: .9rem; display: flex; gap: 12px; justify-content: center; align-items: center; }
.wr-coin-line { display: inline-flex; align-items: center; gap: 4px; }
/* our own race overlays sit under the kit's top bar */
#minimap { top: 72px; }
#tacho { top: 72px; }
#banner { top: 78px; }
@media (max-width: 560px) { #minimap, #tacho { top: 66px; } #banner { top: 70px; } }
/* end screen: our standings show every racer's face, so no big head badge; a bit tighter */
.kg-root.wr-results .kg-badge--lg { display: none; }
.kg-root.wr-results .kg-card { padding-top: 14px; padding-bottom: 12px; }
.kg-root.wr-results .kg-gain { margin: 2px 0; }
/* wide but short screens (Chromebook, laptop): the end card in two columns, so it never scrolls */
@media (min-aspect-ratio: 4/3) and (max-height: 820px) {
  .kg-root.wr-results .kg-card--wide { max-width: 780px; }
  .kg-root.wr-results .kg-card--wide > .kg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
}
/* small phones: a tighter end card (the kit lets it scroll when it still doesn't fit) */
@media (max-height: 700px) and (max-aspect-ratio: 1/1) {
  .wr-standings li { padding: 0 8px 0 4px; font-size: .85rem; }
  .wr-standings img { width: 20px; height: 20px; }
  .kg-root.wr-results .kg-stats { margin: 4px 0; }
}
/* ── phone review 2026-11-30 (docs/phone-review-2026-11-30.md, Word Rally) ──
   Phones play upright: the kit covers a sideways phone, so there is no landscape-phone layout. */
/* top bar: at most 4 pills on phones (menu, place, progress, shells); coins and time are on the results */
@media (max-width: 420px) { .kg-hud [data-k="time"], .kg-hud .wr-coins { display: none !important; } }
@media (max-width: 340px) { .wr-place { font-size: 1rem; padding-left: 8px; padding-right: 8px; } .wr-mid { gap: 6px; } }
/* "+N shells" floats above the card, not over its caption */
.kg-q .kg-pop { top: -54px; }
/* narrow phones: the verb chain stays on one line; the answer replaces the chips */
@media (max-width: 360px) {
  .kg-q .kg-q-text { font-size: 1.35rem; }
  .kg-q .kg-blank { min-width: 2.4em; }
  .kg-q:has(.kg-fb) .kg-choices { display: none; }
}
/* end screen buttons never wrap */
.kg-root.wr-results .kg-actions .kg-btn { white-space: nowrap; }
@media (max-width: 380px) { .kg-root.wr-results .kg-actions .kg-btn { font-size: 1rem; padding-left: 12px; padding-right: 12px; } }
/* short upright frames: a compact end card (standings in two columns, no faces, 2 missed items) */
@media (max-height: 640px) and (max-aspect-ratio: 1/1) {
  .kg-root.wr-results .kg-title { font-size: 1.5rem; margin-bottom: 0; }
  .kg-root.wr-results .kg-stats { display: none; }
  .wr-standings ol { grid-template-columns: 1fr 1fr; gap: 3px 6px; }
  .wr-standings li { font-size: .8rem; gap: 4px; padding: 0 6px 0 4px; }
  .wr-standings img { display: none; }
  .wr-best { margin: 0 0 4px; font-size: .82rem; }
  .kg-root.wr-results .kg-missed-list li:nth-child(n+3) { display: none; }
  .kg-root.wr-results .kg-missed { margin: 4px 0; }
}
/* line-up on upright phones: the minimap waits for the race (it hid the figures) */
@media (max-aspect-ratio: 1/1) { body[data-state="count"] #minimap { visibility: hidden; } }
/* short upright frames: the driver cards as one row of faces, so the figures on the grid show */
@media (max-height: 700px) and (max-aspect-ratio: 1/1) {
  #lineup .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  #lineup h2 { font-size: 18px; margin-bottom: 4px; }
  .lu { padding: 4px 2px 3px; border-width: 3px; }
  .lu .who { flex-direction: column; gap: 2px; }
  .lu .face { width: 34px; height: 34px; }
  .lu b { font-size: 14px; max-width: 100%; }
  .lu .car { display: none; }
}
/* very short frames (a 320×568 phone's game frame): a smaller shell line and buttons, so the rating fits */
@media (max-height: 520px) and (max-aspect-ratio: 1/1) {
  .kg-root.wr-results .kg-gain { font-size: 1.6rem; margin: 0; }
  .kg-root.wr-results .kg-gain .kg-ico { width: 32px; height: 32px; }
  .kg-root.wr-results .kg-missed-h { margin: 2px 0; }
  .kg-root.wr-results .kg-missed-list li:nth-child(n+2) { display: none; }
  .kg-root.wr-results .kg-actions .kg-btn { min-height: 46px; padding-top: 4px; padding-bottom: 4px; }
  .kg-root.wr-results .kg-actions { gap: 8px; margin-top: 8px; }
}
