:root {
  color-scheme: dark;
  --ink: #110e18;
  --cream: #fff1df;
  --muted: #a89eb6;
  --orange: #ff8b4b;
  --line: #372d43;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: "Archivo", "Arial", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 300px;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--cream);
  background: radial-gradient(ellipse at 54% 38%, #211729 0%, #140f1c 47%, #0e0c13 85%);
  font-family: var(--sans);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #b5b6ff; outline-offset: 5px; }
.cabinet {
  height: 100vh; height: 100dvh; padding: clamp(5px, 1vw, 14px);
  padding-top: max(clamp(5px, 1vw, 14px), env(safe-area-inset-top));
  padding-bottom: max(clamp(5px, 1vw, 14px), env(safe-area-inset-bottom));
  padding-left: max(clamp(5px, 1vw, 14px), env(safe-area-inset-left));
  padding-right: max(clamp(5px, 1vw, 14px), env(safe-area-inset-right));
}
.wordmark { display: flex; align-items: center; gap: 9px; user-select: none; font-family: var(--sans); }
.wordmark strong { font-size: 17px; letter-spacing: -.065em; font-weight: 900; color: var(--cream); }
.duo { display: inline-flex; gap: 3px; align-items: center; padding-left: 2px; }
.duo i { width: 12px; height: 17px; display: block; background: #ff8b4b; clip-path: polygon(36% 0, 100% 0, 64% 100%, 0 100%); }
.duo i + i { background: #8d96f9; margin-left: -2px; }
.utility, .top-strip { font-family: var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.sound-area { display: flex; position: relative; gap: 5px; align-items: center; }
.utility {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid #41364e; border-radius: 4px; padding: 10px 13px;
  height: 32px; background: #1d1727de; color: #e2d6e7; font-size: 10px; font-weight: 700;
}
.utility:hover, .pause:hover { background: #30233b; border-color: #74607f; }
.utility.music { width: 32px; padding: 0; letter-spacing: 0; font-size: 18px; }
.sound-icon { display: flex; align-items: center; gap: 2px; color: var(--orange); height: 16px; }
.sound-icon i { width: 2px; height: 5px; background: currentColor; }
.sound-icon i:nth-child(2) { height: 11px; }
.sound-icon i:nth-child(3) { height: 15px; }
.sound-icon i:nth-child(4) { height: 8px; }
[aria-pressed="false"] .sound-icon { color: #8f849f; }
[aria-pressed="false"] .sound-icon i { height: 2px; }
.music-panel {
  position: absolute; z-index: 10; right: 0; top: 39px; max-height: calc(100dvh - 62px); overflow: auto; touch-action: pan-y; user-select: auto; min-width: 235px; max-width: 280px;
  border: 1px solid #584761; border-radius: 5px; background: #201828; padding: 15px;
  box-shadow: 0 12px 30px #07050bb0; font: 13px var(--sans); text-transform: none; letter-spacing: normal;
}
.music-panel p { color: #c1b2ca; margin: 9px 0; line-height: 1.4; overflow-wrap: anywhere; }
.music-panel .text-button { display: block; margin-top: 9px; text-align: left; }

.stage {
  position: relative; width: 100%; height: 100%; isolation: isolate;
  overflow: hidden; background: #1c1329; border: 1px solid #4a3b57; border-radius: 6px;
  box-shadow: 0 24px 75px #0a070e80; touch-action: none; user-select: none;
}
#scene { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.stage-chrome { position: absolute; inset: 9px; z-index: 1; pointer-events: none; }
.stage-chrome i { position: absolute; width: 12px; height: 12px; border-color: #ac92bf70; border-style: solid; border-width: 0; }
.stage-chrome i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.stage-chrome i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.stage-chrome i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.stage-chrome i:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

.top-strip {
  position: absolute; inset: 20px 23px auto; display: flex; justify-content: space-between;
  align-items: center; gap: 8px; font-size: 10px; color: #d6c6de; z-index: 4; pointer-events: none;
}
.top-actions, .best { display: flex; align-items: center; gap: 6px; }
.top-actions { margin-left: auto; }
.sound-area, .pause, .ability { pointer-events: auto; }
.stage:not([data-state="menu"]) .wordmark { display: none; }
.stage:not([data-state="menu"]) #sound { width: 32px; padding: 0; }
.stage:not([data-state="menu"]) #sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.best { gap: 8px; padding: 7px 9px; background: #1c1427c9; border: 1px solid #6b507b8a; border-radius: 3px; }
.best strong { color: #ffbc93; font-size: 11px; }
.pause {
  display: flex; gap: 4px; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; background: #1c1427df; border: 1px solid #6b507b8a; border-radius: 3px; pointer-events: auto;
}
.abilities { display: flex; align-items: center; gap: 6px; }
.ability {
  --charge: 100%; --ability-color: #c4bbfa;
  position: relative; isolation: isolate; overflow: hidden; height: 32px;
  display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 108px;
  padding: 0 7px; border: 1px solid #8d83bba6; border-radius: 3px; background: #231a36e6;
  color: #f2eaff; font: 700 9px var(--mono); letter-spacing: .06em; touch-action: manipulation;
}
.ability::before {
  content: ""; position: absolute; z-index: -1; inset: auto auto 0 0;
  width: var(--charge); height: 2px; background: var(--ability-color);
}
.ability:hover { background: #3a2f59; border-color: var(--ability-color); }
.ability[aria-disabled="true"] { color: #d4c5db; border-color: #6b507b8a; cursor: default; }
.ability-key { border: 1px solid #9382b38a; border-radius: 2px; padding: 1px 3px; font: inherit; }
.ability-status { min-width: 30px; text-align: right; color: var(--ability-color); }
.boost { --ability-color: #98ede2; border-color: #6ba6a4b0; background: #162b36e6; }
.boost:hover { background: #234251; }
.pause i { width: 2px; height: 10px; background: #e4d6ed; }
.start-screen {
  position: absolute; z-index: 2; top: 50%; left: clamp(32px, 5.3vw, 82px);
  transform: translateY(-46%); width: min(55%, 600px);
}
.start-screen h1 {
  margin: 0; font-family: "Archivo Black", "Arial Black", var(--sans);
  font-size: clamp(48px, 6.45vw, 101px); line-height: .91; font-weight: 900;
  letter-spacing: -.086em; color: var(--cream); text-shadow: 0 5px 30px #100b18a0;
}
.start-screen h1 em { font-style: normal; color: var(--orange); }
.start-screen h1 em span { color: #ffb08a; }
.start-screen p {
  margin: 26px 0 26px 3px; color: #e7d9e8; font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.5; text-shadow: 0 2px 10px #100a16;
}
.primary {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px 17px 13px; min-height: 49px; background: #ff8b4b;
  border: 1px solid #ffab78; border-radius: 3px; color: #22141b;
  box-shadow: 0 3px 0 #b44c2b, 0 0 30px #f2794540;
  font-family: var(--mono); font-weight: 900; font-size: 13px; letter-spacing: .09em;
}

.launch-arrow {
  display: inline-block; position: relative; width: 14px; height: 14px; flex: 0 0 14px;
}
.launch-arrow::before, .launch-arrow::after { content: ""; position: absolute; }
.launch-arrow::before {
  width: 13px; height: 1.5px; background: currentColor; left: 0; top: 7px; transform: rotate(-45deg);
}
.launch-arrow::after { width: 6px; height: 6px; border: 1.5px solid currentColor; border-width: 1.5px 1.5px 0 0; top: 2px; right: 1px; }
.track-drop {
  padding: 10px 9px; border: 1px dashed #795d80; border-radius: 4px; text-align: center;
  color: #c1b2ca; font-size: 11px; line-height: 1.5;
}
.music-panel .track-drop .text-button { display: inline; margin: 0; }
.track-drop.is-over { background: #4c2d49; border-color: #ffa47b; }
.beat-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.beat-fields label { font-size: 11px; color: #e8d3e9; }
.beat-fields input {
  display: block; width: 100%; margin-top: 4px; padding: 5px 6px; font: 700 13px var(--mono);
  border: 1px solid #594462; border-radius: 3px; background: #15101d; color: var(--cream);
}
.music-panel .beat-help { font-size: 10px; }

.primary:hover { background: #ffad77; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b44c2b; }
.run-hud { position: absolute; top: 30px; left: 24px; z-index: 2; pointer-events: none; }
.run-hud span, .result span {
  display: block; margin-bottom: 4px; font: 700 9px var(--mono); letter-spacing: .15em; color: #d2c0dd;
}
.run-hud strong {
  font-family: var(--mono); font-size: clamp(25px, 2.9vw, 38px); line-height: 1;
  letter-spacing: -.08em; text-shadow: 0 3px 18px #0d0816;
}
.flight-tip {
  position: absolute; z-index: 2; left: 50%; bottom: 24px; transform: translateX(-50%);
  white-space: nowrap; pointer-events: none; background: #251a31ed; color: #f9dac9;
  border: 1px solid #78545c; border-radius: 3px; padding: 9px 12px;
  font: 700 10px var(--mono); text-transform: uppercase; letter-spacing: .09em;
}
.overlay {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
  padding: 50px 24px 24px; background: #110a19a0; backdrop-filter: blur(4px);
}
.dialog {
  text-align: center; max-width: 100%; padding: 25px 36px; border: 1px solid #74536e;
  border-radius: 5px; background: #201527f2; box-shadow: 0 10px 60px #090511b8;
}
.dialog-label { font: 700 10px var(--mono); letter-spacing: .15em; color: var(--orange); margin: 2px 0 10px; }
.dialog h2 {
  font-family: "Archivo Black", "Arial Black", var(--sans); font-size: clamp(36px, 5.6vw, 70px);
  letter-spacing: -.085em; line-height: .95; margin: 0; text-transform: uppercase;
}
.dialog-description { margin: 13px 0 18px; color: #d9c6de; font-size: 14px; line-height: 1.4; }
.result { display: flex; justify-content: center; gap: 30px; margin: 0 0 19px; }
.result strong { font: 900 27px var(--mono); color: #ffbd97; letter-spacing: -.06em; }
.text-button {
  border: 0; padding: 2px 0; background: transparent; color: #e8cced; text-decoration: underline;
  text-underline-offset: 3px; font-size: 12px;
}
.text-button:hover { color: #ffbd97; }
.menu-button { display: block; margin: 15px auto 0; }

.start-screen .control-hint { margin: 17px 0 0 2px; color: #c6b5ce; font-size: 12px; }
.keyboard-hint { display: block; margin-top: 7px; }
.keyboard-hint kbd + kbd { margin-left: 5px; }
.control-hint kbd { font: 700 10px var(--mono); color: var(--cream); background: #302139; border: 1px solid #6f5676; border-radius: 3px; padding: 2px 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
  .start-screen { left: 34px; }
  .start-screen h1 { font-size: clamp(43px, 8vw, 70px); }
}
@media (max-width: 560px) {
  .top-strip { inset: 14px 13px 14px; align-items: flex-start; }
  .wordmark { gap: 6px; }
  .wordmark strong { font-size: 15px; }
  .duo i { width: 10px; height: 15px; }
  .utility { padding: 7px; gap: 6px; letter-spacing: .05em; }
  .best { gap: 4px; padding: 7px 5px; }
  .stage:not([data-state="menu"]) .best { display: none; }
  .abilities { position: absolute; bottom: 0; right: 0; }
  .flight-tip { bottom: 65px; }
  .ability { height: 40px; min-width: 81px; }
  .run-hud { top: 26px; left: 15px; }
  .start-screen { width: calc(100% - 36px); left: 18px; top: auto; bottom: clamp(25px, 7dvh, 59px); transform: none; }
  .start-screen h1 { font-size: clamp(39px, 11vw, 64px); }
  .start-screen p { margin: 14px 0 16px 1px; font-size: 14px; }
  .start-screen .control-hint { margin-top: 12px; font-size: 11px; }
  .primary { min-height: 42px; padding: 10px 12px; font-size: 12px; }
}
@media (max-height: 540px) {
  .start-screen h1 { font-size: clamp(35px, 10dvh, 63px); }
  .start-screen p { margin: 10px 0; }
  .start-screen .control-hint { margin-top: 10px; }
  .keyboard-hint { margin-top: 5px; }
  .dialog { padding: 15px 22px; }
  .dialog-description { margin: 8px 0 12px; }
  .result { margin-bottom: 10px; }
}

@media (pointer: coarse) {
  .ability-key, .keyboard-hint { display: none; }
}
