﻿:root {
  --bg-1: #93dcff;
  --bg-2: #f5fbff;
  --bg-3: #ffffff;
  --portrait-lock-ratio: 0.5625;
  --text: #f7fbff;
  --muted: rgba(247, 251, 255, 0.72);
  --line: rgba(255, 255, 255, 0.2);
  --accent: #79e5ff;
  --accent-strong: #30beff;
  --shadow: 0 32px 90px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: "Zen Kaku Gothic New", "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.32), transparent 24%),
    radial-gradient(circle at 78% 10%, rgba(255, 255, 255, 0.16), transparent 28%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 54%, var(--bg-3) 100%);
  transition: background 500ms ease;
}

body[data-screen="running"] {
  touch-action: none;
}

body[data-screen="running"][data-device-mode="desktop"],
body[data-screen="running"][data-device-mode="desktop"] .viewport-frame,
body[data-screen="running"][data-device-mode="desktop"] canvas {
  cursor: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 84%);
}

.viewport-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.viewport-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  pointer-events: auto;
}

body[data-touch-orientation="landscape"] .viewport-frame {
  width: min(100vw, calc(100vh * var(--portrait-lock-ratio)));
  height: min(100vh, calc(100vw / var(--portrait-lock-ratio)));
}

body[data-screen="running"][data-mobile-layout="true"] .viewport-frame {
  transform: translateZ(0);
}

body[data-stage="sky"] {
  --bg-1: #bfefff;
  --bg-2: #69b8ff;
  --bg-3: #0b4ea8;
  --text: #091423;
  --muted: rgba(9, 20, 35, 0.8);
  --line: rgba(9, 20, 35, 0.24);
  --accent: #96e7ff;
  --accent-strong: #49c9ff;
}

body[data-stage="sky"] .top-title,
body[data-stage="sky"] .result-copy,
body[data-stage="sky"] .message-bar,
body[data-stage="sky"] .result-badge,
body[data-stage="sky"] .track-option,
body[data-stage="sky"] .stage-option,
body[data-stage="sky"] .utility-button,
body[data-stage="sky"] .link-button,
body[data-stage="sky"] .secondary-button {
  color: #091423;
  text-shadow: none;
}

body[data-stage="sky"] .utility-button,
body[data-stage="sky"] .link-button,
body[data-stage="sky"] .track-option,
body[data-stage="sky"] .stage-option,
body[data-stage="sky"] .secondary-button,
body[data-stage="sky"] .result-badge {
  border-color: rgba(9, 20, 35, 0.18);
}

body[data-stage="sky"] .utility-button,
body[data-stage="sky"] .link-button,
body[data-stage="sky"] .secondary-button {
  background: rgba(255, 255, 255, 0.38);
}

body[data-stage="sky"] .track-option {
  background: rgba(255, 255, 255, 0.34);
}

body[data-stage="sky"] .stage-option {
  box-shadow: 0 20px 48px rgba(9, 20, 35, 0.16);
}

body[data-stage="sky"] .stage-summary {
  color: rgba(9, 20, 35, 0.92);
}

body[data-stage="sky"] .hud-label {
  color: #091423;
}

body[data-stage="sky"] .stage-order,
body[data-stage="sky"] .stage-kicker,
body[data-stage="sky"] .stage-subname,
body[data-stage="sky"] .stage-meta em {
  color: #123d7a;
}

body[data-stage="sky"] .music-kicker,
body[data-stage="sky"] .music-title,
body[data-stage="sky"] .music-track-order,
body[data-stage="sky"] .music-track-meta strong {
  color: #123d7a;
}

body[data-stage="sky"] .music-track-button.is-selected,
body[data-stage="sky"] .music-track-button.is-playing {
  border-color: rgba(18, 61, 122, 0.42);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(165, 219, 255, 0.72));
  box-shadow:
    0 0 0 2px rgba(18, 61, 122, 0.12),
    0 18px 34px rgba(18, 61, 122, 0.22);
}

body[data-stage="sky"] .title-credit {
  color: rgba(18, 61, 122, 0.74);
}

body[data-stage="sky"] .play-credit {
  color: rgba(247, 251, 255, 0.82);
}

