/* ═══════════════════════════════════════════════════════════════════════════
   PAWNUP.ORG — EMERALD & OBSIDIAN CHESS ARENA (v5.0)
   Rebuilt from scratch: Sharp Obsidian Surfaces, Emerald Accents & Split-Bento
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Obsidian Surfaces */
  --bg-primary: #080b0f;
  --bg-secondary: #0e1319;
  --bg-elevated: #141b23;
  --bg-subtle: #1a232e;
  --bg-card: rgba(14, 19, 25, 0.9);
  --bg-card-hover: rgba(20, 27, 35, 0.98);
  --bg-glass: rgba(8, 11, 15, 0.82);

  /* Crisp 1px Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-active: rgba(16, 185, 129, 0.52);

  /* Emerald Accents (No Yellow Clutter) */
  --emerald-primary: #10b981;
  --emerald-light: #34d399;
  --emerald-deep: #059669;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --emerald-glow: rgba(16, 185, 129, 0.28);

  /* Semantic Supporting Colors */
  --blue-accent: #38bdf8;
  --purple-accent: #a78bfa;
  --red-accent: #ef4444;
  --orange-accent: #f97316;

  /* Text Hierarchy */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Default Chess Board Theme: Tournament Emerald */
  --board-light: #e8edd5;
  --board-dark: #4b7d5b;
  --board-highlight: rgba(52, 211, 153, 0.38);
  --board-selected: rgba(16, 185, 129, 0.56);
  --board-check: rgba(239, 68, 68, 0.78);
  --board-hint: rgba(56, 189, 248, 0.45);

  /* Typography */
  --font-main: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Radii & Motion */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ══════════ BOARD THEMES ══════════ */
body[data-theme="emerald"], html[data-theme="emerald"] {
  --board-light: #e8edd5;
  --board-dark: #4b7d5b;
  --board-highlight: rgba(52, 211, 153, 0.38);
}

body[data-theme="wood"], html[data-theme="wood"] {
  --board-light: #ebd5b3;
  --board-dark: #a67b56;
  --board-highlight: rgba(16, 185, 129, 0.34);
}

body[data-theme="marble"], html[data-theme="marble"] {
  --board-light: #e2e8f0;
  --board-dark: #64748b;
  --board-highlight: rgba(56, 189, 248, 0.36);
}

body[data-theme="classic"], html[data-theme="classic"] {
  --board-light: #f1f5f9;
  --board-dark: #475569;
  --board-highlight: rgba(16, 185, 129, 0.34);
}

body[data-theme="neon"], html[data-theme="neon"] {
  --board-light: #2a1b4e;
  --board-dark: #110b26;
  --board-highlight: rgba(56, 189, 248, 0.45);
  --board-hint: rgba(167, 139, 250, 0.55);
}

body[data-theme="neon"] .chess-piece-svg {
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.48));
}
body[data-theme="neon"] .chess-piece-svg g[style*="fill:#262421"],
body[data-theme="neon"] .chess-piece-svg path[style*="fill:#262421"],
body[data-theme="neon"] .chess-piece-svg circle[style*="fill:#262421"] {
  fill: #241d3d !important;
}
body[data-theme="neon"] .chess-piece-svg g[style*="stroke:#ffffff"],
body[data-theme="neon"] .chess-piece-svg path[style*="stroke:#ffffff"],
body[data-theme="neon"] .chess-piece-svg circle[style*="stroke:#ffffff"] {
  stroke: #c084fc !important;
}

