/* ===================================================
   Tennify — "Noir Court" Web Theme
   Dark-mode-first, premium sports aesthetic.
   Deep blacks, warm gold/amber, terracotta clay-court.
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* --- Tokens --- */
:root {
  /* Core backgrounds */
  --bg:            #09090B;
  --bg-elevated:   #0F0F12;
  --surface:       #16161A;
  --surface-el:    #1E1E24;
  --surface-hi:    #26262E;

  /* Gold accent */
  --gold:          #E4A221;
  --gold-muted:    #B8841E;
  --gold-subtle:   rgba(228,162,33,0.10);
  --gold-glow:     rgba(228,162,33,0.04);

  /* Terracotta */
  --terra:         #D4583A;
  --terra-subtle:  rgba(212,88,58,0.10);

  /* Text */
  --text:          #F0EDE8;
  --text-sec:      #918C85;
  --text-muted:    #5C5852;
  --text-on-gold:  #09090B;

  /* Borders */
  --border:        #26262E;
  --border-subtle: #1E1E24;
  --border-gold:   rgba(228,162,33,0.25);

  /* Semantic */
  --win:           #34D399;
  --win-bg:        rgba(52,211,153,0.12);
  --loss:          #F87171;
  --loss-bg:       rgba(248,113,113,0.12);
  --warn:          #FBBF24;

  /* Leaderboard */
  --rank-gold:     #FFD700;
  --rank-silver:   #C0C0C0;
  --rank-bronze:   #CD7F32;

  /* Radii */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Font */
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.anim-up   { animation: fadeUp .5s ease both; }
.anim-up-1 { animation: fadeUp .5s ease .05s both; }
.anim-up-2 { animation: fadeUp .5s ease .10s both; }
.anim-up-3 { animation: fadeUp .5s ease .15s both; }
.anim-up-4 { animation: fadeUp .5s ease .20s both; }
.anim-up-5 { animation: fadeUp .5s ease .25s both; }
.anim-up-6 { animation: fadeUp .5s ease .30s both; }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle noise texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.02'/%3E%3C/svg%3E");
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--gold-muted); }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Uppercase label utility --- */
.label-caps {
  font-size: .5625rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ===================================================
   HEADER
   =================================================== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.3px;
}
.logo:hover { color: var(--text); }

.logo-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}
.logo-mark--sm { width: 20px; height: 20px; }

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  transition: color .2s ease;
}
.nav-link:hover { color: var(--text); }

/* ===================================================
   FOOTER
   =================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-content { text-align: center; }

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.footer-name {
  font-weight: 700;
  font-size: .875rem;
  color: var(--text-sec);
}

.footer-tagline {
  color: var(--text-muted);
  font-size: .8125rem;
  margin-bottom: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.footer-links a {
  color: var(--text-muted);
  font-size: .75rem;
  letter-spacing: .3px;
}
.footer-links a:hover { color: var(--text-sec); }

.footer-copy {
  color: var(--text-muted);
  font-size: .6875rem;
  letter-spacing: .3px;
}

/* --- Main --- */
.site-main {
  flex: 1;
  padding: 0 0 40px 0;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
  text-decoration: none;
  letter-spacing: .3px;
}

.btn-primary {
  background: var(--gold);
  color: var(--text-on-gold);
}
.btn-primary:hover {
  background: var(--gold-muted);
  color: var(--text-on-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-lg {
  padding: 16px 48px;
  font-size: 1rem;
  border-radius: var(--r-lg);
  letter-spacing: .5px;
}

/* ===================================================
   CHALLENGE PAGE
   =================================================== */
.challenge-page { padding-top: 20px; }

/* Badge */
.challenge-badge {
  display: inline-block;
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 5px 16px;
  border-radius: var(--r-sm);
  margin-bottom: 28px;
}

/* Hero */
.challenge-hero {
  text-align: center;
  padding: 40px 0 20px;
}

.challenge-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.player-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  position: relative;
}
.player-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  pointer-events: none;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hi);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--gold);
}

.player-info { text-align: center; }

.player-name {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 2px;
  line-height: 1.1;
}

.player-username {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 24px;
}