body[data-stage="sky"] .track-option:hover,
body[data-stage="sky"] .track-option:focus-visible,
body[data-stage="sky"] .track-option.is-selected,
body[data-stage="sky"] .stage-option:hover,
body[data-stage="sky"] .stage-option:focus-visible,
body[data-stage="sky"] .stage-option.is-preview {
  color: #091423;
  border-color: rgba(9, 20, 35, 0.32);
}

body[data-stage="sky"] .result-badge {
  background: rgba(255, 255, 255, 0.26);
}

body[data-stage="sky"] .result-screen[data-outcome="clear"] .eyebrow,
body[data-stage="sky"] .result-screen[data-outcome="clear"] .result-badge,
body[data-stage="sky"] .result-screen[data-outcome="clear"] h2,
body[data-stage="sky"] .result-screen[data-outcome="clear"] .result-copy,
body[data-stage="sky"] .result-screen[data-outcome="clear"] .result-stat span,
body[data-stage="sky"] .result-screen[data-outcome="clear"] .result-stat strong {
  color: #123d7a;
}

body[data-stage="sky"] .result-screen[data-outcome="clear"] .result-badge {
  border-color: rgba(18, 61, 122, 0.3);
  box-shadow: 0 0 24px rgba(18, 61, 122, 0.14);
}

body[data-stage="sea"] {
  --bg-1: #0e7cc6;
  --bg-2: #052947;
  --bg-3: #04192e;
  --accent: #57f2ff;
  --accent-strong: #11c6de;
}

body[data-stage="space"] {
  --bg-1: #0d1228;
  --bg-2: #040812;
  --bg-3: #010204;
  --accent: #c58dff;
  --accent-strong: #7be5ff;
}

body[data-stage="city"] {
  --bg-1: #ffd4a3;
  --bg-2: #ff8a6b;
  --bg-3: #5d2b3b;
  --accent: #2c8f58;
  --accent-strong: #5abf71;
}

.scene-root,
.grain {
  position: fixed;
  inset: 0;
}

.grain {
  pointer-events: none;
  opacity: 0.28;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 20%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08), transparent 16%);
  mix-blend-mode: screen;
}

.ui-shell {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.hud-bar,
.screen,
.message-bar {
  position: relative;
  z-index: 1;
}

.play-credit {
  position: fixed;
  left: 20px;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  z-index: 1;
  margin: 0;
  color: rgba(247, 251, 255, 0.6);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

body[data-screen="running"] .play-credit,
body[data-screen="select"] .play-credit,
body[data-screen="music"] .play-credit,
body[data-screen="result"] .play-credit {
  opacity: 1;
}

[hidden] {
  display: none !important;
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.top-title {
  margin: 0;
  white-space: nowrap;
  font-family: "Zen Kaku Gothic New", "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(0.96rem, 2vw, 1.22rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  color: rgba(247, 251, 255, 0.98);
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.12);
}

.score-hud {
  display: grid;
  gap: 6px;
}

.hud-metrics {
  display: flex;
  align-items: start;
  gap: 34px;
}

.hud-metric {
  display: grid;
  gap: 6px;
}

#scoreHud .music-track-button {
  display: none !important;
}

.hud-stack {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.life-hud {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.life-icons {
  display: flex;
  gap: 4px;
}

.life-token {
  position: relative;
  width: 80px;
  height: 80px;
  transition: opacity 180ms ease;
}

.life-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.18));
}

.life-token.is-spent {
  opacity: 0;
  pointer-events: none;
}

.life-token.is-lost {
  animation: life-burst 420ms ease forwards;
}

@keyframes life-burst {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
  35% {
    opacity: 1;
    transform: scale(1.2) rotate(-8deg);
    filter: brightness(1.35);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(0.18) rotate(16deg);
    filter: brightness(1.6);
  }
}

.hud-label,
.eyebrow,
.device-badge,
.stage-order,
.result-stat span {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.hud-value {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.2);
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 14px;
}

.time-hud {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.time-value {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.16);
}

