:root {
  --gold: #e8c84a;
  --gold-hot: #ffe07a;
  --indigo: #2a1b6e;
  --cyan: #3ee8e0;
  --cyan-hot: #7af6f0;
  --ink: #2e9bdb;
  --hp0: #e85a2a;
  --hp1: #f5c542;
  --purple: #6b3ab8;
  --sky: #3d2466;
  --navy: #12081f;
  --white: #f4f0e8;
}

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

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

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

#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: "Cinzel", "Exo 2", serif;
  letter-spacing: 0.04em;
  font-weight: 800;
  font-size: 16px;
  color: #ffe07a;
  text-shadow: 0 0 10px #e8c84a, 0 2px 0 #1a0a10;
}
.floater.dmg { color: #ffd36a; font-size: 18px; }
.floater.ink { color: #7af6f0; font-size: 16px; text-shadow: 0 0 12px #3ee8e0; }
.floater.combo {
  color: #ffe07a;
  font-size: 22px;
  font-family: "Rowdies", "Russo One", sans-serif;
  text-shadow: 0 0 12px #e8c84a;
}

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

#hud-tl {
  position: absolute;
  left: 1.4%;
  top: 1.5%;
  width: min(430px, 36vw);
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.stat-ico {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(0,0,0,0.8));
  flex: 0 0 36px;
}

.stat-col { flex: 1; min-width: 0; }

.stat-lab-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
  padding: 0 4px;
}

.stat-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #efe8d8;
  text-shadow: 0 1px 0 #12081f, 0 0 8px rgba(0,0,0,0.8);
}

.stat-pct {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: #efe8d8;
  text-shadow: 0 1px 0 #12081f;
}

.bar-track {
  height: 16px;
  border-radius: 4px;
  background: #0a0610;
  box-shadow: 0 0 0 2px #1a1210, inset 0 0 0 1px #000;
  overflow: hidden;
  position: relative;
}
.bar-track i {
  display: block;
  height: 100%;
  width: 78%;
  border-radius: 3px;
}
.bar-track.hp i {
  background: linear-gradient(90deg, #c43a18 0%, #e85a2a 35%, #f5a623 78%, #f5c542 100%);
  box-shadow: 0 0 10px rgba(232, 90, 42, 0.55);
}
.bar-track.ink i {
  background: linear-gradient(90deg, #1568a8 0%, #2e9bdb 40%, #4fc3f7 78%, #7af0ff 100%);
  box-shadow: 0 0 10px rgba(46, 155, 219, 0.55);
}

#combo-block {
  margin-top: 10px;
  margin-left: 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  filter: drop-shadow(0 3px 0 #12081f);
}
#combo-x {
  font-family: "Rowdies", "Russo One", sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 4.6vw, 58px);
  color: #f5c542;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-shadow: 0 0 2px #12081f, 3px 3px 0 #12081f, 0 0 18px #e8c84a;
  -webkit-text-stroke: 2px #12081f;
}
#combo-word {
  font-family: "Exo 2", sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 38px);
  color: #f4f0e8;
  letter-spacing: 0.02em;
  text-shadow: 3px 3px 0 #12081f, 0 0 12px rgba(0,0,0,0.7);
}

/* Top center */
#hud-tc {
  position: absolute;
  left: 50%;
  top: 0.6%;
  transform: translateX(-50%);
  text-align: center;
  width: min(420px, 42vw);
}

#hud-timer {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 30px);
  color: #f5c542;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 #12081f, 0 0 12px #e8c84a;
}

#cycle-wrap {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cycle-lab {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #efe8d8;
  text-shadow: 0 1px 3px #12081f;
  margin-bottom: 2px;
}

#cycle-dial {
  width: 78px;
  height: 78px;
  position: relative;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
}
#cycle-img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
}
#cycle-needle {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 12px solid #f5c542;
  transform: translateX(-50%);
  filter: drop-shadow(0 1px 0 #12081f);
}

#cycle-phase {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #efe8d8;
  text-shadow: 0 1px 3px #12081f;
  margin-top: 1px;
}

#title-word {
  margin-top: 4px;
  font-family: "Cinzel", "Cinzel Decorative", serif;
  font-weight: 800;
  font-size: clamp(22px, 2.6vw, 32px);
  color: #f4f0e8;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 2px #12081f,
    0 3px 0 #12081f,
    0 0 16px rgba(232, 200, 74, 0.45),
    0 0 28px rgba(180, 80, 255, 0.35);
}

/* Top right */
#hud-tr {
  position: absolute;
  right: 1.6%;
  top: 1.4%;
  text-align: right;
}

#score-line {
  font-family: "Exo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 2.2vw, 28px);
  color: #efe8d8;
  text-shadow: 0 2px 0 #12081f, 0 0 10px rgba(0,0,0,0.6);
}

.vial-lab {
  margin-top: 6px;
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #efe8d8;
  text-shadow: 0 1px 3px #12081f;
}

