:root {
  --cyan: #2ee8f0;
  --cyan-hot: #7af8ff;
  --cyan-deep: #14b8c8;
  --cyan-dim: #3a8aa0;
  --magenta: #ff3ec8;
  --pink: #ff6a9a;
  --gold: #ffb428;
  --gold-hot: #ffd060;
  --orange: #ff8a14;
  --green: #3cff7a;
  --red: #ff4a6a;
  --navy: #021018;
  --panel: rgba(4, 18, 32, 0.82);
  --panel-2: rgba(3, 16, 28, 0.88);
  --ink: #e8f6ff;
  --muted: #6aa8c0;
  --border: #1a8aa0;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #011018;
  color: var(--ink);
  font-family: "Rajdhani", "Exo 2", "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: 4;
  pointer-events: none;
  overflow: hidden;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ========== HUD ========== */
#hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#topbar {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(420px, 2.1fr) minmax(280px, 1.05fr);
  gap: 14px;
  align-items: stretch;
  pointer-events: none;
}

#title-card,
#mid-meters,
#score-card,
#radar-card,
#kit-card,
#obj-card {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 0 22px rgba(0, 40, 60, 0.35);
}

#title-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 10px;
}

#title-orb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(80, 200, 255, 0.55));
  flex-shrink: 0;
}