/* ELO hero card */
.player-elo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 48px;
  position: relative;
}
.player-elo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.elo-label {
  font-size: .5625rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.elo-value {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

.elo-underline {
  width: 28px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  margin-top: 8px;
}

/* Stats */
.challenge-stats { padding: 24px 0 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .2s ease;
}
.stat-card:hover { border-color: var(--surface-hi); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.stat-wins   { color: var(--win); }
.stat-losses { color: var(--loss); }
.stat-highlight { color: var(--gold); }

.stat-label {
  font-size: .5625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Rankings */
.ranking-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ranking-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 28px;
  min-width: 140px;
  transition: border-color .2s ease;
}
.ranking-badge:hover { border-color: var(--border-gold); }

.ranking-scope {
  font-size: .5625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.ranking-rank {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.ranking-total {
  font-size: .6875rem;
  color: var(--text-muted);
}

/* Streak */
.streak-banner {
  text-align: center;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: .8125rem;
  letter-spacing: .5px;
}
.streak-win {
  background: var(--win-bg);
  color: var(--win);
  border: 1px solid rgba(52,211,153,0.2);
}
.streak-loss {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1px solid rgba(248,113,113,0.2);
}

/* Recent Matches */
.challenge-matches { padding: 20px 0; }

.section-title {
  font-size: .5625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  transition: background .15s ease, border-color .15s ease;
}
.match-item:hover {
  background: var(--surface-el);
  border-color: var(--surface-hi);
}

.match-win  { border-left: 3px solid var(--win); }
.match-loss { border-left: 3px solid var(--loss); }

.result-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  font-weight: 800;
  font-size: .6875rem;
  letter-spacing: 1px;
}
.result-win  { background: var(--win-bg);  color: var(--win); }
.result-loss { background: var(--loss-bg); color: var(--loss); }

.match-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.match-opponent {
  font-weight: 600;
  font-size: .875rem;
}
.match-score {
  color: var(--text-sec);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}
.match-date {
  color: var(--text-muted);
  font-size: .75rem;
  white-space: nowrap;
  letter-spacing: .3px;
}

/* CTA Section */
.challenge-cta {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  position: relative;
}
.challenge-cta::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: var(--gold);
}

.cta-heading {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.3px;
}

.cta-subtext {
  color: var(--text-sec);
  margin-bottom: 28px;
  font-size: .9375rem;
}

.cta-note {
  color: var(--text-muted);
  font-size: .75rem;
  margin-top: 12px;
  margin-bottom: 20px;
  letter-spacing: .3px;
}

.app-store-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.store-badge {
  display: inline-block;
  transition: transform .2s ease, opacity .2s ease;
  opacity: .85;
}
.store-badge:hover {
  transform: translateY(-1px);
  opacity: 1;
}

/* Smart Banner */
.smart-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.smart-banner-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.smart-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.smart-banner-icon { flex-shrink: 0; }
.smart-banner-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: .8125rem;
  line-height: 1.3;
}
.smart-banner-info strong { font-size: .875rem; }
.smart-banner-info span { color: var(--text-muted); }
.smart-banner-btn {
  background: var(--gold);
  color: var(--text-on-gold);
  font-size: .75rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  letter-spacing: .5px;
}
.smart-banner-btn:hover { color: var(--text-on-gold); }

/* ===================================================
   LEADERBOARD PAGE
   =================================================== */
.leaderboard-page { padding-top: 30px; }

.leaderboard-header {
  text-align: center;
  margin-bottom: 28px;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.5px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: .75rem;
  margin-top: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Scope Selector */
.scope-selector {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.scope-tab {
  padding: 8px 20px;
  border-radius: var(--r-sm);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all .2s ease;
  border: 1px solid var(--border);
  letter-spacing: .5px;
}
.scope-tab:hover {
  color: var(--text);
  border-color: var(--surface-hi);
  background: var(--surface);
}
.scope-tab--active {
  background: var(--gold);
  color: var(--text-on-gold);
  border-color: var(--gold);
}
.scope-tab--active:hover {
  background: var(--gold);
  color: var(--text-on-gold);
}

/* Table */
.leaderboard-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

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

.leaderboard-table thead { background: var(--surface-el); }

.leaderboard-table th {
  padding: 12px 16px;
  font-size: .5625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.leaderboard-row:last-child td { border-bottom: none; }

.leaderboard-row {
  transition: background .15s ease;
}
.leaderboard-row:hover { background: rgba(228,162,33,0.03); }

.col-rank   { width: 60px;  text-align: center; }
.col-elo    { width: 100px; }
.col-record { width: 100px; }
.col-trend  { width: 60px;  text-align: center; }

.rank-number {
  font-weight: 800;
  font-size: .9375rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-gold .rank-number   { color: var(--rank-gold);   font-size: 1.125rem; }
.rank-silver .rank-number { color: var(--rank-silver); }
.rank-bronze .rank-number { color: var(--rank-bronze); }

/* Top 3 rows get elevated background */
.rank-gold,
.rank-silver,
.rank-bronze { background: var(--surface-el); }

.player-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.player-link:hover { color: var(--text); }
.player-link:hover .player-display-name { color: var(--gold); }

.player-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-hi);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.player-avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  font-weight: 700;
  font-size: .75rem;
  color: var(--gold);
}

.player-names {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.player-display-name {
  font-weight: 600;
  font-size: .875rem;
  transition: color .2s ease;
}
.player-handle {
  font-size: .6875rem;
  color: var(--text-muted);
}

.elo-badge {
  font-weight: 800;
  font-size: .9375rem;
  color: var(--text);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.record-wins   { color: var(--win);  font-weight: 700; font-variant-numeric: tabular-nums; }
.record-sep    { color: var(--text-muted); margin: 0 2px; }
.record-losses { color: var(--loss); font-weight: 700; font-variant-numeric: tabular-nums; }

.trend-indicator { font-size: .8125rem; font-weight: 700; }
.trend-up     { color: var(--win); }
.trend-down   { color: var(--loss); }
.trend-stable { color: var(--text-muted); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 0;
}
.pagination-btn {
  padding: 8px 20px;
  border-radius: var(--r-sm);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .2s ease;
  letter-spacing: .3px;
}
.pagination-btn:hover:not(.pagination-disabled) {
  background: var(--surface-el);
  color: var(--text);
  border-color: var(--surface-hi);
}
.pagination-disabled {
  opacity: .3;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination-info {
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .5px;
}

/* ===================================================
   ERROR PAGE
   =================================================== */
.error-page { padding: 80px 0; }

.error-content {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.error-icon { margin-bottom: 28px; }

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: 4px;
  font-variant-numeric: tabular-nums;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-sec);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.error-message {
  color: var(--text-muted);
  font-size: .9375rem;
  margin-bottom: 32px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state-icon { margin-bottom: 20px; }
.empty-state h2 {
  font-size: 1.125rem;
  margin-bottom: 8px;
  font-weight: 700;
}
.empty-state p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: .875rem;
}

/* ── Leaderboard local-scope CTA ── */
.lb-cta {
  text-align: center;
  padding: 72px 24px 80px;
  max-width: 480px;
  margin: 0 auto;
}
.lb-cta-logo {
  display: block;
  margin: 0 auto 24px;
  opacity: .9;
}
.lb-cta-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.3px;
  margin-bottom: 12px;
  color: var(--text);
}
.lb-cta-desc {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.6;
  margin-bottom: 32px;
}
.lb-cta-btn {
  display: inline-block;
  background: var(--gold);
  color: var(--text-on-gold);
  padding: 13px 32px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: .9375rem;
  text-decoration: none;
  letter-spacing: -.1px;
  transition: opacity .2s, transform .2s;
}
.lb-cta-btn:hover {
  opacity: .9;
  transform: translateY(-2px);
  color: var(--text-on-gold);
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .ranking-badges { flex-direction: column; align-items: center; }
  .ranking-badge { min-width: 200px; }
  .player-name { font-size: 1.75rem; }
  .elo-value { font-size: 2.5rem; letter-spacing: 2px; }
  .cta-heading { font-size: 1.25rem; }
  .page-title { font-size: 1.5rem; }
  .scope-selector { justify-content: flex-start; }
  .leaderboard-table th,
  .leaderboard-table td { padding: 10px; }
  .col-trend { display: none; }
  .player-avatar-sm { width: 28px; height: 28px; }
  .player-handle { display: none; }
  .error-code { font-size: 4rem; }
  .error-actions { flex-direction: column; align-items: center; }
  .app-store-links { flex-direction: column; align-items: center; }
}

/* ===================================================
   LANDING PAGE  (lp-* namespace)
   =================================================== */

/* ── Keyframes ── */
@keyframes lp-float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-10px) rotate(.5deg); }
  66%       { transform: translateY(-5px) rotate(-.3deg); }
}
@keyframes lp-particle-drift {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: var(--p-op); }
  50%  { transform: translateY(-40px) translateX(12px) scale(1.1); opacity: calc(var(--p-op) * 1.5); }
  100% { transform: translateY(0) translateX(0) scale(1); opacity: var(--p-op); }
}
@keyframes lp-shimmer-slide {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}
@keyframes lp-reveal-up {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes lp-reveal-left {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes lp-reveal-right {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes lp-glow-pulse {
  0%, 100% { opacity: .5; transform: scale(1); }
  50%       { opacity: 1;  transform: scale(1.05); }
}
@keyframes lp-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes lp-rank-slide {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Scroll reveal base ── */
.lp-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .55s ease-out,
              transform .55s cubic-bezier(.25,.46,.45,.94);
  will-change: opacity, transform;
}
.lp-reveal.lp-from-left  { transform: translateX(-16px); }
.lp-reveal.lp-from-right { transform: translateX(16px); }
.lp-reveal.visible {
  opacity: 1;
  transform: translate(0);
}
.lp-reveal-d1 { transition-delay: .07s; }
.lp-reveal-d2 { transition-delay: .14s; }
.lp-reveal-d3 { transition-delay: .21s; }
.lp-reveal-d4 { transition-delay: .28s; }
.lp-reveal-d5 { transition-delay: .35s; }

/* ── Root wrapper ── */
.lp { overflow-x: hidden; }

/* ── Shared section ── */
.lp-section {
  padding: 96px 0;
  position: relative;
}
.lp-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.lp-section-label::before {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--gold);
}
.lp-section-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 20px;
}
.lp-section-sub {
  font-size: 1.0625rem;
  color: var(--text-sec);
  line-height: 1.7;
  max-width: 560px;
}
.lp-gold { color: var(--gold); }

/* ─────────────────────────────────────────────────
   HERO
───────────────────────────────────────────────── */
.lp-hero {
  position: relative;
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 60px 0 80px;
}

/* Radial glow behind the card */
.lp-hero-glow {
  position: absolute;
  right: -10%;
  top: 50%;
  transform: translateY(-50%);
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228,162,33,.12) 0%, transparent 70%);
  pointer-events: none;
}
.lp-hero-glow-left {
  position: absolute;
  left: -5%;
  top: 30%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,88,58,.06) 0%, transparent 70%);
  pointer-events: none;
}

