:root {
  --cyan: #00e8f8;
  --cyan-hot: #5cf6ff;
  --cyan-deep: #00c8dc;
  --cyan-dim: #1488a8;
  --magenta: #ff3db4;
  --magenta-hot: #ff5ad0;
  --pink: #ff4ec8;
  --gold: #e8a020;
  --gold-2: #ffc040;
  --orange: #ff8c20;
  --red: #c41e2a;
  --green: #00e880;
  --navy: #0b0e1a;
  --panel: rgba(11, 14, 26, 0.92);
  --panel-2: rgba(12, 16, 32, 0.88);
  --white: #f4fbff;
  --boost: #ff9a28;
  --armor: #c070ff;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0e1a;
  color: var(--white);
  font-family: "Rajdhani", "Exo 2", "Trebuchet MS", sans-serif;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  background: #0b0e1a;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden { display: none !important; }

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

/* ========== FLOATING WORLD LABELS ========== */
#float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}
.floater {
  position: absolute;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  pointer-events: none;
  font-family: "Share Tech Mono", "Orbitron", monospace;
  letter-spacing: 0.06em;
}
.floater.name {
  font-size: 11px;
  font-weight: 700;
  color: #7af6ff;
  background: rgba(8, 18, 32, 0.82);
  border: 1px solid #00c8dc;
  padding: 2px 8px 2px 8px;
}
.floater.name.below {
  transform: translate(-50%, 10px);
}
.floater.name.titan {
  color: #9ad8ff;
  border-color: #1aa8c8;
}
.floater.target {
  font-size: 11px;
  font-weight: 700;
  color: #ffe8a0;
  background: rgba(48, 8, 12, 0.85);
  border: 1px solid #c41e2a;
  padding: 3px 10px;
}
.floater.dmg {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #5cf6ff;
  text-shadow: 0 0 10px #00e8f4, 0 2px 0 #001018;
}
.floater.dmg.arc {
  color: #e070ff;
  text-shadow: 0 0 10px #c040ff;
}
.floater.dmg.crit {
  color: #ffe14a;
  font-size: 22px;
  text-shadow: 0 0 12px #ffc040;
}
.floater.pips {
  display: flex;
  gap: 3px;
  background: rgba(20, 8, 10, 0.75);
  border: 1px solid #6a1018;
  padding: 3px 6px;
}
.floater.pips i {
  width: 10px;
  height: 14px;
  background: #c41e2a;
  display: block;
  box-shadow: 0 0 4px #c41e2a;
}
.floater.pips i.off { background: #2a1014; box-shadow: none; }
.floater.swap {
  font-size: 10px;
  font-weight: 800;
  color: #ffe8a0;
  background: #0b0e1a;
  border: 2px solid #e8a020;
  padding: 6px 8px;
  transform: translate(-50%, -50%) rotate(0deg);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  width: 56px;
  height: 56px;
  font-size: 8px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
}

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

#hud-tl {
  position: absolute;
  top: 14px;
  left: 16px;
  width: min(430px, 32vw);
}

.title-chevron {
  display: flex;
  align-items: stretch;
  filter: drop-shadow(0 0 10px rgba(0, 232, 248, 0.35));
  margin-bottom: 8px;
}
.title-inner {
  background: #0b0e1a;
  border: 2px solid #00e8f8;
  border-right: none;
  padding: 6px 18px 6px 16px;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 100%, 0 100%);
  min-width: 250px;
}
.title-cap {
  width: 28px;
  background: #00e8f8;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  margin-left: -2px;
}
.title-chevron.big .title-inner {
  min-width: 320px;
  padding: 10px 28px 10px 22px;
}
.wordmark {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: 0.04em;
  color: #f4fbff;
  line-height: 1.05;
}
.title-sub {
  font-family: "Share Tech Mono", "Rajdhani", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #00e8f8;
  margin-top: 1px;
}

