:root {
  --navy: #070d14;
  --panel: rgba(8, 14, 22, 0.88);
  --gold: #d4b36a;
  --gold-hot: #f0d48a;
  --gold-line: #c9a44a;
  --cream: #f3ead2;
  --cyan: #3ad6e4;
  --cyan-hot: #7af4ff;
  --green: #3ec85a;
  --amber: #e0a428;
  --ink: #e8efe8;
  --warn: #ff6a4a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #05101a;
  color: var(--ink);
  font-family: "Rajdhani", "Orbitron", sans-serif;
  user-select: none;
}
#stage, #c {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
#c { z-index: 0; }

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

.hidden { display: none !important; }

/* ----- shared panel ----- */
.panel {
  background: var(--panel);
  box-shadow:
    0 0 0 1px rgba(201, 164, 74, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
}
.gold-edge {
  border: 1.5px solid var(--gold-line);
  border-radius: 10px;
}
.cyan-edge {
  border: 1.8px solid #2ec8d4;
  border-radius: 12px;
  box-shadow:
    0 0 18px rgba(46, 200, 212, 0.28),
    inset 0 0 18px rgba(20, 80, 90, 0.25);
}

/* ----- TOP LEFT ----- */
#hud-tl {
  position: absolute;
  top: 1.6%;
  left: 1.4%;
  width: min(400px, 24.5vw);
  padding: 0.62rem 0.85rem 0.72rem;
  z-index: 5;
}
.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.42rem;
  gap: 0.6rem;
}
.tl-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(10px, 0.82vw, 13px);
  color: var(--gold-hot);
  white-space: nowrap;
}
.tl-sys {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(8px, 0.68vw, 11px);
  color: var(--cyan);
}
.stat { margin-bottom: 0.38rem; }
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.stat-lab {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: clamp(9px, 0.72vw, 11px);
  color: #c8d0c4;
}
.stat-num {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-size: clamp(9px, 0.75vw, 12px);
  color: #dfe8de;
  letter-spacing: 0.04em;
}
.stat-num.gold { color: var(--gold-hot); }
.stat-num.cyan { color: var(--cyan-hot); }
.track {
  height: 8px;
  background: #0a1014;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.track i {
  display: block;
  height: 100%;
  width: 80%;
  border-radius: 2px;
}
.fill-green { background: linear-gradient(90deg, #2aa24a, #4ee06a); }
.fill-amber { background: linear-gradient(90deg, #c88818, #f0c040); }
.fill-cyan  { background: linear-gradient(90deg, #1498c0, #40e0f0); }

/* ----- TOP CENTER ----- */
#hud-tc {
  position: absolute;
  top: 1.15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.38rem;
}
.title-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.38rem 1.6rem;
  background: linear-gradient(180deg, #1a160e 0%, #0e0c08 100%);
  border: 1.6px solid var(--gold-line);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4), inset 0 0 18px rgba(201,164,74,0.08);
  min-width: min(560px, 42vw);
  justify-content: center;
}
.title-word {
  font-family: "Cinzel", serif;
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: clamp(13px, 1.35vw, 22px);
  color: var(--cream);
  text-shadow: 0 1px 0 #000, 0 0 12px rgba(240, 212, 138, 0.25);
  white-space: nowrap;
}
.gear-deco {
  width: 18px; height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(212, 179, 106, 0.7));
}
.title-sub {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: clamp(8px, 0.68vw, 11px);
  color: var(--cyan);
  background: rgba(6, 28, 36, 0.78);
  border: 1px solid rgba(58, 214, 228, 0.45);
  border-radius: 999px;
  padding: 0.18rem 0.9rem;
}
.title-banner.big {
  min-width: auto;
  padding: 0.55rem 1.4rem;
}
.title-banner.big .title-word { font-size: clamp(16px, 2vw, 28px); }

/* ----- TOP RIGHT ----- */
#hud-tr {
  position: absolute;
  top: 1.6%;
  right: 1.4%;
  width: min(250px, 17.5vw);
  padding: 0.7rem 0.95rem 0.8rem;
  text-align: right;
  z-index: 5;
}
.tr-lab {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: clamp(9px, 0.72vw, 11px);
  color: var(--gold);
}
.tr-score {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: clamp(22px, 2.1vw, 34px);
  color: var(--gold-hot);
  line-height: 1.05;
  margin: 0.08rem 0 0.28rem;
  text-shadow: 0 0 14px rgba(240, 196, 64, 0.35);
}
.tr-line {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: clamp(9px, 0.74vw, 12px);
  color: #c5d0c8;
  line-height: 1.35;
}
.tr-line b { font-weight: 800; }
.tr-line .cyan { color: var(--cyan-hot); }
.tr-line .gold { color: var(--gold-hot); }

/* ----- NAMEPLATE ----- */
#nameplate {
  position: absolute;
  top: 31.5%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  background: rgba(48, 10, 18, 0.82);
  border: 1px solid rgba(200, 60, 70, 0.7);
  border-radius: 4px;
  padding: 0.32rem 0.7rem 0.38rem;
  z-index: 5;
  box-shadow: 0 0 16px rgba(180, 30, 40, 0.25);
}
.np-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: clamp(10px, 0.82vw, 13px);
  color: #f2dce0;
}
.np-bang { color: #ff6a6a; }
.np-sub {
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(8px, 0.65vw, 10px);
  color: #c8b0b4;
  letter-spacing: 0.06em;
  margin: 2px 0 5px;
}
.np-track {
  height: 5px;
  background: #1a080c;
  border-radius: 1px;
  overflow: hidden;
}
.np-track i {
  display: block;
  height: 100%;
  width: 62%;
  background: linear-gradient(90deg, #c04048, #f07070);
}

/* ----- CROSSHAIR ----- */
#crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 42px; height: 42px;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
}
.ch-ring {
  position: absolute; inset: 0;
  border: 1.6px solid rgba(232, 150, 50, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(232, 150, 50, 0.35);
}
.ch-dot {
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border: 1.5px solid #3ad6e4;
  border-radius: 50%;
}
.ch-h, .ch-v {
  position: absolute;
  background: rgba(232, 150, 50, 0.9);
}
.ch-h {
  left: 50%; top: 50%;
  width: 10px; height: 1px;
  margin: 0 0 0 -5px;
}
.ch-v {
  left: 50%; top: 50%;
  width: 1px; height: 10px;
  margin: -5px 0 0 0;
}

/* ----- BOTTOM LEFT radar ----- */
#hud-bl {
  position: absolute;
  left: 1.4%;
  bottom: 2.2%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.85rem 0.55rem 0.55rem;
  z-index: 5;
  min-width: min(340px, 24vw);
}
#radar {
  width: 78px; height: 78px;
  flex: 0 0 78px;
}
.rad-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: clamp(10px, 0.85vw, 13px);
  color: var(--gold-hot);
  margin-bottom: 0.18rem;
}
.rad-line {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: clamp(10px, 0.78vw, 12px);
  color: #d0d8d0;
}
.rad-line .ok { color: var(--cyan); }
.rad-line .warn { color: #e8c24a; }
.rad-grid {
  margin-top: 0.2rem;
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(8px, 0.65vw, 10px);
  letter-spacing: 0.08em;
  color: #8aa0a4;
}

/* ----- BOTTOM CENTER abilities ----- */
#hud-bc {
  position: absolute;
  left: 50%;
  bottom: 2.3%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.38rem;
  z-index: 5;
  background: rgba(8, 12, 16, 0.82);
  border: 1.5px solid var(--gold-line);
  border-radius: 10px;
  padding: 0.38rem 0.45rem;
}
.slot {
  width: 86px;
  height: 78px;
  background: #101418;
  border: 1.5px solid rgba(201, 164, 74, 0.55);
  border-radius: 8px;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
  font-family: "Rajdhani", sans-serif;
}
.slot img {
  width: 28px; height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(240, 200, 80, 0.35));
}
.slot-key {
  position: absolute;
  top: 4px; left: 6px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #c8c0a8;
  font-family: "Orbitron", sans-serif;
}
.slot-name {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 10px;
  text-align: center;
  line-height: 1.15;
  color: #e8e0c8;
}
.slot-name b { color: var(--gold-hot); }
.slot-name.gold { color: var(--gold-hot); font-size: 9px; }
.slot.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(58, 214, 228, 0.45), inset 0 0 10px rgba(58, 214, 228, 0.12);
}
.slot.selected .slot-name { color: var(--cyan-hot); }
.slot.cool { opacity: 0.55; }
.slot:hover { filter: brightness(1.12); }

