:root {
  --navy-950: #031022;
  --navy-900: #071a36;
  --navy-800: #0b2a53;
  --sky: #4fc3ff;
  --sky-bright: #95e4ff;
  --red: #d72838;
  --green: #14b86f;
  --green-dark: #087346;
  --gold: #ffd45c;
  --orange: #ff9a4d;
  --white: #f7fbff;
  --muted: #afc5dc;
  --danger: #ff5e6d;
  --line: rgba(151, 213, 255, .18);
  --shadow: 0 18px 50px rgba(0, 5, 20, .42);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: radial-gradient(circle at 50% 12%, #113b6f 0, #07162f 40%, #020811 100%); color: var(--white); -webkit-tap-highlight-color: transparent; user-select: none; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.is-hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.fatal-message { position: fixed; inset: 0; display: grid; place-items: center; padding: 30px; background: var(--navy-950); color: #fff; text-align: center; }

#app { width: 100%; height: 100%; display: grid; grid-template-columns: 1fr; place-items: center; isolation: isolate; }
#game-shell { position: relative; height: min(100dvh, calc(100vw * 1.7777778)); max-height: 1080px; width: min(100vw, calc(100dvh * .5625)); max-width: 608px; overflow: hidden; background: linear-gradient(180deg, var(--navy-800), var(--navy-950)); box-shadow: 0 0 0 1px rgba(160, 219, 255, .22), 0 40px 100px rgba(0, 0, 0, .58); }
.shell-glow { position: absolute; z-index: 0; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% -4%, rgba(81, 196, 255, .3), transparent 35%); }

.screen { position: absolute; z-index: 2; inset: 0; display: none; overflow: hidden; background: linear-gradient(180deg, #0a2b52 0%, #061730 55%, #041021 100%); }
.screen.is-active { display: flex; animation: screen-in .25s ease-out both; }
.screen--center { flex-direction: column; align-items: center; justify-content: center; padding: max(28px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom)); text-align: center; }
.screen--panel { flex-direction: column; justify-content: center; gap: 18px; padding: max(34px, env(safe-area-inset-top)) clamp(24px, 7vw, 46px) max(28px, env(safe-area-inset-bottom)); background:
  linear-gradient(135deg, transparent 0 48%, rgba(79, 195, 255, .05) 48% 52%, transparent 52%),
  radial-gradient(circle at 85% 8%, rgba(79, 195, 255, .2), transparent 30%),
  linear-gradient(180deg, #09294e, #041326);
}
@keyframes screen-in { from { opacity: 0; transform: scale(1.012); } to { opacity: 1; transform: scale(1); } }

.eyebrow { margin: 0; color: var(--sky-bright); font-size: clamp(10px, 2.6vw, 13px); line-height: 1.2; font-weight: 900; letter-spacing: .23em; text-transform: uppercase; }
.eyebrow.gold { color: var(--gold); }
h1, h2, h3, p { text-wrap: balance; }
h2 { margin: -4px 0 0; font-size: clamp(38px, 11vw, 60px); line-height: .94; letter-spacing: -.055em; text-transform: uppercase; font-weight: 950; }
.screen--panel > p:not(.eyebrow) { margin: 0; color: #c4d7e9; font-size: clamp(14px, 3.8vw, 18px); line-height: 1.55; }

.loading-mark { width: 94px; aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 24px; border: 2px solid var(--sky); background: linear-gradient(145deg, rgba(79,195,255,.25), rgba(4,16,33,.8)); transform: rotate(45deg); box-shadow: 0 0 42px rgba(79,195,255,.28); }
.loading-mark span { transform: rotate(-45deg); font-weight: 950; font-style: italic; font-size: 32px; }
.loading-title { margin: 9px 0 36px; font-size: clamp(56px, 18vw, 94px); line-height: .76; letter-spacing: -.08em; font-weight: 950; font-style: italic; }
.loading-title em { color: var(--sky); font-style: inherit; }
.loader { width: min(290px, 75vw); height: 8px; padding: 2px; overflow: hidden; border: 1px solid rgba(149,228,255,.42); border-radius: 99px; background: rgba(0,0,0,.3); }
.loader span { display: block; width: 0%; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--sky), var(--gold)); box-shadow: 0 0 14px var(--sky); transition: width .2s ease; }
.loading-copy { color: var(--muted); font-size: 12px; letter-spacing: .08em; }

.notice-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 2px solid var(--gold); color: var(--gold); font-weight: 950; font-size: 28px; transform: rotate(45deg); }
.notice-icon::first-letter { transform: rotate(-45deg); }
.legal-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,8,24,.36); }
.legal-card strong { font-size: 13px; }
.legal-card span { color: var(--muted); font-size: 12px; }

