/* ═══════════════════════════════════════════════════════════
   KINGARENA — PREMIUM DARK CHESS PLATFORM
   Design: Luxury Esports · Gold + Neon Blue · Dark Black
═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Core Palette */
  --bg-void:        #050507;
  --bg-base:        #0a0a0f;
  --bg-surface:     #0f0f18;
  --bg-elevated:    #141420;
  --bg-card:        #181825;
  --bg-card-hover:  #1e1e2e;
  --bg-input:       #12121c;

  /* Gold Accents */
  --gold-bright:    #f5c842;
  --gold-mid:       #d4a017;
  --gold-dim:       #8a6a0a;
  --gold-glow:      rgba(245, 200, 66, 0.15);
  --gold-glow-sm:   rgba(245, 200, 66, 0.08);

  /* Neon Blue Accents */
  --blue-bright:    #4fc3f7;
  --blue-mid:       #0288d1;
  --blue-dim:       #01579b;
  --blue-glow:      rgba(79, 195, 247, 0.15);
  --blue-glow-sm:   rgba(79, 195, 247, 0.07);

  /* Status */
  --green:          #4caf50;
  --green-glow:     rgba(76, 175, 80, 0.2);
  --red:            #ef5350;
  --red-glow:       rgba(239, 83, 80, 0.2);
  --orange:         #ff9800;

  /* Text */
  --text-primary:   #f0eefc;
  --text-secondary: #a8a4c8;
  --text-muted:     #5a5878;
  --text-faint:     #2e2c44;

  /* Board */
  --board-light:    #f0d9b5;
  --board-dark:     #b58863;
  --board-light-hl: #cdd16f;
  --board-dark-hl:  #aaa23a;
  --board-move-from: rgba(245, 200, 66, 0.5);
  --board-move-to:   rgba(245, 200, 66, 0.3);
  --board-legal:    rgba(79, 195, 247, 0.35);
  --board-check:    rgba(239, 83, 80, 0.6);

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.04);
  --border-mid:     rgba(255,255,255,0.08);
  --border-gold:    rgba(245, 200, 66, 0.25);
  --border-blue:    rgba(79, 195, 247, 0.2);

  /* Shadows */
  --shadow-card:    0 4px 24px rgba(0,0,0,0.5);
  --shadow-gold:    0 0 30px rgba(245,200,66,0.12);
  --shadow-blue:    0 0 30px rgba(79,195,247,0.1);
  --shadow-modal:   0 24px 80px rgba(0,0,0,0.8);

  /* Typography */
  --font-display:   'Clash Display', 'Syne', sans-serif;
  --font-body:      'Syne', sans-serif;
  --font-mono:      'JetBrains Mono', monospace;

  /* Spacing */
  --topbar-h:       64px;
  --bnav-h:         68px;
  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  /* Transitions */
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:         150ms;
  --t-mid:          280ms;
  --t-slow:         500ms;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── APP SHELL ──────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── PAGES ──────────────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  padding-top: var(--topbar-h);
  padding-bottom: var(--bnav-h);
  animation: pageFadeIn var(--t-mid) var(--ease-out);
}
.page.active { display: block; }

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

.page-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── TOP BAR ────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(5, 5, 7, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  gap: 1rem;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0.4;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--gold-bright));
  animation: crownPulse 3s ease-in-out infinite;
}

@keyframes crownPulse {
  0%, 100% { filter: drop-shadow(0 0 6px var(--gold-bright)); }
  50%       { filter: drop-shadow(0 0 14px var(--gold-bright)); }
}

.logo-accent { color: var(--gold-bright); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  white-space: nowrap;
}

.nav-link:hover { color: var(--text-primary); background: var(--border-subtle); }
.nav-link.active {
  color: var(--gold-bright);
  background: var(--gold-glow-sm);
  border: 1px solid var(--border-gold);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.coin-balance {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gold-bright);
  cursor: pointer;
  transition: all var(--t-fast);
}
.coin-balance:hover { background: var(--bg-card-hover); box-shadow: var(--shadow-gold); }

.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.notif-btn:hover { color: var(--text-primary); border-color: var(--border-mid); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg-void);
  animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.8rem 0.3rem 0.3rem;
  cursor: pointer;
  transition: all var(--t-fast);
}
.user-profile:hover { border-color: var(--border-gold); box-shadow: var(--shadow-gold); }