/* ----- BOTTOM RIGHT rewind ----- */
#hud-br {
  position: absolute;
  right: 1.4%;
  bottom: 2.2%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.9rem 0.55rem 0.55rem;
  z-index: 5;
  min-width: min(390px, 28vw);
  background: rgba(6, 28, 34, 0.82);
}
.rw-dial {
  position: relative;
  width: 78px; height: 78px;
  flex: 0 0 78px;
}
#rewind-dial { position: absolute; inset: 0; width: 78px; height: 78px; }
.rw-dial-lab {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.rw-sec {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--cyan-hot);
  letter-spacing: 0.02em;
}
.rw-sub {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--cyan);
}
.rw-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.rw-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: clamp(11px, 0.95vw, 15px);
  color: var(--cyan-hot);
}
.rw-ready {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 10px;
  color: var(--cyan);
}
.rw-ready.cool { color: #7a9094; }
.rw-hint {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: #b8d0d4;
  margin: 0.15rem 0 0.35rem;
}
.rw-hint kbd {
  display: inline-block;
  border: 1px solid rgba(58, 214, 228, 0.55);
  padding: 0 0.35rem;
  border-radius: 3px;
  color: var(--cyan-hot);
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
}
.rw-tl {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  color: var(--cyan);
}
.rw-track {
  position: relative;
  flex: 1;
  height: 7px;
  background: #082028;
  border-radius: 3px;
  overflow: visible;
}
.rw-track i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0a6878, #3ad6e4);
  border-radius: 3px;
}
.rw-event {
  position: absolute;
  left: 38%;
  top: -14px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #d8f6f8;
  white-space: nowrap;
}
.rw-now { color: var(--cyan-hot); letter-spacing: 0.1em; }

