:root {
  --cyan: #5cfff6;
  --cyan-hot: #b8fffb;
  --cyan-dim: #1aa8b8;
  --magenta: #ff3db8;
  --magenta-hot: #ff7ad8;
  --pink: #ff62c8;
  --gold: #ffb020;
  --gold-hot: #ffe07a;
  --orange: #ff8a20;
  --red: #ff3a4a;
  --green: #3ee88a;
  --navy: #07101c;
  --panel: rgba(7, 14, 28, 0.86);
  --panel-2: rgba(6, 16, 32, 0.92);
  --ink: #e8fbff;
  --muted: #6aa8b8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #061428;
  color: var(--ink);
  font-family: "Rajdhani", "Exo 2", "Segoe UI", sans-serif;
  user-select: none;
}

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

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

.hidden { display: none !important; }

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

/* ========== WORLD FLOATERS ========== */
#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: "Orbitron", "Share Tech Mono", sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.floater.dmg {
  font-size: 16px;
  color: #ffd0e8;
  text-shadow: 0 0 10px #ff3db8;
}
.floater.crit {
  font-size: 22px;
  font-weight: 900;
  color: #ffc44a;
  text-shadow: 0 0 14px #ffc44a;
}
.floater.heal {
  font-size: 15px;
  color: #7affe0;
  text-shadow: 0 0 10px #00f6c8;
}
.floater.score {
  font-size: 14px;
  color: #ffe07a;
  text-shadow: 0 0 10px #ffb020;
}

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

#hud-tl {
  position: absolute;
  top: 18px;
  left: 22px;
}
#hud-tc {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
}
#hud-tr {
  position: absolute;
  top: 14px;
  right: 18px;
}
#hud-bl {
  position: absolute;
  left: 18px;
  bottom: 22px;
}
#hud-bc {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
}
#hud-br {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.title-card {
  background: linear-gradient(180deg, rgba(10, 18, 42, 0.92), rgba(8, 14, 32, 0.88));
  border: 1px solid rgba(92, 255, 246, 0.28);
  border-left: 3px solid #ff3db8;
  border-radius: 10px;
  padding: 10px 18px 9px;
  min-width: 340px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 18px rgba(0, 180, 255, 0.06);
}
.title-card.big {
  min-width: 520px;
  padding: 16px 22px;
  border-left-width: 4px;
}
.title-main {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.14em;
  color: #8efcff;
  text-shadow: 0 0 12px rgba(0, 230, 255, 0.55);
}
.title-card.big .title-main { font-size: 22px; }
.title-sub {
  margin-top: 3px;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #ff62c8;
  text-transform: uppercase;
}