.avatar-ring {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold-mid);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; }

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.username { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.rating-badge { font-size: 0.7rem; color: var(--gold-bright); font-family: var(--font-mono); }

.chevron { color: var(--text-muted); transition: transform var(--t-fast); }
.user-profile:hover .chevron { transform: rotate(180deg); }

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.menu-btn span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all var(--t-fast);
}

/* ── HERO ───────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 4rem 1.5rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: glowFloat 8s ease-in-out infinite;
}
.glow-gold {
  width: 600px; height: 400px;
  background: var(--gold-mid);
  top: -100px; left: -100px;
}
.glow-blue {
  width: 500px; height: 350px;
  background: var(--blue-mid);
  bottom: -50px; right: -50px;
  animation-delay: -4s;
}

@keyframes glowFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.97); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  flex: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--gold-bright);
  font-family: var(--font-mono);
  margin-bottom: 1.5rem;
  animation: slideDown var(--t-slow) var(--ease-out) both;
}

.pulse-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--green-glow);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(76,175,80,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(76,175,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.title-line {
  display: block;
  animation: slideUp var(--t-slow) var(--ease-out) both;
}
.title-line:nth-child(1) { animation-delay: 0.1s; }
.title-line:nth-child(2) { animation-delay: 0.2s; }
.title-line:nth-child(3) { animation-delay: 0.3s; }

.accent-gold {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin-bottom: 2rem;
  animation: slideUp var(--t-slow) var(--ease-out) 0.4s both;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  animation: slideUp var(--t-slow) var(--ease-out) 0.5s both;
}

.stat-pill { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-divider { width: 1px; height: 36px; background: var(--border-mid); }

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  animation: slideUp var(--t-slow) var(--ease-out) 0.6s both;
}

.hero-board-preview {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideUp var(--t-slow) var(--ease-out) 0.3s both;
}

.mini-board {
  width: min(380px, 42vw);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-gold), var(--shadow-card), var(--shadow-gold);
  transform: perspective(800px) rotateY(-8deg) rotateX(4deg);
  transition: transform var(--t-slow) var(--ease-out);
}
.mini-board:hover { transform: perspective(800px) rotateY(-2deg) rotateX(1deg); }

.board-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at center, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-mid) 100%);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(245,200,66,0.35); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary.full-width { width: 100%; justify-content: center; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-mid);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-gold); background: var(--gold-glow-sm); }
.btn-ghost.full-width { width: 100%; justify-content: center; }
.btn-ghost.small { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--red);
  color: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-danger:hover { background: #c62828; transform: translateY(-1px); }

/* ── SECTIONS ───────────────────────────────────────────── */
.section {
  padding: 4rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.see-all {
  color: var(--gold-bright);
  font-size: 0.85rem;
  font-weight: 500;
  transition: opacity var(--t-fast);
  white-space: nowrap;
}
.see-all:hover { opacity: 0.7; }

/* ── TIME CONTROLS ──────────────────────────────────────── */
.time-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.time-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.time-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--t-mid);
}

.time-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow-gold), var(--shadow-card);
}
.time-card:hover::before { opacity: 1; }

.time-card.bullet .tc-icon { color: var(--red); }
.time-card.blitz  .tc-icon { color: var(--gold-bright); }
.time-card.rapid  .tc-icon { color: var(--blue-bright); }
.time-card.classical .tc-icon { color: var(--green); }

.tc-icon { font-size: 1.8rem; margin-bottom: 0.5rem; display: block; }
.tc-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.2rem;
}
.tc-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: block;
}
.tc-players {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.5rem;
  display: block;
}

/* ── QUICK ACTIONS ──────────────────────────────────────── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.quick-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  transform: scaleX(0);
  transition: transform var(--t-mid) var(--ease-out);
  transform-origin: left;
}

.challenge-card::after { background: var(--red); }
.lobby-card::after     { background: var(--blue-bright); }
.tournament-card::after { background: var(--gold-bright); }
.daily-card::after     { background: var(--green); }

.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.quick-card:hover::after { transform: scaleX(1); }
.challenge-card:hover { border-color: rgba(239,83,80,0.3); }
.lobby-card:hover     { border-color: var(--border-blue); }
.tournament-card:hover { border-color: var(--border-gold); }
.daily-card:hover     { border-color: rgba(76,175,80,0.3); }

.quick-card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.quick-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.quick-card p { font-size: 0.8rem; color: var(--text-muted); }
.quick-card-arrow {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  font-size: 1.1rem;
  color: var(--text-faint);
  transition: all var(--t-fast);
}
.quick-card:hover .quick-card-arrow { color: var(--text-secondary); transform: translateX(3px); }

/* ── LIVE TOURNAMENTS STRIP ─────────────────────────────── */
.live-tournaments-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.tournament-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.tournament-card-item:hover { border-color: var(--border-gold); transform: translateY(-2px); box-shadow: var(--shadow-gold); }

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