/* Court SVG background */
.lp-court-bg {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  width: 55%;
  max-width: 700px;
  opacity: .04;
  pointer-events: none;
}

/* Particle field */
.lp-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.lp-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  animation: lp-particle-drift linear infinite;
}

/* Hero inner grid */
.lp-hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Left text */
.lp-hero-text { display: flex; flex-direction: column; }

.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 24px;
}
.lp-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: lp-glow-pulse 2.5s ease infinite;
}

.lp-headline {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 24px;
}
.lp-headline-em {
  font-style: normal;
  background: linear-gradient(135deg, var(--gold) 0%, #F5C842 50%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: lp-shimmer-slide 4s linear infinite;
}

.lp-hero-sub {
  font-size: 1.125rem;
  color: var(--text-sec);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 40px;
}

.lp-hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lp-btn-store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-el);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 22px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s;
  min-width: 160px;
}
.lp-btn-store:hover {
  border-color: var(--gold);
  background: var(--surface-hi);
  transform: translateY(-2px);
  color: var(--text);
}
.lp-btn-store-icon { flex-shrink: 0; opacity: .9; }
.lp-btn-store-text { display: flex; flex-direction: column; }
.lp-btn-store-text small {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-sec);
}
.lp-btn-store-text strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

/* ── Challenge card mockup ── */
.lp-hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lp-challenge-mock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 320px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(228,162,33,.08);
  animation: lp-float 7s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

