/* ===== DESIGN TOKENS ===== */
:root {
  /* Colors */
  --color-primary: #6C5CE7;
  --color-primary-light: #8577ed;
  --color-primary-dark: #5a4bd4;
  --color-secondary: #00CEC9;
  --color-secondary-light: #33d8d4;
  --color-secondary-dark: #00b5b0;
  --color-bg: #0F0F1A;
  --color-surface: #1A1A2E;
  --color-surface-alt: #25253D;
  --color-text: #F0F0F5;
  --color-text-muted: #8888AA;
  --color-border: #33335A;
  --color-go: #00E676;
  --color-wait: #FF1744;
  --color-warning: #FFD600;
  --color-target: #FF6B35;
  --color-choice-a: #00B0FF;
  --color-choice-b: #E040FB;
  --color-choice-c: #FFAB40;

  /* Typography */
  --font-family: 'Inter', system-ui, sans-serif;
  --font-family-mono: 'Courier New', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 3rem;
  --font-size-display: 4.5rem;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.4);
  --shadow-glow-secondary: 0 0 20px rgba(0, 206, 201, 0.3);

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 400ms ease-out;
}

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== BASE ===== */
body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-normal);
}
a:hover {
  color: var(--color-secondary-light);
  text-decoration: underline;
}
a:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ===== SITE HEADER ===== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.125rem;
}
.site-logo:hover {
  text-decoration: none;
}

.site-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform var(--transition-normal);
}
.site-logo:hover .site-logo-icon {
  transform: rotate(-8deg) scale(1.05);
}

.site-logo-text span {
  color: var(--color-secondary);
}

/* ===== NAV ===== */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.site-nav a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
  text-decoration: none;
}

/* ===== SITE FOOTER ===== */
.site-footer {
  text-align: center;
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-xl);
  background: var(--color-primary);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 200ms ease, box-shadow 200ms ease;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(108, 92, 231, 0.6);
  background: var(--color-primary-light);
  text-decoration: none;
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-glow);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  color: var(--color-secondary);
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal), transform var(--transition-normal);
}
.btn-secondary:hover {
  background: rgba(0, 206, 201, 0.1);
  border-color: var(--color-secondary-light);
  color: var(--color-secondary-light);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-secondary:active {
  transform: translateY(0);
}
.btn-secondary:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
}
.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: background 200ms ease;
}
.progress-dot.active {
  background: var(--color-primary);
}
.progress-dot.completed {
  background: var(--color-secondary);
}
.progress-connector {
  width: 32px;
  height: 2px;
  background: var(--color-border);
}
.progress-connector.completed {
  background: var(--color-secondary);
}

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

/* ===== GAME HEADER ===== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}
.round-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.trial-counter {
  font-family: var(--font-family-mono);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
}

/* ===== TRIAL DOTS ===== */
.trial-dots {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-lg);
}
.trial-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-border);
}
.trial-dot.done {
  background: var(--color-secondary);
}
.trial-dot.current {
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

/* ===== REACTION TIME DISPLAY ===== */
.reaction-time-display {
  font-family: var(--font-family-mono);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1;
  text-align: center;
}
.reaction-time-unit {
  font-size: 1.5rem;
  color: var(--color-text-muted);
}

/* ===== LANDING PAGE ===== */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 80vh;
  padding: var(--space-2xl);
}
.landing-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-glow);
  animation: logoPulse 3s ease-in-out infinite;
}
.landing h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.landing h1 span {
  color: var(--color-secondary);
}
.landing .subtitle {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2xl);
  max-width: 480px;
}

.rounds-preview {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  justify-content: center;
}
.round-preview-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 200px;
  text-align: left;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.round-preview-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.15);
}
.round-preview-card .round-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}
.round-preview-card h3 {
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}
.round-preview-card p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.landing-nav {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* ===== FULLSCREEN GAME STATES ===== */
.fullscreen-game {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  border-radius: var(--radius-lg);
  transition: background 100ms ease;
}
.fullscreen-game .game-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  margin-bottom: 0;
}

