/* Otter Race: a bright, friendly board game look. Colours come from the theme pack (client/theme.ts
   sets the --variables); shapes, icons and labels carry meaning, never colour alone. */
:root {
  --ground: #a6d97f; --ground-alt: #8fcb69; --road: #5d6178; --road-edge: #3d4057; --road-line: #ffe28a;
  --space: #fffaf0; --space-text: #2b2340; --space-edge: #3d4057; --text: #2b2340; --muted: #5a5270;
  --surface: #fffaf0; --surface-alt: #fff0d4; --accent: #ff8a3d; --accent-text: #2b2340; --border: #e6d6b6;
  --express: #17915f; --setback: #d9452f; --good: #17915f; --sky-top: #8fd3ff; --sky-bottom: #e2f5ff;
  --outline: #2b2340; --radius: 18px; --shadow: 0 6px 0 rgba(43, 35, 64, .14), 0 14px 30px rgba(43, 35, 64, .12);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, sans-serif;
  --fs: 16px; --tap: 48px;
  color-scheme: light;
}
:root[data-mode="dark"] { color-scheme: dark; --outline: #0e0b1c; }
:root[data-large-text] { --fs: 19px; --tap: 54px; }
:root[data-high-contrast] { --shadow: 0 0 0 2px var(--text); }
:root[data-high-contrast] .card, :root[data-high-contrast] .btn { border-width: 3px; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: var(--fs); line-height: 1.45; color: var(--text);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom) 60%, var(--sky-bottom)) fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9em; font-weight: 900; }
h2 { font-size: 1.3em; font-weight: 850; }
h3 { font-size: 1.05em; font-weight: 800; }
p { margin: .3em 0 .7em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
small { font-size: .82em; }
code { background: var(--surface-alt); padding: .1em .4em; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.art { display: inline-flex; line-height: 0; flex: none; }
.art svg { display: block; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
:root[data-high-contrast] :focus-visible { outline: 4px solid var(--text); box-shadow: 0 0 0 7px var(--accent); }

/* ---------- buttons, cards, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap); padding: 10px 18px;
  font: inherit; font-weight: 800; color: var(--text); background: var(--surface); border: 2.5px solid var(--outline);
  border-radius: 16px; box-shadow: 0 4px 0 var(--outline); cursor: pointer; text-decoration: none; text-align: left;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: var(--surface-alt); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--outline); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { min-height: 64px; font-size: 1.1em; padding: 12px 22px; }
.btn.big small { display: block; font-weight: 600; opacity: .85; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9em; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.danger { background: var(--setback); color: #fff; }
.link { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 4px; text-align: left; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.4em; font-weight: 800;
}
.icon-btn:hover { border-color: var(--outline); }
.card { background: var(--surface); border: 2.5px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 2px solid var(--border); font-weight: 750; font-size: .88em; color: var(--text); font-family: inherit; white-space: nowrap; }
button.chip { cursor: pointer; }
.chip.warn { border-color: var(--setback); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface-alt); color: var(--text); font: inherit; font-weight: 750; cursor: pointer; }
.chip-btn.bot { background: var(--surface); border-style: dashed; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .75em; font-weight: 800; padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface-alt); }
.tag.good { border-color: var(--good); }
.tag.bad { border-color: var(--setback); }
.note { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.note.bad { color: var(--setback); }
.spinner { display: inline-block; width: 22px; height: 22px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; gap: 12px; align-items: center; justify-content: center; min-height: 60vh; font-weight: 800; font-size: 1.2em; }
.pantry-only { max-width: 560px; margin: 0 auto; padding: 28px 20px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.pantry-only .wordmark svg { max-width: 86vw; height: auto; }
.pantry-only h2 { margin: 6px 0 0; }
.btn.ghost-outline { background: transparent; box-shadow: none; border-color: var(--border); border-radius: 999px; justify-content: center; text-align: center; }
.btn.block { width: 100%; }
.center-page { max-width: 560px; margin: 10vh auto; padding: 24px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-top: 10px; min-height: 40px; cursor: pointer; }
.switch input, .set-row input[type=checkbox], .field input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--accent); }
input[type=text], input[type=number], select {
  font: inherit; color: var(--text); background: var(--space); border: 2px solid var(--border); border-radius: 12px; min-height: 44px; padding: 6px 10px; max-width: 100%;
}
input:focus, select:focus { border-color: var(--outline); }

/* ---------- toasts, dialogs, captions ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; background: var(--surface); color: var(--text); border: 2.5px solid var(--outline); border-radius: 14px; padding: 10px 14px; font-weight: 700; box-shadow: var(--shadow); animation: pop .25s ease-out; }
.toast.bad { border-color: var(--setback); }
.toast.good { border-color: var(--good); }
.toast.out { opacity: 0; transition: opacity .5s; }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(20, 14, 40, .45); display: grid; place-items: center; padding: 14px; }
.dialog { background: var(--surface); color: var(--text); border: 3px solid var(--outline); border-radius: 22px; width: min(100%, 480px); max-height: 92dvh; display: flex; flex-direction: column; box-shadow: 0 10px 0 var(--outline); animation: pop .2s ease-out; }
.dialog.wide { width: min(100%, 760px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 6px 20px; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 6px 20px 18px; overflow: auto; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 2px solid var(--border); flex-wrap: wrap; }
.caption { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 40; background: #14102a; color: #fff; padding: 6px 14px; border-radius: 10px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; display: none; }
:root[data-captions] .caption { display: block; }
.caption.on { opacity: .92; }
.conn-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; display: flex; gap: 8px; justify-content: center; align-items: center; background: #ffd34d; color: #2b2340; font-weight: 800; padding: 8px; }

/* ---------- home ---------- */
.home { max-width: 1040px; margin: 0 auto; padding: 18px 16px 40px; }
.hero { text-align: center; padding: 20px 0 6px; }
.hero-brand { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-brand .wordmark svg { max-width: 82vw; height: auto; }
.tagline { font-size: 1.15em; font-weight: 750; margin: 8px auto 4px; max-width: 34em; }
.road-strip { position: relative; height: 96px; margin: 8px auto 18px; border-radius: 48px; background: var(--road); border: 6px solid var(--road-edge); overflow: hidden; max-width: 760px; }
.road-strip::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 5px dashed var(--road-line); opacity: .8; }
.parade { position: absolute; inset: 0; display: flex; gap: 46px; align-items: center; padding-left: 20px; z-index: 1; animation: parade 18s linear infinite; }
@keyframes parade { from { transform: translateX(-30%); } to { transform: translateX(60%); } }
.parade-car { filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25)); animation: bob 0.6s ease-in-out infinite alternate; }
.parade-car:nth-child(2n) { animation-delay: .3s; }
@keyframes bob { to { transform: translateY(-4px); } }
.home-actions { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin-bottom: 20px; }
.home-actions .btn { justify-content: flex-start; }
.resume, .note-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.resume > div, .note-card > div { flex: 1; min-width: 180px; }
.home-foot { text-align: center; }
.mode-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.mode-card { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 16px; border: 2.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-height: var(--tap); }
.mode-card:hover { border-color: var(--outline); }
.mode-card.selected { border-color: var(--outline); background: var(--surface-alt); box-shadow: 0 4px 0 var(--outline); }
.mode-text { display: grid; gap: 2px; }
.mode-desc { margin-top: 12px; font-weight: 600; }
.theme-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.theme-card { display: grid; gap: 8px; padding: 0 0 12px; border-radius: 16px; border: 2.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; text-align: left; }
.theme-card.selected { border-color: var(--outline); box-shadow: 0 4px 0 var(--outline); }
.theme-pic svg { width: 100%; height: auto; }
.theme-text { display: grid; gap: 4px; padding: 0 12px; }
.pack-rule { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; }

/* ---------- setup ---------- */
.setup { max-width: 980px; margin: 0 auto; padding: 12px 14px 120px; }
.setup-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.setup-top h1 { margin: 0; }
.players { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.player-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px; border-radius: 14px; background: var(--surface-alt); }
.player-row .name { flex: 1; min-width: 120px; }
.otter-pick { border: 2px solid var(--border); border-radius: 14px; background: var(--space); padding: 2px; cursor: pointer; }
.otter-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.otter-grid.small { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.otter-card, .veh-card { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 2.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.otter-card.selected, .veh-card.selected { border-color: var(--outline); background: var(--surface-alt); box-shadow: 0 3px 0 var(--outline); }
.vehicle-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin-top: 10px; }
.vehicle-grid.small .veh-card { min-height: 44px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.field { display: grid; gap: 4px; align-content: start; }
.field label { font-weight: 800; }
.field.locked { opacity: .6; }
.seed-row { display: flex; gap: 6px; }
.seed-row input { flex: 1; min-width: 0; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 800; min-height: 40px; display: flex; align-items: center; }
.wx-presets { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); margin-bottom: 10px; }
.wx-btn { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 2.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 750; cursor: pointer; min-height: var(--tap); }
.wx-btn.selected { border-color: var(--outline); background: var(--surface-alt); box-shadow: 0 3px 0 var(--outline); }
.wx-btn[disabled] { opacity: .45; cursor: not-allowed; }
.live-box { display: grid; gap: 8px; margin: 10px 0; }
.live-box input { flex: 1; min-width: 180px; }
.wx-result { display: flex; gap: 12px; align-items: flex-start; }
.attribution { font-weight: 700; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1.5px solid var(--border); font-weight: 700; }
.start-bar { position: sticky; bottom: 0; display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; padding: 12px; background: var(--surface); border: 2.5px solid var(--outline); border-radius: 20px; box-shadow: var(--shadow); z-index: 5; }

/* ---------- race screen ---------- */
.race-screen { display: flex; flex-direction: column; height: 100dvh; }
.race-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-bottom: 2.5px solid var(--border); flex-wrap: wrap; }
.race-title { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.1em; }
.chips { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.menu-row { display: flex; gap: 6px; }
.menu-row .icon-btn { width: 44px; height: 44px; }
.race-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(300px, 380px); }
.board-scroll { overflow: auto; min-height: 0; padding: 10px; overscroll-behavior: contain; container-type: size; }
.board-wrap { position: relative; margin: 0 auto; }
.board-scroll:has(.board-wrap[data-orientation="cols"]) { display: grid; align-content: center; }
.board-wrap[data-orientation="cols"] { width: min(100%, calc((100cqh - 4px) * var(--aspect))); }
.board-wrap[data-orientation="rows"] { max-width: 760px; }
.board { display: block; width: 100%; height: auto; border-radius: 26px; box-shadow: 0 8px 0 rgba(0, 0, 0, .12); }
.board .num { font: 900 30px var(--font); pointer-events: none; }
.board .end-label { font-size: 26px; }
.board .badge-text { font: 900 26px var(--font); }
.board .badge-text.small { font-size: 20px; }
.board .lane-label { font: 900 20px var(--font); }
.board .space, .board .sign { cursor: pointer; }
.board .space:hover circle { stroke-width: 7; }
.board .lane.open { stroke-dasharray: 26 12; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -38; } }
.board .changing { animation: glowpulse 1.4s ease-in-out infinite; }
@keyframes glowpulse { 50% { opacity: .1; } }
.board .pulse { animation: glowpulse .8s ease-in-out infinite; }
.board .token { transition: none; }
.board .token.active > svg { filter: drop-shadow(0 0 10px var(--accent)); }
.board .token.shake > svg { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.board .trail { fill: none; stroke-width: 26; stroke-linecap: round; opacity: .55; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: trail 1s ease-out forwards; }
.board .trail.express { stroke: var(--express); }
.board .trail.setback { stroke: var(--setback); }
@keyframes trail { 60% { stroke-dashoffset: 0; opacity: .6; } to { stroke-dashoffset: 0; opacity: 0; } }
.board .spark { animation: spark 1.1s ease-out forwards; transform-box: fill-box; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(260deg); opacity: 0; } }
:root[data-reduced-motion] .board *, :root[data-reduced-motion] .parade, :root[data-reduced-motion] .parade-car { animation: none !important; }

