/* ══════════════════════════════════════════════════════════
   Cricket Arena — arcade cricket for the browser
   Night match: floodlit turf, warm lamps, chalk lines, glass HUD.
   ══════════════════════════════════════════════════════════ */

:root {
  --ink: #eaf5ee;
  --ink-dim: #9db4a7;
  --ink-faint: #67806f;
  --lime: #5fe39a;
  --lime-deep: #12a35c;
  --amber: #ffc14d;
  --sky: #57b8ff;
  --violet: #b47bf0;
  --ball: #e0392b;
  --panel: rgba(8, 24, 16, 0.84);
  --panel-2: rgba(6, 19, 13, 0.7);
  --line: rgba(120, 200, 155, 0.18);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  --r: 14px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body {
  height: 100%; overflow: hidden; background: #04100a; color: var(--ink);
  font-family: var(--font); overscroll-behavior: none; touch-action: manipulation;
}
body { -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ── screen router ───────────────────────────────────────── */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; overflow: hidden; }
.screen.is-active { display: flex; animation: rise .3s cubic-bezier(.2,.8,.3,1) both; }
.screen-match.is-active { display: block; animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── stadium backdrop for menu screens ───────────────────── */
.bg-stadium { position: absolute; inset: 0; z-index: 0; background: linear-gradient(#071a12 0%, #04110b 52%, #020a06 100%); overflow: hidden; }
.bg-lights { position: absolute; inset: 0;
  background:
    radial-gradient(38% 30% at 14% -4%, rgba(255,231,175,.20), transparent 70%),
    radial-gradient(38% 30% at 86% -4%, rgba(255,231,175,.20), transparent 70%),
    radial-gradient(60% 34% at 50% -8%, rgba(255,231,175,.14), transparent 70%);
}
.bg-turf { position: absolute; left: -12%; right: -12%; bottom: -34%; height: 78%; border-radius: 50% 50% 0 0 / 44% 44% 0 0;
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,.028) 0 30px, transparent 30px 60px),
    linear-gradient(#1a6b41, #0c3f26 62%, #072a19);
  box-shadow: 0 -30px 90px rgba(20,140,84,.28);
}

/* ── home ────────────────────────────────────────────────── */
.brand { position: relative; z-index: 1; margin-top: calc(8vh + var(--st)); text-align: center; }
.brand-mark { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 18px;
  background: radial-gradient(circle at 34% 30%, #ff6a5c, var(--ball) 58%, #7d1a14);
  box-shadow: 0 0 40px rgba(224,57,43,.45), inset -5px -7px 12px rgba(0,0,0,.42);
  position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border-top: 2px dashed rgba(255,255,255,.8); transform: rotate(-20deg); }
.brand-title { font-size: clamp(30px, 8.4vw, 54px); font-weight: 900; letter-spacing: .12em; line-height: 1; }
.brand-title span { color: var(--lime); margin-left: .12em; }
.brand-sub { margin-top: 10px; font-size: 11px; letter-spacing: .42em; text-transform: uppercase; color: var(--ink-faint); }

.menu-stack { position: relative; z-index: 1; margin: auto 0 4vh; width: min(400px, 86vw); display: flex; flex-direction: column; gap: 11px; }
.home-stats { position: relative; z-index: 1; display: flex; gap: 16px; margin-bottom: 2vh; font-size: 11px; color: var(--ink-faint); letter-spacing: .1em; text-transform: uppercase; }
.home-stats b { color: var(--lime); font-size: 13px; }
.foot { position: relative; z-index: 1; margin-bottom: calc(12px + var(--sb)); font-size: 10.5px; color: rgba(103,128,111,.75); letter-spacing: .1em; }

/* ── buttons ─────────────────────────────────────────────── */
.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 13px 20px; border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(11,32,21,.85); color: var(--ink); cursor: pointer;
  transition: transform .12s ease, filter .15s ease, background .2s ease, border-color .2s ease; }
.btn:hover { background: rgba(18,48,32,.9); border-color: rgba(120,200,155,.34); }
.btn:active { transform: translateY(2px) scale(.99); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn-k { font-size: 15px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.btn-s { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.btn-xl { padding: 16px 22px; }
.btn-primary { background: linear-gradient(#22c973, #0f8c4c); border-color: rgba(255,255,255,.2);
  box-shadow: 0 5px 0 #0a5f34, 0 14px 26px rgba(15,140,76,.34); }
.btn-primary:hover { background: linear-gradient(#2ad97e, #129a55); }
.btn-primary .btn-k { color: #04200f; }
.btn-primary .btn-s { color: rgba(4,32,18,.6); }
.btn-primary:active { box-shadow: 0 1px 0 #0a5f34; }
.btn-ghost { background: transparent; }
.icon-btn { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 11px;
  border: 1px solid var(--line); background: rgba(0,0,0,.4); color: var(--ink); font-size: 15px; cursor: pointer; }
.icon-btn:hover { background: rgba(0,0,0,.6); }
.mini-btn { border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--ink-dim); border-radius: 999px;
  padding: 7px 13px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.mini-btn:hover { color: var(--ink); }

/* ── sheets ──────────────────────────────────────────────── */
.sheet { position: relative; z-index: 1; width: min(560px, 94vw);
  max-height: calc(100% - 20px - var(--st) - var(--sb)); margin: calc(10px + var(--st)) 0 calc(10px + var(--sb));
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(16px); overflow: auto; }
.sheet-center { margin: auto 0; text-align: center; align-items: stretch; }
.sheet { scrollbar-width: thin; scrollbar-color: rgba(120,200,155,.35) transparent; }
.sheet::-webkit-scrollbar { width: 8px; }
.sheet::-webkit-scrollbar-track { background: transparent; }
.sheet::-webkit-scrollbar-thumb { background: rgba(120,200,155,.3); border-radius: 4px; }
.sheet::-webkit-scrollbar-thumb:hover { background: rgba(120,200,155,.5); }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head h2 { flex: 1; font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.sheet-foot { margin-top: auto; padding-top: 4px; display: flex; flex-direction: column; gap: 9px; }
.hint { font-size: 12px; line-height: 1.55; color: var(--ink-dim); }
.tag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--lime);
  border: 1px solid rgba(95,227,154,.3); border-radius: 999px; padding: 4px 9px; white-space: nowrap; }

.opt-block > label { display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.name-row { display: flex; gap: 8px; }
.text-in { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0,0,0,.34); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em; -webkit-user-select: text; user-select: text; }
.text-in:focus { outline: none; border-color: var(--lime); }
.swatches { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.sw { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }

.seg { display: flex; gap: 5px; background: rgba(0,0,0,.32); padding: 5px; border-radius: 12px; border: 1px solid var(--line); }
.seg button { flex: 1; padding: 10px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-dim);
  font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .16s ease, color .16s ease; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: linear-gradient(#22c973, #12a35c); color: #04200f; }

/* ── toss ────────────────────────────────────────────────── */
.coin-wrap { display: grid; place-items: center; height: 130px; perspective: 700px; }
.coin3d { width: 92px; height: 92px; position: relative; transform-style: preserve-3d; transition: transform .2s; }
.coin3d.flip { animation: flip 1.5s cubic-bezier(.3,.1,.3,1) both; }
.coin3d .face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  font-size: 34px; font-weight: 900; color: #5a3d06; backface-visibility: hidden;
  background: radial-gradient(circle at 34% 30%, #ffe9a8, #e8b53c 60%, #a97a17);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.28), 0 12px 28px rgba(0,0,0,.5); }
.coin3d .face.t { transform: rotateY(180deg); }
@keyframes flip { 0% { transform: rotateY(0) translateY(0); } 45% { transform: rotateY(900deg) translateY(-58px); } 100% { transform: rotateY(1800deg) translateY(0); } }
.coin3d.tails { transform: rotateY(180deg); }
.toss-caller { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
.toss-text { font-size: 15px; line-height: 1.6; }
.toss-text b { color: var(--lime); }
.toss-choice { display: flex; gap: 10px; }
.toss-choice .btn { flex: 1; }

/* ══════════════ MATCH ══════════════ */
.screen-match { display: none; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hud-top { position: absolute; top: calc(8px + var(--st)); left: calc(8px + var(--sl)); right: calc(8px + var(--sr));
  z-index: 3; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-actions { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.sb { padding: 8px 13px; border-radius: 13px; background: rgba(3,13,9,.72); border: 1px solid var(--line);
  backdrop-filter: blur(10px); min-width: 168px; }
.sb-line1 { display: flex; align-items: baseline; gap: 7px; }
.sb-line1 span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.sb-line1 b { font-size: 24px; font-weight: 900; letter-spacing: -.01em; margin-left: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); flex: 0 0 7px; }
.sb-line2 { font-size: 11px; color: var(--ink-dim); margin-top: 2px; letter-spacing: .02em; }
.sb-line3 { font-size: 11.5px; color: var(--amber); font-weight: 700; margin-top: 3px; }
.sb-line3:empty { display: none; }

.hud-left { position: absolute; top: calc(96px + var(--st)); left: calc(8px + var(--sl)); z-index: 3;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; }
.over-strip { display: flex; gap: 4px; }
.oball { min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; background: rgba(3,13,9,.8); border: 1px solid var(--line); }
.oball.dot { color: var(--ink-faint); }
.oball.four { background: var(--sky); border-color: #9ed6ff; color: #032338; }
.oball.six { background: var(--violet); border-color: #d8b6ff; color: #1e0836; }
.oball.wkt { background: var(--ball); border-color: #ff8b7e; color: #fff; }
.oball.extra { background: rgba(255,193,77,.9); border-color: #ffe0a0; color: #2b1c00; }
.pcard { padding: 5px 10px; border-radius: 10px; background: rgba(3,13,9,.7); border: 1px solid var(--line);
  font-size: 11px; color: var(--ink-dim); backdrop-filter: blur(6px); white-space: nowrap; }
.pcard b { color: var(--ink); font-weight: 800; }
.pcard .striker { color: var(--lime); }

.turn-flag { position: absolute; top: calc(12px + var(--st)); left: 50%; transform: translateX(-50%); z-index: 3;
  padding: 5px 14px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; background: rgba(3,13,9,.8); border: 1px solid var(--line); pointer-events: none; opacity: 0;
  transition: opacity .2s; }
.turn-flag.show { opacity: 1; }
.turn-flag.p1 { color: var(--lime); border-color: rgba(95,227,154,.4); }
.turn-flag.p2 { color: var(--sky); border-color: rgba(87,184,255,.4); }

.shout { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.shout.show { animation: shout 1.6s cubic-bezier(.2,.8,.3,1) both; }
.shout > div { display: flex; flex-direction: column; align-items: center; }
.shout .big { font-size: clamp(38px, 14vw, 104px); font-weight: 900; letter-spacing: .05em; color: #fff;
  text-shadow: 0 0 34px rgba(0,0,0,.75), 0 6px 0 rgba(0,0,0,.32); text-align: center; line-height: 1.05; }
.shout .sub { display: block; margin-top: 10px; font-size: 13px; font-weight: 800; letter-spacing: .3em;
  text-align: center; color: var(--amber); text-shadow: 0 2px 8px rgba(0,0,0,.9); }
/* "SIX!" wants to fill the screen; "CRIMSON KINGS to bat" very much does not */
.shout .big.long { font-size: clamp(20px, 5.4vw, 42px); letter-spacing: .08em; max-width: 88vw; }
.shout .big.four { color: #9ed6ff; } .shout .big.six { color: #d8b6ff; }
.shout .big.wkt { color: #ff8b7e; } .shout .big.perfect { color: var(--lime); }
@keyframes shout { 0% { opacity: 0; transform: scale(.55); } 14% { opacity: 1; transform: scale(1.07); }
  24% { transform: scale(1); } 76% { opacity: 1; } 100% { opacity: 0; transform: scale(1.03); } }

.commentary { position: absolute; left: 50%; transform: translateX(-50%); z-index: 3;
  bottom: calc(var(--ctlh, 168px) + 12px + var(--sb)); padding: 8px 16px; border-radius: 999px;
  background: rgba(3,13,9,.85); border: 1px solid var(--line); font-size: 12.5px; max-width: 92vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .22s; backdrop-filter: blur(8px); }
.commentary.show { opacity: 1; }

/* ── in-match controls ───────────────────────────────────── */
.ctl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px calc(10px + var(--sr)) calc(12px + var(--sb)) calc(10px + var(--sl));
  display: flex; flex-direction: column; gap: 9px; align-items: center;
  /* the dials have to stay legible over a bright, busy outfield */
  background: linear-gradient(transparent, rgba(2,11,7,.82) 34%, rgba(2,10,6,.95) 66%); }
.ctl[hidden] { display: none; }
.ctl-cap { display: flex; align-items: baseline; justify-content: center; gap: 10px;
  font-size: 11px; flex-wrap: wrap; text-align: center; max-width: 96vw; }
.ctl-cap b { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.ctl-cap i { font-style: normal; color: var(--ink-faint); letter-spacing: .06em; }
@media (max-width: 560px) { .ctl-cap i { display: none; } }

/* ── the dial ────────────────────────────────────────────── */
.dial { width: min(560px, 100%); }
.dial-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.dial-head b { font-size: 12.5px; letter-spacing: .06em; color: var(--lime); font-weight: 800;
  text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dial-ends { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(103,128,111,.8); margin-top: 1px; }

.slider { -webkit-appearance: none; appearance: none; display: block; width: 100%;
  height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.slider::-webkit-slider-runnable-track { height: 15px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16); background: var(--track, rgba(255,255,255,.14)); }
.slider::-moz-range-track { height: 15px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16); background: var(--track, rgba(255,255,255,.14)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; margin-top: -11px;
  border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff, #c9dfd3 70%);
  border: 2px solid #0a2f1c; box-shadow: 0 3px 10px rgba(0,0,0,.55); }
.slider::-moz-range-thumb { width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff, #c9dfd3 70%);
  border: 2px solid #0a2f1c; box-shadow: 0 3px 10px rgba(0,0,0,.55); }
.slider:active::-webkit-slider-thumb { background: radial-gradient(circle at 36% 30%, #fff, #9ff0c2 70%); }
.slider:active::-moz-range-thumb { background: radial-gradient(circle at 36% 30%, #fff, #9ff0c2 70%); }
.slider:disabled { opacity: .45; cursor: default; }

/* leg side reads cool, off side warm — the same language on both dials */
.slider-aim, .slider-line { --track: linear-gradient(90deg, rgba(87,184,255,.55), rgba(255,255,255,.12) 50%, rgba(255,193,77,.55)); }
.slider-power { --track: linear-gradient(90deg, rgba(130,150,140,.5), rgba(95,227,154,.6) 52%, rgba(255,130,50,.8)); }
.slider-length { --track: linear-gradient(90deg, rgba(255,110,85,.6), rgba(95,227,154,.55) 42%, rgba(120,170,255,.6)); }

.play-btn { width: min(560px, 100%); padding: 15px 18px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,.2); background: linear-gradient(#ffb43e, #e0761a); color: #241000;
  box-shadow: 0 5px 0 #a4530f, 0 12px 26px rgba(224,118,26,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; transition: transform .09s ease, filter .12s ease, box-shadow .12s ease; }
.play-btn b { font-size: 18px; font-weight: 900; letter-spacing: .18em; }
.play-btn i { font-style: normal; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; opacity: .6; }
.play-btn:hover { filter: brightness(1.08); }
.play-btn:active, .play-btn.hit { transform: translateY(4px); box-shadow: 0 1px 0 #a4530f; filter: brightness(1.25); }
.ctl.disabled .play-btn { opacity: .45; pointer-events: none; }
.ctl.disabled .slider { pointer-events: none; opacity: .5; }

/* ── thinking time ───────────────────────────────────────── */
.ready { position: absolute; left: 50%; transform: translateX(-50%); z-index: 6;
  bottom: calc(var(--ctlh, 150px) + 10px + var(--sb));
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: min(340px, 76vw); pointer-events: none; }
.ready-track { width: 100%; height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(3,13,9,.85); border: 1px solid var(--line); }
.ready-fill { height: 100%; width: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--lime), var(--amber));
  transform-origin: left center; transition: none; }
.ready-txt { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink); text-shadow: 0 2px 8px rgba(0,0,0,.9); font-weight: 700; }
.ready.urgent .ready-fill { background: linear-gradient(90deg, var(--amber), #ff6a5c); }
.ready.urgent .ready-txt { color: var(--amber); }

.pick-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: min(560px, 98vw); }
.pick { padding: 9px 13px; border-radius: 999px; border: 1px solid var(--line); background: rgba(3,13,9,.82);
  color: var(--ink-dim); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; cursor: pointer; white-space: nowrap; }
.pick:hover { color: var(--ink); }
.pick.on { background: linear-gradient(#22c973, #12a35c); color: #04200f; border-color: transparent; }
.pick i { font-style: normal; opacity: .55; margin-left: 5px; font-size: 10px; }
.bowl-go { width: min(420px, 96vw); display: flex; flex-direction: column; gap: 8px; }
.bowl-go .btn { width: 100%; }
.meter { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.meter-track { position: relative; width: 100%; height: 24px; border-radius: 12px; background: rgba(0,0,0,.55);
  border: 1px solid var(--line); overflow: hidden; }
.meter-green { position: absolute; top: 0; bottom: 0; background: linear-gradient(rgba(95,227,154,.6), rgba(18,163,92,.6));
  border-left: 1px solid rgba(255,255,255,.35); border-right: 1px solid rgba(255,255,255,.35); }
.meter-pin { position: absolute; top: 2px; bottom: 2px; width: 4px; border-radius: 2px; background: #fff; box-shadow: 0 0 10px #fff; }
.meter-cap { font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }

/* ── curtain / modals ────────────────────────────────────── */
.curtain { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center;
  background: linear-gradient(#06150e, #020806); }
.curtain[hidden] { display: none; }
.curtain-in { text-align: center; width: min(380px, 88vw); display: flex; flex-direction: column; gap: 14px; }
.curtain-in h3 { font-size: 20px; font-weight: 900; letter-spacing: .06em; }
.curtain-in p { font-size: 13px; color: var(--ink-dim); line-height: 1.6; }

.modal { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  background: rgba(2,9,6,.76); backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.modal-card { width: min(400px, 88vw); padding: 22px; border-radius: 20px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 11px; max-height: 90vh; overflow: auto; }
.modal-card h3 { font-size: 19px; font-weight: 900; letter-spacing: .04em; }
.modal-card p { font-size: 13.5px; line-height: 1.6; color: var(--ink-dim); }
.break-score { font-size: 30px; font-weight: 900; letter-spacing: .02em; }
.break-score small { display: block; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; margin-top: 4px; }
.break-target { font-size: 15px; color: var(--amber); font-weight: 700; }

/* ── result & scorecard ──────────────────────────────────── */
.result-top { text-align: center; }
.trophy { font-size: 44px; line-height: 1; }
.result-head { font-size: 21px; font-weight: 900; letter-spacing: .03em; margin-top: 8px; }
.result-head.win { color: var(--lime); } .result-head.lose { color: #ff8b7e; } .result-head.tie { color: var(--amber); }
.result-line { font-size: 13px; color: var(--ink-dim); margin-top: 6px; line-height: 1.6; }
.scorecards { display: flex; flex-direction: column; gap: 10px; }
.card-inn { padding: 12px; border-radius: var(--r); background: rgba(6,20,13,.82); border: 1px solid var(--line); }
.card-inn h4 { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); }
.card-inn h4 em { font-style: normal; font-size: 19px; font-weight: 900; color: var(--ink); letter-spacing: 0; }
.tbl { width: 100%; margin-top: 9px; border-collapse: collapse; font-size: 11.5px; }
.tbl th { text-align: right; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700; padding-bottom: 4px; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 3px 0; text-align: right; color: var(--ink-dim); border-top: 1px solid rgba(255,255,255,.05); }
.tbl td:first-child { color: var(--ink); }
.tbl td small { display: block; color: var(--ink-faint); font-size: 9.5px; }
.tbl .nb td:first-child { color: var(--lime); }
.card-sub { margin-top: 10px; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* ── docs, settings, stats ───────────────────────────────── */
.doc { display: flex; flex-direction: column; gap: 9px; }
.doc h3 { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--lime); margin-top: 8px; }
.doc p { font-size: 13px; line-height: 1.65; color: var(--ink-dim); }
.doc b { color: var(--ink); }
.keylist { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.keylist li { font-size: 12.5px; color: var(--ink); }
.keylist span { color: var(--ink-faint); }
kbd { display: inline-block; min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 6px; font-size: 11px;
  background: rgba(255,255,255,.1); border: 1px solid var(--line); box-shadow: 0 2px 0 rgba(0,0,0,.4); margin-right: 4px; }
.g-perfect { color: var(--lime); } .g-great { color: #9ed6ff; } .g-good { color: var(--ink); }
.g-early, .g-late { color: var(--amber); } .g-miss { color: #ff8b7e; }

.toggles { display: flex; flex-direction: column; gap: 8px; }
.tgl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r);
  background: rgba(6,20,13,.8); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; color: var(--ink); }
.tgl-txt { flex: 1; }
.tgl-txt b { display: block; font-size: 13.5px; font-weight: 700; }
.tgl-txt span { font-size: 11px; color: var(--ink-faint); }
.tgl-box { width: 44px; height: 25px; border-radius: 999px; background: rgba(255,255,255,.13); position: relative; flex: 0 0 44px; transition: background .18s; }
.tgl-box::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; transition: transform .18s cubic-bezier(.3,.8,.3,1); }
.tgl.on .tgl-box { background: var(--lime-deep); }
.tgl.on .tgl-box::after { transform: translateX(19px); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.stat { padding: 11px; border-radius: 12px; background: rgba(6,20,13,.8); border: 1px solid var(--line); }
.stat b { display: block; font-size: 20px; font-weight: 900; }
.stat span { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* ══════════════ responsive ══════════════ */

/* Desktop: the dials sit side by side with the action button beside them. */
@media (min-width: 760px) {
  .ctl { padding-bottom: calc(16px + var(--sb)); }
  .ctl-bat, .ctl-bowl { display: grid; align-items: end; gap: 10px 14px;
    grid-template-columns: minmax(260px, 460px) minmax(150px, 200px);
    grid-template-areas: 'cap cap' 'mode mode' 'dial go'; width: min(900px, 96vw); margin: 0 auto; }
  .ctl-bowl { grid-template-areas: 'cap cap' 'style style' 'dial go'; }
  .ctl-cap { grid-area: cap; }
  .dial { grid-area: dial; width: 100%; }
  .play-btn, .bowl-go { grid-area: go; width: 100%; }
  #row-power { grid-area: mode; }
  #row-style, #row-line { grid-area: style; }
  .ctl-bowl { grid-template-areas: 'cap cap' 'style style' 'line line' 'dial go'; }
  #row-line { grid-area: line; }
  .play-btn { height: 100%; min-height: 84px; }
}

/* Phone landscape: shortest layout — dials left, big action right, one thumb each. */
@media (orientation: landscape) and (max-height: 560px) {
  .hud-left { top: calc(76px + var(--st)); gap: 4px; }
  .pcard { font-size: 10px; padding: 4px 8px; }
  .ctl { gap: 6px; padding: 6px calc(10px + var(--sr)) calc(8px + var(--sb)) calc(10px + var(--sl)); }
  .ctl-cap { display: none; }
  .dial-ends { display: none; }
  .dial-head { margin-bottom: 1px; }
  .ctl-bat { display: grid; align-items: end; gap: 6px 12px;
    grid-template-columns: 1fr minmax(130px, 190px);
    grid-template-areas: 'mode go' 'dial go'; width: 100%; }
  .ctl-bowl { display: grid; align-items: end; gap: 6px 12px;
    grid-template-columns: 1fr minmax(130px, 190px);
    grid-template-areas: 'style go' 'line go' 'dial go'; width: 100%; }
  .dial { grid-area: dial; width: 100%; }
  .play-btn, .bowl-go { grid-area: go; width: 100%; }
  #row-power { grid-area: mode; }
  #row-style { grid-area: style; }
  #row-line { grid-area: line; }
  .pick { padding: 7px 11px; font-size: 11px; }
  .slider { height: 38px; }
  .slider::-webkit-slider-thumb { width: 32px; height: 32px; margin-top: -9px; }
  .play-btn { min-height: 62px; padding: 8px; }
  .play-btn b { font-size: 15px; }
  .play-btn i { display: none; }
  .meter-cap { display: none; }
  .brand { margin-top: 3vh; }
  .brand-mark { width: 40px; height: 40px; margin-bottom: 8px; }
  .coin-wrap { height: 92px; }
  .coin3d { width: 64px; height: 64px; }
  .sheet { padding: 12px; gap: 10px; }
}

/* Phone portrait: full-width stacked dials, everything thumb-sized. */
@media (max-width: 640px) {
  /* the scoreboard owns the top strip on a phone — put the turn flag under it */
  .turn-flag { top: calc(52px + var(--st)); left: auto; right: calc(8px + var(--sr)); transform: none; }
  .dial { width: 100%; }
  .play-btn { width: 100%; }
  /* the three intents have to fit on one row, so drop the explanatory tails */
  #row-power .pick i { display: none; }
  .bowl-go { width: 100%; }
  .pick { padding: 11px 16px; font-size: 12.5px; }
}
@media (max-width: 380px) {
  .sb { min-width: 148px; padding: 7px 10px; }
  .sb-line1 b { font-size: 21px; }
  .turn-flag { font-size: 9.5px; padding: 4px 10px; }
  .dial-head b { font-size: 11.5px; }
}

/* ── reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .08s !important; }
  .screen.is-active { animation: none; }
  .shout.show { animation: none; opacity: 1; }
}
