:root {
  --cyan: #5cefff;
  --cyan-hot: #9af6ff;
  --cyan-deep: #14c8e0;
  --magenta: #ff4d9a;
  --magenta-hot: #ff79c2;
  --pink: #ff5ab8;
  --gold: #f0d060;
  --gold-2: #e8b83a;
  --orange: #ff8c3a;
  --navy: #070414;
  --panel: rgba(10, 6, 22, 0.82);
  --panel-2: rgba(8, 6, 20, 0.9);
  --white: #f7fbff;
}

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

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

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

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

.hidden { display: none !important; }

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

#float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.floater {
  position: absolute;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  pointer-events: none;
  font-family: "Orbitron", "Audiowide", sans-serif;
  letter-spacing: 0.04em;
  font-weight: 800;
  text-shadow: 0 0 12px #5cefff, 0 2px 0 #001018;
  color: #9af6ff;
}
.floater.sip { color: #5cefff; font-size: 22px; }
.floater.bean { color: #f0d060; font-size: 16px; text-shadow: 0 0 10px #e8b83a; }
.floater.hurt { color: #ff4d9a; font-size: 18px; text-shadow: 0 0 10px #ff4d9a; }

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

.panel {
  background: linear-gradient(180deg, rgba(16, 10, 32, 0.88), rgba(8, 4, 18, 0.92));
  border-radius: 18px;
  padding: 12px 16px 12px 18px;
  box-shadow:
    0 0 0 1px rgba(92, 239, 255, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ===== TOP LEFT ===== */
#hud-tl {
  position: absolute;
  top: 18px;
  left: 18px;
}
.panel-score {
  min-width: 340px;
  overflow: visible;
  border: 1.5px solid rgba(92, 239, 255, 0.45);
  border-bottom-color: rgba(255, 77, 154, 0.55);
  box-shadow:
    0 0 18px rgba(92, 239, 255, 0.18),
    0 0 0 1px rgba(255, 77, 154, 0.18),
    inset 0 0 24px rgba(92, 239, 255, 0.05);
}
.score-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
}
.lab-cyan { color: var(--cyan); text-shadow: 0 0 8px #14c8e0; }
.lab-gold { color: var(--gold); letter-spacing: 0.1em; }
.score-num {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 900;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #f4fdff;
  text-shadow: 0 0 14px rgba(92, 239, 255, 0.65), 0 2px 0 #082028;
}
.score-pills {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  align-items: center;
}
.pill-mag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #ff3d8a, #ff5ab8);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(255, 77, 154, 0.45);
}
.pill-mag img.ico-bolt {
  width: 14px;
  height: 16px;
  filter: brightness(2) saturate(0);
}
.pill-bean {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
}
.pill-bean img { width: 16px; height: 18px; }

/* ===== TITLE ===== */
#hud-title {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(28, 16, 8, 0.92), rgba(10, 6, 14, 0.95));
  border: 2px solid #e8c24a;
  box-shadow:
    0 0 16px rgba(240, 208, 96, 0.45),
    inset 0 0 18px rgba(240, 180, 40, 0.12);
}
.title-badge.big { padding: 10px 32px; }
.title-cup { width: 22px; height: 16px; object-fit: contain; filter: drop-shadow(0 0 4px #f0d060); }
.title-loop {
  color: #d8d0c8;
  font-size: 16px;
  font-weight: 700;
}
.title-word {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 18px;
  background: linear-gradient(180deg, #fff6c8, #f0d060 40%, #c88820);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 8px rgba(240, 208, 96, 0.55));
}
.loop-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(92, 239, 255, 0.7);
  background: rgba(6, 10, 24, 0.72);
  color: var(--cyan-hot);
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  box-shadow: 0 0 12px rgba(92, 239, 255, 0.25);
}
.loop-pill .dot { opacity: 0.6; }
.loop-pill .timer {
  color: #ff4d9a;
  font-weight: 700;
  margin-left: 6px;
}

/* ===== TOP RIGHT ===== */
#hud-tr {
  position: absolute;
  top: 18px;
  right: 18px;
}
.panel-fuel {
  min-width: 340px;
  border: 1.5px solid rgba(92, 239, 255, 0.4);
  border-bottom-color: rgba(255, 77, 154, 0.5);
}
.fuel-lab {
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
}
.fuel-lab b { color: #fff; }
.fuel-track {
  margin: 8px 4px 10px;
  height: 10px;
  border-radius: 999px;
  background: #0a0610;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}
.fuel-track i {
  display: block;
  height: 100%;
  width: 68%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3ee8ff 0%, #ff5ab8 55%, #ff8c3a 100%);
  box-shadow: 0 0 10px rgba(255, 90, 184, 0.55);
  transition: width 0.15s linear;
}
.shield-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}
.shield-lab {
  color: #c8c0d8;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
}
.hearts { display: flex; gap: 6px; }
.heart {
  width: 22px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #ff4d9a);
  transition: filter 0.2s, opacity 0.2s;
}
.heart:not(.on) {
  opacity: 0.22;
  filter: grayscale(1) drop-shadow(0 0 0 transparent);
}

/* ===== CENTER SIP ===== */
#hud-sip {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.sip-big {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-shadow: 0 0 16px #14c8e0, 0 0 4px #fff;
}
.sip-sub {
  margin-top: 4px;
  font-size: 14px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: #7ad8e8;
  text-shadow: 0 0 8px #14c8e0;
}

/* ===== PHANTOM WARN ===== */
#hud-warn {
  position: absolute;
  top: 38%;
  right: 22%;
  text-align: left;
}
.warn-pill {
  display: inline-block;
  background: linear-gradient(90deg, #c81858, #ff4d7a);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 0 14px rgba(255, 40, 90, 0.5);
}
.warn-sub {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #d8d0dc;
  font-weight: 700;
}

/* ===== BOTTOM LEFT ===== */
#hud-bl {
  position: absolute;
  bottom: 18px;
  left: 18px;
  pointer-events: auto;
}
.panel-boost {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid rgba(92, 239, 255, 0.55);
  cursor: pointer;
  min-width: 340px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.panel-boost:hover,
.panel-boost.armed {
  box-shadow: 0 0 22px rgba(92, 239, 255, 0.4);
  border-color: var(--cyan);
}
.panel-boost.firing {
  border-color: #ff5ab8;
  box-shadow: 0 0 24px rgba(255, 90, 184, 0.55);
}
.overheat {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}
.oh-svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.oh-bg { fill: none; stroke: rgba(92, 239, 255, 0.18); stroke-width: 6; }
.oh-fg {
  fill: none;
  stroke: #5cefff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 188.4;
  stroke-dashoffset: 188.4;
  filter: drop-shadow(0 0 4px #5cefff);
  transition: stroke-dashoffset 0.12s linear, stroke 0.2s;
}
.oh-txt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  color: var(--cyan);
  line-height: 1.05;
}
.oh-txt b { font-size: 13px; }
.oh-txt small {
  font-size: 7px;
  letter-spacing: 0.08em;
  font-family: "Rajdhani", sans-serif;
  font-weight: 800;
}
.boost-copy { display: flex; flex-direction: column; gap: 6px; }
.boost-title {
  font-family: "Orbitron", sans-serif;
  font-size: 15px;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--cyan-hot);
  text-shadow: 0 0 10px #14c8e0;
}
.boost-sub {
  display: inline-block;
  background: linear-gradient(90deg, #14b8d8, #3ee8ff);
  color: #041018;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ===== BOTTOM CENTER ===== */
#hud-bc {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.sector-pill {
  padding: 6px 22px;
  border-radius: 999px;
  background: rgba(8, 6, 18, 0.88);
  border: 1px solid rgba(240, 208, 96, 0.35);
  color: var(--gold);
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}
.keys-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(8, 6, 18, 0.88);
  border: 1px solid rgba(92, 239, 255, 0.2);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 800;
}
.key-ad { border: 1.5px solid #5cefff; color: #5cefff; }
.key-w { border: 1.5px solid #f0d060; color: #f0d060; background: rgba(240, 208, 96, 0.08); }
.key-sp { border: 1.5px solid #ff5ab8; color: #ff79c2; }
.key-lab { color: #d0d8e8; margin-right: 6px; }

/* ===== BOTTOM RIGHT ===== */
#hud-br {
  position: absolute;
  bottom: 18px;
  right: 18px;
}
.panel-vel {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 230px;
  border: 1.5px solid rgba(240, 208, 96, 0.55);
  box-shadow: 0 0 16px rgba(240, 180, 40, 0.18);
}
.eq {
  width: 46px;
  height: 46px;
  border: 1.5px solid rgba(92, 239, 255, 0.45);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  padding: 6px 4px;
  background: rgba(4, 8, 18, 0.6);
}
.eq i {
  width: 6px;
  border-radius: 2px;
  display: block;
  animation: eq 0.6s ease-in-out infinite alternate;
}
.eq i:nth-child(1) { height: 40%; background: #5cefff; animation-delay: 0s; }
.eq i:nth-child(2) { height: 70%; background: #ff5ab8; animation-delay: 0.15s; }
.eq i:nth-child(3) { height: 50%; background: #5cefff; animation-delay: 0.3s; }
@keyframes eq {
  from { transform: scaleY(0.45); }
  to { transform: scaleY(1); }
}
.vel-lab {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 800;
}
.vel-num {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 32px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 12px rgba(240, 208, 96, 0.4);
}
.vel-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #c8b090;
  font-weight: 700;
}

/* ===== MENU / RESULTS ===== */
#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, 8, 36, 0.35), rgba(4, 2, 10, 0.72));
}
.menu-card {
  width: min(560px, 92vw);
  padding: 28px 32px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(16, 10, 32, 0.92), rgba(8, 4, 18, 0.95));
  border: 1.5px solid rgba(240, 208, 96, 0.45);
  box-shadow: 0 0 40px rgba(240, 180, 40, 0.12), 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.menu-card.thin { width: min(360px, 90vw); }
.menu-art {
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 8px;
}
.menu-art img { height: 170px; width: auto; filter: drop-shadow(0 8px 18px rgba(92, 239, 255, 0.35)); }
.menu-sub {
  margin-top: 10px;
  color: var(--cyan);
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
}
.menu-blurb {
  margin: 14px 0 18px;
  color: #d0c8dc;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
}
.menu-blurb b { color: var(--gold); }
#btn-play, #btn-again, #btn-resume {
  display: inline-block;
  padding: 12px 36px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a, #e8b83a 60%, #c88818);
  color: #1a1004;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 15px;
  box-shadow: 0 0 18px rgba(240, 208, 96, 0.45);
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover { filter: brightness(1.08); }
.menu-controls {
  margin-top: 16px;
  font-size: 13px;
  color: #b8b0c8;
  line-height: 1.6;
  font-weight: 600;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(92, 239, 255, 0.5);
  border-radius: 4px;
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 18px 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #c8c0d8;
  font-weight: 700;
}
.res-grid b {
  display: block;
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  color: var(--gold);
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .score-num { font-size: 36px; }
  .panel-score { min-width: 260px; }
  .panel-fuel { min-width: 280px; }
  .title-word { font-size: 14px; letter-spacing: 0.12em; }
  .vel-num { font-size: 24px; }
}
@media (max-width: 760px) {
  #hud-tl, #hud-tr, #hud-bl, #hud-br { transform: scale(0.82); transform-origin: top left; }
  #hud-tr { transform: scale(0.82); transform-origin: top right; }
  #hud-bl { transform: scale(0.82); transform-origin: bottom left; }
  #hud-br { transform: scale(0.82); transform-origin: bottom right; }
  .title-word { font-size: 12px; }
}
