:root {
  --c1: #00f5d4;
  --c2: #7b61ff;
  --c3: #ff2e93;
  --bg: #03040a;
  --hud: rgba(8, 14, 28, 0.52);
  --line: rgba(0, 245, 212, 0.28);
  --text: #eef6ff;
  --muted: rgba(200, 220, 255, 0.58);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Display", "Segoe UI", "PingFang SC", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gl {
  z-index: 0;
  opacity: 0.72;
}

#scene {
  z-index: 1;
  cursor: crosshair;
}

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(2, 4, 12, 0.78) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.014) 0px,
      rgba(255, 255, 255, 0.014) 1px,
      transparent 1px,
      transparent 3px
    );
}

.corner {
  position: fixed;
  width: 24px;
  height: 24px;
  z-index: 3;
  pointer-events: none;
  border-color: var(--c1);
  opacity: 0.55;
  transition: all 0.28s ease;
}
.corner.tl { top: 14px; left: 14px; border-top: 1.5px solid; border-left: 1.5px solid; }
.corner.tr { top: 14px; right: 14px; border-top: 1.5px solid; border-right: 1.5px solid; }
.corner.bl { bottom: 14px; left: 14px; border-bottom: 1.5px solid; border-left: 1.5px solid; }
.corner.br { bottom: 14px; right: 14px; border-bottom: 1.5px solid; border-right: 1.5px solid; }
body.dashing .corner {
  width: 42px;
  height: 42px;
  border-color: var(--c3);
  opacity: 1;
}
body.boss-alert .corner {
  border-color: var(--c3);
  opacity: 0.9;
}

/* ================= HUD ================= */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: clamp(14px, 2.4vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-box {
  pointer-events: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c1);
  background: rgba(0, 245, 212, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 8px;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
}
body.boss-alert .badge {
  color: var(--c3);
  border-color: rgba(255, 46, 147, 0.6);
  background: rgba(255, 46, 147, 0.12);
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
  animation: beat 1.6s infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.5); opacity: 0.35; }
}

.logo {
  position: relative;
  display: inline-block;
  cursor: pointer;
  font-size: clamp(30px, 4.4vw, 48px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(100deg, #fff 10%, var(--c1) 45%, var(--c2) 75%, var(--c3) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
  transition: transform 0.2s ease, filter 0.25s ease;
}
.logo:hover {
  filter: drop-shadow(0 0 18px var(--c1));
  transform: scale(1.02);
}
.logo::after {
  content: "8oo.top";
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--c3);
  opacity: 0;
  pointer-events: none;
  clip-path: inset(0 0 60% 0);
}
body.dashing .logo::after,
.logo.glitching::after {
  animation: glitch 0.28s steps(2) infinite;
  opacity: 0.8;
}
@keyframes shine { to { background-position: 200% center; } }
@keyframes glitch {
  0% { transform: translate(-2px, 1px); clip-path: inset(10% 0 65% 0); }
  50% { transform: translate(3px, -1px); clip-path: inset(55% 0 15% 0); }
  100% { transform: translate(-1px, 2px); clip-path: inset(25% 0 40% 0); }
}

.sub {
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.14em;
}

/* Boss Bar */
.boss-hud {
  flex: 1;
  max-width: 360px;
  margin-top: 6px;
  background: var(--hud);
  border: 1px solid rgba(255, 46, 147, 0.45);
  border-radius: 10px;
  padding: 8px 12px;
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.boss-hud.show {
  opacity: 1;
  transform: translateY(0);
}
.boss-title {
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--c3);
  margin-bottom: 6px;
}
.boss-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--c2), var(--c3));
  box-shadow: 0 0 12px var(--c3);
  transition: width 0.12s linear;
}

/* Telemetry Card */
.telemetry {
  pointer-events: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}
.tele-card {
  background: var(--hud);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 214px;
  transition: border-color 0.25s ease;
}
.tele-card:hover {
  border-color: var(--line);
}
.tele-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  line-height: 1.65;
}
.tele-val {
  color: #fff;
  font-weight: 700;
}
.tele-val.hi { color: var(--c1); }
.tele-val.hot { color: var(--c3); }

