/* ==========================================================================
   NEON DRIFT - UI styles
   Dark neon HUD + glass panels. Everything is plain CSS, no framework.
   ========================================================================== */

:root {
  --cyan: #22e6ff;
  --magenta: #ff2fb2;
  --violet: #8a5cff;
  --amber: #ffb020;
  --lime: #9dff3c;
  --danger: #ff3355;
  --ink: #05060f;
  --panel: rgba(8, 12, 30, 0.72);
  --text: #dbe6ff;
  --muted: #7f8ec0;
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

/* ------------------------------- HUD ---------------------------------- */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: clamp(14px, 2.4vw, 30px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.35s ease;
  font-variant-numeric: tabular-nums;
}

.hud.dim {
  opacity: 0.25;
}

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

.hud-right {
  display: flex;
  gap: clamp(10px, 1.8vw, 26px);
  text-align: right;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.05;
}

.stat .label {
  font-size: clamp(8px, 1vw, 11px);
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}

.stat .value {
  font-size: clamp(15px, 2vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow: 0 0 14px rgba(34, 230, 255, 0.35);
}

.stat-score .value.big {
  font-size: clamp(30px, 5.6vw, 62px);
  color: #fff;
  text-shadow: 0 0 26px rgba(34, 230, 255, 0.75), 0 0 60px rgba(138, 92, 255, 0.4);
}

.stat-score .label {
  color: var(--cyan);
}

/* combo */

.combo {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, 0) scale(0.9);
  display: flex;
  align-items: baseline;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.combo.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.combo-label {
  font-size: clamp(9px, 1.1vw, 12px);
  letter-spacing: 0.35em;
  color: var(--muted);
}

.combo-count {
  font-size: clamp(22px, 3.4vw, 40px);
  font-weight: 800;
  color: var(--lime);
  text-shadow: 0 0 22px rgba(157, 255, 60, 0.8);
}

/* bottom row */

.hud-bottom {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
}

.shield {
  font-size: clamp(8px, 1vw, 11px);
  letter-spacing: 0.24em;
  padding: 6px 12px;
  border: 1px solid rgba(127, 142, 192, 0.4);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.shield.active {
  color: var(--lime);
  border-color: rgba(157, 255, 60, 0.7);
  box-shadow: 0 0 18px rgba(157, 255, 60, 0.3);
}

.boost {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
}

.boost-label {
  font-size: clamp(8px, 1vw, 11px);
  letter-spacing: 0.24em;
  color: var(--muted);
}

.boost-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(127, 142, 192, 0.18);
  overflow: hidden;
}

.boost-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet) 55%, var(--magenta));
  box-shadow: 0 0 16px rgba(34, 230, 255, 0.7);
  transition: width 0.12s linear;
}

/* ----------------------------- overlays ------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(
    circle at 50% 45%,
    rgba(10, 14, 38, 0.55),
    rgba(3, 4, 12, 0.92)
  );
  backdrop-filter: blur(6px);
  z-index: 20;
}

.overlay.visible {
  display: flex;
  animation: fade-in 0.28s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel {
  width: min(560px, 100%);
  padding: clamp(24px, 4vw, 44px);
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(34, 230, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(255, 47, 178, 0.08), 0 30px 90px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(34, 230, 255, 0.06);
  text-align: center;
}

.panel.small {
  width: min(380px, 100%);
}

.title {
  font-size: clamp(38px, 8vw, 74px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 0 30px rgba(34, 230, 255, 0.8);
}

.title span {
  color: var(--magenta);
  text-shadow: 0 0 30px rgba(255, 47, 178, 0.85);
}

.tagline {
  margin-top: 10px;
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(34, 230, 255, 0.6);
}

.panel-title.danger {
  color: var(--danger);
  text-shadow: 0 0 24px rgba(255, 51, 85, 0.6);
}

.controls {
  list-style: none;
  margin: 24px auto 18px;
  display: grid;
  gap: 8px;
  font-size: clamp(12px, 1.5vw, 15px);
  color: var(--text);
}

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 7px;
  margin: 0 2px;
  border-radius: 6px;
  border: 1px solid rgba(34, 230, 255, 0.35);
  background: rgba(34, 230, 255, 0.08);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.85em;
  color: var(--cyan);
}

.hint {
  margin: 12px 0 22px;
  font-size: clamp(11px, 1.3vw, 13px);
  line-height: 1.7;
  color: var(--muted);
}

.hint.small {
  margin: 16px 0 0;
  font-size: 11px;
}

/* results grid */

.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 26px 0 24px;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 10px;
  border-radius: 12px;
  background: rgba(34, 230, 255, 0.05);
  border: 1px solid rgba(34, 230, 255, 0.16);
}

.result .label {
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.result .value {
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 800;
  color: #fff;
}

.new-best {
  display: none;
  margin-top: 12px;
  font-size: clamp(10px, 1.3vw, 13px);
  letter-spacing: 0.3em;
  color: var(--lime);
  text-shadow: 0 0 20px rgba(157, 255, 60, 0.7);
}

.new-best.visible {
  display: block;
  animation: pulse-glow 1.1s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* ------------------------------ buttons ------------------------------- */

.btn {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(11px, 1.4vw, 14px);
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 14px 30px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(34, 230, 255, 0.06);
  border: 1px solid rgba(34, 230, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  background: rgba(34, 230, 255, 0.14);
  box-shadow: 0 0 26px rgba(34, 230, 255, 0.35);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  width: 100%;
  color: #04121a;
  background: linear-gradient(100deg, var(--cyan), var(--violet) 60%, var(--magenta));
  border: none;
  box-shadow: 0 0 32px rgba(34, 230, 255, 0.45);
}

.btn.primary:hover {
  box-shadow: 0 0 48px rgba(255, 47, 178, 0.55);
}

.btn.ghost {
  padding: 9px 18px;
  font-size: 10px;
  border-color: rgba(127, 142, 192, 0.35);
  background: rgba(8, 12, 30, 0.5);
}

.btn.ghost.off {
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  justify-content: center;
  flex-wrap: wrap;
}

.corner-buttons {
  position: fixed;
  right: clamp(14px, 2.4vw, 30px);
  bottom: clamp(14px, 2.4vw, 30px);
  display: flex;
  gap: 10px;
  z-index: 25;
}

/* ------------------------------- misc -------------------------------- */

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 60%, #ffffff, rgba(255, 47, 178, 0.35) 60%, transparent 78%);
  z-index: 15;
  mix-blend-mode: screen;
}

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--ink);
  color: var(--cyan);
  z-index: 40;
  transition: opacity 0.4s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-title {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 900;
  letter-spacing: 0.32em;
  text-shadow: 0 0 26px rgba(34, 230, 255, 0.7);
}

.loading-text {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
  max-width: 480px;
  text-align: center;
  line-height: 1.8;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .hud-right {
    gap: 10px;
  }
  .results {
    grid-template-columns: 1fr 1fr;
  }
  .corner-buttons {
    bottom: auto;
    top: clamp(14px, 2.4vw, 30px);
    right: clamp(14px, 2.4vw, 30px);
  }
}