.state-wait {
  background: var(--color-wait);
}
.state-wait .instruction {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.state-wait .hint {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: var(--space-sm);
}

.state-go {
  background: var(--color-go);
}
.state-go .instruction {
  font-size: 3rem;
  font-weight: 700;
  color: #0F0F1A;
}
.state-go .hint {
  font-size: 1rem;
  color: rgba(15, 15, 26, 0.7);
  margin-top: var(--space-sm);
}

.state-result {
  background: var(--color-bg);
}
.reaction-feedback {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-md);
}

.state-early {
  background: var(--color-warning);
}
.state-early .instruction {
  font-size: 2rem;
  font-weight: 700;
  color: #0F0F1A;
}

/* ===== CHOICE REACTION (Round 2) ===== */
.choice-arena {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.choice-instruction {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.choice-instruction p {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}
.choice-target-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-sm) var(--space-lg);
  font-size: 1rem;
  font-weight: 700;
}
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  max-width: 600px;
  width: 100%;
}
.choice-element {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 100ms ease;
  border: 3px solid transparent;
}
.choice-element:hover {
  transform: scale(1.05);
}
.choice-element.color-a {
  background: var(--color-choice-a);
}
.choice-element.color-b {
  background: var(--color-choice-b);
}
.choice-element.color-c {
  background: var(--color-choice-c);
}
.choice-element.color-go {
  background: var(--color-go);
}
.choice-element.target-highlight {
  border-color: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.3);
}

.choice-wrong-feedback {
  text-align: center;
  padding: var(--space-xl);
}
.choice-wrong-feedback .icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}
.choice-wrong-feedback h3 {
  font-size: 1.5rem;
  color: var(--color-wait);
  margin-bottom: var(--space-sm);
}
.choice-wrong-feedback p {
  color: var(--color-text-muted);
}

/* ===== TARGET REACTION (Round 3) ===== */
.target-arena {
  position: relative;
  min-height: 55vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.target-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  text-align: center;
}
.target-waiting p {
  font-size: 1.25rem;
  color: var(--color-text-muted);
}
.target-waiting .crosshair {
  font-size: 3rem;
  color: var(--color-border);
  margin-bottom: var(--space-md);
}

.target-dot {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--color-target), #e55a2b);
  position: absolute;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 107, 53, 0.5);
  transition: transform 50ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: targetPulse 1.2s ease-in-out infinite;
}
.target-dot:hover {
  transform: scale(1.1);
}
.target-dot-inner {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: #fff;
  opacity: 0.6;
}

.target-result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ===== TRANSITION SCREEN ===== */
.transition-screen {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
}
.transition-progress {
  margin-bottom: var(--space-2xl);
}
.transition-result {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 400px;
  margin: 0 auto var(--space-2xl);
}
.transition-result h2 {
  font-size: 1rem;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}
.transition-result .score {
  font-family: var(--font-family-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.transition-result .score-unit {
  font-size: 1.25rem;
  color: var(--color-text-muted);
}
.transition-result .score-detail {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

.trial-breakdown {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}
.trial-chip {
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-family-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.next-round-preview {
  max-width: 480px;
  margin: 0 auto;
}
.next-round-preview h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}
.next-round-preview h3 span {
  color: var(--color-primary);
}
.next-round-preview p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-lg);
}

/* ===== FINAL RESULTS ===== */
.final-results {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
}
.final-results h1 {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}
.final-results .overall-score {
  font-family: var(--font-family-mono);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1;
}
.final-results .overall-unit {
  font-size: 1.5rem;
  color: var(--color-text-muted);
}
.final-results .qualifier-badge {
  display: inline-block;
  background: var(--color-go);
  color: #0F0F1A;
  font-size: 0.8rem;
  font-weight: 700;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  margin-top: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

.round-scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  max-width: 600px;
  margin: var(--space-2xl) auto;
}
.round-score-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.round-score-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.12);
}
.round-score-card .round-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}
.round-score-card .round-score {
  font-family: var(--font-family-mono);
  font-size: 1.5rem;
  font-weight: 700;
}
.round-score-card .round-score-unit {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.final-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* ===== SCORE SUBMISSION FORM ===== */
.score-form-container {
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}
.score-form-container h2 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--space-sm);
}
.score-form-container .form-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-xl);
}

