:root {
  color-scheme: dark;
  --ground: #080c19;
  --panel: #10172a;
  --edge: #273552;
  --ink: #eef5ff;
  --muted: #a0b0cb;
  --lime: #d5fb70;
  --cyan: #72defb;
  --field-ratio: 16 / 9;
  --field-width-for-height: 177.777778cqh;
  --mono: 'Cascadia Code', Consolas, monospace;
  font: 15px/1.45 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--ground);
}

:root[data-format="phone"] {
  --field-ratio: 9 / 16;
  --field-width-for-height: 56.25cqh;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 31% 27%, #121e38 0%, var(--ground) 63%); min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
button:disabled { cursor: default; }
svg { display: block; }
::selection { color: #121c17; background: var(--lime); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.boot-splash {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  color: #fff5d1;
  background: radial-gradient(ellipse at 50% 37%, #1c3468, #09112c 68%);
  animation: boot-expire 0s 5s forwards;
  transition: opacity 240ms cubic-bezier(.23, 1, .32, 1);
}
.boot-splash:not([hidden], .leaving) ~ .arcade {
  visibility: hidden;
  animation: boot-reveal 0s 5s forwards;
}
@keyframes boot-expire { to { visibility: hidden; } }
@keyframes boot-reveal { to { visibility: visible; } }
.boot-splash.leaving { opacity: 0; pointer-events: none; }
.boot-card { width: min(100%, 475px); text-align: center; }
.boot-flight {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(78px, 27dvh, 208px);
  overflow: hidden;
  border-block: 1px solid #82b8ff55;
  background: radial-gradient(ellipse at 48% 54%, #172a54, #080f27 72%);
}
.boot-stars {
  position: absolute;
  inset: -128px 0 0;
  background:
    radial-gradient(circle at 14px 17px, #e8f1ff 0 1px, transparent 2px),
    radial-gradient(circle at 74px 46px, #85bff5 0 1px, transparent 2px),
    radial-gradient(circle at 44px 81px, #819ed0 0 1px, transparent 2px),
    radial-gradient(circle at 116px 104px, #c8e6ff 0 1px, transparent 2px);
  background-size: 128px 128px, 151px 128px, 103px 128px, 167px 128px;
  animation: boot-drift 900ms linear infinite;
}
.boot-ship {
  position: relative;
  width: clamp(44px, 10dvh, 85px);
  color: #5bbafe;
  filter: drop-shadow(0 2px 13px #67cbff80);
  animation: boot-flight 1850ms linear both;
}
.boot-ship canvas { position: relative; z-index: 1; display: block; width: 100%; height: auto; image-rendering: pixelated; }
.boot-ship::before, .boot-ship::after {
  content: "";
  position: absolute;
  top: 88%;
  width: 19%;
  height: 44%;
  background: linear-gradient(#def8ff, currentColor 32%, transparent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.boot-ship::before { left: 21%; }
.boot-ship::after { right: 21%; }
.boot-title { margin: clamp(10px, 2.5dvh, 22px) 0 7px; font: 800 clamp(30px, 8vw, 60px)/1 Grandstander, 'Trebuchet MS', sans-serif; letter-spacing: -.03em; }
.boot-title strong { color: #ffdf62; font-weight: inherit; }
.boot-meter { width: min(55%, 164px); height: 8px; margin: 0 auto; padding: 1px; overflow: hidden; border: 1px solid #759ce0; }
.boot-meter span { display: block; width: 42%; height: 100%; background: linear-gradient(90deg, #6dc2ff, #ffe378); animation: boot-sweep 950ms linear infinite; }
.boot-label { margin: 8px 0 0; color: #c5d7f8; font: 700 10px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
@keyframes boot-drift { to { transform: translateY(128px); } }
@keyframes boot-flight { from { transform: translateY(24%); } to { transform: translateY(-24%); } }
@keyframes boot-sweep { from { transform: translateX(-100%); } to { transform: translateX(239%); } }
@media (prefers-reduced-motion: reduce) {
  .boot-splash { transition: none; }
  .boot-stars, .boot-ship, .boot-meter span { animation: none; }
}

.arcade { display: grid; grid-template-rows: minmax(0, 1fr); width: min(calc(100% - 32px), 1260px); height: min(100dvh, 920px); margin: 0 auto; padding: 10px 0; container-type: inline-size; }
:root[data-format="phone"] .arcade { width: min(calc(100% - 20px), 510px); height: 100dvh; }
.appearance-picker { display: flex; align-items: center; gap: 5px; }
.view-button { flex-shrink: 0; padding: 6px 8px; border: 1px solid var(--edge); background: var(--panel); border-radius: 7px; font-size: 12px; }
.view-button:hover, .view-button[aria-pressed="true"] { border-color: var(--lime); color: var(--lime); }
.utility #view-options { display: none; }
.ambience, .background-button { display: none; }
.format-picker { display: flex; align-items: center; justify-content: center; gap: 6px; min-inline-size: 0; margin: 0; padding: 3px 5px; border: 1px solid var(--edge); background: var(--panel); }
.match-settings { position: relative; display: flex; align-items: center; gap: 7px; }
.difficulty-picker { gap: 3px; }
.difficulty-picker label span { padding-inline: 6px; }
.difficulty-label { margin-inline: 4px; color: var(--muted); font-size: 12px; }
.format-picker label { position: relative; cursor: pointer; }
.format-picker label span { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 28px; padding: 2px 8px; border: 1px solid transparent; color: var(--ink); font-size: 13px; white-space: nowrap; transition: border-color 130ms, background-color 130ms; }
.format-picker label:hover span { border-color: var(--edge); }
.format-picker input:checked + span { border-color: var(--lime); color: var(--lime); }
.format-picker input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: -2px; }
.format-picker small { font: 700 11px/1 var(--mono); }
.format-toggle, .format-picker svg { flex: none; }
.format-toggle svg, .format-picker svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.format-toggle { display: flex; align-items: center; gap: 5px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--edge); border-radius: 7px; background: var(--panel); font-size: 12px; white-space: nowrap; }
.format-toggle:hover, .format-toggle[aria-expanded="true"] { border-color: var(--cyan); }
[data-format="desktop"] .format-toggle .phone-icon, [data-format="phone"] .format-toggle .desktop-icon { display: none; }
#format-picker { position: absolute; z-index: 6; right: 0; bottom: calc(100% + 6px); display: grid; gap: 5px; width: max-content; padding: 5px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); box-shadow: 0 7px 18px #050b22c0; }
#format-picker label span { min-height: 40px; }
.handedness { display: none; }
[data-touch-controls] .handedness, [data-format="phone"] .handedness { display: flex; }
.brand { display: flex; align-items: center; gap: 9px; font: 800 19px/1 var(--mono); letter-spacing: .025em; }
.brand-genre { display: block; margin-top: 4px; color: var(--muted); font: 700 9px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.brand .sgi-mark { display: block; width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.brand a { display: block; border-radius: 10px; }
.brand a:hover { box-shadow: 0 0 0 1px var(--lime), 0 0 14px #ffdf3052; }
.brand a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.utility { display: flex; gap: 8px; position: relative; }
.utility button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--edge); background: var(--panel); padding: 7px 11px; font-size: 13px; }
.utility button:hover:not(:disabled) { border-color: var(--cyan); }
.utility button:disabled { color: #8d9ebc; }
.utility button[aria-pressed="false"] svg { color: #8d9ebc; }
.utility svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.utility #fullscreen svg { color: var(--ink); }
#fullscreen[aria-pressed="true"] { border-color: var(--lime); }
#fullscreen[aria-pressed="true"] .fullscreen-enter,
#fullscreen[aria-pressed="false"] .fullscreen-exit { display: none; }
#fullscreen-status:empty { display: none; }
#fullscreen-status { position: absolute; z-index: 4; bottom: calc(100% + 7px); right: 0; width: max-content; max-width: calc(100vw - 24px); padding: 6px 9px; background: var(--panel); border: 1px solid var(--edge); color: var(--ink); font-size: 12px; }
.utility #help { display: none; }

@media (min-width: 861px) {
  :root:fullscreen:not([data-format="phone"]) .arcade { width: min(calc(100% - 24px), 1760px); height: 100dvh; }
}

.console { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 10px; min-height: 0; position: relative; }
.side-rail { display: grid; grid-template-rows: minmax(0, auto) auto; align-content: start; gap: 8px; min-width: 0; min-height: 0; }
:root[data-clean-view] .console { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
:root[data-clean-view] :is(.side-rail, .utility #help) { display: none; }
.cabinet, .sidebar { border: 1px solid var(--edge); background: var(--panel); min-width: 0; }
.cabinet { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.hud { display: grid; grid-template-columns: minmax(154px, 1.45fr) repeat(4, minmax(0, 1fr)); align-items: center; gap: 4px 8px; padding: 7px 16px 8px; border-bottom: 1px solid var(--edge); }
.hud-stat { display: grid; gap: 2px; min-width: 0; justify-items: center; align-self: start; }
.hud-stat.lives { justify-items: end; }
.hud:has(.run-clock:not([hidden])) { grid-template-columns: minmax(154px, 1.45fr) repeat(5, minmax(0, 1fr)); }
.run-clock strong { color: var(--lime); font-variant-numeric: tabular-nums; }
.hud .run-clock small { font-size: 10px; white-space: nowrap; }
.hud-stat > span, .special span, .statusbar strong { color: var(--muted); font: 700 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.hud strong { font: 700 23px/1.2 var(--mono); }
#record { color: var(--cyan); }
#record-name { display: block; width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.1; }
.hud small { font: 400 14px var(--mono); color: var(--muted); }
.hud #speed { font: 600 10px/1.25 var(--mono); white-space: nowrap; }
.hud #speed.boosted { color: var(--cyan); }
.health { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 5px; max-width: 100%; }
.health i { width: 15px; height: 14px; background: var(--cyan); clip-path: polygon(0 24%, 25% 0, 50% 24%, 75% 0, 100% 24%, 100% 52%, 50% 100%, 0 52%); }
.health i.spent { background: #405373; }

.viewport { position: relative; display: grid; place-items: center; container-type: size; min-height: 0; overflow: clip; background: radial-gradient(ellipse at center, #142448, #080e23 77%); user-select: none; }
.stage { position: relative; isolation: isolate; container-type: inline-size; width: min(100cqw, var(--field-width-for-height)); aspect-ratio: var(--field-ratio); }
#field { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.viewport.playing #field { cursor: crosshair; }
:root[data-game-fullscreen][data-format="desktop"] .viewport.playing #field { cursor: none; }
.viewport.playing #field { touch-action: none; }
.scanlines { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(180deg, transparent 0 3px, #04091926 3px 4px); z-index: 1; }
.overlay { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; padding: 12px; background: radial-gradient(ellipse at 47% 49%, #070c25ad 0 12%, #080f2670 42%, transparent 83%); }
.overlay h1 { margin: 0; width: min(61%, 510px); font-size: 3rem; line-height: 0; filter: drop-shadow(0 5px 0 #142847) drop-shadow(0 10px 12px #05091f98); }
#lettering { width: 100%; height: auto; image-rendering: pixelated; }
.overlay h2 { margin: 0; font: 800 clamp(19px, 6.5cqw, 57px)/1.04 var(--mono); letter-spacing: -.035em; text-transform: uppercase; text-shadow: 0 4px 12px #02050e; }
.overlay p { margin: clamp(7px, 2.5cqw, 21px) 0; color: #edf3ff; font-weight: 600; font-size: clamp(11px, 2.75cqw, 16px); text-shadow: 0 2px 5px #010411; }
.overlay p:empty { display: none; }
.overlay h2 + p:empty + #launch { margin-top: 7px; }
#launch { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 21px; background: var(--lime); border: 1px solid var(--lime); color: #15210c; font: 800 13px/1.25 var(--mono); text-transform: uppercase; letter-spacing: .06em; min-height: 44px; }
#launch:hover { background: #edffac; border-color: #edffac; }
#launch svg { width: 16px; height: 16px; fill: currentColor; }
.run-result { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 12px; overflow-y: auto; background: radial-gradient(ellipse at 50% 38%, #13244cf0, #090f22d9 76%); }
.result-content { display: grid; justify-items: center; gap: 8px; width: min(100%, 390px); margin: auto; text-align: center; }
.result-content h2 { margin: 0; font: 800 clamp(27px, 7cqh, 50px)/1.05 var(--mono); letter-spacing: -.03em; }
.result-content h2:focus { outline: none; }
.result-content p { margin: 0; font-size: 14px; }
.result-score { display: grid; gap: 2px; padding-block: 4px; font: 700 12px/1.2 var(--mono); color: var(--muted); }
.result-score strong { color: var(--lime); font-size: clamp(24px, 6.5cqh, 36px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.result-score small { font-size: 12px; }
.score-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: min(100%, 326px); }
.score-entry input { width: 100%; min-width: 0; min-height: 46px; padding: 7px 12px; border: 1px solid var(--edge); border-radius: 6px; background: var(--ground); color: var(--ink); font: inherit; font-size: 16px; }
.score-entry input::placeholder { color: var(--muted); }
.score-entry input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.sign-action { min-height: 44px; padding: 6px 12px; border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); font-weight: 700; }
.sign-action:hover { border-color: var(--lime); }
.primary-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 15px; border: 1px solid var(--lime); color: var(--ground); background: var(--lime); font-weight: 800; }
.primary-action:hover { background: #edffac; }
.primary-action svg { width: 16px; height: 16px; fill: currentColor; }
#pilot-status { color: var(--lime); overflow-wrap: anywhere; user-select: text; }
#pilot-status:empty { display: none; }
#result-feedback { width: min(100%, 326px); margin-top: 8px; }
.notice { position: absolute; z-index: 2; top: 15px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 94%; text-align: center; padding: 6px 12px; background: #0a1229ed; border: 1px solid var(--edge); color: var(--lime); font: 700 clamp(10px, 1.1vw, 13px) var(--mono); pointer-events: none; }
.stage-intro { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; gap: .4em; text-align: center; padding: 8px; pointer-events: none; background: radial-gradient(ellipse at center, #070c25ed 0%, #0a1229b8 35%, #080f2638 78%); }
.stage-intro strong { color: var(--lime); font: 800 clamp(23px, 9cqw, 76px)/1 var(--mono); letter-spacing: -.035em; text-transform: uppercase; }
.stage-intro span { color: var(--ink); font: 650 clamp(11px, 3.1cqw, 23px)/1.25 var(--mono); }
@media (prefers-reduced-motion: no-preference) {
  .stage-intro:not([hidden]) { animation: stage-reveal .24s ease-out; }
  @keyframes stage-reveal { from { opacity: .3; } }
}

.statusbar { position: relative; z-index: 3; border-top: 1px solid var(--edge); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; min-height: 43px; padding: 5px 16px; }
.statusbar .appearance-picker { margin-left: auto; }
.statusbar:has(.match-settings:not([hidden])) .utility { gap: 5px; }
.statusbar:has(.match-settings:not([hidden])) .utility button { padding-inline: 7px; gap: 5px; }
.special { display: flex; align-items: center; gap: 7px; }
.nova-label { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.special .charge-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #503261; background: #221934; color: #ec9cff; }
.charge-icon svg { width: 17px; height: 17px; fill: currentColor; }
.charge-steps { display: flex; gap: 4px; margin-top: 4px; }
.charge-steps i { height: 4px; width: clamp(8px, 2vw, 23px); background: #3d2b50; }
.charge-steps i.filled { background: #ec9cff; }
.statusbar .ready { color: #ec9cff; }
#nova-meter.enhanced .charge-icon { border-color: #ffdc7a; color: #fff3b8; box-shadow: 0 0 10px #ffb65077; }
#nova-meter.enhanced :is(#nova-name, #charge) { color: #ffe29b; }
#nova-meter.enhanced .charge-steps .filled { background: #ffce6c; }
@media (prefers-reduced-motion: no-preference) {
  #charge.ready { animation: nova-ready 1.05s ease-in-out 4; }
  @keyframes nova-ready { 50% { opacity: .7; text-shadow: 0 0 10px currentColor; } }
}
#nova-action, .touch-help { display: none; }

.sidebar { padding: 13px 16px 10px; overflow-y: auto; scrollbar-width: thin; }
.side-section h2 { font: 800 13px/1.2 var(--mono); letter-spacing: .13em; margin: 0 0 12px; }
.control { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 9px; margin: 0 0 9px; min-height: 32px; }
.control strong, .arsenal strong { display: block; font-size: 13px; }
.control span, .arsenal small { display: block; color: var(--muted); font-size: 12px; }
.arrows { display: grid; gap: 2px; justify-items: center; }
.arrows div { display: flex; gap: 2px; }
kbd { font: 700 12px/14px var(--mono); text-align: center; width: 17px; height: 16px; border: 1px solid #405473; background: #1a2842; color: var(--ink); }
.control-icon { justify-self: center; width: 30px; height: 30px; fill: none; stroke: var(--cyan); stroke-width: 1.5; }
.control-icon .mouse-button { fill: var(--cyan); stroke: none; }
.control-icon.nova { stroke: #ec9cff; }
.control-icon.nova .mouse-button { fill: #ec9cff; }
.arsenal { border-top: 1px solid var(--edge); margin-top: 15px; padding-top: 17px; }
.arsenal h2 { margin-bottom: 12px; }
.arsenal ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.arsenal li { display: grid; grid-template-columns: 27px 1fr; align-items: center; gap: 6px; border: 1px solid transparent; padding: 5px 7px; }
.arsenal li > span { color: var(--muted); font: 700 11px var(--mono); }
.arsenal li.active { background: #222e28; border-color: #506249; }
.arsenal li.active > span, .arsenal li.active strong { color: var(--lime); }
.arsenal p { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 13px 0 0; }
.pickup-section { margin-top: 11px; }
.pickup-section h2 { margin-bottom: 7px; }
.pickup-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.pickup-guide > span { display: grid; justify-items: center; gap: 2px; padding: 4px 1px; border-radius: 7px; background: #0a132b99; color: var(--ink); font-size: 10px; }
.pickup-guide svg { width: 30px; height: 30px; color: var(--pickup); }
.pickup-meter { display: flex; gap: 3px; margin-top: 2px; }
.pickup-meter i { width: 8px; height: 5px; border-radius: 2px; background: #445478; }
.pickup-meter .filled { background: var(--step-colour, var(--pickup)); box-shadow: 0 0 5px color-mix(in srgb, var(--step-colour, var(--pickup)), transparent 50%); }
.weapon-pickup i:nth-child(2), .speed-pickup i:nth-child(1) { --step-colour: #76e6ff; }
.weapon-pickup i:nth-child(3), .speed-pickup i:nth-child(2) { --step-colour: #b49dff; }
.weapon-pickup i:nth-child(4) { --step-colour: #ffdf70; }
.speed-pickup i:nth-child(3) { --step-colour: #fa90d3; }
.nova-pickup .pickup-meter i { width: 19px; }
.life-pickups { display: flex; justify-content: center; gap: 9px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.life-pickups span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.life-pickups svg { width: 16px; height: 16px; color: var(--pickup); }
.weapon-pickup { --pickup: #8ee347; }
.speed-pickup { --pickup: #59d9ff; }
.nova-pickup { --pickup: #ffc350; }
.heal-pickup { --pickup: #ef6b9f; }
.capacity-pickup { --pickup: #ae95ff; }
.next-levels { display: grid; align-items: center; justify-items: center; justify-content: center; gap: 5px 12px; padding: 9px 12px; border: 1px solid var(--edge); background: var(--panel); position: relative; z-index: 2; text-align: center; }
.next-levels h2 { margin: 0; font: 700 14px/1.2 var(--mono); }
.next-levels p { margin: 0; color: var(--muted); font-size: 13px; }
.next-levels .next-levels-count { margin-top: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.vote-confirmation { display: grid; place-items: center; padding: 16px; }
.vote-confirmation main { width: min(100%, 460px); padding: clamp(16px, 5vw, 28px); border: 1px solid var(--edge); border-radius: 14px; background: var(--panel); }
.vote-confirmation h1 { margin: 0; font-size: clamp(24px, 6vw, 32px); line-height: 1.12; }
.vote-confirmation a { display: inline-block; margin-top: 16px; color: var(--cyan); }
.next-levels-action button { min-height: 34px; padding: 4px 10px; border: 1px solid var(--lime); color: var(--lime); background: transparent; font-weight: 700; font-size: 13px; text-align: center; }
.next-levels-action button:hover:not([aria-disabled="true"]) { background: var(--lime); color: var(--ground); }
.next-levels-action button[aria-disabled="true"] { cursor: default; border-color: var(--edge); color: var(--ink); }
#next-levels-status:empty { display: none; }
#next-levels-status, .next-levels-privacy p { position: absolute; z-index: 5; right: 5px; bottom: calc(100% + 9px); max-width: min(calc(100% - 10px), 380px); width: max-content; padding: 10px 13px; border-radius: 9px; color: var(--ink); background: var(--panel); border: 1px solid var(--edge); box-shadow: 0 8px 22px #04081895; }
#next-levels-status::after { content: ''; position: absolute; right: 19px; bottom: -5px; width: 8px; height: 8px; transform: rotate(45deg); background: var(--panel); border-right: 1px solid var(--edge); border-bottom: 1px solid var(--edge); }
#next-levels-status[data-state="success"] { border-color: var(--lime); }
#next-levels-status[data-state="success"]::after { border-color: var(--lime); }
.next-levels .next-levels-privacy { color: var(--muted); font-size: 12px; }
.next-levels-privacy summary { cursor: pointer; }
.next-levels-privacy a { color: inherit; text-underline-offset: 2px; }

@media (max-width: 860px) {
  .arcade { width: calc(100% - 20px); }
}

@media (max-height: 620px) {
  .arcade { max-width: 840px; }
}

@container (min-width: 1121px) {
  .statusbar:has(.match-settings:not([hidden])) .utility #view-options { display: flex; }
  .statusbar:has(.match-settings:not([hidden])) .appearance-picker { display: none; position: absolute; z-index: 5; right: 6px; bottom: calc(100% + 6px); padding: 6px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); box-shadow: 0 7px 18px #050b22c0; }
  .statusbar:has(.match-settings:not([hidden])) .appearance-picker[data-open] { display: flex; }
  .statusbar:has(.match-settings:not([hidden])) .utility { margin-left: auto; }
}

@container (max-width: 1120px) {
  .utility #view-options { display: flex; }
  .statusbar .utility { margin-left: auto; }
  .appearance-picker { display: none; position: absolute; z-index: 5; right: 6px; bottom: calc(100% + 6px); flex-wrap: wrap; justify-content: end; max-width: calc(100% - 12px); padding: 6px; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); box-shadow: 0 7px 18px #050b22c0; }
  .appearance-picker[data-open] { display: flex; }
}

@container (max-width: 840px) {
  .utility #help { display: flex; }
  .console { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 5px; }
  .side-rail { display: contents; }
  .next-levels { grid-template-columns: repeat(2, auto); padding: 4px 8px; }
  .sidebar { display: none; position: absolute; z-index: 3; top: 0; right: 0; width: min(100%, 460px); max-height: 100%; padding: 12px; overflow: auto; box-shadow: 0 8px 24px #02050e; }
  .sidebar[data-open] { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .sidebar .pickup-section { grid-column: 1 / -1; margin: 0; }
  .arsenal { margin: 0; padding: 0 0 0 10px; border-top: 0; border-left: 1px solid var(--edge); }
  .control { grid-template-columns: 42px 1fr; gap: 4px; }
  .arsenal li { grid-template-columns: 19px 1fr; padding-inline: 3px; }
  kbd { width: 12px; }
}

@container (max-width: 740px) {
  .utility { gap: 4px; }
  .utility button { padding: 6px; }
  .utility button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@container (max-width: 540px) {
  .hud, .hud:has(.run-clock:not([hidden])) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hud .brand { grid-column: 1 / -1; }
  .hud:has(.run-clock:not([hidden])) .brand { grid-column: 1 / 3; grid-row: 1; }
  .hud .run-clock { grid-column: 3 / -1; grid-row: 1; justify-items: end; }
  .hud-stat:nth-child(2) { justify-items: start; }
  .hud-stat > span, .nova-label > span, .nova-label > strong { font-size: 9px; }
  .charge-steps { gap: 3px; }
  .next-levels-privacy { grid-column: 1 / -1; }
  .utility button { padding: 5px; }
  .utility svg { width: 16px; height: 16px; }
}

@container (max-width: 365px) {
  .statusbar { gap: 5px; padding-inline: 6px; }
  .special { gap: 4px; }
  .special .charge-icon { width: 24px; height: 26px; }
  .statusbar .special .charge-icon { display: none; }
  .utility svg { width: 14px; height: 14px; }
  .health { gap: 2px; }
  .hud .health i { width: 9px; height: 9px; }
  .next-levels h2 { font-size: 12px; }
}

@media (max-width: 600px) {
  .arcade { gap: 5px; padding: 5px 0; }
  .brand { font-size: clamp(12px, 3.1vw, 18px); gap: 6px; }
  .hud, .statusbar { padding-inline: 8px; }
  .hud strong { font-size: clamp(15px, 4.6vw, 22px); }
  .hud small { font-size: .62em; }
  .health i { width: 11px; height: 10px; }
  .next-levels { padding: 4px 7px; }
  .next-levels h2 { font-size: 12px; }
  .next-levels-action button { min-height: 32px; font-size: 12px; }
  .next-levels .next-levels-privacy { grid-column: 1 / -1; }
}

@container (max-width: 500px) {
  .difficulty-label { display: none; }
  .format-picker label span { padding-inline: 5px; font-size: 12px; }
  .match-settings { gap: 5px; margin-inline: auto; }
  .statusbar:has(.match-settings:not([hidden])) .utility button { padding-inline: 5px; }
}

#result-feedback .next-levels { display: grid; grid-template-columns: 1fr; }

@container (max-width: 400px) {
  .overlay { padding: 4px; }
  #launch { padding: 3px 9px; min-height: 31px; font-size: 12px; }
}

@container (max-width: 230px) {
  .overlay #brief { margin: 4px 0; font-size: 10px; line-height: 1.12; }
  #launch { gap: 3px; min-height: 25px; }
  #launch svg { width: 11px; height: 11px; }
}

@container (max-width: 118px) {
  :root[data-format="phone"] .overlay #brief { display: none; }
  :root[data-format="phone"] .overlay h1 { width: 100%; }
  :root[data-format="phone"] .overlay #launch { max-width: 100%; margin-top: 6px; padding-inline: 3px; font-size: 10px; }
  :root[data-format="phone"] .overlay #launch svg { display: none; }
  :root[data-format="phone"] .overlay #launch span { min-width: 0; overflow-wrap: anywhere; }
}

@container (max-width: 70px) {
  :root[data-format="phone"] .overlay #game-title { display: none; }
  :root[data-format="phone"] .overlay h2 { font-size: min(13px, 22cqw); overflow-wrap: anywhere; }
}

@media (max-height: 420px) and (orientation: landscape) {
  :root[data-format="phone"] .arcade { width: min(calc(100% - 20px), 840px); }
  .difficulty-label { display: none; }
  .statusbar { min-height: 37px; padding-block: 3px; }
  .overlay #brief { display: none; }
  .overlay #launch { margin-top: 6px; }
  .sidebar .pickup-guide svg { width: 23px; height: 23px; }
  .run-result { padding: 5px 9px; }
  .result-content { gap: 4px; }
  .result-score { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: center; gap: 4px 8px; padding-block: 0; }
  #result-feedback { margin-top: 3px; }
  #result-feedback .next-levels { grid-template-columns: repeat(2, auto); }
}

@media (pointer: coarse) {
  .touch-help { display: block; font-size: 12px; color: var(--muted); }
}

:is([data-touch-controls], [data-format="phone"]) #nova-action:not(:disabled) {
  display: block;
  position: absolute;
  z-index: 2;
  inset: auto auto 8px 8px;
  min-width: 48px;
  min-height: 48px;
  padding: 5px;
  background: #221934eb;
  border: 1px solid #80508c;
  border-radius: 10px;
  touch-action: none;
  font-size: 13px;
  font-weight: 750;
}
:is([data-touch-controls], [data-format="phone"])[data-handedness="left"] #nova-action:not(:disabled) { left: auto; right: 8px; }
#nova-action[aria-disabled="true"] { opacity: .55; }

@container (max-width: 540px) {
  #record-label, #run-clock > span { white-space: nowrap; letter-spacing: 0; }
  .hud-stat:has(#record-label) { min-width: max-content; }
  .hud #total-time { font-size: 10px; }
}

@media (orientation: landscape) and (max-height: 510px) and (min-width: 460px) {
  [data-touch-controls][data-format="desktop"] .arcade { width: 100%; max-width: none; padding: 3px; }
  [data-touch-controls][data-format="desktop"] .console { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  [data-touch-controls][data-format="desktop"] .side-rail { display: contents; }
  [data-touch-controls][data-format="desktop"] .side-rail > .next-levels { display: none; }
  [data-touch-controls][data-format="desktop"] .cabinet {
    grid-template-columns: clamp(76px, 11vw, 105px) minmax(0, 1fr) clamp(76px, 11vw, 105px);
    grid-template-rows: minmax(0, 1fr);
    border-radius: 10px;
  }
  [data-touch-controls][data-format="desktop"] .hud {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 2px;
    padding: 4px;
    border: 0;
    border-right: 1px solid var(--edge);
  }
  [data-touch-controls][data-format="desktop"] .brand { flex-direction: column; gap: 3px; text-align: center; font-size: 12px; }
  [data-touch-controls][data-format="desktop"] .brand-genre { display: none; }
  [data-touch-controls][data-format="desktop"] .hud-stat { align-self: stretch; justify-items: center; text-align: center; gap: 0; }
  [data-touch-controls][data-format="desktop"] .hud-stat > span { font-size: 8px; letter-spacing: 0; white-space: nowrap; }
  [data-touch-controls][data-format="desktop"] .hud strong { font-size: clamp(13px, 2.3vh, 19px); }
  [data-touch-controls][data-format="desktop"] .hud small { font-size: 9px; }
  [data-touch-controls][data-format="desktop"] .health { justify-content: center; margin-top: 1px; gap: 2px; }
  [data-touch-controls][data-format="desktop"] .health i { width: 10px; height: 9px; }
  [data-touch-controls][data-format="desktop"] .statusbar {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 7px;
    padding: 4px;
    border: 0;
    border-left: 1px solid var(--edge);
  }
  [data-touch-controls][data-format="desktop"] .special .charge-icon { display: none; }
  [data-touch-controls][data-format="desktop"] .nova-label { flex-direction: column; gap: 0; }
  [data-touch-controls][data-format="desktop"] .charge-steps { justify-content: center; gap: 3px; }
  [data-touch-controls][data-format="desktop"] .charge-steps i { width: 8px; }
  [data-touch-controls][data-format="desktop"] .utility { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin: 0; gap: 3px; }
  [data-touch-controls][data-format="desktop"] .utility button { justify-content: center; min-height: 30px; padding: 3px; }
  [data-touch-controls][data-format="desktop"] .utility :is(#view-options, #help) { display: flex; }
  [data-touch-controls][data-format="desktop"] .utility button > span,
  [data-touch-controls][data-format="desktop"] .format-toggle > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  [data-touch-controls][data-format="desktop"] .match-settings { flex-direction: column; gap: 4px; margin: 0; }
  [data-touch-controls][data-format="desktop"] .difficulty-picker { display: grid; gap: 1px; padding: 2px; }
  [data-touch-controls][data-format="desktop"] .difficulty-label { display: none; }
  [data-touch-controls][data-format="desktop"] .difficulty-picker label span { min-height: 22px; font-size: 11px; }
  [data-touch-controls][data-format="desktop"] .format-toggle { min-height: 28px; }
  [data-touch-controls][data-format="desktop"] #format-picker { inset: auto calc(100% + 11px) 0 auto; }
  [data-touch-controls][data-format="desktop"] .appearance-picker { inset: 8px calc(100% + 6px) auto auto; width: max-content; max-width: calc(100vw - 100px); }
  [data-touch-controls][data-format="desktop"] .sidebar:not([data-open]) { display: none; }
}
