:root {
  --ink: #0a0e12;
  --ink-mid: #121820;
  --steel: #7a93a8;
  --mist: #c8d4de;
  --signal: #c45c26;
  --signal-glow: rgba(196, 92, 38, 0.35);
  --danger: #c23b3b;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--mist);
  background: var(--ink);
  overflow: hidden;
  min-height: 100%;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% 35%, #1a2430 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 80%, #152028 0%, transparent 45%),
    linear-gradient(165deg, #0c1016 0%, #0a0e12 45%, #080b0f 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.07;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 75% 70% at 50% 45%,
    transparent 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.4) 2px,
    rgba(0, 0, 0, 0.4) 4px
  );
}

.screen {
  position: relative;
  z-index: 3;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.menu-btn {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e8eef2;
  cursor: pointer;
  padding: 0.85rem 2.5rem;
  min-width: 14rem;
  position: relative;
  z-index: 1;
  transition: color 0.2s ease, letter-spacing 0.25s ease;
}

.menu-btn::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.45rem;
  width: 0;
  height: 2px;
  background: var(--signal);
  box-shadow: 0 0 12px var(--signal-glow);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.menu-btn:hover,
.menu-btn:focus-visible {
  color: #fff;
  letter-spacing: 0.28em;
  outline: none;
}

.menu-btn:hover::before,
.menu-btn:focus-visible::before {
  width: 3.5rem;
}

.game-screen {
  padding: 1rem;
  animation: fade-in 0.45s ease-out both;
}

.game-frame {
  position: relative;
  width: min(1280px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hud {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0 0.15rem;
}

.hud-mission,
.hud-status {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hud-meter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 10rem;
  flex: 0.8;
}

.meter {
  height: 6px;
  background: rgba(122, 147, 168, 0.2);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: #c45c26;
  box-shadow: 0 0 10px rgba(196, 92, 38, 0.45);
  transition: width 0.1s linear;
}

.meter-fill.hot {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(194, 59, 59, 0.55);
}

#hud-health {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--mist);
}

.hud-label {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--steel);
}

#hud-objective {
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--mist);
}

.alarm-clear {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: #6a9e78;
}

.alarm-triggered {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--danger);
  animation: pulse-alarm 0.55s ease-in-out infinite alternate;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #070a0e;
  cursor: crosshair;
  border: 1px solid rgba(122, 147, 168, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 11, 0.78);
  backdrop-filter: blur(3px);
  animation: fade-in 0.35s ease-out both;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  text-align: center;
  max-width: 28rem;
  padding: 2rem 1.5rem;
}

.overlay-tag {
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 0.6rem;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8eef2;
  line-height: 0.95;
  margin-bottom: 0.75rem;
}

.overlay-msg {
  font-size: 0.95rem;
  color: var(--steel);
  letter-spacing: 0.04em;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.overlay-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(150, 170, 190, 0.18);
}

.overlay-stats span {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--steel);
}

.overlay-stats b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.05em;
  color: #f0d9b8;
  line-height: 1;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.04) translate(-1%, 1%);
  }
}

@keyframes pulse-alarm {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .menu-btn {
    min-width: 12rem;
    padding: 0.75rem 1.5rem;
  }

  .game-screen {
    padding: 0.5rem;
  }
}