/* ══════════ RESET & BASE ══════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  color-scheme: dark;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.text-gold,
.text-emerald {
  background: linear-gradient(135deg, #6ee7b7 0%, #10b981 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

button, input, select, textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--emerald-primary);
  outline-offset: 2px;
}

#particlesCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.btn-svg, .nav-svg, .caret-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.caret-svg { width: 13px; height: 13px; opacity: 0.7; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(16, 185, 129, 0.45); }

/* ══════════ BUTTONS & INPUTS ══════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.58rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background 0.16s ease, border-color 0.16s ease, box-shadow 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-primary) 0%, var(--emerald-deep) 100%);
  color: #031710;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.24);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--emerald-light) 0%, var(--emerald-primary) 100%);
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.36);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-main);
  border-color: var(--border-strong);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.28);
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fff;
}

.btn-lg { padding: 0.82rem 1.45rem; font-size: 0.95rem; border-radius: var(--radius-md); }
.btn-sm { padding: 0.46rem 0.82rem; font-size: 0.81rem; }
.btn-xs { padding: 0.32rem 0.64rem; font-size: 0.75rem; border-radius: 7px; }
.btn-block { width: 100%; }

.input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input:focus {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}
.input-sm { padding: 0.46rem 0.72rem; font-size: 0.82rem; }
.form-label { display: block; font-size: 0.76rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.form-group { margin-bottom: 0.65rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ══════════ 2. NAVBAR ══════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: 62px;
  background: rgba(8, 11, 15, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.navbar-inner {
  max-width: 1420px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--emerald-primary) 0%, var(--emerald-deep) 100%);
  color: #031710;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.32);
}

.brand-icon-sm { width: 28px; height: 28px; font-size: 0.95rem; border-radius: 8px; }

.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}
.brand-dot { color: var(--emerald-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.42rem 0.85rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  color: var(--emerald-light);
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.28);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 36px;
  padding: 0 0.72rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.nav-ctrl-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}
.nav-icon-only { width: 36px; padding: 0; justify-content: center; }

.custom-dropdown { position: relative; }
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65);
  z-index: 950;
  max-height: 340px;
  overflow-y: auto;
}

.dropdown-choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.48rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}
.dropdown-choice:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }
.dropdown-choice.active { background: var(--emerald-soft); color: var(--emerald-light); }

.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.swatch-emerald { background: linear-gradient(135deg, #e8edd5 50%, #4b7d5b 50%); }
.swatch-wood { background: linear-gradient(135deg, #ebd5b3 50%, #a67b56 50%); }
.swatch-marble { background: linear-gradient(135deg, #e2e8f0 50%, #64748b 50%); }
.swatch-neon { background: linear-gradient(135deg, #2a1b4e 50%, #a78bfa 50%); }
.swatch-classic { background: linear-gradient(135deg, #f1f5f9 50%, #475569 50%); }

.lang-flag-slot, .country-flag-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.lang-flag-svg { display: block; border-radius: 3px; }
.country-flag-icon { object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.15); }

.mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ══════════ 3. MOBILE DRAWER ══════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  z-index: 980;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: -320px;
  width: 295px;
  max-width: 86vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: 990;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  transition: left 0.28s var(--ease);
}
.mobile-drawer.open { left: 0; }

.drawer-close-btn {
  align-self: flex-end;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
}
.drawer-avatar { border-radius: 50%; object-fit: cover; border: 2px solid var(--emerald-primary); }
.drawer-user-info { display: flex; flex-direction: column; }
.drawer-username { font-weight: 700; font-size: 0.92rem; }
.drawer-rating { font-size: 0.78rem; color: var(--emerald-light); font-family: var(--font-mono); }

.drawer-nav { display: flex; flex-direction: column; gap: 0.35rem; }
.drawer-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.drawer-nav-btn.active { background: var(--emerald-soft); color: var(--emerald-light); border-color: var(--border-active); }

.drawer-settings {
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.drawer-label { display: block; font-size: 0.76rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0.35rem; }
.drawer-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
}
.drawer-lang-pills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.35rem; }
.drawer-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.drawer-lang-btn.active { border-color: var(--emerald-primary); color: var(--emerald-light); background: var(--emerald-soft); }
.drawer-auth { margin-top: auto; padding-top: 0.5rem; }

/* ══════════ 4. SPLIT-HERO + BENTO GRID LANDING ══════════ */
.hero-section {
  position: relative;
  z-index: 1;
  padding: 2.2rem 1.25rem 3.5rem;
  overflow: hidden;
}

.hero-ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 25%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 25%, #000 35%, transparent 100%);
  pointer-events: none;
}

.hero-ambient-glow {
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 960px;
  height: 520px;
  background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.14) 0%, rgba(16, 185, 129, 0.03) 45%, transparent 72%);
  pointer-events: none;
}

.hero-shell {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hero-split {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.15rem;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.34rem 0.8rem;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--emerald-light);
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-primary);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulseEmerald 2s infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes pulseEmerald {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.2vw, 3.55rem);
  font-weight: 800;
  line-height: 1.07;
  letter-spacing: -0.035em;
  color: #ffffff;
}

.hero-subtitle {
  font-size: 1.03rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.58;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 0.75rem;
  width: 100%;
  max-width: 520px;
  margin-top: 0.45rem;
}

.hero-stat-card {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hero-stat-number {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}
.hero-stat-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* HERO MINIATURE LIVE BOARD CARD */
.hero-right { display: flex; justify-content: center; }

.hero-board-card {
  width: 100%;
  max-width: 420px;
  padding: 1rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(165deg, rgba(16, 22, 29, 0.96) 0%, rgba(10, 14, 19, 0.98) 100%);
  border: 1px solid rgba(16, 185, 129, 0.22);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.22s var(--ease), border-color 0.22s ease;
}
.hero-board-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.45);
}

