* {
  box-sizing: border-box;
}

:root {
  --bg: #020806;
  --panel: #06110c;
  --panel-2: #0a1b12;
  --line: rgba(122, 255, 175, 0.17);
  --glow: #7affaf;
  --soft: #b7ffd0;
  --text: #e6ffef;
  --muted: #85a791;
  --danger: #ffcf6e;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(57, 147, 92, 0.12), transparent 38rem),
    var(--bg);
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  overflow: hidden;
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  background: rgba(4, 18, 11, 0.84);
  box-shadow: inset 0 0 30px rgba(72, 255, 139, 0.04);
  padding: 14px 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(20px, 2vw, 30px);
  letter-spacing: 0.16em;
  color: var(--glow);
  text-shadow: 0 0 16px rgba(122, 255, 175, 0.4);
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.stats {
  display: flex;
  gap: 10px;
}

.stats div {
  min-width: 86px;
  border: 1px solid var(--line);
  background: #05130c;
  padding: 8px 12px;
  text-align: right;
}

.stats span,
.status-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.stats strong {
  display: block;
  margin-top: 3px;
  font-size: 24px;
  color: var(--soft);
}

.game-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
}

.radar-panel,
.side-panel {
  border: 1px solid var(--line);
  background: rgba(3, 14, 9, 0.9);
  box-shadow:
    inset 0 0 50px rgba(72, 255, 139, 0.035),
    0 0 24px rgba(0, 0, 0, 0.45);
}

.radar-panel {
  min-height: 0;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

#radar {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hud-message {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(122, 255, 175, 0.25);
  background: rgba(0, 12, 6, 0.72);
  color: var(--soft);
  padding: 8px 14px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
}

.side-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mission-card,
.legend,
.status-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 14px;
}

.mission-card h2 {
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--glow);
  margin-bottom: 10px;
}

.mission-card p,
.legend {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.legend {
  display: grid;
  gap: 10px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
}

.target-dot {
  background: #edfff3;
  box-shadow: 0 0 10px var(--glow);
}

.sweep-dot {
  background: var(--glow);
}

.controls {
  display: grid;
  gap: 10px;
}

button {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(122, 255, 175, 0.35);
  background: #07170f;
  color: var(--soft);
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

button:hover {
  background: #0b2416;
  box-shadow: 0 0 18px rgba(122, 255, 175, 0.1);
}

button:active {
  transform: translateY(1px);
}

.primary {
  color: #03210f;
  background: var(--glow);
  border-color: var(--glow);
  font-weight: 800;
}

.primary:hover {
  background: #a1ffc2;
}

.secondary {
  color: var(--soft);
}

.status-card strong {
  display: block;
  margin-top: 7px;
  color: var(--glow);
  font-size: 19px;
  letter-spacing: 0.12em;
}

.escape-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 7, 4, 0.82);
  display: grid;
  place-items: center;
  padding: 20px;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  width: min(420px, 100%);
  border: 1px solid rgba(122, 255, 175, 0.4);
  background: #06110c;
  box-shadow: 0 0 60px rgba(122, 255, 175, 0.12);
  padding: 26px;
  text-align: center;
}

.overlay-card h2 {
  color: var(--glow);
  letter-spacing: 0.12em;
}

.overlay-card p {
  color: var(--muted);
  margin: 14px 0 20px;
  line-height: 1.55;
}

@media (max-width: 820px) {
  html,
  body {
    overflow: auto;
  }

  .app {
    min-height: 100svh;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    width: 100%;
  }

  .stats div {
    flex: 1;
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(58vh, 1fr) auto;
  }

  .side-panel {
    min-height: 260px;
  }
}
