:root {
  color-scheme: dark;
  color: #eaf5f3;
  background: #080e19;
  font-family: 'Segoe UI', system-ui, sans-serif;
  --lime: #cefc7b;
  --ink: #0b1714;
  --muted: #adbecb;
  --line: #82bbbe4d;
  --safe-x: calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
  --safe-y: calc(env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 64% 39%, #14282e, #080e19 74%);
}
#stage {
  position: relative;
  width: min(100vw, 150vh);
  width: min(calc(100dvw - var(--safe-x)), calc((100dvh - var(--safe-y)) * 1.5));
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  background: #080e19;
  touch-action: none;
  user-select: none;
  outline: none;
  box-shadow: 0 0 90px #0008;
}
#game, #game canvas, .screen, #hud, #sticks { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen { z-index: 3; }
.title-screen {
  background: linear-gradient(90deg, #080f1bf2 0%, #080f1bbd 29%, transparent 66%),
    linear-gradient(0deg, #080e19f0 0%, transparent 23%), url('./assets/title-art.webp') center / cover no-repeat;
}
.title-content { position: absolute; left: 7%; top: 10%; display: grid; justify-items: start; gap: 3.1cqw; }
.wordmark, h2 { font-family: Impact, 'Arial Narrow', 'Segoe UI', sans-serif; text-transform: uppercase; }
.wordmark {
  margin: 0;
  font-size: 9.3cqw;
  line-height: .87;
  font-weight: 800;
  letter-spacing: .005em;
  filter: drop-shadow(0 .45cqw .65cqw #0009);
}
.wordmark span, .wordmark strong { display: block; }
.wordmark span { color: #f0f5fa; }
.wordmark strong { font-size: 1.34em; color: var(--lime); line-height: .96; letter-spacing: .022em; }
.title-buttons { display: grid; gap: .9cqw; width: 29cqw; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, #stage[data-input='gamepad'] button:focus { outline: max(2px, .25cqw) solid #f5ffd9; outline-offset: .28cqw; }
.button, .quiet-button {
  color: #e9f2f5;
  min-width: 0;
  font-size: max(11px, 2.05cqw);
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: .65cqw;
  background: #101e2ae8;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.button { min-height: max(24px, 5.6cqw); padding: .85cqw 1.65cqw; text-align: left; }
.button:hover, .quiet-button:hover { border-color: var(--lime); color: var(--lime); }
.button:active { background: #263844; }
.button.primary { color: var(--ink); background: var(--lime); border-color: var(--lime); font-weight: 800; }
.button.primary:hover, .button.primary:active { background: #ecffbd; color: var(--ink); }
.button:disabled { cursor: default; opacity: .5; }
.button.compact { min-height: max(24px, 4.8cqw); width: max-content; }
.title-footer { position: absolute; inset: auto 7% 4.2%; display: flex; align-items: center; justify-content: space-between; gap: 2cqw; }
.title-footer p, .loading-label, .quiet-button { font-size: max(9px, 1.48cqw); }
.title-footer p, .loading-label { margin: 0; color: var(--muted); }
.title-footer b { margin: 0 .55cqw; color: #8399a5; }
.title-links { display: flex; gap: .7cqw; }
kbd { font: inherit; font-weight: 750; color: #eff7f7; }
.quiet-button { padding: .8cqw 1.3cqw; }
.loading-label { position: absolute; left: 7%; bottom: 5%; }
.touch-help, .pad-help { display: none; }
#stage[data-input='gamepad'] .pad-help { display: block; }
#stage[data-input='gamepad'] :is(.desktop-help,.touch-help) { display: none; }

.menu-screen, .dialog { display: grid; place-items: center; padding: 5cqw; }
.menu-screen { background: linear-gradient(#0a1421bd, #080e19f2), url('./assets/bbq_bg.webp') center / cover; }
.dialog { background: #040811b5; }
.panel {
  width: 100%;
  padding: 3.1cqw;
  display: grid;
  gap: 2.2cqw;
  background: #101c2af2;
  border: 1px solid var(--line);
  border-top: .35cqw solid var(--lime);
  border-radius: .85cqw;
  box-shadow: 0 1.75cqw 6cqw #02050ac7;
}
.options-panel { width: min(62cqw, 100%); }
.options-panel:has(#motion-options:not([hidden])), .medals-panel { width: min(86cqw, 100%); }
.narrow-panel { width: min(54cqw, 100%); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1cqw; }
h2 { font-size: 5.4cqw; font-weight: 700; line-height: 1; letter-spacing: .02em; margin: 0; }
h3 { margin: 0 0 1.3cqw; color: var(--lime); font-size: max(11px, 2.2cqw); font-weight: 700; }
.controls-section { padding: 1.4cqw 0; border-top: 1px solid var(--line); }
.settings-grid { display: grid; gap: 2.5cqw; }
.settings-grid:has(#motion-options:not([hidden])) { grid-template-columns: 1.2fr 1fr; }
.split-buttons, .motion-settings { display: flex; flex-wrap: wrap; gap: .65cqw; }
.motion-settings { margin-top: .65cqw; }
.split-buttons button[aria-pressed='true'], .motion-settings button[aria-pressed='true'] {
  color: var(--ink);
  border-color: var(--lime);
  background: var(--lime);
}
.menu-note { margin: 1cqw 0 0; color: var(--muted); font-size: max(10px, 1.65cqw); }
.menu-note:empty { display: none; }
.motion-settings .button { font-size: max(9px, 1.55cqw); min-height: max(24px, 3.9cqw); }
.empty-score, #final-score { margin: 1.1cqw 0 0; color: var(--muted); font-size: max(10px, 2cqw); }
#score-list, #score, #final-score { font-variant-numeric: tabular-nums; }
.controls { display: grid; gap: .78cqw; margin: 0; font-size: max(10px, 1.88cqw); }
.controls div { display: grid; grid-template-columns: 1.3fr 1fr; gap: .6cqw; }
.controls dt { font-weight: 700; }
.controls dd { margin: 0; color: var(--muted); }
#score-list { margin: 0; padding-inline-start: 4cqw; color: #dce7eb; font-size: max(11px, 2.7cqw); }
#score-list li { padding: .52cqw 0; border-bottom: 1px solid var(--line); }
#score-list li::marker { color: var(--lime); }
#score-list:empty { display: none; }
#score-list li { padding-right: .6cqw; }
#score-list li strong { float: right; color: var(--lime); }

#medal-count { color: var(--lime); font-size: max(10px, 2cqw); }
.medal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9cqw; }
.medal-grid .button { padding: .65cqw; display: flex; gap: .8cqw; align-items: center; white-space: normal; }
.medal-grid .button[aria-pressed='true'] { border-color: var(--lime); }
.medal-grid img { width: 6cqw; aspect-ratio: 2 / 1; object-fit: contain; }
.medal-grid .locked img { filter: grayscale(100%); opacity: .48; }
.medal-grid span { line-height: 1.12; font-size: max(9px, 1.65cqw); }
.medal-grid small { display: block; color: var(--muted); line-height: 1.25; margin-top: .3cqw; font-size: max(8px, 1.22cqw); }
#medal-detail { min-height: 6cqw; margin: 0; }
.about-panel { width: min(66cqw, 100%); }
.about-panel img { display: block; width: 100%; max-height: 41cqw; object-fit: contain; }
.pilot-label { font-size: max(11px, 1.9cqw); color: var(--muted); }
#pilot-name { min-height: 5.3cqw; color: inherit; font: inherit; font-size: max(16px, 2.1cqw); padding: .6cqw 1cqw; border: 1px solid var(--line); border-radius: .5cqw; background: #080e19; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#game-over-art { display: block; aspect-ratio: 4 / 1; width: 100%; background: url('./assets/gameover.webp') 0 0 / 400% 800% no-repeat; }

#hud { z-index: 1; pointer-events: none; display: flex; justify-content: space-between; align-items: flex-start; padding: 1.45cqw 1.65cqw; }
.hud-block {
  display: flex;
  align-items: center;
  gap: 1.25cqw;
  min-height: 5.4cqw;
  padding: .7cqw 1.3cqw;
  background: #0b1727e0;
  border: 1px solid var(--line);
  border-radius: .7cqw;
  box-shadow: 0 .45cqw 1.7cqw #03060d73;
}
.hud-stat { display: grid; gap: .22cqw; min-width: 8cqw; }
.hud-stat span { font-size: max(8px, 1.15cqw); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .13em; }
#score { display: block; line-height: 1; font-size: max(12px, 2.32cqw); font-weight: 750; }
#weapon-stage { display: block; line-height: 1; font-size: max(11px, 2.15cqw); font-weight: 750; }
#multiplier { color: var(--lime); font-size: 2.2cqw; font-weight: 750; }
#health { appearance: none; width: 12cqw; height: max(4px, 1.15cqw); display: block; background: #243541; }
#health::-webkit-meter-bar { background: #243541; border: 0; border-radius: 0; }
#health::-webkit-meter-optimum-value { background: linear-gradient(90deg, #e28d65, #fec191); }
#health::-moz-meter-bar { background: #fec191; }
#pause {
  display: grid;
  place-items: center;
  pointer-events: auto;
  width: max(24px, 4.6cqw);
  height: max(24px, 4.35cqw);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .5cqw;
  color: #eef4f8;
  background: #172637;
}
#pause::before { content: ''; width: max(7px, 1.32cqw); height: max(9px, 1.65cqw); border-inline: max(2px, .39cqw) solid currentColor; }
#pause:hover { color: var(--lime); border-color: var(--lime); }
.shock-button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65cqw;
  min-height: max(24px, 5.4cqw);
  color: #d9f4ff;
  padding: .6cqw 1cqw;
  border-color: #80d6f18c;
  font-size: max(9px, 1.65cqw);
}
.shock-button img { width: max(12px, 2.6cqw); aspect-ratio: 1; object-fit: contain; }
.shock-button strong { color: #a5edff; font-variant-numeric: tabular-nums; }
.shock-button:disabled { opacity: .55; cursor: default; }
.medal-notice {
  position: absolute;
  inset: 9.5cqw auto auto 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1cqw;
  padding: .65cqw 1.25cqw;
  background: #12222bf5;
  border: 1px solid var(--lime);
  border-radius: .6cqw;
  color: var(--lime);
  font-size: max(10px, 1.9cqw);
  white-space: nowrap;
  box-shadow: 0 .5cqw 2cqw #0009;
}
.medal-notice img { width: 5cqw; aspect-ratio: 2 / 1; object-fit: contain; }

#sticks { z-index: 2; pointer-events: none; display: none; }
.stick {
  position: absolute;
  bottom: 3.3cqw;
  width: 16cqw;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  pointer-events: auto;
  border: 1px solid #b8f3ec57;
  border-radius: 50%;
  background: #10233382;
  color: #d4ecee;
}
.stick[data-stick='move'] { left: 4cqw; }
.stick[data-stick='aim'] { right: 4cqw; }
.stick i {
  width: 43%;
  aspect-ratio: 1;
  border: 1px solid #caf9e27d;
  border-radius: 50%;
  background: #8bcab66e;
  transform: translate(var(--stick-x, 0), var(--stick-y, 0));
  pointer-events: none;
}
.stick span { position: absolute; font-size: max(8px, 1.45cqw); bottom: 10%; pointer-events: none; }
.rotate-hint { display: none; }
@media (pointer: coarse) {
  #sticks { display: block; }
  .touch-help { display: block; }
  .desktop-help { display: none; }
  #stage[data-tilt='on'] .stick[data-stick='aim'] { display: none; }
  #stage[data-tilt='on'] .stick[data-stick='move'] { right: 4cqw; left: auto; }
}
@media (pointer: coarse) and (orientation: portrait) {
  .rotate-hint { display: block; position: fixed; bottom: 8%; margin: 0; color: var(--muted); font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