#vial-row {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.vial {
  width: 34px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7));
  transition: filter 0.2s, opacity 0.2s, transform 0.2s;
}
.vial.off {
  opacity: 0.32;
  filter: grayscale(0.4) brightness(0.7) drop-shadow(0 2px 4px rgba(0,0,0,0.7));
}
.vial.on {
  opacity: 1;
  transform: scale(1.08);
  filter: drop-shadow(0 0 8px rgba(80, 200, 255, 0.8));
}

/* Bottom ability bar */
#hud-bc {
  position: absolute;
  left: 50%;
  bottom: 1.6%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  pointer-events: auto;
}

.ab {
  position: relative;
  width: 86px;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ab img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.75));
  border-radius: 6px;
}
.ab .ab-cd {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 72px;
  border-radius: 6px;
  background: rgba(8, 4, 16, 0.55);
  pointer-events: none;
  display: none;
}
.ab.cooling .ab-cd { display: block; }
.ab.active img {
  box-shadow: 0 0 0 2px #e8c84a, 0 0 16px rgba(232, 200, 74, 0.7);
  border-radius: 6px;
}
.ab-name {
  font-family: "Exo 2", sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #efe8d8;
  text-shadow: 0 2px 0 #12081f, 0 0 8px #12081f;
  white-space: nowrap;
}
.ab:hover img { filter: drop-shadow(0 0 10px rgba(232, 200, 74, 0.7)) brightness(1.08); }

#banner {
  position: absolute;
  left: 50%;
  top: 36%;
  transform: translateX(-50%);
  z-index: 12;
  font-family: "Cinzel", serif;
  font-weight: 800;
  font-size: clamp(22px, 3.2vw, 38px);
  letter-spacing: 0.14em;
  color: #f5c542;
  text-shadow: 0 0 16px #e8c84a, 0 0 32px #6b3ab8, 0 3px 0 #12081f;
  pointer-events: none;
  text-align: center;
}
#pause {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(10, 4, 22, 0.5);
  font-family: "Cinzel", serif;
  font-size: 42px;
  letter-spacing: 0.4em;
  color: #f5c542;
  text-shadow: 0 0 18px #e8c84a;
}

/* ========== MENU / RESULTS ========== */
#menu, #results {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, rgba(90, 40, 140, 0.42), rgba(10, 4, 22, 0.62) 58%);
}

.menu-card {
  width: min(640px, 92vw);
  padding: 28px 36px 32px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 12, 42, 0.82), rgba(10, 6, 24, 0.88));
  box-shadow: 0 0 0 1px rgba(232, 200, 74, 0.35), 0 0 40px rgba(80, 40, 180, 0.4);
  text-align: center;
}

.menu-title {
  font-family: "Cinzel", "Cinzel Decorative", serif;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 42px);
  color: #f4f0e8;
  text-shadow: 0 0 16px rgba(232, 200, 74, 0.55), 0 3px 0 #12081f;
}
.menu-title.sm { font-size: 26px; }

.menu-sub {
  font-family: "Exo 2", sans-serif;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: #e8c84a;
  text-shadow: 0 0 10px #e8c84a;
  margin: 6px 0 10px;
}

.menu-art {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 12px;
}
#menu-hero {
  height: 176px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(62, 232, 224, 0.65));
}

.menu-blurb {
  font-size: 15px;
  line-height: 1.45;
  color: #d8d0e8;
  margin: 0 auto 18px;
  max-width: 520px;
}
.menu-blurb b { color: #f5c542; }

#btn-play, #btn-again {
  pointer-events: auto;
  border: 0;
  padding: 12px 36px;
  border-radius: 999px;
  font-family: "Cinzel", serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: #12081f;
  background: linear-gradient(90deg, #f5c542, #e8c84a 40%, #3ee8e0);
  box-shadow: 0 0 22px rgba(232, 200, 74, 0.55);
}
#btn-play:hover, #btn-again:hover { filter: brightness(1.08); }

.menu-controls {
  margin-top: 16px;
  font-size: 13px;
  color: #b8a8d0;
  line-height: 1.55;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(232, 200, 74, 0.12);
  box-shadow: 0 0 0 1px rgba(232, 200, 74, 0.35);
  font-family: "Exo 2", monospace;
  font-size: 11px;
  color: #f5c542;
}

.title-word {
  font-family: "Cinzel", serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.14em;
  color: #f5c542;
  text-shadow: 0 0 14px #e8c84a;
  margin: 8px 0 4px;
}

.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin: 18px 0 22px;
  font-family: "Exo 2", sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #c8b8d8;
}
.res-grid b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  color: #f5c542;
  text-shadow: 0 0 10px #e8c84a;
}

@media (max-width: 820px) {
  #hud-tl { transform: scale(0.86); transform-origin: top left; }
  #combo-x { font-size: 34px; }
  .ab { width: 68px; }
  .ab img { width: 56px; height: 56px; }
}