.charge-bar, .nova-bar, .dash-bar {
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.charge-bar { margin: 4px 0 8px; }
.charge-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c2), var(--c1));
  box-shadow: 0 0 8px var(--c1);
  transition: width 0.2s ease;
}

.stat-group {
  margin-top: 7px;
}
.stat-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.combo-tag {
  color: var(--c3);
  font-weight: 800;
  opacity: 0.45;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.combo-tag.active {
  opacity: 1;
  text-shadow: 0 0 10px var(--c3);
}

.shield-pips {
  display: flex;
  gap: 5px;
}
.pip {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}
.pip.on {
  background: var(--c1);
  box-shadow: 0 0 9px var(--c1);
}
.pip.low {
  background: var(--c3);
  box-shadow: 0 0 9px var(--c3);
}

.nova-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c2), var(--c3));
  transition: width 0.15s ease;
}
.nova-fill.ready {
  background: linear-gradient(90deg, var(--c1), var(--c3));
  box-shadow: 0 0 12px var(--c3);
}

.tele-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.eq-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}
.eq-wrap:hover, .eq-wrap.on { opacity: 1; }
.eq-label { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.eq-wrap.on .eq-label { color: var(--c1); }
.eq { display: flex; align-items: flex-end; gap: 2.5px; height: 14px; }
.eq span {
  width: 2.5px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--c2), var(--c1));
  height: 3px;
  transition: height 0.08s ease;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-btn:hover {
  border-color: var(--c1);
  color: var(--c1);
  background: rgba(0, 245, 212, 0.1);
}

/* Bottom Bar */
.bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.dash-wrap {
  width: 190px;
  background: var(--hud);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 7px 10px;
  backdrop-filter: blur(12px);
}
.dash-label {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 5px;
}
.dash-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: var(--c1);
  box-shadow: 0 0 8px var(--c1);
  transition: width 0.08s linear;
}

.mobile-actions {
  display: none;
  gap: 12px;
  pointer-events: auto;
  margin-left: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
body.playing .mobile-actions {
  opacity: 1;
  transform: translateY(0);
}
.act-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1.5px solid var(--c1);
  background: radial-gradient(circle at center, rgba(8, 14, 28, 0.78) 54%, rgba(0, 245, 212, 0.16) 100%);
  color: var(--c1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.22);
  overflow: hidden;
  transition: transform 0.12s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}
.act-btn::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--pct, 100%);
  background: rgba(0, 245, 212, 0.22);
  z-index: 0;
  transition: height 0.1s linear;
}
.act-btn > * {
  position: relative;
  z-index: 1;
}
.act-btn small {
  font-size: 9px;
  opacity: 0.85;
}
.act-btn.cooling {
  opacity: 0.5;
}
.act-btn.nova {
  border-color: var(--c3);
  color: var(--c3);
  background: radial-gradient(circle at center, rgba(8, 14, 28, 0.78) 54%, rgba(255, 46, 147, 0.14) 100%);
  box-shadow: 0 0 16px rgba(255, 46, 147, 0.2);
}
.act-btn.nova::before {
  background: rgba(255, 46, 147, 0.28);
}
.act-btn.nova.ready {
  box-shadow: 0 0 28px var(--c3), inset 0 0 14px rgba(255, 46, 147, 0.4);
  animation: novaPulse 1.1s ease-in-out infinite;
}
@keyframes novaPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
.act-btn:active {
  transform: scale(0.92);
}

.mobile-only {
  display: none;
}

/* Center Banner & Whisper */
.center-hud {
  position: fixed;
  left: 50%;
  top: 24%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  text-align: center;
}
.banner {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(16px, 2.8vw, 28px);
  font-weight: 900;
  letter-spacing: 0.36em;
  color: #fff;
  text-shadow: 0 0 22px var(--c1), 0 0 46px var(--c2);
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.28s ease;
}
.banner.show {
  opacity: 1;
  transform: scale(1);
}
.banner.warn {
  color: #fff;
  text-shadow: 0 0 24px var(--c3), 0 0 54px var(--c3);
}