.lp-mock-badge {
  display: inline-block;
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-full);
  padding: 4px 12px;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 20px;
}

.lp-mock-player {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.lp-mock-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold-subtle);
  border: 1.5px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}
.lp-mock-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.lp-mock-handle {
  font-size: .8125rem;
  color: var(--text-muted);
}

.lp-mock-elo-block {
  background: var(--surface-el);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lp-mock-elo-label {
  font-size: .5625rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}
.lp-mock-elo-val {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text);
}

.lp-mock-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.lp-mock-stat {
  flex: 1;
  background: var(--surface-el);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lp-mock-stat-val { font-size: 1.125rem; font-weight: 800; }
.lp-mock-stat-lbl { font-size: .5rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text-muted); text-transform: uppercase; }
.lp-mock-stat-val.win  { color: var(--win); }
.lp-mock-stat-val.loss { color: var(--loss); }
.lp-mock-stat-val.gold { color: var(--gold); }

.lp-mock-ranks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.lp-mock-rank {
  font-size: .75rem;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  gap: 6px;
}
.lp-mock-rank::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .6;
  flex-shrink: 0;
}

.lp-mock-cta {
  display: block;
  background: var(--gold);
  color: var(--text-on-gold);
  text-align: center;
  border-radius: var(--r-md);
  padding: 13px;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.lp-mock-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.25) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: lp-shimmer-slide 2.5s linear infinite;
}

