:root {
  --navy: #0b0618;
  --panel: rgba(12, 8, 28, 0.92);
  --ink: #f4efe8;
  --gold: #ffb020;
  --gold-hot: #ffd56a;
  --orange: #ff9a2e;
  --cyan: #3ad7ea;
  --teal: #2dd4c8;
  --mag: #c084fc;
  --purple: #7c3aed;
  --red: #ef5a72;
  --muted: #8a7aa8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0b0618;
  color: var(--ink);
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  user-select: none;
}
#stage, #c {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
#c { z-index: 0; }
#float-layer {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
}
.hidden { display: none !important; }

#hud {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
}
#hud button { pointer-events: auto; cursor: pointer; }

/* ---------- floating world labels ---------- */
.floater {
  position: absolute;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 10px;
  pointer-events: none;
  text-transform: uppercase;
}
.floater.cyan {
  background: #0b3a4a;
  border: 1px solid #3ad7ea;
  color: #d9fbff;
}
.floater.green {
  background: #163a22;
  border: 1px solid #6ee7a8;
  color: #d9ffe8;
}
.floater.gold {
  background: #2a1c08;
  border: 1px solid #ffb020;
  color: #ffe7a8;
}
.floater.red {
  background: #3a1020;
  border: 1px solid #ef5a72;
  color: #ffd0d8;
}
.floater.mag {
  background: #2a1040;
  border: 1px solid #c084fc;
  color: #f0d9ff;
}
.floater.dark {
  background: #16101f;
  border: 1px solid #6b7280;
  color: #e5e7eb;
}
.floater.tiny { font-size: 10px; padding: 2px 7px; }

