:root {
  --bg-primary: #07070d;
  --bg-secondary: #0e0e18;
  --bg-card: #151524;
  --bg-card-hover: #1c1c34;
  --text-primary: #e4e4f0;
  --text-secondary: #6a6a88;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.12);
  --danger: #ff4060;
  --info: #1ba84aad;
  --gold: #fbbf24;
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Syne', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 255, 136, 0.04), transparent),
    radial-gradient(circle at 20% 80%, rgba(0, 100, 255, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ── Entrance animations ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleReveal {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.15); }
  50%      { box-shadow: 0 0 35px rgba(0, 255, 136, 0.3); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes rankPop {
  0%   { opacity: 0; transform: scale(0.5); }
  70%  { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes gradeReveal {
  0%   { opacity: 0; transform: scale(0) rotate(-15deg); }
  60%  { transform: scale(1.2) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.anim-fade-up {
  animation: fadeSlideUp 0.5s ease both;
}

.anim-stagger-1 { animation-delay: 0.05s; }
.anim-stagger-2 { animation-delay: 0.1s; }
.anim-stagger-3 { animation-delay: 0.15s; }
.anim-stagger-4 { animation-delay: 0.2s; }
.anim-stagger-5 { animation-delay: 0.25s; }

/* Screen management */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* Canvas */
#screen-game {
  user-select: none;
}

#screen-results {
  align-items: center;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
  background: #121218;
}

/* Countdown overlay */
#countdown-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10;
}

#countdown-overlay.visible {
  display: flex;
}

#countdown-number {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

/* Pause overlay */
#pause-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10;
}

#pause-overlay.visible {
  display: flex;
}

#pause-overlay h2 {
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

.pause-actions {
  display: flex;
  gap: 1rem;
}

.pause-settings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  min-width: 280px;
}

/* Menu */
.menu-container {
  text-align: center;
  position: relative;
  z-index: 1;
  margin: auto;
  padding: 2rem 0;
}

.title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px rgba(0, 255, 136, 0.2), 0 0 80px rgba(0, 255, 136, 0.06);
  animation: fadeSlideUp 0.6s ease both;
}

.accent {
  color: var(--accent);
}

.title-tld {
  color: #34d399;
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  color: var(--text-secondary);
  margin: 0.5rem 0 2.5rem;
  font-size: 1rem;
  letter-spacing: 0.03em;
  animation: fadeSlideUp 0.6s ease 0.1s both;
}

.mode-cards {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 1200px;
  animation: fadeSlideUp 0.6s ease 0.2s both;
}

.menu-actions {
  margin-top: 1.5rem;
  animation: fadeSlideUp 0.5s ease 0.4s both;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.2s, box-shadow 0.25s;
  color: var(--text-primary);
  font-family: inherit;
  width: 195px;
  text-align: center;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 0%, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card:hover {
  border-color: rgba(0, 255, 136, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 255, 136, 0.08), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.mode-card:active {
  transform: translateY(-1px);
}

.mode-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  opacity: 0.9;
}

.mode-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.mode-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Results */
.results-container {
  text-align: center;
  position: relative;
  z-index: 1;
}

.results-container h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: fadeSlideUp 0.4s ease both;
}