.hero-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.hero-board-player {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hero-gm-thumb {
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--emerald-primary);
}
.hero-gm-name { display: block; font-size: 0.82rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.hero-gm-elo { display: block; font-size: 0.7rem; font-family: var(--font-mono); color: var(--emerald-light); }

.hero-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald-light);
  font-size: 0.7rem;
  font-weight: 700;
}

.hero-mini-eval-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.hero-mini-eval-track {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: #1e293b;
  overflow: hidden;
}
.hero-mini-eval-fill {
  height: 100%;
  background: linear-gradient(90deg, #e2e8f0, var(--emerald-light));
  transition: width 0.45s var(--ease);
}
.hero-mini-eval-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}

.hero-mini-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-mini-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-mini-sq.light { background-color: var(--board-light); }
.hero-mini-sq.dark { background-color: var(--board-dark); }
.hero-mini-sq.last-move::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--board-highlight);
  pointer-events: none;
}
.hero-mini-sq svg { width: 86%; height: 86%; position: relative; z-index: 1; }

.hero-board-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.hero-mini-opening {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-mini-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* BENTO GRID */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.bento-card {
  position: relative;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s ease, background 0.2s ease;
}
.bento-card:hover {
  transform: translateY(-3px);
  background: var(--bg-elevated);
  border-color: var(--border-active);
}

.bento-wide { grid-column: span 6; }
.bento-third { grid-column: span 4; }

.bento-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bento-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.bento-tag-live { background: var(--emerald-soft); color: var(--emerald-light); border-color: rgba(16, 185, 129, 0.3); }

.bento-arrow {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.bento-card:hover .bento-arrow {
  background: var(--emerald-primary);
  color: #031710;
}

.bento-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}
.bento-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.48; }

.bento-bots-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.55rem;
  flex-wrap: wrap;
}
.bento-avatar-stack { display: flex; }
.bento-avatar-stack img {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-secondary);
  margin-left: -8px;
}
.bento-avatar-stack img:first-child { margin-left: 0; }

.bento-elo-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.bento-chip {
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}
.bento-chip-emerald {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.32);
  color: var(--emerald-light);
}

.bento-time-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.55rem;
}
.bento-time-chip {
  padding: 0.36rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.bento-time-chip:hover,
.bento-time-chip.active {
  background: var(--emerald-soft);
  border-color: var(--emerald-primary);
  color: var(--emerald-light);
}

.bento-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.22);
  font-size: 1.05rem;
}

.bento-badge-pill {
  padding: 0.18rem 0.52rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--emerald-light);
  background: var(--emerald-soft);
}

.bento-mini-wdl {
  display: flex;
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  gap: 2px;
  margin-top: auto;
  padding-top: 0.4rem;
}
.bento-mini-wdl span { border-radius: 99px; }

.bento-flags-row { display: flex; gap: 4px; align-items: center; }

/* ══════════ 5. AD BANNERS ══════════ */
.ad-banner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0.4rem 1rem;
}
.ad-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  background: rgba(14, 19, 25, 0.55);
  color: var(--text-dim);
  font-size: 0.74rem;
}
.ad-728x90 { max-width: 728px; }
.ad-320x50 { max-width: 340px; }
.ad-300x250 { min-height: 76px; flex-direction: column; justify-content: center; gap: 0.25rem; text-align: center; }

/* ══════════ 6. MAIN APP CHESS ARENA ══════════ */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.gameplay-view {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
}

/* Surgical Arena Grid: Aligns Eval Bar precisely with Board height */
.arena-wrapper {
  display: grid;
  grid-template-columns: 26px minmax(280px, 590px);
  column-gap: 0.65rem;
  row-gap: 0.55rem;
  flex-shrink: 0;
}

.player-banner {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-banner.active-turn {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25), 0 8px 24px rgba(16, 185, 129, 0.08);
}

.player-banner-left { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.player-avatar-wrap { position: relative; flex-shrink: 0; }
.player-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  display: block;
}

.turn-indicator {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 2px solid var(--bg-secondary);
}
.turn-indicator.active {
  background: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-primary);
}