.utility-button,
.link-button,
.primary-button,
.secondary-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.utility-button,
.link-button {
  padding: 12px 16px;
  background: rgba(4, 10, 24, 0.32);
  color: var(--text);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.screen {
  align-self: end;
  width: min(780px, 100%);
}

.intro-screen {
  align-self: stretch;
  width: 100%;
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  padding-top: clamp(12px, 4vh, 48px);
  position: relative;
}

.intro-shell,
.music-shell {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
}

.intro-shell {
  min-height: min(68vh, 720px);
  grid-template-rows: auto auto 1fr auto;
  align-content: stretch;
  justify-items: center;
  text-align: center;
  transform: translateY(-10vh);
}

.title-badge,
.music-kicker {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}

.title-headline,
.music-title {
  margin: 0;
  font-family: "Zen Kaku Gothic New", "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.title-headline {
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  line-height: 0.94;
  max-width: 8em;
  text-wrap: balance;
}

.title-logo {
  display: block;
  width: min(840px, 92vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.22));
}


.title-subcopy,
.music-copy {
  margin: 0;
  max-width: 26rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.06rem);
  line-height: 1.72;
}

.music-screen .music-copy {
  display: none;
}

.title-actions,
.music-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.title-actions {
  width: min(280px, 72vw);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-inline: auto;
}

.music-back-row {
  display: flex;
  justify-content: flex-start;
}

.title-mode-button {
  min-width: 190px;
  width: 100%;
}

.title-credit {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-top: auto;
  color: rgba(247, 251, 255, 0.5);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  line-height: 1.55;
  text-align: center;
  width: min(90vw, 520px);
}

.title-credit p {
  margin: 0;
}

.music-option-button {
  min-width: 64px;
  padding-inline: 0;
  font-size: 1.15rem;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.music-option-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

#musicPlayButton,
#musicStopButton,
#musicPrevButton,
#musicNextButton,
#musicShuffleButton,
#musicRepeatButton {
  min-width: auto;
  padding: 12px 16px;
  min-height: 51px;
}

.music-screen,
.select-screen {
  width: 100%;
  justify-items: end;
  align-self: stretch;
}

.screen-heading {
  width: min(760px, 100%);
  display: grid;
  gap: 4px;
  justify-items: start;
}

.music-shell,
.select-shell {
  min-height: min(60vh, 620px);
  align-content: end;
  justify-items: stretch;
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
}

.music-title {
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: clamp(1.02rem, 2vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

.select-title {
  text-align: left;
}

.music-track-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.music-track-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(6, 12, 28, 0.24);
  color: var(--text);
  min-height: 154px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.music-track-button:hover,
.music-track-button:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.34);
}

.music-track-button.is-selected {
  border-color: rgba(123, 229, 255, 0.42);
  background: linear-gradient(180deg, rgba(123, 229, 255, 0.2), rgba(6, 12, 28, 0.3));
}

.music-track-button.is-locked {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(108, 116, 132, 0.16), rgba(6, 12, 28, 0.26));
}

.music-track-button.is-locked:hover,
.music-track-button.is-locked:focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
}

.music-track-button.is-playing {
  box-shadow: 0 0 28px rgba(121, 229, 255, 0.24);
  animation: music-pulse 1.6s ease-in-out infinite;
}

.music-track-order {
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  color: var(--accent);
}

.music-track-meta {
  display: grid;
  gap: 8px;
}

.music-track-meta strong {
  font-size: clamp(1.14rem, 2.6vw, 1.5rem);
  font-weight: 800;
}

.music-track-meta em {
  font-style: normal;
  color: var(--muted);
}

.music-track-status {
  justify-self: start;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.72);
}

@keyframes music-pulse {
  0%,
  100% {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(121, 229, 255, 0.14);
  }
  50% {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(121, 229, 255, 0.28);
  }
}

.result-screen h2 {
  margin: 0;
  font-family: "Zen Kaku Gothic New", "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.result-copy,
.message-bar {
  margin: 0;
  max-width: 32rem;
  color: rgba(247, 251, 255, 0.92);
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  line-height: 1.75;
}

.result-screen {
  display: grid;
  gap: 22px;
  align-content: end;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-self: start;
  align-items: start;
  width: min(760px, 100%);
}

.city-track-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 12px;
  justify-self: end;
}