.score-grade {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
  animation: gradeReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

.score-grade.grade-s { color: var(--accent); text-shadow: 0 0 40px rgba(0, 255, 136, 0.4), 0 0 80px rgba(0, 255, 136, 0.15); }
.score-grade.grade-a { color: #60a5fa; text-shadow: 0 0 40px rgba(96, 165, 250, 0.35); }
.score-grade.grade-b { color: #a78bfa; text-shadow: 0 0 40px rgba(167, 139, 250, 0.3); }
.score-grade.grade-c { color: var(--gold); text-shadow: 0 0 30px rgba(251, 191, 36, 0.25); }
.score-grade.grade-d { color: #f97316; text-shadow: 0 0 25px rgba(249, 115, 22, 0.2); }
.score-grade.grade-f { color: var(--danger); text-shadow: 0 0 25px rgba(255, 64, 96, 0.2); }

.score-value {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.75rem;
  animation: fadeSlideUp 0.5s ease 0.3s both;
}

.score-value span {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 0.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
  min-width: 600px;
}

.stats-grid-tracking {
  grid-template-columns: repeat(2, 1fr);
  min-width: 300px;
  max-width: 400px;
  margin: 0 auto 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 1.1rem 0.75rem;
  animation: fadeSlideUp 0.5s ease both;
}

.stat:nth-child(1) { animation-delay: 0.35s; }
.stat:nth-child(2) { animation-delay: 0.4s; }
.stat:nth-child(3) { animation-delay: 0.45s; }
.stat:nth-child(4) { animation-delay: 0.5s; }
.stat:nth-child(5) { animation-delay: 0.55s; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  animation: fadeSlideUp 0.5s ease 0.6s both;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 0.7rem 1.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 2px 12px rgba(0, 255, 136, 0.2);
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(0, 255, 136, 0.15);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* ── Settings screen ── */
#screen-settings {
  overflow-y: auto;
  align-items: flex-start;
  padding: 2rem 0;
}

.settings-container {
  width: 100%;
  max-width: 580px;
  margin: auto;
  padding: 0 1rem;
}

.settings-container h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.settings-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
}

.settings-section h2 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
  font-weight: 700;
}

.settings-section h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1rem 0 0.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.setting-row label {
  flex: 0 0 130px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.setting-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s;
}

.setting-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.setting-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.setting-value {
  flex: 0 0 60px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Crosshair color swatches */
.color-presets {
  display: flex;
  gap: 0.6rem;
  flex: 1;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  outline: none;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}

.color-swatch[data-color="transparent"] {
  background: #1a1a2e !important;
  position: relative;
}
.color-swatch[data-color="transparent"]::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 1px),
    rgba(255, 80, 80, 0.85) calc(50% - 1px),
    rgba(255, 80, 80, 0.85) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
}

.settings-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
  padding-bottom: 1rem;
}

/* ── Auth banner + user pill ── */
.auth-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(0, 255, 136, 0.04);
  border: 1px solid rgba(0, 255, 136, 0.15);
  border-radius: 10px;
  padding: 0.6rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  animation: fadeSlideUp 0.5s ease 0.15s both;
}

.user-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

#user-name {
  color: var(--accent);
  font-weight: 600;
}

.btn-sm {
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

/* ── Go Premium upsell button ── */
.btn-go-premium {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
  background-size: 200% 100%;
  color: #000;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: transform 0.15s, box-shadow 0.15s;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: goldShimmer 2.5s ease-in-out infinite;
}
.btn-go-premium:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 50%, #fcd34d 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.btn-go-premium:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}
@keyframes goldShimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

/* ── Locked mode cards ── */
.mode-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

.mode-card.locked:hover {
  border-color: transparent;
  background: var(--bg-card);
  transform: none;
}

.mode-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ── Leaderboard screen ── */
#screen-leaderboard {
  overflow-y: auto;
  align-items: flex-start;
  padding: 2rem 0;
}

.lb-container {
  width: 100%;
  max-width: 620px;
  margin: auto;
  padding: 0 1rem;
}

.lb-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.lb-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  justify-content: center;
}

.lb-sort-tabs {
  margin-bottom: 1rem;
}

.lb-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.lb-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.lb-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ── Podium ── */
.lb-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0;
  padding: 0.75rem 0 0;
  min-height: 200px;
}

.lb-podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 130px;
  cursor: pointer;
  transition: transform 0.2s;
}

.lb-podium-slot:hover {
  transform: translateY(-4px);
}