/* Floating accent pills */
.lp-accent-pill {
  position: absolute;
  background: var(--surface-el);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 8px 14px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  z-index: 3;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.lp-accent-pill-1 {
  top: -16px;
  right: -24px;
  color: var(--win);
  border-color: rgba(52,211,153,.3);
  animation: lp-float 5s ease-in-out infinite;
  animation-delay: .8s;
}
.lp-accent-pill-2 {
  bottom: 24px;
  left: -32px;
  color: var(--gold);
  border-color: var(--border-gold);
  animation: lp-float 6s ease-in-out infinite;
  animation-delay: 2s;
}
.lp-accent-pill-3 {
  top: 50%;
  right: -40px;
  transform: translateY(-50%);
  color: var(--text-sec);
  animation: lp-float 4.5s ease-in-out infinite;
  animation-delay: 1.2s;
}

/* ─────────────────────────────────────────────────
   HOW IT WORKS
───────────────────────────────────────────────── */
.lp-how { background: var(--bg-elevated); }
.lp-how-header { text-align: center; margin-bottom: 72px; }
.lp-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.lp-step {
  background: var(--surface);
  padding: 48px 36px;
  position: relative;
}
.lp-step-num {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--surface-hi);
  margin-bottom: 24px;
  display: block;
}
.lp-step-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -.4px;
}
.lp-step-desc {
  font-size: .9375rem;
  color: var(--text-sec);
  line-height: 1.65;
}
.lp-step-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.25rem;
}

/* ─────────────────────────────────────────────────
   VIRAL CHALLENGE LINK
───────────────────────────────────────────────── */
.lp-viral { }
.lp-viral-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: center;
}
.lp-viral-url-wrap {
  margin-top: 32px;
}
.lp-url-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  gap: 12px;
  margin-bottom: 8px;
}
.lp-url-lock {
  color: var(--gold);
  flex-shrink: 0;
  opacity: .8;
}
.lp-url-text {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .9375rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.lp-url-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--gold);
  vertical-align: text-bottom;
  flex-shrink: 0;
  animation: lp-blink .8s step-end infinite;
}
.lp-url-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-sec);
  cursor: pointer;
  padding: 6px 12px;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
.lp-url-copy:hover { color: var(--gold); border-color: var(--border-gold); }
.lp-url-hint {
  font-size: .8125rem;
  color: var(--text-muted);
  padding-left: 4px;
}

/* Viral mockup — share preview cards */
.lp-viral-previews {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.lp-share-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.lp-share-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  color: var(--gold);
}
.lp-share-body { flex: 1; }
.lp-share-name { font-size: .875rem; font-weight: 700; color: var(--text); }
.lp-share-meta { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.lp-share-elo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 1px;
}

