:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #a9b6c7;
  --dim: #738197;
  --panel: rgba(8, 16, 29, 0.78);
  --panel-strong: rgba(7, 14, 26, 0.94);
  --line: rgba(197, 219, 247, 0.16);
  --line-strong: rgba(197, 219, 247, 0.28);
  --cyan: #69e4ff;
  --cyan-soft: rgba(105, 228, 255, 0.15);
  --amber: #ffc66d;
  --red: #ff6f7e;
  --green: #7be1ad;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #050a12; }
button, input, select { font: inherit; }
button, select, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { position: relative; width: 100%; height: 100%; min-height: 560px; overflow: hidden; isolation: isolate; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: radial-gradient(circle at 50% 35%, #15233c, #050a12 68%); }
.vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(3, 7, 13, .52), transparent 21%, transparent 64%, rgba(3, 7, 13, .88)), radial-gradient(circle, transparent 48%, rgba(2, 5, 10, .54) 100%); z-index: 2; }

.glass-panel { background: linear-gradient(155deg, rgba(18, 31, 51, .86), rgba(6, 13, 24, .74)); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px) saturate(1.1); }
.eyebrow { display: block; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .16em; line-height: 1.2; }
.tag { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border: 1px solid rgba(105, 228, 255, .24); border-radius: 999px; background: var(--cyan-soft); color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .12em; }

