:root {
  color-scheme: dark;
  --bg: #080410;
  --panel: #150b24;
  --fg: #f7f3ff;
  --muted: #ad9fbf;
  --purple: #7a2cff;
  --pink: #ff2abf;
  --cyan: #9ffcff;
  --border: rgba(180, 85, 245, .23);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { color: var(--fg); background: radial-gradient(ellipse at 13% 5%, #35134b66, transparent 44%), radial-gradient(ellipse at 88% 82%, #39103533, transparent 48%), var(--bg); }
button, input { font: inherit; }
button, a { -webkit-touch-callout: none; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
button, a, input { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--cyan); }
a { color: inherit; text-decoration: none; }
svg { display: block; width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.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; }
.game-shell { width: min(1100px, 100%); height: 100vh; height: 100svh; height: 100dvh; margin: auto; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); display: grid; grid-template-rows: auto minmax(0,1fr); gap: 22px; position: relative; }
.game-header { display: grid; grid-template-columns: 110px minmax(0,1fr) 110px; align-items: center; min-height: 52px; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
.back-link { display: inline-flex; align-items: center; gap: 5px; width: fit-content; min-height: 44px; font-size: 12px; font-weight: 650; color: #c6b2d8; border-radius: 10px; padding: 0 8px 0 0; }
.back-link svg { width: 19px; height: 19px; }
.game-brand { text-align: center; }
.brand-kicker { display: block; color: #b892ce; font-size: 8px; font-weight: 800; letter-spacing: .19em; margin-bottom: 4px; }
.game-brand h1 { font-size: 25px; font-weight: 900; letter-spacing: -.045em; line-height: 1; margin: 0; }
.game-brand h1 span { color: #de8be7; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 12px; color: #d4bde7; background: #170c25a3; padding: 0; }
#settings-button { justify-self: end; }
.game-layout { min-height: 0; display: grid; grid-template-columns: 215px minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto; gap: 18px 32px; }
.game-info { grid-column: 1; grid-row: 1; align-self: start; min-width: 0; display: flex; flex-direction: column; gap: 21px; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-card { position: relative; min-width: 0; padding: 16px 14px 14px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(125deg, #211036b3, #11091d); overflow: hidden; }
.stat-label { display: block; font-size: 8px; font-weight: 800; letter-spacing: .12em; color: #ad91c2; margin-bottom: 5px; white-space: nowrap; }
.score-card strong { font-size: 31px; letter-spacing: -.04em; line-height: 1; font-weight: 850; font-variant-numeric: tabular-nums; }
.score-card-current { border-color: #b34ae345; background: linear-gradient(115deg, #371451a3, #1a0a2da3); }
.score-card-current strong { color: #ffc6f1; }
.score-spark, .best-icon { position: absolute; right: 8px; top: 9px; color: #b565d5; font-size: 10px; opacity: .75; }
.best-icon { width: 11px; height: 11px; }
.mode-panel { min-width: 0; }
.mode-tabs { display: flex; flex-direction: column; gap: 8px; }
.mode-button { border: 1px solid var(--border); background: #140b23; text-align: left; min-height: 45px; padding: 10px 15px; border-radius: 11px; color: #b5a2c7; font-size: 12px; font-weight: 750; position: relative; }
.mode-button::after { content: ""; position: absolute; right: 14px; top: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: #705780; }
.mode-button.is-active, .mode-button[aria-pressed="true"] { border-color: #bc70f16b; background: linear-gradient(110deg, #361655, #220e36); color: #f4dfff; }
.mode-button.is-active::after, .mode-button[aria-pressed="true"]::after { background: #ea77ef; box-shadow: 0 0 10px #e647ca66; }
#mode-description { margin: 11px 1px 0; font-size: 11px; color: #a995bb; line-height: 1.6; min-height: 34px; }
.desktop-note { margin: 16px 0 0; padding: 21px 18px; border-left: 1px solid #8233a74d; }
.note-orbit { color: #d486e2; font-size: 23px; }
.desktop-note p { font-size: 22px; letter-spacing: -.04em; line-height: 1.25; margin: 15px 0 12px; color: #a98eb9; }
.desktop-note strong { font-weight: 750; color: #dec7eb; }
.desktop-note>span:last-child { color: #9f87ae; font-size: 10px; }
.arena { grid-column: 2; grid-row: 1 / 3; min-width: 0; min-height: 0; display: grid; grid-template-rows: 23px minmax(0,1fr) 24px; gap: 5px; }
.board-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 3px; gap: 8px; min-width: 0; font-size: 8px; font-weight: 800; letter-spacing: .12em; color: #bca8c8; }
#session-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-signature { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: #9c83af; }
.board-signature i { width: 5px; height: 5px; border-radius: 50%; background: #d786ed; box-shadow: 0 0 9px #df77fa77; }
.board-area { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; container-type: size; }
.board-wrap { position: relative; width: 100%; max-height: 100%; aspect-ratio: 1; border: 1px solid #9855c04d; border-radius: 21px; overflow: hidden; background: radial-gradient(circle at 55% 42%, #2c11343b, transparent 65%), #0e0817; box-shadow: 0 0 0 5px #39194c14, inset 0 0 28px #03010799, 0 15px 42px #0000002a; isolation: isolate; touch-action: none; -webkit-user-select: none; user-select: none; }
@supports (width: 100cqw) { .board-wrap { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); aspect-ratio: auto; } }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 40%, #170c29e8, #0a0516a6 75%); z-index: 3; overflow: auto; -webkit-overflow-scrolling: touch; }
.overlay-panel { width: min(330px, 100%); text-align: center; }
.overlay-kicker { display: block; color: #ef84e2; font-size: 9px; font-weight: 850; letter-spacing: .18em; margin-bottom: 16px; }
.overlay-title { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: .99; font-weight: 850; letter-spacing: -.065em; }
.overlay-title span { background: linear-gradient(110deg, #b486ff 5%, #fa59d5 96%); color: transparent; -webkit-background-clip: text; background-clip: text; }
.overlay-copy { color: #b9a4ca; font-size: 12px; line-height: 1.8; margin: 16px 0 20px; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 12px 20px; border: 1px solid #c660ec; border-radius: 12px; font-size: 12px; font-weight: 800; letter-spacing: .01em; }
.primary-button { background: linear-gradient(110deg, #7a2cff, #df36b8); color: #fff; box-shadow: 0 5px 24px #9a25bf28; }
.primary-button>span { margin-left: 10px; font-size: 18px; font-weight: 450; }
.secondary-button { background: #251237; border-color: #9c50bf55; color: #dac6e8; }
.overlay-hint { font-size: 9px; color: #917d9f; line-height: 1.6; margin: 16px 0 0; }
.overlay-stats { display: flex; justify-content: center; gap: 25px; margin: 20px 0; }
.overlay-stats>div { display: grid; gap: 5px; }
.overlay-stats strong { font-size: 30px; font-weight: 850; letter-spacing: -.035em; }
.overlay-stats span, .overlay-stats small { font-size: 9px; font-weight: 750; color: #b99bcc; text-transform: uppercase; letter-spacing: .07em; }
.overlay-record, .new-best { display: inline-block; padding: 7px 11px; color: #f5cc83; border: 1px solid #bb8f4444; border-radius: 8px; background: #4b35152e; font-size: 10px; font-weight: 800; margin-top: 12px; }
.power-status { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; overflow: hidden; }
.power-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #a768d540; border-radius: 7px; padding: 5px 7px; color: #d5bde7; background: #22103288; font-size: 9px; white-space: nowrap; font-weight: 650; line-height: 1; }
.power-chip[data-power="slow"], .power-chip.slow { color: #9ffcff; border-color: #67d8dc44; }
.power-chip[data-power="double"], .power-chip.double { color: #f5a1e4; border-color: #ed64c844; }
.power-chip[data-power="shield"], .power-chip.shield { color: #b4a8ff; border-color: #9a8cf144; }
.power-chip[data-power="gold"], .power-chip.gold { color: #f7d28b; border-color: #d6ab5844; }
.power-status:empty::before { content: "COLLECT. GROW. GO AGAIN."; color: #685879; font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.power-empty { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8b759d; font-size: 9px; text-align: center; }
.game-controls { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 13px; min-width: 0; }
.action-area { width: 100%; min-width: 0; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.control-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 8px; font-size: 10px; font-weight: 700; color: #c1adce; background: linear-gradient(115deg, #1c0e2c, #150b24); border: 1px solid #8850ab40; border-radius: 11px; white-space: nowrap; touch-action: manipulation; }
.control-button svg { width: 17px; height: 17px; }
.control-hint { margin: 10px 0 0; font-size: 9px; line-height: 1.5; color: #806c91; text-align: center; }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px); gap: 5px; touch-action: none; -webkit-user-select: none; user-select: none; }
.dpad button { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #9761b645; background: linear-gradient(125deg, #2a143d, #1a0d2a); border-radius: 12px; color: #d8bde9; touch-action: none; padding: 0; }
.dpad button svg { width: 21px; height: 21px; stroke-width: 2; fill: none; }
.dpad button[data-direction="up"] { grid-column: 2; grid-row: 1; }
.dpad button[data-direction="left"] { grid-column: 1; grid-row: 2; }
.dpad button[data-direction="down"] { grid-column: 2; grid-row: 2; }
.dpad button[data-direction="right"] { grid-column: 3; grid-row: 2; }
.dpad button:active, .dpad button.is-pressed { background: #57227a; border-color: #d489f8; color: #fff; }
.control-button:active, .icon-button:active { background: #371746; }
.score-pulse, .score-bump, .score-pop { display: inline-block; animation: score-pop .3s ease-out; }
@keyframes score-pop { 35% { transform: scale(1.13); color: #fff; } }
.toast { position: fixed; z-index: 15; top: max(80px, calc(env(safe-area-inset-top) + 70px)); left: 50%; transform: translateX(-50%); max-width: min(360px, calc(100% - 28px)); min-width: 190px; text-align: center; padding: 13px 17px; border: 1px solid #c77bf267; border-radius: 14px; background: #261137ed; color: #f5d9ff; font-size: 12px; font-weight: 700; line-height: 1.6; box-shadow: 0 8px 28px #0006; pointer-events: none; }
.save-note { position: absolute; z-index: 10; left: 12px; right: 12px; bottom: max(8px, env(safe-area-inset-bottom)); margin: 0; text-align: center; color: #ffd7a2; background: #312117f2; border: 1px solid #b58a5144; border-radius: 9px; padding: 8px 12px; font-size: 10px; line-height: 1.5; pointer-events: none; }
.game-dialog { width: min(520px, calc(100vw - 26px)); max-height: min(760px, calc(100svh - 36px)); padding: 0; border: 1px solid #ad64d768; border-radius: 21px; color: var(--fg); background: linear-gradient(135deg, #211034, #12091f 70%); box-shadow: 0 18px 70px #0009; overflow: auto; overscroll-behavior: contain; }
.game-dialog::backdrop { background: #030108c4; backdrop-filter: blur(5px); }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 22px 22px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #20102ff5; border-bottom: 1px solid #a66dd32d; }
.dialog-kicker { display: block; color: #e69bdd; font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.dialog-header h2 { margin: 7px 0 0; font-size: 24px; letter-spacing: -.035em; }
.dialog-header .icon-button { flex-shrink: 0; }
.dialog-body { padding: 21px 22px 24px; }
.dialog-intro { margin: 0 0 18px; color: #b5a0c5; font-size: 12px; line-height: 1.75; }
.setting-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid #9766b727; cursor: pointer; min-height: 73px; }
.setting-row>span:first-child { min-width: 0; }
.setting-row strong { display: block; font-size: 13px; font-weight: 720; margin-bottom: 5px; }
.setting-row small { display: block; color: #a994ba; font-size: 11px; line-height: 1.65; }
.setting-row input { position: absolute; width: 48px; height: 32px; right: 0; opacity: 0; cursor: pointer; }
.switch { position: relative; display: inline-block; flex-shrink: 0; width: 42px; height: 26px; border-radius: 20px; border: 1px solid #78538f77; background: #39224a; pointer-events: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #b69bc8; transition: transform .18s, background .18s; }
.setting-row input:checked+.switch { background: #833bc3; border-color: #b776df; }
.setting-row input:checked+.switch::after { transform: translateX(16px); background: #fbebff; }
.setting-row input:focus-visible+.switch { outline: 2px solid var(--cyan); outline-offset: 4px; }
.settings-status { color: #b994d0; font-size: 10px; line-height: 1.6; margin: 14px 0 0; }
.settings-status:empty { display: none; }
.how-to-panel { margin-top: 25px; padding: 20px 18px 16px; border: 1px solid #a458cc3b; border-radius: 14px; background: #28133655; }
.how-to-panel h3, .power-guide h3 { margin: 8px 0 12px; font-size: 16px; letter-spacing: -.02em; }
.how-to-panel p { font-size: 11px; line-height: 1.8; color: #b8a4c8; margin: 10px 0 0; }
.power-guide { margin-top: 24px; }
.power-guide>div { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.power-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #29203d; font-size: 14px; font-weight: 800; }
.power-dot.slow-dot { color: var(--cyan); background: #173339; }
.power-dot.double-dot { color: #ff8dda; background: #3b1433; font-size: 11px; }
.power-dot.gold-dot { color: #ffdb92; background: #35291a; }
.power-dot.shield-dot { color: #b6a7ff; background: #292044; }
.power-guide strong { display: block; font-size: 11px; margin-bottom: 3px; }
.power-guide small { display: block; font-size: 10px; color: #a68eb7; }
.local-save-info { padding-top: 16px; margin: 17px 0 0; border-top: 1px solid #8f5aae27; color: #9783a6; font-size: 10px; line-height: 1.75; }
.release-info { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 19px; font-size: 8px; letter-spacing: .08em; font-weight: 750; color: #795f8c; }
.progress-content>p { font-size: 12px; color: #b4a0c4; line-height: 1.7; margin-top: 0; }
.skin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.skin-card { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; min-width: 0; gap: 10px; padding: 14px; border: 1px solid #9f65c343; border-radius: 14px; background: #1c0e2b; }
.skin-card.is-selected { border-color: #db8ee2c4; background: linear-gradient(115deg, #361842, #23102e); box-shadow: inset 0 0 0 1px #d284d530; }
.skin-card.is-locked { opacity: .67; }
.skin-card .skin-swatch { height: 36px; border-radius: 9px; background: var(--skin-color, #bc85ff); box-shadow: inset 0 0 13px #fff2; }
.skin-meta strong, .skin-card>strong { font-size: 12px; display: block; margin-bottom: 4px; }
.skin-card small, .skin-requirement { color: #b5a0c7; font-size: 10px; line-height: 1.6; margin: 0; }
.skin-card .skin-status { font-size: 9px; color: #f0b6e7; font-weight: 800; }
.skin-card button { min-height: 44px; border-radius: 9px; border: 1px solid #ba6ed54d; background: #3a174e; color: #edd5f5; font-weight: 750; font-size: 10px; padding: 8px; }
.achievement-list { display: flex; flex-direction: column; gap: 11px; }
.achievement-card { display: flex; align-items: flex-start; gap: 13px; padding: 16px 14px; border: 1px solid #9f65c338; border-radius: 14px; background: #1b0d29; }
.achievement-card.is-unlocked { border-color: #c188d967; background: linear-gradient(110deg, #311640, #1d0d2a); }
.achievement-icon { display: grid; place-items: center; width: 37px; height: 37px; flex-shrink: 0; color: #b181c8; font-size: 18px; border-radius: 11px; background: #43204f55; }
.achievement-card.is-unlocked .achievement-icon { color: #ffdfa1; background: #71562633; }
.achievement-copy { flex: 1; min-width: 0; }
.achievement-copy strong, .achievement-copy h3 { font-size: 12px; margin: 0 0 4px; display: block; }
.achievement-copy p { font-size: 10px; line-height: 1.65; color: #ad94c0; margin: 0; }
.achievement-progress { height: 4px; border-radius: 5px; background: #5e366b55; overflow: hidden; margin-top: 11px; }
.achievement-progress>span, .achievement-progress>i { display: block; height: 100%; background: linear-gradient(90deg, #9c64f3, #e279ca); border-radius: inherit; }
.achievement-copy small { display: block; font-size: 9px; color: #c099d3; margin-top: 7px; }
.progress-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 13px 14px; border-radius: 12px; margin-bottom: 18px; background: #31163d66; border: 1px solid #a45bb735; font-size: 11px; color: #d1b4de; line-height: 1.7; }
.noscript-note { position: fixed; inset: 20px; z-index: 99; display: grid; place-content: center; gap: 20px; padding: 30px; text-align: center; background: #150b24; border: 1px solid #a963d0; border-radius: 16px; line-height: 1.7; }
.noscript-note a { color: #f092e4; }
@media (hover: hover) {
  .control-button:hover, .icon-button:hover, .dpad button:hover { background: #32143f; border-color: #c57bf278; }
  .back-link:hover { color: #f4d4fb; }
  .primary-button:hover { filter: brightness(1.1); }
  .secondary-button:hover { background: #3a1b4c; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .game-shell { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); gap: 10px; }
  .game-header { min-height: 45px; grid-template-columns: 70px minmax(0,1fr) 70px; padding-bottom: 6px; }
  .back-link { font-size: 10px; }
  .game-brand h1 { font-size: 23px; }
  .brand-kicker { font-size: 6px; letter-spacing: .13em; margin-bottom: 4px; }
  .icon-button { border-radius: 11px; }
  .game-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto; gap: 8px; }
  .game-info { grid-column: 1; grid-row: 1; gap: 7px; }
  .scoreboard { gap: 8px; }
  .score-card { min-height: 51px; padding: 9px 12px 8px; border-radius: 12px; }
  .stat-label { font-size: 7px; margin-bottom: 3px; letter-spacing: .09em; }
  .score-card strong { font-size: 24px; }
  .score-spark, .best-icon { right: 12px; top: 13px; }
  .mode-tabs { flex-direction: row; gap: 6px; }
  .mode-button { flex: 1; text-align: center; min-height: 44px; padding: 9px 4px; font-size: 11px; border-radius: 10px; }
  .mode-button::after { display: none; }
  #mode-description { text-align: center; margin: 5px 0 0; font-size: 10px; line-height: 1.3; min-height: 13px; }
  .desktop-note { display: none; }
  .arena { grid-column: 1; grid-row: 2; grid-template-rows: 15px minmax(0,1fr) 20px; gap: 4px; }
  .board-heading { font-size: 6px; letter-spacing: .12em; }
  .board-wrap { border-radius: 17px; }
  .power-status { gap: 4px; }
  .power-chip { padding: 4px 6px; font-size: 8px; }
  .power-status:empty::before { font-size: 6px; }
  .power-empty { font-size: 7px; }
  .game-controls { grid-column: 1; grid-row: 3; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 10px; }
  .game-controls.no-dpad { grid-template-columns: minmax(0,1fr); }
  .game-controls.no-dpad .action-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .action-grid { gap: 5px; }
  .control-button { gap: 4px; min-height: 44px; padding: 6px 4px; font-size: 9px; border-radius: 10px; }
  .control-button svg { width: 14px; height: 14px; }
  .control-hint { font-size: 7px; line-height: 1.35; margin: 7px 0 0; }
  .dpad { grid-template-columns: repeat(3,52px); grid-template-rows: repeat(2,52px); gap: 5px; }
  .dpad button { width: 52px; height: 52px; border-radius: 11px; }
  .dpad button svg { width: 20px; height: 20px; }
  .game-overlay { padding: 16px; }
  .overlay-kicker { font-size: 7px; margin-bottom: 10px; }
  .overlay-title { font-size: 38px; }
  .overlay-copy { font-size: 10px; line-height: 1.6; margin: 11px 0 14px; }
  .overlay-hint { font-size: 8px; margin: 10px 0 0; }
  .overlay-stats { margin: 14px 0; gap: 21px; }
  .overlay-stats strong { font-size: 25px; }
  .overlay-stats span, .overlay-stats small { font-size: 8px; }
  .primary-button, .secondary-button { min-height: 44px; padding: 10px 16px; font-size: 11px; border-radius: 10px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  .game-shell { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); gap: 6px; }
  .game-layout { gap: 5px; }
  .game-info { gap: 5px; }
  .score-card { min-height: 47px; padding: 8px 11px 7px; }
  .score-card strong { font-size: 23px; }
  .control-button { font-size: 8px; gap: 3px; }
  .control-button svg { width: 13px; height: 13px; }
  .game-controls { gap: 8px; }
  .control-hint { font-size: 6px; }
  .overlay-title { font-size: 29px; }
  .overlay-copy { margin: 9px 0 11px; font-size: 9px; }
  .overlay-kicker { font-size: 6px; margin-bottom: 8px; }
  .overlay-hint { font-size: 7px; }
  .overlay-stats { margin: 10px 0; gap: 15px; }
  .overlay-stats strong { font-size: 22px; }
  .overlay-actions { gap: 6px; }
  .primary-button, .secondary-button { font-size: 10px; padding: 9px 12px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .game-shell { width: min(1100px,100%); padding: max(6px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); gap: 7px; }
  .game-header { min-height: 44px; padding-bottom: 4px; grid-template-columns: 100px minmax(0,1fr) 100px; }
  .game-brand h1 { font-size: 21px; }
  .brand-kicker { font-size: 6px; margin-bottom: 3px; }
  .game-layout { grid-template-columns: minmax(142px,.75fr) minmax(0,1.65fr) minmax(142px,.75fr); grid-template-rows: minmax(0,1fr); gap: 13px; }
  .game-info { grid-column: 1; grid-row: 1; gap: 10px; align-self: center; }
  .scoreboard { gap: 6px; }
  .score-card { padding: 11px 9px 9px; border-radius: 11px; }
  .score-card strong { font-size: 26px; }
  .stat-label { font-size: 6px; letter-spacing: .05em; }
  .score-spark, .best-icon { right: 7px; top: 9px; font-size: 8px; }
  .mode-tabs { gap: 5px; }
  .mode-button { min-height: 44px; padding: 8px 12px; font-size: 10px; border-radius: 9px; }
  #mode-description { font-size: 9px; margin-top: 7px; line-height: 1.6; min-height: 29px; }
  .desktop-note { display: none; }
  .arena { grid-column: 2; grid-row: 1; grid-template-rows: 13px minmax(0,1fr) 18px; gap: 4px; }
  .board-heading { font-size: 6px; }
  .board-signature { display: none; }
  .board-wrap { border-radius: 16px; }
  .power-chip { font-size: 7px; padding: 4px 5px; }
  .power-status:empty::before { font-size: 6px; }
  .power-empty { font-size: 6px; }
  .game-controls { grid-column: 3; grid-row: 1; align-self: center; gap: 12px; }
  .control-button { min-height: 44px; font-size: 8px; padding: 6px 3px; gap: 4px; }
  .control-button svg { width: 13px; height: 13px; }
  .control-hint { font-size: 7px; margin-top: 8px; }
  .dpad { grid-template-columns: repeat(3,44px); grid-template-rows: repeat(2,44px); gap: 5px; }
  .dpad button { width: 44px; height: 44px; border-radius: 10px; }
  .game-overlay { padding: 14px; }
  .overlay-kicker { font-size: 7px; margin-bottom: 9px; }
  .overlay-title { font-size: 32px; }
  .overlay-copy { font-size: 10px; line-height: 1.55; margin: 10px 0 14px; }
  .overlay-hint { font-size: 7px; margin-top: 9px; }
  .overlay-stats { margin: 12px 0; gap: 18px; }
  .overlay-stats strong { font-size: 23px; }
  .overlay-stats span, .overlay-stats small { font-size: 7px; }
  .primary-button, .secondary-button { min-height: 44px; padding: 10px 14px; font-size: 10px; }
}
@media (orientation: landscape) and (max-height: 350px) {
  .game-info { gap: 6px; }
  .score-card { padding: 7px 8px; }
  .score-card strong { font-size: 22px; }
  .mode-tabs { flex-direction: row; gap: 3px; }
  .mode-button { min-height: 44px; flex: 1; font-size: 8px; text-align: center; padding: 5px 2px; }
  .mode-button::after { display: none; }
  #mode-description { font-size: 8px; min-height: 25px; }
  .overlay-copy { margin: 7px 0 9px; }
  .overlay-hint { display: none; }
  .overlay-title { font-size: 25px; }
  .overlay-kicker { font-size: 6px; margin-bottom: 6px; }
  .overlay-stats { margin: 9px 0; }
}
/* Size the complete overlay to the board, including short landscape viewports. */
@container (max-width: 300px) or (max-height: 300px) {
  .game-overlay { padding: 10px; }
  .overlay-kicker { font-size: 6px; line-height: 1.2; margin-bottom: 5px; letter-spacing: .12em; }
  .overlay-title { font-size: 24px; line-height: .99; }
  .overlay-copy { font-size: 9px; line-height: 1.4; margin: 6px 0 7px; }
  .overlay-stats { margin: 7px 0 9px; gap: 18px; }
  .overlay-stats>div { gap: 3px; }
  .overlay-stats strong { font-size: 20px; line-height: 1; }
  .overlay-stats span, .overlay-stats small { font-size: 7px; line-height: 1.2; }
  .overlay-actions { flex-wrap: nowrap; gap: 6px; }
  .overlay-actions .primary-button, .overlay-actions .secondary-button { flex: 1; min-width: 0; min-height: 44px; padding: 8px 5px; gap: 4px; font-size: 9px; border-radius: 9px; white-space: nowrap; }
  .overlay-actions .primary-button>span { margin-left: 0; font-size: 14px; }
  .overlay-hint { display: none; }
}
/* Older Safari still receives compact controls without container queries. */
@supports not (width: 100cqw) {
  @media (max-width: 380px) and (max-height: 650px), (orientation: landscape) and (max-height: 350px) {
    .game-overlay { padding: 10px; }
    .overlay-kicker { font-size: 6px; line-height: 1.2; margin-bottom: 5px; }
    .overlay-title { font-size: 24px; line-height: .99; }
    .overlay-copy { font-size: 9px; line-height: 1.4; margin: 6px 0 7px; }
    .overlay-stats { margin: 7px 0 9px; }
    .overlay-stats>div { gap: 3px; }
    .overlay-stats strong { font-size: 20px; line-height: 1; }
    .overlay-stats span, .overlay-stats small { font-size: 7px; line-height: 1.2; }
    .overlay-actions { flex-wrap: nowrap; gap: 6px; }
    .overlay-actions .primary-button, .overlay-actions .secondary-button { flex: 1; min-width: 0; min-height: 44px; padding: 8px 5px; gap: 4px; font-size: 9px; white-space: nowrap; }
    .overlay-actions .primary-button>span { margin-left: 0; font-size: 14px; }
    .overlay-hint { display: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