.grid-card {
  background: linear-gradient(180deg, rgba(8, 22, 40, 0.9), rgba(6, 16, 32, 0.88));
  border: 1px solid rgba(0, 220, 210, 0.45);
  border-radius: 12px;
  padding: 10px 22px 8px;
  min-width: 560px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 220, 210, 0.12);
}
.grid-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 28px;
}
.grid-lab {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #7af8f0;
}
.grid-val {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #c8fff8;
}
.grid-val b { color: #ffffff; font-size: 14px; }
.grid-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 5px;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #6ad8d0;
}
.grid-meta b { color: #e8fffc; }

.score-card {
  background: linear-gradient(180deg, rgba(10, 22, 36, 0.92), rgba(6, 14, 26, 0.9));
  border: 1px solid rgba(255, 61, 184, 0.35);
  border-right: 3px solid #ff3db8;
  border-radius: 10px;
  padding: 8px 16px 7px;
  min-width: 230px;
  text-align: right;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.score-lab {
  font-family: "Orbitron", sans-serif;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #8aa8b8;
}
.score-num {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #ffb020;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(255, 176, 32, 0.55);
  line-height: 1.05;
}
.score-sub {
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  color: #d0e8f0;
}
.score-sub b { color: #fff; }
.boost-tag { color: #ff8a20; margin-left: 6px; }
.spore-ico {
  display: inline-block;
  width: 8px; height: 8px;
  margin: 0 4px 1px;
  border-radius: 50%;
  background: #ff7a40;
  box-shadow: 0 0 6px #ff7a40;
  vertical-align: middle;
}
.score-tech {
  margin-top: 2px;
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #5a8898;
}

.weaver-card {
  background: linear-gradient(180deg, rgba(8, 18, 36, 0.92), rgba(6, 12, 26, 0.9));
  border: 1px solid rgba(0, 210, 220, 0.4);
  border-radius: 10px;
  padding: 10px 14px 12px;
  width: 300px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.weaver-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.weaver-name {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7af8f0;
}
.lvl-pill {
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #c8fff8;
  border: 1px solid rgba(0, 220, 210, 0.5);
  border-radius: 4px;
  padding: 1px 7px;
  background: rgba(0, 40, 50, 0.6);
}
.stat-line {
  display: flex;
  justify-content: space-between;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: #7aa0b0;
  margin-top: 6px;
}
.stat-num { color: #d8f0f8; }
.stat-num b { color: #fff; }

.bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(8, 20, 32, 0.9);
  border: 1px solid rgba(80, 140, 160, 0.25);
  overflow: hidden;
  margin-top: 3px;
}
.bar i {
  display: block;
  height: 100%;
  width: 80%;
  border-radius: 4px;
}
.bar.hull i {
  background: linear-gradient(90deg, #1aa868, #4cff9a);
  box-shadow: 0 0 8px #3ee88a;
}
.bar.shield i {
  background: linear-gradient(90deg, #1288c8, #5cfff6);
  box-shadow: 0 0 8px #5cfff6;
}
.bar.fuel {
  height: 10px;
  border-radius: 5px;
  background: #0a1420;
}
.bar.fuel i {
  background: linear-gradient(90deg, #2ee8c8 0%, #7aff80 35%, #ffe020 62%, #ff7a20 82%, #ff3db8 100%);
  box-shadow: 0 0 10px rgba(255, 160, 40, 0.45);
}

.fuel-card {
  background: linear-gradient(180deg, rgba(6, 16, 32, 0.94), rgba(6, 12, 26, 0.92));
  border: 1px solid rgba(0, 200, 210, 0.38);
  border-radius: 12px;
  padding: 10px 16px 12px;
  width: 560px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.fuel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.fuel-title {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #7af8f0;
}
.fuel-title b { color: #fff; margin-left: 4px; }
.heat-pill {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #ffd080;
  background: rgba(80, 30, 10, 0.55);
  border: 1px solid rgba(255, 140, 40, 0.45);
  border-radius: 4px;
  padding: 2px 8px;
}
.heat-pill.ok { color: #8ef0d0; border-color: rgba(0, 220, 160, 0.4); background: rgba(10, 40, 36, 0.55); }
.heat-pill.crit { color: #ffb0b8; border-color: #ff3a4a; background: rgba(80, 10, 18, 0.7); animation: pulse 0.6s ease-in-out infinite; }

.fuel-meta {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 10px;
  margin: 8px 0 10px;
}
.fm-lab {
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #5a8898;
}
.fm-val {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  color: #ffe8c0;
  margin-top: 1px;
}
.fm-val.cyan { color: #7affe0; }
.fm-val.warn { color: #ffb060; }

.ability-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.ab {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 30%, #1a2838, #0a121c);
  border: 1px solid rgba(0, 200, 210, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
}
.ab img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(0, 255, 220, 0.45));
  pointer-events: none;
}
.ab-key {
  position: absolute;
  top: 2px;
  left: 5px;
  font-family: "Orbitron", sans-serif;
  font-size: 8px;
  letter-spacing: 0.06em;
  color: #8ad8d0;
}
.ab-name {
  position: absolute;
  bottom: 2px;
  left: 0; right: 0;
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #c8fff8;
}
.ab-cd {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.62);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}
.ab.on {
  border-color: #ff8a20;
  box-shadow: 0 0 14px rgba(255, 138, 32, 0.55);
}
.ab.ready {
  border-color: #7affe0;
}

.radar-card {
  background: linear-gradient(180deg, rgba(8, 16, 32, 0.94), rgba(6, 12, 24, 0.92));
  border: 1px solid rgba(255, 61, 184, 0.4);
  border-right: 3px solid #ff3db8;
  border-radius: 10px;
  padding: 8px 10px 8px;
  width: 236px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.radar-head {
  display: flex;
  justify-content: space-between;
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #7af8f0;
  margin-bottom: 4px;
}
.radar-head .depth { color: #8aa8b8; font-size: 9px; }
.radar-head .depth b { color: #c8fff8; }
#radar { display: block; width: 216px; height: 176px; }
.radar-legend {
  display: flex;
  justify-content: space-between;
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  color: #7aa0b0;
  margin-top: 4px;
}
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.dot.weaver { background: #5cfff6; box-shadow: 0 0 6px #5cfff6; }
.dot.node { background: #3ec8ff; }
.dot.blight { background: #ff3db8; box-shadow: 0 0 6px #ff3db8; }

#overdrive {
  position: absolute;
  left: 50%;
  bottom: 248px;
  transform: translateX(-50%);
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #fff4e0;
  padding: 8px 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a18, #ff4a40 50%, #ff3db8);
  box-shadow: 0 0 22px rgba(255, 80, 40, 0.65), 0 6px 18px rgba(0,0,0,0.4);
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
  white-space: nowrap;
}
.od-bolt { margin-right: 6px; }

.world-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}
.world-tag.blight {
  color: #ffd0d4;
  background: rgba(48, 8, 14, 0.88);
  border: 1px solid #ff3a4a;
  text-shadow: 0 0 8px #ff3a4a;
}
.world-tag.node {
  color: #c8fff8;
  background: rgba(6, 22, 32, 0.88);
  border: 1px solid #00d4c8;
}

#reticle-blight {
  position: absolute;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid #ff3a4a;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 8px #ff3a4a;
}
#reticle-blight::before, #reticle-blight::after {
  content: "";
  position: absolute;
  background: #ff3a4a;
}
#reticle-blight::before { left: 50%; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; }
#reticle-blight::after { top: 50%; left: 4px; right: 4px; height: 2px; margin-top: -1px; }

#reticle-node {
  position: absolute;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border: 2px dashed rgba(92, 255, 246, 0.55);
  border-radius: 50%;
  pointer-events: none;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border: 1px solid rgba(92, 255, 246, 0.35);
  border-radius: 50%;
  pointer-events: none;
  z-index: 7;
}
#crosshair::before, #crosshair::after {
  content: "";
  position: absolute;
  background: rgba(92, 255, 246, 0.7);
}
#crosshair::before { left: 50%; top: 3px; bottom: 3px; width: 1px; margin-left: -0.5px; }
#crosshair::after { top: 50%; left: 3px; right: 3px; height: 1px; margin-top: -0.5px; }

#hint {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #7affe0;
  text-shadow: 0 0 10px #00e8d0;
  pointer-events: none;
  z-index: 7;
}

/* ========== MENUS ========== */
#menu, #results, #pause {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 10, 50, 0.35), rgba(4, 8, 20, 0.72));
}

.menu-card {
  width: min(720px, 92vw);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(8, 16, 36, 0.94), rgba(6, 12, 28, 0.94));
  border: 1px solid rgba(0, 220, 210, 0.4);
  border-left: 4px solid #ff3db8;
  border-radius: 16px;
  padding: 28px 32px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(0, 180, 255, 0.12);
  text-align: center;
}
.menu-card.slim { width: min(420px, 90vw); padding: 28px; }

.menu-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  height: 150px;
  margin: 18px 0 10px;
}
.menu-art img {
  height: 130px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(0, 230, 255, 0.35));
}
.menu-art img:nth-child(2) { height: 148px; }
.menu-art img:nth-child(3) { filter: drop-shadow(0 0 14px rgba(255, 50, 70, 0.4)); }

.menu-blurb {
  font-size: 15px;
  line-height: 1.45;
  color: #c8e4ec;
  margin: 8px 0 18px;
}
.menu-blurb b { color: #7affe0; }

#btn-play, #btn-again, #btn-resume {
  pointer-events: auto;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: #061018;
  background: linear-gradient(90deg, #5cfff6, #7affc0);
  border: 0;
  border-radius: 8px;
  padding: 12px 28px;
  box-shadow: 0 0 22px rgba(92, 255, 246, 0.4);
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover {
  filter: brightness(1.08);
}

.menu-controls {
  margin-top: 16px;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  color: #7aa0b0;
  line-height: 1.7;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(92, 255, 246, 0.35);
  border-radius: 3px;
  color: #7affe0;
  background: rgba(0, 30, 40, 0.5);
  font-family: inherit;
  font-size: 11px;
}

.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin: 18px 0 22px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #8aa8b8;
}
.res-grid b {
  display: block;
  font-size: 22px;
  color: #ffb020;
  margin-top: 4px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (max-width: 1100px) {
  .fuel-card { width: 480px; }
  .grid-card { min-width: 420px; }
  .title-main { font-size: 14px; }
}