.tc-item-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}
.badge-live { background: rgba(239,83,80,0.15); color: var(--red); border: 1px solid rgba(239,83,80,0.3); }
.badge-free { background: rgba(76,175,80,0.12); color: var(--green); border: 1px solid rgba(76,175,80,0.25); }
.badge-paid { background: var(--gold-glow-sm); color: var(--gold-bright); border: 1px solid var(--border-gold); }
.badge-upcoming { background: var(--blue-glow-sm); color: var(--blue-bright); border: 1px solid var(--border-blue); }

.tc-item-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.tc-item-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.tc-item-prize {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.tc-item-progress {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 0.75rem;
  overflow: hidden;
}
.tc-item-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-mid), var(--gold-bright));
  border-radius: 2px;
  transition: width 1s var(--ease-out);
}

/* ── RATINGS GRID ───────────────────────────────────────── */
.ratings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.rating-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--t-mid);
}
.rating-card:hover { border-color: var(--border-gold); box-shadow: var(--shadow-gold); }

.rating-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.rating-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.rating-icon { font-size: 1.2rem; }

.rating-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.rating-best { font-size: 0.75rem; color: var(--text-muted); }
.rating-best span { color: var(--gold-bright); }

.rating-stats {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}
.rs-item { display: flex; flex-direction: column; }
.rs-num { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; }
.rs-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.rs-win { color: var(--green); }
.rs-draw { color: var(--text-muted); }
.rs-loss { color: var(--red); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-top: 0.5rem;
}
.rank-master   { background: rgba(156,39,176,0.15); color: #ce93d8; border: 1px solid rgba(156,39,176,0.3); }
.rank-diamond  { background: var(--blue-glow-sm); color: var(--blue-bright); border: 1px solid var(--border-blue); }
.rank-gold     { background: var(--gold-glow-sm); color: var(--gold-bright); border: 1px solid var(--border-gold); }
.rank-silver   { background: rgba(158,158,158,0.1); color: #bdbdbd; border: 1px solid rgba(158,158,158,0.2); }

/* ── GAME LAYOUT ────────────────────────────────────────── */
#page-game {
  padding-top: var(--topbar-h);
  padding-bottom: var(--bnav-h);
}

.game-layout {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  gap: 1rem;
  height: calc(100vh - var(--topbar-h) - var(--bnav-h));
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

/* ── PLAYER CARDS ───────────────────────────────────────── */
.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color var(--t-fast);
}
.player-card.active-player { border-color: var(--border-gold); box-shadow: var(--shadow-gold); }

.player-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.player-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-mid);
}
.player-status {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.player-status.online { background: var(--green); }
.player-status.offline { background: var(--text-muted); }

.player-details { flex: 1; min-width: 0; }
.player-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-rating { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }

.player-timer {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.7rem;
  flex-shrink: 0;
}
.player-timer.active-timer {
  background: var(--bg-card-hover);
  border-color: var(--gold-mid);
  box-shadow: 0 0 12px var(--gold-glow);
}
.player-timer.low-time { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow); animation: timerPulse 1s ease-in-out infinite; }

@keyframes timerPulse {
  0%, 100% { box-shadow: 0 0 8px var(--red-glow); }
  50%       { box-shadow: 0 0 20px var(--red-glow); }
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

/* ── CHESS BOARD ────────────────────────────────────────── */
.board-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(560px, calc(100vh - var(--topbar-h) - var(--bnav-h) - 180px));
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--gold-dim), var(--shadow-card), var(--shadow-gold);
  user-select: none;
}

.board-coords-left {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: min(560px, calc(100vh - var(--topbar-h) - var(--bnav-h) - 180px));
  padding: 4px 0;
}

