:root {
  --space-black: #03050c;
  --space-navy: #081326;
  --cyan: #61e8ff;
  --violet: #a986ff;
  --white: #f4fbff;
  --warning-orange: #ff9d55;
  --muted: #95a9bf;
  --glass: rgba(8, 18, 36, 0.64);
  --border: rgba(173, 224, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 15%, #14244a 0, transparent 42%),
    var(--space-black);
  color: var(--white);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.game-frame {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
  background: var(--space-black);
  cursor: crosshair;
  user-select: none;
}

.game-frame::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, rgba(1, 4, 12, 0.12), transparent 24%, transparent 72%, rgba(1, 3, 9, 0.46)),
    radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.4) 100%);
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  inset: 24px 28px auto;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  pointer-events: none;
}

.hud[hidden] {
  display: none;
}

.glass-chip,
.glass-panel {
  border: 1px solid var(--border);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.score-block {
  display: grid;
  width: 152px;
  padding: 11px 14px 10px;
  border-radius: 6px;
}

.hud-label,
.best-score,
.eyebrow,
.controls span,
.final-score span,
.result-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.score-block > strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px rgba(97, 232, 255, 0.35);
}

.best-score {
  margin-top: 3px;
  letter-spacing: 0.08em;
}

.best-score b {
  color: #c4d5e5;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 600;
}

.combo {
  align-self: start;
  margin-top: 8px;
  color: #afc0d4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0;
  text-transform: uppercase;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.combo strong {
  margin-left: 5px;
  color: var(--cyan);
  font-size: 17px;
}

.combo.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.objective {
  position: absolute;
  top: 92px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(210, 237, 247, 0.72);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
  transform: translate(-50%, -5px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.objective i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px var(--cyan);
}

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

.hud-actions {
  display: flex;
  justify-self: end;
  gap: 8px;
  pointer-events: auto;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(7, 17, 34, 0.64);
  color: #d9f7ff;
  cursor: pointer;
  font-size: 15px;
  transition: border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  border-color: rgba(97, 232, 255, 0.55);
  background: rgba(17, 42, 66, 0.78);
}

.sound-on {
  display: none;
}

.audio-enabled .sound-on {
  display: inline;
}

.audio-enabled .sound-off {
  display: none;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  padding: 32px;
  place-content: center;
  place-items: center;
  text-align: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, visibility 300ms;
}

.screen.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.menu-screen {
  background: radial-gradient(circle at 50% 52%, rgba(36, 102, 145, 0.11), transparent 36%);
}

.menu-screen .eyebrow {
  margin-bottom: 16px;
  color: #9eb9cd;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(52px, 8vw, 108px);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 0.84;
  text-transform: uppercase;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

h1 span {
  display: block;
  color: transparent;
  font-weight: 300;
  -webkit-text-stroke: 1px rgba(173, 238, 255, 0.78);
  text-shadow: 0 0 32px rgba(97, 232, 255, 0.16);
}

.tagline {
  margin-top: 23px;
  color: #b9cad9;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 400;
  line-height: 1.45;
}

.controls {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 38px 0 26px;
}

.controls div {
  display: grid;
  min-width: 100px;
  gap: 4px;
}

.controls strong {
  font-size: 14px;
  font-weight: 600;
}

.controls i {
  width: 1px;
  height: 30px;
  background: rgba(176, 218, 239, 0.23);
}

.primary-button {
  min-width: 210px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid rgba(156, 241, 255, 0.72);
  border-radius: 5px;
  background: linear-gradient(110deg, rgba(22, 143, 181, 0.9), rgba(84, 100, 208, 0.88));
  box-shadow: 0 10px 42px rgba(30, 161, 202, 0.24), inset 0 1px rgba(255, 255, 255, 0.22);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: filter 150ms ease, transform 150ms ease;
}

.primary-button span {
  display: inline-block;
  margin-left: 14px;
  font-size: 18px;
  vertical-align: -1px;
}

.primary-button:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

.mission-note {
  margin-top: 18px;
  color: #73869b;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pause-screen,
.game-over-screen {
  z-index: 7;
  background: rgba(2, 5, 12, 0.56);
}

.result-panel {
  position: relative;
  width: min(450px, calc(100vw - 40px));
  padding: 36px 38px 30px;
  border-radius: 8px;
}

.game-over-screen .result-panel::before,
.game-over-screen .result-panel::after {
  position: absolute;
  top: 18px;
  width: 46px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(97, 232, 255, 0.55));
}

.game-over-screen .result-panel::before { left: 20px; }
.game-over-screen .result-panel::after { right: 20px; transform: scaleX(-1); }

.result-panel h2 {
  margin: 8px 0 28px;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.final-score {
  display: grid;
  gap: 3px;
  margin-bottom: 24px;
}

.final-score strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 44px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(97, 232, 255, 0.28);
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin-bottom: 16px;
  background: rgba(160, 214, 239, 0.13);
}

.result-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #0b1424;
  text-align: left;
}

.result-stats span b { margin-right: 7px; color: var(--cyan); font-size: 14px; }

.result-stats strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  margin: 0 2px 27px;
  color: #72879a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-meta b {
  margin-left: 6px;
  color: #d6e6ef;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.text-button {
  display: block;
  margin: 16px auto 0;
  padding: 6px 14px;
  border: 0;
  background: transparent;
  color: #92a6ba;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-button:hover {
  color: var(--white);
}

.orientation-note {
  position: absolute;
  z-index: 10;
  display: none;
}

@media (max-width: 680px) {
  .game-frame {
    min-height: 420px;
  }

  .hud {
    inset: 14px 14px auto;
  }

  .score-block {
    width: 124px;
    padding: 8px 10px;
  }

  .score-block > strong {
    font-size: 18px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .screen {
    padding: 20px;
  }

  .controls {
    margin: 28px 0 22px;
  }

  .mission-note {
    max-width: 260px;
    line-height: 1.7;
  }
}

@media (orientation: portrait) and (max-width: 540px) {
  .orientation-note {
    right: 12px;
    bottom: 10px;
    display: block;
    color: rgba(206, 229, 240, 0.5);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
