:root {
  --void: #080812;
  --panel: rgba(12, 14, 28, 0.92);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.55);
  --yellow: #ffd93d;
  --blue: #4facfe;
  --pink: #ff6bce;
  --purple: #9b59ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  color: var(--text);
  background: var(--void);
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(79, 172, 254, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 80%, rgba(155, 89, 255, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 70%, rgba(255, 107, 206, 0.06) 0%, transparent 35%);
  z-index: 0;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0.75rem;
}

.hud {
  display: flex;
  align-items: center;
  width: min(420px, 100%);
  padding: 0 0.25rem 0.5rem;
  gap: 0.5rem;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}

.hud-center {
  text-align: center;
  flex: 1.4;
}

.hud-right {
  text-align: right;
}

.hud-label {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hud-value {
  font-family: "Syne", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.player-badge {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.c-yellow { color: var(--yellow); }
.c-blue { color: var(--blue); }
.c-pink { color: var(--pink); }
.c-purple { color: var(--purple); }

.canvas-wrap {
  position: relative;
  width: min(420px, 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(79, 172, 254, 0.08);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--void);
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 5, 14, 0.82);
  backdrop-filter: blur(6px);
}

.overlay.hidden {
  display: none;
}

.card {
  width: 100%;
  max-width: 340px;
  padding: 1.5rem 1.25rem;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-align: center;
}

.title-main {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.tagline {
  margin: 1rem 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(240, 244, 255, 0.75);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.swatch {
  font-size: 0.62rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0.85;
}

.swatch.is-you {
  opacity: 1;
  box-shadow: 0 0 12px rgba(79, 172, 254, 0.45);
}

.controls-hint {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 0.65rem;
}

.play-btn {
  font-family: "Syne", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #080812;
  background: linear-gradient(135deg, var(--blue), #7ec8ff);
  box-shadow: 0 4px 24px rgba(79, 172, 254, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(79, 172, 254, 0.45);
}

.play-btn:active {
  transform: translateY(0);
}

.end-title {
  font-family: "Syne", sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--pink);
  margin-bottom: 0.35rem;
}

.end-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.end-stats {
  margin-bottom: 1.25rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.stat-row strong {
  color: var(--text);
  font-family: "Syne", sans-serif;
  font-size: 1rem;
}

.stat-row-total {
  border-bottom: none;
  padding-top: 0.5rem;
}

.end-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.home-link {
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
}

.home-link:hover {
  color: var(--blue);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