.player-info { display: flex; flex-direction: column; min-width: 0; }
.player-title {
  display: inline-block;
  width: fit-content;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--emerald-light);
  text-transform: uppercase;
}
.player-name-row { display: flex; align-items: center; gap: 0.4rem; }
.player-name { font-weight: 700; font-size: 0.9rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 1px;
  min-height: 16px;
  margin-top: 1px;
}
.captured-piece-svg { display: inline-flex; width: 15px; height: 15px; }
.captured-piece-svg svg { width: 100%; height: 100%; }
.material-diff { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; color: var(--emerald-light); margin-left: 4px; }

.clock-badge {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.36rem 0.72rem;
  border-radius: 9px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  min-width: 68px;
  text-align: center;
}
.clock-badge.low-time {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.14);
}

/* Eval Bar */
.eval-bar-wrapper {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.eval-bar {
  width: 14px;
  flex: 1;
  border-radius: 99px;
  background: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.25);
}

.eval-segment.eval-black {
  width: 100%;
  background: #141b23;
  transition: height 0.42s var(--ease);
}
.eval-segment.eval-white { flex: 1; background: #f1f5f9; }

.eval-score {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Chess Board */
.board-outer {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(16, 185, 129, 0.14);
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  user-select: none;
}

.arrow-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

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

.square.last-move::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--board-highlight);
  pointer-events: none;
}

.square.selected::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--board-selected);
  box-shadow: inset 0 0 0 2.5px var(--emerald-light);
  pointer-events: none;
}

.square.in-check {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.88) 0%, rgba(239, 68, 68, 0.4) 70%, transparent 100%);
}

.square.mark-highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(56, 189, 248, 0.42);
  box-shadow: inset 0 0 0 2px #38bdf8;
  pointer-events: none;
}

.square.premove::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(167, 139, 250, 0.38);
  pointer-events: none;
}

.square.drag-over {
  box-shadow: inset 0 0 0 3px var(--emerald-light);
}

.square-coord {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: 0.72;
  z-index: 2;
}
.square.light .square-coord { color: var(--board-dark); }
.square.dark .square-coord { color: var(--board-light); }
.square-coord.rank { top: 3px; left: 4px; }
.square-coord.file { bottom: 3px; right: 4px; }
body.hide-coords .square-coord { display: none; }

.piece-wrap {
  position: relative;
  z-index: 3;
  width: 86%;
  height: 86%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s var(--ease);
}
.square:hover .piece-wrap { transform: scale(1.04); }
.piece-wrap.dragging { opacity: 0.35; }
.chess-piece-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.legal-dot {
  position: relative;
  z-index: 4;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.58);
  box-shadow: 0 0 0 2px rgba(8, 11, 15, 0.18);
  pointer-events: none;
}
.legal-capture-ring {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 3.5px solid rgba(16, 185, 129, 0.75);
  z-index: 4;
  pointer-events: none;
}