.form-group {
  margin-bottom: var(--space-lg);
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 1rem;
  outline: none;
  transition: border-color 200ms ease;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}
.form-group input::placeholder {
  color: var(--color-text-muted);
}
.form-group .form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.score-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  text-align: center;
}
.score-preview .preview-time {
  font-family: var(--font-family-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-secondary);
}
.score-preview .preview-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

/* ===== LEADERBOARD ===== */
.leaderboard-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl);
}
.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}
.leaderboard-header h1 {
  font-size: 2rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--space-sm);
}
.leaderboard-table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  text-align: left;
  padding: var(--space-sm) var(--space-md);
}
.leaderboard-table tbody tr {
  background: var(--color-surface);
  transition: background 200ms ease;
}
.leaderboard-table tbody tr:hover {
  background: var(--color-surface-alt);
}
.leaderboard-table tbody td {
  padding: var(--space-md);
  font-size: 0.95rem;
}
.leaderboard-table tbody tr td:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.leaderboard-table tbody tr td:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}
.rank-1 { background: #FFD700; color: #0F0F1A; }
.rank-2 { background: #C0C0C0; color: #0F0F1A; }
.rank-3 { background: #CD7F32; color: #0F0F1A; }
.rank-default { background: var(--color-surface-alt); color: var(--color-text-muted); }

.player-name {
  font-weight: 700;
}
.player-country {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.avg-time {
  font-family: var(--font-family-mono);
  font-weight: 700;
  color: var(--color-secondary);
}
.avg-time-unit {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.rounds-badge {
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.play-date {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.highlight-row {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-radius: var(--radius-md);
}
.highlight-row td {
  background: rgba(108, 92, 231, 0.1);
}

.leaderboard-footer {
  text-align: center;
  margin-top: var(--space-xl);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 200ms ease;
}
.modal-content {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 300ms ease;
}
.modal-content .score-form-container {
  padding: var(--space-2xl) var(--space-xl);
}

/* ===== CHOICE FEEDBACK ===== */
.choice-feedback {
  font-family: var(--font-family-mono);
  font-size: 1rem;
  min-height: 1.5em;
}

/* ===== GAME CONTAINER ===== */
#game-container {
  min-height: 70vh;
}

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.4); }
  50% { box-shadow: 0 0 36px rgba(108, 92, 231, 0.7); }
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 16px rgba(0, 230, 118, 0.4); }
  50% { box-shadow: 0 0 28px rgba(0, 230, 118, 0.7); }
}

@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 107, 53, 0.5); }
  50% { box-shadow: 0 0 40px rgba(255, 107, 53, 0.8); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== RESPONSIVE: DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
  .site-header {
    padding: var(--space-md) var(--space-2xl);
  }

  .landing {
    padding: var(--space-3xl) var(--space-2xl);
  }
  .landing h1 {
    font-size: 3.5rem;
  }
  .landing .subtitle {
    font-size: var(--font-size-lg);
    max-width: 560px;
  }

  .rounds-preview {
    gap: var(--space-lg);
  }
  .round-preview-card {
    width: 220px;
    padding: var(--space-xl);
  }

  .fullscreen-game {
    min-height: 75vh;
  }

  .choice-arena {
    min-height: 55vh;
    padding: var(--space-2xl);
  }
  .choice-grid {
    max-width: 640px;
    gap: var(--space-lg);
  }

  .target-arena {
    min-height: 60vh;
  }

  .final-results {
    padding: var(--space-3xl) var(--space-2xl);
  }

  .leaderboard-container {
    max-width: 900px;
    padding: var(--space-2xl);
  }

  .score-form-container {
    max-width: 520px;
  }

  .transition-screen {
    padding: var(--space-3xl) var(--space-2xl);
  }
}