.board-coords-bottom {
  position: absolute;
  bottom: -20px; left: 28px;
  display: flex;
  width: min(560px, calc(100vh - var(--topbar-h) - var(--bnav-h) - 180px));
  justify-content: space-around;
}

.coord-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  line-height: 1;
}

.board-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--t-fast);
}

.board-square.light { background: var(--board-light); }
.board-square.dark  { background: var(--board-dark); }
.board-square.highlight-from { background: var(--board-move-from) !important; }
.board-square.highlight-to   { background: var(--board-move-to) !important; }
.board-square.legal-move::after {
  content: '';
  position: absolute;
  width: 30%;
  aspect-ratio: 1;
  background: var(--board-legal);
  border-radius: 50%;
  pointer-events: none;
}
.board-square.legal-capture::after {
  width: 100%;
  border-radius: 0;
  background: transparent;
  border: 4px solid var(--board-legal);
  border-radius: 50%;
  width: 90%;
}
.board-square.in-check { background: var(--board-check) !important; }
.board-square.selected { background: rgba(245,200,66,0.4) !important; }

.chess-piece {
  width: 88%;
  height: 88%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 5vw, 2.4rem);
  cursor: grab;
  transition: transform var(--t-fast) var(--ease-spring);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
}
.chess-piece:hover { transform: scale(1.12); }
.chess-piece.dragging { transform: scale(1.2); cursor: grabbing; z-index: 10; opacity: 0.9; }
.chess-piece.moving { animation: pieceMove 0.2s var(--ease-out); }

@keyframes pieceMove {
  0%   { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ── GAME CONTROLS BAR ──────────────────────────────────── */
.game-controls-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ctrl-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ctrl-btn:hover { color: var(--text-primary); border-color: var(--border-mid); background: var(--bg-card-hover); }
.ctrl-btn.resign-btn:hover { color: var(--red); border-color: rgba(239,83,80,0.3); }

/* ── MOVE LIST ──────────────────────────────────────────── */
.move-list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.move-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.move-count {
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.move-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.move-list-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2rem 1rem;
}

.move-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  gap: 0.25rem;
  align-items: center;
  padding: 0.2rem 0.25rem;
  border-radius: var(--radius-sm);
}
.move-row:hover { background: var(--bg-elevated); }

.move-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.move-san {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.move-san:hover { background: var(--bg-elevated); color: var(--text-primary); }
.move-san.current { background: var(--gold-glow-sm); color: var(--gold-bright); border: 1px solid var(--border-gold); }

/* ── REACTIONS ──────────────────────────────────────────── */
.reactions-bar {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.reaction-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-spring);
}
.reaction-btn:hover { transform: scale(1.2); border-color: var(--border-gold); background: var(--bg-card-hover); }

.reaction-popup {
  position: fixed;
  font-size: 2.5rem;
  pointer-events: none;
  z-index: 200;
  animation: reactionFloat 1.5s var(--ease-out) forwards;
  display: none;
}

@keyframes reactionFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.5); }
}

/* ── CAPTURED PIECES ────────────────────────────────────── */
.captured-pieces {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
}
.captured-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); display: block; margin-bottom: 0.3rem; }
.captured-list { display: flex; flex-wrap: wrap; gap: 1px; font-size: 0.9rem; min-height: 20px; }

/* ── GAME ACTIONS ───────────────────────────────────────── */
.game-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── TOURNAMENTS PAGE ───────────────────────────────────── */
.tournaments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tournament-full-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
}
.tournament-full-card:hover { border-color: var(--border-gold); transform: translateY(-4px); box-shadow: var(--shadow-gold), var(--shadow-card); }

