:root {
  --bg-deep: #030811;
  --bg-mid: #08101d;
  --bg-steel: #14304a;
  --ice: #8cecff;
  --ice-bright: #dfffff;
  --ember: #ff6d3a;
  --ember-hot: #ffd36b;
  --ember-deep: #ff3f2b;
  --text: #edf6ff;
  --muted: rgba(237, 246, 255, 0.72);
  --line: rgba(140, 236, 255, 0.18);
  --line-strong: rgba(140, 236, 255, 0.34);
  --panel: rgba(5, 12, 24, 0.54);
  --shadow: 0 25px 90px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: auto;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 109, 58, 0.15), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(140, 236, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #07101c 0%, #02050b 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  touch-action: auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(140, 236, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 236, 255, 0.06) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.1), black 38%, black);
  opacity: 0.18;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 45%, rgba(0, 0, 0, 0.44) 100%);
}

body.is-playing {
  cursor: none;
  overflow: hidden;
  touch-action: none;
}

.hidden {
  display: none;
}

#arena {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  padding: 1.25rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.25rem;
  pointer-events: none;
}

.topbar,
.footer-bar,
.intro,
.gameover {
  pointer-events: auto;
}

.topbar,
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand h1,
.intro h2,
.gameover h2,
.boss-copy h3,
.announcement h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand h1 {
  font-size: clamp(1.1rem, 3vw, 1.9rem);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.status-block {
  min-width: 5.6rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 16, 29, 0.72), rgba(8, 16, 29, 0.38));
  backdrop-filter: blur(16px);
}

.status-block .label,
.meter .label,
.gameover-stat span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-block strong,
.gameover-stat strong {
  font-size: 1.2rem;
  font-weight: 700;
}

.boss-hud {
  position: fixed;
  top: 6.5rem;
  right: 1.25rem;
  z-index: 4;
  width: min(29rem, calc(100vw - 2.5rem));
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 109, 58, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 109, 58, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(7, 14, 26, 0.82), rgba(4, 8, 16, 0.55));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.boss-copy {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.boss-copy h3 {
  font-size: clamp(1rem, 3vw, 1.6rem);
}

.boss-meter {
  margin-top: 0.8rem;
}

.boss-meter-track,
.meter-track {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.boss-meter-track {
  height: 0.9rem;
  border: 1px solid rgba(255, 109, 58, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 109, 58, 0.1), rgba(255, 109, 58, 0.04)),
    rgba(255, 255, 255, 0.06);
}

.boss-meter-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--ember-deep), var(--ember-hot));
  box-shadow: 0 0 34px rgba(255, 109, 58, 0.5);
  transform-origin: left center;
  transition: transform 90ms linear;
}

.announcement {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 5;
  width: min(36rem, calc(100vw - 2rem));
  padding: 1.2rem 1.4rem;
  text-align: center;
  border: 1px solid rgba(140, 236, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 109, 58, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(7, 14, 26, 0.72), rgba(4, 8, 16, 0.42));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.96);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.announcement.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.announcement h2 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 0.95;
}

.intro,
.gameover {
  position: relative;
  align-self: center;
  width: min(54rem, 100%);
  padding: clamp(1.05rem, 3vw, 2rem);
  background:
    linear-gradient(135deg, rgba(255, 109, 58, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(7, 14, 26, 0.82), rgba(4, 8, 16, 0.55));
  border: 1px solid rgba(140, 236, 255, 0.18);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.intro::before,
.gameover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(140, 236, 255, 0.08), transparent 35%),
    linear-gradient(90deg, transparent, rgba(255, 109, 58, 0.08), transparent);
  opacity: 0.85;
}

.intro > *,
.gameover > * {
  position: relative;
  z-index: 1;
}

.logo-stage {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.15rem;
}

.logo-mark {
  position: relative;
  width: clamp(7rem, 18vw, 10.5rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 109, 58, 0.12), transparent 48%),
    radial-gradient(circle at center, rgba(140, 236, 255, 0.16), transparent 68%);
  animation: float-logo 5.8s ease-in-out infinite;
}

.logo-ring,
.logo-line {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.logo-ring-a {
  border: 1px solid rgba(140, 236, 255, 0.34);
  transform: scale(1);
  animation: spin-ring 18s linear infinite;
}

.logo-ring-b {
  inset: 12%;
  border: 1px solid rgba(255, 109, 58, 0.3);
  animation: spin-ring-reverse 13s linear infinite;
}

.logo-line-a,
.logo-line-b {
  border: 0;
}

.logo-line-a::before,
.logo-line-a::after,
.logo-line-b::before,
.logo-line-b::after {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(140, 236, 255, 0.5), transparent);
}

.logo-line-a::before,
.logo-line-a::after {
  left: 14%;
  right: 14%;
  height: 1px;
}

.logo-line-a::before {
  top: 26%;
}

.logo-line-a::after {
  bottom: 26%;
}

.logo-line-b::before,
.logo-line-b::after {
  top: 14%;
  bottom: 14%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255, 109, 58, 0.46), transparent);
}

.logo-line-b::before {
  left: 26%;
}

.logo-line-b::after {
  right: 26%;
}

.logo-core {
  width: 56%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  gap: 0.2rem;
  border-radius: 50%;
  border: 1px solid rgba(140, 236, 255, 0.34);
  background:
    radial-gradient(circle at center, rgba(140, 236, 255, 0.18), rgba(7, 14, 26, 0.78));
  box-shadow:
    0 0 36px rgba(140, 236, 255, 0.18),
    inset 0 0 24px rgba(255, 109, 58, 0.12);
}