.boot-screen { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(23, 44, 71, .97), rgba(4, 8, 15, .99) 65%); transition: opacity .45s ease, visibility .45s ease; }
.boot-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card { width: min(440px, calc(100% - 40px)); text-align: center; }
.boot-card h1 { margin: 8px 0 10px; font-size: clamp(31px, 5vw, 52px); line-height: .96; letter-spacing: -.045em; }
.boot-card p { color: var(--muted); }
.boot-card .boot-note { margin-top: 14px; color: var(--dim); font-size: 12px; line-height: 1.45; }
.boot-mark { display: flex; align-items: flex-end; justify-content: center; gap: 7px; height: 54px; margin-bottom: 20px; }
.boot-mark span { width: 13px; border-radius: 10px 10px 3px 3px; background: linear-gradient(#f9fdff, #8fc4d1); box-shadow: 0 0 28px rgba(105, 228, 255, .26); animation: pinPulse 1.2s ease-in-out infinite alternate; }
.boot-mark span:nth-child(1) { height: 36px; }
.boot-mark span:nth-child(2) { height: 50px; animation-delay: .14s; }
.boot-mark span:nth-child(3) { height: 42px; animation-delay: .28s; }
@keyframes pinPulse { to { transform: translateY(-6px); filter: brightness(1.25); } }
.boot-meter { height: 3px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.boot-meter span { display: block; width: 22%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), #fff); animation: bootProgress 1.5s ease-in-out infinite; }
@keyframes bootProgress { 0% { transform: translateX(-110%); } 100% { transform: translateX(520%); } }

.top-hud { position: absolute; z-index: 10; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; min-height: 76px; display: grid; grid-template-columns: 150px minmax(520px, 1fr) 150px; align-items: stretch; gap: 12px; pointer-events: none; }
.top-hud > * { pointer-events: auto; }
.brand-block { align-self: center; padding-left: 5px; text-shadow: 0 3px 18px rgba(0,0,0,.8); }
.brand-kicker { display: block; color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.brand-block strong { font-size: 17px; letter-spacing: .08em; }

.scorecard { display: grid; grid-template-columns: repeat(9, minmax(44px, 1fr)) minmax(66px, 1.34fr); height: 72px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 12, 22, .76); box-shadow: 0 14px 40px rgba(0,0,0,.32); backdrop-filter: blur(16px); }
.frame-cell { position: relative; min-width: 0; display: grid; grid-template-rows: 20px 25px 1fr; border-right: 1px solid var(--line); }
.frame-cell:last-child { border-right: 0; }
.frame-cell.is-current { background: linear-gradient(180deg, rgba(105, 228, 255, .17), rgba(105, 228, 255, .035)); box-shadow: inset 0 2px var(--cyan); }
.frame-number { display: grid; place-items: center; color: var(--dim); font-size: 9px; font-weight: 800; }
.frame-rolls { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid rgba(255,255,255,.055); border-bottom: 1px solid rgba(255,255,255,.055); }
.frame-cell:last-child .frame-rolls { grid-template-columns: repeat(3, 1fr); }
.frame-mark { display: grid; place-items: center; border-left: 1px solid var(--line); font-size: 13px; font-weight: 800; }
.frame-mark:first-child { border-left: 0; }
.frame-total { display: grid; place-items: center; color: var(--ink); font-size: 15px; font-weight: 750; }
.frame-cell.is-current .frame-total { color: var(--cyan); }

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.icon-button { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 15, 27, .72); box-shadow: 0 12px 30px rgba(0,0,0,.25); backdrop-filter: blur(12px); cursor: pointer; font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.icon-button:hover { border-color: var(--line-strong); background: rgba(15, 29, 47, .88); }
.shot-clock { min-width: 76px; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(7,15,27,.8); }
.shot-clock-label { color: var(--dim); font-size: 7px; font-weight: 900; letter-spacing: .13em; }
.shot-clock strong { color: var(--green); font-variant-numeric: tabular-nums; font-size: 18px; }
.shot-clock.is-warning strong { color: var(--amber); }
.shot-clock.is-danger { border-color: rgba(255,111,126,.48); box-shadow: 0 0 28px rgba(255,111,126,.14); }
.shot-clock.is-danger strong { color: var(--red); }

.left-hud { position: absolute; z-index: 8; left: 16px; top: 105px; width: min(286px, 24vw); display: grid; gap: 10px; pointer-events: none; }
.left-hud > * { pointer-events: auto; }
.status-card { padding: 16px; border-radius: 14px; }
.status-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.status-heading h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.025em; }
.pattern-track { position: relative; height: 7px; margin: 15px 0 10px; overflow: visible; border-radius: 999px; background: rgba(255,255,255,.09); }
.pattern-track span { position: absolute; inset: 0 auto 0 0; width: 58.33%; border-radius: inherit; background: linear-gradient(90deg, rgba(105,228,255,.75), rgba(105,228,255,.22)); }
.pattern-track i { position: absolute; top: 50%; left: 58.33%; width: 2px; height: 15px; transform: translate(-1px,-50%); border-radius: 2px; background: #fff; box-shadow: 0 0 12px var(--cyan); }
.status-card > p { min-height: 42px; margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.48; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.status-grid div { display: flex; flex-direction: column; gap: 2px; }
.status-grid span { color: var(--dim); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.status-grid strong { font-size: 12px; }
.result-card { min-height: 100px; padding: 16px; border-radius: 14px; border-left: 3px solid var(--cyan); }
.result-card > strong { display: block; margin: 5px 0 3px; font-size: 20px; letter-spacing: -.025em; }
.result-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.result-card.is-strike { border-left-color: var(--amber); }
.result-card.is-strike .eyebrow { color: var(--amber); }
.result-card.is-foul { border-left-color: var(--red); }
.result-card.is-foul .eyebrow { color: var(--red); }

.right-hud { position: absolute; z-index: 8; right: 16px; top: 105px; width: min(215px, 19vw); display: grid; gap: 10px; pointer-events: none; }
.right-hud > * { pointer-events: auto; }
.pin-card { padding: 14px; border-radius: 14px; }
.pin-card-head { display: flex; justify-content: space-between; align-items: center; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: var(--cyan); cursor: pointer; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.text-button[aria-pressed="true"], .text-button:hover { color: #fff; }
.pin-map { position: relative; width: 150px; height: 104px; margin: 12px auto 3px; }
.pin-dot { position: absolute; width: 23px; height: 23px; display: grid; place-items: center; transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.86); border-radius: 50%; background: rgba(255,255,255,.13); color: #fff; font-size: 8px; font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,.28); transition: opacity .25s ease, transform .25s ease, background .25s ease; }
.pin-dot::after { content: ''; position: absolute; top: 4px; width: 13px; height: 3px; border-top: 1px solid var(--red); border-bottom: 1px solid var(--red); }
.pin-dot.is-down { opacity: .16; transform: translate(-50%, -50%) scale(.78); background: transparent; }
.quick-actions { display: grid; border-radius: 12px; overflow: hidden; }
.quick-actions button { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; text-align: left; }
.quick-actions button:last-child { border-bottom: 0; }
.quick-actions button:hover:not(:disabled) { background: rgba(105,228,255,.08); color: var(--ink); }
.quick-actions button:disabled { opacity: .35; cursor: not-allowed; }
.quick-actions button span { min-width: 19px; height: 19px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--cyan); font-size: 8px; }

.control-deck { position: absolute; z-index: 12; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); width: min(1110px, calc(100% - 32px)); transform: translateX(-50%); border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, rgba(13, 24, 40, .92), rgba(5, 11, 21, .94)); box-shadow: 0 24px 60px rgba(0,0,0,.46); backdrop-filter: blur(20px) saturate(1.08); }
.control-row { display: grid; grid-template-columns: 135px 78px repeat(4, minmax(112px, 1fr)) 162px; gap: 10px; align-items: end; padding: 13px 13px 9px; }
.control-field { min-width: 0; display: grid; gap: 7px; }
.control-field > span { min-height: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--dim); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.control-field > span b { color: var(--muted); font-weight: 750; }
.control-field output { color: var(--ink); font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }
.select-field select { width: 100%; height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: rgba(2,7,13,.5); color: var(--ink); font-size: 11px; }
.select-field select:focus { border-color: rgba(105,228,255,.5); }
.slider-field input[type="range"] { width: 100%; height: 18px; margin: 0; accent-color: var(--cyan); cursor: ew-resize; }
.bowl-button { height: 48px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid rgba(105,228,255,.46); border-radius: 11px; background: linear-gradient(135deg, rgba(105,228,255,.28), rgba(39,116,157,.34)); box-shadow: inset 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.3); cursor: pointer; }
.bowl-button:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.bowl-button:disabled { opacity: .4; cursor: not-allowed; }
.bowl-button-key { padding: 4px 6px; border: 1px solid rgba(255,255,255,.24); border-radius: 5px; color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.bowl-button-copy { display: flex; flex-direction: column; align-items: flex-start; }
.bowl-button-copy strong { font-size: 15px; letter-spacing: .08em; }
.bowl-button-copy small { color: var(--muted); font-size: 9px; }
.control-hint { min-height: 31px; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 13px 7px; border-top: 1px solid rgba(255,255,255,.045); color: var(--dim); font-size: 9px; }
kbd { min-width: 18px; height: 18px; display: inline-grid; place-items: center; margin-right: 2px; border: 1px solid var(--line); border-bottom-color: var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.035); color: var(--muted); font: 700 8px/1 inherit; }
.control-hint .text-button { margin-left: auto; }
.advanced-controls { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(220px, 1.2fr) minmax(220px, 1.2fr); gap: 18px; padding: 12px 15px 14px; border-top: 1px solid var(--line); }
.toggle-field { display: flex; align-items: center; gap: 10px; color: var(--muted); cursor: pointer; }
.toggle-field input { width: 17px; height: 17px; accent-color: var(--cyan); }
.toggle-field span { display: flex; flex-direction: column; gap: 1px; }
.toggle-field strong { color: var(--ink); font-size: 11px; }
.toggle-field small { color: var(--dim); font-size: 9px; }

.help-dialog, .game-dialog { max-height: calc(100% - 28px); padding: 0; overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; background: rgba(5, 11, 21, .97); color: var(--ink); box-shadow: 0 40px 100px rgba(0,0,0,.65); }
.help-dialog { width: min(760px, calc(100% - 28px)); }
.help-dialog::backdrop, .game-dialog::backdrop { background: rgba(0, 4, 10, .78); backdrop-filter: blur(9px); }
.dialog-card { padding: 23px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin: 5px 0 0; font-size: 28px; letter-spacing: -.035em; }
.dialog-close { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.04); cursor: pointer; font-size: 23px; }
.dialog-close:hover { border-color: var(--line-strong); background: rgba(255,255,255,.08); }
.dialog-intro { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 22px; }
.dialog-grid h3 { margin: 0 0 10px; font-size: 14px; }
.dialog-grid ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-grid dl { margin: 0; }
.dialog-grid dl div { display: grid; grid-template-columns: 84px 1fr; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.dialog-grid dt { color: var(--cyan); font-size: 11px; font-weight: 800; }
.dialog-grid dd { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.dialog-note { margin-top: 22px; padding: 14px; border: 1px solid rgba(255,198,109,.18); border-radius: 11px; background: rgba(255,198,109,.055); }
.dialog-note strong { color: var(--amber); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.dialog-note p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sound-test-status { min-height: 18px; margin: 16px 0 0; color: var(--dim); font-size: 11px; }
.sound-test-status.is-success { color: var(--cyan); }
.sound-test-status.is-error { color: var(--red); }
.dialog-actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 10px; margin-top: 18px; }
.dialog-primary, .dialog-secondary { min-height: 44px; border-radius: 10px; cursor: pointer; font-weight: 800; }
.dialog-primary { border: 1px solid rgba(105,228,255,.36); background: rgba(105,228,255,.13); }
.dialog-secondary { border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--muted); }
.dialog-primary:hover, .dialog-secondary:hover { filter: brightness(1.16); }
.dialog-actions.single-action { grid-template-columns: 1fr; }
.legal-note { margin: 15px 0 0; color: var(--dim); font-size: 10px; line-height: 1.5; }

.ball-dialog { width: min(890px, calc(100% - 28px)); }
.ball-dialog-card { padding-bottom: 19px; }
.ball-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-top: 18px; }
.ball-option { min-width: 0; min-height: 118px; display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.012)); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease; }
.ball-option:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(105,228,255,.055); }
.ball-option.is-selected { border-color: rgba(105,228,255,.68); background: linear-gradient(145deg, rgba(105,228,255,.16), rgba(105,228,255,.035)); box-shadow: inset 0 0 0 1px rgba(105,228,255,.12), 0 12px 28px rgba(0,0,0,.24); }
.ball-option:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.ball-option-orb { position: relative; width: 70px; aspect-ratio: 1; display: block; border-radius: 50%; box-shadow: inset -12px -14px 22px rgba(0,0,0,.52), inset 8px 9px 14px rgba(255,255,255,.12), 0 12px 24px rgba(0,0,0,.4); overflow: hidden; }
.ball-option-orb::before, .ball-option-orb::after { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #020407; box-shadow: inset 0 1px 2px rgba(255,255,255,.2); top: 17px; left: 23px; }
.ball-option-orb::after { left: 40px; }
.ball-option-copy { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ball-option-copy strong { font-size: 13px; line-height: 1.2; }
.ball-option-copy small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.ball-selection-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 17px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.028); }
.selected-ball-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.selected-ball-copy strong { font-size: 18px; }
.selected-ball-copy small { color: var(--muted); font-size: 11px; }
.ball-confirm-button { min-width: 180px; padding: 0 22px; }
.ball-dialog[data-required="true"] .dialog-head::after { content: 'CHOOSE TO CONTINUE'; align-self: center; margin-left: auto; color: var(--amber); font-size: 9px; font-weight: 850; letter-spacing: .12em; }

