@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap");

:root {
  --bg-top: #06111f;
  --bg-bottom: #02050c;
  --panel-bg: rgba(4, 10, 22, 0.72);
  --panel-border: rgba(155, 220, 255, 0.22);
  --panel-highlight: rgba(255, 255, 255, 0.08);
  --accent: #00e5ff;
  --danger: #ff3b3b;
  --text: #eefaff;
  --muted: rgba(238, 250, 255, 0.74);
}

* {
  box-sizing: border-box;
  font-family: "Orbitron", sans-serif;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(0, 229, 255, 0.12), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: "Orbitron", sans-serif;
  transition: background 220ms ease, filter 220ms ease;
  position: relative;
}

body.time-slowed {
  background:
    radial-gradient(circle at top, rgba(0, 229, 255, 0.08), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.03), transparent 18%),
    linear-gradient(180deg, #020811, #000205);
  filter: brightness(0.74);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 229, 255, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(0, 20, 46, 0.08), rgba(0, 0, 0, 0.14));
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 2;
}

body.time-slowed::before {
  opacity: 1;
}

body.game-paused::before,
body.game-over::before {
  opacity: 1;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 52%),
    rgba(2, 8, 17, 0.42);
}

#gameCanvas {
  display: block;
  transform-origin: center center;
  transition: transform 220ms ease, filter 220ms ease;
  position: relative;
  z-index: 1;
}

body.time-slowed #gameCanvas {
  transform: scale(1.045);
  filter: saturate(0.9);
}

body.game-paused #gameCanvas,
body.game-over #gameCanvas {
  filter: blur(4px) saturate(0.8);
  transform: scale(1.02);
}

#hud {
  position: absolute;
  z-index: 10;
  top: 18px;
  left: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.hud-chip {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(6, 17, 31, 0.5);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-energy {
  min-width: 220px;
  padding: 10px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(6, 17, 31, 0.54);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.hud-energy.pulse {
  animation: energyPulse 280ms ease;
}

.hud-energy-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.energy-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.energy-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #a5f3fc);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.6);
  transform-origin: left center;
  transition: transform 80ms linear, background 160ms ease;
}

.energy-fill.low {
  background: linear-gradient(90deg, #fb7185, #fda4af);
  box-shadow: 0 0 16px rgba(251, 113, 133, 0.55);
}

.death-flash {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.22), transparent 36%),
    rgba(255, 64, 64, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 15;
}

.death-flash.active {
  opacity: 1;
}

#ui {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.panel {
  min-width: min(92vw, 420px);
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    var(--panel-bg);
  backdrop-filter: blur(18px);
  box-shadow:
    inset 0 1px 0 var(--panel-highlight),
    0 25px 80px rgba(0, 0, 0, 0.35);
}

.screen-panel {
  width: min(92vw, 430px);
  pointer-events: auto;
  transition: transform 200ms ease, opacity 200ms ease;
}

#mainMenu {
  width: min(94vw, 920px);
}

.screen-panel h1,
.screen-panel h2,
.screen-panel p {
  margin: 0;
}

.screen-panel h1 {
  margin-top: 6px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-title {
  white-space: nowrap;
  line-height: 1;
}

.screen-panel h2 {
  margin-top: 6px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow.danger {
  color: #ff9f9f;
}

.panel-copy {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.keycap,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.volume-group {
  display: block;
  margin-top: 18px;
  color: var(--muted);
}

.volume-group span {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

button {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

button:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.hidden {
  display: none;
}

@keyframes energyPulse {
  0% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); }
  50% { box-shadow: 0 12px 40px rgba(34, 211, 238, 0.4), 0 0 0 1px rgba(34, 211, 238, 0.25); }
  100% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); }
}

@media (max-width: 640px) {
  #hud {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .hud-chip {
    font-size: 11px;
  }

  .hud-energy {
    min-width: 100%;
  }

  .panel {
    padding: 22px;
    border-radius: 22px;
  }

  .panel-row {
    align-items: stretch;
    flex-direction: column;
  }

  .keycap,
  .pill,
  button {
    width: 100%;
  }
}