.stage-option-card {
  position: relative;
  display: grid;
  gap: 0;
  width: 100%;
  min-height: 184px;
  height: 184px;
  background: rgba(6, 12, 28, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  color: var(--text);
  overflow: hidden;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.stage-option-card[data-theme="city"] {
  background:
    linear-gradient(180deg, rgba(121, 242, 168, 0.2), rgba(8, 20, 14, 0.38));
}

.stage-option-main {
  min-height: 100%;
  height: 100%;
  padding-bottom: 78px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.stage-option-main:hover,
.stage-option-main:focus-visible {
  border-color: transparent;
}

.stage-option-card:hover,
.stage-option-card:focus-within {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.32);
}

.stage-option-card .stage-option.is-preview {
  transform: none;
}

.stage-option-card:has(.stage-option.is-preview) {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.34);
}

.city-track-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.city-track-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.track-option {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(6, 12, 28, 0.26);
  color: rgba(247, 251, 255, 0.88);
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.track-option:hover,
.track-option:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.track-option.is-selected {
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(135deg, rgba(123, 229, 255, 0.28), rgba(73, 201, 255, 0.18));
  color: #ffffff;
  box-shadow: 0 0 24px rgba(121, 229, 255, 0.14);
}

.stage-option {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: start;
  gap: 14px 16px;
  width: 100%;
  min-height: 184px;
  padding: 20px;
  background: rgba(6, 12, 28, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.stage-option:hover,
.stage-option:focus-visible {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.32);
}

.stage-option.is-preview {
  color: #ffffff;
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.34);
}

.stage-order {
  text-align: left;
  opacity: 0.8;
  font-family: "Orbitron", "Zen Kaku Gothic New", sans-serif;
}

.stage-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 6px 12px;
}

.stage-kicker {
  grid-column: 1;
  grid-row: 1;
  font-family: "Orbitron", "Zen Kaku Gothic New", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.stage-meta strong {
  grid-column: 1 / -1;
  grid-row: 2;
  font-family: "Zen Kaku Gothic New", "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.stage-subname {
  grid-column: 1 / -1;
  grid-row: 3;
  font-family: "Orbitron", "Zen Kaku Gothic New", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.stage-summary,
.stage-best {
  font-style: normal;
  color: var(--muted);
}

.stage-meta em {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-family: "Orbitron", "Zen Kaku Gothic New", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-style: normal;
  color: var(--accent);
}

body[data-screen="select"][data-stage="city"] .stage-kicker,
body[data-screen="select"][data-stage="city"] .stage-subname,
body[data-screen="select"][data-stage="city"] .stage-meta em {
  color: #153d22;
  text-shadow: none;
}

.stage-meta em:empty {
  display: none;
}

.stage-summary {
  grid-column: 1 / -1;
  font-size: 0.94rem;
  line-height: 1.65;
  color: rgba(247, 251, 255, 0.92);
}

.stage-summary:empty {
  display: none;
}

.stage-best {
  position: absolute;
  top: 54px;
  right: 20px;
  font-family: "Orbitron", "Zen Kaku Gothic New", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: right;
}

.stage-option[data-theme="sky"] {
  background:
    linear-gradient(180deg, rgba(116, 223, 255, 0.22), rgba(8, 20, 40, 0.3));
}

.stage-option[data-theme="sea"] {
  background:
    linear-gradient(180deg, rgba(13, 117, 196, 0.3), rgba(4, 20, 46, 0.42));
}

.stage-option[data-theme="space"] {
  background:
    linear-gradient(180deg, rgba(129, 95, 232, 0.2), rgba(8, 12, 26, 0.34));
}

.stage-option[data-theme="city"] {
  background:
    linear-gradient(180deg, rgba(121, 242, 168, 0.2), rgba(8, 20, 14, 0.38));
}

.stage-option-card .city-track-panel--inline {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 16px;
  width: auto;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  justify-self: stretch;
}

.stage-option-card .city-track-label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: rgba(206, 255, 221, 0.92);
}

.stage-option-card .city-track-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.stage-option-card .track-option {
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.8rem;
  text-align: center;
}

.result-screen {
  position: relative;
  overflow: hidden;
  align-self: center;
  justify-self: center;
  width: min(860px, 100%);
  min-height: min(72vh, 620px);
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
}

.result-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  padding: clamp(24px, 4vw, 40px);
  display: grid;
  gap: 18px;
  justify-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(10, 18, 36, 0.9), rgba(5, 10, 20, 0.82));
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.result-card > * {
  position: relative;
  z-index: 1;
}

.result-card .eyebrow,
.result-card h2,
.result-card .result-copy {
  color: rgba(247, 251, 255, 0.98);
}

.result-card .result-copy {
  max-width: 38rem;
}

.result-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-badge {
  margin: 0;
  width: fit-content;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.96);
  backdrop-filter: blur(12px);
}