.leaderboard-dialog { width: min(700px, calc(100% - 28px)); }
.leaderboard-table-wrap { position: relative; min-height: 230px; margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.16); }
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.leaderboard-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 8px; font-weight: 850; letter-spacing: .11em; text-align: left; text-transform: uppercase; }
.leaderboard-table td { padding: 11px 12px; border-top: 1px solid rgba(255,255,255,.055); color: var(--muted); }
.leaderboard-table tbody tr:first-child td { border-top: 0; background: rgba(255,198,109,.055); }
.leaderboard-table td:nth-child(1) { width: 42px; color: var(--dim); font-variant-numeric: tabular-nums; }
.leaderboard-table td:nth-child(2) { width: 88px; color: var(--cyan); font-size: 14px; font-weight: 900; letter-spacing: .12em; }
.leaderboard-table td:nth-child(3) { width: 78px; color: var(--ink); font-size: 18px; font-weight: 850; font-variant-numeric: tabular-nums; }
.leaderboard-table td:last-child strong, .leaderboard-table td:last-child small { display: block; }
.leaderboard-table td:last-child strong { color: var(--ink); font-size: 11px; }
.leaderboard-table td:last-child small { margin-top: 3px; color: var(--dim); font-size: 9px; }
.leaderboard-empty { position: absolute; inset: 42px 0 0; display: grid; place-items: center; margin: 0; padding: 30px; color: var(--dim); font-size: 11px; text-align: center; }

