:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0b0d10;
  color: #e6e8eb;
}

.game {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.game-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.reduced-motion {
  font-size: 0.85rem;
  color: #9ba0a6;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.game-video {
  width: 100%;
  max-height: 200px;
  border-radius: 0.5rem;
  background: #000;
  object-fit: cover;
}

.bpm-readout {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #14171b;
  border-radius: 0.5rem;
}

.bpm-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.bpm-value {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bpm-quality {
  margin-left: auto;
  font-size: 0.8rem;
  color: #9ba0a6;
}

.phase {
  padding: 1rem 1.25rem;
  background: #14171b;
  border-radius: 0.5rem;
}

.phase h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.phase ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
  line-height: 1.55;
  color: #c5c8cc;
}

.phase progress {
  width: 100%;
  height: 0.5rem;
  margin-top: 0.5rem;
}

.phase-info {
  color: #9ba0a6;
  text-align: center;
}

.phase-quiet {
  text-align: center;
  color: #c5c8cc;
}

.hint {
  margin-top: 0.5rem;
  color: #9ba0a6;
  font-size: 0.85rem;
}

.btn {
  margin-top: 0.75rem;
  padding: 0.55rem 1rem;
  background: #1f2329;
  color: #e6e8eb;
  border: 1px solid #2e3338;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.result-list {
  margin: 0.5rem 0;
  padding-left: 1.1rem;
  color: #c5c8cc;
  line-height: 1.6;
}

.leaderboard {
  padding: 1rem 1.25rem;
  background: #14171b;
  border-radius: 0.5rem;
}

.leaderboard h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.leaderboard ol {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: #6b7280;
  font-size: 0.8rem;
}

/* ---------- visual startle overlay ------------------------------------- */
.flash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  animation: flash-fade 200ms ease-out forwards;
}

.flash-bright {
  /* Saturated orange — high salience, not the worst case for photosensitive
     users (avoids pure white luminance spike). Single short pulse stays well
     under WCAG flash thresholds. */
  background: radial-gradient(circle, rgba(255, 140, 50, 0.95), rgba(255, 80, 30, 0.5));
}

.flash-reduced {
  /* Reduced motion: gentle color shift, no luminance spike. */
  background: rgba(80, 160, 255, 0.18);
  animation: flash-fade-soft 200ms ease-out forwards;
}

@keyframes flash-fade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes flash-fade-soft {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