.whisper {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(210, 230, 255, 0.42);
  white-space: nowrap;
  transition: opacity 0.6s ease, color 0.25s ease;
}
.whisper.flash {
  color: var(--c1);
  opacity: 1;
  text-shadow: 0 0 14px var(--c1);
}
.whisper.faded {
  opacity: 0;
}

/* ================= OVERLAY PANELS ================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 14, 0.34);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(460px, 100%);
  background: rgba(7, 13, 28, 0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 32px);
  text-align: center;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.72), inset 0 0 40px rgba(0, 245, 212, 0.05);
  backdrop-filter: blur(18px);
}
.panel.hidden {
  display: none;
}

.panel-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--c1);
  margin-bottom: 10px;
}
.panel-tag.warn {
  color: var(--c3);
}

.panel-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  background: linear-gradient(100deg, #fff 15%, var(--c1) 55%, var(--c3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 18px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  text-align: left;
}
.ctrl-item {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
}
.ctrl-item b {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--c1);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.ctrl-item span {
  color: rgba(220, 235, 255, 0.78);
}

.panel-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 20px;
}
.panel-meta b {
  color: #fff;
}
.link-btn {
  color: var(--c1);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.primary-btn, .ghost-btn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  border-radius: 999px;
  padding: 13px 30px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.primary-btn {
  border: 1px solid var(--c1);
  color: #03040a;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  box-shadow: 0 0 26px rgba(0, 245, 212, 0.35);
}
.primary-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 36px rgba(0, 245, 212, 0.6);
}
.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.ghost-btn:hover {
  border-color: var(--c3);
  color: var(--c3);
}

.panel-btn-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 16px;
}
.res-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
}
.res-box span {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.res-box b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  color: var(--c1);
}

.new-best {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--c3);
  text-shadow: 0 0 14px var(--c3);
  margin-bottom: 16px;
}
.new-best.hidden {
  display: none;
}

@media (pointer: coarse) {
  .dash-wrap { display: none; }
  .mobile-actions { display: flex; }
  .desktop-only { display: none; }
  .mobile-only { display: grid; }
}

@media (max-width: 720px) {
  .corner {
    width: 16px;
    height: 16px;
  }
  .hud {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }
  .badge {
    font-size: 9px;
    padding: 3px 8px;
    margin-bottom: 4px;
    letter-spacing: 0.14em;
  }
  .logo {
    font-size: 24px;
  }
  .sub { display: none; }

  .tele-card {
    min-width: 138px;
    padding: 6px 9px;
    border-radius: 10px;
    font-size: 10px;
  }
  .tele-row {
    gap: 8px;
    line-height: 1.45;
  }
  .hide-mobile {
    display: none;
  }
  .charge-bar {
    height: 3px;
    margin: 3px 0 5px;
  }
  .stat-group {
    margin-top: 4px;
  }
  .stat-label {
    font-size: 9px;
    margin-bottom: 3px;
  }
  .pip {
    height: 5px;
  }
  .tele-actions {
    margin-top: 6px;
    padding-top: 5px;
  }
  .eq-label {
    display: none;
  }
  .eq {
    height: 11px;
  }
  .icon-btn {
    padding: 2px 7px;
    font-size: 9px;
  }

  .boss-hud {
    position: fixed;
    left: 50%;
    top: max(76px, calc(env(safe-area-inset-top) + 66px));
    transform: translateX(-50%);
    width: calc(100vw - 28px);
    max-width: 300px;
    padding: 6px 10px;
  }
  .boss-hud.show {
    transform: translateX(-50%);
  }
  .dash-wrap { display: none; }
  .mobile-actions { display: flex; }
  .desktop-only { display: none; }
  .mobile-only { display: grid; }
  .whisper { display: none; }

  .panel {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .panel-title {
    font-size: 28px;
    margin-bottom: 8px;
  }
  .panel-desc {
    font-size: 12px;
    margin-bottom: 14px;
  }
  .controls-grid {
    gap: 6px;
    margin-bottom: 14px;
  }
  .ctrl-item {
    padding: 7px 8px;
    font-size: 10px;
  }
  .primary-btn, .ghost-btn {
    padding: 11px 24px;
    font-size: 12px;
  }
}