.lb-podium-rank {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.lb-podium-slot[data-rank="1"] .lb-podium-rank { color: #ffd700; font-size: 1.25rem; }
.lb-podium-slot[data-rank="2"] .lb-podium-rank { color: #c8c8d4; }
.lb-podium-slot[data-rank="3"] .lb-podium-rank { color: #d8a050; }

.lb-podium-avatar-wrap {
  position: relative;
}

.lb-podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  border: 2px solid transparent;
  position: relative;
  z-index: 1;
}

.lb-podium-slot[data-rank="1"] .lb-podium-avatar {
  width: 56px;
  height: 56px;
  font-size: 1.1rem;
  border-color: #ffd700;
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.3), 0 0 48px rgba(255, 215, 0, 0.1);
}

.lb-podium-slot[data-rank="2"] .lb-podium-avatar {
  border-color: #c0c0c0;
  box-shadow: 0 0 16px rgba(192, 192, 192, 0.15);
}

.lb-podium-slot[data-rank="3"] .lb-podium-avatar {
  border-color: #cd7f32;
  box-shadow: 0 0 16px rgba(205, 127, 50, 0.15);
}

.lb-podium-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-podium-score {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
}

.lb-podium-slot[data-rank="1"] .lb-podium-score { color: #ffd700; }
.lb-podium-slot[data-rank="2"] .lb-podium-score { color: #c0c0c0; }
.lb-podium-slot[data-rank="3"] .lb-podium-score { color: #cd7f32; }

.lb-podium-bar {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.5rem;
}

.lb-podium-slot[data-rank="1"] .lb-podium-bar {
  height: 80px;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.13), rgba(255, 215, 0, 0.02));
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-bottom: none;
}

.lb-podium-slot[data-rank="2"] .lb-podium-bar {
  height: 56px;
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.10), rgba(192, 192, 192, 0.02));
  border: 1px solid rgba(192, 192, 192, 0.12);
  border-bottom: none;
}

.lb-podium-slot[data-rank="3"] .lb-podium-bar {
  height: 38px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.10), rgba(205, 127, 50, 0.02));
  border: 1px solid rgba(205, 127, 50, 0.12);
  border-bottom: none;
}

/* Podium-to-table connector */
.lb-podium + .lb-table {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.lb-table th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-weight: 600;
}

.lb-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
}

.lb-table tbody tr {
  transition: background 0.15s;
}

.lb-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.lb-table tr:last-child td {
  border-bottom: none;
}

.lb-rank-1 { color: #ffd700; font-weight: 700; }
.lb-rank-2 { color: #c0c0c0; font-weight: 700; }
.lb-rank-3 { color: #cd7f32; font-weight: 700; }

.lb-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem 0;
}

.lb-your-row {
  background: rgba(0, 255, 136, 0.05) !important;
  border-left: 2px solid var(--accent);
}

/* ── Promo banner (Discord / ad replacement) ── */
.ad-slot {
  margin: 1.25rem auto 1.25rem;
  text-align: center;
  max-width: 728px;
  width: 100%;
}

.promo-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.15), rgba(0, 255, 136, 0.08));
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s;
}
.promo-banner:hover {
  border-color: rgba(88, 101, 242, 0.6);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.22), rgba(0, 255, 136, 0.12));
  text-decoration: none;
}
.promo-badge {
  background: #5865f2;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.promo-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
  min-width: 0;
}
.promo-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}
.promo-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}
.promo-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: #5865f2;
  white-space: nowrap;
  flex-shrink: 0;
}
.promo-banner:hover .promo-cta {
  color: #7289da;
}
@media (max-width: 600px) {
  .promo-banner { flex-direction: column; text-align: center; gap: 0.5rem; padding: 0.75rem; }
  .promo-text { text-align: center; }
}

/* ── Support banner ── */
.support-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.03));
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.25s, background 0.25s;
  max-width: 728px;
  width: 100%;
  margin: 0.5rem auto 0;
  box-sizing: border-box;
}
.support-banner:hover {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(251, 191, 36, 0.06));
  text-decoration: none;
}
.support-badge {
  color: var(--gold);
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.support-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.support-banner:hover .support-cta {
  color: #fcd34d;
}
.sponsor-disclaimer {
  width: 100%;
  font-size: 0.65rem;
  color: #888;
  opacity: 0.5;
  text-align: center;
  margin-top: -0.5rem;
}
@media (max-width: 600px) {
  .support-banner { flex-direction: column; text-align: center; gap: 0.5rem; padding: 0.75rem; }
}

/* ── Premium modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 10, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  animation: scaleReveal 0.3s ease both;
}

.modal-box h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.modal-box > p { color: var(--text-secondary); margin-bottom: 1.75rem; }

/* ── Auth modal ── */
.auth-card {
  position: relative;
  background: linear-gradient(170deg, #0c0c1a 0%, #080812 100%);
  border: 1px solid rgba(0, 255, 136, 0.1);
  border-radius: 16px;
  padding: 2.25rem 2rem 2rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
  overflow: hidden;
  animation: authSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.auth-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 160px;
  background: radial-gradient(ellipse, rgba(0, 255, 136, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s;
  z-index: 2;
}
.auth-close:hover { color: var(--text-primary); }

.auth-header { margin-bottom: 1.5rem; position: relative; z-index: 1; }

.auth-crosshair {
  display: inline-flex;
  margin-bottom: 0.75rem;
  animation: authPulse 2.5s ease-in-out infinite;
}
@keyframes authPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.08); }
}

.auth-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin: 0;
}