.unit-card {
  background: rgba(11, 14, 26, 0.9);
  border: 1px solid rgba(0, 232, 248, 0.35);
  padding: 8px 10px 8px 8px;
}
.unit-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
}
.unit-row + .unit-row {
  border-top: 1px solid rgba(0, 232, 248, 0.18);
}
.unit-ico {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  background: #0b0e1a;
}
.unit-ico img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: auto;
}
.cyan-frame { border: 2px solid #00e8f8; box-shadow: 0 0 10px rgba(0, 232, 248, 0.35) inset; }
.mag-frame { border: 2px solid #ff3db4; box-shadow: 0 0 10px rgba(255, 61, 180, 0.35) inset; }
.unit-body { flex: 1; min-width: 0; }
.unit-name {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e8f4ff;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-active { color: #00e880; font-size: 11px; }
.tag-linked { color: #7ab0ff; font-size: 11px; }
.swap-hint {
  margin-left: auto;
  color: #7af6ff;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.unit-stats {
  display: flex;
  justify-content: space-between;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: #9ad0e0;
  margin-top: 2px;
}
.unit-stats.tiny { font-size: 10px; color: #6aa8c0; }
.unit-stats .right { color: #7af6ff; }
.bar-row {
  height: 7px;
  background: #141a28;
  margin-top: 3px;
  position: relative;
  overflow: hidden;
}
.bar-row.boost { height: 5px; }
.bar-row.dome { height: 5px; }
.bar-row i.fill {
  display: block;
  height: 100%;
  width: 85%;
}
.fill.hp { background: linear-gradient(90deg, #00c878, #00e880); }
.fill.boost { background: linear-gradient(90deg, #e07010, #ffb040); width: 62%; }
.fill.armor { background: linear-gradient(90deg, #7060ff, #c070ff); width: 96%; }
.fill.dome { background: linear-gradient(90deg, #00b8e0, #5cf6ff); width: 100%; }
.tether-line {
  margin-top: 4px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: #5cf6ff;
  letter-spacing: 0.04em;
}
.tether-line b { color: #9affd0; }

/* top center */
#hud-tc {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}
.wave-banner {
  background: #0b0e1a;
  border: 2px solid #00d4ec;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
  padding: 6px 42px 8px;
  min-width: min(560px, 46vw);
  text-align: center;
  box-shadow: 0 0 16px rgba(0, 212, 236, 0.25);
}
.wave-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: #f4fbff;
}
.wave-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: #7ad8ec;
}
.core-lab b { color: #5cf6ff; }
.core-track {
  flex: 1;
  height: 8px;
  background: #1a2434;
  overflow: hidden;
}
.core-track i {
  display: block;
  height: 100%;
  width: 78%;
  background: #00e8f8;
  box-shadow: 0 0 8px #00e8f8;
}
.timer { color: #c8e8f8; white-space: nowrap; }
.clock { color: #7af6ff; }

/* top right */
#hud-tr {
  position: absolute;
  top: 10px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.score-banner {
  background: #0b0e1a;
  border: 2px solid #e8a020;
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%);
  padding: 8px 26px 8px 42px;
  min-width: 260px;
  text-align: right;
  box-shadow: 0 0 14px rgba(232, 160, 32, 0.28);
}
.score-lab {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #f4fbff;
}
.score-num {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.04em;
  color: #f4fbff;
  line-height: 1.1;
  min-height: 34px;
  min-width: 6.5ch;
  display: inline-block;
}
.combo-lab {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #e8a020;
  margin-top: 2px;
}
.tech-line {
  margin-top: 6px;
  background: #0b0e1a;
  padding: 2px 10px;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #8aa0b8;
  letter-spacing: 0.04em;
}

/* bottom bar */
#hud-bot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 10px;
  padding: 8px 14px 10px;
  background: linear-gradient(180deg, transparent, rgba(8, 12, 22, 0.55) 18%, #0a1018 42%);
  border-top: 2px solid #00c8dc;
  pointer-events: none;
}
.bot-left { justify-self: start; min-width: 0; }
.bot-mid { justify-self: center; display: flex; flex-direction: column; align-items: center; padding-bottom: 2px; }
.bot-right { justify-self: end; display: flex; align-items: flex-end; gap: 10px; }

.loadout-head {
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #7af6ff;
  margin-bottom: 6px;
}
.wep-row { display: flex; gap: 6px; }
.wep-card {
  background: #0b0e1a;
  border: 1px solid #2a4050;
  padding: 6px 8px;
  min-width: 108px;
  font-family: "Share Tech Mono", monospace;
}
.wep-card.cyan { border-color: #00e8f8; }
.wep-card.gold { border-color: #e8a020; }
.wep-card.gray { border-color: #3a5060; opacity: 0.92; }
.wep-card.ready { box-shadow: 0 0 10px rgba(0, 232, 248, 0.25); }
.wep-card.cd { opacity: 0.55; }
.wep-key { font-size: 10px; color: #8ad0e0; }
.wep-name { font-size: 12px; color: #e8f4ff; font-weight: 700; line-height: 1.15; }
.wep-sub { font-size: 11px; color: #5cf6ff; margin-top: 2px; }
.wep-card.gold .wep-sub { color: #ffc040; }
.wep-card.gray .wep-sub { color: #8aa0b0; }

.swap-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 14, 26, 0.92);
  border: 2px solid #00d4ec;
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 100%, 0 100%);
  padding: 8px 28px;
}
.swap-ico {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #00e8f8);
}
.swap-ico.mag { filter: drop-shadow(0 0 6px #ff3db4); }
.swap-line {
  width: 36px;
  height: 3px;
  background: #00e8f8;
  box-shadow: 0 0 8px #00e8f8;
}
#btn-swap {
  pointer-events: auto;
  background: #0b0e1a;
  border: 2px solid #e8a020;
  color: #f4fbff;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-size: 13px;
}
#btn-swap small {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #e8a020;
  letter-spacing: 0.12em;
  font-weight: 700;
}
#btn-swap .swap-sym { color: #e8a020; margin-right: 4px; }
#btn-swap:hover { background: #16140a; }
.tether-opt {
  margin-top: 4px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: #00e880;
  letter-spacing: 0.06em;
}

.sys-panel {
  background: rgba(11, 14, 26, 0.92);
  border: 1px solid #1aa8c8;
  padding: 6px 10px;
  font-family: "Share Tech Mono", monospace;
  min-width: 130px;
}
.sys-head { font-size: 10px; letter-spacing: 0.14em; color: #7af6ff; }
.sys-row { font-size: 11px; color: #9ad0e0; margin-top: 2px; }
.sys-row.ok { color: #00e880; }
.heat-track {
  height: 6px;
  background: #141a28;
  margin: 3px 0;
  overflow: hidden;
}
.heat-track i {
  display: block;
  height: 100%;
  width: 24%;
  background: #00e8f8;
}

.radar-wrap { text-align: center; }
#radar {
  width: 92px;
  height: 92px;
  display: block;
  background: #081018;
  border-radius: 50%;
  border: 1px solid #1aa8c8;
}
.radar-lab {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #8aa0b8;
  margin-top: 2px;
  letter-spacing: 0.08em;
}

/* ========== MENU / RESULTS ========== */
#menu, #results, #pause {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 70% 40%, rgba(255, 120, 40, 0.18), transparent 50%),
              radial-gradient(ellipse at 20% 30%, rgba(180, 20, 60, 0.22), transparent 50%),
              rgba(8, 10, 22, 0.55);
}
.menu-card {
  background: rgba(11, 14, 26, 0.92);
  border: 2px solid #00e8f8;
  padding: 28px 36px 24px;
  max-width: 640px;
  width: min(640px, 92vw);
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 232, 248, 0.18);
}
.menu-card.slim { max-width: 360px; padding: 28px; }
.menu-sub {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.18em;
  color: #e8a020;
  font-size: 13px;
  margin: 10px 0 14px;
}
.menu-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  height: 150px;
  margin: 8px 0 12px;
}
.menu-art img {
  height: 140px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 232, 248, 0.35));
}
.menu-blurb {
  font-size: 15px;
  color: #c8dce8;
  line-height: 1.45;
  margin: 0 0 18px;
}
.menu-blurb b { color: #5cf6ff; }
#btn-play, #btn-again, #btn-resume {
  background: #00e8f8;
  color: #0b0e1a;
  border: none;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 16px;
  padding: 12px 28px;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover { background: #5cf6ff; }
.menu-controls {
  margin-top: 16px;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  color: #8aa0b8;
  line-height: 1.7;
}
kbd {
  display: inline-block;
  border: 1px solid #00c8dc;
  padding: 0 5px;
  color: #5cf6ff;
  font-family: inherit;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 18px 0;
  font-family: "Share Tech Mono", monospace;
  color: #9ad0e0;
}
.res-grid b {
  display: block;
  font-family: "Orbitron", sans-serif;
  color: #f4fbff;
  font-size: 20px;
}

#menu .title-chevron, #results .title-chevron {
  justify-content: center;
}

@media (max-width: 1100px) {
  .wep-name { font-size: 11px; }
  .wep-card { min-width: 90px; }
  .score-num { font-size: 22px; }
  .wave-banner { min-width: 420px; padding-left: 28px; padding-right: 28px; }
}
