:root {
  --bg: #020308;
  --ground: #0b0f1c;
  --surface: #0c1120;
  --surface-2: #10172b;
  --border: rgba(200, 215, 255, .09);
  --border-strong: rgba(200, 215, 255, .18);
  --text: #e1e6f2;
  --soft: #9babd4;
  --muted: #67759a;
  --accent: #3d6ef0;
  --accent-hover: #5582ff;
  --on-accent: #fff;
  --sand: #ffc857;
  --sage: #45d3a0;
  --clay: #ff7b61;
  --dusk: #8f7cff;
  --slate: #7f93b8;
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.2, 1.4, .4, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); overscroll-behavior: none; }
body { margin: 0; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; overflow-x: clip; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.ground { position: fixed; inset: 0; z-index: -2; pointer-events: none; background: radial-gradient(120% 70% at 50% 110%, #070b18 0%, var(--bg) 60%); }
.backdrop { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .5s ease; }
.backdrop.show { opacity: 1; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); font-weight: 500; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 10px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px var(--font); border-radius: 10px; padding: 12px 20px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s var(--ease-out); }
.btn:hover:not(:disabled) { border-color: rgba(200, 215, 255, .32); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.accent:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--soft); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border); }
.btn.full { width: 100%; }

.blob { display: inline-block; width: 64px; height: 64px; position: relative; flex: none; }
.blob svg { width: 100%; height: 100%; display: block; overflow: visible; --mo-track-travel: 3px; }
.blob-zzz { display: none; }
.blob.pop { animation: blob-pop 520ms var(--ease-spring); }
@keyframes blob-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12, .92); } 100% { transform: none; } }

.screen { display: none; min-height: 100vh; min-height: 100svh; padding: 24px; }
.screen.active { display: flex; align-items: center; justify-content: center; animation: screen-in 380ms var(--ease-out); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.start-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 780px; }
.mark { position: relative; margin: 40px 0 0; font-family: var(--display); font-weight: 700; font-size: clamp(56px, 13vw, 104px); line-height: 1; letter-spacing: -.02em; color: var(--text); user-select: none; }
.mark-word { position: relative; z-index: 1; }
.mark-letter { position: relative; display: inline-block; isolation: isolate; }
.mark-peek { position: absolute; z-index: -1; width: .4em; height: .4em; animation: peek-in 700ms var(--ease-spring) both; }
.mark-peek .blob { display: block; width: 100%; height: 100%; }
.mark-peek.hole { left: .185em; top: .19em; width: .25em; height: .25em; }
.mark-peek.over-left { left: -.14em; top: -.06em; rotate: -16deg; }
.mark-peek.over-o { left: .08em; top: .08em; width: .34em; height: .34em; }
.mark-peek.over { left: .05em; top: -.12em; rotate: 6deg; }
.mark-peek.side { left: .09em; top: .3em; width: .36em; height: .36em; rotate: 10deg; }
@keyframes peek-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mark-rise { from { transform: translateY(80%); opacity: 0; } to { transform: none; opacity: 1; } }
.tagline { margin: 0 0 14px; color: var(--soft); font-size: 15px; }

.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; }
.panel h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; font-size: 15px; font-weight: 700; }
.panel h2 .icon { width: 17px; height: 17px; color: var(--muted); }
.panel-section h3 { display: flex; align-items: center; gap: 9px; }
.panel-section h3 .icon { width: 17px; height: 17px; color: var(--muted); }
.panel-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-strong); }
.play-panel .panel-section { margin-top: auto; }
.play-panel > .btn { margin-bottom: 22px; }
.play-panel > .hint { margin-bottom: 20px; }

.me { display: flex; align-items: center; gap: 20px; flex: 1; }
.me-blob { width: clamp(96px, 12vw, 124px); height: auto; aspect-ratio: 1; }
.name-line { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; font-size: 1.34rem; }
.name-field { position: relative; display: inline-block; width: 7ch; max-width: 100%; font-weight: 700; padding-bottom: 2px; border-bottom: 1px dashed var(--border-strong); transition: width .26s var(--ease-out), border-color .2s; }
.name-field:focus-within { border-bottom-style: solid; border-bottom-color: var(--text); }
.name-mirror, .name-field input { padding: 0 6px; font: inherit; font-weight: 700; white-space: pre; }
.name-mirror { position: absolute; top: 0; left: 0; visibility: hidden; pointer-events: none; }
.name-field input { display: block; width: 100%; min-width: 0; appearance: none; border: 0; outline: 0; background: transparent; color: var(--text); }
.name-field input::placeholder { color: var(--muted); opacity: .6; }

.c-clay { --seat: var(--clay); }
.c-sage { --seat: var(--sage); }
.c-dusk { --seat: var(--dusk); }
.c-sand { --seat: var(--sand); }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: .3; cursor: default; }