/* weather and ambient overlays: decorative, never covering what matters */
.board-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 26px; }
.board-overlay.wx-cloudy, .board-overlay.wx-foggy { background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 40%); }
.board-overlay.wx-foggy::before { content: ""; position: absolute; inset: -10%; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .22) 0 120px, transparent 120px 300px); animation: drift 30s linear infinite; opacity: .6; }
.board-overlay.wx-sunny::before { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 140, .55), transparent 70%); }
@keyframes drift { to { transform: translateX(300px); } }
.board-overlay b { position: absolute; top: -20px; display: block; }
.board-overlay.wx-rainy b, .board-overlay.wx-mixed b { width: 2px; height: 18px; background: rgba(80, 140, 220, .55); animation: fall 0.9s linear infinite; }
.board-overlay.wx-snowy b { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .9); animation: fall 6s linear infinite; }
.board-overlay.wx-windy b { width: 70px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .6); top: 30%; animation: gust 3s linear infinite; }
@keyframes fall { to { transform: translateY(110vh); } }
@keyframes gust { from { transform: translateX(-120px); } to { transform: translateX(110vw); } }
.board-overlay i { position: absolute; top: -20px; display: block; width: 10px; height: 10px; animation: float 12s linear infinite; opacity: .85; }
.amb-snow i { border-radius: 50%; background: #fff; }
.amb-leaves i { background: #e0702b; border-radius: 0 10px; }
.amb-petals i { background: #ff9fc6; border-radius: 10px 0; }
.amb-bubbles i { border: 2px solid rgba(255, 255, 255, .8); border-radius: 50%; animation-name: rise; top: auto; bottom: -20px; }
.amb-bats i { width: 16px; height: 6px; background: #2c2640; border-radius: 50% 50% 0 0; }
.amb-fireflies i, .amb-sparkles i { width: 6px; height: 6px; border-radius: 50%; background: #ffe680; box-shadow: 0 0 8px #ffe680; }
@keyframes float { to { transform: translate(60px, 110vh) rotate(360deg); } }
@keyframes rise { to { transform: translate(-30px, -110vh); } }

.race-side { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; border-left: 2.5px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.turn-panel { background: var(--surface); border: 3px solid var(--outline); border-radius: 20px; padding: 14px; box-shadow: 0 5px 0 var(--outline); display: grid; gap: 10px; position: relative; }
.turn-panel .die { position: absolute; right: 12px; top: 12px; display: flex; gap: 4px; }
.die.rolling .die-face { animation: tumble .18s linear infinite; }
.die.landed .die-face { animation: land .35s ease-out; }
@keyframes tumble { 50% { transform: rotate(18deg) scale(.92); } }
@keyframes land { 40% { transform: scale(1.2); } }
.turn-head { display: flex; gap: 10px; align-items: center; padding-right: 76px; }
.turn-title { font-size: 1.3em; font-weight: 900; margin: 0; }
.btn.roll { font-size: 1.4em; min-height: 70px; }
.timer-bar { height: 8px; width: 150px; max-width: 100%; border-radius: 4px; background: var(--surface-alt); overflow: hidden; margin-top: 4px; }
.timer-bar i { display: block; height: 100%; background: var(--express); transition: width .25s linear; }
.timer-bar.low i { background: var(--setback); }
.tokens-row { display: grid; gap: 8px; }
.token-btn { display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px 10px; border-radius: 14px; border: 2.5px solid var(--border); background: var(--surface-alt); color: var(--text); font: inherit; cursor: pointer; min-height: var(--tap); }
.token-btn span { display: grid; }
.token-btn.on { border-color: var(--outline); background: var(--accent); color: var(--accent-text); }
.token-btn.passive { cursor: default; }
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.steps-row .btn { padding: 6px; font-size: .9em; text-align: center; }
.fork-choice { display: grid; gap: 8px; }
.btn.fork { justify-content: flex-start; }
.btn.fork span { display: grid; }
.btn.fork.short { border-style: dashed; }
.waiting { display: flex; gap: 12px; align-items: center; padding-right: 70px; }
.wait-title { font-weight: 850; margin: 0; }
.small-head { font-size: .95em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 6px; }
.stand-list, .feed, .result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stand { display: grid; grid-template-columns: 22px auto 1fr; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); }
.stand.acting { border-color: var(--outline); box-shadow: 0 3px 0 var(--outline); }
.stand.mine { background: var(--surface-alt); }
.stand .rank { font-weight: 900; text-align: center; }
.stand .who { display: grid; min-width: 0; }
.stand .name { font-weight: 850; display: flex; gap: 5px; align-items: center; }
.stand .where, .stand .team-names { font-size: .82em; color: var(--muted); }
.stand .extras { grid-column: 2 / -1; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.stand .extras:empty { display: none; }
.stand .pts { font-weight: 900; margin-left: auto; }
.feed-item { display: flex; gap: 8px; align-items: flex-start; font-size: .9em; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.feed-item:first-child { font-weight: 800; }
.feed-item .dot { width: 24px; flex: none; }

/* ---------- results ---------- */
.results { position: fixed; inset: 0; z-index: 30; overflow: auto; padding: 24px 16px 40px; text-align: center; background: color-mix(in srgb, var(--surface) 94%, transparent); display: grid; align-content: start; justify-items: center; gap: 12px; }
.results h1 { max-width: 20em; }
.podium { display: flex; gap: 10px; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.podium .step { display: grid; justify-items: center; padding: 10px 12px; border-radius: 18px 18px 8px 8px; background: var(--surface-alt); border: 2.5px solid var(--outline); min-width: 110px; }
.podium .s1 { order: 2; padding-bottom: 34px; background: var(--accent); color: var(--accent-text); }
.podium .s2 { order: 1; padding-bottom: 20px; }
.podium .s3 { order: 3; }
.podium .pname { font-weight: 900; margin: 4px 0 0; }
.podium .place { margin: 0; font-weight: 800; }
.titles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); width: min(100%, 760px); }
.title-card { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border); }
.title-card p { margin: 0; font-weight: 700; }
.result-list { width: min(100%, 460px); }
.result-list li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--surface); border: 2px solid var(--border); text-align: left; }
.result-list .name { flex: 1; font-weight: 800; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: float 5s linear infinite; }

/* ---------- dialogs content ---------- */
.rule-lines { padding-left: 1.3em; display: grid; gap: 6px; }
.legend { list-style: none; padding: 0; display: grid; gap: 8px; }
.legend li { display: flex; gap: 10px; align-items: center; }
.board-list { padding-left: 2.2em; columns: 2 260px; font-size: .9em; }
.board-list li { break-inside: avoid; }
.board-list li.has { font-weight: 800; }
.settings { display: grid; }
.reactions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.btn.react { justify-content: flex-start; }
.host-controls { display: grid; gap: 10px; }
.weather-box .wx-head { display: flex; gap: 12px; align-items: center; }
.weather-box .big { font-size: 1.2em; font-weight: 900; margin: 0; }
.periods { padding-left: 1.2em; }
.tutorial { text-align: center; }
.tut-art { min-height: 140px; display: grid; place-items: center; }
.tut-row { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tut-text { font-size: 1.05em; font-weight: 600; min-height: 4.5em; }
.tut-dots { display: flex; gap: 6px; justify-content: center; }
.tut-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.tut-dots i.on { background: var(--accent); outline: 2px solid var(--outline); }

/* ---------- online ready screen ---------- */
.ready { max-width: 1100px; margin: 0 auto; padding: 14px; }
.ready-top { display: flex; gap: 12px; align-items: center; }
.ready-top h1 { margin: 0; }
.countdown { font-size: 1.3em; font-weight: 900; text-align: center; }
.ready-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.seats { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.seat { display: flex; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 14px; background: var(--surface-alt); }
.seat.away { opacity: .6; }
.seat.mine { outline: 3px solid var(--accent); }
.teams { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.host-row { justify-content: center; margin: 16px 0; }

/* ---------- phones ---------- */
@media (max-width: 820px) {
  .race-main { display: flex; flex-direction: column; }
  .board-scroll { flex: 1; padding: 6px; }
  .race-side { border-left: 0; border-top: 2.5px solid var(--border); max-height: 42dvh; flex: none; padding: 8px; }
  .race-side .standings .where { display: none; }
  .race-side .feed-box { display: none; }
  .turn-panel { padding: 10px; }
  .chips { order: 3; flex-basis: 100%; }
  .race-title { flex: 1; font-size: 1em; }
  .stand { padding: 4px 6px; }
  h1 { font-size: 1.6em; }
}
@media (max-width: 420px) {
  .start-bar { flex-wrap: nowrap; padding: 8px; }
  .start-bar .btn.ghost { padding: 6px; font-size: .85em; }
  .menu-row .icon-btn { width: 40px; height: 40px; }
  .btn.big { min-height: 58px; padding: 10px 14px; }
  .card { padding: 14px; }
}

/* ---------- the TV ---------- */
body[data-view="tv"] { --fs: 22px; }
.race-screen.tv .race-main { grid-template-columns: 1fr 460px; }
.race-screen.tv .board-scroll { overflow: hidden; }
.race-screen.tv .tv-die { display: flex; justify-content: center; min-height: 128px; }
.race-screen.tv .tv-die .die { position: static; display: flex; gap: 10px; }
.race-screen.tv .turn-panel { box-shadow: none; }
.ready.tv { font-size: 1.2em; }
