:root {
  --orange: #ff7a22;
  --orange-hot: #ff9a3a;
  --orange-deep: #e85a10;
  --cyan: #3ee8ff;
  --cyan-hot: #7af4ff;
  --gold: #ffe27a;
  --gold-num: #fff6c8;
  --navy: #0b1018;
  --panel: rgba(12, 16, 24, 0.86);
  --red-glow: #ff3a3a;
  --green: #3dff7a;
  --green-soft: #7cff9a;
  --pink: #ff4d8a;
  --white: #f4f7fb;
}

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

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

#stage {
  position: fixed;
  inset: 0;
  background: #16141f;
}

#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;
  font-size: 15px;
}
.floater.spd { color: #7af4ff; text-shadow: 0 0 12px #3ee8ff, 0 2px 0 #001018; }
.floater.hurt { color: #ff4d4d; text-shadow: 0 0 12px #ff3a3a; font-size: 16px; }
.floater.score { color: #ffe27a; text-shadow: 0 0 10px #c9a020; }
.floater.mug { color: #fff6c8; text-shadow: 0 0 10px #ff9a3a; }

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

/* ========== TOP LEFT ========== */
#hud-tl {
  position: absolute;
  top: 22px;
  left: 22px;
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(42, 22, 10, 0.92), rgba(22, 10, 6, 0.94));
  border: 1.5px solid rgba(255, 122, 34, 0.7);
  border-radius: 18px;
  padding: 7px 10px 7px 12px;
  box-shadow:
    0 0 18px rgba(255, 110, 20, 0.45),
    0 0 40px rgba(255, 90, 10, 0.18),
    inset 0 1px 0 rgba(255, 180, 80, 0.25);
}
.title-loop {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #ff7a22);
}
.title-word {
  font-family: "Audiowide", "Orbitron", sans-serif;
  font-size: 17px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #ffb056;
  text-shadow:
    0 0 8px #ff7a22,
    0 0 18px #ff5a10,
    0 1px 0 #3a1400;
}
.rush-pill {
  margin-left: 6px;
  background: linear-gradient(180deg, #ff8a28, #e85a10);
  color: #fff4e0;
  font-family: "Exo 2", "Rajdhani", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(255, 110, 20, 0.55);
  white-space: nowrap;
}
.title-bar.big {
  padding: 10px 14px;
  justify-content: center;
}
.title-bar.big .title-word { font-size: 22px; }

.vitality-bar {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(14, 16, 24, 0.82);
  border: 1px solid rgba(80, 90, 110, 0.45);
  border-radius: 14px;
  padding: 7px 14px 7px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.vit-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #c8d0dc;
}
.vit-cups {
  display: flex;
  gap: 6px;
  align-items: center;
}
.vit-cups img {
  width: 26px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px #ff7a22);
}
.vit-cups img.off {
  filter: grayscale(1) brightness(0.55) drop-shadow(none);
  opacity: 0.55;
}

/* ========== TOP CENTER ========== */
#hud-tc {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}
.timer-panel {
  min-width: 280px;
  background: linear-gradient(180deg, rgba(6, 28, 36, 0.88), rgba(4, 16, 24, 0.92));
  border: 2px solid #3ee8ff;
  border-radius: 16px;
  padding: 8px 22px 10px;
  text-align: center;
  box-shadow:
    0 0 22px rgba(62, 232, 255, 0.35),
    inset 0 0 24px rgba(62, 232, 255, 0.06);
}
.timer-head {
  font-family: "Exo 2", "Rajdhani", sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #7af4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.dot-cyan {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ee8ff;
  box-shadow: 0 0 8px #3ee8ff;
}
.timer-digits {
  font-family: "Orbitron", "Share Tech Mono", monospace;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 0.08em;
  color: #e8fbff;
  text-shadow: 0 0 14px #3ee8ff, 0 0 4px #fff;
  line-height: 1.15;
  margin: 2px 0 2px;
}
.timer-warn {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #ffb020;
  text-shadow: 0 0 8px #ff8a00;
}
.warn-tri { color: #ffb020; margin-right: 4px; }

/* ========== TOP RIGHT ========== */
#hud-tr {
  position: absolute;
  top: 16px;
  right: 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 310px;
}
.score-panel {
  background: linear-gradient(180deg, rgba(18, 22, 32, 0.9), rgba(10, 12, 20, 0.94));
  border: 1.5px solid #c9a24a;
  border-radius: 16px;
  padding: 8px 16px 8px 18px;
  box-shadow: 0 0 16px rgba(201, 162, 74, 0.22);
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.score-num {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #fff6c8;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px #ffe27a;
}
.score-meta { text-align: right; }
.score-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #ffe27a;
}
.loop-mult {
  margin-top: 3px;
  display: inline-block;
  background: #1a1408;
  border: 1px solid #c9a24a;
  color: #ffe27a;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 6px;
}
.order-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(22, 16, 12, 0.92), rgba(12, 10, 10, 0.94));
  border: 1px solid rgba(80, 70, 60, 0.5);
  border-radius: 14px;
  padding: 8px 14px 8px 0;
  overflow: hidden;
  position: relative;
}
.order-accent {
  width: 6px;
  align-self: stretch;
  background: linear-gradient(180deg, #ff8a28, #e85a10);
  box-shadow: 0 0 10px #ff7a22;
  margin-right: 4px;
}
.order-ico {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px #ff9a3a);
}
.order-title {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #fff0d8;
}
.order-sub {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #c8b8a0;
}

/* ========== WORLD LABELS ========== */
.world-label {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  white-space: nowrap;
  font-family: "Exo 2", "Rajdhani", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.sentry-hp {
  background: linear-gradient(180deg, #3a1018, #22080e);
  border: 1.5px solid #ff3a4a;
  color: #ffd0d4;
  font-size: 11px;
  padding: 4px 10px 8px;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(255, 50, 60, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hp-txt { white-space: nowrap; }
.hp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3a4a;
  box-shadow: 0 0 6px #ff3a4a;
}
.hp-track {
  display: block;
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 3px;
  background: #2a1014;
  border-radius: 2px;
  overflow: hidden;
}
.hp-track b {
  display: block;
  height: 100%;
  width: 78%;
  background: linear-gradient(90deg, #ff7a20, #ff3a3a);
}
.chrono-spd {
  background: rgba(8, 28, 36, 0.88);
  border: 1.5px solid #3ee8ff;
  color: #7af4ff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(62, 232, 255, 0.4);
}
.dmg-tag {
  background: linear-gradient(180deg, #5a1018, #3a080c);
  border: 1.5px solid #ff3a3a;
  color: #ffd0d0;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 0 14px rgba(255, 40, 40, 0.5);
  letter-spacing: 0.06em;
}

/* ========== BOTTOM LEFT INFUSIONS ========== */
#hud-bl {
  position: absolute;
  left: 18px;
  bottom: 18px;
}
.infusion-panel {
  width: 420px;
  background: linear-gradient(180deg, rgba(28, 12, 10, 0.92), rgba(14, 8, 8, 0.94));
  border: 2px solid #ff3a3a;
  border-radius: 16px;
  padding: 12px 14px 12px 14px;
  box-shadow:
    0 0 22px rgba(255, 50, 40, 0.4),
    inset 0 0 28px rgba(255, 40, 20, 0.08);
}
.inf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.inf-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: #ff4a4a;
  text-shadow: 0 0 10px #ff3a3a;
}
.inf-bolt {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px #ff4a4a);
}
.perk-pill {
  background: #3a2208;
  border: 1px solid #c97820;
  color: #ffd080;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: 8px;
}
.perk {
  background: rgba(10, 8, 8, 0.45);
  border-radius: 8px;
  padding: 7px 10px 8px;
  margin-bottom: 6px;
}
.perk-on {
  background: rgba(40, 28, 8, 0.45);
  box-shadow: inset 0 0 0 1px rgba(80, 180, 60, 0.15);
}
.perk-name {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #e8f0e0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.perk-on .perk-name { color: #b8ff90; }
.perk-caret { color: #7cff9a; }
.lvl { color: #9ad070; font-size: 12px; }
.perk-ico {
  width: 14px;
  height: 14px;
  object-fit: contain;
}
.perk-up {
  color: #3dff7a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.perk-dn {
  color: #ff4a4a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tox-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #d8c8b0;
}
.tox-val { color: #ff9a3a; }
.tox-track {
  margin-top: 4px;
  height: 8px;
  background: #2a2420;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.tox-track i {
  display: block;
  height: 100%;
  width: 74%;
  background: repeating-linear-gradient(
    -55deg,
    #ff9a20 0 8px,
    #ff4a20 8px 16px
  );
  box-shadow: 0 0 8px #ff6a20;
}

/* ========== BOTTOM RIGHT KEYS ========== */
#hud-br {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.keys-panel {
  display: flex;
  gap: 14px;
  background: rgba(10, 14, 24, 0.88);
  border: 1px solid rgba(50, 70, 90, 0.45);
  border-radius: 18px;
  padding: 12px 18px 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}
.key-slot { cursor: pointer; }
.key-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 88px;
}
.keycap {
  font-family: "Orbitron", "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 18px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid;
  background: rgba(8, 16, 24, 0.7);
  margin-bottom: 6px;
}
.keycap.wide { width: 92px; font-size: 16px; }
.key-cyan { color: #3ee8ff; border-color: #3ee8ff; box-shadow: 0 0 10px rgba(62, 232, 255, 0.35); }
.key-orange { color: #ff9a3a; border-color: #ff9a3a; box-shadow: 0 0 10px rgba(255, 154, 58, 0.35); }
.key-teal { color: #3ee8d0; border-color: #3ee8d0; box-shadow: 0 0 10px rgba(62, 232, 208, 0.35); }
.key-blue { color: #4aa8ff; border-color: #4aa8ff; box-shadow: 0 0 10px rgba(74, 168, 255, 0.35); }
.keycap.flash {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.96);
}
.key-name {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #d0d8e4;
  text-align: center;
}
.key-st {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.key-st.ready { color: #3dff7a; }
.key-st.cd { color: #ff9a3a; }
.key-st.jump { color: #4aa8ff; }

.engine-foot {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #6a7484;
  padding-right: 6px;
}

/* ========== 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 center, rgba(20, 16, 28, 0.55), rgba(8, 8, 14, 0.78));
  pointer-events: auto;
}
.menu-card {
  width: min(560px, 92vw);
  background: linear-gradient(180deg, rgba(22, 16, 14, 0.94), rgba(10, 8, 12, 0.96));
  border: 1.5px solid rgba(255, 122, 34, 0.55);
  border-radius: 22px;
  padding: 22px 26px 24px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 90, 20, 0.22), 0 20px 50px rgba(0, 0, 0, 0.5);
}
.menu-card.thin { width: min(360px, 90vw); padding: 28px; }
.menu-art img {
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  margin-bottom: 10px;
}
.menu-sub {
  margin-top: 10px;
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: #7af4ff;
}
.menu-blurb {
  margin: 14px 0 18px;
  font-size: 15px;
  line-height: 1.45;
  color: #d8dce8;
  font-weight: 600;
}
.menu-blurb b { color: #ffb056; }
#btn-play, #btn-again, #btn-resume {
  pointer-events: auto;
  background: linear-gradient(180deg, #ff9a3a, #e85a10);
  border: 0;
  color: #fff8ec;
  font-family: "Audiowide", "Exo 2", sans-serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  padding: 12px 28px;
  border-radius: 14px;
  box-shadow: 0 0 18px rgba(255, 110, 20, 0.5);
}
#btn-play:hover, #btn-again:hover, #btn-resume:hover {
  filter: brightness(1.08);
}
.menu-controls {
  margin-top: 16px;
  font-size: 13px;
  color: #a8b0c0;
  line-height: 1.7;
  font-weight: 600;
}
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 4px;
  border: 1px solid #3ee8ff;
  color: #7af4ff;
  font-family: "Orbitron", monospace;
  font-size: 11px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 18px 0;
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #c8d0dc;
}
.res-grid b {
  display: block;
  color: #ffe27a;
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .title-word { font-size: 13px; }
  .timer-digits { font-size: 26px; }
  .infusion-panel { width: 340px; transform: scale(0.9); transform-origin: bottom left; }
  .keys-panel { transform: scale(0.88); transform-origin: bottom right; }
}
