:root {
  --navy: #0a0818;
  --panel: rgba(8, 12, 32, 0.55);
  --cyan: #4ae0ee;
  --cyan-hot: #8af6ff;
  --cyan-deep: #1ad0e8;
  --orange: #f28a53;
  --orange-hot: #ffb060;
  --gold: #fad78c;
  --green: #6cff6a;
  --green-dim: #3ad848;
  --white: #f4fbff;
  --muted: #c8d0e8;
  --alert: #ff6a7a;
  --magenta: #e85cff;
  --night: #0c1a47;
}

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

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

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

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

#loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0818;
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.22em;
  font-size: 13px;
  font-weight: 700;
}

#vignette, #hit-flash, #night-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
#vignette {
  background: radial-gradient(ellipse at 50% 58%, transparent 42%, rgba(8, 6, 22, 0.55) 100%);
  opacity: 0.85;
}
#hit-flash {
  background: rgba(255, 40, 70, 0.32);
  opacity: 0;
}
#night-wash {
  background: linear-gradient(90deg, rgba(255, 140, 60, 0.0) 0%, rgba(20, 30, 90, 0.18) 70%, rgba(8, 16, 60, 0.28) 100%);
  opacity: 0.35;
  transition: opacity 0.8s linear;
}

#popup-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  overflow: hidden;
}
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 10px rgba(74, 224, 238, 0.8);
  animation: popUp 0.7s ease-out forwards;
  white-space: nowrap;
}
.pop.gold { color: #ffe080; text-shadow: 0 0 10px rgba(255, 180, 40, 0.8); }
.pop.green { color: #7cff88; text-shadow: 0 0 10px rgba(80, 255, 120, 0.8); }
.pop.red { color: #ff8aa0; text-shadow: 0 0 10px rgba(255, 60, 80, 0.8); }
@keyframes popUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}

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

#hud-tl {
  position: absolute;
  top: 18px;
  left: 22px;
}
.title-lockup { line-height: 0.92; }
.title-row { display: flex; align-items: center; gap: 10px; }
.title-cyan {
  font-family: "Russo One", "Orbitron", sans-serif;
  font-size: 34px;
  letter-spacing: 0.04em;
  color: #8af6ff;
  -webkit-text-stroke: 4px #102040;
  paint-order: stroke fill;
  text-shadow:
    0 0 0 #102040,
    3px 4px 0 #0a1838,
    0 0 16px rgba(74, 224, 238, 0.55);
  font-weight: 400;
}
.title-orange {
  font-family: "Russo One", "Orbitron", sans-serif;
  font-size: 34px;
  letter-spacing: 0.06em;
  color: #ffb060;
  -webkit-text-stroke: 4px #102040;
  paint-order: stroke fill;
  text-shadow:
    3px 4px 0 #0a1838,
    0 0 16px rgba(255, 140, 60, 0.45);
}
.score-word { margin-top: 2px; }
.paw {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255, 160, 60, 0.7));
  margin-left: 4px;
}
.score-block { margin-top: 14px; }
.score-line, .high-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.lab {
  font-family: "Exo 2", "Rajdhani", sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 0 #102040, 0 0 8px rgba(0,0,0,0.5);
}
.lab.dim { color: #e8eef8; opacity: 0.95; font-size: 16px; }
.val {
  font-family: "Exo 2", "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.02em;
}
.val.cyan {
  color: #5ef0ff;
  text-shadow: 0 0 12px rgba(74, 224, 238, 0.7);
  font-size: 30px;
}
.val.white { color: #fff; font-size: 18px; letter-spacing: 0.04em; }
.high-line { margin-top: 2px; }

#hud-tr {
  position: absolute;
  top: 16px;
  right: 22px;
  text-align: right;
  min-width: 260px;
}
.batt-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.batt-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 0 #102040;
}
.batt-pct {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--green);
  text-shadow: 0 0 10px rgba(80, 255, 100, 0.55);
}
.batt-pct.warn { color: #ffd24a; text-shadow: 0 0 10px rgba(255, 200, 40, 0.55); }
.batt-pct.low { color: #ff6a7a; text-shadow: 0 0 10px rgba(255, 60, 80, 0.55); }

.batt-icon {
  position: relative;
  width: 64px;
  height: 32px;
  border: 3px solid #3ee87a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px 4px 5px;
  box-shadow: 0 0 10px rgba(80, 255, 120, 0.35);
  background: rgba(6, 20, 18, 0.35);
}
.batt-icon::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 8px;
  width: 5px;
  height: 14px;
  background: #3ee87a;
  border-radius: 0 3px 3px 0;
}
.batt-icon .bar {
  flex: 1;
  height: 100%;
  background: linear-gradient(180deg, #b8ff90, #3ee05a);
  border-radius: 2px;
  opacity: 0.22;
}
.batt-icon .bar.on { opacity: 1; }
.batt-icon.warn { border-color: #ffd24a; box-shadow: 0 0 10px rgba(255, 200, 40, 0.35); }
.batt-icon.warn::after { background: #ffd24a; }
.batt-icon.warn .bar.on { background: linear-gradient(180deg, #ffe090, #ffb020); }
.batt-icon.low { border-color: #ff6a7a; box-shadow: 0 0 10px rgba(255, 60, 80, 0.4); }
.batt-icon.low::after { background: #ff6a7a; }
.batt-icon.low .bar.on { background: linear-gradient(180deg, #ffb0b8, #ff4058); }
.batt-icon .bolt {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.batt-icon .bolt::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 10px;
  height: 10px;
  margin-left: -2px;
  background: #fff;
  clip-path: polygon(35% 0, 100% 0, 55% 48%, 90% 48%, 0 100%, 42% 52%, 10% 52%);
  filter: drop-shadow(0 0 4px #fff);
  opacity: 0.95;
}

.shift-meter {
  margin-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
}
.shift-ico {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 220, 80, 0.5));
}
.shift-ico.moon { filter: drop-shadow(0 0 8px rgba(140, 200, 255, 0.7)); }
.gauge {
  position: relative;
  width: 118px;
  height: 64px;
}
.gauge-svg {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 118px;
  height: 64px;
  filter: drop-shadow(0 0 6px rgba(80, 180, 255, 0.35));
}
.gauge-arrow {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 32px solid #3ad0ff;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(-18deg);
  filter: drop-shadow(0 0 6px #3ad0ff);
}
.shift-lab {
  margin-top: 6px;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 0 #102040, 0 0 8px rgba(58, 208, 255, 0.35);
}

#hud-bl {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.combo-ring {
  position: relative;
  width: 92px;
  height: 92px;
  filter: drop-shadow(0 0 10px rgba(58, 208, 255, 0.45));
}
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none;
  stroke: rgba(20, 40, 80, 0.7);
  stroke-width: 10;
}
.ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: #3ad8ff;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 80;
  filter: drop-shadow(0 0 4px #3ad8ff);
}
.combo-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 3px solid rgba(255, 150, 70, 0.85);
  box-shadow: inset 0 0 12px rgba(20, 40, 90, 0.5);
}
.combo-mult {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Exo 2", "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 2px 0 #102040, 0 0 8px rgba(58, 208, 255, 0.6);
}
.combo-copy {
  background: linear-gradient(90deg, #1a2848 0%, #243058 70%, rgba(20, 30, 60, 0) 100%);
  border: 2px solid rgba(80, 140, 220, 0.35);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  padding: 8px 22px 8px 14px;
  margin-left: -8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.combo-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #fff;
}
.combo-num {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: #fff;
}

#hud-br {
  position: absolute;
  right: 18px;
  bottom: 18px;
}
.alert-panel {
  min-width: 340px;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(16, 28, 52, 0.82), rgba(10, 18, 40, 0.78));
  border: 1.6px solid rgba(90, 160, 220, 0.45);
  border-radius: 12px;
  padding: 10px 16px 12px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4), inset 0 0 18px rgba(40, 80, 140, 0.18);
  text-align: left;
}
.alert-line {
  font-family: "Rajdhani", "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #e8eef8;
  line-height: 1.35;
}
.alert-line:first-child { color: #fff; }
#alert-1 { color: #fff; }

/* Menu / pause / results */
#menu, #pause, #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, 30, 70, 0.25), rgba(6, 8, 20, 0.78));
}
.menu-card {
  width: min(720px, 92vw);
  padding: 28px 32px 24px;
  background: rgba(10, 14, 32, 0.88);
  border: 1.6px solid rgba(74, 224, 238, 0.45);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(74, 180, 255, 0.18);
  text-align: center;
}
.menu-card.slim { width: min(420px, 90vw); }
.menu-title { display: inline-block; margin-bottom: 12px; }
.menu-blurb {
  color: #d0d8f0;
  font-size: 16px;
  line-height: 1.45;
  margin: 12px 0 16px;
}
.menu-blurb b { color: var(--cyan-hot); }
.menu-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  height: 140px;
  margin-bottom: 16px;
}
.menu-art img {
  max-height: 110px;
  max-width: 140px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}
.menu-art img.hero { max-height: 138px; }
#btn-play, #btn-again, #btn-resume {
  background: linear-gradient(180deg, #5ef0ff, #1ab8e0);
  color: #081428;
  border: 0;
  border-radius: 10px;
  padding: 12px 28px;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
  box-shadow: 0 0 22px rgba(74, 224, 238, 0.45);
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover { filter: brightness(1.12); }
.menu-controls {
  margin-top: 14px;
  color: #9aa8c8;
  font-size: 13px;
  line-height: 1.6;
}
.menu-controls kbd {
  display: inline-block;
  background: #e8eef4;
  color: #0a1820;
  font-family: "Rajdhani", sans-serif;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  margin: 0 2px;
}
.menu-sub {
  color: var(--cyan);
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-bottom: 12px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 16px 0 18px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #b8c0d8;
}
.res-grid b {
  display: block;
  font-family: "Orbitron", sans-serif;
  color: #fff;
  font-size: 20px;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .title-cyan, .title-orange { font-size: 22px; -webkit-text-stroke-width: 3px; }
  .alert-panel { min-width: 240px; }
  .combo-ring { width: 72px; height: 72px; }
  .paw { width: 26px; height: 26px; }
}