/* ─────────────────────────────────────────────────
   ELO RANKING SYSTEM
───────────────────────────────────────────────── */
.lp-elo { background: var(--bg-elevated); }
.lp-elo-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
.lp-elo-text { padding-top: 16px; }
.lp-elo-detail {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lp-elo-point {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.lp-elo-point-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
  margin-top: 6px;
}
.lp-elo-point-text {
  font-size: .9375rem;
  color: var(--text-sec);
  line-height: 1.6;
}
.lp-elo-point-text strong { color: var(--text); }

/* Cascade of ranking tiers */
.lp-rank-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lp-rank-tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .5s ease-out, transform .5s cubic-bezier(.25,.46,.45,.94),
              border-color .2s, background .2s;
  will-change: opacity, transform;
}
.lp-rank-tier.visible { opacity: 1; transform: translateX(0); }
.lp-rank-tier:hover {
  border-color: var(--border-gold);
  background: var(--surface-el);
}
.lp-rank-tier-icon {
  font-size: 1.375rem;
  width: 44px;
  text-align: center;
  flex-shrink: 0;
}
.lp-rank-tier-info { flex: 1; }
.lp-rank-tier-name {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
}
.lp-rank-tier-sub {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.lp-rank-tier-badge {
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-transform: uppercase;
  flex-shrink: 0;
}
/* Indent tiers to show hierarchy */
.lp-rank-tier:nth-child(2) { margin-left: 20px; }
.lp-rank-tier:nth-child(3) { margin-left: 40px; }
.lp-rank-tier:nth-child(4) { margin-left: 60px; }

/* Stagger the tier reveal delays */
.lp-rank-tier:nth-child(1) { transition-delay: .05s; }
.lp-rank-tier:nth-child(2) { transition-delay: .15s; }
.lp-rank-tier:nth-child(3) { transition-delay: .25s; }
.lp-rank-tier:nth-child(4) { transition-delay: .35s; }

/* ─────────────────────────────────────────────────
   STATS
───────────────────────────────────────────────── */
.lp-stats {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 72px 0;
}
.lp-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.lp-stat-block {
  background: var(--surface);
  padding: 48px 36px;
  text-align: center;
}
.lp-stat-num {
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}
.lp-stat-num span { color: var(--gold); }
.lp-stat-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────
   DOWNLOAD CTA
───────────────────────────────────────────────── */
.lp-download {
  padding: 120px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.lp-download-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228,162,33,.08) 0%, transparent 65%);
  pointer-events: none;
}
.lp-download-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.1;
}
.lp-download-sub {
  font-size: 1.0625rem;
  color: var(--text-sec);
  max-width: 440px;
  margin: 0 auto 48px;
  line-height: 1.7;
}
.lp-download-ctas {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.lp-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: var(--text-on-gold);
  border-radius: var(--r-lg);
  padding: 16px 28px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.2px;
  text-decoration: none;
  transition: opacity .2s, transform .2s;
}
.lp-btn-primary:hover {
  opacity: .9;
  transform: translateY(-2px);
  color: var(--text-on-gold);
}

/* ─────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lp-hero-inner  { grid-template-columns: 1fr; }
  .lp-hero-visual { order: -1; }
  .lp-challenge-mock { width: 290px; }
  .lp-viral-inner { grid-template-columns: 1fr; }
  .lp-viral-previews { display: none; }
  .lp-elo-inner   { grid-template-columns: 1fr; }
  .lp-rank-tier:nth-child(n) { margin-left: 0; }
}
@media (max-width: 640px) {
  .lp-section { padding: 64px 0; }
  .lp-steps { grid-template-columns: 1fr; }
  .lp-stats-grid { grid-template-columns: 1fr; }
  .lp-step { padding: 32px 24px; }
  .lp-hero { padding: 40px 0 64px; }
  .lp-accent-pill-2, .lp-accent-pill-3 { display: none; }
}

/* ── Language switcher ── */
.lang-switch {
  background: var(--surface-el);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-sec) !important;
  transition: border-color .2s, color .2s;
}
.lang-switch:hover {
  border-color: var(--border-gold);
  color: var(--gold) !important;
}

/* ── Web app link (hero + challenge CTA) ── */
.lp-hero-webapp {
  display: inline-block;
  margin-top: 14px;
  font-size: .8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s;
  letter-spacing: .2px;
}
.lp-hero-webapp:hover { color: var(--gold); }

.cta-webapp-link {
  display: inline-block;
  margin-top: 10px;
  font-size: .8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s;
}
.cta-webapp-link:hover { color: var(--gold); }
