:root {
  color-scheme: dark;
  --bg-top: #10182f;
  --bg-bottom: #1d3557;
  --panel: rgba(8, 15, 30, 0.65);
  --text-main: #f4f8ff;
  --text-subtle: #b4c4de;
  --accent: #89d0ff;
  --accent-2: #98f5cf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 20% 10%, #29406d 0%, var(--bg-top) 45%, #080d19 100%);
  display: grid;
  place-items: center;
}

.app {
  width: min(95vw, 1300px);
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

.hud {
  background: var(--panel);
  border: 1px solid rgba(168, 198, 255, 0.18);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
}

.brand h1 {
  margin: 0;
  font-size: 1.3rem;
}

.brand p {
  margin: 0.2rem 0 0;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.stats {
  display: flex;
  gap: 1.2rem;
}

.stats div {
  display: grid;
  gap: 0.2rem;
  text-align: right;
}

.stats span {
  color: var(--text-subtle);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats strong {
  font-size: 1rem;
}

.stage {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(167, 203, 255, 0.2);
  box-shadow: 0 18px 45px rgba(0, 10, 30, 0.45);
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  background: linear-gradient(#6aa7c8, #a6d8e8 50%, #e5f7ff);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.4rem;
  background: linear-gradient(rgba(8, 17, 40, 0.6), rgba(5, 14, 24, 0.75));
  transition: opacity 200ms ease;
}

.overlay:not(.visible) {
  opacity: 0;
  pointer-events: none;
}

.overlay h2 {
  margin: 0;
  font-size: 1.8rem;
}

.overlay p {
  margin: 0;
  color: var(--text-subtle);
}

button {
  border: 1px solid rgba(173, 209, 255, 0.4);
  background: rgba(37, 68, 112, 0.65);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font: inherit;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: rgba(52, 91, 148, 0.8);
}

.controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

@media (max-width: 820px) {
  .hud {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .stats {
    width: 100%;
    justify-content: space-between;
  }

  .stats div {
    text-align: left;
  }
}