:root {
  --bg: #080b22;
  --panel: #121630;
  --accent: #6fffe9;
  --accent-text: #041b22;
  --muted: #b8c2dc;
  --page-glow: rgba(92, 225, 230, 0.18);
}

body {
  background:
    radial-gradient(circle at 14% 8%, rgba(111, 255, 233, 0.16), transparent 24rem),
    radial-gradient(circle at 86% 14%, rgba(255, 155, 86, 0.13), transparent 22rem),
    linear-gradient(180deg, #080b22, #03040d);
}

.stage,
.side-panel,
.camera-card,
.control-card {
  background: rgba(12, 16, 39, 0.92);
  border-color: rgba(154, 205, 255, 0.17);
}

.stage {
  aspect-ratio: 20 / 13;
  min-height: 0;
  box-shadow:
    0 0 0 1px rgba(111, 255, 233, 0.03),
    0 28px 80px rgba(0, 0, 0, 0.28);
}

#game-canvas {
  min-height: 0;
  background: #07091c;
  touch-action: none;
}

.flight-hud {
  display: grid;
  grid-template-columns: auto minmax(112px, 1.2fr) repeat(3, auto);
  gap: 0.55rem;
  align-items: stretch;
  padding: 0.8rem;
  color: #fff;
  font-size: clamp(0.68rem, 1.25vw, 0.88rem);
  font-weight: 900;
  letter-spacing: 0.035em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hud-cell {
  display: grid;
  align-content: center;
  min-height: 3.1rem;
  border: 1px solid rgba(197, 228, 255, 0.18);
  border-radius: 8px;
  background: rgba(4, 8, 27, 0.7);
  padding: 0.45rem 0.65rem;
}

.hud-label {
  display: block;
  color: #96a5c6;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud-value {
  display: block;
  margin-top: 0.12rem;
  white-space: nowrap;
}

.fuel-track {
  width: 100%;
  height: 0.42rem;
  margin-top: 0.34rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.fuel-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9b56, #ffe379 52%, #6fffe9);
  transition: width 100ms linear;
}

.hud-value[data-tone="safe"] {
  color: #77ffd3;
}

.hud-value[data-tone="warn"] {
  color: #ffe379;
}

.hud-value[data-tone="danger"] {
  color: #ff718b;
}

.flight-mode {
  position: absolute;
  right: 0.9rem;
  bottom: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(4, 8, 27, 0.72);
  color: #abb8d8;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.38rem 0.62rem;
  text-transform: uppercase;
}

.overlay-card {
  width: min(470px, calc(100% - 1.5rem));
  border-color: rgba(111, 255, 233, 0.27);
  background: rgba(6, 9, 27, 0.93);
  backdrop-filter: blur(10px);
}

.overlay-card h1,
.overlay-card h2 {
  color: #f9fbff;
  letter-spacing: 0.04em;
}

.overlay-card .eyebrow {
  margin-bottom: 0.45rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mission-brief {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.mission-brief span {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: #c7d1ea;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.62rem 0.35rem;
}

.mission-brief strong {
  display: block;
  margin-top: 0.2rem;
  color: #77ffd3;
  font-size: 0.9rem;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.overlay-button.secondary {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #ecf3ff;
}

.overlay-button:focus-visible,
.home-link:focus-visible {
  outline: 3px solid rgba(111, 255, 233, 0.55);
  outline-offset: 3px;
}

.result-score {
  color: #fff !important;
  font-size: 1.08rem;
  font-weight: 900;
}

.result-detail {
  font-size: 0.88rem;
}

.control-note {
  margin-bottom: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.85rem;
  font-size: 0.82rem;
}

@media (max-width: 980px) {
  .stage {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .flight-hud {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    padding: 0.45rem;
  }

  .hud-cell {
    min-height: 2.65rem;
    padding: 0.35rem 0.4rem;
  }

  .hud-cell--fuel {
    grid-column: span 2;
    grid-row: 2;
  }

  .hud-cell--score {
    grid-column: span 2;
    grid-row: 2;
  }

  .hud-label {
    font-size: 0.56rem;
  }

  .flight-mode {
    display: none;
  }

  .mission-brief {
    gap: 0.3rem;
  }

  .mission-brief span {
    font-size: 0.63rem;
    padding-inline: 0.2rem;
  }
}

@media (max-width: 430px) {
  .stage {
    aspect-ratio: 4 / 3;
  }

  .overlay-card {
    padding: 1rem;
  }

  .overlay-card p {
    font-size: 0.86rem;
  }
}
