:root {
  --bg: #06080f;
  --panel: rgba(6, 8, 15, 0.86);
  --panel-2: rgba(14, 18, 30, 0.9);
  --ink: #f4f8ff;
  --dim: #aab4cc;
  --accent: #ff8a1f;
  --accent-ink: #ffb25c;
  --green: #3dff8a;
  --red: #ff4d4d;
  --line: rgba(244, 248, 255, 0.22);
  --display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --pad: clamp(10px, 1.6vw, 18px);
  --bar: 0px; /* letterbox bar height, set while a cinematic plays */
  --cine-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--display); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#stage { position: fixed; inset: 0; touch-action: none; outline: none; }
#gl { width: 100%; height: 100%; display: block; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -0.02em; }
.dim { color: var(--dim); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
kbd { font-family: var(--mono); font-size: max(11px, 0.72em); padding: 1px 6px; border: 1px solid currentColor; background: rgba(255, 255, 255, 0.08); }

#hud { position: fixed; inset: 0; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#hud > * { position: absolute; }
#hud button { pointer-events: auto; }

/* ---------- scorebug ---------- */
.bug { top: var(--pad); left: var(--pad); display: flex; align-items: stretch; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.bug-logo { background: var(--accent); color: #090a0f; padding: 6px 14px 6px 12px; display: flex; flex-direction: column; justify-content: center; font-weight: 700; line-height: 0.95; letter-spacing: 0.06em; font-size: 15px; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.bug-logo span:last-child { font-size: 19px; letter-spacing: 0.02em; }
.bug-body { margin: 0; background: var(--panel); padding: 6px 16px 6px 14px; margin-left: -6px; display: grid; grid-auto-flow: column; gap: 16px; align-items: center; clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); border-bottom: 3px solid var(--accent); }
.bug-body > div { display: grid; gap: 1px; }
.bug-body dt { font-size: 11px; letter-spacing: 0.16em; color: var(--dim); font-weight: 500; }
.bug-body dd { margin: 0; display: flex; align-items: baseline; gap: 5px; font-size: 20px; line-height: 1.1; }
.bug-body small { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 10px; height: 10px; background: #2a3042; transform: skewX(-18deg); }
.pips i.on { background: var(--accent); }
.pips i.done { background: var(--ink); }
.pips i.foul { background: var(--red); }

/* ---------- toolbar ---------- */
.tools { top: calc(var(--pad) + 62px); left: var(--pad); display: flex; gap: 6px; flex-wrap: wrap; }
.tools button, .cluster button { background: var(--panel); border: 0; border-left: 3px solid var(--accent); padding: 6px 10px; font-size: 12px; letter-spacing: 0.12em; cursor: pointer; transition: all 100ms ease-out; display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
.tools button:hover:not(:disabled), .cluster button:hover { background: var(--accent); color: #090a0f; }
/* native button chrome off: iOS / some engines fade a disabled native button, which made REPLAY look see-through */
.tools button, .cluster button { -webkit-appearance: none; appearance: none; border-radius: 0; }
.tools button:disabled { opacity: 1; background-color: #0b0e17; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.045) 0 3px, transparent 3px 7px); color: #737c94; border-left-color: #3a4256; cursor: not-allowed; -webkit-text-fill-color: #737c94; }
.tools button:disabled b, .tools button:disabled .ic { color: #737c94; -webkit-text-fill-color: #737c94; }
.tools button b, .cluster button b { color: var(--accent-ink); font-weight: 700; }
.tools button:hover:not(:disabled) b, .cluster button:hover b { color: #090a0f; }
.tools button[aria-pressed='true'] b { color: var(--green); }
.tools .ic, .cluster .ic { font-family: var(--mono); font-size: 13px; }

/* ---------- right column: wind, then camera / technique (shown only while they apply) ---------- */
.rightcol { top: var(--pad); right: var(--pad); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cluster { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cluster button { position: relative; min-height: 44px; }
.cluster button b { max-width: 19ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-dot { position: absolute; top: -9px; right: -4px; background: var(--green); color: #090a0f; font-style: normal; font-size: 11px; letter-spacing: 0.1em; padding: 1px 6px; font-weight: 700; }
.new-dot[hidden] { display: none; }
.toast { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border-right: 3px solid var(--accent); padding: 4px 10px; font-size: 12px; letter-spacing: 0.14em; white-space: nowrap; opacity: 0; transition: opacity 160ms; pointer-events: none; }
.toast.on { opacity: 1; }
body[data-state='result'] .cluster, body[data-state='final'] .cluster, body.card-on .cluster { display: none; }
body:not([data-state='ready']) #btnTech { display: none; }

/* ---------- wind ---------- */
.wind { position: relative; display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 8px 14px 8px 10px; border-bottom: 3px solid var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%); padding-left: 18px; }
.wind svg { width: 54px; height: 54px; }
.wind .ring { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 4; }
.wind .arrow { fill: var(--accent); transition: transform 100ms ease-out; }
.wind-txt { display: grid; gap: 0; justify-items: start; }
.wind .kind { font-size: 12px; letter-spacing: 0.2em; color: var(--dim); font-weight: 500; }
.wind .kind.head { color: var(--green); }
.wind .kind.tail { color: var(--accent-ink); }
.wind b { font-size: 22px; line-height: 1.05; }
.wind .cross { font-size: 11px; color: var(--dim); }
.wind .wx { font-size: 11px; color: var(--accent-ink); letter-spacing: 0.04em; white-space: nowrap; }

/* ---------- meters ---------- */
.meters { left: var(--pad); bottom: var(--pad); width: min(430px, 46vw); display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: end; }
.meter, .nose { background: var(--panel); padding: 8px 12px 8px; border-left: 3px solid var(--accent); pointer-events: auto; }
.meter { grid-column: 1 / -1; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.meter-head { display: flex; gap: 10px; align-items: baseline; font-size: 12px; letter-spacing: 0.2em; }
.meter-head .pstate { margin-left: 2px; }
.meter-head b { font-size: 20px; margin-left: auto; letter-spacing: 0; }
.bar { position: relative; height: 16px; margin: 5px 0 4px; background: #151a29; border: 1px solid var(--line); }
.fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: linear-gradient(90deg, #ff8a1f, #ffd23f); }
.fill.full { background: linear-gradient(90deg, #35e07a, #b8ff7a); }
.fill.dizzy { background: repeating-linear-gradient(45deg, #ff4d4d 0 6px, #7a1f1f 6px 12px); }
/* the charge zones sit over the fill: SWEET (green bracket) and OVERCHARGE (red hatch) */
.zone { position: absolute; top: -1px; bottom: -1px; pointer-events: none; }
.zone.sweet { background: rgba(61, 255, 138, 0.22); border-left: 2px solid var(--green); border-right: 2px solid var(--green); }
.zone.over { background: repeating-linear-gradient(135deg, rgba(255, 77, 77, 0.5) 0 4px, rgba(255, 77, 77, 0.14) 4px 8px); }
.pstate { font-size: 11px; letter-spacing: 0.16em; color: var(--dim); font-weight: 600; }
.pstate.sweet { color: var(--green); }
.pstate.over { color: var(--red); animation: blink 0.25s steps(2) infinite; }
.meter-foot { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.16em; color: var(--dim); }
.meter-foot b { color: var(--ink); font-size: 13px; letter-spacing: 0; }
.dizzy { color: var(--red); font-weight: 700; animation: blink 0.25s steps(2) infinite; }
.nose { grid-column: 1 / -1; display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; padding: 4px 12px; }
.nose svg { width: 120px; height: 44px; }
.nose .ref { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.nose .disc { fill: #cfd6e6; }
.nose .rim { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.nose .arc { fill: none; stroke: var(--accent-ink); stroke-width: 1; }
.nose-txt { display: grid; gap: 1px; }
.nose-txt small { font-size: 11px; letter-spacing: 0.2em; color: var(--dim); }
.nose-txt b { font-size: 20px; line-height: 1; }
.nose-txt span { font-size: 11px; }
.nose-txt span.warn { color: var(--red); }
.nose-txt span.good { color: var(--green); }

/* ---------- dial ---------- */
.dial { right: var(--pad); bottom: var(--pad); width: 148px; display: grid; justify-items: center; gap: 3px; }
.dial svg { width: 148px; height: 148px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.dial-bg { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.dial .win, .howto .win { fill: rgba(61, 255, 138, 0.35); stroke: var(--green); stroke-width: 1.5; }
.dial .sec { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 3; }
.needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: square; }
.needle-dot { fill: var(--accent); stroke: var(--ink); stroke-width: 1.5; }
.dial-lab { font-size: 11px; line-height: 1; letter-spacing: 0.24em; color: var(--dim); background: var(--panel); padding: 3px 8px 3px 11px; border-bottom: 2px solid var(--accent); }
#dialState { position: absolute; bottom: 4px; font-size: 12px; background: var(--panel); padding: 1px 8px; letter-spacing: 0.1em; }
#dialState.in { color: var(--green); }
#dialState.perfect { color: #ffd23f; }
.dial.hot .win { fill: rgba(61, 255, 138, 0.55); stroke-width: 2.5; }
.dial.hot .dial-bg { stroke: var(--green); }
.dial.perfect .win { fill: rgba(255, 210, 63, 0.5); stroke: #ffd23f; }
.dial.perfect .needle-dot { fill: #ffd23f; }
#dialState.out { color: var(--accent-ink); }

/* ---------- hint chip ---------- */
.hint { left: calc(var(--pad) + min(430px, 46vw) + 16px); bottom: calc(var(--pad) + 4px); max-width: min(760px, calc(100vw - var(--pad) * 2 - min(430px, 46vw) - 148px - 32px)); background: var(--panel); border-bottom: 3px solid var(--accent); padding: 8px 18px; font-size: 14px; line-height: 1.3; letter-spacing: 0.06em; transition: opacity 100ms; }
.hint b { color: var(--accent-ink); }
.hint em { color: var(--green); font-style: normal; font-weight: 700; }
.hint i { display: inline-block; width: 1px; height: 12px; background: var(--line); margin: 0 10px; vertical-align: -1px; }
.hint.off { opacity: 0; }

/* ---------- lower third ---------- */
.lt { left: calc(var(--pad) + min(430px, 46vw) + 16px); right: calc(var(--pad) + 148px + 16px); bottom: calc(var(--pad) + 4px); display: grid; max-width: 760px; }
.lt[hidden] { display: none; }
.lt-tag { justify-self: start; background: var(--accent); color: #090a0f; font-size: 11px; font-weight: 700; letter-spacing: 0.22em; padding: 3px 14px 3px 10px; clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.lt p { margin: 0; background: var(--panel); border-bottom: 3px solid var(--accent); padding: 10px 16px 11px; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.22; letter-spacing: 0.02em; font-weight: 500; }
.lt.teaching .lt-tag { background: var(--green); }
.lt.teaching p { border-bottom-color: var(--green); }
.lt.pop { animation: ltIn 220ms cubic-bezier(0.2, 0.9, 0.2, 1); }
body.hint-on .lt { transform: translateY(-64px); }

/* Rookie: one action. The nose gauge, spin counter and nose hint appear only if you take the nose over (or play Pro). */
body[data-nose='auto'] .nose { display: none; }
body[data-mode='rookie'] .meter-foot, body[data-mode='rookie'] #hintPro { display: none; }
/* nothing to show until the first mark is on the board */
body[data-played='0'] .bug-body > div:nth-child(n + 2) { display: none; }
/* modal screens own the whole view */
body[data-state='start'] #hud, body[data-state='help'] #hud, body[data-state='board'] #hud, body[data-state='initials'] #hud, body[data-state='tech'] #hud { visibility: hidden; }
#btnBoard2, #btnShare { display: none; }
body[data-state='final'] #btnBoard2, body[data-state='final'] #btnShare { display: inline-flex; align-items: center; justify-content: center; }
body[data-state='final'] #btnReplay2 { display: none; }
#btnShare .sm { display: none; }
body[data-state='result'] .meters, body[data-state='final'] .meters, body[data-state='replay'] .meters,
body[data-state='result'] .dial, body[data-state='final'] .dial, body[data-state='replay'] .dial { display: none; }
body[data-state='result'] .lt, body[data-state='final'] .lt, body[data-state='replay'] .lt { left: var(--pad); right: var(--pad); max-width: 760px; }

/* ---------- flash ---------- */
#flash { left: 50%; top: 24%; transform: translate(-50%, -50%); font-weight: 700; font-size: clamp(40px, 8vw, 104px); letter-spacing: 0.04em; line-height: 0.95; text-align: center; text-transform: uppercase; color: var(--ink); text-shadow: 0 5px 0 rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 138, 31, 0.55); white-space: nowrap; }
#flash[hidden] { display: none; }
#flash small { display: block; font-size: 0.32em; letter-spacing: 0.22em; color: #fff; margin-top: 6px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.95), 0 0 22px rgba(0, 0, 0, 0.8); }
#flash.foul { color: var(--red); text-shadow: 0 5px 0 rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 77, 77, 0.5); }
#flash.good { color: var(--green); }
#flash.perfect { color: #ffd23f; text-shadow: 0 5px 0 rgba(0, 0, 0, 0.6), 0 0 46px rgba(255, 210, 63, 0.75); letter-spacing: 0.1em; }
#flash.show { animation: flashIn 1.4s cubic-bezier(0.2, 0.9, 0.2, 1) forwards; }

/* ---------- result ---------- */
#result { right: var(--pad); width: min(380px, calc(100vw - 2 * var(--pad))); top: calc(var(--pad) + 98px); background: var(--panel); border-top: 4px solid var(--accent); padding: 12px 18px 16px; pointer-events: none; animation: slideIn 260ms cubic-bezier(0.2, 0.9, 0.2, 1); }
#result[hidden] { display: none; }
#result button { pointer-events: auto; }
.res-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag { white-space: nowrap; background: var(--accent); color: #090a0f; font-weight: 700; font-size: 11px; letter-spacing: 0.2em; padding: 2px 10px; }
.rank { min-width: 0; line-height: 1.1; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); text-align: right; }
.res-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.big { font-size: clamp(54px, 7vw, 82px); line-height: 1; letter-spacing: -0.05em; }
.unit { font-size: 26px; font-weight: 700; color: var(--accent-ink); }
.feet { font-size: 15px; color: var(--dim); margin-left: auto; }
#result.foul { border-top-color: var(--red); }
#result.foul .big { color: var(--red); font-family: var(--display); letter-spacing: 0.02em; }
#result.foul .unit { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chips span { background: #1d2335; border-left: 3px solid var(--accent); font-size: 12px; letter-spacing: 0.1em; padding: 2px 8px; font-weight: 600; }
.chips span b { color: var(--accent-ink); font-family: var(--mono); }
.chips span.total { background: var(--accent); color: #090a0f; border-left-color: #fff; }
.chips span.total b { color: #090a0f; }
.chips span.rival { border-left-color: var(--accent-ink); }
.chips span.rival.win { border-left-color: var(--green); }
.chips span.rival.win b { color: var(--green); }
.chips.final-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.chips.final-grid span { text-align: center; padding: 4px 6px; white-space: nowrap; }
.chips.final-grid span.total, .chips.final-grid span.rival { grid-column: 1 / -1; text-align: left; }
.coach { margin: 8px 0 0; font-size: 14px; line-height: 1.25; font-weight: 600; letter-spacing: 0.02em; color: #fff; background: #1d2335; border-left: 3px solid var(--accent-ink); padding: 5px 10px; }
.coach[hidden] { display: none; }
.res-stats { display: grid; grid-template-columns: 1fr; gap: 3px; margin: 10px 0 0; font-size: 11px; letter-spacing: 0.14em; }
.res-stats div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.res-stats dt { color: var(--dim); }
.res-stats dd { margin: 0; font-family: var(--mono); font-weight: 700; letter-spacing: 0; font-size: 12px; }
.res-stats dd.up { color: var(--green); }
.res-stats dd.down { color: var(--red); }
.note { margin: 10px 0 0; font-size: 13px; line-height: 1.3; color: var(--ink); border-left: 3px solid var(--green); padding-left: 10px; letter-spacing: 0.02em; font-weight: 500; }
.note:empty { display: none; }
.res-actions { display: flex; gap: 8px; margin-top: 12px; }
.res-actions .swap { flex: 0 0 48px; width: 48px; padding: 0; font-size: 20px; line-height: 1; }
.res-actions .primary { flex: 1 1 auto; }
body[data-state='final'] #btnSwap { display: none; }
.details { display: none; }
.details i { width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform 120ms ease-out; }
.details[aria-expanded='true'] i { transform: translateY(1px) rotate(-135deg); }
.res-actions button, .primary { background: #1b2133; border: 1px solid var(--line); padding: 9px 14px; font-weight: 700; letter-spacing: 0.12em; font-size: 14px; cursor: pointer; transition: all 100ms ease-out; min-height: 44px; }
.res-actions button:hover, .primary:hover { background: var(--ink); color: #090a0f; border-color: var(--ink); }
.res-actions .primary, .primary { background: var(--accent); color: #090a0f; border-color: var(--accent); }
.res-actions .primary:hover, .primary:hover { background: var(--ink); }
.primary kbd { color: #090a0f; margin-left: 6px; }

/* ---------- replay tag ---------- */
/* broadcast replay bug: sits just inside the top letterbox bar */
#replayTag { top: calc(var(--bar) + 14px); left: var(--pad); display: flex; align-items: stretch; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)); }
#replayTag[hidden] { display: none; }
#replayTag b { background: #e8202a; color: #fff; font-size: 18px; letter-spacing: 0.2em; padding: 5px 14px 5px 12px; font-weight: 700; }
#replayTag .num { background: var(--panel); color: var(--ink); font-size: 13px; letter-spacing: 0.02em; padding: 0 14px; display: flex; align-items: center; border-bottom: 3px solid #e8202a; }
#replayTag i { width: 8px; align-self: stretch; background: #e8202a; animation: blink 0.8s steps(2) infinite; }

/* ---------- howto overlay ---------- */
.howto { position: fixed; inset: 0; display: grid; place-items: center; padding: 12px; background: radial-gradient(ellipse at 50% 40%, rgba(6, 8, 15, 0.55), rgba(6, 8, 15, 0.93)); z-index: 5; }
.howto[hidden] { display: none; }
.howto-card { width: min(900px, 100%); max-height: 100%; overflow: auto; padding: clamp(14px, 3vw, 30px); background: var(--panel-2); border-top: 5px solid var(--accent); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.howto-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(14px, 3vw, 32px); align-items: stretch; }
.howto-title { display: grid; gap: 10px; align-content: space-between; }
.rules { background: #0d1120; border-left: 3px solid var(--green); padding: 10px 14px 12px; display: grid; gap: 8px; align-content: start; }
.rules h2 { margin: 0; font-size: 13px; letter-spacing: 0.24em; color: var(--green); font-weight: 700; }
.rules dl { margin: 0; display: grid; gap: 6px; }
.rules dl div { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.rules dl div:last-child { border-bottom: 0; padding-bottom: 0; }
.rules dt { font-size: 11px; letter-spacing: 0.18em; color: var(--dim); }
.rules dd { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: 0.02em; color: #e6ecfa; }
.howto h1 { margin: 0; font-size: clamp(40px, 8vw, 84px); line-height: 0.88; letter-spacing: 0.01em; text-transform: uppercase; }
.howto h1 em { font-style: normal; color: var(--accent); }
.howto .sub { margin: 0; color: var(--dim); font-size: 15px; letter-spacing: 0.08em; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: stretch; }
.steps li { background: #0d1120; padding: 10px 12px 12px; display: grid; grid-template-rows: auto auto 1fr; gap: 6px; align-content: start; border-left: 3px solid var(--accent); }
.steps b { font-size: 17px; letter-spacing: 0.08em; }
.steps span { font-size: 14px; line-height: 1.35; color: #d3dbee; font-weight: 400; letter-spacing: 0.02em; }
.anim { height: 92px; position: relative; display: grid; place-items: center; overflow: hidden; background: #070a14; }
.anim svg { height: 88px; width: auto; }
.a1 .finger { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px rgba(244, 248, 255, 0.25); animation: press 2.4s ease-in-out infinite; z-index: 2; }
.a1 .ringp { position: absolute; width: 74px; height: 74px; border-radius: 50%; border: 4px solid #1b2133; border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.a1 .spinner { position: absolute; bottom: 6px; left: 12%; height: 6px; background: var(--accent); animation: fillbar 2.4s ease-in-out infinite; }
.needle-anim { animation: sweep 1.6s linear infinite; }
.a2 .dial-bg, .a2 .win { stroke-width: 1.5; }
.a3 .ref { stroke: var(--line); stroke-dasharray: 3 3; }
.a3 .disc { fill: #cfd6e6; stroke: var(--accent); stroke-width: 1.5; }
.a3 .tilt { animation: tilt 2.6s ease-in-out infinite; }
.howto-foot { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.warn { margin: 0; font-size: 14px; color: var(--accent-ink); letter-spacing: 0.05em; }
.big-btn { font-size: 20px; padding: 12px 26px; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding-right: 36px; }

/* ---------- start screen, initials, board ---------- */
.overlay { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; }
.overlay[hidden] { display: none; }
#initials, #board { background: radial-gradient(ellipse at 50% 40%, rgba(6, 8, 15, 0.72), rgba(6, 8, 15, 0.95)); }
.overlay button { cursor: pointer; transition: all 100ms ease-out; }
.overlay .primary kbd { color: #090a0f; margin-left: 6px; }
.start { place-items: center end; padding: 20px clamp(14px, 6vw, 96px); background: linear-gradient(90deg, rgba(6, 8, 15, 0) 0%, rgba(6, 8, 15, 0.2) 40%, rgba(6, 8, 15, 0.82) 100%); }
.start-card { --char: var(--accent); position: relative; width: min(420px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 12px; padding: 22px 24px 24px; background: var(--panel-2); border-top: 5px solid var(--char); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.start h1 { margin: 0; font-size: clamp(44px, 6vw, 64px); line-height: 0.88; letter-spacing: 0.01em; text-transform: uppercase; padding-right: 48px; }
.start h1 em { font-style: normal; color: var(--accent); }
.start .sub { margin: -2px 0 0; color: var(--dim); font-size: 15px; letter-spacing: 0.06em; }
.icon-btn { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; background: #1b2133; border: 1px solid var(--line); font-family: var(--mono); font-weight: 700; font-size: 18px; }
.icon-btn:hover { background: var(--ink); color: #090a0f; }
.carousel { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 10px; align-items: center; background: #0d1120; border-left: 3px solid var(--char); padding: 8px 8px 8px 10px; }
.arrow { width: 44px; height: 44px; padding: 0 0 4px; background: #1b2133; border: 1px solid var(--line); font-size: 30px; line-height: 1; font-weight: 500; }
.arrow:hover { background: var(--char); color: #090a0f; border-color: var(--char); }
.char { display: grid; gap: 2px; min-width: 0; text-align: center; }
.char-role { display: inline-flex; justify-content: center; align-items: center; gap: 6px; font-size: 12px; letter-spacing: 0.16em; color: var(--dim); font-weight: 500; }
.char-role i { width: 10px; height: 10px; background: var(--char); transform: skewX(-18deg); flex: none; }
.char-role small { font-size: 11px; font-family: var(--mono); letter-spacing: 0; color: var(--dim); }
.char b { font-size: 36px; line-height: 1; letter-spacing: 0.04em; color: var(--char); }
.char-blurb { font-size: 14px; line-height: 1.25; color: #d3dbee; font-weight: 400; letter-spacing: 0.02em; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); }
.seg button { min-height: 44px; background: #111627; border: 0; font-weight: 700; letter-spacing: 0.16em; font-size: 15px; color: var(--dim); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked='true'] { background: var(--accent); color: #090a0f; }
.seg button:hover:not([aria-checked='true']) { background: #1b2133; color: var(--ink); }
.mode-blurb { margin: -4px 0 0; font-size: 13px; color: var(--dim); letter-spacing: 0.04em; min-height: 1.2em; }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.setup-btn { min-height: 48px; padding: 4px 10px; text-align: left; background: #111627; border: 1px solid var(--line); border-left: 3px solid var(--char); display: grid; align-content: center; gap: 0; min-width: 0; }
.setup-btn small { font-size: 11px; letter-spacing: 0.18em; color: var(--dim); font-weight: 500; line-height: 1.2; }
.setup-btn b { font-size: 15px; letter-spacing: 0.06em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-btn:hover { background: #1b2133; }
.start-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.start-actions .big-btn { width: 100%; font-size: 22px; padding: 12px 20px 12px 24px; }
.board-btn { position: relative; min-height: 52px; padding: 0 22px; background: #1b2133; border: 1px solid var(--line); font-weight: 700; letter-spacing: 0.14em; font-size: 16px; }
.board-btn:hover { background: var(--ink); color: #090a0f; border-color: var(--ink); }
.daily-dot { position: absolute; top: -9px; right: -6px; background: var(--green); color: #090a0f; font-style: normal; font-size: 11px; letter-spacing: 0.1em; padding: 1px 6px; font-weight: 700; }
.daily-dot[hidden] { display: none; }

.ini-card, .board-card { width: min(440px, 100%); max-height: 100%; background: var(--panel-2); border-top: 5px solid var(--accent); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 20px 22px 22px; display: grid; gap: 10px; text-align: center; }
.kicker { margin: 0; font-size: 13px; letter-spacing: 0.3em; color: #ffd23f; font-weight: 700; }
.ini-card h2 { margin: 0; font-size: 20px; color: var(--accent-ink); line-height: 1; }
.ini-card h2 b { font-size: 60px; color: var(--ink); letter-spacing: -0.04em; }
.ini-sub { margin: 0; font-size: 12px; letter-spacing: 0.16em; color: var(--dim); }
.wheels { display: flex; justify-content: center; gap: 12px; margin: 4px 0; }
.wheel { display: grid; grid-template-rows: 44px auto 44px; gap: 4px; justify-items: center; }
.wheel button { width: 64px; height: 44px; background: #1b2133; border: 1px solid var(--line); font-size: 16px; }
.wheel button:hover { background: var(--ink); color: #090a0f; }
.letter { display: grid; place-items: center; width: 64px; height: 72px; font-size: 54px; line-height: 1; background: #0d1120; border-bottom: 4px solid var(--line); color: var(--ink); }
.wheel.on .letter { border-bottom-color: #ffd23f; color: #ffd23f; }
.ini-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-top: 4px; }
.ini-actions button, .board-foot button { min-height: 48px; background: #1b2133; border: 1px solid var(--line); font-weight: 700; letter-spacing: 0.12em; font-size: 15px; }
.ini-actions .primary, .board-foot .primary { background: var(--accent); color: #090a0f; border-color: var(--accent); }
.ini-actions button:hover, .board-foot button:hover { background: var(--ink); color: #090a0f; border-color: var(--ink); }

.board-card { width: min(560px, 100%); grid-template-rows: auto auto minmax(0, 1fr) auto; text-align: left; overflow: hidden; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.board-head h2 { margin: 0; font-size: 30px; letter-spacing: 0.04em; line-height: 1; }
.tabs { display: flex; border: 1px solid var(--line); }
.tabs button { min-height: 44px; padding: 0 16px; background: #111627; border: 0; color: var(--dim); font-weight: 700; letter-spacing: 0.14em; font-size: 14px; }
.tabs button + button { border-left: 1px solid var(--line); }
.tabs button[aria-selected='true'] { background: var(--accent); color: #090a0f; }
.board-sub { margin: 0; font-size: 12px; letter-spacing: 0.1em; color: var(--dim); }
.board-list { overflow: auto; min-height: 0; border-top: 1px solid var(--line); }
.brow { display: grid; grid-template-columns: 26px 44px 54px minmax(0, 1fr) 62px 48px; gap: 8px; align-items: center; min-height: 30px; padding: 0 6px; border-bottom: 1px solid rgba(244, 248, 255, 0.1); font-size: 13px; }
.brow.head { min-height: 22px; font-size: 11px; letter-spacing: 0.14em; color: var(--dim); position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.brow .rk { color: var(--dim); }
.brow .in { color: var(--ink); letter-spacing: 0.08em; }
.brow .mk { color: var(--accent-ink); font-size: 15px; text-align: right; }
.brow .ch { display: flex; gap: 6px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.04em; }
.brow .ch i { width: 8px; height: 8px; flex: none; transform: skewX(-18deg); }
.brow .md { font-size: 11px; letter-spacing: 0.1em; font-weight: 700; color: var(--dim); }
.brow .md.pro { color: var(--red); }
.brow .dt { font-size: 12px; color: var(--dim); text-align: right; }
.brow.npc .in { color: var(--dim); }
.brow.you { background: rgba(255, 210, 63, 0.16); box-shadow: inset 3px 0 0 #ffd23f; }
.brow.you .in, .brow.you .rk { color: #ffd23f; }
.board-foot { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.board-foot .primary[hidden] { display: none; }
.board-foot .primary[hidden] + button { grid-column: 1 / -1; }


/* ---------- technique picker ---------- */
.tech { place-items: center end; padding: 20px clamp(14px, 4vw, 70px); background: linear-gradient(90deg, rgba(6, 8, 15, 0) 0%, rgba(6, 8, 15, 0.18) 42%, rgba(6, 8, 15, 0.82) 100%); }
.tech-card { --char: var(--accent); width: min(470px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 10px; padding: 16px 18px 18px; background: var(--panel-2); border-top: 5px solid var(--char); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tech-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tech-head h2 { margin: 0; font-size: 26px; line-height: 1; letter-spacing: 0.06em; }
.tech-ath { display: grid; grid-template-columns: 44px minmax(0, auto) 44px; align-items: center; gap: 6px; }
.tech-ath b { font-size: 20px; letter-spacing: 0.06em; color: var(--char); text-align: center; min-width: 5.5ch; }
.tech-list { display: grid; gap: 6px; }
.tc { display: grid; grid-template-columns: minmax(0, 1fr) 96px; grid-template-rows: auto auto; align-items: center; gap: 1px 10px; min-height: 62px; padding: 7px 10px 7px 12px; text-align: left; background: #0d1120; border: 1px solid var(--line); border-left: 4px solid #2a3042; }
.tc:hover { background: #151c31; }
.tc[aria-checked='true'] { background: #172037; border-color: var(--char); border-left-width: 4px; }
.tc-name { font-size: 18px; font-weight: 700; letter-spacing: 0.05em; line-height: 1.1; align-self: end; }
.tc-tags { display: flex; gap: 6px; font-size: 11px; letter-spacing: 0.12em; font-style: normal; align-self: start; flex-wrap: wrap; }
.tc-tags i { font-style: normal; font-weight: 600; }
.up { color: var(--green); }
.dn { color: var(--red); }
.tc-arc { grid-column: 2; grid-row: 1 / span 2; width: 96px; height: 46px; }
.tc-arc .ground { stroke: var(--line); stroke-width: 1; }
.tc-arc .path { fill: none; stroke: var(--dim); stroke-width: 1.6; stroke-dasharray: 3 3; }
.tc[aria-checked='true'] .tc-arc .path { stroke: var(--char); stroke-dasharray: none; }
.tc-arc .dot { fill: var(--ink); }
.tech-info { margin: 0; display: grid; gap: 3px; font-size: 13px; line-height: 1.3; color: #d3dbee; letter-spacing: 0.02em; min-height: 3.6em; align-content: start; }
.tech-info .num { font-size: 11px; color: var(--dim); letter-spacing: 0; font-weight: 500; }
.tech-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.linkbtn { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent-ink); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-decoration: underline; text-underline-offset: 4px; }
.linkbtn:hover { color: var(--ink); }
#techDone { min-height: 48px; padding: 8px 22px 8px 26px; font-size: 17px; }

/* ---------- animations ---------- */
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes ltIn { from { transform: translateY(14px); opacity: 0; } to { opacity: 1; } }
body.hint-on .lt.pop { animation-name: ltInHint; }
@keyframes ltInHint { from { transform: translateY(-48px); opacity: 0; } to { transform: translateY(-64px); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flashIn { 0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 78% { opacity: 1; } 100% { transform: translate(-50%, -62%) scale(0.98); opacity: 0; } }
@keyframes press { 0%, 12% { transform: translateY(18px) scale(1.15); } 22%, 80% { transform: translateY(0) scale(0.9); } 92%, 100% { transform: translateY(18px) scale(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fillbar { 0% { width: 0; } 80%, 100% { width: 76%; } }
@keyframes sweep { from { transform: rotate(-150deg); } to { transform: rotate(210deg); } }
@keyframes tilt { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(-30deg); } }

/* ---------- mobile portrait / narrow ---------- */
@media (max-width: 860px) {
  .lt { left: var(--pad); right: var(--pad); bottom: 218px; max-width: none; }
  body.hint-on .lt { transform: none; }
  .hint { left: var(--pad); right: var(--pad); top: calc(var(--pad) + 106px); bottom: auto; max-width: none; font-size: 12px; padding: 6px 8px; text-align: center; }
  .hint i { margin: 0 5px; }
  .meters { width: calc(100vw - 126px - 3 * var(--pad)); grid-template-columns: 1fr; }
  .nose { grid-template-columns: 1fr; padding: 4px 10px; }
  .nose-txt .rel { display: none; }
  .nose svg { width: 100%; height: 38px; }
  .nose-txt { grid-auto-flow: column; justify-content: space-between; align-items: baseline; }
  .dial { width: 126px; }
  .dial svg { width: 126px; height: 126px; }
  .bug-body { gap: 9px; padding: 3px 10px 3px 12px; }
  .bug-body dd { font-size: 15px; }
  .bug-body dt { font-size: 11px; letter-spacing: 0.08em; }
  #attemptTxt { display: none; }
  .bug .mult { display: none; } /* the multiplier also flashes on screen; the phone scorebug has no room for it */
  .pips i { width: 8px; height: 8px; }
  .bug-logo { font-size: 11px; padding: 3px 12px 3px 8px; }
  .bug-logo span:last-child { font-size: 14px; }
  .wind { padding: 3px 8px 3px 14px; gap: 4px; }
  .wind svg { width: 30px; height: 30px; }
  .rightcol { gap: 6px; }
  .cluster .lbl, .cluster button b { display: none; }
  .cluster .ic { font-size: 18px; }
  .cluster button { padding: 0; min-height: 44px; min-width: 44px; justify-content: center; }
  .toast { top: 50%; right: calc(100% + 6px); transform: translateY(-50%); }
  .tech-head h2 { font-size: 22px; }
  .tech-list { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tc { grid-template-columns: 1fr; grid-template-rows: auto; min-height: 48px; padding: 6px 8px 6px 10px; }
  .tc-name { font-size: 16px; align-self: center; }
  .tc-tags, .tc-arc { display: none; }
  .tc:last-child { grid-column: 1 / -1; }
  .tech-info { font-size: 12px; min-height: 0; }
  .wind b { font-size: 15px; }
  .wind .kind { font-size: 11px; letter-spacing: 0.08em; }
  .wind .cross { display: none; }
  .wind .wxn { display: none; }
  .tools { top: calc(var(--pad) + 57px); gap: 4px; }
  .tools button { padding: 4px 9px; font-size: 11px; min-height: 44px; min-width: 44px; justify-content: center; letter-spacing: 0.06em; }
  #result { top: calc(var(--pad) + 98px); right: var(--pad); left: var(--pad); width: auto; padding: 8px 12px 10px; }
  .big { font-size: 52px; }
  .res-stats { font-size: 11px; gap: 2px 10px; }
  .res-stats dd { font-size: 11px; }
  .note { font-size: 12px; margin-top: 6px; }
  .res-actions { margin-top: 8px; }
  .res-actions button { min-height: 44px; padding: 6px 10px; font-size: 13px; }
  .howto-head { grid-template-columns: 1fr; gap: 10px; }
  .howto-title { gap: 4px; }
  .rules { padding: 8px 12px 10px; }
  .rules dl { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .rules dl div { grid-template-columns: 1fr; gap: 0; border-bottom: 0; padding-bottom: 0; }
  .rules dd { font-size: 13px; }
  .steps { grid-template-columns: 1fr; gap: 6px; }
  .steps li { grid-template-columns: 86px 1fr; grid-template-rows: auto 1fr; column-gap: 10px; row-gap: 2px; }
  .steps li .anim { grid-row: span 2; height: 72px; }
  .anim svg { height: 70px; }
  .howto-foot { justify-content: center; }
  .big-btn { width: 100%; justify-content: center; }
  #replayTag { top: calc(var(--bar) + 10px); }
  #replayTag b { font-size: 14px; padding: 4px 10px; }
  #flash { top: 30%; }
}

/* ---------- portrait phone: the result is a bottom sheet (stat row + details toggle) so the landing stays visible ---------- */
@media (max-width: 860px) and (orientation: portrait) {
  #result { top: auto; bottom: var(--pad); left: var(--pad); right: var(--pad); width: auto; max-height: min(62vh, 520px); overflow: auto; padding: 8px 12px 0; animation-name: sheetIn; }
  #result .res-main { margin-top: 2px; }
  .big { font-size: 48px; }
  .unit { font-size: 22px; }
  .chips { margin-top: 4px; }
  .res-stats, .note { display: none; }
  #result.open .res-stats { display: grid; }
  #result.open .note:not(:empty) { display: block; }
  .res-actions { position: sticky; bottom: 0; background: var(--panel); margin: 8px -12px 0; padding: 6px 12px 10px; gap: 6px; }
  .res-actions button { flex: 1 1 0; padding: 4px 6px; }
  .res-actions .primary { flex: 1.5 1 0; }
  .res-actions .primary kbd { display: none; }
  .res-actions .details { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 6px; padding: 4px 10px; }
  body[data-state='result'] .lt, body[data-state='final'] .lt { top: calc(var(--pad) + 98px); bottom: auto; }
  body[data-state='result'] .lt-tag, body[data-state='final'] .lt-tag, body[data-state='replay'] .lt-tag { display: none; }
  body[data-state='result'] .hint, body[data-state='final'] .hint, body[data-state='replay'] .hint { display: none; }
  #replayTag { top: calc(var(--bar) + 10px); }
}
@media (max-width: 860px) and (orientation: portrait) {
  .cluster { position: fixed; top: calc(var(--pad) + 176px); right: var(--pad); }
  .tech { place-items: end center; padding: 0; background: linear-gradient(180deg, rgba(6, 8, 15, 0) 0%, rgba(6, 8, 15, 0.1) 40%, rgba(6, 8, 15, 0.6) 100%); }
  .tech-card { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .start { place-items: end center; padding: 0; background: linear-gradient(180deg, rgba(6, 8, 15, 0) 0%, rgba(6, 8, 15, 0.1) 40%, rgba(6, 8, 15, 0.6) 100%); }
  .start-card { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; padding: 16px 16px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  .start h1 { font-size: 46px; }
  .board-card, .ini-card { padding: 16px 14px 16px; }
  .brow { grid-template-columns: 22px 40px 48px minmax(0, 1fr) 56px 44px; gap: 6px; padding: 0 2px; }
  #btnShare .lg { display: none; }
  #btnShare .sm { display: inline; }
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- landscape phone (short + wide): left meter column, right result panel ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --pad: 8px; }
  .bug-body { gap: 10px; padding: 3px 10px 3px 12px; }
  .bug-body dd { font-size: 15px; }
  .bug-body dt { font-size: 11px; letter-spacing: 0.08em; }
  #attemptTxt { display: none; }
  .pips i { width: 8px; height: 8px; }
  .bug-logo { font-size: 11px; padding: 3px 12px 3px 8px; }
  .bug-logo span:last-child { font-size: 14px; }
  .wind { padding: 3px 8px 3px 14px; gap: 6px; }
  .wind svg { width: 32px; height: 32px; }
  .wind b { font-size: 15px; }
  .wind .kind { font-size: 11px; letter-spacing: 0.08em; }
  .wind .cross { display: none; }
  .tools { top: var(--pad); left: 292px; right: 150px; flex-wrap: wrap; gap: 4px; }
  .tools button { padding: 4px 10px; font-size: 11px; min-height: 44px; min-width: 44px; justify-content: center; letter-spacing: 0.06em; }

  /* left column ~220px: power + nose */
  .meters { left: var(--pad); bottom: var(--pad); width: 220px; grid-template-columns: 1fr; gap: 6px; }
  .meter { padding: 5px 10px 6px; }
  .meter-head b { font-size: 17px; }
  .bar { height: 14px; margin: 3px 0; }
  .nose { grid-template-columns: 84px 1fr; padding: 3px 10px; gap: 6px; }
  .nose svg { width: 84px; height: 32px; }
  .nose-txt { grid-auto-flow: row; justify-content: stretch; align-items: start; }
  .nose-txt b { font-size: 17px; }
  /* dial right */
  .dial { width: 112px; right: var(--pad); bottom: var(--pad); }
  .dial svg { width: 112px; height: 112px; }
  /* hint + announcer stack in the centre column between meters and dial */
  .hint { left: calc(var(--pad) + 220px + 12px); right: calc(var(--pad) + 112px + 12px); top: auto; bottom: var(--pad); max-width: none; text-align: left; font-size: 12px; padding: 5px 10px; }
  .lt { left: calc(var(--pad) + 220px + 12px); right: calc(var(--pad) + 112px + 12px); bottom: var(--pad); max-width: none; }
  body.hint-on .lt { transform: translateY(-62px); }
  body.hint-on .lt.pop { animation-name: ltIn; }
  .lt p { font-size: 13px; padding: 6px 12px 7px; }
  .lt-tag { padding: 2px 12px 2px 8px; }
  #flash { top: 24%; font-size: clamp(30px, 10vh, 56px); }
  #replayTag { top: calc(var(--bar) + 8px); }
  #replayTag b { font-size: 14px; padding: 4px 10px; }

  /* result / final: compact right-hand panel; everything that would sit on top of it steps aside */
  #result { top: calc(var(--pad) + 50px); right: var(--pad); left: auto; width: min(300px, 40vw); max-height: calc(100vh - var(--pad) * 2 - 50px); overflow: auto; padding: 8px 12px 10px; border-top-width: 3px; }
  .big { font-size: 44px; }
  .unit { font-size: 20px; }
  .feet { font-size: 13px; }
  .chips { margin-top: 4px; }
  .res-stats { margin-top: 6px; gap: 2px; }
  .res-actions { margin-top: 8px; }
  .res-actions button { min-height: 44px; flex: 1; padding: 4px 8px; }
  .note { font-size: 12px; margin-top: 6px; line-height: 1.25; }
  body[data-state='result'] .hint, body[data-state='final'] .hint, body[data-state='replay'] .hint { display: none; }
  body[data-state='result'] .lt-tag, body[data-state='final'] .lt-tag, body[data-state='replay'] .lt-tag { display: none; }
  body[data-state='result'] .meters, body[data-state='final'] .meters, body[data-state='result'] .dial, body[data-state='final'] .dial { display: none; }
  body[data-state='result'] .lt, body[data-state='final'] .lt { left: var(--pad); right: calc(var(--pad) + min(300px, 40vw) + 12px); transform: none; }

  /* how-to: three columns, no animations, compact header */
  .howto-card { padding: 10px 16px 12px; gap: 8px; }
  .howto h1 { font-size: 34px; line-height: 0.9; }
  .howto h1 br { display: none; }
  .howto-title { align-content: center; }
  .howto .sub { font-size: 13px; }
  .howto-head { grid-template-columns: 1fr 1fr; gap: 14px; }
  .rules { padding: 6px 10px 8px; gap: 4px; }
  .rules dl { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .rules dl div { grid-template-columns: 1fr; gap: 0; border-bottom: 0; padding-bottom: 0; }
  .rules dd { font-size: 12px; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .steps li, .steps li:nth-child(n) { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .steps li .anim { display: none; }
  .steps span { font-size: 12px; }
  .howto-foot { justify-content: space-between; }
  .warn { font-size: 12px; }
  .big-btn { width: auto; padding: 8px 22px 8px 18px; font-size: 17px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .start { padding: 8px 14px; }
  .start-card { width: min(350px, 54vw); padding: 10px 14px 12px; gap: 8px; }
  .start h1 { font-size: 30px; line-height: 0.95; padding-right: 50px; }
  .start .sub { font-size: 12px; margin: 0; }
  .icon-btn { top: 6px; right: 6px; }
  .carousel { padding: 4px 6px 4px 8px; }
  .char b { font-size: 24px; }
  .char-blurb, .mode-blurb { display: none; }
  .start-actions .big-btn { font-size: 19px; padding: 8px 14px 8px 18px; }
  .board-btn { min-height: 48px; }
  .overlay .primary kbd { display: none; }
  .ini-card, .board-card { padding: 10px 16px 12px; gap: 6px; }
  .ini-card h2 b { font-size: 40px; }
  .kicker { font-size: 12px; }
  .wheel { gap: 2px; }
  .letter { height: 52px; font-size: 42px; }
  .board-head h2 { font-size: 22px; }
  .board-sub { display: none; }
  .brow { min-height: 22px; font-size: 12px; }
  .brow .mk { font-size: 13px; }
  .brow.head { min-height: 18px; }
  .tech { padding: 8px 14px; }
  .tech-card { width: min(372px, 56vw); padding: 8px 12px 10px; gap: 6px; border-top-width: 4px; }
  .tech-head h2 { font-size: 20px; }
  .tech-ath b { font-size: 16px; }
  .tech-info .num { display: none; }
  .tech-info { min-height: 0; font-size: 12px; gap: 1px; }
  #techDone { min-height: 44px; padding: 6px 16px 6px 18px; font-size: 16px; }
  .res-actions .primary kbd { display: none; }
  #btnShare .lg { display: none; }
  #btnShare .sm { display: inline; }
  .coach { font-size: 12px; margin-top: 4px; padding: 3px 8px; }
}
/* ---------- very short landscape (667x375, 844x390): one tool row, compact result card with a pinned footer ---------- */
@media (orientation: landscape) and (max-height: 400px) {
  .tools { flex-wrap: nowrap; }
  #result { top: calc(var(--pad) + 54px); width: min(320px, 46vw); max-height: calc(100vh - var(--pad) * 2 - 54px); padding: 6px 12px 0; }
  .wind .wx { font-size: 11px; line-height: 1.05; }
  .wind b { line-height: 1; }
  .chips .who { display: none; }
  #result .note { display: none; }
  .res-top { gap: 6px; }
  .rank { font-size: 13px; letter-spacing: 0.04em; }
  .big { font-size: 40px; }
  .res-stats { margin-top: 4px; gap: 1px; }
  .res-actions { position: sticky; bottom: 0; z-index: 1; background: var(--panel); margin: 6px -12px 0; padding: 6px 12px 8px; }
  #flash { top: 26%; }
}
/* icon-only toolbar when the label row would not fit beside the scorebug and wind (still 44x44 touch targets) */
@media (orientation: landscape) and (max-height: 400px) and (max-width: 760px) {
  .tools { left: 268px; right: auto; }
  .tools button { padding: 0; }
  .tools .lbl, .tools button b { display: none; }
  .tools .ic { font-size: 18px; }
  .tools button[aria-pressed='true'] .ic { color: var(--green); }
  .tools button[aria-pressed='false'] .ic { color: var(--accent-ink); }
  .tools button:hover:not(:disabled) .ic { color: #090a0f; }
  .lt p { font-size: 12px; }
}
@media (max-height: 560px) and (min-width: 861px) and (min-aspect-ratio: 5/2) {
  .howto .sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .a1 .finger { transform: none; }
}

/* ---------- cinematic layer: walk-out + replay ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.cine { --bar: min(9vh, 11vw); }
.bars { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.bars i { position: absolute; left: 0; right: 0; height: min(9vh, 11vw); background: #000; transform: scaleY(0); transition: transform 520ms var(--cine-ease); }
.bars i:first-child { top: 0; transform-origin: top; }
.bars i:last-child { bottom: 0; transform-origin: bottom; }
body.cine .bars i { transform: scaleY(1); }
/* the HUD steps aside for the walk-out and comes back with the throwing camera */
#hud { transition: opacity 380ms var(--cine-ease); }
body[data-state='walkout'] #hud { opacity: 0; }
body[data-state='walkout'] #hud * { pointer-events: none !important; }
body[data-state='replay'] .tools, body[data-state='replay'] .rightcol, body[data-state='replay'] .bug { opacity: 0; pointer-events: none; }
.walk { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.walk[hidden] { display: none; }
.namecard { --char: var(--accent); position: absolute; left: calc(var(--pad) + 6px); bottom: calc(var(--bar) + 22px); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0; align-items: stretch; max-width: min(560px, calc(100vw - var(--pad) * 2 - 12px)); opacity: 0; transform: translateX(-26px); transition: opacity 360ms var(--cine-ease), transform 520ms var(--cine-ease); filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.4)); }
.namecard.on { opacity: 1; transform: none; }
.nc-num { grid-row: 1 / span 2; background: var(--char); color: #090a0f; font-size: clamp(34px, 4.2vw, 58px); padding: 0 16px; display: flex; align-items: center; justify-content: center; min-width: 2.1em; letter-spacing: -0.04em; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.nc-main { background: var(--panel); padding: 8px 22px 10px 18px; margin-left: -8px; display: grid; gap: 2px; border-bottom: 3px solid var(--char); }
.nc-main small { font-size: 12px; letter-spacing: 0.24em; color: var(--dim); font-weight: 600; }
.nc-main b { font-size: clamp(34px, 4.6vw, 64px); line-height: 0.95; letter-spacing: 0.02em; font-weight: 700; }
.nc-meta { font-size: 12px; color: var(--accent-ink); letter-spacing: 0.02em; }
.nc-venue { grid-column: 2; justify-self: start; margin-left: -8px; margin-top: 6px; background: rgba(6, 8, 15, 0.78); padding: 3px 12px; font-size: 11px; color: var(--dim); letter-spacing: 0.06em; }
.walk .skip { position: absolute; right: calc(var(--pad) + 4px); bottom: calc(var(--bar) + 18px); font-size: 12px; letter-spacing: 0.2em; color: rgba(244, 248, 255, 0.78); background: rgba(6, 8, 15, 0.55); padding: 6px 12px; }
.walk .skip .tp { display: none; }
@media (pointer: coarse) {
  .walk .skip .kb { display: none; }
  .walk .skip .tp { display: inline; }
}
@media (max-width: 600px) {
  .namecard { bottom: calc(var(--bar) + 54px); }
  .nc-main { padding: 6px 16px 8px 14px; }
  .walk .skip { bottom: calc(var(--bar) + 12px); }
}
@media (prefers-reduced-motion: reduce) {
  .bars i, .namecard, #hud { transition: none; }
}