/* ----- veils ----- */
#rewind-veil {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(40, 200, 220, 0.18), rgba(6, 20, 30, 0.45));
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.12s;
}
#hitflash {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 50% 80%, rgba(220, 40, 40, 0.35), transparent 55%);
  opacity: 0;
}
#banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--gold-hot);
  background: rgba(10, 12, 16, 0.72);
  border: 1px solid var(--gold-line);
  padding: 0.45rem 1.2rem;
  border-radius: 6px;
  pointer-events: none;
}
#pause {
  position: absolute; inset: 0; z-index: 9;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 12, 0.55);
  font-family: "Cinzel", serif;
  letter-spacing: 0.4em;
  font-size: 28px;
  color: var(--cream);
}
#hint {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: rgba(200, 220, 220, 0.7);
  pointer-events: none;
}
#hud ~ #hint, #hud:not(.hidden) ~ #hint { display: none; }
#menu:not(.hidden) ~ #hint { display: none; }

/* ----- 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(8, 28, 40, 0.55), rgba(4, 8, 14, 0.78));
}
.menu-card {
  width: min(720px, 92vw);
  background: rgba(8, 12, 18, 0.92);
  border: 1.6px solid var(--gold-line);
  border-radius: 14px;
  padding: 1.4rem 1.6rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 40px rgba(201,164,74,0.06);
}
.menu-blurb {
  margin: 0.9rem auto 0.8rem;
  max-width: 560px;
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: #d0d8d4;
}
.menu-blurb b { color: var(--gold-hot); }
.menu-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.4rem;
  margin: 0.4rem 0 1rem;
  min-height: 110px;
}
.menu-art img {
  height: 108px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.45));
}
#btn-play, #btn-again {
  pointer-events: auto;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 14px;
  color: #0a1014;
  background: linear-gradient(180deg, #f0d48a, #c9a44a);
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1.6rem;
  box-shadow: 0 0 18px rgba(201, 164, 74, 0.35);
}
#btn-play:hover, #btn-again:hover { filter: brightness(1.08); }
.menu-controls {
  margin-top: 0.9rem;
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  color: #9aa8a8;
  letter-spacing: 0.04em;
  line-height: 1.55;
}
.menu-controls kbd {
  display: inline-block;
  border: 1px solid rgba(201,164,74,0.5);
  padding: 0 0.3rem;
  border-radius: 3px;
  color: var(--gold-hot);
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1.2rem;
  margin: 1rem auto 1.1rem;
  max-width: 420px;
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  color: #c8d0cc;
}
.res-grid b {
  display: block;
  font-family: "Orbitron", sans-serif;
  color: var(--gold-hot);
  font-size: 18px;
  margin-top: 2px;
}

@media (max-width: 900px) {
  #hud-tl, #hud-tr { width: 42vw; }
  .slot { width: 70px; height: 68px; }
  .title-word { letter-spacing: 0.12em; }
}