/* Move Quality Badges on Board & Table */
.sq-quality-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 7;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  animation: badgePopIn 0.22s var(--ease) both;
}
@keyframes badgePopIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.move-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
}
.qual-brilliant { background: #0284c7; }
.qual-best { background: #10b981; color: #031710; }
.qual-good { background: #334155; }
.qual-inaccuracy { background: #0ea5e9; }
.qual-mistake { background: #f97316; }
.qual-blunder { background: #ef4444; }

/* Time Controls & Analysis Dock under Board */
.time-control-bar,
.analysis-controls-bar {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.time-pill {
  padding: 0.36rem 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.time-pill:hover { color: var(--text-main); border-color: var(--border-strong); }
.time-pill.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

.ctrl-btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}
.ctrl-btn-mini:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.ctrl-btn-sq { width: 34px; }
.ctrl-btn-pill { padding: 0 0.72rem; }
.ctrl-btn-pill.highlight { border-color: rgba(16, 185, 129, 0.38); color: var(--emerald-light); background: var(--emerald-soft); }
.dock-divider { width: 1px; height: 20px; background: var(--border-color); margin: 0 0.15rem; }

/* ══════════ SIDE PANEL & CARDS ══════════ */
.side-panel {
  width: 425px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-card {
  padding: 1.05rem;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.panel-card-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}

.panel-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.panel-badge-gold,
.panel-badge-success {
  background: var(--emerald-soft);
  color: var(--emerald-light);
  border-color: rgba(16, 185, 129, 0.32);
}
.panel-badge-info {
  background: rgba(56, 189, 248, 0.12);
  color: var(--blue-accent);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Active Bot Spotlight */
.active-bot-spotlight {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid rgba(16, 185, 129, 0.22);
  margin-bottom: 0.8rem;
}
.spotlight-avatar { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 1.5px solid var(--emerald-primary); flex-shrink: 0; }
.spotlight-info { min-width: 0; }
.spotlight-title-row { display: flex; align-items: center; gap: 0.45rem; }
.spotlight-elo { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.spotlight-name { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; font-weight: 700; margin: 2px 0; }
.spotlight-bio { font-size: 0.77rem; color: var(--text-muted); line-height: 1.38; }

.bot-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.bot-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.16s ease;
}
.bot-card:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.bot-card.selected { background: var(--emerald-soft); border-color: var(--emerald-primary); }

.bot-avatar-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.bot-info-thumb { min-width: 0; flex: 1; }
.bot-info-thumb h4 { display: flex; align-items: center; gap: 0.3rem; font-size: 0.79rem; font-weight: 700; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-info-thumb > span { display: block; font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-elo-bar { height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; margin: 4px 0 2px; }
.bot-elo-fill { height: 100%; border-radius: 99px; }
.bot-elo-label { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; color: var(--emerald-light); }

.color-chooser {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.color-chooser-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-right: 0.25rem; }
.color-btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.color-btn.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

.pass-play-trigger { width: 100%; }
.pass-play-trigger.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

/* Online Panel */
.online-section-subtitle { font-size: 0.82rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.online-desc { font-size: 0.79rem; color: var(--text-muted); line-height: 1.45; margin-bottom: 0.65rem; }
.online-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.45rem; }

.quick-match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.quick-match-card {
  padding: 0.52rem 0.3rem;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.quick-match-card.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }
.qm-time { font-weight: 700; font-size: 0.8rem; }
.qm-type { font-size: 0.68rem; color: var(--text-muted); }

.join-room-row { display: flex; gap: 0.45rem; margin-top: 0.55rem; }
.rooms-empty {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px dashed var(--border-color);
  text-align: center;
}
.rooms-empty-icon { font-size: 1.4rem; display: block; margin-bottom: 0.25rem; }
.rooms-empty h5 { font-size: 0.83rem; font-weight: 700; margin-bottom: 0.2rem; }
.rooms-empty p { font-size: 0.75rem; color: var(--text-muted); }

.public-lobbies-list { display: flex; flex-direction: column; gap: 0.45rem; }
.lobby-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}
.lobby-user { display: flex; align-items: center; gap: 0.5rem; }
.lobby-name { display: block; font-size: 0.82rem; font-weight: 700; }
.lobby-elo { display: block; font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }

.live-indicator { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 700; color: var(--emerald-light); }
.draw-offer-banner {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.38);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
}
.draw-offer-btns { display: flex; gap: 0.45rem; }
.online-match-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-bottom: 0.65rem; }

.online-chat-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
}
.chat-messages-scroll { max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.45rem; font-size: 0.79rem; }
.chat-msg { padding: 0.25rem 0.5rem; border-radius: 7px; background: rgba(255, 255, 255, 0.04); }
.chat-msg-self { background: var(--emerald-soft); }
.quick-emotes-row { display: flex; gap: 0.3rem; margin-bottom: 0.45rem; flex-wrap: wrap; }
.emote-btn { padding: 0.2rem 0.45rem; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-elevated); color: var(--text-main); font-size: 0.75rem; cursor: pointer; }
.online-chat-form { display: flex; gap: 0.4rem; }

/* Puzzles Panel */
.puzzle-difficulty-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.diff-chip {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
}
.diff-chip.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

.puzzle-challenge-box {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}
.puzzle-task-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; color: var(--emerald-light); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-primary); animation: pulseEmerald 1.8s infinite; }
.puzzle-desc { font-size: 0.85rem; color: var(--text-main); margin-bottom: 0.55rem; }
.puzzle-feedback { padding: 0.55rem 0.7rem; border-radius: 8px; font-size: 0.8rem; font-weight: 600; }
.puzzle-feedback.neutral { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }
.puzzle-feedback.success { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); }
.puzzle-feedback.error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.puzzle-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.5rem; margin-bottom: 0.75rem; }
.puzzle-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.pstat-item {
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  text-align: center;
}
.pstat-val { display: block; font-family: var(--font-mono); font-size: 0.92rem; font-weight: 700; }
.pstat-lbl { display: block; font-size: 0.68rem; color: var(--text-muted); }

/* Pro Analysis Panel */
.depth-pills-mini { display: flex; gap: 0.25rem; }
.depth-pill {
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.depth-pill.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

.an-subtabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.65rem;
}
.an-subtab {
  padding: 0.42rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.an-subtab.active { background: var(--bg-elevated); color: var(--emerald-light); }

.analysis-nav-dock {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.an-dock-btn {
  flex: 1;
  min-width: 36px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.an-dock-btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.an-dock-mistake { flex: 2; background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }

.analysis-hero-card {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}
.hero-eval-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.eval-pill-big {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0.36rem 0.65rem;
  border-radius: 9px;
  background: var(--emerald-soft);
  color: var(--emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.35);
  min-width: 64px;
  text-align: center;
}
.eval-pill-big.neg { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.hero-verdict-wrap { min-width: 0; }
.hero-verdict-title { display: block; font-size: 0.84rem; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.hero-sub-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.25rem; }
.opening-eco-tag {
  padding: 1px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--emerald-soft);
  color: var(--emerald-light);
}
.opening-name-text { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hero-best-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}
.analysis-stat-label { color: var(--text-muted); }
.highlight-move { font-family: var(--font-mono); font-weight: 700; color: var(--emerald-light); }
.hero-depth-tag { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); }

.wdl-header-row { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.wdl-bar-track { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--bg-elevated); }
.wdl-seg { transition: width 0.35s var(--ease); }
.wdl-seg-w { background: #e2e8f0; }
.wdl-seg-d { background: #475569; }
.wdl-seg-l { background: #10b981; }

.move-coach-card {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-bottom: 0.75rem;
}
.move-coach-card.coach-warn { border-color: rgba(56, 189, 248, 0.4); }
.move-coach-card.coach-bad { border-color: rgba(239, 68, 68, 0.45); }
.coach-top-row { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; }
.coach-qual-text { font-size: 0.78rem; color: var(--text-muted); }
.coach-advice-text { font-size: 0.8rem; color: var(--text-main); margin-bottom: 0.5rem; }
.coach-nav-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.review-summary-card {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}
.review-acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.55rem; }
.review-acc-box {
  padding: 0.55rem;
  border-radius: 9px;
  background: var(--bg-elevated);
  text-align: center;
}
.acc-side { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.acc-score { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 800; color: var(--emerald-light); }
.review-jump-hint { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.review-counts-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.qual-pill-btn {
  padding: 0.24rem 0.5rem;
  border-radius: 7px;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}
.qual-pill-btn:disabled { opacity: 0.35; cursor: default; }

.famous-title { font-size: 0.8rem; font-weight: 700; color: var(--text-main); margin: 0.7rem 0 0.45rem; }
.analysis-lines-list { display: flex; flex-direction: column; gap: 0.38rem; }
.analysis-line-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}
.analysis-line-item:hover { border-color: var(--emerald-primary); background: var(--emerald-soft); }
.pv-rank { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); }
.pv-score { font-family: var(--font-mono); font-weight: 700; min-width: 44px; color: var(--text-main); }
.pv-score.pos { color: var(--emerald-light); }
.pv-score.neg { color: #fca5a5; }
.pv-moves { font-family: var(--font-mono); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-line-empty { font-size: 0.79rem; color: var(--text-muted); padding: 0.5rem 0; }

.famous-games-grid { display: flex; flex-direction: column; gap: 0.45rem; }
.famous-game-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}
.famous-game-btn:hover { border-color: var(--emerald-primary); background: var(--emerald-soft); }
.fg-title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.81rem; font-weight: 700; }
.fg-desc { font-size: 0.73rem; color: var(--text-muted); }
.fen-input-group { display: flex; gap: 0.45rem; }
.analysis-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }

/* Bot Chat & Move History */
.bot-chat-card.thinking { border-color: var(--emerald-primary); }
.bot-quote { font-size: 0.85rem; color: var(--text-main); font-style: italic; line-height: 1.45; }
.typing-dots { display: none; gap: 4px; margin-top: 0.45rem; }
.bot-chat-card.thinking .typing-dots { display: flex; }
.typing-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-primary); animation: pulseEmerald 1.2s infinite; }

.game-status-text { font-size: 0.77rem; font-weight: 700; color: var(--text-muted); }
.opening-pill-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.6rem;
}

.moves-history {
  max-height: 210px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: 0.75rem;
}
.moves-table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.moves-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
  padding: 0.42rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
}
.moves-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border-subtle); }
.move-num { width: 38px; font-family: var(--font-mono); color: var(--text-dim); }
.move-san { font-family: var(--font-mono); font-weight: 600; cursor: pointer; border-radius: 4px; }
.move-san:hover { background: rgba(255, 255, 255, 0.05); }
.move-san.active-move { background: var(--emerald-soft); color: var(--emerald-light); }