.clear-burst {
  position: absolute;
  inset: -12% -8% auto auto;
  width: 300px;
  height: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.clear-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 96px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 244, 170, 0.92), rgba(255, 255, 255, 0));
  transform-origin: center -22px;
}

.clear-burst span:nth-child(1) { transform: translate(-50%, -50%) rotate(0deg); }
.clear-burst span:nth-child(2) { transform: translate(-50%, -50%) rotate(32deg); }
.clear-burst span:nth-child(3) { transform: translate(-50%, -50%) rotate(64deg); }
.clear-burst span:nth-child(4) { transform: translate(-50%, -50%) rotate(96deg); }
.clear-burst span:nth-child(5) { transform: translate(-50%, -50%) rotate(128deg); }
.clear-burst span:nth-child(6) { transform: translate(-50%, -50%) rotate(160deg); }

.result-screen[data-outcome="clear"] {
  background:
    radial-gradient(circle at 84% 18%, rgba(255, 238, 146, 0.26), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(7, 14, 28, 0.14));
}

.result-screen[data-outcome="clear"] .result-card {
  background:
    linear-gradient(180deg, rgba(22, 24, 48, 0.86), rgba(10, 14, 28, 0.8));
  border-color: rgba(255, 239, 153, 0.26);
  box-shadow:
    0 28px 82px rgba(0, 0, 0, 0.42),
    0 0 44px rgba(255, 226, 144, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body[data-stage] .result-screen .result-card .eyebrow,
body[data-stage] .result-screen .result-card h2,
body[data-stage] .result-screen .result-card .result-copy,
body[data-stage] .result-screen .result-card .result-stat strong {
  color: rgba(247, 251, 255, 0.98);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.32);
}

body[data-stage] .result-screen .result-card .result-stat span {
  color: rgba(150, 231, 255, 0.92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.26);
}

body[data-stage] .result-screen .result-card .result-badge {
  color: rgba(255, 247, 191, 0.98);
  border-color: rgba(255, 239, 153, 0.42);
  background: rgba(6, 12, 28, 0.42);
  box-shadow: 0 0 24px rgba(255, 228, 124, 0.18);
}

.result-screen[data-outcome="clear"] .result-badge {
  color: #fff7bf;
  border-color: rgba(255, 239, 153, 0.42);
  box-shadow: 0 0 24px rgba(255, 228, 124, 0.18);
}

.result-screen[data-outcome="clear"] h2 {
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.96;
  text-shadow: 0 0 28px rgba(255, 240, 154, 0.14);
}

.result-screen[data-outcome="clear"] .result-copy {
  max-width: 38rem;
}

.result-screen[data-outcome="clear"] .clear-burst {
  opacity: 1;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%) scale(1.18);
}

.result-screen[data-outcome="failed"] .result-card {
  background:
    linear-gradient(180deg, rgba(14, 20, 36, 0.9), rgba(6, 10, 18, 0.84));
  border-color: rgba(255, 255, 255, 0.12);
}