.button { min-height: 50px; border: 0; border-radius: 12px; padding: 0 22px; cursor: pointer; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; transition: transform .12s ease, filter .12s ease, background .12s ease; }
.button:active, .icon-button:active, .text-button:active { transform: scale(.97); }
.button--wide { width: 100%; }
.button--primary { color: #03142a; background: linear-gradient(135deg, var(--sky-bright), var(--sky)); box-shadow: 0 12px 26px rgba(79,195,255,.24); }
.button--secondary { border: 1px solid var(--line); background: rgba(10,44,82,.72); }
.button--danger { background: var(--danger); color: #200208; }
.text-button { appearance: none; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 10px 4px; background: transparent; color: #d3e5f4; cursor: pointer; font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; text-decoration: underline; text-decoration-color: rgba(151,213,255,.35); text-underline-offset: 5px; }
.text-button--gold { color: var(--gold); text-decoration-color: rgba(255,212,92,.42); }
.danger-button { width: 100%; border: 1px solid rgba(255,94,109,.35); border-radius: 12px; padding: 14px; background: rgba(255,94,109,.08); color: #ff8995; cursor: pointer; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; background: rgba(3,16,34,.66); backdrop-filter: blur(12px); cursor: pointer; font-size: 18px; }
.icon-button--back { font-size: 24px; }

.home-screen { overflow: hidden; background: radial-gradient(circle at 50% 18%, rgba(84,184,255,.45), transparent 29%), linear-gradient(180deg, #183b70 0 37%, #16704d 37% 66%, #031022 87%); }
.home-screen::before { content: ""; position: absolute; inset: 36% -22% 0; opacity: .42; background: repeating-linear-gradient(90deg, transparent 0 42px, rgba(255,255,255,.1) 43px 44px), linear-gradient(155deg, transparent 48%, rgba(255,255,255,.12) 49% 50%, transparent 51%); transform: perspective(320px) rotateX(58deg); transform-origin: top; }
.home-screen::after { content: ""; position: absolute; inset: 8% 4% auto; height: 28%; border-radius: 50% 50% 8px 8px; opacity: .45; background: repeating-linear-gradient(90deg, #102544 0 10px, #23446c 10px 20px); box-shadow: inset 0 -20px 40px rgba(0,0,0,.45); }
.home-vignette { position: absolute; z-index: 1; inset: 0; background: linear-gradient(180deg, rgba(2,10,23,.04) 0%, rgba(2,10,23,.12) 40%, rgba(2,10,23,.7) 61%, #031022 88%); }
.home-player { --kit-primary: #c8102e; --kit-secondary: #fff; --kit-accent: #00205b; --skin: #efc3a0; --hair: #d5b068; position: absolute; z-index: 1; top: 7.5%; left: 50%; width: 214px; height: 410px; transform: translateX(-50%); filter: drop-shadow(0 20px 22px rgba(0,0,0,.42)); }
.home-player__head { position: absolute; z-index: 3; top: 35px; left: 72px; width: 70px; height: 92px; border-radius: 46% 46% 42% 42%; background: var(--skin); box-shadow: inset -8px -4px 0 rgba(79,37,21,.13); }
.home-player__neck { position: absolute; z-index: 2; top: 111px; left: 91px; width: 35px; height: 48px; border-radius: 10px; background: var(--skin); }
.home-player__hair { position: absolute; z-index: 4; top: 20px; left: 66px; width: 82px; height: 55px; border-radius: 54% 58% 30% 30%; background: var(--hair); box-shadow: inset -9px -3px 0 rgba(0,0,0,.2); }
.home-player[data-hair="crop"] .home-player__hair { top: 28px; left: 70px; width: 74px; height: 42px; }
.home-player[data-hair="fade"] .home-player__hair { top: 31px; left: 73px; width: 68px; height: 36px; border-radius: 50% 50% 18% 18%; }
.home-player[data-hair="swept"] .home-player__hair { top: 15px; left: 70px; width: 77px; height: 54px; border-radius: 68% 38% 28% 30%; transform: skew(-9deg); }
.home-player[data-hair="waves"] .home-player__hair { background: repeating-radial-gradient(ellipse at 45% 110%, transparent 0 6px, rgba(255,255,255,.12) 7px 9px), var(--hair); }
.home-player[data-hair="curly"] .home-player__hair { height: 64px; background: radial-gradient(circle at 18% 30%, rgba(255,255,255,.13) 0 5px, transparent 6px), radial-gradient(circle at 72% 58%, rgba(255,255,255,.1) 0 5px, transparent 6px), var(--hair); background-size: 21px 21px; }
.home-player[data-hair="long"] .home-player__hair, .home-player[data-hair="long-curly"] .home-player__hair { height: 126px; border-radius: 52% 56% 46% 44%; }
.home-player[data-hair="long-curly"] .home-player__hair { background: radial-gradient(circle at 22% 30%, rgba(255,255,255,.12) 0 5px, transparent 6px), radial-gradient(circle at 72% 56%, rgba(255,255,255,.1) 0 5px, transparent 6px), var(--hair); background-size: 22px 22px; }
.home-player[data-hair="mohawk"] .home-player__hair { top: 5px; left: 88px; width: 42px; height: 76px; border-radius: 60% 60% 30% 30%; transform: skew(-5deg); }
.home-player[data-hair="braids"] .home-player__hair { height: 75px; background: repeating-linear-gradient(90deg, var(--hair) 0 7px, #34221b 8px 10px); }
.home-player__body { position: absolute; z-index: 2; top: 135px; left: 37px; width: 140px; height: 205px; display: flex; flex-direction: column; align-items: center; padding-top: 28px; border-radius: 40px 40px 18px 18px; color: var(--kit-secondary); background: linear-gradient(90deg, var(--kit-accent) 0 7px, transparent 7px calc(100% - 7px), var(--kit-accent) calc(100% - 7px)), var(--kit-primary); box-shadow: inset 0 -18px 0 rgba(0,0,0,.14); text-shadow: 0 2px 2px rgba(0,0,0,.45); }
.home-player__body span { font-size: 15px; font-weight: 950; letter-spacing: .12em; }
.home-player__body strong { margin-top: 5px; font-size: 78px; font-style: italic; line-height: 1; }
.home-player__arm { position: absolute; z-index: 1; top: 159px; width: 45px; height: 185px; border-radius: 24px; background: linear-gradient(180deg, var(--kit-primary) 0 37%, var(--skin) 38%); }
.home-player__arm--left { left: 13px; transform: rotate(10deg); }
.home-player__arm--right { right: 13px; transform: rotate(-10deg); }
.home-topline { position: absolute; z-index: 2; inset: max(20px, env(safe-area-inset-top)) 18px auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-language-control { min-width: 0; height: 42px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(3,16,34,.72); backdrop-filter: blur(12px); }
.home-language-control span { flex: 0 0 auto; font-size: 15px; }
.home-language-control select { width: clamp(92px, 24vw, 138px); border: 0; outline: 0; background: transparent; color: var(--white); cursor: pointer; font-size: 11px; font-weight: 850; text-overflow: ellipsis; }
.home-language-control option, .setting-row--language option { background: #071a34; color: var(--white); }
.home-copy { position: absolute; z-index: 2; inset: auto clamp(18px, 5.5vw, 34px) max(12px, env(safe-area-inset-bottom)); text-align: center; }
.home-copy h1 { margin: 5px 0 8px; font-size: clamp(42px, 12vw, 68px); line-height: .76; letter-spacing: -.075em; font-weight: 950; font-style: italic; text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.home-copy h1 em { display: inline-block; color: var(--sky); font-style: inherit; }
.team-picker { display: grid; grid-template-columns: minmax(0,1fr) 38px minmax(0,1fr); align-items: end; gap: 6px; width: min(430px,100%); margin: 0 auto 4px; padding: 9px; border: 1px solid rgba(151,213,255,.22); border-radius: 15px; background: rgba(3,16,34,.84); box-shadow: 0 12px 30px rgba(0,0,0,.2); backdrop-filter: blur(14px); }
.team-picker label { min-width: 0; text-align: left; }
.team-picker label span { display: block; margin: 0 0 5px 5px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.team-picker select { width: 100%; height: 38px; min-width: 0; border: 1px solid rgba(255,255,255,.2); border-radius: 9px; padding: 0 8px; outline: none; color: var(--white); background: #0a2342; font-size: 12px; font-weight: 850; text-overflow: ellipsis; }
.team-swap { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; color: var(--gold); background: rgba(79,143,216,.2); cursor: pointer; font-size: 21px; font-weight: 900; }
.home-matchup-summary { min-height: 14px; margin: 0 0 5px; color: rgba(255,255,255,.74); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.home-records { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; width: min(330px, 90%); margin: 0 auto 8px; overflow: hidden; border: 1px solid rgba(151,213,255,.18); border-radius: 12px; background: rgba(151,213,255,.18); backdrop-filter: blur(12px); }
.home-records div { padding: 9px; background: rgba(3,16,34,.82); }
.home-records span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.home-records strong { display: block; margin-top: 2px; font-size: 20px; }
.home-records strong b { font: inherit; }
.button--play { width: min(360px, 100%); min-height: 56px; display: flex; align-items: center; justify-content: space-between; margin: 0 auto; padding: 0 15px 0 28px; border-radius: 16px; color: #03142a; background: linear-gradient(135deg, #d8f7ff 0%, var(--sky) 52%, #34a2ff 100%); box-shadow: 0 16px 38px rgba(41,164,255,.34); font-size: 20px; }
.button--play i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: #061932; font-style: normal; font-size: 15px; }
.button--compact { margin: 14px auto 2px; min-height: 56px; }
.home-secondary { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(6px, 2.5vw, 18px); }

.game-screen { background: #0b6843; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.hud { position: absolute; z-index: 5; inset: max(12px, env(safe-area-inset-top)) 14px auto; pointer-events: none; text-shadow: 0 2px 5px rgba(0,0,0,.65); }
.hud-row { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start; }
.hud-row--match { grid-template-columns: minmax(0,1.2fr) minmax(88px,.8fr) 42px; gap: 8px; }
.match-scoreboard { min-width: 0; display: flex; align-items: center; gap: 5px; width: max-content; max-width: 100%; padding: 6px 8px; border: 1px solid rgba(255,255,255,.34); border-radius: 12px; background: rgba(3,16,34,.78); backdrop-filter: blur(9px); }
.match-scoreboard strong { display: flex; align-items: center; gap: 3px; white-space: nowrap; font-size: clamp(10px,2.6vw,14px); letter-spacing: .03em; }
.match-scoreboard strong b { min-width: 12px; color: var(--gold); font-size: 1.16em; }
.match-scoreboard strong i { color: rgba(255,255,255,.55); font-style: normal; }
.match-flag { font-size: clamp(14px,3.8vw,20px); line-height: 1; }
.hud-stat span { display: block; color: rgba(255,255,255,.72); font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.hud-stat strong { display: block; font-size: clamp(19px, 5vw, 27px); line-height: 1.05; font-weight: 950; }
.hud-stat strong b { font: inherit; }
.hud-stat--points { min-width: 0; text-align: right; }
.hud-stat--points small { display: block; color: rgba(255,255,255,.66); font-size: 8px; font-weight: 850; white-space: nowrap; }
.hud-stat--points small b { font: inherit; color: var(--white); }
.hud-stat--center { text-align: center; }
.hud-pause { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; gap: 5px; justify-self: end; border: 1px solid rgba(255,255,255,.34); border-radius: 50%; background: rgba(3,16,34,.65); pointer-events: auto; cursor: pointer; }
.hud-pause i { width: 4px; height: 15px; border-radius: 2px; background: #fff; }
.charge-wrap { margin-top: 8px; }
.charge-track { position: relative; height: 11px; overflow: hidden; border: 2px solid rgba(255,255,255,.7); border-radius: 99px; background: rgba(3,16,34,.65); box-shadow: inset 0 0 8px rgba(0,0,0,.42); }
.charge-track span { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), #ff9a32 72%, var(--gold)); box-shadow: 0 0 15px rgba(255,211,92,.72); transition: width .2s cubic-bezier(.2,.9,.3,1.2); }
.power-row { min-height: 26px; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; margin-top: 6px; }
.power-pill { padding: 5px 9px; border: 1px solid rgba(149,228,255,.5); border-radius: 999px; background: rgba(3,16,34,.75); color: var(--sky-bright); font-size: 9px; font-weight: 900; letter-spacing: .05em; }
.power-pill--gold { margin-left: auto; border-color: rgba(255,212,92,.6); color: var(--gold); }
.power-pill--red { border-color: rgba(255,100,115,.65); color: #ffabb2; background: rgba(91,10,25,.72); }
.power-pill--card { border-color: rgba(255,211,92,.82); color: #3a2800; background: linear-gradient(100deg,#fff0a0,#ffd35c); text-shadow: none; animation: card-warning-in .32s ease-out; }
.power-pill--card[data-card="red"] { border-color: #ff9ba5; color: #fff; background: linear-gradient(100deg,#a8071e,#e72b3e); box-shadow: 0 0 18px rgba(231,43,62,.48); }
@keyframes card-warning-in { from { transform: translateY(-7px) scale(.88); opacity: 0; } }
.power-pill--super { margin-left: auto; border-color: rgba(255,212,92,.45); color: #ffe69b; background: rgba(55,38,4,.76); transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.power-pill--super.is-ready { color: #07162f; background: linear-gradient(100deg, #fff1a8, var(--gold)); border-color: #fff4bd; box-shadow: 0 0 22px rgba(255,211,92,.64); animation: super-ready-pulse .75s ease-in-out infinite alternate; }
@keyframes super-ready-pulse { to { transform: scale(1.04); filter: brightness(1.12); } }

.tutorial-cue { position: absolute; z-index: 7; top: 29%; left: 50%; width: 80%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; color: #fff; text-align: center; text-shadow: 0 2px 7px rgba(0,0,0,.7); animation: tutorial-pulse 1s ease-in-out infinite; pointer-events: none; }
.tutorial-cue span { font-size: 42px; }
.tutorial-cue strong { padding: 9px 14px; border-radius: 999px; background: rgba(3,16,34,.82); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
@keyframes tutorial-pulse { 50% { transform: translateX(-50%) translateY(-6px); } }
.aim-instructions { position: absolute; z-index: 7; left: 50%; bottom: 25%; transform: translateX(-50%); width: max-content; max-width: 82%; display: flex; flex-direction: column; padding: 9px 15px; border: 1px solid rgba(255,212,92,.5); border-radius: 10px; background: rgba(3,16,34,.82); text-align: center; pointer-events: none; }
.aim-instructions strong { color: var(--gold); font-size: 11px; letter-spacing: .1em; }
.aim-instructions span { margin-top: 2px; color: #d9e8f4; font-size: 9px; }
.shot-clock { position: absolute; z-index: 9; top: 14.5%; left: 50%; transform: translateX(-50%); pointer-events: none; filter: drop-shadow(0 8px 18px rgba(0,0,0,.42)); }
.shot-clock-ring { --clock-progress: 1; width: 88px; aspect-ratio: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--clock-progress) * 1turn), rgba(255,255,255,.16) 0); color: var(--white); text-align: center; }
.shot-clock-ring::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(255,255,255,.26); border-radius: inherit; background: rgba(3,16,34,.94); }
.shot-clock-ring > * { position: relative; z-index: 1; }
.shot-clock-ring span, .shot-clock-ring small { font-size: 7px; line-height: 1; font-weight: 950; letter-spacing: .13em; }
.shot-clock-ring strong { margin: 2px 0; color: var(--gold); font-size: 27px; line-height: .9; font-variant-numeric: tabular-nums; }
.shot-clock.is-urgent .shot-clock-ring { background: conic-gradient(var(--danger) calc(var(--clock-progress) * 1turn), rgba(255,255,255,.13) 0); animation: shot-clock-pulse .48s ease-in-out infinite alternate; }
.shot-clock.is-urgent .shot-clock-ring strong { color: #ff9aa5; }
@keyframes shot-clock-pulse { to { transform: scale(1.08); filter: brightness(1.18); } }
.game-toast { position: absolute; z-index: 10; left: 50%; bottom: 18%; transform: translateX(-50%); padding: 8px 13px; border-radius: 99px; background: rgba(3,16,34,.88); font-size: 11px; font-weight: 800; white-space: nowrap; }
.reaction-panel { position: absolute; z-index: 12; inset: 12% 5% 13%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 16px 8% 22px; overflow: hidden; border: 3px solid rgba(255,255,255,.9); border-radius: 28px; background: radial-gradient(circle at 50% 15%, rgba(151,229,255,.42), transparent 36%), linear-gradient(155deg, rgba(1,13,29,.98), rgba(16,101,162,.97) 72%, rgba(79,195,255,.95)); box-shadow: 0 25px 70px rgba(0,0,0,.62), inset 0 0 45px rgba(255,255,255,.08); pointer-events: none; animation: reaction-in .25s cubic-bezier(.17,.89,.28,1.3) both; }
.reaction-panel[data-result="perfect"], .reaction-panel[data-result="super"] { background: radial-gradient(circle at 50% 15%, rgba(255,248,191,.56), transparent 38%), linear-gradient(155deg, #241603, #9e5d08 66%, var(--gold)); }
.reaction-panel[data-result="miss"], .reaction-panel[data-result="saved"], .reaction-panel[data-result="post"], .reaction-panel[data-result="wide"], .reaction-panel[data-result="high"], .reaction-panel[data-result="timeout"] { background: linear-gradient(120deg, #1c1224, #6a2852 65%, #e25e77); }
.reaction-panel div { position: relative; z-index: 1; margin-top: -8px; text-align: center; }
.reaction-face { position: relative; z-index: 1; width: min(250px, 62vw); height: 54%; min-height: 180px; object-fit: contain; border: 0; filter: drop-shadow(0 16px 18px rgba(0,0,0,.38)); }
.reaction-panel span { display: block; font-size: 10px; font-weight: 900; letter-spacing: .22em; }
.reaction-panel strong { display: block; font-size: clamp(50px, 15vw, 78px); line-height: .88; font-style: italic; letter-spacing: -.06em; text-shadow: 0 5px 0 rgba(0,0,0,.23); }
.reaction-panel small { display: block; margin-top: 4px; color: var(--gold); font-size: 18px; font-weight: 950; }
@keyframes reaction-in { from { opacity: 0; transform: translateY(28px) scale(.92); } }

.overlay-panel { z-index: 15; background: rgba(3,16,34,.94); backdrop-filter: blur(9px); }
.overlay-panel h2 { margin-bottom: 12px; }
.results-screen { z-index: 15; flex-direction: column; align-items: center; justify-content: flex-start; overflow-x: hidden; overflow-y: auto; padding: max(24px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom)); text-align: center; background: radial-gradient(circle at 50% 18%, rgba(79,195,255,.26), transparent 34%), linear-gradient(180deg, #09294e, #041326); scrollbar-width: thin; }
.results-screen h2 { font-size: clamp(38px, 10vw, 55px); }
.new-best { margin-top: 8px; color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .13em; animation: tutorial-pulse 1s ease-in-out infinite; }
.result-hero { margin-top: 10px; }
.result-match { display: flex; align-items: center; gap: 11px; margin-top: 12px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(0,8,24,.48); }
.result-match > span { font-size: 22px; }
.result-match strong { display: flex; gap: 5px; align-items: center; font-size: 14px; letter-spacing: .04em; }
.result-match strong i { color: var(--gold); font-size: 20px; font-style: normal; }
.result-hero > span { display: block; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.result-hero > strong { display: block; font-size: clamp(55px, 17vw, 88px); line-height: .9; letter-spacing: -.05em; }
.result-hero small { color: var(--sky-bright); font-size: 13px; font-weight: 800; }
.result-grid { width: min(390px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 18px 0 4px; }
.result-grid div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,8,24,.34); }
.result-grid span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.result-grid strong { display: block; margin-top: 2px; font-size: 21px; }

.score-submit-card { width: min(390px,100%); display: grid; gap: 7px; margin: 14px 0 4px; padding: 15px; border: 1px solid rgba(255,212,92,.28); border-radius: 16px; background: rgba(0,8,24,.52); text-align: left; }
.score-submit-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.score-submit-heading span { display: block; color: var(--gold); font-size: 8px; font-weight: 950; letter-spacing: .14em; }
.score-submit-heading strong { display: block; margin-top: 2px; font-size: 16px; }
.score-submit-heading > b { color: var(--gold); font-size: 30px; line-height: 1; }
.score-submit-card label { margin-top: 3px; color: #dbe8f4; font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.score-submit-card input, .score-submit-card select { width: 100%; min-height: 43px; border: 1px solid rgba(151,213,255,.28); border-radius: 10px; padding: 0 12px; background: #071a34; color: var(--white); user-select: text; }
.score-submit-card select { cursor: pointer; }
.score-submit-card .button { margin-top: 5px; }
.online-status { min-height: 28px; margin: 1px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; text-align: center; }
.online-status[data-type="success"] { color: #83efb9; }
.online-status[data-type="error"] { color: #ff9ba5; }
.online-status[data-type="warning"] { color: #ffd988; }
.button:disabled { cursor: not-allowed; filter: grayscale(.45); opacity: .58; }

.leaderboard-screen { z-index: 18; flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: max(20px,env(safe-area-inset-top)) 20px max(22px,env(safe-area-inset-bottom)); background: radial-gradient(circle at 80% 0, rgba(215,40,56,.2), transparent 35%), linear-gradient(180deg,#09294e,#041326); scrollbar-width: thin; }
.leaderboard-screen .screen-header { flex: 0 0 auto; }
.leaderboard-screen .screen-header > :last-child { margin-left: auto; }
.leaderboard-loading { padding: 35px 15px; color: var(--muted); text-align: center; }
.leaderboard-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; counter-reset: none; }
.leaderboard-row { min-height: 52px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,8,24,.42); }
.leaderboard-row.is-current { border-color: rgba(255,212,92,.6); background: rgba(255,212,92,.09); }
.leaderboard-rank { color: var(--sky-bright); font-size: 16px; font-weight: 950; text-align: center; }
.leaderboard-identity { min-width: 0; display: flex; align-items: center; gap: 9px; }
.leaderboard-identity > span { font-size: 21px; }
.leaderboard-identity strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.leaderboard-score { color: var(--gold); font-size: 17px; font-weight: 950; }
.leaderboard-list .is-empty { padding: 30px 15px; color: var(--muted); text-align: center; }
.leaderboard-own { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.leaderboard-own > small { display: block; margin-bottom: 6px; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.leaderboard-error { padding: 25px 0; text-align: center; }
.leaderboard-error p { color: #ff9ba5; }
.leaderboard-note { margin: 14px 3px 0; color: var(--muted); font-size: 9px; line-height: 1.45; text-align: center; }

.settings-screen, .how-to-screen { z-index: 18; flex-direction: column; padding: max(20px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, #09294e, #041326); }
.screen-header { display: flex; align-items: center; gap: 17px; margin-bottom: 18px; }
.screen-header h2 { margin: 1px 0 0; font-size: clamp(33px, 9vw, 48px); }
.settings-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 2px 3px 12px; scrollbar-width: thin; }
.setting-row { min-height: 59px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.setting-row label, .slider-row label { font-size: 14px; font-weight: 800; }
.setting-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.setting-row--language select { width: min(48%, 190px); min-height: 40px; border: 1px solid rgba(151,213,255,.28); border-radius: 10px; padding: 0 10px; background: #071a34; color: var(--white); cursor: pointer; font-size: 12px; font-weight: 800; }
.screen-header > div { min-width: 0; }
.screen-header h2 { overflow-wrap: anywhere; }
.toggle { width: 52px; height: 30px; position: relative; flex: 0 0 auto; padding: 4px; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; background: #31445a; cursor: pointer; touch-action: manipulation; transition: background .18s ease, border-color .18s ease; }
.toggle span { display: block; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 3px 9px rgba(0,0,0,.32); transition: transform .18s ease; }
.toggle[aria-checked="true"] { border-color: rgba(149,228,255,.7); background: var(--sky); }
.toggle[aria-checked="true"] span { transform: translateX(21px); }
.slider-row { padding: 14px 0 16px; border-bottom: 1px solid var(--line); }
.slider-row label { display: flex; justify-content: space-between; color: #dceaf5; }
.slider-row output { color: var(--sky-bright); }
input[type="range"] { appearance: none; width: 100%; height: 34px; margin: 8px 0 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 7px; border-radius: 99px; background: linear-gradient(90deg, var(--sky), #31577e); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 24px; height: 24px; margin-top: -8.5px; border: 3px solid #fff; border-radius: 50%; background: var(--sky); box-shadow: 0 4px 12px rgba(0,0,0,.38); }
input[type="range"]::-moz-range-track { height: 7px; border: 0; border-radius: 99px; background: #31577e; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
input[type="range"]::-moz-range-progress { height: 7px; border-radius: 99px; background: var(--sky); }
input[type="range"]::-moz-range-thumb { width: 19px; height: 19px; border: 3px solid #fff; border-radius: 50%; background: var(--sky); box-shadow: 0 4px 12px rgba(0,0,0,.38); }
.settings-scroll .button { margin-top: 14px; }
.settings-scroll .danger-button { margin-top: 9px; }

.how-to-screen { z-index: 18; }
.how-cards { display: grid; gap: 10px; flex: 1; min-height: 0; align-content: center; overflow-x: hidden; overflow-y: auto; padding: 2px 3px; scrollbar-width: thin; }
.how-card { display: flex; align-items: center; gap: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,8,24,.32); }
.how-card--gold { border-color: rgba(255,212,92,.34); background: rgba(255,212,92,.07); }
.how-card--red { border-color: rgba(255,94,109,.34); background: rgba(215,40,56,.08); }
.gesture-icon { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: rgba(79,195,255,.13); color: var(--sky-bright); font-size: 25px; font-weight: 900; }
.how-card div { text-align: left; }
.how-card strong { display: block; font-size: 14px; }
.how-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.rotate-screen { z-index: 50; background: var(--navy-950); }
.phone-rotate { width: 65px; height: 104px; display: grid; place-items: center; position: relative; border: 3px solid var(--sky); border-radius: 12px; font-size: 76px; line-height: 1; color: transparent; }
.phone-rotate span { position: absolute; right: -33px; top: 31px; color: var(--gold); font-size: 34px; }
.rotate-screen h2 { margin-top: 32px; font-size: 34px; }
.rotate-screen p { color: var(--muted); }

.modal { position: absolute; z-index: 60; inset: 0; display: grid; place-items: center; padding: 25px; background: rgba(0,5,15,.74); backdrop-filter: blur(8px); }
.modal-card { width: 100%; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: #0a2443; box-shadow: var(--shadow); }
.modal-card h3 { margin: 8px 0; font-size: 26px; text-transform: uppercase; }
.modal-card p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.enable-music { position: absolute; z-index: 70; left: 50%; bottom: max(15px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 15px; border: 1px solid var(--gold); border-radius: 999px; background: rgba(3,16,34,.94); color: var(--gold); cursor: pointer; font-size: 11px; font-weight: 900; box-shadow: var(--shadow); white-space: nowrap; }

@media (max-width: 700px) {
  #game-shell { width: min(100vw, calc(100dvh * .5625)); max-width: none; height: min(100dvh, calc(100vw * 1.7777778)); max-height: none; box-shadow: 0 0 42px rgba(0, 5, 20, .52); }
}

@media (max-height: 670px) {
  .home-copy h1 { font-size: 43px; margin-bottom: 9px; }
  .home-records { margin-bottom: 8px; }
  .button--play { min-height: 54px; }
  .screen--panel { gap: 12px; }
  .result-grid { margin-top: 10px; }
  .result-grid div { padding: 8px; }
  .result-hero > strong { font-size: 55px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
body.reduced-motion .reaction-panel { animation-name: screen-in; transform: none; }
body.reduced-motion .shot-clock.is-urgent .shot-clock-ring { animation: none; }