.tfc-banner {
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tfc-banner-free     { background: linear-gradient(135deg, #0d2b0d, #1a4a1a); }
.tfc-banner-paid     { background: linear-gradient(135deg, #1a1200, #3d2e00); }
.tfc-banner-premium  { background: linear-gradient(135deg, #0a0a1a, #1a0a2e); }

.tfc-banner-icon { font-size: 2.5rem; filter: drop-shadow(0 0 12px rgba(255,255,255,0.3)); }

.tfc-body { padding: 1.25rem; }
.tfc-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.tfc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tfc-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tfc-prize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tfc-prize-label { font-size: 0.75rem; color: var(--text-muted); }
.tfc-prize-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.tfc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}
.tfc-players { font-size: 0.78rem; color: var(--text-muted); }
.tfc-players span { color: var(--text-secondary); font-weight: 600; }

/* ── STANDINGS TABLE ────────────────────────────────────── */
.standings-section { margin-top: 2rem; }
.standings-table-wrap { overflow-x: auto; }
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.standings-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.standings-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.standings-table tr:hover td { background: var(--bg-elevated); }
.standings-table tr:first-child td { color: var(--gold-bright); }

/* ── WALLET PAGE ────────────────────────────────────────── */
.wallet-layout {
  display: grid;
  grid-template-columns: 1fr 280px 280px;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-gold);
}

.balance-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, var(--gold-glow) 0%, transparent 60%);
  pointer-events: none;
}

.balance-content { position: relative; z-index: 1; }
.balance-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); display: block; margin-bottom: 0.75rem; }

.balance-amount {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.coin-icon-lg { font-size: 2rem; }
.balance-num {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1;
}
.balance-inr { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

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

.balance-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-gold);
  position: relative;
  z-index: 1;
}
.bal-stat { display: flex; flex-direction: column; }
.bal-stat-num { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.bal-stat-label { font-size: 0.7rem; color: var(--text-muted); }

.daily-rewards-card, .reward-methods {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.streak-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.streak-fire { font-size: 1.5rem; }
.streak-num {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--orange);
  line-height: 1;
}
.streak-label { font-size: 0.8rem; color: var(--text-muted); }

.streak-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  margin-bottom: 1.25rem;
}
.streak-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.streak-day.claimed { background: var(--orange); border-color: var(--orange); color: white; }
.streak-day.today { border-color: var(--gold-bright); color: var(--gold-bright); animation: todayPulse 2s ease-in-out infinite; }

@keyframes todayPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--gold-glow); }
  50%       { box-shadow: 0 0 0 4px var(--gold-glow); }
}

.reward-list { display: flex; flex-direction: column; gap: 0.75rem; }
.reward-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--t-fast);
}
.reward-item:hover { border-color: var(--border-gold); background: var(--bg-card-hover); }
.reward-item-icon { font-size: 1.3rem; flex-shrink: 0; }
.reward-item-info { flex: 1; }
.reward-item-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.reward-item-desc { font-size: 0.72rem; color: var(--text-muted); }
.reward-item-coins { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--gold-bright); white-space: nowrap; }

/* ── TRANSACTIONS ───────────────────────────────────────── */
.transactions-section { margin-top: 1rem; }
.transactions-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--t-fast);
}
.tx-item:hover { border-color: var(--border-mid); }

.tx-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.tx-icon.win     { background: rgba(76,175,80,0.12); }
.tx-icon.loss    { background: rgba(239,83,80,0.1); }
.tx-icon.deposit { background: var(--blue-glow-sm); }
.tx-icon.reward  { background: var(--gold-glow-sm); }

.tx-info { flex: 1; }
.tx-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.tx-date { font-size: 0.72rem; color: var(--text-muted); }

.tx-amount {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
}
.tx-amount.positive { color: var(--green); }
.tx-amount.negative { color: var(--red); }