.auth-subtitle {
  color: #9090a8;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.auth-step { position: relative; z-index: 1; }

.auth-field { text-align: left; margin-bottom: 0.85rem; }

.auth-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9090a8;
  margin-bottom: 0.35rem;
}
.auth-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #666;
  font-size: 0.7rem;
}

.auth-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus {
  border-color: rgba(0, 255, 136, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.06);
}
.auth-input::placeholder { color: #555; }

.auth-input-code {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.5rem;
}

.auth-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin: 0.25rem 0 0.5rem;
  text-align: left;
}

.auth-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.auth-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-btn-primary {
  background: var(--accent);
  color: #000;
}
.auth-btn-primary:hover:not(:disabled) {
  background: #00e67a;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.auth-btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.auth-hint {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #777;
  line-height: 1.5;
}
.auth-hint strong { color: #aaa; }

.auth-step-desc {
  color: #9090a8;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.auth-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.1);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  animation: authCheckPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes authCheckPop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Premium-specific modal styling ── */
#premium-modal .modal-box {
  max-width: 500px;
  padding: 2.5rem 2rem;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
  border-color: rgba(251, 191, 36, 0.1);
}

#premium-modal .modal-box h2 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--gold), #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.premium-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.4rem 0;
}

.premium-feature::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.plan-cards {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.plan-card {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.25s ease;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.plan-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(251, 191, 36, 0.08), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.plan-card:hover::before {
  opacity: 1;
}

.plan-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.1);
}

.plan-card-popular {
  position: absolute;
  top: -1px;
  right: -1px;
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--gold);
  color: #000;
  padding: 0.25rem 0.6rem;
  border-radius: 0 12px 0 8px;
}

.plan-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.plan-price {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
}

.plan-desc { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  z-index: 200;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Result rank */
#result-rank {
  margin-bottom: 1.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.03em;
  animation: rankPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both;
}

/* ── Avatar ── */
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--bg-primary), 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Profile screen ── */
#screen-profile {
  overflow-y: auto;
  align-items: flex-start;
  padding: 2rem 0;
}

.profile-container {
  width: 100%;
  max-width: 620px;
  margin: auto;
  padding: 0 1rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadeSlideUp 0.5s ease both;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-info h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.profile-bio {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 0.3rem;
  line-height: 1.5;
}

.profile-badge {
  font-family: var(--font-display);
  font-size: 0.6rem;
  background: var(--accent);
  color: #000;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.profile-social-counts {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.social-count {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.social-count:hover .social-count-num {
  color: #fff;
}

.social-count-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  transition: color 0.15s;
}