.result-screen[data-outcome="failed"] .result-badge {
  color: rgba(247, 251, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(5, 10, 20, 0.28);
}

.result-stat {
  display: grid;
  gap: 6px;
  padding: 14px 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.result-stat--time {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.result-stat strong {
  font-family: "Orbitron", "Segoe UI", sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.result-screen[data-outcome="clear"] .result-stats,
.result-screen[data-outcome="clear"] .result-actions {
  justify-content: center;
}

.primary-button,
.secondary-button {
  padding: 14px 20px;
  min-width: 170px;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #041018;
  box-shadow: 0 0 26px rgba(121, 229, 255, 0.28);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#musicPlayButton.is-selected,
#musicShuffleButton.is-selected,
#musicRepeatButton.is-selected {
  background: rgba(121, 229, 255, 0.24);
  border-color: rgba(121, 229, 255, 0.6);
  box-shadow: 0 0 18px rgba(121, 229, 255, 0.22);
}

body[data-stage="sky"] #musicPlayButton.is-selected,
body[data-stage="sky"] #musicShuffleButton.is-selected,
body[data-stage="sky"] #musicRepeatButton.is-selected {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(165, 219, 255, 0.8));
  border-color: rgba(18, 61, 122, 0.42);
  box-shadow:
    0 0 0 2px rgba(18, 61, 122, 0.12),
    0 18px 34px rgba(18, 61, 122, 0.22);
  color: #123d7a;
}

.utility-button:hover,
.link-button:hover,
.primary-button:hover,
.secondary-button:hover,
.utility-button:focus-visible,
.link-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.stage-option:hover,
.stage-option:focus-visible {
  transform: translateY(-2px);
}

.utility-button:disabled,
.link-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.utility-button.is-muted {
  opacity: 0.68;
}

.message-bar {
  min-height: 1.5em;
  align-self: end;
  font-size: 0.92rem;
}

body[data-screen="intro"] .score-hud,
body[data-screen="intro"] .life-hud,
body[data-screen="intro"] #titleButton,
body[data-screen="music"] .score-hud,
body[data-screen="music"] .life-hud,
body[data-screen="select"] .score-hud,
body[data-screen="select"] .life-hud,
body[data-screen="result"] .score-hud {
  display: none;
}

body[data-screen="result"] .life-hud {
  display: none;
}

body[data-screen="running"] .screen,
body[data-screen="running"] .message-bar {
  display: none;
}

body[data-screen="running"] .hud-bar {
  align-items: start;
}

body[data-screen="running"] .utility-bar {
  display: flex;
}

body[data-screen="running"] #soundButton {
  display: none;
}

body[data-screen="result"] #soundButton {
  display: none;
}

body[data-screen="result"] #resultTopHomeButton {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  z-index: 18;
  width: auto;
  min-width: 136px;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

body[data-screen="result"] #resultTopHomeButton {
  right: 16px;
}

body[data-screen="result"] #homeButton {
  display: none;
}

body[data-screen="running"] .score-hud {
  display: grid;
}

body[data-screen="running"] .life-hud {
  display: grid;
}

body[data-touch-orientation="landscape"] .ui-shell {
  padding: 16px;
  gap: 16px;
}

body[data-touch-orientation="landscape"] .title-credit {
  width: min(82vw, 320px);
  font-size: 0.66rem;
  line-height: 1.45;
  color: rgba(247, 251, 255, 0.34);
}

body[data-touch-orientation="landscape"] .play-credit {
  left: 12px;
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  font-size: 0.62rem;
  line-height: 1.3;
  color: rgba(247, 251, 255, 0.42);
}

body[data-touch-orientation="landscape"] .screen {
  width: 100%;
}

body[data-touch-orientation="landscape"] .stage-option-card {
  min-height: 156px;
  height: 156px;
}

body[data-touch-orientation="landscape"] .stage-option {
  grid-template-columns: 38px 1fr;
  min-height: 0;
  padding: 14px 14px;
  gap: 10px 12px;
}

body[data-touch-orientation="landscape"] .stage-option-main {
  padding-bottom: 58px;
}

body[data-touch-orientation="landscape"] .stage-list {
  grid-template-columns: 1fr;
  width: 100%;
  gap: 12px;
}

body[data-touch-orientation="landscape"] .select-screen {
  justify-items: stretch;
}

body[data-touch-orientation="landscape"] .music-shell,
body[data-touch-orientation="landscape"] .select-shell {
  width: 100%;
}

body[data-touch-orientation="landscape"] .music-screen {
  justify-items: stretch;
}

body[data-touch-orientation="landscape"] .city-track-panel {
  width: 100%;
  justify-self: stretch;
}

body[data-touch-orientation="landscape"] .music-track-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

body[data-touch-orientation="landscape"] .title-actions,
body[data-touch-orientation="landscape"] .music-actions {
  flex-direction: column;
  align-items: stretch;
}

body[data-touch-orientation="landscape"] .music-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(6, 12, 28, 0.22);
  backdrop-filter: blur(12px);
}

body[data-touch-orientation="landscape"] .title-mode-button,
body[data-touch-orientation="landscape"] .music-track-button,
body[data-touch-orientation="landscape"] .link-button,
body[data-touch-orientation="landscape"] .primary-button,
body[data-touch-orientation="landscape"] .secondary-button {
  width: 100%;
}