/* ── LEADERBOARD ────────────────────────────────────────── */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 2rem 1rem;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.podium-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--border-mid);
  overflow: hidden;
}
.podium-place:nth-child(1) .podium-avatar { width: 72px; height: 72px; border-color: var(--gold-bright); box-shadow: 0 0 20px var(--gold-glow); }
.podium-place:nth-child(2) .podium-avatar { border-color: #bdbdbd; }
.podium-place:nth-child(3) .podium-avatar { border-color: #cd7f32; }

.podium-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.podium-rating { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

.podium-stand {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}
.podium-place:nth-child(1) .podium-stand { height: 80px; background: linear-gradient(180deg, var(--gold-mid), var(--gold-dim)); color: #0a0a0f; }
.podium-place:nth-child(2) .podium-stand { height: 60px; background: linear-gradient(180deg, #757575, #424242); color: white; }
.podium-place:nth-child(3) .podium-stand { height: 44px; background: linear-gradient(180deg, #a1887f, #6d4c41); color: white; }

.leaderboard-table-wrap { overflow-x: auto; }
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.leaderboard-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.leaderboard-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.leaderboard-table tr:hover td { background: var(--bg-elevated); }

.lb-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}
.lb-rank.gold   { color: var(--gold-bright); }
.lb-rank.silver { color: #bdbdbd; }
.lb-rank.bronze { color: #cd7f32; }

.lb-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  overflow: hidden;
}
.lb-name { font-weight: 600; color: var(--text-primary); font-size: 0.875rem; }
.lb-rating { font-family: var(--font-mono); font-weight: 700; color: var(--text-primary); }
.lb-streak { color: var(--orange); font-weight: 600; }

/* ── FILTER TABS ────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.25rem;
}

.filter-tab {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  border: none;
  background: none;
}
.filter-tab:hover { color: var(--text-secondary); }
.filter-tab.active {
  background: var(--bg-elevated);
  color: var(--gold-bright);
  border: 1px solid var(--border-gold);
}
.filter-tabs.small .filter-tab { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

/* ── BOTTOM NAV ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  background: rgba(5, 5, 7, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  z-index: 100;
}

.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
  min-width: 56px;
}
.bnav-btn:hover { color: var(--text-secondary); }
.bnav-btn.active { color: var(--gold-bright); }
.bnav-btn.active svg { filter: drop-shadow(0 0 6px var(--gold-glow)); }

/* ── MODALS ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  width: min(480px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  z-index: 201;
  opacity: 0;
  pointer-events: none;
  transition: all var(--t-mid) var(--ease-spring);
  box-shadow: var(--shadow-modal);
}
.modal.active {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}
.modal.small-modal { width: min(360px, calc(100vw - 2rem)); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--t-fast);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.modal-body { padding: 1.5rem; }
.modal-body.center-content { text-align: center; }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── MATCH TYPE CARDS ───────────────────────────────────── */
.match-type-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.match-type-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
}
.match-type-card:hover { transform: translateY(-3px); }
.free-match:hover { border-color: rgba(76,175,80,0.4); box-shadow: 0 8px 24px rgba(76,175,80,0.1); }
.paid-match:hover { border-color: var(--border-gold); box-shadow: var(--shadow-gold); }

.match-type-icon { font-size: 2rem; margin-bottom: 0.75rem; display: block; }
.match-type-card h4 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.4rem; }
.match-type-card p { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.match-type-reward { font-size: 0.75rem; font-weight: 600; color: var(--gold-bright); font-family: var(--font-mono); }

/* ── REGION SELECTOR ────────────────────────────────────── */
.region-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.region-btn {
  flex: 1;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.region-btn:hover { color: var(--text-secondary); border-color: var(--border-mid); }
.region-btn.active { color: var(--gold-bright); border-color: var(--border-gold); background: var(--gold-glow-sm); }

/* ── STAKES GRID ────────────────────────────────────────── */
.stakes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stake-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-mid) var(--ease-out);
}
.stake-card:hover { border-color: var(--border-gold); transform: translateY(-2px); box-shadow: var(--shadow-gold); }

.stake-amount {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
  display: block;
  margin-bottom: 0.25rem;
}
.stake-prize { font-size: 0.72rem; color: var(--text-muted); }
.stake-prize span { color: var(--green); font-weight: 600; }

.platform-fee-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}

/* ── MATCHMAKING ANIMATION ──────────────────────────────── */
.matchmaking-animation {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mm-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: mmSpin 2s linear infinite;
}
.mm-ring-1 { width: 120px; height: 120px; border-top-color: var(--gold-bright); animation-duration: 2s; }
.mm-ring-2 { width: 90px; height: 90px; border-top-color: var(--blue-bright); animation-duration: 1.5s; animation-direction: reverse; }
.mm-ring-3 { width: 60px; height: 60px; border-top-color: var(--gold-mid); animation-duration: 1s; }

@keyframes mmSpin { to { transform: rotate(360deg); } }

.mm-center {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px var(--gold-bright));
  animation: crownPulse 2s ease-in-out infinite;
}

.mm-info { margin-bottom: 1.5rem; }
.mm-time {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.mm-status { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.mm-rating-range { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ── CHALLENGE FRIEND MODAL ─────────────────────────────── */
.room-code-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.room-code-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.room-code {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.1em;
  flex: 1;
}
.copy-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.copy-btn:hover { color: var(--gold-bright); border-color: var(--border-gold); }

.divider-text {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.75rem 0;
  position: relative;
}
.divider-text::before, .divider-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border-subtle);
}
.divider-text::before { left: 0; }
.divider-text::after  { right: 0; }

.invite-link-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.invite-link-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.875rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  outline: none;
}

.challenge-options { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.25rem; }
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toggle-group { display: flex; gap: 0.25rem; }
.toggle-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}
.toggle-btn:hover { color: var(--text-secondary); }
.toggle-btn.active { background: var(--gold-glow-sm); color: var(--gold-bright); border-color: var(--border-gold); }

.select-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.select-input:hover, .select-input:focus { border-color: var(--border-gold); }

/* ── DEPOSIT PACKAGES ───────────────────────────────────── */
.deposit-packages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.deposit-pkg {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.deposit-pkg:hover { border-color: var(--border-gold); }
.deposit-pkg.popular { border-color: var(--gold-mid); }
.deposit-pkg-popular-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  display: block;
}
.deposit-pkg-amount { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.deposit-pkg-coins { font-size: 0.75rem; color: var(--gold-bright); font-family: var(--font-mono); }

.payment-methods { display: flex; flex-direction: column; gap: 0.5rem; }
.payment-method-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  width: 100%;
  text-align: left;
}
.payment-method-btn:hover { border-color: var(--border-gold); color: var(--text-primary); }
.payment-method-icon { font-size: 1.2rem; }

/* ── REWARD ANIMATION ───────────────────────────────────── */
.reward-animation {
  margin: 1rem auto 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.reward-coin { font-size: 3rem; animation: rewardBounce 0.6s var(--ease-spring) infinite alternate; }
@keyframes rewardBounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-8px) scale(1.1); }
}
.reward-amount { font-family: var(--font-mono); font-size: 2.5rem; font-weight: 700; color: var(--gold-bright); }
.reward-label { font-size: 0.85rem; color: var(--text-muted); }
.streak-bonus { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.5rem; background: var(--bg-elevated); padding: 0.75rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }

/* ── RESULT DISPLAY ─────────────────────────────────────── */
.result-display {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.result-stats {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.result-stat { display: flex; flex-direction: column; align-items: center; }
.result-stat-num { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.result-stat-label { font-size: 0.72rem; color: var(--text-muted); }

/* ── TOAST ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + 1rem);
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  animation: toastIn var(--t-mid) var(--ease-spring) both;
  pointer-events: all;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast.success { border-color: rgba(76,175,80,0.4); }
.toast.error   { border-color: rgba(239,83,80,0.4); }
.toast.info    { border-color: var(--border-gold); }
.toast.removing { animation: toastOut var(--t-mid) var(--ease-out) both; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ── FLOATING PIECES ────────────────────────────────────── */
.floating-pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.floating-piece {
  position: absolute;
  font-size: 2rem;
  opacity: 0.04;
  animation: floatPiece linear infinite;
}

@keyframes floatPiece {
  0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.04; }
  90%  { opacity: 0.04; }
  100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

/* ── ANIMATIONS ─────────────────────────────────────────── */
@keyframes slideUp   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .wallet-layout { grid-template-columns: 1fr 1fr; }
  .balance-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .topbar-nav { display: none; }
  .menu-btn { display: flex; }
  .hero { flex-direction: column; text-align: center; padding: 3rem 1.5rem; gap: 2rem; }
  .hero-content { max-width: 100%; }
  .hero-sub { max-width: 100%; }
  .hero-stats { justify-content: center; }
  .hero-cta { justify-content: center; }
  .hero-board-preview { display: none; }
  .game-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .game-sidebar-left { order: 1; }
  .game-center { order: 2; }
  .game-sidebar-right { order: 3; }
  .chess-board { width: min(480px, calc(100vw - 2rem)); }
  .board-coords-left { height: min(480px, calc(100vw - 2rem)); }
}

@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar { padding: 0 1rem; }
  .logo-text { display: none; }
  .user-info { display: none; }
  .coin-balance { padding: 0.3rem 0.6rem; }
  .coin-balance .coin-amount { display: none; }
  .section { padding: 2.5rem 1rem; }
  .time-controls-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .wallet-layout { grid-template-columns: 1fr; }
  .match-type-cards { grid-template-columns: 1fr; }
  .stakes-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 2.4rem; }
  .podium { gap: 0.5rem; }
  .podium-stand { width: 64px; }
}

@media (max-width: 400px) {
  .time-controls-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 2rem; }
}