@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&family=Share+Tech+Mono&display=swap');

:root {
  --bg: #0a0b12;
  --bg-2: #121526;
  --accent: #59f2ff;
  --accent-2: #ff6ad5;
  --text: #e9f0ff;
  --muted: rgba(233, 240, 255, 0.7);
  --panel: rgba(10, 12, 20, 0.72);
  --panel-border: rgba(89, 242, 255, 0.35);
}

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

html,
body {
  width: 100%;
  height: 100%;
  background: radial-gradient(1200px 800px at 70% 10%, #1b1f3d 0%, #0a0b12 60%);
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  overflow: hidden;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  align-items: center;
}

#boost {
  display: flex;
  align-items: center;
  gap: 8px;
}

#boostFill {
  width: 86px;
  height: 6px;
  border-radius: 6px;
  background: rgba(89, 242, 255, 0.15);
  border: 1px solid rgba(89, 242, 255, 0.4);
  position: relative;
  overflow: hidden;
}

#boostFill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #59f2ff, #ff6ad5);
  transform: scaleX(var(--boost, 0));
  transform-origin: left;
  transition: transform 0.08s linear;
}

.panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px 32px;
  text-align: center;
  backdrop-filter: blur(8px);
  pointer-events: auto;
  min-width: 280px;
}

.panel h1 {
  font-size: 32px;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
}

.panel h2 {
  font-size: 26px;
  margin-bottom: 10px;
}

.panel p {
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.status-error {
  color: var(--accent-2);
}

.score-entry {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.score-entry input {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(10, 12, 20, 0.6);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-entry input:disabled {
  opacity: 0.6;
}

.panel button,
.panel a {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  color: var(--text);
  background: linear-gradient(
    135deg,
    rgba(89, 242, 255, 0.2),
    rgba(255, 106, 213, 0.2)
  );
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.panel button:hover,
.panel a:hover {
  border-color: var(--accent-2);
}

.panel button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#leaderboard {
  position: absolute;
  left: 16px;
  top: 64px;
  min-width: 120px;
  transform: translateX(0);
}

#boardList {
  margin-top: 8px;
  text-align: left;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.hidden {
  display: none;
}

#controls {
  position: fixed;
  inset: auto 0 20px 0;
  display: none;
  justify-content: center;
  gap: 16px;
  pointer-events: auto;
}

#controls button {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#controls #boostBtn {
  width: 110px;
  text-transform: uppercase;
  border-color: var(--accent-2);
}

@media (max-width: 900px) {
  #controls {
    display: flex;
  }
  #hud {
    top: 10px;
    left: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
}

.panel.win {
  border-color: rgba(89, 242, 255, 0.8);
  box-shadow: 0 0 28px rgba(89, 242, 255, 0.35);
  animation: winReveal 0.6s ease-out both;
}

.panel.win h2 {
  text-shadow: 0 0 14px rgba(89, 242, 255, 0.6);
}

.panel.win #downloadBtn {
  box-shadow: 0 0 12px rgba(255, 106, 213, 0.45);
  animation: pulseGlow 1.4s ease-in-out infinite;
}

.panel.lose {
  border-color: rgba(255, 106, 213, 0.65);
  box-shadow: 0 0 22px rgba(255, 106, 213, 0.25);
}

@keyframes winReveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(255, 106, 213, 0.35);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 106, 213, 0.7);
  }
}

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    600px 400px at 50% 40%,
    rgba(89, 242, 255, 0.9),
    rgba(255, 106, 213, 0.35),
    rgba(10, 11, 18, 0.1)
  );
  opacity: 0;
  mix-blend-mode: screen;
}

.flash.active {
  animation: finishFlash 0.45s ease-out;
}

@keyframes finishFlash {
  0% {
    opacity: var(--flash, 0.9);
  }
  100% {
    opacity: 0;
  }
}

#boostPct {
  min-width: 42px;
  text-align: right;
  font-family: 'Share Tech Mono', monospace;
  color: var(--muted);
}

#boost.active #boostPct {
  color: var(--accent);
}

#boost.active #boostFill::after {
  filter: brightness(1.2);
}
