/* Hundreder Classic — indigo, electric accents, and square geometric numerals. */
@font-face { font-family: Fredoka; src: url('./assets/fonts/fredoka-700.woff2') format('woff2'); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: 'Chakra Petch'; src: url('./assets/fonts/chakra-petch-700.ttf') format('truetype'); font-style: normal; font-weight: 700; font-display: swap; }
:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px);
  --bg: #10132b; --surface: #1a203b; --raised: #293252; --stroke: #404c70; --text: #f5f7ff; --muted: #b3bfda; --faint: #8795b9;
  --accent: #6ae6ff; --accent-light: #b1f3ff; --violet: #b5a1ff; --coral: #ff91ae;
  --gold: var(--accent); --gold-light: var(--accent-light); --mint: #adff9b; --rose: var(--coral);
  --display: 'Chakra Petch', 'Arial Black', system-ui, sans-serif; --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: var(--ui); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, summary { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; transition: background .16s, border-color .16s, color .16s, opacity .16s, transform .16s; }
button:disabled { cursor: not-allowed; opacity: .4; }
button:active:enabled { transform: scale(.96); }
button:focus-visible, input:focus-visible, canvas:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
input[aria-invalid='true'] { outline: 2px solid var(--rose); outline-offset: 2px; }
[hidden] { display: none !important; }
.game-loader { position: fixed; z-index: 100; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: radial-gradient(ellipse at center,#29335b,var(--bg) 65%); }
.loader-mark { width: 68px; height: 68px; filter: drop-shadow(0 5px 25px #efc85b20); }
.loader-mark rect { fill: var(--gold); }
.loader-mark path { fill: none; stroke: #242018; stroke-width: 3.5; stroke-linecap: round; }
.loader-name { font: 700 25px var(--display); letter-spacing: -.5px; }
.loader-track { width: 120px; height: 3px; margin-top: 8px; border-radius: 4px; overflow: hidden; background: #ffffff19; }
.loader-track::after { content: ''; display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--gold); animation: load-sweep 1s ease-in-out infinite alternate; }
@keyframes load-sweep { from { transform: translateX(-100%); } to { transform: translateX(325%); } }
@media (prefers-reduced-motion: reduce) { .loader-track::after { animation: none; width: 100%; opacity: .7; } }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow: clip; background: radial-gradient(ellipse at 6% 25%,#674fd329,transparent 52%),radial-gradient(ellipse at 95% 50%,#3858ab26,transparent 58%),var(--bg); padding: max(12px, var(--safe-top)) max(28px, var(--safe-right)) max(20px, var(--safe-bottom)) max(28px, var(--safe-left)); }
.topbar { z-index: 20; display: flex; align-items: center; gap: 18px; height: 60px; flex: none; border-bottom: 1px solid #ffffff12; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-mark { width: 31px; height: 31px; }
.brand-mark rect { fill: var(--gold); }
.brand-mark path { fill: none; stroke: #242018; stroke-width: 3.5; stroke-linecap: round; }
.logo { color: var(--text); font: 700 24px/1 var(--display); letter-spacing: -.5px; }
.recent-rounds { display: flex; align-items: center; flex: 1; min-width: 0; gap: 6px; }
.rounds-list { display: flex; flex: 1; min-width: 0; align-items: center; gap: 6px; padding: 0 16px 0 0; margin: 0; list-style: none; overflow: hidden; mask-image: linear-gradient(90deg,#000 calc(100% - 16px),transparent); }
.rounds-list li { flex: none; }
.round-chip { display: grid; place-items: center; min-width: 62px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--rose); font: 700 13px var(--display); }
.round-chip span { width: 100%; padding: 6px 9px; border: 1px solid #98547370; border-radius: 4px; background: #49294480; }
.round-chip[data-result='positive'] { color: var(--mint); }
.round-chip[data-result='positive'] span { background: #24413b90; border-color: #519a6770; }
.round-chip[data-result='high'] { color: var(--gold-light); }
.round-chip[data-result='high'] span { background: #203f5590; border-color: #5299b570; }
.round-chip[data-result='neutral'] { color: var(--text); }
.round-chip[data-result='neutral'] span { background: var(--surface); border-color: var(--stroke); }
.round-chip:hover span { border-color: currentColor; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.balance-block { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border: 1px solid #698aaa60; border-radius: 6px; background: #23324c; color: var(--accent-light); }
.demo-pill { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.balance { font: 700 19px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.topup { height: 44px; min-width: 44px; margin-right: -10px; background: none; border: 0; font-size: 24px; color: var(--accent-light); }
.utility-button, .menu-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--stroke); border-radius: 6px; background: var(--surface); color: var(--text); padding: 0; }
.utility-button:hover, .menu-button:hover, .game-menu[open] .menu-button { border-color: var(--accent); color: var(--accent-light); background: var(--raised); }
.utility-button[aria-pressed='true'] { color: var(--gold); }
.game-menu { position: relative; }
.menu-button { list-style: none; cursor: pointer; }
.menu-button::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; top: calc(100% + 12px); right: 0; width: 250px; padding: 8px; border: 1px solid var(--stroke); border-radius: 8px; background: var(--surface); box-shadow: 0 16px 50px #050a2399; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 46px; width: 100%; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; text-align: left; }
.menu-item:hover { background: #ffffff08; }
.menu-item .icon { color: var(--muted); }
.menu-item { text-decoration: none; }
.menu-item kbd { margin-left: auto; color: var(--muted); font: 11px var(--ui); }
.sound-off { display: none; }
.menu-audio { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--stroke); }
.audio-toggle { position: relative; }
.audio-state { margin-left: auto; min-width: 37px; padding: 5px 7px; border-radius: 4px; background: var(--raised); color: var(--muted); text-align: center; font: 800 9px/1 var(--ui); letter-spacing: .6px; }
.audio-toggle[aria-pressed='true'] .icon, .audio-toggle[aria-pressed='true'] .audio-state { color: var(--accent); }
.audio-toggle[aria-pressed='false'] { color: var(--muted); }
.quick-music[aria-pressed='false'] .icon { opacity: .4; }
.menu-panel { max-height: calc(100dvh - 100px); overflow-y: auto; }
.history-preview-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
main, .game-shell { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.stage { position: relative; isolation: isolate; display: flex; flex-direction: column; flex: 1; min-height: 360px; width: 100%; margin: 0 auto; }
.glow-backdrop { position: absolute; z-index: -1; pointer-events: none; inset: -12px -40px 0; overflow: hidden; mask-image: linear-gradient(transparent,#000 18%,#000 70%,transparent); background: linear-gradient(#8799f208 1px,transparent 1px),linear-gradient(90deg,#8799f208 1px,transparent 1px); background-size: 64px 64px; }
.glow-backdrop::before { content: ''; position: absolute; inset: -15%; background: radial-gradient(ellipse at 26% 45%,#6ae6ff15,transparent 45%),radial-gradient(ellipse at 80% 30%,#a587ff22,transparent 50%); animation: atmosphere-float 16s ease-in-out infinite alternate; }
.glow-backdrop::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 48%,transparent,var(--bg) 88%); }
.revealing .glow-backdrop::before { animation-duration: 3s; }
@keyframes atmosphere-float { from { transform: translate(-16px,8px) scale(.98); } to { transform: translate(16px,-8px) scale(1.04); } }
.scoreboard { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.55fr) minmax(0,1fr); align-items: center; gap: clamp(18px, 2.4vw, 64px); width: 100%; flex: 1; margin: 0 auto; padding: 30px 0 10px; }
.num-block { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; min-width: 0; height: clamp(210px, 30dvh, 310px); border: 1px solid #ffffff19; border-radius: 8px; background: linear-gradient(150deg,#27345070,#19203980); box-shadow: inset 0 1px 0 #ffffff08,0 16px 40px #060b201a; }
.num-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 2px; line-height: 1.3; }
.num { font: 700 clamp(80px, 12vw, 160px)/1.02 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.055em; margin-top: 8px; color: var(--text); }
.num-block.player { border-color: #6ae6ff55; background: linear-gradient(150deg,#243f5766,#19203980); }
.num-block.player .num { color: var(--accent); }
.num-block.casino { border-color: #ff91ae40; background: linear-gradient(150deg,#49305355,#19203980); }
.num-block.casino .num { color: var(--coral); }
.num.is-masked { font-size: 0; color: transparent; }
.num.is-masked::after { content: '—'; font: 700 clamp(80px, 12vw, 160px)/1.02 var(--display); color: #9284b0; }
.number-underline { width: 24px; height: 3px; border-radius: 2px; background: #9295a14d; margin-top: 14px; }
.player .number-underline { background: var(--accent); }
.casino .number-underline { background: var(--coral); }
.focus-row { align-self: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; position: relative; padding: 0 0 44px; }
.focus { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; width: 100%; }
.focus-label { font-size: 11px; font-weight: 700; letter-spacing: 3px; color: #d3d3dc; }
.focus-value { color: var(--mint); font: 700 clamp(100px, 13vw, 176px)/1.02 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.045em; white-space: nowrap; text-shadow: 0 4px 0 #090f26; }
.focus-value.bump { animation: number-bump .25s ease-out; }
.focus[class*='leap-'] .focus-value { animation: result-land .48s ease-out; }
.win-banner { display: flex; align-items: center; gap: 9px; position: absolute; bottom: -6px; padding: 9px 16px; border: 1px solid #adff9b55; border-radius: 6px; background: #243c3bd9; color: var(--text); opacity: 0; transform: translateY(5px); transition: opacity .22s, transform .22s; white-space: nowrap; }
.win-banner.visible { opacity: 1; transform: translateY(0); }
.return-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: #ceced7; }
#payout-amount { font: 700 22px var(--display); color: var(--mint); }
.win-small { border-color: var(--stroke); background: var(--surface); }
.win-small #payout-amount { color: #ececf1; }
.distance-label { height: 28px; flex: none; display: flex; justify-content: center; align-items: center; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 2px; }
.picker-area { flex: none; width: 100%; margin: 0 auto 16px; }
.picker-controls { display: flex; align-items: center; gap: 12px; width: 100%; height: 112px; }
.pick-step { width: 44px; height: 48px; flex: none; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--stroke); border-radius: 6px; color: var(--accent-light); }
.pick-step svg { width: 11px; height: 19px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pick-step:hover:enabled { background: var(--raised); color: var(--accent); border-color: var(--accent); }
.ruler-wrap { position: relative; flex: 1; min-width: 0; height: 100%; }
.ruler { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.indicator { position: absolute; top: 4px; bottom: 8px; left: 50%; width: 2px; transform: translateX(-50%); border-radius: 2px; background: var(--accent); box-shadow: 0 0 16px #6ae6ff55; pointer-events: none; }
.indicator::before { content: ''; position: absolute; top: -2px; left: -4px; width: 10px; height: 7px; background: var(--gold); clip-path: polygon(0 0,100% 0,50% 100%); }
.fade { position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
.fade-left { left: 0; background: linear-gradient(90deg,var(--bg),transparent); }
.fade-right { right: 0; background: linear-gradient(-90deg,var(--bg),transparent); }
.controls { --step-size: 44px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr) minmax(0,1fr); align-items: stretch; gap: 20px; width: 100%; margin: 0 auto; padding: 16px; border: 1px solid #5e6c9990; border-radius: 10px; background: linear-gradient(150deg,#252e4bf2,#1a213af2); box-shadow: 0 16px 50px #050a2355, inset 0 1px 0 #ffffff07; }
.control-card { container: settings / inline-size; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.mini-label { display: block; font-size: 10px; line-height: 1.3; font-weight: 800; letter-spacing: 1.1px; color: #c7c9d2; }
.control-card > .mini-label { margin-left: 12px; }
.bet-section { grid-column: 1; grid-row: 1; }
.custom-row, .number-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; margin-top: 8px; }
.amount-stepper, .pick-stepper { display: grid; grid-template-columns: var(--step-size) minmax(0,1fr) var(--step-size); align-items: center; min-width: 0; padding: 1px; border: 1px solid var(--stroke); border-radius: 6px; background: #12182e; }
.step-btn { position: relative; isolation: isolate; flex: none; display: grid; place-items: center; width: var(--step-size,44px); height: 44px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text); font: 500 22px var(--ui); }
.step-btn::before { content: ''; position: absolute; z-index: -1; inset: 5px; border-radius: inherit; background: #39456890; transition: background .16s; }
.step-btn:hover:enabled { color: var(--gold-light); }
.step-btn:hover:enabled::before { background: #50618d; }
.bet-shortcuts { display: flex; justify-content: center; align-items: center; gap: 6px; }
.bet-scale { width: 44px; font: 700 15px var(--display); }
.amount-entry { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: var(--text); font: 700 21px var(--display); }
.custom-input, #pick-input { width: 100%; min-width: 0; padding: 4px 0; height: 44px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: 700 23px var(--display); font-variant-numeric: tabular-nums; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.custom-input { width: 5.7ch; max-width: 100%; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.play-section { display: flex; grid-column: 2; grid-row: 1; }
.play { width: 100%; min-height: 104px; border: 1px solid #c0f7ff; border-bottom: 3px solid #218faa; border-radius: 6px; color: #0e2940; background: linear-gradient(180deg,#a0efff,var(--accent) 90%); font: 700 36px/1 var(--display); letter-spacing: 1px; box-shadow: inset 0 1px 0 #e0fbff,0 4px 0 #10223a,0 8px 25px #6ae6ff18; }
.play:hover:enabled { background: linear-gradient(180deg,#c5f6ff,#8ceeff); box-shadow: inset 0 1px 0 #effdff,0 4px 0 #10223a,0 0 30px #6ae6ff32; }
.play:active:enabled { transform: translateY(2px) scale(.985); }
.play[aria-busy='true'] { opacity: .78; font-size: 30px; }
.number-section { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; }
#pick-input { color: var(--accent); flex: 1; font-size: 28px; }
.random-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 44px; font-size: 9px; font-weight: 600; letter-spacing: 1px; }
.random-button span { display: none; }
.random-button .icon { width: 18px; height: 18px; }
@container settings (max-width: 300px) {
  .custom-row, .number-row { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .random-button { justify-self: center; width: 106px; }
  .random-button span { display: inline; }
  .random-button::before { inset: 5px 0; }
}
.num.impact { animation: result-land .4s ease-out; }
.balance.credited { animation: balance-credit .5s ease-out; }
.error-banner { position: fixed; z-index: 40; left: 50%; bottom: max(28px,var(--safe-bottom)); max-width: min(90vw,480px); transform: translate(-50%,12px); opacity: 0; pointer-events: none; transition: opacity .2s,transform .2s; background: #3e2926; border: 1px solid #ba8273; color: #ffe8da; padding: 14px 20px; border-radius: 12px; font-size: 13px; line-height: 1.5; box-shadow: 0 12px 40px #0008; }
.error-banner.visible { opacity: 1; transform: translate(-50%,0); }
dialog { width: min(600px,calc(100vw - 28px)); max-height: calc(100dvh - max(16px,var(--safe-top)) - max(16px,var(--safe-bottom))); border: 1px solid var(--stroke); border-radius: 10px; padding: 24px; background: var(--surface); color: var(--text); box-shadow: 0 30px 90px #050a2399; }
dialog::backdrop { background: #070d25bd; backdrop-filter: blur(8px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--muted); }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--stroke); border-radius: 10px; background: #292b33; color: var(--text); font-size: 25px; }
.icon-button:hover { background: #3a3c46; }
dialog h2 { font: 700 28px var(--display); margin: 12px 0 24px; }
.help-steps { list-style: none; counter-reset: steps; padding: 0; display: grid; gap: 20px; }
.help-steps li { counter-increment: steps; position: relative; padding-left: 36px; }
.help-steps li::before { content: counter(steps,decimal-leading-zero); position: absolute; left: 0; top: 0; font: 700 16px var(--display); color: var(--gold); }
.help-steps strong { display: block; font-size: 14px; margin-bottom: 6px; }
.help-steps span, .dialog-note { color: #c9cad4; font-size: 13px; line-height: 1.7; }
.payout-reference { margin-top: 24px; }
.payout-reference h3 { font-size: 13px; color: var(--muted); font-weight: 600; }
.dialog-note { margin: 20px 0 0; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 10px; border-bottom: 1px solid #ffffff16; font-size: 12px; color: #dedfe7; }
th { font-weight: 600; color: var(--muted); }
th:last-child, td:last-child { text-align: right; }
#history-dialog { width: min(780px,calc(100vw - 28px)); }
.history-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.history-heading h2 { display: flex; gap: 10px; align-items: center; margin: 0; font-size: 22px; }
.history-heading h2 > span { font: 700 12px var(--ui); color: var(--muted); }
.session-label { font-size: 9px; color: var(--muted); letter-spacing: 1px; }
.history-scroll { overflow-x: auto; }
.history-table { min-width: 590px; }
.positive { color: var(--mint); } .negative { color: var(--rose); }
.history-empty { display: flex; gap: 14px; align-items: center; padding: 35px 0; }
.history-empty strong { font-size: 14px; }
.history-empty p { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.empty-symbol { color: var(--gold); font-size: 24px; } .empty-dots { display: none; }
.game-details { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 20px 0 10px; border-top: 1px solid var(--stroke); padding-top: 16px; font-size: 12px; color: var(--muted); }
.game-details strong { color: var(--gold); }
.fair-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0; border: 0; background: none; }
.fair-title { display: flex; gap: 9px; align-items: center; color: var(--text); font-size: 13px; font-weight: 600; }
.fair-chevron { display: inline-block; font-size: 22px; color: var(--gold); transition: transform .2s; }
.fair-toggle[aria-expanded='true'] .fair-chevron { transform: rotate(180deg); }
.fair-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 16px; border: 1px solid var(--stroke); border-radius: 12px; background: #111217; }
.fair-note { grid-column: 1/-1; font-size: 12px; line-height: 1.7; color: var(--muted); margin: 0; }
.fair-field { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.fair-label { color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.fair-value { font: 11px/1.7 monospace; color: #dedfe7; overflow-wrap: anywhere; }
.fair-seed-row { display: flex; gap: 8px; }
.fair-input { min-width: 0; width: 100%; height: 44px; padding: 8px; border: 1px solid var(--stroke); border-radius: 6px; background: #202128; color: var(--text); }
.fair-btn { min-height: 44px; padding: 8px 12px; border: 1px solid #76663a; border-radius: 8px; background: #35301e; color: var(--gold-light); font-size: 11px; font-weight: 700; }
.fair-btn:hover:enabled { background: #504522; }
.fair-btn.wide, .fair-result { grid-column: 1/-1; }
.fair-result { overflow-wrap: anywhere; white-space: pre-wrap; padding: 12px; border-radius: 8px; font: 12px/1.7 monospace; background: #29391c; color: var(--mint); }
.fair-result.bad { color: #ffc3b5; background: #3e2926; }
@keyframes number-bump { 50% { transform: translateY(-2px); } }
@keyframes result-land { 35% { transform: scale(1.06); } }
@keyframes balance-credit { 50% { transform: scale(1.04); } }
@media (max-width: 1100px) {
  .app { padding-left: max(20px,var(--safe-left)); padding-right: max(20px,var(--safe-right)); }
  .topbar { gap: 12px; }
  .logo { font-size: 21px; }
  .controls { grid-template-columns: minmax(0,1fr) minmax(0,.95fr) minmax(0,1fr); gap: 16px; padding: 14px; }
  .amount-entry, .custom-input { font-size: 21px; }
  .scoreboard { gap: 20px; padding-left: 0; padding-right: 0; }
}
@media (max-width: 760px) {
  .app { padding: max(8px,var(--safe-top)) max(12px,var(--safe-right)) max(12px,var(--safe-bottom)) max(12px,var(--safe-left)); }
  .topbar { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; height: auto; min-height: 54px; padding-bottom: 8px; }
  .brand { gap: 6px; } .brand-mark { width: 24px; height: 24px; } .logo { font-size: 18px; }
  .header-actions { grid-column: 3; grid-row: 1; gap: 6px; }
  .balance-block { padding: 0 9px; gap: 6px; min-height: 42px; }
  .demo-pill { font-size: 7px; letter-spacing: .7px; }
  .balance { font-size: 16px; }
  .recent-rounds { grid-column: 1/-1; grid-row: 2; width: 100%; }
  .round-chip { font-size: 12px; min-width: 58px; height: 44px; }
  .stage { min-height: 300px; }
  .scoreboard { grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 18px 8px 12px; max-width: 620px; align-content: center; }
  .focus-row { grid-column: 1/-1; grid-row: 1; padding-bottom: 38px; }
  .focus { gap: 8px; }
  .focus-value { font-size: clamp(100px,23vw,160px); letter-spacing: -.055em; }
  .focus-label { font-size: 10px; letter-spacing: 2px; }
  .num-block { height: clamp(128px,19dvh,184px); border-radius: 6px; }
  .num-label { font-size: 9px; letter-spacing: 1.5px; }
  .num { font-size: clamp(78px,17vw,120px); letter-spacing: -.055em; margin-top: 4px; }
  .num.is-masked::after { font-size: clamp(78px,17vw,120px); }
  .number-underline { margin-top: 4px; width: 18px; height: 2px; }
  .win-banner { padding: 5px 14px; bottom: 0; }
  #payout-amount { font-size: 19px; }
  .distance-label { height: 24px; font-size: 10px; letter-spacing: 1.4px; }
  .picker-area { margin-bottom: 8px; }
  .picker-controls { height: 84px; gap: 8px; }
  .pick-step { width: 44px; height: 44px; }
  #pick-input { font-size: 24px; }
  dialog { padding: 18px; }
  .fair-panel { grid-template-columns: 1fr; padding: 12px; }
}
/* Keep the action below both settings when the game is in a narrow panel. */
@media (max-width: 760px), (max-width: 900px) and (min-height: 651px) {
  .controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px 20px; padding: 14px; border-radius: 8px; }
  .number-section { grid-column: 2; grid-row: 1; }
  .play-section { grid-column: 1/-1; grid-row: 2; }
  .play { min-height: 60px; font-size: 29px; border-radius: 6px; }
  .amount-entry, .custom-input { font-size: 19px; }
  .bet-scale { font-size: 15px; }
}
@media (max-width: 420px) {
  .controls { --step-size: 36px; gap: 10px 14px; padding: 10px; }
  .amount-entry, .custom-input { font-size: 17px; }
  .mini-label { font-size: 9px; letter-spacing: .8px; }
}
@media (max-width: 380px) {
  .app { padding-left: max(8px,var(--safe-left)); padding-right: max(8px,var(--safe-right)); }
  .brand-mark { display: none; } .logo { font-size: 17px; }
  .balance { font-size: 15px; }
  .balance-block { gap: 4px; padding: 0 7px; }
}
@media (max-width: 350px) {
  .brand-mark { display: block; }
  .logo { display: none; }
  .controls { --step-size: 32px; }
  .amount-entry, .custom-input { font-size: 15px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .stage { min-height: 236px; }
  .scoreboard { padding: 8px 16px 2px; gap: 6px 18px; }
  .focus-value { font-size: 88px; }
  .focus-row { padding-bottom: 27px; }
  .focus { gap: 4px; }
  .num-block { height: 90px; border-radius: 6px; }
  .num, .num.is-masked::after { font-size: 60px; }
  .number-underline { display: none; }
  .picker-controls { height: 68px; }
  .distance-label { height: 19px; font-size: 9px; }
  .win-banner { padding: 3px 12px; }
  #payout-amount { font-size: 17px; }
  .return-label { font-size: 9px; }
}
@media (min-width: 761px) and (max-height: 650px) {
  .app { padding-top: 8px; padding-bottom: 12px; }
  .topbar { height: 52px; padding-bottom: 8px; }
  .stage { min-height: 260px; }
  .scoreboard { padding-top: 12px; padding-bottom: 0; }
  .num-block { height: 132px; }
  .num, .num.is-masked::after { font-size: 70px; }
  .focus-value { font-size: 100px; }
  .picker-controls { height: 90px; }
  .picker-area { margin-bottom: 8px; }
}
@media (max-width: 760px) and (max-height: 600px) and (orientation: portrait) {
  .scoreboard { padding: 4px 12px 0; gap: 4px 16px; }
  .focus-value { font-size: 70px; }
  .focus { gap: 2px; }
  .focus-row { padding-bottom: 22px; }
  .focus-label { font-size: 9px; }
  .num-block { height: 66px; }
  .num, .num.is-masked::after { font-size: 46px; }
  .num { margin-top: 2px; }
  .distance-label { height: 14px; }
  .picker-controls { height: 56px; }
  .picker-area { margin-bottom: 4px; }
  .controls { row-gap: 4px; padding: 8px; }
  .custom-row, .number-row { margin-top: 4px; }
  .play { min-height: 52px; font-size: 27px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .app { padding-top: max(6px,var(--safe-top)); padding-bottom: max(8px,var(--safe-bottom)); }
  .topbar { display: flex; min-height: 46px; height: 46px; gap: 10px; padding-bottom: 4px; }
  .recent-rounds { width: auto; flex: 1; }
  .logo { font-size: 19px; } .brand-mark { width: 24px; height: 24px; }
  .balance { font-size: 16px; }
  .stage { min-height: 174px; }
  .scoreboard { display: grid; grid-template-columns: 1fr 2.4fr 1fr; gap: 30px; max-width: 700px; padding: 6px 32px 0; }
  .focus-row { grid-column: 2; grid-row: 1; padding-bottom: 26px; }
  .num-block.player { grid-column: 1; grid-row: 1; }
  .num-block.casino { grid-column: 3; grid-row: 1; }
  .focus-value { font-size: 60px; letter-spacing: -2px; }
  .focus { gap: 2px; }
  .focus-label { font-size: 9px; }
  .num-block { height: 86px; border-radius: 6px; }
  .num, .num.is-masked::after { font-size: 45px; margin-top: 4px; }
  .num-label { font-size: 9px; }
  .number-underline { display: none; }
  .win-banner { padding: 3px 10px; bottom: -1px; }
  #payout-amount { font-size: 16px; }
  .return-label { font-size: 8px; }
  .distance-label { height: 17px; font-size: 9px; }
  .picker-controls { height: 48px; }
  .picker-area { margin-bottom: 4px; }
  .controls { --step-size: 36px; grid-template-columns: minmax(0,1fr) minmax(0,.9fr) minmax(0,1fr); padding: 10px; gap: 16px; }
  .custom-row, .number-row { gap: 2px; margin-top: 4px; }
  .bet-scale, .random-button { height: 36px; }
  .number-section { grid-column: 3; grid-row: 1; }
  .play-section { grid-column: 2; grid-row: 1; }
  .play { min-height: 64px; font-size: 27px; }
  .mini-label { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Scale with the available desktop space, including wide external displays. */
@media (min-width: 1200px) and (min-height: 701px) {
  .app { padding-left: max(clamp(28px,2.2vw,72px),var(--safe-left)); padding-right: max(clamp(28px,2.2vw,72px),var(--safe-right)); padding-bottom: max(clamp(20px,2.4dvh,44px),var(--safe-bottom)); }
  .scoreboard { width: 100%; gap: clamp(28px,2.4vw,92px); }
  .num-block { height: clamp(232px,34dvh,500px); border-radius: 8px; }
  .num, .num.is-masked::after { font-size: clamp(144px,min(13vw,28dvh),360px); }
  .num-label, .focus-label { font-size: clamp(11px,.85vw,16px); }
  .focus-value { font-size: clamp(156px,min(13vw,30dvh),400px); }
  .picker-area { width: 100%; margin-bottom: clamp(16px,2dvh,32px); }
  .picker-controls { height: clamp(112px,12dvh,168px); }
  .controls { width: 100%; gap: clamp(20px,2vw,64px); padding: clamp(16px,1.4vw,26px); }
  .play { min-height: clamp(104px,11dvh,150px); font-size: clamp(36px,2.8vw,54px); }
  .focus-row { padding-bottom: 52px; }
  #payout-amount { font-size: clamp(22px,1.65vw,36px); }
}
/* Leave room for the ruler and controls on wide but shallow screens. */
@media (min-width: 761px) and (min-height: 651px) and (max-height: 850px) {
  .scoreboard { padding-top: 16px; }
  .focus-value { font-size: clamp(100px,min(13vw,24dvh),200px); }
  .focus-row { padding-bottom: 44px; }
}
