:root {
  --bg: #05060c;
  --panel: rgba(8, 9, 18, 0.82);
  --line: #2b2f4a;
  --ink: #e8e6f2;
  --muted: #9a98b8;
  --red: #ff3434;
  --amber: #f2d27a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "VT323", "Courier New", monospace;
  font-size: 20px;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  image-rendering: pixelated;
}

#game.dragging { cursor: grabbing; }

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 16px;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.hud.top {
  top: 0;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(5, 6, 12, 0.9), rgba(5, 6, 12, 0));
}

.hud.bottom {
  bottom: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(5, 6, 12, 0.9), rgba(5, 6, 12, 0));
}

h1 {
  margin: 0;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: clamp(11px, 2.2vw, 16px);
  font-weight: 400;
  color: var(--ink);
  text-shadow: 2px 2px 0 #3a0a0a, 0 0 12px rgba(255, 52, 52, 0.45);
}

.stats {
  display: flex;
  gap: 18px;
  font-size: 22px;
  color: var(--muted);
}

.stats b {
  color: var(--amber);
  font-weight: 400;
}

.left, .zoom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button {
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 10px;
  line-height: 1;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

button:hover { border-color: #4a4f78; }

button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.zoom button {
  min-width: 40px;
  font-family: "VT323", "Courier New", monospace;
  font-size: 26px;
  padding: 4px 10px 6px;
}

.zoom #zoomFit { font-size: 22px; }

.home {
  font-size: 20px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 6px;
}

.home:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 3, 8, 0.55);
}

.card {
  width: min(460px, 100%);
  padding: 24px 22px;
  background: #0a0b16;
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 #000, 0 0 40px rgba(255, 52, 52, 0.12);
  text-align: center;
}

.card h2 {
  margin: 0 0 14px;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: clamp(12px, 3.4vw, 16px);
  font-weight: 400;
  line-height: 1.5;
  color: var(--red);
  text-shadow: 0 0 10px rgba(255, 52, 52, 0.5);
}

.card p { margin: 0 0 12px; font-size: 22px; }

.preview {
  display: block;
  width: 88px;
  height: 96px;
  margin: 4px auto 16px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(255, 52, 52, 0.35));
}

.card ul {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 20px;
  color: var(--muted);
}

.card li { margin: 4px 0; }

.card li b { color: var(--ink); font-weight: 400; }

.card .small { font-size: 18px; color: var(--muted); }

button.primary {
  margin-top: 6px;
  font-size: 12px;
  padding: 14px 18px;
  color: #1a0505;
  background: var(--red);
  border-color: #ff8080;
}

button.primary:hover { background: #ff5a5a; }