body[data-touch-orientation="landscape"] .music-actions .secondary-button {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 8px 10px;
  font-size: 0.86rem;
  line-height: 1;
}

body[data-touch-orientation="landscape"] .music-actions .music-option-button {
  font-size: 0.92rem;
}

body[data-touch-orientation="landscape"] .music-actions .music-option-button svg {
  width: 16px;
  height: 16px;
}

body[data-touch-orientation="landscape"] #musicPlayButton {
  grid-column: 2;
}

body[data-touch-orientation="landscape"] #musicPrevButton {
  grid-column: 1;
}

body[data-touch-orientation="landscape"] #musicNextButton {
  grid-column: 3;
}

body[data-touch-orientation="landscape"] #musicShuffleButton {
  grid-column: 3;
}

body[data-touch-orientation="landscape"] #musicRepeatButton {
  grid-column: 1;
}

body[data-touch-orientation="landscape"] #musicStopButton {
  grid-column: 2;
}

body[data-touch-orientation="landscape"] .result-actions {
  flex-direction: column;
  align-items: start;
}

body[data-touch-orientation="landscape"] .utility-bar {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
}

body[data-touch-orientation="landscape"][data-screen="select"] #soundButton,
body[data-touch-orientation="landscape"][data-screen="select"] #titleButton,
body[data-touch-orientation="landscape"][data-screen="music"] #soundButton,
body[data-touch-orientation="landscape"][data-screen="music"] #musicBackButton,
body[data-touch-orientation="landscape"][data-screen="result"] #resultTopHomeButton {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  z-index: 18;
  width: auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
}

body[data-touch-orientation="landscape"][data-screen="result"] #resultTopHomeButton {
  width: auto;
  min-width: 124px;
  text-align: center;
  white-space: nowrap;
}

body[data-touch-orientation="landscape"][data-screen="select"] #titleButton {
  right: 16px;
}

body[data-touch-orientation="landscape"][data-screen="music"] #musicBackButton {
  right: 16px;
}

body[data-touch-orientation="landscape"][data-screen="result"] #resultTopHomeButton {
  right: 16px;
}

body[data-touch-orientation="landscape"][data-screen="select"] #soundButton {
  right: 128px;
}

body[data-touch-orientation="landscape"][data-screen="music"] #soundButton {
  right: 128px;
}

body[data-touch-orientation="landscape"] .life-token {
  width: 68px;
  height: 68px;
}

body[data-touch-orientation="landscape"] .top-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-touch-orientation="landscape"] .stage-order {
  font-size: 0.72rem;
}

body[data-touch-orientation="landscape"] .stage-title {
  font-size: 1.24rem;
}

body[data-touch-orientation="landscape"] .stage-subname,
body[data-touch-orientation="landscape"] .stage-kicker,
body[data-touch-orientation="landscape"] .stage-meta em,
body[data-touch-orientation="landscape"] .stage-best {
  font-size: 0.64rem;
}

body[data-touch-orientation="landscape"] .music-track-button {
  min-height: 92px;
  padding: 10px 12px;
}

body[data-touch-orientation="landscape"] .music-track-meta {
  gap: 6px;
}

body[data-touch-orientation="landscape"] .music-track-meta strong {
  font-size: 1.05rem;
}

body[data-touch-orientation="landscape"] .music-track-meta em {
  font-size: 0.78rem;
}

body[data-touch-orientation="landscape"] .music-track-order {
  font-size: 0.7rem;
}

body[data-touch-orientation="landscape"] .stage-option-card .city-track-panel--inline {
  left: 14px;
  right: 14px;
  bottom: 12px;
  gap: 8px;
}

body[data-touch-orientation="landscape"] .stage-option-card .city-track-options {
  gap: 4px;
}

body[data-touch-orientation="landscape"] .stage-option-card .track-option {
  padding: 6px 6px;
  font-size: 0.72rem;
}