.logo-core span,
.logo-core strong {
  display: block;
  font-family: "Orbitron", sans-serif;
  text-transform: uppercase;
}

.logo-core span {
  color: var(--muted);
  font-size: clamp(0.76rem, 2vw, 1rem);
  letter-spacing: 0.34em;
}

.logo-core strong {
  font-size: clamp(1.5rem, 4.4vw, 2.6rem);
  letter-spacing: 0.12em;
}

.logo-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.intro h2,
.gameover h2 {
  font-size: clamp(1.7rem, 4vw, 3.15rem);
  line-height: 0.95;
  max-width: 18ch;
}

.intro-copy,
.gameover-copy,
.footer-copy {
  max-width: 39rem;
  color: var(--muted);
  line-height: 1.55;
}

.loadout {
  margin-top: 1rem;
}

.loadout-label {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.loadout-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.loadout-option {
  appearance: none;
  padding: 0.8rem 0.85rem;
  border: 1px solid rgba(140, 236, 255, 0.16);
  background: rgba(8, 16, 29, 0.48);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.loadout-option:hover,
.loadout-option.is-selected {
  transform: translateY(-2px);
  border-color: rgba(140, 236, 255, 0.4);
  background: rgba(11, 24, 40, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.loadout-option strong,
.loadout-option small {
  display: block;
}

.loadout-option strong {
  margin-top: 0.55rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loadout-option small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.loadout-swatch {
  display: block;
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  box-shadow: 0 0 18px currentColor;
}

.swatch-blue {
  color: #8cecff;
  background: linear-gradient(90deg, #8cecff, #dfffff);
}

.swatch-green {
  color: #7effb0;
  background: linear-gradient(90deg, #7effb0, #ecfff2);
}

.swatch-red {
  color: #ff5e4a;
  background: linear-gradient(90deg, #ff5e4a, #ffe2d2);
}

.swatch-amber {
  color: #ffba48;
  background: linear-gradient(90deg, #ffba48, #fff0bf);
}

.instruction-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

.instruction-strip span {
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(255, 211, 107, 0.2);
  background: rgba(255, 211, 107, 0.08);
  color: var(--text);
  font-size: 0.92rem;
}

.intro-stats,
.gameover-stats {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.15rem;
}

.intro-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.85rem 0;
  border-top: 1px solid rgba(140, 236, 255, 0.14);
  border-bottom: 1px solid rgba(140, 236, 255, 0.14);
}

.intro-stat,
.gameover-stat {
  min-width: 0;
}

.intro-stat strong {
  display: block;
  margin-bottom: 0.35rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-stat span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

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

.gameover-stat {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  background: rgba(8, 16, 29, 0.4);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.start-button,
.sound-button {
  appearance: none;
  border: 0;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.start-button {
  background: linear-gradient(135deg, var(--ember), var(--ember-hot));
  color: #160902;
  box-shadow: 0 16px 42px rgba(255, 109, 58, 0.36);
}

.sound-button {
  background: rgba(8, 16, 29, 0.72);
  color: var(--text);
  border: 1px solid var(--line);
}

.start-button:hover,
.sound-button:hover {
  transform: translateY(-2px);
}

.audio-diagnostic {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.audio-diagnostic[data-state="error"] {
  color: #ffd0c2;
}

.audio-diagnostic[data-state="ok"] {
  color: #c9fff2;
}

.footer-bar {
  align-items: flex-end;
  justify-content: flex-start;
}

.meter {
  width: min(18rem, 100%);
}

.meter-track {
  height: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(140, 236, 255, 0.14);
}

.meter-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--ice), var(--ice-bright));
  box-shadow: 0 0 24px rgba(140, 236, 255, 0.7);
  transform-origin: left center;
  transition: transform 90ms linear;
}

@keyframes float-logo {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin-ring {
  from {
    transform: scale(1) rotate(0deg);
  }

  to {
    transform: scale(1) rotate(360deg);
  }
}

@keyframes spin-ring-reverse {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

@media (max-width: 980px) {
  .intro-stats {
    grid-template-columns: 1fr;
  }

  .loadout-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logo-stage {
    align-items: flex-start;
    flex-direction: column;
  }

  .boss-hud {
    top: auto;
    right: 1rem;
    bottom: 6.6rem;
    left: 1rem;
    width: auto;
  }
}

@media (max-width: 840px) {
  .shell {
    padding: 1rem;
    gap: 1rem;
  }

  .topbar,
  .footer-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-cluster {
    justify-content: flex-start;
  }

  .status-block {
    min-width: 4.9rem;
  }

  .announcement {
    width: calc(100vw - 2rem);
  }
}

@media (max-width: 640px) {
  .brand h1 {
    font-size: 1rem;
  }

  .intro,
  .gameover {
    width: 100%;
  }

  .intro h2,
  .gameover h2 {
    font-size: clamp(1.85rem, 12vw, 3rem);
  }

  .status-cluster {
    gap: 0.55rem;
  }

  .status-block {
    padding: 0.6rem 0.7rem;
  }

  .instruction-strip span {
    width: 100%;
  }

  .loadout-options {
    grid-template-columns: 1fr;
  }

  .gameover-stats {
    grid-template-columns: 1fr;
  }

  .footer-copy {
    font-size: 0.92rem;
  }

  .announcement {
    padding: 1rem;
  }

  .announcement h2 {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
  }

  .boss-copy {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-height: 760px) {
  .intro-stats {
    display: none;
  }
}