.controls-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; margin-bottom: 0.45rem; }
.ctrl-btn { padding: 0.46rem 0.5rem; font-size: 0.76rem; }
.controls-export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }

/* ══════════ LEADERBOARD VIEW ══════════ */
.leaderboard-fullpage { max-width: 1120px; margin: 0 auto; }
.fullpage-hero { text-align: center; padding: 1.5rem 0 1.75rem; }
.fullpage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald-light);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-primary); }
.fullpage-title { font-family: var(--font-display); font-size: clamp(1.75rem, 3.2vw, 2.55rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 0.6rem; }
.fullpage-subtitle { max-width: 680px; margin: 0 auto 1.35rem; color: var(--text-muted); font-size: 0.94rem; }

.fullpage-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.fp-stat-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.fp-stat-num { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 800; }
.fp-stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.fullpage-mission-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, var(--bg-secondary) 70%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  margin-bottom: 1.25rem;
}
.mission-banner-left { display: flex; align-items: center; gap: 0.9rem; }
.mission-icon { font-size: 2rem; }
.mission-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.mission-desc { font-size: 0.83rem; color: var(--text-muted); }

.fullpage-filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1.1rem; }
.search-input-wrap { position: relative; min-width: 260px; flex: 1; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; opacity: 0.7; }
.search-input-wrap .input { padding-left: 2rem; }
.region-filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.region-chip {
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.region-chip.active { background: var(--emerald-soft); border-color: var(--emerald-primary); color: var(--emerald-light); }

.fullpage-table-card {
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
}
.table-responsive { overflow-x: auto; }
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th {
  padding: 0.65rem 1rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}
.leaderboard-table td { padding: 0.72rem 1rem; border-bottom: 1px solid var(--border-subtle); font-size: 0.86rem; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.rank-badge.rank-1 { background: rgba(16, 185, 129, 0.22); color: var(--emerald-light); border: 1px solid rgba(16, 185, 129, 0.45); }
.rank-badge.rank-2 { background: rgba(56, 189, 248, 0.16); color: var(--blue-accent); border: 1px solid rgba(56, 189, 248, 0.35); }
.rank-badge.rank-3 { background: rgba(167, 139, 250, 0.16); color: var(--purple-accent); border: 1px solid rgba(167, 139, 250, 0.35); }

.join-team-btn {
  padding: 0.34rem 0.72rem;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: var(--emerald-soft);
  color: var(--emerald-light);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.join-team-btn:hover { background: var(--emerald-primary); color: #031710; }

/* ══════════ 7. MODALS ══════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 11, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.65rem;
  border-radius: var(--radius-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  box-shadow: 0 32px 72px rgba(0, 0, 0, 0.7);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { color: #fff; border-color: var(--border-strong); }
.modal-title { font-family: var(--font-display); font-size: 1.22rem; font-weight: 800; margin-bottom: 0.35rem; }
.modal-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

.promo-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; }
.promo-choice-btn {
  position: relative;
  padding: 0.75rem 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.promo-choice-btn:hover { border-color: var(--emerald-primary); background: var(--emerald-soft); }
.promo-key { position: absolute; top: 5px; left: 7px; font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-dim); }
.promo-piece { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; }
.promo-piece svg { width: 100%; height: 100%; }
.promo-label { font-size: 0.74rem; font-weight: 600; }

.game-over-modal { text-align: center; }
.game-over-trophy { font-size: 2.6rem; margin-bottom: 0.4rem; }
.star-rating { color: var(--emerald-light); font-size: 1.15rem; letter-spacing: 3px; margin-bottom: 0.9rem; }
.gameover-accuracy-box { margin-bottom: 1rem; }
.gameover-acc-title { display: block; font-size: 0.76rem; color: var(--text-muted); margin-bottom: 0.45rem; }
.game-over-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.room-code-box {
  padding: 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-active);
  text-align: center;
  margin-bottom: 0.85rem;
}
.room-code-text { font-family: var(--font-mono); font-size: 1.45rem; font-weight: 800; letter-spacing: 0.14em; color: var(--emerald-light); }
.share-input-group { display: flex; gap: 0.45rem; margin-bottom: 1rem; }
.room-waiting { text-align: center; padding: 0.8rem 0 1rem; }
.waiting-spinner { display: inline-block; margin-bottom: 0.45rem; }
.spinner-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--emerald-primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-text { font-size: 0.83rem; color: var(--text-muted); }

/* Settings Modal */
.settings-section { padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--border-subtle); }
.settings-label { font-size: 0.84rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.5rem; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.board-theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.45rem; }
.board-theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.board-theme-option input { display: none; }
.board-theme-option:has(input:checked) { border-color: var(--emerald-primary); background: var(--emerald-soft); color: var(--emerald-light); }
.mini-board { width: 32px; height: 32px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 5px; overflow: hidden; }
.theme-emerald .mb-light { background: #e8edd5; } .theme-emerald .mb-dark { background: #4b7d5b; }
.theme-wood .mb-light { background: #ebd5b3; } .theme-wood .mb-dark { background: #a67b56; }
.theme-marble .mb-light { background: #e2e8f0; } .theme-marble .mb-dark { background: #64748b; }
.theme-neon .mb-light { background: #2a1b4e; } .theme-neon .mb-dark { background: #110b26; }
.theme-classic .mb-light { background: #f1f5f9; } .theme-classic .mb-dark { background: #475569; }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-subtle);
  border-radius: 99px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--emerald-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.volume-control-wrap { display: flex; align-items: center; gap: 0.5rem; }
.range-slider { accent-color: var(--emerald-primary); }
.volume-val { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); min-width: 36px; text-align: right; }

.settings-radio-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.radio-option input { accent-color: var(--emerald-primary); }
.radio-option:has(input:checked) { border-color: var(--emerald-primary); background: var(--emerald-soft); color: var(--emerald-light); }

/* Profile Modal */
.profile-header { text-align: center; margin-bottom: 1rem; }
.profile-avatar { border-radius: 50%; object-fit: cover; border: 2px solid var(--emerald-primary); margin-bottom: 0.5rem; }
.profile-username { font-size: 1.15rem; font-weight: 800; }
.profile-rating { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; color: var(--emerald-light); }

.profile-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin-bottom: 0.85rem; }
.profile-stat { padding: 0.55rem 0.3rem; border-radius: 10px; background: var(--bg-primary); border: 1px solid var(--border-color); text-align: center; }
.profile-stat-value { display: block; font-family: var(--font-mono); font-size: 1.05rem; font-weight: 800; }
.profile-stat-win { color: var(--emerald-light); }
.profile-stat-loss { color: #f87171; }
.profile-stat-label { font-size: 0.68rem; color: var(--text-muted); }

.profile-puzzle-badge {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald-light);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.9rem;
}

.win-rate-wrapper { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; margin-bottom: 0.9rem; }
.win-rate-circle { position: relative; width: 112px; height: 112px; display: flex; align-items: center; justify-content: center; }
.win-rate-bg { stroke: rgba(255, 255, 255, 0.08); }
.win-rate-arc { stroke: var(--emerald-primary); transition: stroke-dashoffset 0.5s var(--ease); }
.win-rate-percent { position: absolute; font-family: var(--font-mono); font-size: 1.1rem; font-weight: 800; }
.win-rate-label { font-size: 0.76rem; color: var(--text-muted); }

.rating-chart-placeholder {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  margin-bottom: 0.9rem;
  text-align: center;
  font-size: 0.79rem;
  color: var(--text-muted);
}

/* Confetti & Toasts */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -14px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

/* ══════════ 10. FOOTER ══════════ */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-color);
  background: rgba(8, 11, 15, 0.94);
  padding: 1.65rem 1.25rem 1.25rem;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.footer-logo { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.footer-desc { font-size: 0.82rem; color: var(--text-muted); max-width: 420px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.footer-link { color: var(--text-muted); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.footer-link:hover { color: var(--emerald-light); }
.footer-bottom {
  max-width: 1240px;
  margin: 1rem auto 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* ══════════ RESPONSIVE DESIGN ══════════ */
@media (max-width: 1080px) {
  .gameplay-view { flex-direction: column; align-items: center; }
  .arena-wrapper { width: 100%; max-width: 620px; grid-template-columns: 24px 1fr; }
  .side-panel { width: 100%; max-width: 620px; }
  .hero-split { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero-board-card { max-width: 440px; }
  .bento-wide, .bento-third { grid-column: span 6; }
  .fullpage-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .fullpage-mission-banner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 820px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 640px) {
  .navbar-inner { padding: 0 0.75rem; }
  #themeDropdown, .lang-dropdown { display: none; }
  .hero-section { padding: 1.4rem 0.85rem 2.2rem; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .hero-stat-card { padding: 0.65rem; }
  .hero-stat-number { font-size: 1.25rem; }
  .bento-wide, .bento-third { grid-column: span 12; }
  .app-container { padding: 0.85rem 0.65rem 1.75rem; }
  .arena-wrapper { grid-template-columns: 18px 1fr; column-gap: 0.4rem; }
  .bot-card-grid { grid-template-columns: 1fr; }
  .board-theme-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .controls-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
