:root {
  color-scheme: dark;
  --page: #080710;
  --panel: #100d1b;
  --white: #f9f5ff;
  --muted: #a29bb9;
  --lime: #dfff8f;
  --line: #28223b;
  --mono: "Space Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 52% 9%, #17102a 0, #0a0812 51%, var(--page) 80%);
  color: var(--white);
  overscroll-behavior: none;
}
button { font: inherit; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
[hidden] { display: none !important; }
.arcade {
  width: min(100%, 1232px);
  margin-inline: auto;
  padding: max(22px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-left));
}
.topbar, .top-actions, .brand { display: flex; align-items: center; }
.topbar { justify-content: space-between; margin-bottom: 20px; }
.brand { gap: 11px; font-weight: 900; font-size: 15px; letter-spacing: .18em; }
.brand-mark {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #29273b;
  border: 1px solid #44445a;
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2.4px solid var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 7px #dfff8f42;
}
.brand-mark::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 9px;
  height: 2.4px;
  transform: rotate(46deg);
  transform-origin: right center;
  background: var(--lime);
}
.stick-hud {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  color: #a7f0ff;
}
.stick-hud-dial {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: conic-gradient(#9df1ff 0 var(--stick-fill, 0%), #4a3a65 var(--stick-fill, 0%) 100%);
}
.stick-hud-dial::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background:
    linear-gradient(#3b3151, #3b3151) center / 1px 100% no-repeat,
    linear-gradient(#3b3151, #3b3151) center / 100% 1px no-repeat,
    #171225;
}
.stick-hud-dial i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(calc(-50% + 13px * var(--stick-x, 0)), calc(-50% + 13px * var(--stick-y, 0)));
  background: #bdf6ff;
  box-shadow: 0 0 7px #9df1ff66;
}
.stick-hud-readout { display: grid; gap: 3px; min-width: 4ch; font-family: var(--mono); }
.stick-hud-readout span { color: #b0a8c8; font-size: 8px; letter-spacing: .08em; }
.stick-hud-readout strong { font-size: 12px; line-height: 1; font-variant-numeric: tabular-nums; }
.top-actions { gap: 8px; }
.icon-button {
  color: #ded8f0;
  border: 1px solid #352d49;
  background: #151124;
  height: 40px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
}
.icon-button:hover:enabled { background: #252039; }
.icon-button:disabled { opacity: .44; cursor: default; }
.icon-button svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-button span { font: 700 10px var(--mono); letter-spacing: .06em; }
.sound { padding: 0 11px; }
.pause, .fullscreen { width: 41px; }
.sound-cross, .sound[aria-pressed="false"] .sound-waves { display: none; }
.sound[aria-pressed="false"] .sound-cross { display: initial; }
.shrink-icon, .fullscreen[aria-pressed="true"] .expand-icon { display: none; }
.fullscreen[aria-pressed="true"] .shrink-icon { display: initial; }
.fullscreen-hint { margin: 0 0 7px; color: #d7c7ee; font-size: 12px; line-height: 1.35; }

.cabinet {
  border: 1px solid #33294a;
  border-radius: 13px;
  overflow: hidden;
  background: #0a0815;
  box-shadow: 0 24px 90px #030106bd, 0 0 75px #361b6a28;
}
.hud {
  height: 72px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  padding: 0 24px;
  background: linear-gradient(104deg, #161122, #100d1b 48%, #161122);
  border-bottom: 1px solid #3a2b58;
}
.metric { display: grid; gap: 5px; justify-items: start; line-height: 1; min-width: 0; }
.metric-mid { justify-items: center; }
.metric-best { justify-items: end; }
.metric span { font: 700 10px var(--mono); color: #b0a8c8; letter-spacing: .14em; white-space: nowrap; }
.metric strong { font: 700 25px/1 var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric strong[data-wide] { font-size: clamp(14px, 2vw, 24px); }
.metric-mid strong { color: var(--lime); }
.metric-best strong { color: #ddd1ff; }
.scores-open {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c6b2ee;
  font: 700 10px var(--mono);
  white-space: nowrap;
  cursor: pointer;
}
.scores-open:hover { color: #fff; }
.scores-open span { color: inherit; }
.best-value { display: flex; align-items: baseline; gap: 5px; }
.arena {
  position: relative;
  isolation: isolate;
  height: clamp(400px, calc(100svh - 246px), 662px);
  overflow: hidden;
  background: #0c0819;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}
#field, .screen-texture, .arena-corners, .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#field { display: block; touch-action: none; }
.screen-texture {
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 3px, #05010e26 4px, transparent 5px);
  z-index: 1;
}
.arena-corners { pointer-events: none; z-index: 2; }
.arena-corners i { position: absolute; width: 13px; height: 13px; border: 0 solid #a688ed95; }
.arena-corners i:nth-child(1) { top: 11px; left: 11px; border-width: 1px 0 0 1px; }
.arena-corners i:nth-child(2) { top: 11px; right: 11px; border-width: 1px 1px 0 0; }
.arena-corners i:nth-child(3) { bottom: 11px; left: 11px; border-width: 0 0 1px 1px; }
.arena-corners i:nth-child(4) { bottom: 11px; right: 11px; border-width: 0 1px 1px 0; }
.overlay {
  z-index: 3;
  display: grid;
  place-items: center;
  align-items: safe center;
  overflow-y: auto;
  text-align: center;
  padding: 12px;
  background: radial-gradient(ellipse at center, #100820d9 3%, #1008209e 35%, #0a061517 73%);
}
.overlay.is-panel { background: #0905159e; backdrop-filter: blur(4px); }
.intro { position: relative; width: 100%; padding-bottom: 3px; }
.mode {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #e1d2fb;
  font: 700 11px var(--mono);
  letter-spacing: .18em;
}
.mode i, .start-note i { display: inline-block; width: 5px; height: 5px; transform: rotate(45deg); background: var(--lime); box-shadow: 0 0 12px #dfff8fa0; }
.intro h1 {
  margin: 10px 0 7px;
  font-size: clamp(58px, 13vw, 145px);
  font-weight: 950;
  line-height: .96;
  letter-spacing: -.065em;
  transform: skew(-8deg);
  padding-right: .085em;
  background: linear-gradient(175deg, #ffffff 17%, #f5edff 50%, #c39eff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px #ae69ff72);
}
.intro p { color: #e3d9f2; font-size: clamp(15px, 2.25vw, 19px); margin: 16px 0 25px; letter-spacing: .01em; }
.primary {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  min-width: 176px;
  min-height: 47px;
  padding: 0 15px 0 17px;
  gap: 24px;
  border: 0;
  border-radius: 5px;
  color: #151a0e;
  background: var(--lime);
  box-shadow: 0 0 22px #c9ff6b46, inset 0 -2px #8ca54380;
  font: 800 12px var(--mono);
  letter-spacing: .11em;
  cursor: pointer;
}
.primary:hover { background: #eeffb8; box-shadow: 0 0 32px #c9ff6b69; }
.primary:active { transform: translateY(1px); }
.primary span { font-size: 19px; line-height: 1; }
.start-note { color: #bab0cd; margin-top: 15px; font: 700 9px var(--mono); letter-spacing: .14em; }
.start-note i { width: 3px; height: 3px; vertical-align: 2px; margin: 0 4px; background: #bb9ae5; }
.run-hint {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  bottom: 19px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  text-align: center;
  background: #100c20df;
  color: #f0e9ff;
  border: 1px solid #59447c;
  border-radius: 5px;
  padding: 6px 10px;
  font: 12px var(--mono);
}
.panel {
  width: min(100%, 408px);
  border: 1px solid #614a91;
  border-radius: 12px;
  padding: 24px 23px;
  background: radial-gradient(ellipse at top, #27193e, #100b1b 68%);
  box-shadow: 0 14px 44px #080410ba, 0 0 48px #8848f025;
}
.panel h2 { font: 800 clamp(31px, 8vw, 58px)/1 var(--mono); margin: 13px 0 8px; letter-spacing: -.09em; overflow-wrap: anywhere; }
.panel p { color: #d3c6e7; font-size: 14px; margin: 9px 0 15px; }
.run-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 19px; padding: 13px 0; border-block: 1px solid #48365f; }
.run-stats div { display: grid; gap: 6px; font-family: var(--mono); }
.run-stats div + div { border-left: 1px solid #48365f; }
.run-stats strong { font-size: 15px; color: var(--lime); }
.run-stats span { font-size: 9px; color: #b5a5cc; }
.paused h2 { margin: 0 0 20px; }
.text-button { display: block; margin: 12px auto 0; padding: 6px; border: 0; background: transparent; color: #d7c7ee; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.steering-switch {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 10px auto 0;
  padding: 2px;
  gap: 2px;
  border: 1px solid #3a304f;
  border-radius: 6px;
  background: #100b1be8;
}
.steering-switch button {
  padding: 5px 10px;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  color: #c9bada;
  background: transparent;
  cursor: pointer;
  font: 700 11px var(--mono);
  white-space: nowrap;
}
.steering-switch button[aria-pressed="true"] { color: #dcf9ff; background: #2c2650; }
.steering-switch button:hover { color: #fff; }
.intro .steering-hint, .panel .steering-hint {
  max-width: 280px;
  margin: 9px auto 0;
  color: #c4b4db;
  font: 11px/1.5 var(--mono);
  letter-spacing: 0;
}
.control-touch { white-space: normal; }
.music-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-top: 10px;
  color: #b6a8ce;
  font: 10px/1.5 var(--mono);
}
.music-artists { color: #9383ad; }
.music-credit button {
  padding: 4px 7px;
  border: 1px solid #59447c;
  border-radius: 4px;
  background: #171020;
  color: #dcf9ff;
  font: inherit;
  cursor: pointer;
}
.is-immersive .music-credit { display: none; }
.game-dialog {
  width: min(430px, calc(100% - 24px));
  max-height: min(620px, calc(100% - 24px));
  overflow-y: auto;
  color: var(--white);
  text-align: left;
}
.game-dialog::backdrop { background: #080612c9; }
.game-dialog h2 { font-size: clamp(26px, 7vw, 36px); margin: 0; }
.game-dialog label { display: block; margin-bottom: 5px; color: #dfd4ef; font: 700 11px var(--mono); }
.game-dialog input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #6b5689;
  border-radius: 5px;
  background: #0d0918;
  color: var(--white);
  font: inherit;
}
.game-dialog .primary { width: 100%; margin-top: 12px; }
.dialog-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.close-dialog { width: 42px; flex: none; font-size: 24px; }
.scores-list { margin: 10px 0 0; padding-left: 2.4ch; color: #c7b3e9; font: 700 13px var(--mono); }
.scores-list li { padding: 8px 0 8px 4px; border-bottom: 1px solid #36274b; }
.scores-list li div { display: flex; justify-content: space-between; gap: 10px; }
.scores-list li span { color: var(--white); overflow-wrap: anywhere; }
.scores-list li strong { color: #a7f0ff; flex: none; }
.score-status { color: #bdf6ff; font-size: 12px; }

.guide { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 18px 1px 0; }
.rules { display: flex; gap: clamp(12px, 3vw, 35px); align-items: center; }
.rule { display: flex; align-items: center; gap: 9px; }
.rule > div { display: grid; gap: 3px; }
.rule strong { font-size: 12px; }
.rule span { color: var(--muted); font-size: 11px; }
.rule-icon { display: block; flex: 0 0 25px; width: 25px; height: 25px; position: relative; border: 1px solid #302642; border-radius: 5px; background: #141021; }
.rule-icon::before, .rule-icon::after { content: ""; position: absolute; }
.rule-swarm::before { inset: 7px; transform: rotate(45deg); border: 1px solid #60a5ff; box-shadow: 0 0 6px #327df4; }
.rule-shard::before { inset: 6px 9px; background: #b7ff79; transform: rotate(30deg); box-shadow: 0 0 7px #88ff4d70; }
.rule-gate::before { top: 11px; left: 5px; right: 5px; height: 1px; background: #83edff; }
.rule-gate::after { top: 9px; left: 4px; width: 5px; height: 5px; border-radius: 50%; background: #ff925d; box-shadow: 10px 0 #ff925d; }
.controls { color: var(--muted); white-space: nowrap; font: 11px var(--mono); }
.control-keys, .control-touch { align-items: center; gap: 5px; display: flex; }
.control-touch { display: none; }
.control-touch i { width: 9px; height: 9px; border: 1px solid #a68ec9; border-radius: 50%; }
kbd { padding: 4px 6px; border: 1px solid #3a304d; border-radius: 4px; color: #e7dcfa; font: inherit; background: #151021; }

@media (pointer: coarse) {
  .control-keys { display: none; }
  .control-touch { display: flex; }
}
@media (max-width: 740px) {
  .arcade { padding: max(9px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .topbar { margin-bottom: 8px; }
  .brand { font-size: 12px; gap: 7px; }
  .brand-mark { width: 29px; height: 29px; }
  .icon-button { min-height: 44px; }
  .pause, .fullscreen { min-width: 44px; }
  .cabinet { border-radius: 9px; }
  .hud { height: 55px; padding-inline: 11px; }
  .metric span { font-size: 8px; letter-spacing: .08em; }
  .scores-open { font-size: 8px; }
  .metric strong { font-size: 19px; }
  .metric strong[data-wide] { font-size: clamp(12px, 3.1vw, 19px); }
  .arena { height: max(310px, calc(100svh - 200px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  .intro h1 { font-size: clamp(38px, 15vw, 94px); }
  .intro p { margin: 13px 0 20px; }
  .guide { display: grid; gap: 7px; padding-top: 9px; }
  .rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 7px; }
  .rule { align-items: flex-start; gap: 4px; }
  .rule strong, .rule span { font-size: 10px; }
  .rule-icon { flex-basis: 20px; width: 20px; height: 20px; }
  .rule-swarm::before { inset: 5px; }
  .rule-shard::before { inset: 4px 7px; }
  .rule-gate::before { top: 9px; left: 4px; right: 4px; }
  .rule-gate::after { top: 7px; left: 3px; box-shadow: 8px 0 #ff925d; }
  .controls { font-size: 10px; }
}
@media (max-width: 430px) {
  .stick-hud:not([hidden]) + .top-actions .sound { width: 44px; padding: 0; }
  .stick-hud:not([hidden]) + .top-actions .sound span { display: none; }
}
@media (max-width: 350px) {
  .topbar:has(.stick-hud:not([hidden])) .brand > span:last-child { display: none; }
  .best-value > span { display: none; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .arcade { padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .topbar { margin-bottom: 4px; }
  .icon-button { min-height: 44px; }
  .hud { height: 39px; padding-inline: 14px; }
  .metric { gap: 2px; }
  .metric span { font-size: 8px; }
  .metric strong { font-size: 18px; }
  .arena { height: max(220px, calc(100svh - 94px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  .guide { padding-top: 7px; }
  .intro h1 { font-size: clamp(43px, 9vw, 74px); }
  .intro p { margin: 8px 0 11px; }
  .start-note { margin-top: 10px; }
  .panel { padding: 12px 16px; }
  .panel h2 { margin-top: 5px; font-size: 34px; }
  .panel p { margin: 6px 0 8px; }
  .run-stats { margin-bottom: 8px; padding: 7px 0; }
  .steering-switch { margin-top: 6px; }
  .steering-switch button { min-height: 26px; }
}

html.is-immersive, .is-immersive body { overflow: hidden; }
.is-immersive .arcade {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100svh;
  height: 100dvh;
  padding: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
}
.is-immersive .topbar { margin-bottom: 5px; }
.is-immersive .topbar, .is-immersive .hud, .is-immersive .fullscreen-hint { flex: none; }
.is-immersive .cabinet { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.is-immersive .arena { flex: 1; height: auto; min-height: 0; }
.is-immersive .guide { display: none; }
