: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: 'Hanken Grotesk', '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; }
}

/* Overshoot lives in the easing curve alone (one mild snap) — the keyframes
   go straight to rest so the pop lands once, not twice */
@keyframes rankPop {
  0%   { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes gradeReveal {
  0%   { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  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 {
  /* stays position: fixed from .screen — that already anchors the lock hint */
  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;
}

/* ── Daily challenge banner — tinted with the day's mode color ── */
.daily-banner {
  --mode-c: var(--accent);
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 728px;
  width: 100%;
  margin: 0 auto 1.5rem;
  padding: 0.8rem 1.25rem;
  background: color-mix(in srgb, var(--mode-c) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--mode-c) 30%, transparent);
  border-radius: 10px;
  text-align: left;
  animation: fadeSlideUp 0.6s ease 0.25s both;
}
.daily-kicker { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--font-display); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mode-c); white-space: nowrap; margin-bottom: 0.15rem; }
.daily-main { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 0.05rem; }
.daily-main strong { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.2; }
.daily-main span { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btn-daily { white-space: nowrap; }
.daily-leader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  background: rgba(255, 215, 94, 0.08);
  border: 1px solid rgba(255, 215, 94, 0.35);
  white-space: nowrap;
}
.daily-leader svg { color: var(--gold, #ffd75e); flex-shrink: 0; }
.daily-leader-text { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.daily-leader-text span { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.daily-leader-text strong { font-size: 0.85rem; color: var(--gold, #ffd75e); }
.lb-daily-info { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.lock-hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: #ffd75e; background: rgba(255, 215, 94, 0.1); border: 1px solid rgba(255, 215, 94, 0.35);
  border-radius: 6px; padding: 0.3rem 0.7rem; pointer-events: none; z-index: 5;
}

.lb-season-info {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.45rem; font-size: 0.8rem; color: var(--text-secondary);
  margin: 0.1rem 0 0.75rem; line-height: 1.5;
}
.lb-season-label {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-secondary); opacity: 0.7;
}
#lb-season-name { color: var(--text-primary); font-weight: 600; }
.lb-season-select {
  font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text-primary);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; padding: 0.18rem 0.5rem; cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.lb-season-select:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); }
.lb-season-select:focus-visible { outline: 2px solid rgba(0,255,136,0.5); outline-offset: 1px; }
.lb-season-select option { background: #10101c; color: #e4e4f0; }
.lb-season-champ { color: var(--gold, #ffd75e); font-weight: 600; }
.lb-daily-yesterday { font-size: 0.78rem; color: var(--gold, #ffd75e); margin-bottom: 0.9rem; }
#btn-daily:disabled { opacity: 0.7; cursor: default; }
@media (max-width: 600px) {
  .daily-banner { flex-direction: column; text-align: center; gap: 0.5rem; }
  .daily-main { align-items: center; }
  .daily-main span { white-space: normal; }
}

/* Play streak pill — gold, same family as the ranked badge */
.menu-streak {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: -1.7rem auto 1.7rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold, #ffd75e);
  background: rgba(255, 215, 94, 0.08);
  border: 1px solid rgba(255, 215, 94, 0.35);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  animation: fadeSlideUp 0.5s ease 0.15s both;
}

/* Streak + season pills sit on one row under the subtitle; the row carries
   the pull-up margin the lone streak pill used to */
.menu-pills { display: flex; justify-content: center; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: -1.7rem auto 1.7rem; }
.menu-pills .menu-streak { margin: 0; }
.menu-season {
  color: var(--accent);
  background: rgba(0, 255, 136, 0.07);
  border-color: rgba(0, 255, 136, 0.32);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu-season:hover { background: rgba(0, 255, 136, 0.13); }
.menu-season.ending { color: var(--gold); background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.4); }
.menu-season .sep { opacity: 0.45; margin: 0 0.1rem; }

/* Season recap modal */
.season-recap-kicker { font-family: var(--font-display); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.25rem; }
.season-recap-block { margin-top: 1rem; text-align: left; }
.season-recap-block h3 { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin: 0 0 0.5rem; }
.season-recap-row { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); align-items: start; column-gap: 0.5rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.season-recap-row:last-child { border-bottom: none; }
.season-recap-mode { font-weight: 700; font-size: 0.88rem; line-height: 1.6rem; }
.season-recap-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.season-recap-chips .badge-chip { padding-left: 0.5rem; padding-right: 0.5rem; }
.season-recap-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }
.season-recap-note { color: var(--text-secondary); font-size: 0.85rem; margin: 0.25rem 0 0; }

/* Personal-best line on the results screen */
.result-pb {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}
.result-pb.pb-new { color: var(--gold, #ffd75e); font-weight: 700; }
.result-pb.pb-close { color: var(--accent); }

.hero-tagline {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-top: 0.75rem;
  animation: fadeSlideUp 0.6s ease 0.05s both;
}

/* Browser surfaces the app shell never styled (matches the static pages) */
html { color-scheme: dark; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
td { font-variant-numeric: tabular-nums; }

.subtitle {
  color: var(--text-secondary);
  margin: 0.35rem 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;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeSlideUp 0.5s ease 0.4s both;
}

.btn-menu-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-menu-action svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.mode-card {
  --mode-c: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  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%, color-mix(in srgb, var(--mode-c) 9%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

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

.mode-card:hover {
  border-color: color-mix(in srgb, var(--mode-c) 40%, transparent);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px color-mix(in srgb, var(--mode-c) 10%, transparent), 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

/* Drawn crossed-swords mark for everything ranked */
.swords-icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 0.3rem;
}

/* Ranked badge inside mode cards — starts a ranked round */
.ranked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.75rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffd75e;
  background: rgba(255, 215, 94, 0.08);
  border: 1px solid rgba(255, 215, 94, 0.35);
  position: relative;
  z-index: 1;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.ranked-badge .swords-icon {
  width: 11px;
  height: 11px;
  margin-right: 0;
  vertical-align: 0;
}

.ranked-badge:hover {
  background: #ffd75e;
  color: #000;
  border-color: #ffd75e;
}

/* Board toggle (Casual / Ranked) on the leaderboard */
.lb-board-tabs {
  margin-bottom: 0.9rem;
}

.lb-board-tabs .lb-tab[data-board="ranked"].active {
  background: #ffd75e;
  border-color: #ffd75e;
  color: #000;
}

.mode-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--mode-c);
  background: color-mix(in srgb, var(--mode-c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--mode-c) 22%, transparent);
}

.mode-icon svg {
  width: 22px;
  height: 22px;
}

.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;
  flex: 1;
}

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

/* Quiet return address on the shared-screenshot surface */
.results-watermark {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.55;
  margin: 0.35rem 0 0.75rem;
  user-select: none;
}

.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.5s cubic-bezier(0.22, 1.18, 0.36, 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;
}

/* Match a game: select + sens + FOV + button on one line, wrapping on phones */
.setting-match { align-items: flex-start; }
.setting-match label { padding-top: 0.35rem; }
.match-fields { flex: 1; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.match-fields select,
.match-fields input[type="number"] {
  background: #1a1a28;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.match-fields select { flex: 1 1 8rem; min-width: 8rem; }
.match-fields input[type="number"] { width: 5.5rem; }
.match-fields input[type="number"][hidden] { display: none; }
.setting-note {
  margin: 0.15rem 0 0.5rem 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* 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.62;
  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;
}

/* ── Guest sign-up prompt on the results screen ── */
.results-signup {
  max-width: 460px;
  margin: 1.25rem auto 0.5rem;
  padding: 0.9rem 1.1rem;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid rgba(0, 255, 136, 0.22);
  border-radius: 8px;
}

.results-signup p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.7rem;
}

/* ── 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;
}

/* Secondary filters (sort + period) share one quiet row below the mode pills */
.lb-filter-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.lb-filter-row .lb-tabs { margin-bottom: 0; }

.lb-period-tabs {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 0.9rem;
}

.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: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms 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 {
  transform: scale(0.96);
}

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

/* Sort/period are tertiary — ghost pills, green-tint when active, so the
   board and mode rows keep the visual weight */
.lb-sort-tabs .lb-tab,
.lb-period-tabs .lb-tab {
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  border-color: transparent;
  background: transparent;
}

.lb-sort-tabs .lb-tab:hover,
.lb-period-tabs .lb-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}

.lb-sort-tabs .lb-tab.active,
.lb-period-tabs .lb-tab.active {
  background: rgba(0, 255, 136, 0.1);
  border-color: rgba(0, 255, 136, 0.3);
  color: var(--accent);
}

/* ── 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;
}

/* Podium slots and player links are real buttons now: reset the UA button
   styling, keep the visual rules below */
button.lb-podium-slot, button.lb-player-link, .user-name-btn {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: inherit; cursor: pointer;
}
.user-name-btn { color: var(--text-secondary); }
.user-name-btn:hover { color: var(--accent); }
[role="button"] { cursor: pointer; }
.modal-box:focus, .auth-card:focus { outline: none; }

.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-slot:active {
  transform: scale(0.97);
}

.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; }
}

/* ── Marshal cross-promo (reuses .promo-banner layout, recolored to Marshal indigo) ── */
.promo-marshal {
  background: linear-gradient(135deg, rgba(124, 108, 246, 0.16), rgba(124, 108, 246, 0.05));
  border-color: rgba(124, 108, 246, 0.38);
}
.promo-marshal:hover {
  border-color: rgba(124, 108, 246, 0.65);
  background: linear-gradient(135deg, rgba(124, 108, 246, 0.24), rgba(124, 108, 246, 0.09));
}
.promo-marshal .promo-badge { background: linear-gradient(180deg, #9b8cff, #7c6cf6); }
.promo-marshal .promo-cta { color: #9b8cff; }
.promo-marshal:hover .promo-cta { color: #b3a8ff; }
.promo-logo {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(124, 108, 246, 0.35), 0 4px 12px -3px rgba(124, 108, 246, 0.5);
}
.ad-slot .promo-banner + .promo-banner { margin-top: 0.6rem; }

/* ── Sensitivity-converter self-promo (reuses .promo-banner layout, cyan so it
   reads distinct from the green announcement slides) ── */
.promo-converter {
  background: linear-gradient(135deg, rgba(0, 208, 255, 0.12), rgba(0, 208, 255, 0.04));
  border-color: rgba(0, 208, 255, 0.32);
}
.promo-converter:hover {
  border-color: rgba(0, 208, 255, 0.58);
  background: linear-gradient(135deg, rgba(0, 208, 255, 0.18), rgba(0, 208, 255, 0.07));
}
.promo-converter .promo-badge { background: #00d0ff; color: #000; }
.promo-converter .promo-cta { color: #00d0ff; }
.promo-converter:hover .promo-cta { color: #5ce0ff; }
.promo-converter .promo-icon { width: 34px; height: 34px; flex-shrink: 0; color: #00d0ff; }

/* ── Menu carousels (announcements + self-promos) ──
   Slides stack in one grid cell so every banner shares the tallest slide's
   size; the active one sweeps in from the right while the outgoing one
   exits left. */
.carousel .carousel-track { display: grid; }
.carousel .carousel-track > * {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateX(32px) scale(0.975);
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.22, 0.9, 0.3, 1);
  pointer-events: none;
}
.carousel .carousel-track > .carousel-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.carousel .carousel-track > .carousel-exit {
  opacity: 0;
  transform: translateX(-32px) scale(0.975);
}
.carousel .carousel-track > .promo-banner + .promo-banner { margin-top: 0; }
@media (prefers-reduced-motion: reduce) {
  .carousel .carousel-track > * { transition: opacity 0.2s ease; transform: none; }
}
.slide-disabled { display: none !important; }
.carousel-dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.carousel-dots:empty { display: none; }
.carousel-dot { width: 7px; height: 7px; border-radius: 999px; border: none; padding: 0; background: rgba(255, 255, 255, 0.18); cursor: pointer; transition: background 0.25s, width 0.3s cubic-bezier(0.22, 0.9, 0.3, 1); }
.carousel-dot:hover { background: rgba(255, 255, 255, 0.35); }
.carousel-dot.active { width: 20px; background: var(--accent); }

/* Announcement slides reuse the promo-banner form, tinted to the site accent */
.announce-banner { width: 100%; font-family: inherit; font-size: inherit; cursor: pointer; background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 255, 136, 0.03)); border: 1px solid rgba(0, 255, 136, 0.3); }
.announce-banner:hover { border-color: rgba(0, 255, 136, 0.55); background: linear-gradient(135deg, rgba(0, 255, 136, 0.14), rgba(0, 255, 136, 0.05)); }
.announce-banner .promo-badge { background: var(--accent); color: #000; }
.announce-banner .promo-cta { color: var(--accent); }
.announce-banner:hover .promo-cta { color: #66ffb8; }
@media (max-width: 600px) {
  .promo-logo { width: 40px; height: 40px; }
}

/* ── 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.16, 1, 0.3, 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);
}

/* Solid gold + glow — the same vocabulary as an S-grade score */
#premium-modal .modal-box h2 {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 28px rgba(255, 215, 94, 0.35);
}

.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.4s cubic-bezier(0.22, 1.18, 0.36, 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 chips — mono uppercase data chips per the design language.
   Placement tints are state (podium metals + signal green); achievements
   stay neutral so color keeps meaning. */
.badge-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.24rem 0.55rem; border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}
.badge-chip svg { width: 11px; height: 11px; flex-shrink: 0; }
.badge-chip b { font-weight: 700; }

.badge-chip.season-badge.rank-1 {
  color: #ffd700; border-color: rgba(255, 215, 0, 0.45); background: rgba(255, 215, 0, 0.08);
}
.badge-chip.season-badge.rank-2 {
  color: #c8c8d4; border-color: rgba(192, 192, 192, 0.4); background: rgba(192, 192, 192, 0.07);
}
.badge-chip.season-badge.rank-3 {
  color: #d8a050; border-color: rgba(205, 127, 50, 0.45); background: rgba(205, 127, 50, 0.08);
}
.badge-chip.season-badge.rank-top10 {
  color: var(--accent); border-color: rgba(0, 255, 136, 0.3); background: rgba(0, 255, 136, 0.06);
}
/* Profile season history — one row per closed season */
.season-history-row {
  display: flex; align-items: baseline; gap: 0.7rem;
  flex-wrap: wrap; margin-bottom: 0.55rem;
}
.season-history-label {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary); white-space: nowrap;
}
.season-history-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* Achievement identities keep their colors (like the five mode colors) —
   the icons are stroke SVGs, so the tint carries through them too */
/* Premium reads platinum — the only white-hot chip, so it can't be confused
   with Top 10 green or the gold/yellow tier */
.badge-chip.premium      { color: #f2f2f7; border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.09); }
.badge-chip.centurion    { color: #f97316; border-color: rgba(249, 115, 22, 0.4);  background: rgba(249, 115, 22, 0.07); }
.badge-chip.veteran      { color: #a855f7; border-color: rgba(168, 85, 247, 0.4);  background: rgba(168, 85, 247, 0.07); }
.badge-chip.sharpshooter { color: #38bdf8; border-color: rgba(56, 189, 248, 0.4);  background: rgba(56, 189, 248, 0.07); }
.badge-chip.perfect      { color: #facc15; border-color: rgba(250, 204, 21, 0.4);  background: rgba(250, 204, 21, 0.07); }
.badge-chip.speedster    { color: #f43f5e; border-color: rgba(244, 63, 94, 0.4);   background: rgba(244, 63, 94, 0.07); }
.badge-chip.season-share { font: inherit; font-size: 0.7rem; font-weight: 700; cursor: pointer; color: var(--accent); border-color: rgba(0, 255, 136, 0.35); background: rgba(0, 255, 136, 0.06); }
.badge-chip.season-share:hover { background: rgba(0, 255, 136, 0.14); }
.badge-chip.streak_7     { color: #fb923c; border-color: rgba(251, 146, 60, 0.4);  background: rgba(251, 146, 60, 0.07); }
.badge-chip.streak_30    { color: #ff5c5c; border-color: rgba(255, 92, 92, 0.45);  background: rgba(255, 92, 92, 0.08); }
.badge-chip.daily_winner { color: #ffd75e; border-color: rgba(255, 215, 94, 0.45); background: rgba(255, 215, 94, 0.08); }
.badge-chip.daily_podium { color: #34d399; border-color: rgba(52, 211, 153, 0.4);  background: rgba(52, 211, 153, 0.07); }
.menu-streak.at-risk { color: var(--danger); background: rgba(255, 64, 96, 0.08); border-color: rgba(255, 64, 96, 0.4); }

/* ── 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: rgba(255,100,50,0.15); color: #ff6432; }
.mode-strafe    { background: rgba(64,160,255,0.15); color: #40a0ff; }
.mode-gridshot  { background: rgba(160,100,255,0.15); color: #a064ff; }
.mode-tracking  { background: rgba(0,255,136,0.12); color: #00ff88; }
.mode-speed     { background: rgba(255,220,0,0.12); color: #ffdc00; }
.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 { background: rgba(0, 255, 136, 0.06); border: 1px solid rgba(0, 255, 136, 0.22); }
.notif-item.unread:hover { background: rgba(0, 255, 136, 0.1); }
.notif-item-time { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.2rem; }
.notif-cta { color: var(--accent); font-size: 0.74rem; font-weight: 700; margin-top: 0.3rem; }
.notif-item:hover .notif-cta { text-decoration: underline; }
.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;
}

.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 a { color: var(--accent); font-weight: 700; }
.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);
  }
}

/* ── Reduced motion (system setting): every CSS animation and transition
   collapses to a frame; the carousel keeps its opacity swap. Game loops run
   on requestAnimationFrame and are not affected. ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Drill presets (settings) ── */
.settings-help { color: var(--text-secondary); font-size: 0.85rem; margin: -0.25rem 0 0.9rem; }
.drill-presets { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.25rem; }
.drill-row { display: grid; grid-template-columns: 5.5rem repeat(3, minmax(0, 1fr)); gap: 0.4rem; align-items: center; }
.drill-mode { font-weight: 700; font-size: 0.85rem; }
.drill {
  font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.45rem 0.5rem; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.drill:hover { color: var(--text); border-color: rgba(0, 255, 136, 0.35); }
.drill[aria-pressed="true"] { color: var(--accent); border-color: rgba(0, 255, 136, 0.5); background: rgba(0, 255, 136, 0.07); }

/* ── Results trend ── */
.result-trend { margin: 0.9rem auto 0; max-width: 480px; text-align: left; }
.result-daily-nudge { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; max-width: 480px; margin: 0.9rem auto 1rem; padding: 0.6rem 0.85rem; border: 1px solid rgba(0, 255, 136, 0.28); border-radius: 10px; background: var(--bg-card); text-align: left; animation: fadeSlideUp 0.5s ease 0.5s both; }
.result-daily-nudge-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.result-daily-nudge-text strong { font-family: var(--font-display); font-size: 1rem; color: var(--text-primary); }
.result-daily-nudge-sub { font-size: 0.78rem; color: var(--text-secondary); }
.result-daily-nudge .btn-sm { flex-shrink: 0; }
@media (max-width: 480px) { .result-daily-nudge { flex-direction: column; align-items: stretch; } }
.result-trend-head { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.result-trend-head #result-trend-delta { font-weight: 700; }
.result-trend-head #result-trend-delta.up { color: var(--accent); }
.result-trend-head #result-trend-delta.down { color: var(--text-secondary); }
.result-trend-body { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.75rem; }
.result-trend-body canvas { display: block; width: 100%; height: 72px; }
.result-trend.locked canvas { filter: blur(5px); opacity: 0.85; }
.result-trend-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.75rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--text); background: rgba(10, 10, 16, 0.35); border-radius: 10px; }