/* ===== RESPONSIVE: TABLET (max 768px) ===== */
@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }
  .site-nav {
    gap: var(--space-md);
  }
  .site-nav a {
    font-size: 0.8rem;
  }

  .landing {
    padding: var(--space-xl) var(--space-md);
    min-height: 70vh;
  }
  .landing h1 {
    font-size: 2rem;
  }
  .landing .subtitle {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-xl);
  }
  .rounds-preview {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
  }
  .round-preview-card {
    width: 100%;
    max-width: 320px;
  }

  .reaction-time-display {
    font-size: 3rem;
  }

  .fullscreen-game {
    min-height: 60vh;
  }

  .choice-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }
  .choice-arena {
    padding: var(--space-md);
  }

  .target-arena {
    min-height: 45vh;
  }

  .round-scores-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
  }

  .final-results {
    padding: var(--space-xl) var(--space-md);
  }
  .final-results .overall-score {
    font-size: 3rem;
  }
  .final-results h1 {
    font-size: 1.5rem;
  }

  .leaderboard-container {
    padding: var(--space-md);
  }
  .leaderboard-table {
    font-size: 0.85rem;
  }
  .leaderboard-table thead th {
    font-size: 0.65rem;
    padding: var(--space-xs) var(--space-sm);
  }
  .leaderboard-table tbody td {
    padding: var(--space-sm);
  }
  .leaderboard-header h1 {
    font-size: 1.5rem;
  }

  .transition-screen {
    padding: var(--space-xl) var(--space-md);
  }
  .transition-result .score {
    font-size: 2.5rem;
  }

  .score-form-container {
    padding: 0 var(--space-md);
  }

  .game-header {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ===== RESPONSIVE: SMALL MOBILE (max 320px) ===== */
@media (max-width: 480px) {
  .site-header {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
  }
  .site-logo {
    font-size: 1rem;
  }
  .site-logo-icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  .site-nav {
    gap: var(--space-sm);
  }
  .site-nav a {
    font-size: 0.75rem;
  }

  .landing {
    padding: var(--space-lg) var(--space-sm);
    min-height: auto;
  }
  .landing-logo {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
  .landing h1 {
    font-size: 1.625rem;
  }
  .landing .subtitle {
    font-size: var(--font-size-sm);
  }
  .round-preview-card {
    padding: var(--space-md);
  }
  .round-preview-card h3 {
    font-size: 0.9rem;
  }
  .round-preview-card p {
    font-size: 0.75rem;
  }

  .btn-primary {
    padding: var(--space-sm) var(--space-lg);
    font-size: 1rem;
  }
  .btn-secondary {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
  }

  .reaction-time-display {
    font-size: 2.5rem;
  }
  .reaction-time-unit {
    font-size: 1rem;
  }

  .fullscreen-game {
    min-height: 50vh;
  }
  .state-wait .instruction {
    font-size: 1.25rem;
  }
  .state-go .instruction {
    font-size: 2rem;
  }

  .choice-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xs);
  }
  .choice-instruction p {
    font-size: 1rem;
  }

  .target-arena {
    min-height: 40vh;
  }
  .target-dot {
    width: 44px;
    height: 44px;
  }
  .target-dot-inner {
    width: 16px;
    height: 16px;
  }

  .round-scores-grid {
    gap: var(--space-sm);
  }
  .round-score-card {
    padding: var(--space-md);
  }
  .round-score-card .round-score {
    font-size: 1.25rem;
  }

  .final-results .overall-score {
    font-size: 2.5rem;
  }
  .final-results .overall-unit {
    font-size: 1rem;
  }
  .final-actions {
    flex-direction: column;
    align-items: center;
  }

  .leaderboard-table thead th {
    font-size: 0.6rem;
    padding: var(--space-xs);
  }
  .leaderboard-table tbody td {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
  }
  .rank-badge {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }

  .transition-result {
    padding: var(--space-md);
  }
  .transition-result .score {
    font-size: 2rem;
  }
  .trial-chip {
    font-size: 0.7rem;
    padding: 2px var(--space-sm);
  }

  .score-preview .preview-time {
    font-size: 1.5rem;
  }

  .progress-dot {
    width: 10px;
    height: 10px;
  }
  .progress-connector {
    width: 20px;
  }

  .modal-content {
    border-radius: var(--radius-lg);
  }
  .modal-content .score-form-container {
    padding: var(--space-xl) var(--space-md);
  }

  .site-footer {
    padding: var(--space-md);
    font-size: 0.7rem;
  }
}