.high-score-dialog { width: min(470px, calc(100% - 28px)); overflow: visible; text-align: center; }
.high-score-card { position: relative; padding: 32px 28px 25px; }
.high-score-card h2 { margin: 6px 0 2px; font-size: 27px; letter-spacing: -.035em; }
.high-score-burst { position: absolute; right: 20px; top: 18px; padding: 5px 8px; transform: rotate(3deg); border: 1px solid rgba(255,198,109,.48); border-radius: 5px; background: rgba(255,198,109,.12); color: var(--amber); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.high-score-value { display: block; margin: 16px 0 2px; color: var(--amber); font-size: 74px; line-height: .86; font-variant-numeric: tabular-nums; letter-spacing: -.06em; text-shadow: 0 0 42px rgba(255,198,109,.20); }
.high-score-meta { margin: 8px 0 20px; color: var(--muted); font-size: 11px; }
.initials-field { display: grid; gap: 8px; text-align: left; }
.initials-field span { color: var(--dim); font-size: 9px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.initials-field input { width: 100%; height: 66px; border: 1px solid var(--line-strong); border-radius: 12px; outline: none; background: rgba(0,0,0,.28); color: var(--ink); font-size: 34px; font-weight: 900; letter-spacing: .35em; text-align: center; text-indent: .35em; text-transform: uppercase; }
.initials-field input:focus { border-color: rgba(105,228,255,.72); box-shadow: 0 0 0 3px rgba(105,228,255,.10); }
.form-error { margin: 8px 0 0; color: var(--red); font-size: 10px; text-align: left; }

.toast { position: absolute; z-index: 30; left: 50%; top: 105px; max-width: min(420px, calc(100% - 36px)); padding: 10px 15px; transform: translate(-50%, -15px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel-strong); color: var(--ink); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: .22s ease; font-size: 11px; text-align: center; }
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.fatal-error { position: absolute; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,7,13,.96); }
.fatal-error[hidden] { display: none; }
.fatal-error > div { max-width: 520px; padding: 22px; border: 1px solid rgba(255,111,126,.4); border-radius: 14px; background: rgba(255,111,126,.06); }
.fatal-error strong { color: var(--red); font-size: 20px; }
.fatal-error p { color: var(--muted); line-height: 1.55; }

@media (max-width: 980px) {
  .top-hud { grid-template-columns: 0 minmax(0, 1fr) 96px; }
  .brand-block { display: none; }
  .left-hud { width: 250px; }
  .right-hud { width: 180px; }
  .control-row { grid-template-columns: 118px 68px repeat(2, 1fr) 150px; }
  .control-row .slider-field:nth-of-type(5), .control-row .slider-field:nth-of-type(6) { display: none; }
  .advanced-controls { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .app-shell { min-height: 620px; }
  .top-hud { left: 8px; right: 8px; top: max(7px, env(safe-area-inset-top)); grid-template-columns: minmax(0, 1fr) 48px; gap: 6px; }
  .scorecard { height: 61px; border-radius: 9px; grid-template-columns: repeat(9, minmax(28px, 1fr)) minmax(45px, 1.4fr); }
  .frame-cell { grid-template-rows: 16px 20px 1fr; }
  .frame-number { font-size: 7px; }
  .frame-mark { font-size: 10px; }
  .frame-total { font-size: 11px; }
  .top-actions { align-items: flex-start; }
  .top-actions .icon-button:first-of-type { display: none; }
  .icon-button { width: 43px; height: 43px; }
  .shot-clock { position: absolute; right: 48px; top: 65px; }
  .left-hud { left: 8px; top: 76px; width: 205px; }
  .status-card { padding: 11px; }
  .status-heading h2 { font-size: 15px; }
  .status-card > p, .pattern-track, .status-grid div:nth-child(3), .status-grid div:nth-child(4) { display: none; }
  .status-grid { padding-top: 8px; }
  .result-card { min-height: 76px; padding: 11px; }
  .result-card > strong { font-size: 16px; }
  .right-hud { right: 8px; top: 76px; width: 126px; }
  .pin-card { padding: 9px; }
  .pin-card-head .text-button { display: none; }
  .pin-map { width: 108px; height: 76px; margin-top: 8px; transform: scale(.82); transform-origin: 50% 0; }
  .quick-actions button { min-height: 34px; padding: 0 8px; font-size: 9px; }
  .control-deck { bottom: max(7px, env(safe-area-inset-bottom)); width: calc(100% - 16px); border-radius: 13px; }
  .control-row { grid-template-columns: 1fr 1fr 128px; gap: 8px; padding: 9px; }
  .select-field { display: none; }
  .control-row .slider-field { display: grid !important; }
  .control-row .slider-field:nth-of-type(5), .control-row .slider-field:nth-of-type(6) { display: none !important; }
  .control-row .slider-field:nth-of-type(3) { grid-column: 1; }
  .control-row .slider-field:nth-of-type(4) { grid-column: 2; }
  .bowl-button { grid-column: 3; grid-row: 1; height: 52px; }
  .bowl-button-key { display: none; }
  .control-hint { justify-content: flex-start; gap: 8px; overflow: hidden; white-space: nowrap; }
  .control-hint span:nth-child(n+3) { display: none; }
  .advanced-controls { grid-template-columns: 1fr; max-height: 220px; overflow: auto; }
  .dialog-grid { grid-template-columns: 1fr; gap: 20px; }
  .dialog-actions { grid-template-columns: 1fr; }
  .ball-grid { grid-template-columns: 1fr 1fr; }
  .ball-option { grid-template-columns: 60px minmax(0, 1fr); min-height: 92px; padding: 10px; }
  .ball-option-orb { width: 54px; }
  .ball-option-orb::before { top: 13px; left: 17px; }
  .ball-option-orb::after { top: 13px; left: 31px; }
  .ball-selection-footer { align-items: stretch; flex-direction: column; }
  .ball-confirm-button { width: 100%; min-width: 0; }
  .leaderboard-table th, .leaderboard-table td { padding-left: 8px; padding-right: 8px; }
  .leaderboard-table td:nth-child(1) { width: 30px; }
  .leaderboard-table td:nth-child(2) { width: 64px; }
  .leaderboard-table td:nth-child(3) { width: 58px; }
}

@media (max-width: 460px) {
  .ball-grid { grid-template-columns: 1fr; }
  .ball-dialog-card { padding: 18px 14px 15px; }
  .ball-dialog[data-required="true"] .dialog-head::after { display: none; }
  .leaderboard-card { padding: 18px 12px; }
  .leaderboard-table td:last-child small { display: none; }
  .high-score-card { padding: 29px 18px 20px; }
}

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