@media (max-width: 720px) {
  .result-card {
    width: 100%;
    padding: 22px 18px;
  }

  .result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ui-shell {
    padding: 16px;
    gap: 16px;
  }

  .title-credit {
    width: min(82vw, 320px);
    font-size: 0.66rem;
    line-height: 1.45;
    color: rgba(247, 251, 255, 0.34);
  }

  .play-credit {
    left: 12px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    font-size: 0.62rem;
    line-height: 1.3;
    color: rgba(247, 251, 255, 0.42);
  }

  .screen {
    width: 100%;
  }

  .stage-option {
    grid-template-columns: 44px 1fr;
    min-height: 0;
    padding: 18px 16px;
  }

  .stage-list {
    grid-template-columns: 1fr;
  }

  .select-screen {
    justify-items: stretch;
  }

  .music-shell,
  .select-shell {
    width: 100%;
  }

  .music-screen {
    justify-items: stretch;
  }

  .stage-list {
    width: 100%;
  }

  .city-track-panel {
    width: 100%;
    justify-self: stretch;
  }

  .music-track-grid {
    grid-template-columns: 1fr;
  }

  .title-actions,
  .music-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .music-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(6, 12, 28, 0.22);
    backdrop-filter: blur(12px);
  }

  .title-mode-button,
  .music-track-button,
  .link-button {
    width: 100%;
  }


  .result-actions {
    flex-direction: column;
    align-items: start;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .music-actions .secondary-button {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 8px 10px;
    font-size: 0.86rem;
    line-height: 1;
  }

  .music-actions .music-option-button {
    font-size: 0.92rem;
  }

  .music-actions .music-option-button svg {
    width: 16px;
    height: 16px;
  }

  #musicPrevButton {
    grid-column: 1;
  }

  #musicPlayButton {
    grid-column: 2;
  }

  #musicNextButton {
    grid-column: 3;
  }

  #musicShuffleButton {
    grid-column: 3;
  }

  #musicRepeatButton {
    grid-column: 1;
  }

  #musicStopButton {
    grid-column: 2;
  }

  .utility-bar {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  body[data-screen="select"] #soundButton,
  body[data-screen="select"] #titleButton,
  body[data-screen="music"] #soundButton,
  body[data-screen="music"] #musicBackButton,
  body[data-screen="result"] #soundButton,
  body[data-screen="result"] #homeButton {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    z-index: 18;
    width: auto;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.74rem;
    line-height: 1;
    white-space: nowrap;
  }

  body[data-screen="select"] #titleButton {
    right: 16px;
  }

  body[data-screen="music"] #musicBackButton {
    right: 16px;
  }

  body[data-screen="result"] #resultTopHomeButton {
    right: 16px;
  }

  body[data-screen="select"] #soundButton {
    right: 128px;
  }

  body[data-screen="music"] #soundButton {
    right: 128px;
  }

  .life-token {
    width: 68px;
    height: 68px;
  }

  .top-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 720px) {
  .stage-option-card {
    min-height: 156px;
    height: 156px;
  }

  .stage-option {
    grid-template-columns: 38px 1fr;
    padding: 14px 14px;
    gap: 10px 12px;
  }

  .stage-option-main {
    padding-bottom: 58px;
  }

  .stage-list {
    gap: 12px;
  }

  .stage-order {
    font-size: 0.72rem;
  }

  .stage-title {
    font-size: 1.24rem;
  }

  .stage-subname,
  .stage-kicker,
  .stage-meta em,
  .stage-best {
    font-size: 0.64rem;
  }

  .music-track-grid {
    gap: 12px;
  }

  .music-track-button {
    min-height: 92px;
    padding: 10px 12px;
  }

  .music-track-meta {
    gap: 6px;
  }

  .music-track-meta strong {
    font-size: 1.05rem;
  }

  .music-track-meta em {
    font-size: 0.78rem;
  }

  .music-track-order {
    font-size: 0.7rem;
  }

  .stage-option-card .city-track-panel--inline {
    left: 14px;
    right: 14px;
    bottom: 12px;
    gap: 8px;
  }

  .stage-option-card .city-track-options {
    gap: 4px;
  }

  .stage-option-card .track-option {
    padding: 6px 6px;
    font-size: 0.72rem;
  }

  .music-track-button {
    min-height: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .music-track-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
  }

  .music-track-meta strong,
  .music-track-meta em {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .music-track-meta strong {
    flex: 0 1 auto;
    font-size: 0.92rem;
  }

  .music-track-meta em {
    flex: 1 1 auto;
    font-size: 0.72rem;
  }

  .music-track-status {
    justify-self: end;
    white-space: nowrap;
    font-size: 0.62rem;
  }
}
