:root {
  --bg: #142d23;
  --navy: #0d121a;
  --navy-2: #18212f;
  --panel: rgba(13, 20, 27, 0.94);
  --cyan: #2ee6ff;
  --cyan-hot: #7af6ff;
  --cyan-deep: #00b8d4;
  --gold: #f5cf3b;
  --gold-dim: #c9a227;
  --green: #3ee07a;
  --red: #ff4458;
  --white: #f4fbff;
  --muted: #9ca9bb;
}

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

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

#stage { position: fixed; inset: 0; background: #0b1a14; }
#c { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

#loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1a14;
  color: #2ee6ff;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.18em;
  font-size: 14px;
}

/* ========== FLOATING WORLD TAGS ========== */
#float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.nametag {
  position: absolute;
  transform: translate(-50%, -120%);
  min-width: 168px;
  padding: 6px 10px 7px;
  border-radius: 8px;
  background: rgba(12, 18, 28, 0.92);
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 12px rgba(46, 230, 255, 0.18);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.nametag.tag-gold { border-color: var(--gold); box-shadow: 0 0 12px rgba(245, 207, 59, 0.22); }
.nametag.tag-red { border-color: #ff4d62; box-shadow: 0 0 12px rgba(255, 68, 88, 0.22); }
.nametag.tag-grey { border-color: #c5d0dc; box-shadow: 0 0 10px rgba(180, 190, 200, 0.18); }

.tag-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #e8f4ff;
  font-family: "Exo 2", sans-serif;
  font-size: 10.5px;
}
.tag-hp { color: #cfe0f0; font-variant-numeric: tabular-nums; }
.tag-bar {
  margin-top: 5px;
  height: 5px;
  border-radius: 3px;
  background: #1a2430;
  overflow: hidden;
}
.tag-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1ad4ea, #3dff9a);
  border-radius: 3px;
}
.tag-bar.gold i { background: linear-gradient(90deg, #d4a017, #f5cf3b); }
.tag-bar.red i { background: linear-gradient(90deg, #c02030, #ff4458); }
.tag-bar.grey i { background: linear-gradient(90deg, #8a96a6, #d0d8e0); }

.target-card {
  position: absolute;
  transform: translate(-50%, -130%);
  min-width: 210px;
  padding: 8px 12px 9px;
  border-radius: 8px;
  background: rgba(8, 22, 32, 0.94);
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 14px rgba(46, 230, 255, 0.25);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.tc-title {
  color: var(--cyan-hot);
  font-weight: 800;
  font-family: "Exo 2", sans-serif;
  font-size: 12px;
  margin-bottom: 3px;
}
.tc-line { color: #d5e6f2; font-size: 11px; line-height: 1.35; }
.tc-line.green { color: var(--green); }
.tc-line b { color: var(--white); }

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

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 10px;
  background: linear-gradient(180deg, #0c121a 0%, #141c28 100%);
  border-bottom: 1px solid #1e2a38;
  gap: 12px;
}

#brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 340px;
}
.brand-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #2ee6ff);
}
.brand-title {
  font-family: "Orbitron", "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #f7fbff;
}
.brand-title.big { font-size: 22px; letter-spacing: 0.14em; }
.brand-sub {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  font-weight: 700;
  margin-top: 1px;
}

#top-pills {
  display: flex;
  gap: 10px;
  flex: 1;
  justify-content: center;
}
.pill {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 210px;
  padding: 5px 14px 6px;
  border-radius: 10px;
  background: rgba(10, 16, 24, 0.85);
  border: 1.5px solid var(--cyan);
}
.pill-gold { border-color: var(--gold); }
.pill-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #eef6ff;
  font-family: "Exo 2", sans-serif;
}
.pill-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.pill-checks { display: flex; gap: 8px; font-size: 10px; color: #c9d4e0; margin-top: 1px; }
.chk.on { color: var(--gold); }
.dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3ee07a;
  box-shadow: 0 0 8px #3ee07a;
  display: inline-block;
  margin-right: 8px;
}
#pill-turn {
  flex-direction: row;
  align-items: center;
}
.wind-track {
  margin-top: 4px;
  height: 6px;
  border-radius: 4px;
  background: #1a2836;
  overflow: hidden;
}
.wind-track i {
  display: block;
  height: 100%;
  width: 75%;
  background: linear-gradient(90deg, #1488a8, #2ee6ff);
  box-shadow: 0 0 8px #2ee6ff;
}

#top-score {
  text-align: right;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #c5d2e0;
  min-width: 130px;
  line-height: 1.35;
  font-weight: 700;
}
#top-score b { color: #fff; }
.fps-line { color: #7f93a8; font-size: 10px; }

#turn-order {
  position: absolute;
  top: 66px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.to-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #9eb0c4;
  font-weight: 700;
}
.to-pills { display: flex; gap: 6px; }
.to-pill {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1.5px solid #2a3a4c;
  background: rgba(10, 16, 24, 0.82);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #9eb0c4;
  font-family: "Exo 2", sans-serif;
}
.to-pill.active { border-color: var(--cyan); color: var(--cyan-hot); }
.to-pill.gold { border-color: #4a3e18; color: var(--gold); }
.to-pill.red { border-color: #4a1c24; color: #ff6b7a; }
.to-pill.grey { border-color: #3a4450; color: #c5d0dc; }

/* UNIT STATUS */
#unit-status {
  pointer-events: auto;
  position: absolute;
  left: 14px;
  bottom: 16px;
  width: 360px;
  background: var(--panel);
  border: 1.5px solid #1f6f88;
  border-radius: 10px;
  padding: 10px 12px 10px;
  box-shadow: 0 0 18px rgba(0, 40, 50, 0.45);
}
.us-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 8px;
}
.us-lv { color: var(--gold); font-size: 10px; }
.us-body { display: flex; gap: 12px; }
.us-icon-wrap {
  width: 72px; height: 72px;
  border: 1.5px solid #2a3e52;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 16, 24, 0.6);
}
.us-icon-wrap img { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 0 6px #2ee6ff); }
.us-stats { flex: 1; }
.us-row {
  display: flex; justify-content: space-between;
  font-size: 11px; letter-spacing: 0.08em; font-weight: 700; color: #d5e4f0;
}
.us-num { color: var(--green); }
.us-bar {
  height: 7px; border-radius: 4px; background: #1a2430; overflow: hidden; margin: 4px 0 6px;
}
.us-bar i {
  display: block; height: 100%; width: 85%;
  background: linear-gradient(90deg, #1ecf6a, #6dff9c);
}
.us-meta { font-size: 11px; color: #b8c8d8; letter-spacing: 0.04em; line-height: 1.35; }
.us-meta.gold, .us-meta .gold, .us-meta span { color: inherit; }
.us-meta.gold { color: var(--gold); }
.us-foot {
  margin-top: 8px;
  border: 1px solid #1f3a52;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--cyan);
  line-height: 1.4;
}
.tether { color: var(--cyan-hot); font-weight: 700; }

/* ACTIONS */
#actions {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(720px, 46vw);
  background: var(--panel);
  border: 1.5px solid #1f6f88;
  border-radius: 10px;
  padding: 8px 10px 10px;
}
.act-head {
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 7px;
}
.act-row { display: flex; gap: 7px; }
.act {
  flex: 1;
  background: rgba(10, 18, 28, 0.9);
  border: 1.5px solid #2a3e52;
  border-radius: 8px;
  color: #e8f2fa;
  padding: 7px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.act:hover { border-color: #4a90a8; }
.act.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(46, 230, 255, 0.28);
}
.act:disabled { opacity: 0.4; cursor: default; }
.act-key { font-size: 10px; color: var(--cyan); letter-spacing: 0.08em; font-weight: 700; }
.act-name { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; font-family: "Exo 2", sans-serif; }
.act-cost { font-size: 10px; color: #9eb0c4; letter-spacing: 0.04em; }
.act-cost.green { color: var(--green); }

/* PET PANEL */
#pet-panel {
  pointer-events: auto;
  position: absolute;
  right: 14px;
  bottom: 16px;
  width: 400px;
  background: var(--panel);
  border: 1.6px solid var(--gold);
  border-radius: 10px;
  padding: 9px 11px 10px;
  box-shadow: 0 0 16px rgba(180, 140, 20, 0.18);
}
.pp-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}
.pp-auto { color: var(--green); font-size: 10px; }
.pp-stance {
  font-size: 11px;
  color: #c9d6e4;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.pp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.pet-cmd {
  text-align: left;
  background: rgba(10, 18, 28, 0.9);
  border: 1.5px solid #2a3e52;
  border-radius: 8px;
  color: #e8f2fa;
  padding: 8px 10px;
  min-height: 52px;
}
.pet-cmd:hover { border-color: #8a7420; }
.pet-cmd.selected {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(245, 207, 59, 0.22);
}
.pc-key { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; font-family: "Exo 2", sans-serif; }
.pc-sub { display: block; font-size: 10.5px; color: #9eb0c4; margin-top: 2px; }
.pp-next {
  margin-top: 8px;
  font-size: 11px;
  color: var(--green);
  letter-spacing: 0.03em;
  font-weight: 600;
}

/* TOAST / FX */
#toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(8, 16, 24, 0.92);
  border: 1.5px solid var(--cyan);
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.12em;
  font-size: 14px;
  pointer-events: none;
}
#dmg-fx { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.floater {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #ff6b7a;
  text-shadow: 0 0 8px #ff4458;
  pointer-events: none;
}
.floater.heal { color: #3ee07a; text-shadow: 0 0 8px #3ee07a; }
.floater.wind { color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }
.floater.gold { color: var(--gold); text-shadow: 0 0 8px var(--gold); }

/* MENU / RESULTS */
#menu, #results {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 50, 42, 0.55), rgba(6, 12, 16, 0.82));
}
.menu-card {
  width: min(560px, 92vw);
  background: rgba(10, 16, 24, 0.94);
  border: 1.5px solid #1f6f88;
  border-radius: 14px;
  padding: 28px 32px 26px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 24px rgba(46, 230, 255, 0.12);
}
.menu-hero {
  width: 220px;
  height: 140px;
  object-fit: contain;
  margin: 0 auto 10px;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.45));
  background: transparent;
}
.menu-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.menu-brand img { width: 48px; height: 48px; object-fit: contain; }
.menu-blurb {
  color: #c5d4e2;
  font-size: 14px;
  line-height: 1.45;
  margin: 8px 0 18px;
}
#btn-play, #btn-again {
  pointer-events: auto;
  background: linear-gradient(180deg, #1ad4ea, #0ea0b8);
  color: #041018;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 14px;
  font-family: "Orbitron", sans-serif;
}
#btn-play:hover, #btn-again:hover { filter: brightness(1.08); }
.menu-controls {
  margin-top: 16px;
  text-align: left;
  font-size: 12px;
  color: #9eb0c4;
  line-height: 1.7;
  letter-spacing: 0.04em;
}
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-right: 3px;
  border-radius: 4px;
  border: 1px solid #2a4a5c;
  background: #121c28;
  color: var(--cyan);
  font-size: 11px;
  font-family: inherit;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 20px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #9eb0c4;
}
.res-grid b { display: block; color: #fff; font-size: 18px; font-family: "Orbitron", sans-serif; }

@media (max-width: 1280px) {
  #unit-status { width: 300px; }
  #pet-panel { width: 340px; }
  #actions { width: min(640px, 44vw); }
  .brand-title { font-size: 13px; }
}