.social-count span:last-child {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-actions {
  margin-bottom: 1.25rem;
}

.profile-edit {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.profile-input {
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.profile-input:focus {
  border-color: var(--accent);
}

.profile-input::placeholder {
  color: var(--text-secondary);
}

.profile-edit-actions {
  display: flex;
  gap: 0.75rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.profile-stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.profile-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.profile-stat-card h3 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.profile-stat-card[data-mode="flick"] h3    { color: #60a5fa; }
.profile-stat-card[data-mode="strafe"] h3   { color: #34d399; }
.profile-stat-card[data-mode="gridshot"] h3 { color: #fb923c; }
.profile-stat-card[data-mode="tracking"] h3 { color: #c084fc; }
.profile-stat-card[data-mode="speed"] h3    { color: #fb7185; }

.profile-stat-card .stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.profile-stat-card .stat-row span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Social screen ── */
#screen-social {
  overflow-y: auto;
  align-items: flex-start;
  padding: 2rem 0;
}

.social-container {
  width: 100%;
  max-width: 580px;
  margin: auto;
  padding: 0 1rem;
}

.social-search-bar {
  margin-bottom: 1rem;
}

.social-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  min-height: 100px;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.social-card:hover {
  background: var(--bg-card-hover);
}

.social-card-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.social-card-badge {
  font-size: 0.55rem;
  background: var(--accent);
  color: #000;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 700;
  margin-left: 0.5rem;
}

/* ── Leaderboard clickable names ── */
.lb-player-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.lb-player-link:hover {
  text-decoration: underline;
}

/* ── Clickable user name in pill ── */
#user-name {
  cursor: pointer;
}

#user-name:hover {
  text-decoration: underline;
}

/* ── Online dot ── */
.avatar-sm { position: relative; }
.online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; position: absolute; bottom: 1px; right: 1px;
  border: 2px solid var(--bg-primary); pointer-events: none;
}

/* ── Badge chips (achievements) ── */
.badges-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem;
}
.badge-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem;
  font-weight: 600; letter-spacing: 0.03em; white-space: nowrap;
  background: var(--bg-card); border: 1px solid var(--text-secondary);
  color: var(--text-primary);
}
.badge-chip.premium  { border-color: var(--accent); color: var(--accent); }
.badge-chip.centurion { border-color: #f97316; color: #f97316; }
.badge-chip.veteran  { border-color: #a855f7; color: #a855f7; }
.badge-chip.sharpshooter { border-color: #38bdf8; color: #38bdf8; }
.badge-chip.perfect  { border-color: #facc15; color: #facc15; }
.badge-chip.speedster { border-color: #f43f5e; color: #f43f5e; }

/* ── Compare button + comparison table ── */
.compare-table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.25rem;
  font-size: 0.82rem;
}
.compare-table th {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-secondary); padding: 0.4rem 0.5rem; text-align: center;
  border-bottom: 1px solid var(--bg-card);
}
.compare-table th:first-child { text-align: left; }
.compare-table td {
  padding: 0.45rem 0.5rem; text-align: center;
  border-bottom: 1px solid var(--bg-card); color: var(--text-secondary);
}
.compare-table td:first-child { text-align: left; color: var(--text-primary); font-weight: 600; }
.compare-table .winner { color: var(--accent); font-weight: 700; }

/* ── Recent games list ── */
.game-card {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-card); border-radius: 8px; padding: 0.6rem 0.85rem;
}
.game-mode-pill {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.15rem 0.5rem; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.mode-flick     { background: #1d4ed8; color: #bfdbfe; }
.mode-strafe    { background: #065f46; color: #6ee7b7; }
.mode-gridshot  { background: #7c2d12; color: #fdba74; }
.mode-tracking  { background: #4c1d95; color: #ddd6fe; }
.mode-speed     { background: #9f1239; color: #fda4af; }
.game-card-score { font-weight: 700; font-size: 0.95rem; flex: 1; }
.game-card-accuracy { font-size: 0.8rem; color: var(--text-secondary); }
.game-card-time { font-size: 0.75rem; color: var(--text-secondary); margin-left: auto; }

/* ── Feed cards ── */
.feed-card {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-card); border-radius: 8px; padding: 0.75rem 1rem;
}
.feed-card-text { flex: 1; font-size: 0.88rem; line-height: 1.4; }
.feed-card-text strong { color: var(--text-primary); cursor: pointer; }
.feed-card-text strong:hover { text-decoration: underline; }
.feed-card-time { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; }

/* ── Notification bell ── */
.notif-bell-wrap {
  position: relative; display: inline-flex; align-items: center;
}
.btn-icon {
  background: none; border: none; cursor: pointer; font-size: 1.2rem;
  padding: 0.25rem; color: var(--text-secondary); transition: color 0.15s;
  font-family: inherit;
}
.btn-icon:hover { color: var(--text-primary); }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--danger); color: #fff; font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; padding: 0 3px;
  pointer-events: none;
}

/* ── Notification panel ── */
.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 320px;
  background: var(--bg-secondary); z-index: 300;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  transform: translateX(100%); transition: transform 0.25s ease;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1rem; border-bottom: 1px solid var(--bg-card);
}
.notif-panel-header h2 { font-size: 1rem; font-weight: 700; }
.notif-list {
  flex: 1; overflow-y: auto; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.notif-item {
  background: var(--bg-card); border-radius: 8px; padding: 0.75rem;
  font-size: 0.82rem; line-height: 1.5; cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item-time { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.2rem; }
.notif-overlay {
  position: fixed; inset: 0; z-index: 299; background: transparent;
  display: none;
}
.notif-overlay.open { display: block; }

/* ── Challenge friend picker modal ── */
.challenge-modal .modal-box { max-width: 360px; }
.friend-pick-list {
  display: flex; flex-direction: column; gap: 0.4rem;
  max-height: 240px; overflow-y: auto; margin: 1rem 0;
}
.friend-pick-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-card); border-radius: 8px; padding: 0.6rem 0.85rem;
  cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s;
}
.friend-pick-item:hover { border-color: var(--accent); }
.friend-pick-item.selected { border-color: var(--accent); background: var(--bg-card-hover); }

/* ── Challenges tab cards ── */
.challenge-card {
  background: var(--bg-card); border-radius: 8px; padding: 0.85rem 1rem;
  font-size: 0.85rem;
}
.challenge-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
}
.challenge-card-meta { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Section title ── */
.section-title {
  font-family: var(--font-display);
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: 0.75rem; font-weight: 700;
}
.profile-section { margin-bottom: 1.5rem; }
.profile-section-list {
  display: flex; flex-direction: column; gap: 0.4rem;
}

/* ── Suggestions section ── */
.suggestions-section { margin-top: 1rem; }
.suggestions-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 600;
}

/* ── Analytics screen ── */
#screen-analytics {
  overflow-y: auto;
  align-items: flex-start;
  padding: 2rem 0;
}

.analytics-container {
  width: 100%;
  max-width: 640px;
  margin: auto;
  padding: 0 1rem;
}

.analytics-streak-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.analytics-stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.analytics-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.analytics-stat-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

.analytics-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.analytics-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.analytics-chart-wrap { margin-bottom: 1rem; }

.analytics-chart-title {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.analytics-gate {
  text-align: center;
  padding: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.analytics-notice {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.history-filter-select {
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.history-filter-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Leaderboard period tabs ── */
.lb-period-tabs { margin-bottom: 1.25rem; }

.lb-tab-premium::after {
  content: ' ⭐';
  font-size: 0.75em;
  opacity: 0.8;
}

/* ── Settings premium gate ── */
.settings-premium-wall { position: relative; }

.settings-premium-gate {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.9);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

.settings-premium-gate p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* ── Username setup modal ── */
.username-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

#username-modal .modal-box {
  max-width: 400px;
}

#username-modal .profile-input {
  margin-top: 1rem;
}

/* ── Mobile warning ── */
.mobile-warning {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #1a1a10;
  border-bottom: 1px solid #f97316;
  color: #fdba74;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 500;
}

/* ── Menu footer ── */
.menu-footer {
  margin-top: 1.25rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.menu-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.menu-footer a:hover,
.menu-footer-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.menu-footer-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.footer-social-link {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.footer-social-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* ── Toast variants ── */
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--accent); color: #000; }
.toast-info { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--text-secondary); }

/* ── Keyboard shortcuts modal ── */
.shortcuts-modal-box {
  max-width: 380px;
  text-align: left;
}

.shortcuts-modal-box h2 {
  text-align: center;
  margin-bottom: 1.25rem;
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
}

.shortcuts-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--bg-card);
}

.shortcuts-table tr:last-child td { border-bottom: none; }

.shortcuts-table td:first-child {
  width: 100px;
}

kbd {
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

/* ── How to play modal ── */
.howtoplay-modal-box {
  max-width: 480px;
  text-align: left;
}

.howtoplay-modal-box h2 {
  text-align: center;
  margin-bottom: 1.25rem;
}

.howtoplay-modes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.howtoplay-mode {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.howtoplay-mode .game-mode-pill {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.howtoplay-mode p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.howtoplay-tip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-top: 0.5rem;
}

.howtoplay-modal-box .btn-primary { display: block; margin: 0 auto; }

/* ── Sound toggle button ── */
.sound-toggle-btn {
  min-width: 80px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.sound-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Share score canvas (offscreen, not shown) ── */
#share-canvas { display: none; }

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — screens usable on phones (game itself stays desktop-only)
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {

  /* Allow scrolling on non-game screens */
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }

  /* Screens: switch from fixed centering to scrollable flow */
  .screen {
    position: absolute;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    padding: 1rem 0;
  }

  /* Game screen stays fixed (canvas needs it) */
  #screen-game {
    position: fixed;
    padding: 0;
    overflow: hidden;
  }

  /* ── Menu ── */
  .menu-container {
    padding: 0 1rem;
  }

  .title {
    font-size: 1.35rem;
    white-space: nowrap;
  }

  .title-tld {
    font-size: 0.5em;
  }

  .subtitle {
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
  }

  .mode-cards {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0 0.25rem;
  }

  .mode-card {
    width: calc(50% - 0.25rem);
    min-width: 0;
    padding: 0.85rem 0.6rem;
  }

  .mode-icon {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
  }

  .mode-card h2 {
    font-size: 0.95rem;
  }

  .mode-card p {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  /* Auth banner + user pill */
  .auth-banner {
    flex-wrap: wrap;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .user-pill {
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.8rem;
  }

  /* Menu actions */
  .menu-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .menu-footer {
    font-size: 0.65rem;
    gap: 0.3rem;
    padding: 0 0.5rem;
  }

  /* ── Results ── */
  .results-container {
    padding: 0 1rem;
  }

  .score-grade {
    font-size: 3.5rem;
  }

  .score-value {
    font-size: 1.75rem;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    min-width: 0;
    gap: 0.5rem;
  }

  .stats-grid-tracking {
    min-width: 0;
    max-width: none;
  }

  .stat {
    padding: 0.75rem 0.4rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.55rem;
  }

  .results-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .results-actions .btn-primary,
  .results-actions .btn-secondary {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.6rem 0.5rem;
  }

  /* ── Settings ── */
  .settings-container {
    max-width: 100%;
  }

  .settings-container h1 {
    font-size: 1.5rem;
  }

  .settings-section {
    padding: 1rem;
  }

  .setting-row {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .setting-row label {
    flex: 0 0 100%;
    font-size: 0.82rem;
  }

  .setting-row input[type="range"] {
    flex: 1;
    min-width: 0;
  }

  .setting-value {
    flex: 0 0 50px;
    text-align: right;
  }

  /* ── Leaderboard ── */
  .lb-container {
    max-width: 100%;
  }

  .lb-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .lb-tabs {
    gap: 0.25rem;
  }

  .lb-tab {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  .lb-table th,
  .lb-table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.7rem;
  }

  /* Podium */
  .lb-podium {
    min-height: 140px;
    gap: 0.3rem;
  }

  .lb-podium-slot {
    width: 100px;
  }

  .lb-podium-rank {
    font-size: 0.95rem;
  }

  .lb-podium-name {
    font-size: 0.65rem;
    max-width: 90px;
  }

  .lb-podium-score {
    font-size: 0.7rem;
  }

  .lb-podium-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }

  .lb-podium-slot[data-rank="1"] .lb-podium-avatar {
    width: 42px;
    height: 42px;
  }

  /* ── Profile ── */
  .profile-container {
    max-width: 100%;
  }

  .profile-header {
    gap: 1rem;
  }

  .profile-info h1 {
    font-size: 1.35rem;
  }

  .profile-name-row {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .avatar {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  /* ── Social ── */
  .social-container {
    max-width: 100%;
  }

  /* ── Analytics ── */
  .analytics-container {
    max-width: 100%;
  }

  .analytics-streak-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }

  .analytics-stat-card {
    padding: 0.6rem 0.4rem;
  }

  .analytics-stat-value {
    font-size: 1.2rem;
  }

  .analytics-stat-label {
    font-size: 0.58rem;
  }

  .analytics-section {
    padding: 1rem;
  }

  /* ── Notification panel ── */
  .notif-panel {
    width: 100%;
  }

  /* ── Countdown overlay ── */
  #countdown-number {
    font-size: 5rem;
  }

  #pause-overlay h2 {
    font-size: 2.5rem;
  }

  /* ── Modals ── */
  .modal-box {
    width: 95%;
    max-width: none;
    padding: 1.25rem;
  }

  /* ── Promo/support banners (enhance existing) ── */
  .promo-banner,
  .support-banner {
    padding: 0.6rem;
    gap: 0.5rem;
  }

  .promo-badge,
  .support-badge {
    font-size: 0.65rem;
  }

  .promo-text strong,
  .support-banner .promo-text strong {
    font-size: 0.8rem;
  }

  .promo-text span,
  .support-banner .promo-text span {
    font-size: 0.7rem;
  }

  /* ── Buttons ── */
  .btn-primary,
  .btn-secondary {
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
  }

  .btn-sm {
    font-size: 0.78rem;
    padding: 0.3rem 0.75rem;
  }

  /* ── Mode cards: visually muted on mobile ── */
  .mode-card {
    opacity: 0.5;
    pointer-events: auto; /* still clickable to show toast */
  }

  .mode-card::after {
    content: 'Desktop only';
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    opacity: 0.7;
  }

  .mode-card:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.05);
    background: var(--bg-card);
  }
}