.setup-panel { width: 100%; max-width: 480px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.seat-list { display: flex; flex-direction: column; gap: 8px; }
.seat { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 10px 8px 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit; text-align: left; }
.seat-avatar { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--seat, #7f8db0) 24%, #0a0f1d); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--seat, #7f8db0) 55%, transparent); }
.seat-avatar .seat-blob { width: 36px; height: 36px; }
.seat.empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--muted); }
.seat.empty .seat-avatar { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); color: var(--muted); }
.seat.empty .seat-name { font-weight: 600; }
.seat.add { cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.seat.add .seat-name { color: var(--soft); font-weight: 700; }
.seat.add .seat-avatar { color: #c9d6ff; box-shadow: inset 0 0 0 1.5px #5b7cfa; background: rgba(61, 110, 240, .12); }
.seat.add:hover { border-color: #5b7cfa; background: rgba(61, 110, 240, .08); }
.seat.add:hover .seat-name { color: var(--text); }
.seat-cpu { margin-left: auto; margin-right: 6px; color: var(--muted); display: grid; }
.seat.add:active { transform: scale(.985); }
.seat-blob { width: 40px; height: 40px; }
.seat-name { flex: 1; min-width: 0; height: 36px; border: 0; border-bottom: 1px dashed var(--border-strong); background: transparent; outline: none; font-weight: 700; font-size: 16px; padding: 0 4px; }
.seat-name:focus { border-bottom-style: solid; border-bottom-color: var(--text); }
.kind-btn { display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; width: 118px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--soft); font: 600 12px var(--font); cursor: pointer; flex: none; white-space: nowrap; }
.kind-btn .icon { width: 15px; height: 15px; }
.kind-btn.bot { color: #c9d6ff; border-color: #5b7cfa; }
.kind-btn:hover { color: var(--text); }
.lane-tag { padding: 2px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); font: 700 11px var(--font); }
.seat-tag { width: 36px; text-align: center; color: var(--muted); font-size: 12px; flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.seg button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--soft); cursor: pointer; font-weight: 700; }
.seg button small { font-weight: 500; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.panel-section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.join-row { display: flex; gap: 4px; margin-top: 10px; padding: 4px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px; }
.join-row:focus-within { border-color: var(--accent); }
.code-input { flex: 1; width: 0; min-width: 0; background: transparent; border: 0; padding: 0 10px; font: 600 16px var(--font); outline: none; text-transform: lowercase; }
.join-row .btn.small { min-width: 104px; }
.err { margin: 10px 0 0; color: #ffa891; font-size: 13px; line-height: 1.4; }
.name-fix { margin-top: 8px; }
.corner { position: fixed; top: max(16px, env(safe-area-inset-top)); right: 18px; display: flex; gap: 8px; align-items: center; z-index: 30; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button { padding: 6px 10px; border-radius: 7px; font: 700 12px var(--font); color: var(--muted); border: 1px solid var(--border); background: transparent; cursor: pointer; }
.lang-switch button.on { color: #04060d; background: var(--text); border-color: var(--text); }
body[data-screen="board"] .corner, body[data-screen="mini"] .corner { display: none; }
.rejoin-panel { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 25; flex-direction: row; align-items: center; gap: 18px; width: max-content; max-width: calc(100% - 32px); padding: 12px 14px 12px 18px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); transition: opacity .3s var(--ease-out), transform .42s var(--ease-spring); }
.rejoin-panel[hidden] { display: none; }
.rejoin-panel.out { opacity: 0; transform: translate(-50%, calc(100% + 32px)); transition: opacity .3s var(--ease-out), transform .36s var(--ease-out); pointer-events: none; }
.panel.rejoin-panel { padding: 12px 14px 12px 18px; border-radius: 16px; }
.panel.rejoin-panel h2 { margin: 0; white-space: nowrap; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.rejoin-panel .btn { font-size: 14px; }
.rejoin-panel code { font: 700 14px ui-monospace, monospace; letter-spacing: .04em; color: #ffb48c; background: rgba(255, 180, 140, .08); border: 1px solid rgba(255, 180, 140, .3); border-radius: 7px; padding: 3px 8px; }
.rejoin-actions { display: flex; gap: 8px; }
.rejoin-actions .btn { padding: 9px 14px; }
.invite code { font: 700 15px var(--font); color: #ffb48c; }
.lobby-panel { width: 100%; max-width: 1060px; padding: 0; display: grid; grid-template-columns: 370px minmax(0, 1fr); overflow: hidden; }
.panel.lobby-panel { padding: 0; }
.lobby-side .kind-btn { width: auto; padding: 0 10px; flex: none; }
.lobby-side { display: flex; flex-direction: column; gap: 10px; padding: 26px 22px 22px; border-right: 1px solid var(--border); background: rgba(0, 0, 0, .18); }
.lobby-side h2, .lobby-head h2 { margin: 0 0 6px; display: flex; align-items: baseline; gap: 8px; }
.lobby-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.lobby-foot { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.lobby-foot .invite { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; border-style: dashed; }
.lobby-foot .invite-code { justify-content: center; }
.lobby-main { display: flex; flex-direction: column; gap: 14px; padding: 26px 28px 22px; min-width: 0; }
.lobby-head { display: flex; flex-direction: column; gap: 2px; }
.lobby-head .hint { margin: 0; }
.board-cards { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.board-cards button { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 14px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .15s var(--ease-out); }
.board-cards button:hover:not(:disabled):not(.on) { border-color: rgba(200, 215, 255, .32); }
.board-cards button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 10px 30px rgba(61, 110, 240, .18); background: #0f1a3e; }
.board-cards button:disabled { cursor: default; }
.board-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px; }
.board-label strong { font: 700 20px var(--display); }
.board-label small { color: var(--soft); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-mini { flex: 1; display: grid; place-items: center; border-radius: 12px; background: #070b16; padding: 10px; }
.board-mini canvas { display: block; width: 100%; height: auto; border-radius: 8px; }
.mini-island { fill: #10182e; stroke: #1b2747; stroke-width: 6; }
.mini-trail { fill: none; stroke: #1f2c50; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; }
.mini-dot { stroke: rgba(0, 0, 0, .35); stroke-width: 3; }
.mini-dot.plain { fill: #2a3a66; }
.mini-peak { fill: #c9d6ff; opacity: .55; }
.board-cards button:not(.on) .board-mini canvas { opacity: .7; }
.lobby-sub { margin: 6px 0 0; display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.game-tile { display: flex; align-items: flex-end; min-height: 58px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.lobby-actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 4px; }
.lobby-actions .hint { margin: 0; }
.lobby-actions .btn { min-width: 200px; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-strong); }
.invite-code { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.invite code { font-size: 22px; letter-spacing: .02em; }
#copyLink { min-width: 150px; }
#inviteHint { margin: 8px 0 14px; }
.seat-badge { padding: 2px 8px; border-radius: 7px; font: 700 11px var(--font); color: var(--muted); border: 1px solid var(--border-strong); flex: none; }
.seat-badge.host { color: #ffe3a3; border-color: #b8613f; display: inline-flex; align-items: center; gap: 4px; }
.seat-badge.host .icon { width: 12px; height: 12px; }
.seat-name.static { border-bottom: 0; display: flex; align-items: center; }
.seat.away .seat-blob { opacity: .45; }
.setup-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.setup-actions .btn.ghost { padding-left: 0; }
.setup-actions .btn.accent { min-width: 168px; }

.board-screen.active { flex-direction: column; align-items: stretch; justify-content: flex-start; height: 100vh; height: 100svh; padding: 12px 16px 0; gap: 10px; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 760px; width: 100%; margin: 0 auto; }
.hud-top { display: flex; align-items: center; gap: 6px; order: 2; }
.hud .standings { order: 1; }
.volume { --level: 80%; width: 120px; min-width: 0; height: 28px; margin: 0; background: none; cursor: pointer; appearance: none; -webkit-appearance: none; }
.volume:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.volume::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--level), rgba(200, 215, 255, .16) var(--level)); }
.volume::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--level), rgba(200, 215, 255, .16) var(--level)); }
.volume::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -5px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); -webkit-appearance: none; appearance: none; }
.volume::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.standings { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 4px; border-radius: 17px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.chip.on { border-color: var(--seat); box-shadow: inset 0 0 0 1px var(--seat); }
.chip-blob { width: 26px; height: 26px; }
.chip-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-pos { min-width: 2ch; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-pos.bump { display: inline-block; animation: pos-bump 420ms var(--ease-spring); }
@keyframes pos-bump { 0% { transform: scale(1.4); color: var(--text); } 100% { transform: none; } }

.board-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board { position: relative; width: 100%; }
.board-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail-under { fill: none; stroke: #080c15; stroke-width: 34; stroke-linecap: round; stroke-linejoin: round; }
.trail { fill: none; stroke: #17203b; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 12; }
.island-shore { fill: none; stroke: #11182c; stroke-width: 10; stroke-linejoin: round; }
.island { fill: #0b0f1c; }
.terrace { fill: #0b0f1c; stroke: #10172b; stroke-width: 1.5; }
.terrace.t1 { fill: #0b101e; }
.terrace.t2 { fill: #0c1120; }
.terrace.t3 { fill: #0d1221; }
.terrace.t4 { fill: #0d1323; }
.terrace.t5 { fill: #0e1425; }
.summit path { stroke-linejoin: round; }
.mt-back { fill: #141e38; }
.mt-shade { fill: #1d2a4c; }
.mt-lit { fill: #2c3f6b; }
.mt-snow { fill: #e6eeff; }
.mt-snow-shade { fill: #9fb0d8; }
.mt-snow-dim { fill: #5d6f99; }
.mt-ridge { fill: none; stroke: #121a33; stroke-width: 2; stroke-linecap: round; opacity: .7; }
.mt-pole { stroke: #e6eeff; stroke-width: 2.5; stroke-linecap: round; }
.mt-flag { fill: #ffc857; }
.mt-flag-shade { fill: url(#flagShade); pointer-events: none; }
.mt-pole-cap { fill: #e6eeff; }
.space { --tile: #1f2c52; --tile-side: #0a1124; --tile-edge: #2a3a66; cursor: pointer; }
.space .disc { fill: var(--tile); stroke: var(--tile-side); stroke-width: 2.5; }
.space .num { fill: #c9d6ff; font: 800 13px var(--display); }
.space.k-start { --tile: #1d6b52; --tile-side: #0d3527; --tile-edge: #45d3a0; }
.space.k-gate { --tile: #e0a326; --tile-side: #6b4a12; --tile-edge: #fff0b8; }
.k-gate .ico.crown { fill: #fff6dc; }
.ico.crown { fill: #ffe08a; stroke: var(--tile-side); stroke-width: 1.3; stroke-linejoin: round; paint-order: stroke; }
.ico.gem { fill: #ff4d6d; }
.ico.solo-text { fill: #fff; font: 800 12.5px var(--display); letter-spacing: -.02em; stroke: var(--tile-side); stroke-width: 2.4; paint-order: stroke; }
.ico.vs { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.space.k-boost { --tile: #27b07f; --tile-side: #11583e; --tile-edge: #7ae6bd; }
.space.k-slip { --tile: #db5a3f; --tile-side: #6e2617; --tile-edge: #ffa58f; }
.space.k-chance { --tile: #4467ee; --tile-side: #1b2c7a; --tile-edge: #a9bbff; }
.space.k-storm { --tile: #43577f; --tile-side: #1d2843; --tile-edge: #a9bcdd; }
.space.k-duel { --tile: #a443c4; --tile-side: #4d1a5e; --tile-edge: #eaa9ff; }
.space.k-solo { --tile: #eeac33; --tile-side: #7a520d; --tile-edge: #ffe09a; }
.ico.line { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .35)); }
.ico.pip { fill: #fff; }
.ico.solid { fill: #fff; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .3)); }
.ico.solid.soft { fill: rgba(255, 255, 255, .78); }
.ico.eye { fill: var(--tile-side); }
.ico.spark { fill: #ffe9a8; }
.ico.sword { fill: #fff; stroke: var(--tile-side); stroke-width: 1.3; stroke-linejoin: round; paint-order: stroke; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .3)); }
.ico.groove { fill: none; stroke: var(--tile-side); stroke-width: 1.8; stroke-linecap: round; }
.k-solo .ico.solid { fill: #fff8e6; }
.ico.bolt { fill: #ffd166; stroke: var(--tile-side); stroke-width: 1; stroke-linejoin: round; }
.ico.card { fill: #fff; stroke: var(--tile-side); stroke-width: 1.5; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .3)); }
.ico.card-q { fill: #4467ee; font: 800 16px var(--display); }
.legend { display: none; }
.space-tip { opacity: 0; transition: opacity .2s ease, transform .26s var(--ease-spring); position: absolute; z-index: 1000; transform: scale(.85); width: max-content; max-width: 220px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.35; pointer-events: none; }
.space-tip.show { opacity: 1; transform: none; }
.space-tip span { color: var(--soft); }
.chance-card { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; pointer-events: none; background: rgba(2, 3, 8, .4); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); opacity: 0; transition: opacity .3s ease; perspective: 1200px; }
.chance-card.show { opacity: 1; }
.chance-card.out { opacity: 0; }
.ev-card { position: relative; width: min(300px, 74vw); aspect-ratio: 5 / 7; transform-style: preserve-3d; }
.chance-card.show .ev-card { animation: ev-in 1200ms var(--ease-out) both; }
.chance-card.out .ev-card { animation: ev-out 320ms ease-in forwards; }
@keyframes ev-in { 0% { transform: translateY(70vh) rotateZ(-14deg) rotateY(0deg) scale(.7); } 38% { transform: translateY(0) rotateZ(3deg) rotateY(0deg) scale(1.05); } 52% { transform: rotateZ(0) rotateY(0deg) scale(1.05); } 82% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg) scale(1); } }
@keyframes ev-out { from { transform: rotateY(180deg) scale(1); opacity: 1; } to { transform: rotateY(180deg) translateY(-30px) scale(.85); opacity: 0; } }
.ev-face { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: 0 30px 70px rgba(0, 0, 0, .6); }
.ev-back { background: repeating-linear-gradient(45deg, #3557d8 0 14px, #2c49bd 14px 28px); border: 6px solid #e6edff; }
.ev-q { display: grid; place-items: center; width: 46%; aspect-ratio: 1; border-radius: 50%; background: #e6edff; color: #2c49bd; font: 800 88px / 1 var(--display); box-shadow: 0 6px 0 rgba(0, 0, 0, .2); }
.ev-front { transform: rotateY(180deg); gap: 10px; padding: 26px 22px; background: linear-gradient(180deg, #fdfbf3, #efe8d6); border: 6px solid #4467ee; color: #1a1f33; }
.ev-front .card-kicker { padding: 3px 12px; border-radius: 999px; background: #4467ee; color: #fff; font: 700 13px var(--font); }
.ev-icon { width: 46%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #dfe6ff; color: #2c49bd; }
.ev-icon svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ev-front strong { font: 800 30px / 1.05 var(--display); color: #1a1f33; }
.ev-text { color: #3d4560; font-size: 16px; line-height: 1.4; font-weight: 600; }
.chance-card .ready-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ready-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 700; transition: border-color .2s, background .2s; }
.ready-chip i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--seat); transition: background .2s; }
.ready-chip small { color: var(--muted); font-size: 12px; font-weight: 600; }
.ready-chip.on { border-color: var(--seat); background: var(--surface-2); }
.ready-chip.on i { background: var(--seat); animation: blob-pop 420ms var(--ease-spring); }
.ready-chip.on small { color: var(--text); }
.card-demo { position: relative; height: 230px; border-radius: 12px; overflow: hidden; background: #070b16; border: 1px solid var(--border); }
.card-demo canvas { width: 100%; height: 100%; display: block; }
.card-demo-tag { position: absolute; left: 10px; bottom: 8px; padding: 2px 8px; border-radius: 7px; background: rgba(2, 3, 8, .75); color: var(--soft); font: 700 11px var(--font); }
.card-kicker { color: #8fa3e8; font-size: 12px; font-weight: 600; }

.tokens { position: absolute; inset: 0; pointer-events: none; }
.token-tag { position: absolute; left: 50%; bottom: 112%; transform: translateX(-50%); padding: 1px 6px 2px; background: rgba(0, 0, 0, .42); color: #fff; font: 700 max(13px, 28cqw) / 1.15 var(--display); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.token-blob { pointer-events: auto; }
.token:has(.token-blob:hover) .token-tag { opacity: 1; }
.token:has(.token-blob:hover) { z-index: 1003 !important; }
.token.active .token-tag { bottom: 178%; }
.token { container-type: inline-size; position: absolute; width: var(--token-w, 11%); aspect-ratio: 1; transform: translate(-50%, -78%) scale(var(--token-scale, 1)); transform-origin: 50% 80%; transition: left var(--hop-move, 240ms) cubic-bezier(.45, 0, .3, 1), top var(--hop-move, 240ms) cubic-bezier(.45, 0, .3, 1), transform 200ms var(--ease-out); }
.token.shared { --token-scale: .78; }
.token-ring { position: absolute; left: 16%; right: 16%; top: 66%; height: 24%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .7), rgba(0, 0, 0, .45) 60%, transparent); }
.token-blob { position: absolute; left: 0; top: -22%; width: 100%; height: 100%; transform-origin: 50% 92%; transition: transform 200ms var(--ease-out); filter: drop-shadow(1.6px 0 0 #f4f7ff) drop-shadow(-1.6px 0 0 #f4f7ff) drop-shadow(0 1.6px 0 #f4f7ff) drop-shadow(0 -1.6px 0 #f4f7ff) drop-shadow(0 5px 4px rgba(0, 0, 0, .55)); }
.token-alert { position: absolute; left: 50%; top: -78%; display: none; font: 800 72cqw / 1 var(--display); color: #ff3045; -webkit-text-stroke: 9cqw #fff; paint-order: stroke fill; text-shadow: 0 3px 0 rgba(0, 0, 0, .35); transform-origin: 50% 100%; pointer-events: none; }
.token.active:not(.moving) .token-alert { display: block; animation: alert-jump 900ms cubic-bezier(.3, .7, .4, 1) infinite; }
@keyframes alert-jump { 0%, 100% { transform: translate(-50%, 0) scale(1.12, .88); } 15% { transform: translate(-50%, 0) scale(.92, 1.1); } 45% { transform: translate(-50%, -38%) scale(1); } 75% { transform: translate(-50%, 0) scale(1); } 85% { transform: translate(-50%, 0) scale(1.1, .9); } }
.token-blob.hop { animation: token-hop var(--hop-ms, 260ms) cubic-bezier(.3, .7, .4, 1); }
.token-blob.hop-big { animation: token-hop-big 300ms cubic-bezier(.3, .7, .4, 1); }
@keyframes token-hop { 0% { transform: none; } 16% { transform: scale(1.14, .84); } 52% { transform: translateY(-52%) scale(.92, 1.1); } 84% { transform: translateY(0) scale(1.14, .86); } 100% { transform: none; } }
@keyframes token-hop-big { 0% { transform: none; } 16% { transform: scale(1.18, .8); } 50% { transform: translateY(-110%) scale(.9, 1.14) rotate(8deg); } 84% { transform: translateY(0) scale(1.16, .84); } 100% { transform: none; } }
.token.sliding .token-blob { transform: rotate(-14deg) translateY(4%); }
.dust { position: absolute; width: var(--token-w, 11%); aspect-ratio: 2.6; border-radius: 50%; background: rgba(200, 215, 255, .2); transform: translate(-50%, -40%); pointer-events: none; animation: dust 520ms var(--ease-out) forwards; z-index: 0; }
@keyframes dust { from { transform: translate(-50%, -40%) scale(.35); opacity: 1; } to { transform: translate(-50%, -40%) scale(1.6, 1.25); opacity: 0; } }
.space .pulse { fill: none; stroke: #e1e6f2; stroke-width: 4; transform-box: fill-box; transform-origin: center; pointer-events: none; animation: space-pulse 800ms var(--ease-out) forwards; }
.k-boost .pulse { stroke: #45d3a0; }
.k-slip .pulse { stroke: #ff7b61; }
.k-chance .pulse { stroke: #8fa3e8; }
.k-storm .pulse { stroke: #b9cbe8; }
@keyframes space-pulse { from { transform: scale(1); opacity: .95; } to { transform: scale(2.2); opacity: 0; } }
.storm-fx { position: absolute; z-index: 1002; width: calc(var(--token-w, 11%) * 3); aspect-ratio: 1; transform: translate(-50%, -78%); pointer-events: none; animation: storm-drop 1900ms var(--ease-out) forwards; }
.storm-fx svg { width: 100%; height: 100%; overflow: visible; }
.sf-cloud { fill: #2b3150; stroke: #c9d6ff; stroke-width: 2.5; stroke-linejoin: round; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.sf-cloud-top { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: 2; stroke-linecap: round; }
.sf-bolt { fill: #ffe14d; stroke: #fff6c2; stroke-width: 1.2; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(255, 225, 77, .9)); opacity: 0; }
.sf-bolt.b1 { animation: bolt-strike 1900ms steps(1) forwards; }
.sf-bolt.b2 { animation: bolt-strike 1900ms steps(1) 140ms forwards; }
.sf-bolt.b3 { animation: bolt-strike 1900ms steps(1) 300ms forwards; }
.sf-rain path { stroke: #9fb4ff; stroke-width: 2; stroke-linecap: round; opacity: .8; animation: rain-fall 420ms linear infinite; }
.sf-rain path:nth-child(2n) { animation-delay: -210ms; }
.sf-rain path:nth-child(3n) { animation-delay: -110ms; }
@keyframes rain-fall { from { transform: translateY(-6px); opacity: 0; } 30% { opacity: .8; } to { transform: translateY(30px); opacity: 0; } }
@keyframes storm-drop { 0% { opacity: 0; transform: translate(-50%, -150%) scale(.6); } 18% { opacity: 1; transform: translate(-50%, -78%) scale(1.05); } 26% { transform: translate(-50%, -78%) scale(1); } 85% { opacity: 1; transform: translate(-50%, -80%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -96%) scale(1.1); } }
@keyframes bolt-strike { 0%, 22% { opacity: 0; } 24%, 30% { opacity: 1; } 32%, 40% { opacity: 0; } 42%, 52% { opacity: 1; } 54%, 64% { opacity: 0; } 66%, 74% { opacity: 1; } 76%, 100% { opacity: 0; } }
.storm-flash { position: absolute; inset: 0; z-index: 1001; pointer-events: none; background: rgba(220, 230, 255, .55); opacity: 0; animation: storm-flash 1900ms steps(1) forwards; border-radius: inherit; }
@keyframes storm-flash { 0%, 23% { opacity: 0; } 24% { opacity: .9; } 26%, 41% { opacity: 0; } 42% { opacity: .55; } 44%, 100% { opacity: 0; } }
.token.inside { opacity: 0; }
.token.zapped .token-blob { animation: zap 1500ms steps(2) 420ms; }
@keyframes zap { 0%, 100% { transform: none; } 10% { transform: translateX(-4%) rotate(-6deg); } 20% { transform: translateX(4%) rotate(6deg); } 30% { transform: translateX(-3%); } 40% { transform: none; } }
.board { transition: transform 700ms var(--ease-out); }
.board.focus { transform: none; }
.turn-bar.swap > * { animation: turn-swap 380ms var(--ease-out) both; }
.turn-bar.swap > :nth-child(2) { animation-delay: 40ms; }
.turn-bar.swap > :nth-child(3) { animation-delay: 80ms; }
@keyframes turn-swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.token.moving { z-index: 999 !important; }
.step-count { position: absolute; left: 50%; top: -70%; transform: translateX(-50%); min-width: 62cqw; padding: 4cqw 12cqw; border-radius: 40cqw; background: #f6f5f0; color: #16192a; font: 800 44cqw / 1 var(--display); text-align: center; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); pointer-events: none; transition: opacity .25s, transform .25s; }
.step-count.tick { animation: count-pop 220ms var(--ease-spring); }
.step-count.gone { opacity: 0; transform: translateX(-50%) scale(.6); }
@keyframes count-pop { 0% { transform: translateX(-50%) scale(1.35); } 100% { transform: translateX(-50%) scale(1); } }
.roll-extras { position: absolute; transform: translate(-50%, -160%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; transition: opacity .35s; }
.roll-extras.gone { opacity: 0; }
.roll-extra { padding: 6px 14px; border-radius: 999px; font: 800 20px var(--display); color: #062016; background: #45d3a0; box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .4); animation: extra-in 420ms var(--ease-spring) both; }
.roll-extra.down { background: #ff7b61; color: #2a0b04; }
@keyframes extra-in { 0% { opacity: 0; transform: translateY(18px) scale(.5); } 100% { opacity: 1; transform: none; } }
.token.flying { transition: none; z-index: 1001 !important; }
.token.flying .token-ring { opacity: .3; }
.token.crouch .token-blob { transform: scale(1.18, .78); transition-duration: 160ms; }
.token-blob.land { animation: token-land 300ms var(--ease-out); }
@keyframes token-land { 0% { transform: scale(1.3, .7); } 45% { transform: scale(.9, 1.12); } 100% { transform: none; } }
.board-screen.fast .token { transition-duration: 60ms; }
.board-screen.fast .token-blob.hop, .board-screen.fast .token-blob.hop-big { animation-duration: 80ms; }
.board-screen.fast .chance-card.show .ev-card { animation-duration: 500ms; }

.turn-bar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; }
.turn-blob { width: 48px; height: 48px; }
.turn-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "blob name dice roll" "blob hint dice roll"; column-gap: 12px; row-gap: 2px; }
.turn-blob { grid-area: blob; }
.turn-name { grid-area: name; display: flex; align-items: center; min-width: 0; align-self: end; }
.turn-sub { grid-area: hint; display: flex; align-items: center; gap: 6px; min-width: 0; height: 20px; align-self: start; }
.turn-name strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pills { display: flex; gap: 4px; flex: none; }
.pill { padding: 1px 7px; line-height: 16px; border-radius: 9px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border-strong); }
.pill.up { color: #9ef0c9; border-color: #1f6b52; }
.pill.down { color: #ffb3a1; border-color: #e0603f; }
.turn-hint { flex: 1; color: var(--soft); font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.turn-bar .dice { grid-area: dice; }
.turn-bar .roll-btn { grid-area: roll; }
.die { width: 52px; height: 52px; border-radius: 12px; background: #f6f5f0; display: grid; place-items: center; flex: none; box-shadow: inset 0 -3px 0 #c9c6bb, 0 2px 6px rgba(0, 0, 0, .3); }
.pips { display: grid; grid-template-columns: repeat(3, 9px); grid-template-rows: repeat(3, 9px); gap: 4px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; }
.pips i.on { background: #16192a; }
.dice { perspective: 420px; }
.die.rolling { animation: die-tumble 420ms linear infinite; }
@keyframes die-tumble { 0% { transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0); } 25% { transform: translateY(-14px) rotateX(90deg) rotateY(45deg) rotateZ(20deg); } 50% { transform: translateY(-4px) rotateX(180deg) rotateY(90deg) rotateZ(0); } 75% { transform: translateY(-12px) rotateX(270deg) rotateY(135deg) rotateZ(-20deg); } 100% { transform: translateY(0) rotateX(360deg) rotateY(180deg) rotateZ(0); } }
.die.idle .pips { opacity: .3; }
.die.landed { animation: die-land 380ms var(--ease-spring); }
@keyframes die-land { 0% { transform: translateY(-16px) scale(1.12); } 45% { transform: translateY(0) scale(1.1, .9); } 70% { transform: translateY(-4px) scale(.97, 1.03); } 100% { transform: none; } }
.roll-btn { --charge: 0; min-width: 150px; min-height: 58px; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-content: stretch; gap: 12px; padding: 9px 16px 9px 10px; text-align: left; border-radius: 14px; border: 0; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
.roll-btn:disabled { opacity: .45; }
.roll-btn:not(:disabled):not(.charging) { animation: roll-call 1800ms ease-in-out infinite; }
@keyframes roll-call { 0%, 100% { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 0 0 0 rgba(85, 130, 255, .5); } 50% { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 0 0 7px rgba(85, 130, 255, 0); } }
.roll-fill { position: absolute; inset: 0; background: linear-gradient(90deg, #6f97ff 0%, #ffc44d 62%, #ff6a2b 84%, #ff2d4b 100%); clip-path: inset(0 calc((1 - var(--charge)) * 100%) 0 0); pointer-events: none; }
.roll-cube { position: relative; width: 40px; height: 40px; border-radius: 11px; background: #f6f5f0; color: #16192a; display: grid; place-items: center; box-shadow: inset 0 -3px 0 #c9c6bb, 0 2px 6px rgba(0, 0, 0, .3); transform: rotate(calc(var(--charge) * 300deg)) scale(calc(1 + var(--charge) * .12)); }
.roll-cube .icon { width: 24px; height: 24px; stroke-width: 2.4; }
.roll-text { position: relative; display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.roll-text strong { font: 800 19px var(--display); letter-spacing: .01em; }
.roll-text small { font-size: 12px; font-weight: 700; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.roll-ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; pointer-events: none; }
.roll-ticks i { position: absolute; bottom: 0; width: 2px; height: 100%; background: rgba(255, 255, 255, .35); }
.roll-ticks i:nth-child(1) { left: 25%; }
.roll-ticks i:nth-child(2) { left: 50%; }
.roll-ticks i:nth-child(3) { left: 75%; }
.roll-ticks i:nth-child(4) { display: none; }
.roll-btn.charging { background: #23305e; animation: roll-shake 90ms linear infinite; }
.roll-btn.charging .roll-text { text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.roll-btn.max { animation: roll-shake 50ms linear infinite, roll-hot 260ms ease-in-out infinite alternate; }
.roll-btn.max .roll-text strong { color: #fff; }
@keyframes roll-shake { 0% { transform: translate(0, 0); } 25% { transform: translate(calc(var(--charge) * 2.5px), calc(var(--charge) * -1.5px)); } 50% { transform: translate(calc(var(--charge) * -2px), calc(var(--charge) * 1.5px)); } 75% { transform: translate(calc(var(--charge) * 1.5px), calc(var(--charge) * 2px)); } 100% { transform: translate(0, 0); } }
@keyframes roll-hot { from { box-shadow: 0 0 0 0 rgba(255, 45, 75, .7), 0 0 18px rgba(255, 106, 43, .6); } to { box-shadow: 0 0 0 5px rgba(255, 45, 75, 0), 0 0 34px rgba(255, 45, 75, .9); } }
.dice-layer { position: absolute; inset: 0; pointer-events: none; z-index: 950; }
.dice-gl { position: absolute; left: 0; top: 0; pointer-events: none; transition: opacity .35s ease; }
.dice-gl.gone { opacity: 0; }
.board-wrap.shake { animation: wrap-shake 360ms cubic-bezier(.3, .7, .4, 1); }
@keyframes wrap-shake { 0% { transform: translate(0, 0); } 15% { transform: translate(calc(var(--shake) * -1), calc(var(--shake) * .6)); } 35% { transform: translate(var(--shake), calc(var(--shake) * -.5)); } 55% { transform: translate(calc(var(--shake) * -.5), calc(var(--shake) * .3)); } 75% { transform: translate(calc(var(--shake) * .25), 0); } 100% { transform: translate(0, 0); } }

.pick-panel { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; background: rgba(2, 3, 8, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: veil-in 260ms ease-out; }
.pick-card { width: min(560px, 100%); padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); animation: card-in-up 360ms var(--ease-spring); }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes card-in-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.pick-panel h3 { margin: 0 0 16px; font: 700 24px var(--display); text-align: center; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px 14px; border-radius: 16px; border: 1px solid var(--border-strong); transition: transform .15s var(--ease-out), border-color .15s; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.pick:hover { border-color: var(--seat); transform: translateY(-3px); }
.pick-blob { width: 64px; height: 64px; }
.pick-name { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-pos { color: var(--muted); font-size: 12px; }
.dice { display: flex; align-items: center; gap: 8px; flex: none; }
.die.boost { width: 40px; height: 40px; border-radius: 10px; background: #ffcf5c; box-shadow: inset 0 -3px 0 #e3a93a, 0 2px 6px rgba(0, 0, 0, .3); position: relative; }
.die.boost .pips { grid-template-columns: repeat(3, 7px); grid-template-rows: repeat(3, 7px); gap: 3px; }
.die.boost .pips i { width: 7px; height: 7px; }
.die-tag { position: absolute; top: -9px; right: -8px; padding: 1px 5px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); font: 700 10px var(--font); }

.mini-screen.active { flex-direction: column; align-items: stretch; justify-content: flex-start; height: 100vh; height: 100svh; padding: 12px 16px 16px; gap: 10px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.mini-head { display: flex; align-items: center; gap: 14px; max-width: 960px; width: 100%; margin: 0 auto; }
.mini-head strong { font: 700 20px var(--display); white-space: nowrap; }
.mini-progress { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mini-progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.stage { -webkit-tap-highlight-color: transparent; position: relative; flex: 1; min-height: 0; max-width: 960px; width: 100%; margin: 0 auto; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mini-canvas { position: absolute; inset: 0; display: block; }
.lanes { position: absolute; inset: 0; display: grid; gap: 6px; padding: 6px; grid-auto-rows: 1fr; }
.lanes.n2 { grid-template-columns: 1fr 1fr; }
.lanes.n3 { grid-template-columns: 1fr 1fr 1fr; }
.lanes.n4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.lane { animation: lane-in 460ms var(--ease-out) both; }
.lane:nth-child(2) { animation-delay: 60ms; }
.lane:nth-child(3) { animation-delay: 120ms; }
.lane:nth-child(4) { animation-delay: 180ms; }
@keyframes lane-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.lane { position: relative; border-radius: 12px; border: 1px solid var(--border); border-top: 4px solid var(--seat); cursor: pointer; }
.lane.bot { cursor: default; }
.lane.mine { border: 3px solid #e6eeff; border-top: 6px solid var(--seat); box-shadow: 0 0 0 3px rgba(230, 238, 255, .18); z-index: 1; }
.lane.mine .lane-head::after { content: attr(data-you); margin-left: auto; padding: 2px 8px; border-radius: 8px; background: #e6eeff; color: #0b1120; font: 800 12px var(--font); }
.lane-head { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.lane-blob { width: 40px; height: 40px; }
.lane-name { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-pair { display: block; font-size: 12px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.lanes.pairs.n4:not(.has-mine) { grid-template-columns: 1fr 1fr 6px 1fr 1fr; }
.lanes.pairs.n4:not(.has-mine) .lane:nth-child(3) { grid-column: 4; }
.lane kbd { min-width: 28px; height: 28px; display: grid; place-items: center; padding: 0 6px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 3px; font: 700 13px var(--font); color: var(--text); }
.stage::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: rgba(2, 3, 8, .5); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); transition: opacity .3s ease; }
.stage:has(.mini-card:not([hidden]))::after { opacity: 1; }
.mini-card, .mini-results { z-index: 3; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 22px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 10px; animation: card-in 320ms var(--ease-spring); }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, -44%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%); } }
.card-kicker { color: var(--muted); font-size: 13px; font-weight: 600; }
.mini-card h2, .mini-results h2 { margin: 0; font: 700 28px var(--display); }
.mini-card { width: min(680px, calc(100% - 32px)); padding: 28px; gap: 14px; border-radius: 20px; }
.mini-card h2 { font-size: 40px; line-height: 1.05; }
.mini-card p { font-size: 17px; }
.mini-card .card-demo { height: min(340px, 38vh); }
.mini-card p { margin: 0; color: var(--soft); line-height: 1.45; }
.mini-card .card-versus { color: var(--text); font-weight: 700; }
.results-note { margin: 0; color: var(--soft); font-size: 14px; }
.mini-card .btn, .mini-results .btn { margin-top: 8px; }
.mini-wait { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--soft); font-weight: 600; font-size: 14px; white-space: nowrap; }
.lane.remote { cursor: default; background: var(--surface); }
.remote-note { position: absolute; inset: 56px 8px 8px; display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; pointer-events: none; }
.remote-note.live { color: var(--text); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 120px var(--display); color: var(--text); pointer-events: none; }
.countdown.tick { animation: count-tick 650ms var(--ease-out); }
.countdown.go { color: var(--accent-hover); animation: count-go 520ms var(--ease-out) forwards; }
@keyframes count-go { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 35% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } }
@keyframes count-tick { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: .2; transform: translate(-50%, -50%) scale(.92); } }
.results-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.results-list li { display: grid; grid-template-columns: 26px 34px 1fr auto; grid-template-areas: "place blob name score" "place blob boost score"; align-items: center; column-gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border-left: 4px solid var(--seat); animation: step-in 420ms var(--ease-spring) both; }
.res-place.hide { visibility: hidden; }
.res-place.pop-in { animation: blob-pop 420ms var(--ease-spring) both; }
.results-list li.win { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--seat); }
.res-place { grid-area: place; font: 700 18px var(--display); color: var(--soft); }
.res-blob { grid-area: blob; width: 34px; height: 34px; }
.res-name { grid-area: name; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-boost { grid-area: boost; color: var(--muted); font-size: 12px; }
.res-score { grid-area: score; font-weight: 700; font-variant-numeric: tabular-nums; }

#screen-podium { position: relative; overflow: hidden; --win: #ffc857; }
#screen-podium.active { align-items: safe center; background: radial-gradient(60% 55% at 50% 42%, color-mix(in srgb, var(--win) 16%, transparent), transparent 72%); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.finale { position: relative; width: 100%; max-width: 980px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.podium-title { margin: 0; text-align: center; font: 800 clamp(34px, 5vw, 68px) / 1.08 var(--display); color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .35); opacity: 0; position: relative; z-index: 2; }
.finale.go .podium-title { animation: title-in 760ms var(--ease-spring) 2620ms both; }
@keyframes title-in { 0% { opacity: 0; transform: translateY(26px) scale(.45); } 60% { opacity: 1; transform: translateY(-4px) scale(1.07); } 100% { opacity: 1; transform: none; } }
.win-name { position: relative; z-index: 0; display: inline-block; padding: 0 .1em; color: #ffd75e; text-shadow: 0 0 26px rgba(255, 200, 80, .55), 0 4px 0 rgba(0, 0, 0, .4); }
.podium-stage { position: relative; width: 100%; display: flex; justify-content: center; padding-top: 120px; }
.rays { position: absolute; left: 50%; top: 46%; width: 1200px; height: 1200px; margin: -600px 0 0 -600px; pointer-events: none; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 214, 110, .16) 0deg 8deg, transparent 8deg 20deg); -webkit-mask-image: radial-gradient(closest-side, #000 18%, transparent 78%); mask-image: radial-gradient(closest-side, #000 18%, transparent 78%); opacity: 0; }
.finale.go .rays { animation: rays-in 1100ms ease-out 2480ms forwards, rays-spin 36s linear infinite; }
@keyframes rays-in { to { opacity: 1; } }
@keyframes rays-spin { to { transform: rotate(360deg); } }
.podium { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 12px; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; width: 170px; }
.step-1 { width: 210px; }
.step-3 { width: 160px; }
.step-crew { display: flex; justify-content: center; align-items: flex-end; gap: 6px; width: 100%; }
.step-person { display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1; }
.step-3.pair { width: 220px; }
.step-3.pair .podium-blob { width: 80px; height: 80px; }
.step-actor { position: relative; display: flex; justify-content: center; opacity: 0; }
.step-hop { position: relative; z-index: 1; transform-origin: 50% 95%; }
.podium-blob { display: block; width: 104px; height: 104px; }
.step-1 .podium-blob { width: 150px; height: 150px; }
.step-3 .podium-blob { width: 92px; height: 92px; }
.step-shadow { position: absolute; left: 18%; right: 18%; bottom: -4px; height: 16px; border-radius: 50%; background: rgba(0, 0, 0, .55); }
.finale.go .step-actor { animation: actor-pop 520ms var(--ease-spring) calc(var(--rise) + 380ms) both; }
@keyframes actor-pop { 0% { opacity: 0; transform: translateY(26px) scale(.3); } 100% { opacity: 1; transform: none; } }
.finale.go .step-1 .step-actor { animation: actor-drop 430ms cubic-bezier(.55, 0, 1, .45) 2050ms both; }
@keyframes actor-drop { 0% { opacity: 1; transform: translateY(-110vh); } 100% { opacity: 1; transform: none; } }
.finale.go .step-1 .step-hop { animation: land-squash 440ms ease-out 2480ms, win-jump 820ms cubic-bezier(.33, 0, .67, 1) 3300ms infinite; }
.finale.go .step-1 .step-shadow { animation: win-shadow 820ms cubic-bezier(.33, 0, .67, 1) 3300ms infinite; }
@keyframes land-squash { 0% { transform: scale(1.35, .62); } 40% { transform: scale(.9, 1.14); } 70% { transform: scale(1.06, .95); } 100% { transform: none; } }
@keyframes win-jump { 0% { transform: translateY(0) scale(1.16, .84); } 14% { transform: translateY(-8%) scale(.9, 1.12); } 50% { transform: translateY(-58%) scale(1); } 86% { transform: translateY(-8%) scale(.94, 1.07); } 100% { transform: translateY(0) scale(1.16, .84); } }
@keyframes win-shadow { 0%, 100% { transform: scale(1.1); opacity: 1; } 50% { transform: scale(.55); opacity: .45; } }
.podium-crown { position: absolute; left: 50%; top: -24%; width: 58%; transform: translateX(-50%) rotate(-9deg); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .3)); opacity: 0; }
.podium-crown svg { display: block; width: 100%; height: auto; }
.finale.go .podium-crown { animation: crown-drop 620ms var(--ease-spring) 2700ms both; }
@keyframes crown-drop { 0% { opacity: 0; transform: translate(-50%, -420%) rotate(-50deg) scale(1.4); } 55% { opacity: 1; transform: translate(-50%, 6%) rotate(4deg) scale(1); } 100% { opacity: 1; transform: translateX(-50%) rotate(-9deg); } }
.step-name { margin: 10px 0 8px; max-width: 100%; font: 700 17px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; }
.step-1 .step-name { font-size: 24px; color: #ffd75e; }
.finale.go .step-name { animation: fade-up 400ms var(--ease-out) calc(var(--rise) + 520ms) both; }
.finale.go .step-1 .step-name { animation-delay: 2900ms; }
.step-block { width: 100%; height: 100px; display: grid; place-items: center; border-radius: 14px 14px 0 0; background: linear-gradient(180deg, color-mix(in srgb, var(--seat) 34%, #17213e), #0b1226 85%); border-top: 5px solid var(--seat); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); font: 800 40px var(--display); transform: scaleY(0); transform-origin: 50% 100%; }
.step-block span { opacity: .9; }
.step-1 .step-block { height: 150px; border-top-color: #ffc233; font-size: 64px; color: #ffd75e; background: linear-gradient(180deg, color-mix(in srgb, var(--seat) 30%, #3a2c10), #0b1226 88%); }
.step-3 .step-block { height: 72px; font-size: 32px; }
.finale.go .step-block { animation: block-rise 640ms var(--ease-spring) var(--rise) forwards; }
@keyframes block-rise { from { transform: scaleY(0); } to { transform: none; } }
@keyframes step-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
#screen-podium.quake .finale { animation: quake 480ms cubic-bezier(.3, .7, .4, 1); }
@keyframes quake { 0% { transform: translate(0, 0); } 15% { transform: translate(-10px, 7px); } 30% { transform: translate(9px, -6px); } 45% { transform: translate(-6px, 4px); } 65% { transform: translate(3px, -2px); } 100% { transform: translate(0, 0); } }
.finale-info { width: 100%; max-width: 860px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; margin-top: 6px; opacity: 0; }
.finale-actions { width: 100%; max-width: 860px; margin-top: 0; opacity: 0; }
.finale.go .finale-info { animation: fade-up 520ms var(--ease-out) 3500ms both; }
.finale.go .finale-actions { animation: fade-up 520ms var(--ease-out) 3650ms both; }
.stats { display: grid; grid-template-columns: 26px minmax(0, 1fr) repeat(3, 96px); align-items: center; row-gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.stats-head { color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; padding-bottom: 2px; }
.stats-row { display: contents; }
.stats-place { font: 700 16px var(--display); color: var(--soft); }
.stats-who { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.stats-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-row.first .stats-place, .stats-row.first .stats-who span { color: #ffd75e; }
.stats-blob { width: 28px; height: 28px; flex: none; }
.stats-num { text-align: right; font-weight: 700; }
.records { align-self: start; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.records strong { font-size: 14px; }
.record { display: flex; justify-content: space-between; gap: 12px; color: var(--soft); }
.record b { color: var(--text); font-weight: 700; text-align: right; }
.record-new { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }

@media (max-width: 700px) {
  .podium-stage { padding-top: 90px; }
  .step { width: 104px; }
  .step-1 { width: 124px; }
  .step-3 { width: 96px; }
  .step-3.pair { width: 130px; }
  .step-3.pair .podium-blob { width: 50px; height: 50px; }
  .podium { gap: 6px; }
  .podium-blob { width: 66px; height: 66px; }
  .step-1 .podium-blob { width: 96px; height: 96px; }
  .step-3 .podium-blob { width: 58px; height: 58px; }
  .step-1 .step-block { height: 110px; font-size: 44px; }
  .step-block { height: 76px; font-size: 30px; }
  .step-3 .step-block { height: 54px; font-size: 24px; }
  .step-name { font-size: 14px; }
  .step-1 .step-name { font-size: 18px; }
  .rays { width: 700px; height: 700px; margin: -350px 0 0 -350px; }
  .finale-info { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: 22px minmax(0, 1fr) repeat(2, 48px) auto; column-gap: 10px; padding: 12px; }
  .lobby-panel { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .lobby-side { border-right: 0; border-bottom: 1px solid var(--border); padding: 18px; }
  .lobby-main { padding: 18px; }
  .board-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .board-cards button { padding: 8px 8px 10px; gap: 8px; }
  .board-mini { padding: 6px; }
  .board-label { flex-direction: column; gap: 0; }
  .board-label strong { font-size: 17px; }
  .board-label small { font-size: 12px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-actions { flex-direction: column; align-items: stretch; }
  .rejoin-panel { position: static; transform: none; width: 100%; max-width: none; flex-direction: column; align-items: stretch; gap: 12px; box-shadow: none; padding: 14px; }
  .rejoin-panel.out { transform: translateY(14px); }
  .panel.rejoin-panel h2 { justify-content: center; flex-wrap: wrap; }
  .rejoin-actions .btn { flex: 1; }
  .corner { top: 10px; right: 10px; }
  #screen-start, #screen-lobby, #screen-podium { padding-top: 60px; }
  .screen { padding: 16px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .mark { margin-top: 56px; }
  .panel { padding: 18px; }
  .board-screen.active { padding: 8px 8px 0; gap: 6px; }
  .hud { gap: 6px 8px; flex-wrap: wrap; }
  .hud-top { order: 0; gap: 8px; width: 100%; }
  .hud-top .volume { flex: 1; width: auto; }
  .standings { width: 100%; flex-wrap: nowrap; gap: 4px; min-width: 0; }
  .standings .chip { flex: 1 1 0; min-width: 0; justify-content: center; }
  .chip { height: 32px; gap: 4px; padding: 0 8px 0 3px; font-size: 13px; }
  .chip-blob { width: 24px; height: 24px; }
  .chip-name { display: none; }
  .turn-bar { column-gap: 10px; row-gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "blob name name" "blob dice roll" "hint hint hint"; }
  .turn-name { align-self: center; justify-self: stretch; }
  .turn-sub { padding-left: 2px; }
  .turn-blob { width: 40px; height: 40px; }
  .die { width: 46px; height: 46px; }
  .pips { grid-template-columns: repeat(3, 8px); grid-template-rows: repeat(3, 8px); gap: 3px; }
  .pips i { width: 8px; height: 8px; }
  .roll-btn { min-width: 0; min-height: 50px; padding: 7px 12px 7px 7px; gap: 8px; }
  .roll-cube { width: 34px; height: 34px; }
  .roll-text strong { font-size: 16px; }
  .roll-text small { font-size: 11px; }
  .seat { gap: 8px; }
  .kind-btn { width: 108px; padding: 0 8px; }
  .die.boost { width: 36px; height: 36px; }
  .dice { gap: 6px; }
  .mini-screen.active { padding: 8px 8px 10px; gap: 8px; }
  .lanes.n3 { grid-template-columns: 1fr; }
  .lanes.n4 { grid-template-columns: 1fr 1fr; }
  .lanes.pairs.n4:not(.has-mine) { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) 4px minmax(0, 1fr); }
  .lanes.pairs.n4:not(.has-mine) .lane:nth-child(n+3) { grid-column: auto; grid-row: 3; }
  .lanes.has-mine { grid-auto-rows: auto; grid-template-rows: minmax(0, 1fr) minmax(0, 2fr); }
  .lanes.has-mine.n2 { grid-template-columns: 1fr; }
  .lanes.has-mine.n3 { grid-template-columns: 1fr 1fr; }
  .lanes.has-mine.n4 { grid-template-columns: 1fr 1fr 1fr; }
  .lanes.has-mine .lane.mine { grid-column: 1 / -1; grid-row: 2; }
  .lanes.has-mine .lane:not(.mine) .lane-name { font-size: 12px; }
  .lanes.has-mine .lane:not(.mine) .lane-tag { display: none; }
  .lanes.has-mine .lane:not(.mine) .lane-head { gap: 6px; }
  .lanes.has-mine .remote-note { inset: 48px 6px 6px; }
  .lanes.has-mine .remote-note.live { font-size: 17px; }
  .lane-blob { width: 32px; height: 32px; }
  .mini-card h2, .mini-results h2 { font-size: 24px; }
}

@media (min-aspect-ratio: 4/3) and (min-width: 701px) {
  body { overflow: hidden; }
  #app { position: fixed; inset: 0; overflow: hidden; }
  .screen { min-height: 0; height: 100%; overflow: auto; }
  .board-screen.active { display: grid; grid-template-columns: clamp(214px, 16%, 264px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "hud board" "side board" "turn board"; height: 100%; padding: 18px; gap: 14px; }
  .hud { grid-area: hud; flex-direction: column; align-items: stretch; gap: 10px; max-width: none; margin: 0; }
  .standings { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  .chip { height: 44px; border-radius: 12px; padding: 0 12px 0 6px; gap: 10px; font-size: 14px; }
  .chip-blob { width: 32px; height: 32px; }
  .chip-name { flex: 1; max-width: none; }
  .chip-pos { font-size: 15px; color: var(--soft); }
  .hud-top { order: 0; }
  .hud-top .volume { flex: 1; width: auto; }
  .board-wrap { grid-area: board; overflow: hidden; border-radius: 18px; }
  .board-screen.active { overflow: hidden; }
  .legend { grid-area: side; align-self: start; display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 4px 0 0; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
  .legend li { display: flex; align-items: center; gap: 10px; }
  .legend-icon { width: 34px; height: 34px; flex: none; overflow: visible; }
  .legend .space { cursor: default; }
  .legend span { display: flex; flex-direction: column; min-width: 0; }
  .legend strong { font-size: 13px; }
  .legend small { color: var(--muted); font-size: 12px; line-height: 1.3; }
  .turn-bar { grid-area: turn; max-width: none; margin: 0; border-radius: 16px; border-bottom: 1px solid var(--border); padding: 14px; column-gap: 10px; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "blob name dice" "hint hint hint" "roll roll roll"; row-gap: 10px; }
  .turn-bar .dice { justify-self: end; }
  .turn-bar .turn-blob { width: 40px; height: 40px; }
  .turn-bar .die { width: 44px; height: 44px; border-radius: 11px; }
  .turn-bar .pips { grid-template-columns: repeat(3, 8px); grid-template-rows: repeat(3, 8px); gap: 3px; }
  .turn-bar .pips i { width: 8px; height: 8px; }
  .turn-bar .die.boost { width: 36px; height: 36px; margin-left: -20px; margin-top: 18px; transform: rotate(9deg); z-index: 1; }
  .turn-bar .die.boost .pips { grid-template-columns: repeat(3, 6px); grid-template-rows: repeat(3, 6px); gap: 3px; }
  .turn-bar .die.boost .pips i { width: 6px; height: 6px; }
  .turn-bar .roll-btn { min-height: 74px; padding: 12px; gap: 12px; }
  .turn-bar .roll-cube { width: 44px; height: 44px; }
  .turn-bar .roll-cube .icon { width: 26px; height: 26px; }
  .turn-bar .roll-text strong { font-size: 22px; }
  .turn-bar .roll-text small { font-size: 12px; white-space: normal; }
  .turn-name { align-self: center; justify-self: stretch; justify-content: flex-start; text-align: left; }
  .turn-name strong { font-size: 18px; }
  .turn-hint { white-space: normal; }
  .turn-sub { height: auto; min-height: 20px; }
  .mini-screen.active { height: 100%; padding: 18px; }
  .mini-head, .stage { max-width: none; }
}

@media (min-aspect-ratio: 4/3) and (min-width: 1000px) {
  body { font-size: 15px; }
  .start-inner { max-width: 820px; gap: 18px; }
  .mark { font-size: clamp(96px, 8.5vw, 150px); margin-top: 0; }
  .tagline { font-size: 18px; margin-bottom: 24px; }
  .home-grid { gap: 24px; }
  .panel { padding: 32px; border-radius: 20px; }
  .panel h2, .panel-section h3 { font-size: 18px; }
  .me-blob { width: 130px; }
  .name-line { font-size: 26px; }
  .btn { font-size: 16px; padding: 15px 24px; }
  .btn.small { padding: 10px 18px; font-size: 15px; }
  .code-input { font-size: 16px; }
  .seat { padding: 12px 14px 12px 12px; }
  .seat-blob { width: 52px; height: 52px; }
  .seg button { padding: 18px 10px; }
  .board.focus { transform: none; }
}

.board { width: 100%; height: 100%; overflow: hidden; border-radius: 18px; }
.board-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.board .token { width: 46px; }
.board .token-tag { opacity: 1; font-size: 13px; border-radius: 5px; }
.board .token-alert { animation: none; }

.board .token { width: auto; min-width: 44px; height: 24px; aspect-ratio: auto; container-type: normal; transform: translate(-50%, -100%); transition: none; }
.board .token-blob, .board .token-ring { display: none; }
.board .token-tag, .board .token.active .token-tag { position: relative; left: auto; bottom: auto; display: block; transform: none; padding: 3px 10px 4px; border-radius: 999px; background: var(--seat, #7f8db0); color: #0d1220; font: 800 12px / 1.2 var(--display); text-align: center; box-shadow: 0 0 0 2px #fff, 0 3px 0 2px rgba(6, 10, 22, .35); }
.board .token-tag::before, .board .token-tag::after { content: ''; position: absolute; left: var(--tail-x, 50%); top: 100%; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; transform: translateX(-50%) skewX(var(--tail-skew, 0deg)); pointer-events: none; }
.board .token-tag::before { width: 19px; height: 11px; background: #fff; }
.board .token-tag::after { width: 13px; height: 10px; margin-top: -3px; background: var(--seat, #7f8db0); }
.board .token:not(.active) .token-tag { transform: scale(.88); opacity: .92; }
.board .token.active .token-tag { font-size: 13px; padding: 4px 12px 5px; }
.board .token-alert, .board .token.active:not(.moving) .token-alert { position: absolute; display: grid; place-items: center; top: -15px; left: auto; right: -17px; width: 26px; height: 26px; border-radius: 50%; background: #ff3045; color: #fff; font: 800 18px / 1 var(--display); -webkit-text-stroke: 0; z-index: 2; box-shadow: 0 0 0 2.5px #fff, 0 3px 0 2.5px rgba(6, 10, 22, .35); transform-origin: 50% 100%; animation: tag-alert 1s cubic-bezier(.3, .7, .4, 1) infinite; }
@keyframes tag-alert { 0%, 100% { transform: translateY(0) scale(1.12, .86); } 18% { transform: translateY(-2px) scale(.92, 1.1); } 45% { transform: translateY(-11px) scale(1); } 72% { transform: translateY(0) scale(1); } 84% { transform: translateY(0) scale(1.1, .9); } }
.board .token:not(.active) .token-alert, .board .token.moving .token-alert { display: none; }
.board .step-count { top: -38px; display: grid; place-items: center; min-width: 0; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: #fff; color: #0d1220; font: 800 19px / 1 var(--display); box-shadow: 0 0 0 3px var(--seat, #7f8db0), 0 4px 0 3px rgba(6, 10, 22, .35); }

.board .token { left: 0; top: 0; }
.board-screen .blob, .board-screen .blob * { animation-play-state: paused !important; }
.board-screen .roll-btn:not(:disabled):not(.charging) { animation: none; }

.board .token-tag.long, .board .token.active .token-tag.long { font-size: 11px; }

.map-controls { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.cam-seg { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: rgba(8, 12, 24, .86); box-shadow: 0 0 0 1px rgba(200, 215, 255, .14), 0 6px 18px rgba(0, 0, 0, .35); pointer-events: auto; }
.cam-glider { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--accent); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); transition: transform 320ms var(--ease-spring), opacity 200ms; }
.cam-seg[data-mode="island"] .cam-glider { transform: translateX(100%); }
.cam-seg[data-mode="free"] .cam-glider { opacity: 0; }
.cam-seg button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 16px; border: 0; border-radius: 999px; background: none; color: var(--soft); font: 700 13px / 1.1 var(--font); white-space: nowrap; cursor: pointer; transition: color 200ms, transform 120ms; }
.cam-seg button .icon { width: 17px; height: 17px; }
.cam-seg button:hover { color: var(--text); }
.cam-seg[data-mode="follow"] #mapFollow, .cam-seg[data-mode="island"] #mapOverview { color: #fff; }
.cam-seg button:active { transform: scale(.95); }
.cam-seg button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.map-controls > span { margin-left: auto; padding: 7px 12px; border-radius: 999px; background: rgba(8, 12, 24, .62); color: #c9d3ea; font-size: 11px; }
@media (max-width: 600px) { .map-controls { top: 8px; left: 8px; right: 8px; } .cam-seg button { padding: 8px 12px; font-size: 12px; } .map-controls > span { width: 100%; margin-left: 0; padding: 0; background: none; text-shadow: 0 1px 3px #101925; } }

.board-screen.active { position: relative; }
.board-screen .board { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; z-index: 0; pointer-events: auto; }
.board-screen .dice-layer { position: fixed; inset: 0; }
.board-screen .board-wrap { overflow: visible; border-radius: 0; pointer-events: none; }
.board-screen .map-controls { z-index: 6; }
.board-screen .hud, .board-screen .legend, .board-screen .turn-bar { position: relative; z-index: 3; }
.board-screen .hud-top { padding: 6px 14px 6px 6px; border-radius: 14px; background: rgba(9, 13, 26, .86); box-shadow: 0 0 0 1px var(--border), 0 8px 24px rgba(0, 0, 0, .25); }
.board-screen .chip, .board-screen .legend, .board-screen .turn-bar { background: rgba(10, 15, 29, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.board-screen .chip.on { box-shadow: inset 0 0 0 1px var(--seat), 0 8px 24px rgba(0, 0, 0, .25); }
@media (min-aspect-ratio: 4/3) and (min-width: 701px) {
  .board-screen .hud { align-self: start; }
  .board-screen .legend { align-self: start; max-height: 100%; overflow-y: auto; scrollbar-width: none; }
  .board-screen .turn-bar { align-self: end; }
}