.title-word {
  font-family: "Exo 2", "Orbitron", sans-serif;
  font-weight: 800;
  font-size: clamp(13px, 1.15vw, 18px);
  letter-spacing: 0.06em;
  color: #f4fbff;
  line-height: 1.1;
  white-space: nowrap;
}
.title-zone {
  font-size: clamp(9px, 0.78vw, 12px);
  letter-spacing: 0.08em;
  color: var(--cyan);
  font-weight: 700;
  margin-top: 2px;
}
.title-eng {
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  color: #5a8a9a;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

#mid-meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 8px 16px 10px;
  align-items: center;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.meter-lab {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.meter-lab.cyan { color: var(--cyan); }
.meter-lab.pink { color: var(--pink); }
.meter-val {
  font-size: 11px;
  font-weight: 700;
  color: #d8eef6;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ok { color: var(--green); }
.warn { color: var(--gold-hot); }
.crit { color: var(--red); }

.track {
  height: 9px;
  border-radius: 8px;
  overflow: hidden;
  background: #061018;
  border: 1px solid #0a3040;
}
.track i {
  display: block;
  height: 100%;
  border-radius: 8px;
}
.cyan-track i {
  background: linear-gradient(90deg, #00d4e8 0%, #3cff9a 100%);
  box-shadow: 0 0 8px #2ee8c0;
}
.risk-track i {
  background: linear-gradient(90deg, #3cff7a 0%, #c8e020 55%, #ff4a6a 100%);
  box-shadow: 0 0 8px #3cff7a;
}

#score-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
}
.chip-lab {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 700;
}
.score-num {
  font-family: "Orbitron", "Exo 2", sans-serif;
  font-size: clamp(18px, 1.7vw, 26px);
  font-weight: 700;
  color: #f4fbff;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.vit-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.vit-orb {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #2ee8f0);
}
.vit-orb.dim { opacity: 0.28; filter: grayscale(0.4); }
.fps-col {
  margin-left: auto;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: var(--cyan-dim);
  white-space: nowrap;
}

/* world tags */
.world-tag {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -120%);
  pointer-events: none;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px #000;
  z-index: 6;
}
.cyan-tag { color: var(--cyan-hot); }
.gel-tag { color: #c8dce8; font-size: 10px; letter-spacing: 0.12em; }
.red-tag { color: #ff8aa0; font-size: 10px; letter-spacing: 0.1em; }
.core-tag { text-align: left; white-space: normal; line-height: 1.25; }
.core-tag .sub { color: #8ab0c0; font-size: 9px; letter-spacing: 0.12em; }

.mantis-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(80, 10, 22, 0.88);
  border: 1.5px solid #e04058;
  border-radius: 6px;
  padding: 3px 8px 3px 6px;
  color: #ffd0d8;
  font-size: 10px;
  letter-spacing: 0.1em;
  box-shadow: 0 0 12px rgba(224, 40, 70, 0.45);
}
.mantis-badge img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

/* BOTTOM */
#bottombar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: grid;
  grid-template-columns: 210px minmax(520px, 1.7fr) minmax(340px, 1.05fr);
  gap: 12px;
  align-items: stretch;
  pointer-events: none;
}

#radar-card {
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.card-lab {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin-bottom: 4px;
}
.dot-cyan {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  margin-right: 4px;
}
#radar {
  width: 168px;
  height: 168px;
}

#kit-card {
  display: flex;
  align-items: stretch;
  padding: 10px 12px;
  gap: 10px;
  pointer-events: auto;
}
#ink-block {
  width: 210px;
  flex-shrink: 0;
  padding: 2px 8px 2px 4px;
}
.ink-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.ink-pct {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #e8f0f4;
  margin: 2px 0 6px;
}
.ink-track {
  height: 12px;
  border-radius: 10px;
  background: #061018;
  border: 1px solid #3a2a10;
  overflow: hidden;
}
.ink-track i {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #ff6a10 0%, #ffcc28 70%, #c8f040 100%);
  box-shadow: 0 0 8px #ff9a20;
}
.ink-meta {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.35;
  color: #8ab0c0;
  font-weight: 600;
}
.ink-meta b { color: var(--gold-hot); }

.kit-div {
  width: 1px;
  background: linear-gradient(180deg, transparent, #1a6a80, transparent);
  margin: 4px 4px;
}

#abs {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ab {
  pointer-events: auto;
  background: rgba(4, 22, 36, 0.55);
  border: 1.5px solid #1a6a80;
  border-radius: 12px;
  padding: 8px 8px 6px;
  color: var(--ink);
  text-align: left;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ab:hover { border-color: var(--cyan); }
.ab.active {
  border-color: #e0a010;
  background: linear-gradient(180deg, rgba(60, 40, 8, 0.55), rgba(18, 22, 10, 0.55));
  box-shadow: 0 0 12px rgba(224, 160, 16, 0.25);
}
.ab-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ab-key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #0a3040;
  border-radius: 4px;
  padding: 1px 6px;
  color: #b8e0ec;
}
.ab-key.gold { background: #e0a010; color: #1a1204; }
.ab-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.ab-name {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-top: 6px;
  color: #f2fbff;
}
.ab-sub {
  font-size: 11px;
  color: #8ab0c0;
  font-weight: 600;
}
.ab-state {
  margin-top: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding-top: 6px;
}
.ab-state.gold { color: var(--gold); }
.ab-state.ready { color: var(--green); }
.ab-state.cd { color: #8ab0c0; }

#obj-card {
  padding: 10px 16px 12px;
}
.obj-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 8px;
}
#obj-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#obj-list li {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.obj-main {
  font-size: 13px;
  font-weight: 700;
  color: #e8f4fa;
}
.obj-sub {
  font-size: 12px;
  font-weight: 600;
  padding-left: 4px;
}
.obj-sub.gold { color: var(--gold); }
.obj-sub.green { color: var(--green); }
.obj-sub.red { color: var(--pink); }
.tag-prog { color: #d8eef6; }
.tag-stealth { color: #d8eef6; }
.tag-goal { color: #d8eef6; }
#obj-list li.done .obj-main { color: #6a98a8; text-decoration: line-through; }

/* MENU / RESULTS */
#menu, #results {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 40, 60, 0.35), rgba(0, 6, 12, 0.72));
}
.menu-card {
  width: min(560px, 92vw);
  background: rgba(4, 16, 28, 0.92);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 28px 32px 26px;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 180, 220, 0.12);
}
.menu-orb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(80, 200, 255, 0.6));
  margin-bottom: 8px;
}
.menu-kicker {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  font-weight: 700;
}
.menu-title {
  font-family: "Exo 2", "Orbitron", sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0.06em;
  line-height: 1.05;
  margin: 8px 0 6px;
  color: #f4fbff;
}
.menu-title.sm { font-size: 28px; }
.menu-sub {
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--cyan-dim);
  font-weight: 700;
  margin-bottom: 12px;
}
.menu-blurb {
  font-size: 15px;
  line-height: 1.45;
  color: #c0d8e4;
  margin-bottom: 18px;
}
.menu-blurb b { color: var(--cyan-hot); }
#btn-play, #btn-again {
  pointer-events: auto;
  background: linear-gradient(90deg, #0a8aa0, #14c8d8);
  border: 0;
  color: #041018;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(20, 200, 220, 0.35);
}
#btn-play:hover, #btn-again:hover { filter: brightness(1.12); }
.menu-controls {
  margin-top: 16px;
  font-size: 12px;
  color: #8ab0c0;
  line-height: 1.6;
}
.menu-controls kbd {
  display: inline-block;
  background: #0a2838;
  border: 1px solid #1a6a80;
  border-radius: 4px;
  padding: 0 5px;
  color: var(--cyan-hot);
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  margin: 12px 0 18px;
  font-size: 13px;
  color: #8ab0c0;
}
.res-grid b { color: #f4fbff; font-family: "Orbitron", sans-serif; }

#banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 22px;
  color: var(--cyan-hot);
  text-shadow: 0 0 18px rgba(80, 220, 255, 0.6);
  pointer-events: none;
}
#pause {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 6, 12, 0.45);
  font-family: "Orbitron", sans-serif;
  font-size: 42px;
  letter-spacing: 0.3em;
  color: var(--cyan-hot);
}

@media (max-width: 1200px) {
  #topbar { grid-template-columns: 1fr 1.4fr 0.9fr; }
  #bottombar { grid-template-columns: 180px 1.5fr 0.95fr; }
  .ab-name { font-size: 11px; }
}