/* ---------- top title ---------- */
#hud-title {
  position: absolute;
  top: 10px; left: 16px;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 10px;
  background: var(--panel);
  border: 2px solid #e8891a;
  border-radius: 18px;
  box-shadow: 0 0 0 1px #000, 0 8px 22px rgba(0,0,0,0.45);
}
#hud-title img { width: 28px; height: 28px; object-fit: contain; }
.title-word {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: #f5a524;
}
.title-word span { color: #ffc14d; }
.title-ver {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #7a6a90;
  margin-left: 4px;
  margin-top: 6px;
}

/* ---------- cycle banner ---------- */
#hud-cycle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 6px 22px 6px 10px;
  min-width: min(640px, 42vw);
  background: var(--panel);
  border: 2px solid #e8891a;
  border-radius: 22px;
  box-shadow: 0 0 0 1px #000, 0 8px 22px rgba(0,0,0,0.45);
}
#cycle-pie { width: 42px; height: 42px; object-fit: contain; }
.cycle-h {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
}
.cycle-h b { color: #ffc14d; }
.cycle-s {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f0b0c0;
}
.cycle-s .warn { color: #ef5a72; margin-right: 4px; }
.cycle-s .sep { color: #6b5a80; margin: 0 8px; }
.cycle-s b { color: #f0d0e0; }

/* ---------- resources ---------- */
#hud-res {
  position: absolute;
  top: 10px; right: 14px;
  display: flex; gap: 8px;
}
.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 5px 8px;
  background: var(--panel);
  border-radius: 14px;
  border: 2px solid #444;
  min-width: 108px;
}
.pill img { width: 28px; height: 28px; object-fit: contain; }
.pill .n {
  font-family: "Share Tech Mono", monospace;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.pill .s {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-top: 1px;
}
.pill.gold { border-color: #e8891a; }
.pill.gold .n, .pill.gold .s { color: #ffc14d; }
.pill.mag { border-color: #a855f7; }
.pill.mag .n, .pill.mag .s { color: #e9d5ff; }
.pill.cyan { border-color: #22d3ee; }
.pill.cyan .n, .pill.cyan .s { color: #a5f3fc; }
.pill.red {
  border-color: #ef5a72;
  flex-direction: column; align-items: flex-start; gap: 0;
  min-width: 128px; padding: 5px 12px;
}
.wave-lab { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: #fda4af; }
.wave-lab b { color: #fff; }
.pts {
  font-family: "Share Tech Mono", monospace;
  font-size: 15px; color: #fda4af;
}
.pts span { font-size: 10px; }

/* ---------- minimap ---------- */
#minimap-wrap {
  position: absolute;
  top: 78px; right: 22px;
  width: 118px; height: 118px;
  border-radius: 50%;
  border: 3px solid #e8c45a;
  box-shadow: 0 0 0 2px #1a0a10, 0 0 18px rgba(232,137,26,0.4), inset 0 0 18px rgba(124,58,237,0.35);
  background: #0c0614;
  overflow: hidden;
}
#minimap-bezel {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: screen;
}
#minimap {
  position: absolute; inset: 6%;
  width: 88%; height: 88%;
  border-radius: 50%;
}

/* ---------- tactical radar ---------- */
#radar-panel {
  position: absolute;
  left: 14px; bottom: 16px;
  width: 228px;
  padding: 12px 12px 8px;
  background: var(--panel);
  border: 2px solid #e8891a;
  border-radius: 16px;
  box-shadow: 0 0 0 1px #000, 0 10px 28px rgba(0,0,0,0.5);
}
.radar-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #ffc14d;
  margin-bottom: 4px;
}
#radar { display: block; width: 100%; height: 132px; }
.radar-foot {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #6b5a80;
  margin-top: 2px;
}

/* ---------- build bar ---------- */
#build-bar {
  position: absolute;
  left: 258px; right: 14px; bottom: 14px;
  display: flex; align-items: stretch; gap: 8px;
  padding: 10px 10px 10px 12px;
  background: var(--panel);
  border: 2px solid #e8891a;
  border-radius: 18px;
  box-shadow: 0 0 0 1px #000, 0 10px 28px rgba(0,0,0,0.5);
  pointer-events: auto;
}
.card {
  position: relative;
  flex: 0 0 108px;
  background: #120b20;
  border: 2px solid #3a2a55;
  border-radius: 12px;
  color: #e8e0f0;
  padding: 16px 8px 8px;
  display: flex; flex-direction: column; align-items: center;
  font-family: "Rajdhani", sans-serif;
}
.card img { width: 36px; height: 36px; object-fit: contain; margin: 2px 0 4px; }
.card .key {
  position: absolute; top: 6px; left: 8px;
  width: 16px; height: 16px;
  border-radius: 4px;
  background: #2a1c08;
  border: 1px solid #e8891a;
  color: #ffc14d;
  font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}
.card .nm { font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.card .cost {
  font-size: 11px; font-weight: 700; color: #c4b8d8; margin-top: 2px;
}
.card .cost.goldc { color: #ffc14d; display: flex; align-items: center; gap: 4px; }
.card .cost.goldc img { width: 12px; height: 12px; margin: 0; }
.card .star { color: #ffc14d; }
.card .g { color: #c084fc; }
.card.sel {
  border-color: #2dd4c8;
  background: #043346;
  box-shadow: 0 0 16px rgba(45,212,200,0.25);
}
.sel-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: #2dd4c8; color: #04222a;
  font-size: 9px; font-weight: 800; letter-spacing: 0.12em;
  padding: 2px 8px; border-radius: 8px;
}
.card.dim { opacity: 0.72; border-color: #2a2238; }
.card.dim .cd {
  color: #ef5a72;
  font-family: "Share Tech Mono", monospace;
  font-size: 16px; font-weight: 700;
  margin: 6px 0 2px;
}
.card.surge {
  background: #3b0764;
  border-color: #c084fc;
  flex: 0 0 118px;
}
.card .key.space {
  width: auto; padding: 0 5px; font-size: 8px; letter-spacing: 0.06em;
  background: #5b21b6; border-color: #c084fc; color: #f5d0fe;
}
.card .ready {
  color: #f5d0fe; font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
}
.card:hover { filter: brightness(1.08); }

.info-panel {
  flex: 1 1 auto;
  min-width: 210px;
  background: #120b20;
  border: 1px solid #3a2a55;
  border-radius: 12px;
  padding: 10px 14px;
}
.info-h {
  font-size: 13px; font-weight: 800; letter-spacing: 0.08em; color: #e9d5ff;
}
.info-stats {
  font-size: 11px; color: #c4b8d8; margin: 3px 0 6px;
  font-family: "Share Tech Mono", monospace;
}
.info-day { font-size: 11px; font-weight: 700; color: #86efac; }
.info-night { font-size: 11px; font-weight: 700; color: #e9d5ff; margin-top: 2px; }

.speed-panel {
  flex: 0 0 148px;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
  padding: 6px 6px 4px 8px;
  background: #120b20;
  border: 1px solid #3a2a55;
  border-radius: 12px;
}
.spd-row { display: flex; gap: 6px; }
.spd {
  width: 30px; height: 28px;
  border-radius: 8px;
  border: 1px solid #4a3a60;
  background: #1a1228;
  color: #d8cce8;
  font-weight: 800; font-size: 11px;
  font-family: "Rajdhani", sans-serif;
}
.spd.on {
  background: #f5a524;
  border-color: #f5a524;
  color: #1a0c04;
}
.cam-lab {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; color: #ffc14d;
}

/* ---------- menu / pause / results ---------- */
#menu, #results, #pause {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,176,32,0.16), transparent 42%),
              radial-gradient(ellipse at 80% 70%, rgba(124,58,237,0.28), transparent 50%),
              rgba(6, 3, 14, 0.72);
}
.menu-card {
  width: min(560px, 92vw);
  padding: 28px 32px 24px;
  background: rgba(12, 8, 28, 0.94);
  border: 2px solid #e8891a;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 40px rgba(232,137,26,0.12);
}
.menu-card.slim { width: min(420px, 92vw); text-align: center; }
.menu-title { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.menu-title img { width: 48px; height: 48px; }
.wordmark {
  font-family: "Orbitron", sans-serif;
  font-weight: 800; font-size: 32px; letter-spacing: 0.08em;
  color: #f5a524;
}
.menu-sub {
  font-size: 12px; font-weight: 800; letter-spacing: 0.16em; color: #c084fc;
}
.menu-blurb {
  font-size: 15px; line-height: 1.45; color: #d8cce8; margin: 10px 0 14px;
}
.menu-hooks { display: grid; gap: 6px; margin-bottom: 16px; }
.menu-hooks div {
  font-size: 13px; font-weight: 700; color: #d8cce8;
  display: flex; gap: 10px; align-items: center;
}
.menu-hooks span {
  display: inline-block; min-width: 54px;
  font-size: 10px; letter-spacing: 0.12em; font-weight: 800;
  padding: 2px 8px; border-radius: 8px; text-align: center;
  background: #2a1c08; color: #ffc14d; border: 1px solid #e8891a;
}
.menu-hooks div:nth-child(2) span { background: #3b0764; color: #e9d5ff; border-color: #c084fc; }
.menu-hooks div:nth-child(3) span { background: #1e1b4b; color: #c4b5fd; border-color: #6366f1; }
#btn-play, #btn-again, #btn-resume {
  display: block; width: 100%;
  margin-top: 6px; padding: 12px 16px;
  background: linear-gradient(180deg, #ffc14d, #e8891a);
  border: 0; border-radius: 12px;
  color: #1a0c04; font-family: "Orbitron", sans-serif;
  font-weight: 800; letter-spacing: 0.14em; font-size: 14px;
  cursor: pointer;
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover { filter: brightness(1.08); }
.menu-controls {
  margin-top: 14px; font-size: 12px; color: #8a7aa8; line-height: 1.55;
}
kbd {
  display: inline-block;
  padding: 0 5px; border-radius: 4px;
  background: #1a1228; border: 1px solid #4a3a60;
  color: #ffc14d; font-family: "Share Tech Mono", monospace; font-size: 11px;
}
.res-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 16px 0; font-size: 13px; color: #c4b8d8;
}
.res-grid b { display: block; color: #ffc14d; font-size: 18px; font-family: "Share Tech Mono", monospace; }

@media (max-width: 1280px) {
  .card { flex: 0 0 92px; }
  .info-panel { min-width: 160px; }
  #hud-cycle { min-width: 420px; }
}
