/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════ */
:root {
  /* ── Brown chess board palette ── */
  --bg:        #110c07;   /* deep walnut */
  --surface:   #1c140c;
  --card:      #241a0f;   /* dark oak */
  --card-2:    #2e2113;
  --border:    rgba(181,136,99,0.18);
  --border-2:  rgba(181,136,99,0.32);

  --accent:    #d4a055;   /* warm gold — light-square inspired */
  --accent-2:  #b55c1a;   /* deep rust */
  --accent-glow: rgba(212,160,85,0.18);

  --text:      #f0d9b5;   /* cream — exactly the light square colour */
  --text-2:    #c4a070;
  --text-3:    #7a5c38;

  --best:      #4ade80;
  --excellent: #86efac;
  --good:      #bef264;
  --inaccuracy:#fbbf24;
  --mistake:   #f97316;
  --blunder:   #ef4444;

  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 8px 32px rgba(0,0,0,0.55);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.65);

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* ── iOS Safe Area Insets Fallbacks ── */
  --safe-top: env(safe-area-inset-top, 0px);

  /* ── Defined missing variables ── */
  --card-1:    var(--card);
  --border-1:  var(--border);
  --text-1:    var(--text);
  --gold:      var(--accent);
}

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

html { height: 100%; }

body {
  font-family: var(--font);
  background: linear-gradient(rgba(17, 12, 7, 0.88), rgba(17, 12, 7, 0.94)),
              url('https://images.unsplash.com/photo-1529699211952-734e80c4d42b?q=80&w=1600') no-repeat center center fixed;
  background-size: cover;
  color: var(--text);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.gradient-text {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: rgba(13, 10, 8, 0.75); /* Warm chess theme dark background */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
  display: block;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: opacity .2s;
}
.logo:hover { opacity: .8; }
.logo-icon { font-size: 22px; }
.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 100%;
}
.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.25s ease, border-bottom-color 0.25s ease;
  height: 70px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  padding: 0 4px;
  margin-top: 3px; /* visual balance tweak for active border */
}
.nav-link:hover {
  color: var(--text);
}
.nav-link.active-link {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.header-user {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   VIEWS
═══════════════════════════════════════════════════════ */
.view {
  min-height: 100vh;
  padding-top: calc(86px + var(--safe-top)); /* Reclaims spacing under the fixed header (70px header + 16px padding) */
}
.view.active { display: block; }
#view-analysis {
  height: 100vh;
  overflow: hidden;
  padding-top: var(--safe-top); /* Board starts exactly from safe area top */
}

/* ═══════════════════════════════════════════════════════
   HOME HERO
═══════════════════════════════════════════════════════ */
.home-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 24px;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(212,160,85,0.10) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  text-align: center;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.hero-logo-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 8px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow);
  user-select: none;
}
.hero-logo-icon {
  font-size: 24px;
  color: var(--accent);
  filter: drop-shadow(0 2px 8px rgba(212, 160, 85, 0.4));
}
.hero-logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, var(--text-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.5px;
  margin-bottom: 16px;
}
.hero-sub {
  font-size: 17px;
  color: var(--text-2);
  margin-bottom: 32px;
  max-width: 580px;
  line-height: 1.5;
}

/* Phone Card */
.phone-card {
  background: linear-gradient(135deg, rgba(36, 26, 15, 0.75), rgba(46, 33, 19, 0.45));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  width: 100%;
  max-width: 440px;
  margin-bottom: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}
.phone-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(212, 160, 85, 0.04) 0%, transparent 60%);
  pointer-events: none;
}
.phone-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 0 0 20px rgba(212, 160, 85, 0.1);
  border-color: var(--accent);
}
.phone-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.phone-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--best);
  border-radius: 50%;
  position: relative;
}
.phone-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--best);
  animation: pulse 1.8s infinite ease-in-out;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3.5); opacity: 0; }
}
.phone-number-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.phone-number {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.btn-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}
.btn-copy:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--border-2);
}
.copy-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #110c07;
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.copy-tooltip.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.btn-dial {
  width: 100%;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #110c07 !important;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 4px 15px rgba(212, 160, 85, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-dial:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 160, 85, 0.35);
  filter: brightness(1.1);
}

/* Hero Buttons */
.hero-buttons {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  margin-bottom: 24px;
}
.hero-buttons .btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
}
.btn-play-call {
  background: linear-gradient(135deg, var(--card-2), rgba(28, 20, 12, 0.95)) !important;
  border: 1px solid var(--border-2) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow);
}
.btn-play-call:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 0 15px var(--accent-glow) !important;
  transform: translateY(-2px);
}
.hero-buttons .btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.hero-buttons .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--border-2);
  transform: translateY(-2px);
}
.arrow-down {
  display: inline-block;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  60% { transform: translateY(-3px); }
}

/* Voice indicator animation */
.voice-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
}
.voice-indicator span {
  font-size: 12px;
  color: var(--text-2);
}
.voice-indicator .bar {
  width: 2.5px;
  height: 10px;
  background-color: var(--accent);
  border-radius: 2px;
  animation: wave 1.2s infinite ease-in-out;
}
.voice-indicator .bar:nth-child(1) { animation-delay: -1.0s; height: 14px; }
.voice-indicator .bar:nth-child(2) { animation-delay: -0.8s; height: 8px; }
.voice-indicator .bar:nth-child(3) { animation-delay: -0.6s; height: 18px; }
.voice-indicator .bar:nth-child(4) { animation-delay: -0.4s; height: 10px; }
.voice-indicator .bar:nth-child(5) { animation-delay: -0.2s; height: 13px; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1.4); }
}

/* How It Works Section */
.home-features {
  padding: 100px 24px;
  background: rgba(28, 20, 12, 0.4);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  width: 100%;
}
.section-container {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.section-subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 60px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  transition: all 0.3s ease;
  text-align: left;
}
.feature-card:hover {
  border-color: var(--border-2);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.feature-icon-box {
  width: 44px;
  height: 44px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 20px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
}
.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.feature-card p {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}

/* Local Analysis Section */
.home-analysis-section {
  padding: 100px 24px;
  background: linear-gradient(rgba(17, 12, 7, 0.95), rgba(17, 12, 7, 0.98));
  position: relative;
  width: 100%;
}
.analysis-card-wrap {
  max-width: 600px;
  margin: 0 auto;
}
.search-card {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  text-align: left;
}
.search-card-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.search-card-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 24px;
}
.search-row {
  display: flex;
  gap: 12px;
}
.input-wrap {
  flex: 1;
  position: relative;
}
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-3);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 14px 14px 14px 40px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-wrap input::placeholder { color: var(--text-3); }

.home-analysis-section .sf-badge {
  display: inline-flex;
  margin-top: 24px;
  font-size: 13px;
}


/* Games Filter Tabs */
.games-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.games-tab {
  background: none;
  border: none;
  color: var(--text-3);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.games-tab:hover {
  color: var(--text);
  background: var(--surface);
}
.games-tab.active {
  color: #1a0f06;
  background: linear-gradient(135deg, #d4a055, #b58863);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #d4a055, #b58863);
  color: #1a0f06;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212,160,85,0.40);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.inline-error {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 14px;
}

.sf-badge {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
}
.sf-badge.ok {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
  color: #86efac;
}
.sf-badge.missing {
  background: rgba(249,115,22,0.1);
  border-color: rgba(249,115,22,0.3);
  color: #fdba74;
}

/* ═══════════════════════════════════════════════════════
   PAGE HEADER (Games / Analysis /* ── KPI Dashboard ── */
.games-kpi-row {
  max-width: 1300px;
  margin: 20px auto 0;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.kpi-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: #d4a055; /* warm gold accent */
}
.kpi-value.win { color: var(--best) !important; }
.kpi-value.loss { color: var(--blunder) !important; }

/* ── Games list rows (Table view) ── */
.games-list-container {
  max-width: 1300px;
  margin: 24px auto 40px;
  padding: 0 28px;
}
.games-list-header {
  display: grid;
  grid-template-columns: 80px 200px 1fr 140px 80px 100px;
  gap: 16px;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.games-list-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.game-row {
  display: grid;
  grid-template-columns: 80px 200px 1fr 140px 80px 100px;
  gap: 16px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.game-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  opacity: 0.8;
}
.game-row.result-Win::before   { background: var(--best); }
.game-row.result-Loss::before  { background: var(--blunder); }
.game-row.result-Draw::before  { background: #94a3b8; }

.game-row:hover {
  border-color: var(--border-2);
  background: var(--card-2);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.game-row-opp {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.game-row-opp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-row-opp-rating {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}
.game-row-opening {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-row-mode {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.game-row-date {
  font-size: 13px;
  color: var(--text-3);
}
.game-row-action-btn {
  font-size: 12px;
  font-weight: 600;
  color: #d4a055;
  background: rgba(212, 160, 85, 0.1);
  padding: 6px 12px;
  border-radius: 6px;
  text-align: center;
  opacity: 0.7;
  transition: opacity .15s, background .15s;
}
.game-row:hover .game-row-action-btn {
  opacity: 1;
  background: rgba(212, 160, 85, 0.2);
}
.game-result-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  text-align: center;
  width: fit-content;
}
.badge-Win  { background: rgba(74,222,128,.15);  color: var(--best); }
.badge-Loss { background: rgba(239,68,68,.15);  color: var(--blunder); }
.badge-Draw { background: rgba(148,163,184,.15); color: #94a3b8; }

.page-header {
  max-width: 1300px;
  margin: 0 auto;
  padding: 28px 28px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.header-top-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}
.back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.back-btn:hover { color: var(--text); border-color: var(--border-2); }

/* ── Profile Tag / Badge ── */
.profile-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  margin-left: auto; /* floats to the right of the header row */
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.profile-tag:hover {
  border-color: var(--accent);
  background: rgba(129, 182, 76, 0.08); /* subtle green tint */
}
.profile-tag.hidden {
  display: none !important;
}
.profile-avatar {
  width: 20px;
  height: 20px;
  background: var(--accent); /* chess.com green */
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.profile-username {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.mode-selector {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mode-label { font-size: 13px; color: var(--text-2); }
.mode-btns {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.mode-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.mode-btn.active {
  background: var(--card-2);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════
   GAMES GRID
═══════════════════════════════════════════════════════ */
.games-grid {
  max-width: 1300px;
  margin: 24px auto 40px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity .2s;
}
.game-card.result-Win::before   { background: linear-gradient(90deg, var(--best), #22d3ee); }
.game-card.result-Loss::before  { background: linear-gradient(90deg, var(--blunder), #f97316); }
.game-card.result-Draw::before  { background: linear-gradient(90deg, #94a3b8, #64748b); }

.game-card:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.game-card:hover::before { opacity: 1; }

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.game-result-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}
.badge-Win  { background: rgba(34,197,94,.15);  color: var(--best); }
.badge-Loss { background: rgba(239,68,68,.15);  color: var(--blunder); }
.badge-Draw { background: rgba(148,163,184,.15); color: #94a3b8; }

.game-time-class {
  font-size: 12px;
  color: var(--text-3);
  text-transform: capitalize;
}

.game-players {
  margin-bottom: 10px;
}
.game-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 2px 0;
}
.player-color-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.player-color-dot.white { background: #e8edf5; border: 1px solid rgba(255,255,255,.2); }
.player-color-dot.black { background: #374151; border: 1px solid rgba(255,255,255,.1); }
.game-player-name { font-weight: 600; flex: 1; }
.game-player-name.me { color: var(--accent); }
.game-player-rating { color: var(--text-3); font-size: 13px; font-family: var(--mono); }

.game-opening {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-date {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}
.analyse-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity .2s;
}
.game-card:hover .analyse-hint { opacity: 1; }

/* ═══════════════════════════════════════════════════════
   ANALYSIS VIEW
═══════════════════════════════════════════════════════ */
.analysis-topbar {
  max-width: 1300px;
  margin: 0 auto;
  padding: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.meta-opening {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Loading */
.loading-screen {
  max-width: 1300px;
  margin: 0 auto;
  padding: 40px 28px;
  display: flex;
  gap: 48px;
  align-items: flex-start;
}
.loading-board-ghost {
  width: 440px;
  height: 440px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f0d9b5 25%, #b58863 25%, #b58863 50%, #f0d9b5 50%, #f0d9b5 75%, #b58863 75%);
  background-size: 55px 55px;
  border-radius: var(--radius);
  opacity: .18;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .3; } 50% { opacity: .5; } }

.loading-info {
  flex: 1;
  padding-top: 60px;
  text-align: center;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-2);
  border-top-color: #d4a055;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-label { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.loading-progress { font-size: 14px; color: var(--text-2); margin-bottom: 16px; }
.progress-bar-wrap {
  background: var(--surface);
  border-radius: 999px;
  height: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d4a055, #b58863);
  border-radius: 999px;
  width: 0%;
  transition: width .4s ease;
}

/* Analysis layout */
.analysis-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 24px 20px;
  display: flex;
  justify-content: center; /* Center horizontally */
  gap: 32px;               /* Clean spacing between board and sidebar */
  align-items: stretch;    /* Stretch to match height */
  height: calc(100vh - 56px - 20px); /* Fill viewport height below header */
  overflow: hidden;        /* Prevent layout overflow scrolling */
}

/* ── Board column ── */
.board-col {
  width: fit-content;      /* Hug board + eval bar width */
  display: flex;
  flex-direction: column;
  gap: 0;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
}
.player-info { display: flex; align-items: center; gap: 12px; }
.player-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}
.player-avatar.white-av { background: #e8edf5; color: #1a2235; }
.player-avatar.black-av { background: #2d3748; color: #e8edf5; }
.player-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.player-rating { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

.player-accuracy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.acc-value { font-size: 20px; font-weight: 700; color: #d4a055; }
.acc-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }

/* Board + eval bar */
.board-eval-wrap {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.eval-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 22px;
  height: 440px;  /* must match board width */
}
.eval-bar-bg {
  flex: 1;
  width: 16px;
  background: #b58863;   /* dark square colour */
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.eval-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f0d9b5;   /* light square colour */
  border-radius: 999px;
  transition: height .4s cubic-bezier(.4,0,.2,1);
  height: 50%;
}
.eval-bar-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-3);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* chessboard.js overrides */
.chess-board { border-radius: var(--radius); overflow: hidden; }
#board {
  /* width set dynamically by JS via getBoardSize() */
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.8);
}
#board .square-55d63 { transition: background-color .15s; }

/* Wood board textures from Chess.com */
.white-1e1d7 {
  background-image: url('https://images.chesscomfiles.com/chess-themes/boards/wood/light.png') !important;
  background-size: cover !important;
}
.black-3c85d {
  background-image: url('https://images.chesscomfiles.com/chess-themes/boards/wood/dark.png') !important;
  background-size: cover !important;
}

/* Coordinate styling for wood board readability */
.notation-322f9 {
  color: #f0d9b5 !important;
  font-weight: 600 !important;
  font-family: var(--font) !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
  opacity: 0.85;
  font-size: 11px !important;
}
#board, .board-b72b1 {
  touch-action: none !important;
}
/* Quality-based board highlighting overrides */
.hl-best-from       { background: rgba(74, 222, 128, 0.22) !important; }
.hl-best-to         { background: rgba(74, 222, 128, 0.40) !important; }

.hl-excellent-from  { background: rgba(134, 239, 172, 0.22) !important; }
.hl-excellent-to    { background: rgba(134, 239, 172, 0.40) !important; }

.hl-good-from       { background: rgba(190, 242, 100, 0.18) !important; }
.hl-good-to         { background: rgba(190, 242, 100, 0.35) !important; }

.hl-inaccuracy-from { background: rgba(251, 191, 36, 0.20) !important; }
.hl-inaccuracy-to   { background: rgba(251, 191, 36, 0.42) !important; }

.hl-mistake-from    { background: rgba(249, 115, 22, 0.22) !important; }
.hl-mistake-to      { background: rgba(249, 115, 22, 0.45) !important; }

.hl-blunder-from    { background: rgba(239, 68, 68, 0.25) !important; }
.hl-blunder-to      { background: rgba(239, 68, 68, 0.50) !important; }

/* Controls */
.board-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.ctrl-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
}
.ctrl-btn:hover { color: var(--text); border-color: var(--border-2); }
/* ── Variation blocks ──────────────────────────── */
.variation-block {
  grid-column: 1 / -1;
  padding: 4px 6px 4px 14px;
  margin: 3px 0;
  border-left: 1.5px solid rgba(255,255,255,0.18);
  width: 100%;
}
.variation-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}
.var-bracket {
  color: var(--text-3);
  font-weight: 500;
  padding: 0 4px;
}
.var-num {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  padding-right: 2px;
}
.move-cell.var-move {
  font-size: 13px;
  padding: 2px 5px;
  background: transparent;
  border-radius: 4px;
  color: var(--text-2);
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.move-cell.var-move:hover  { background: rgba(255,255,255,0.06); color: var(--text); }
.move-cell.var-move.active {
  background: var(--border-2) !important;
  color: var(--text) !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
}

/* ── Unicode Chess Piece Icons inside move cells ── */
.piece-sym {
  font-size: 13.5px;
  margin-right: 2px;
  display: inline-block;
  vertical-align: middle;
  opacity: 0.95;
  line-height: 1;
}

/* ── King End-Game Highlights ── */
.hl-king-win {
  box-shadow: inset 0 0 20px rgba(129, 182, 76, 0.9) !important;
  background-color: rgba(129, 182, 76, 0.35) !important;
}
.hl-king-lose {
  box-shadow: inset 0 0 20px rgba(239, 83, 80, 0.9) !important;
  background-color: rgba(239, 83, 80, 0.35) !important;
  animation: pulse-red-king 2s infinite ease-in-out;
}
.hl-king-draw {
  box-shadow: inset 0 0 20px rgba(41, 182, 246, 0.75) !important;
  background-color: rgba(41, 182, 246, 0.25) !important;
}

@keyframes pulse-red-king {
  0% { box-shadow: inset 0 0 14px rgba(239, 83, 80, 0.6); }
  50% { box-shadow: inset 0 0 24px rgba(239, 83, 80, 0.95); }
  100% { box-shadow: inset 0 0 14px rgba(239, 83, 80, 0.6); }
}

.main-line-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 12px;
  background: rgba(251,191,36,0.12);
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.main-line-btn:hover { background: rgba(251,191,36,0.22); }
.move-counter {
  font-size: 13px;
  color: var(--text-2);
  font-family: var(--mono);
  min-width: 80px;
  text-align: center;
}

/* ── Right column ── */
.right-col {
  width: 380px;            /* Proportional width matching Chess.com */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100%;            /* Fill analysis layout height */
  overflow: hidden;        /* Prevent right column scrolling as a whole */
}

/* ── Unified Sidebar (Chess.com Style) ── */
.sidebar-container {
  background: #211f1c;      /* Chess.com flat dark grey sidebar background */
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.8);
}

/* Tabs */
.sidebar-tabs {
  display: flex;
  background: #191815;      /* slightly darker header for tabs */
  border-bottom: 2px solid #2d2b27;
}
.sidebar-tab {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  text-align: center;
}
.sidebar-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.02);
}
.sidebar-tab.active {
  color: var(--text);
}
.sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #81b64c;      /* Accent green bar */
}

/* Tab contents */
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #211f1c;
}
.moves-list-wrap {
  flex: 1;
  overflow-y: auto;
}
.review-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.review-scroll-container::-webkit-scrollbar,
.moves-list-wrap::-webkit-scrollbar {
  width: 4px;
}
.review-scroll-container::-webkit-scrollbar-thumb,
.moves-list-wrap::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 99px;
}

/* Action button area */
.game-review-action {
  padding: 14px 16px;
  background: #191815;
  border-top: 1px solid #2d2b27;
}
.btn-review {
  width: 100%;
  padding: 16px;
  background: #81b64c !important; /* Chess.com green */
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  border: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(129, 182, 76, 0.3);
  transition: background 0.15s, transform 0.1s !important;
}
.btn-review:hover {
  background: #95c25d !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(129, 182, 76, 0.45);
}
.btn-review:active {
  transform: translateY(0);
}
.review-icon {
  font-size: 20px;
  color: #fff;
}

/* Tab-specific list configurations */
.accuracy-row-vertical {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.acc-card-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #272522;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 14px;
}
.chart-section {
  background: #272522;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 14px;
}

.acc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.acc-player-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.acc-player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acc-color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.white-dot { background: #e8edf5; }
.black-dot { background: #374151; border: 1px solid rgba(255,255,255,.15); }
.acc-big {
  font-size: 24px;
  font-weight: 700;
  color: #d4a055;
  line-height: 1;
}
.cls-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  margin-top: 2px;
  padding-left: 20px;
}
.cls-pip {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  white-space: nowrap;
}
.cls-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}
.chart-wrap { height: 120px; }

.moves-list {
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 36px 1fr;
  gap: 2px;
  align-items: center;
}
.moves-list::-webkit-scrollbar { width: 4px; }
.moves-list::-webkit-scrollbar-track { background: transparent; }
.moves-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.move-num {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
  text-align: center;
  line-height: 1;
  padding-top: 6px;
}
.move-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--mono);
  min-width: 0;
  white-space: nowrap !important;
}
.move-cell span {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  white-space: nowrap !important;
}
.move-cell:hover { background: var(--card-2); }
.move-cell.active {
  background: rgba(212,160,85,.15);
  color: #d4a055;
}
.move-cell.empty { cursor: default; }
.move-cls-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
}
.cls-best       .move-cls-dot { background: var(--best); }
.cls-excellent  .move-cls-dot { background: var(--excellent); }
.cls-good       .move-cls-dot { background: var(--good); }
.cls-inaccuracy .move-cls-dot { background: var(--inaccuracy); }
.cls-mistake    .move-cls-dot { background: var(--mistake); }
.cls-blunder    .move-cls-dot { background: var(--blunder); }

/* Tooltip */
.move-tooltip {
  position: fixed;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 12px 16px;
  pointer-events: none;
  z-index: 999;
  box-shadow: var(--shadow);
  min-width: 160px;
}
.tooltip-cls {
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 4px;
}
.tooltip-cpl { font-size: 12px; color: var(--text-2); }
.tooltip-best { font-size: 12px; color: var(--best); margin-top: 6px; }

/* cls colors */
.cls-best       { color: var(--best); }
.cls-excellent  { color: var(--excellent); }
.cls-good       { color: var(--good); }
.cls-inaccuracy { color: var(--inaccuracy); }
.cls-mistake    { color: var(--mistake); }
.cls-blunder    { color: var(--blunder); }

/* Live Engine Panel */
.live-engine-panel {
  background: #191815;      /* matching tabs header */
  border-top: 1px solid #2d2b27;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.engine-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.engine-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.toggle-arrows-lbl {
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toggle-arrows-lbl input {
  cursor: pointer;
}
.engine-lines-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.engine-line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #211f1c;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 13px;
}
.engine-line-item.empty {
  font-family: var(--font);
  color: var(--text-3);
  justify-content: center;
  font-style: italic;
  font-size: 12px;
  background: transparent;
  border: none;
}
.line-rank {
  font-weight: 600;
  margin-right: 8px;
}
.line-rank-1 { color: #4ade80; } /* green */
.line-rank-2 { color: #3b82f6; } /* blue */
.line-rank-3 { color: #f59e0b; } /* orange */

.line-move {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.line-eval {
  font-weight: 500;
  color: #d4a055; /* gold */
}

/* SVG Arrows */
#board {
  position: relative; /* ensure absolute svg stays inside board boundaries */
}

/* ── Chess Coach Panel (Universal Speech Bubble) ── */
.coach-panel {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 560px; /* matches board size on desktop */
  margin: 0 auto 12px;
  padding: 0 4px;
}
.coach-avatar {
  font-size: 32px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.coach-bubble {
  position: relative;
  background: #211f1c; /* chess.com dark sidebar dark */
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  flex: 1;
  box-shadow: var(--shadow);
}
/* Speech bubble left pointer arrow */
.coach-bubble::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -7px;
  width: 12px;
  height: 12px;
  background: #211f1c;
  border-left: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  transform: rotate(45deg);
}
.coach-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.coach-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.coach-badge {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #110c07;
}
.coach-text {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.4;
}
.mobile-navigation-row {
  display: none;
}
.mobile-bottom-bar {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #view-analysis {
    height: auto;
    overflow-y: visible !important;
  }
  .analysis-layout {
    flex-direction: column;
    height: auto;
    overflow-y: visible !important;
    padding: 16px;
    align-items: center;
    gap: 20px;
  }
  .board-col {
    align-items: center;
    width: 100%;
    max-width: 480px;
  }
  .right-col {
    width: 100%;
    max-width: 480px;
    height: auto;
    margin-top: 16px;
    flex-shrink: 1;
    display: none !important; /* Hide vertical sidebar on mobile — moves are now horizontal, review matches the bottom next button */
  }
  .sidebar-container {
    height: auto;
    min-height: 480px;
    box-shadow: none;
  }
  .moves-list-wrap {
    max-height: 280px;
    height: 280px;
  }
  .loading-board-ghost {
    width: 280px;
    height: 280px;
  }

  /* ── Reclaim vertical header space on mobile ── */
  .header {
    display: none !important;
  }
  .view {
    padding-top: calc(8px + var(--safe-top)) !important;
  }
  #view-analysis {
    padding-top: calc(6px + var(--safe-top)) !important; /* Tight top safety margin to maximize screen space */
  }

  /* ── Mobile One-Line Player Cards ── */
  .player-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 4px 6px !important;
    width: 100% !important;
    max-width: 480px !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    height: auto !important;
  }
  .player-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .player-info > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
  }
  .player-name {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    max-width: 150px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .player-rating {
    font-size: 12px !important;
    color: var(--text-3) !important;
    font-weight: 500 !important;
    margin: 0 !important;
  }
  .player-accuracy {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 !important;
  }
  .player-accuracy .acc-label {
    display: none !important; /* Hide 'Accuracy' word on mobile */
  }
  .player-accuracy .acc-value {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    background: #81b64c !important; /* chess.com green accuracy pill */
    color: #fff !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
  }
  .player-avatar {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    margin: 0 !important;
  }
  #player-bottom {
    margin-top: 6px !important; /* Spacing breathing space below the chessboard */
  }

  /* ── Hide desktop controls on mobile ── */
  #desktop-board-controls {
    display: none !important;
  }

  /* ── Chess Coach Panel (Mobile Speech Bubble) ── */
  .coach-panel {
    max-width: 480px !important;
    margin-bottom: 4px !important;
    gap: 20px !important;
  }

  /* ── Mobile Horizontal Navigation Row ── */
  .mobile-navigation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    background: #191815;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    margin-top: 4px !important;
  }
  .ctrl-btn-mobile {
    background: var(--card-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .ctrl-btn-mobile:active {
    background: var(--border-2);
  }
  .mobile-moves-scroll {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap; /* allow wrapping onto multiple rows */
    max-height: 80px; /* precisely fits 2 rows of move items */
    height: 80px;
    overflow-y: auto; /* vertical scroll fallback */
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding: 4px;
    -webkit-overflow-scrolling: touch; /* smooth iOS touch inertia */
  }
  /* Hide scrollbar elements */
  .mobile-moves-scroll::-webkit-scrollbar {
    display: none;
  }
  .mobile-moves-scroll {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }
  .mobile-move-item {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
  }
  .mobile-move-item.active {
    color: var(--text) !important;
    background: var(--border-2);
    font-weight: 700;
    text-decoration: underline;
  }
  .mobile-move-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }
  .mobile-move-num {
    color: var(--text-3);
    font-weight: 600;
  }

  /* ── Mobile Bottom Actions Toolbar ── */
  .mobile-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    background: #191815;
    padding: 8px 12px !important;
    margin-top: 6px !important;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .mobile-action-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-2);
    cursor: pointer;
    font-size: 11px;
    font-family: var(--font);
    flex: 1;
  }
  .mobile-action-icon {
    font-size: 18px;
  }
  .mobile-action-btn:active {
    color: var(--text);
  }
  .btn-mobile-primary-next {
    background: #81b64c; /* chess.com green button */
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(129,182,76,0.3);
    flex: 1.5;
    text-align: center;
  }
  .btn-mobile-primary-next:active {
    background: #6a9c3b;
    transform: translateY(1px);
  }
}
@media (max-width: 600px) {
  .search-row { flex-direction: column; }
  .games-grid { grid-template-columns: 1fr; }
  .accuracy-row { flex-direction: column; align-items: flex-start; }

  /* Bigger touch targets for controls */
  .ctrl-btn { width: 48px; height: 48px; font-size: 18px; border-radius: 10px; }
  .board-controls { gap: 8px; margin-top: 10px; }
  .move-counter { font-size: 14px; min-width: 70px; }

  /* Compact analysis topbar */
  .analysis-topbar { padding: 8px 12px 0; gap: 10px; }
  .back-btn { padding: 7px 12px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }

  /* Player bars flush against board */
  .player-bar { padding: 4px 2px; }
  .player-avatar { width: 32px; height: 32px; font-size: 15px; }
  .player-name { font-size: 14px; }
  .acc-value { font-size: 18px; }
  .acc-label { font-size: 10px; }

  /* Mobile Loading screen fixes */
  .loading-screen {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 16px;
  }
  .loading-board-ghost {
    width: 260px;
    height: 260px;
    background-size: 32.5px 32.5px;
  }
  .loading-info {
    padding-top: 0;
    width: 100%;
    text-align: center;
  }

  /* Mobile Dashboard & KPI layout */
  .games-kpi-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    padding: 0 16px !important;
    margin-top: 16px !important;
  }
  .games-kpi-row > :first-child {
    grid-column: span 2 !important; /* Record card stays full width */
  }
  .kpi-card {
    padding: 12px 16px;
  }
  .kpi-title {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .kpi-value {
    font-size: 18px;
  }

  /* Mobile Games Archive List layout */
  .games-list-container {
    padding: 0 16px;
    margin-top: 16px;
    margin-bottom: 24px;
  }
  .games-list-header {
    display: none !important; /* Hide headers on mobile */
  }
  .game-row {
    grid-template-columns: 60px 1fr auto;
    gap: 12px;
    padding: 12px 14px;
  }
  .game-row-opening {
    display: none !important;
  }
  .game-row-date {
    display: none !important;
  }
  .game-row-action-btn {
    display: none !important; /* Entire row is clickable anyway */
  }
  .game-row-mode {
    font-size: 11px;
    justify-content: flex-end;
  }

  /* Smaller board notations & player headers for mobile */
  .notation-322f9 {
    font-size: 9px !important;
  }
  .player-name {
    font-size: 13px !important;
    max-width: 120px !important;
  }
  .player-rating {
    font-size: 11px !important;
  }
  .acc-value {
    font-size: 15px !important;
  }

  /* ── Mobile Game Review Card (Whitespace Use) ── */
  .mobile-review-card {
    display: block !important;
    background: #1e1b18 !important; /* chess.com sidebar dark background */
    border: 1.5px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    margin-top: 16px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    max-width: 480px !important;
    box-shadow: var(--shadow) !important;
  }
  .mob-review-header {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: var(--text-2) !important;
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1.5px solid var(--border) !important;
    padding-bottom: 4px !important;
  }
  /* Scrollable container for mobile review details */
  .mob-review-scroll-area {
    max-height: 200px !important;
    overflow-y: auto !important;
    padding-right: 4px !important;
    -webkit-overflow-scrolling: touch !important; /* momentum scroll on iOS */
  }
  .mob-review-scroll-area::-webkit-scrollbar {
    width: 4px !important;
  }
  .mob-review-scroll-area::-webkit-scrollbar-thumb {
    background: var(--border) !important;
    border-radius: 2px !important;
  }

  /* Mobile review chart styling */
  .mob-chart-section {
    margin-top: 14px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }
  .mob-chart-label {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    color: var(--text-3) !important;
    margin-bottom: 6px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  .mob-chart-wrap {
    position: relative !important;
    height: 100px !important;
    width: 100% !important;
    background: var(--card-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 6px !important;
  }

  /* Metadata Info grid styling */
  .mob-info-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-top: 12px !important;
    border-top: 1.5px solid var(--border) !important;
    padding-top: 10px !important;
  }
  .mob-info-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: var(--card-2) !important;
    border: 1px solid var(--border) !important;
    padding: 6px 4px !important;
    border-radius: 6px !important;
  }
  .mob-info-label {
    font-size: 9.5px !important;
    color: var(--text-3) !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
  }
  .mob-info-value {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    color: var(--text-2) !important;
    margin-top: 2px !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  .mob-cls-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* 3 columns: Blunders, Mistakes, Inaccuracies */
    gap: 8px !important;
    margin-top: 6px !important;
  }
  .mob-cls-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    padding: 6px 4px !important;
    border-radius: 6px !important;
  }
  .mob-cls-num-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-weight: 700 !important;
    font-size: 13.5px !important;
  }
  .mob-cls-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50 !important;
    border-radius: 50% !important;
  }
  .mob-cls-label {
    font-size: 10px !important;
    color: var(--text-3) !important;
    margin-top: 2px !important;
    font-weight: 600 !important;
  }
}

/* Hide review card on desktop */
.mobile-review-card {
  display: none;
}

/* ── Clocks, Captured Pieces, Flags, and Summary Pills ── */
.player-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-name {
  font-weight: 600;
  font-size: 14px;
}
.player-rating {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}
.captured-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-2);
  min-height: 16px;
}
.captured-piece {
  font-size: 13px;
  margin-right: -2px;
  opacity: 0.85;
}
.material-adv-pill {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  margin-left: 4px;
}
.player-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-clock {
  background: #262421;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  min-width: 64px;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.player-clock.active {
  background: #d4a055;
  color: #110c07;
  border-color: #d4a055;
}

/* Move grid time spent element */
.move-time {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--mono);
  opacity: 0.75;
}
.move-cell.active .move-time {
  color: inherit;
  opacity: 0.9;
}

/* Move Classification Summary Pills (Desktop sidebar under moves list) */
.desktop-summary-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 0 8px;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  color: #110c07;
  box-shadow: var(--shadow);
}
.summary-pill.pill-best       { background: var(--best); }
.summary-pill.pill-excellent  { background: var(--excellent); }
.summary-pill.pill-good       { background: var(--good); }
.summary-pill.pill-inaccuracy { background: var(--inaccuracy); }
.summary-pill.pill-mistake    { background: var(--mistake); }
.summary-pill.pill-blunder    { background: var(--blunder); }


/* ── Onboarding Phone Auth Overlay ── */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 12, 7, 0.95);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--card-1);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.auth-card h2 {
  font-size: 22px;
  color: var(--text-1);
  margin-bottom: 12px;
  font-weight: 700;
}
.auth-card p {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 24px;
  line-height: 1.5;
}
.auth-input-group input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
  font-size: 16px;
  text-align: center;
  margin-bottom: 20px;
  font-family: var(--mono);
}
.auth-input-group input:focus {
  border-color: var(--best);
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}
.btn-auth {
  width: 100%;
  background: var(--best);
  color: #110c07;
  font-size: 16px;
  font-weight: 700;
  padding: 12px;
  border-radius: 8px;
}


/* ── Voice Call Overlay Screen ── */
.voice-call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 12, 7, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
}
.call-avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-avatar {
  font-size: 72px;
  z-index: 2;
  user-select: none;
}
.call-pulse-waves {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.pulse-wave {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(212, 160, 85, 0.2);
  animation: pulseScale 2s infinite ease-out;
}
.pulse-wave:nth-child(2) {
  animation-delay: 1s;
}
@keyframes pulseScale {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.call-details {
  text-align: center;
  margin-bottom: 40px;
  padding: 0 20px;
}
.call-details h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text-1);
  font-weight: 700;
}
.call-details p {
  font-size: 13px;
  color: var(--text-3);
}
.call-details p.call-privacy-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  opacity: 0.75;
  line-height: 1.4;
}
.call-feedback-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 15px 25px;
  max-width: 80%;
  text-align: center;
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.4;
  color: var(--text-2);
  font-style: italic;
}
.call-action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.call-action-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.call-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}
.call-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.call-text-fallback {
  display: flex;
  gap: 8px;
  margin-bottom: 36px;
  width: 80%;
  max-width: 320px;
}
.call-text-fallback input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
  font-size: 14px;
  font-family: var(--mono);
}
.call-text-fallback input:focus {
  border-color: var(--best);
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}
.call-text-fallback button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--best);
  color: #110c07;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.call-controls {
  display: flex;
  gap: 30px;
}
.call-controls button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.call-controls button:active {
  transform: scale(0.9);
}
.btn-mute {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}
.btn-mute.muted {
  background: #ef4444;
}
.btn-hangup {
  background: #ef4444;
  color: white;
}
.btn-hangup:hover {
  background: #dc2626;
}


/* ── Call Trigger Button ── */
.btn-call {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #22c55e !important;
  transition: background 0.15s, color 0.15s;
}
.btn-call:hover {
  background: #22c55e !important;
  color: #110c07 !important;
}


/* ── Games Page: Play Section (bot selector + PvP cards) ── */
.play-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px 24px 8px;
}

.saved-games-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 24px 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Saved Games Tab Styles ── */
.saved-games-container {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.bot-selector-card {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 14px;
}
.bot-selector-card h3 {
  font-size: 14px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--text-1);
}
.bot-selector-card p {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.bot-select-dropdown {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-1);
  background: var(--card-1);
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
}
.pvp-challenge-card, .pvp-pending-card {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 14px;
}
.pvp-challenge-card h3 {
  font-size: 14px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--text-1);
}
.pvp-challenge-card p {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.pvp-challenge-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pvp-challenge-row button,
.bot-selector-row button {
  width: 100%;
  justify-content: center;
}
.bot-selector-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pvp-challenge-row input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-1);
  background: var(--card-1);
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--mono);
}
.pvp-challenge-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.pvp-pending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.pvp-pending-item {
  background: var(--card-1);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.pvp-pending-item .pvp-pending-actions {
  display: flex;
  gap: 6px;
}
.pvp-pending-item button {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.pvp-pending-item button.pvp-accept {
  background: var(--best);
  color: #110c07;
  border-color: var(--best);
}
.pvp-pending-item.empty {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  padding: 14px;
  background: transparent;
  border: none;
}
.saved-games-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 6px;
  margin-top: 8px;
}
.saved-games-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}
.game-history-item {
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.game-history-item:hover {
  background: var(--card-1);
  border-color: var(--best);
}
.game-history-item.empty {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  padding: 20px;
  background: transparent;
  border: none;
}
.game-item-players {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.game-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}
.game-item-accs {
  display: flex;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
}
.game-acc-val {
  padding: 2px 5px;
  border-radius: 4px;
  color: #110c07;
}
.game-acc-white { background: var(--best); }
.game-acc-black { background: var(--good); }


/* ── Centering Play Lobby View ── */
#view-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#view-play .page-header {
  max-width: 1000px;
  width: 100%;
  text-align: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px 24px 0;
}

#view-play .page-header > div:nth-child(2) {
  text-align: center;
  width: 100%;
  margin-top: 12px;
}

#view-play .play-section {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  justify-content: center;
  padding: 20px 24px 24px;
}

/* ── Redesigned Hero Tagline & Phone Section ── */
.hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 24px;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .hero-tagline {
    white-space: normal;
  }
}
.phone-display-section {
  background: linear-gradient(135deg, rgba(36, 26, 15, 0.82), rgba(46, 33, 19, 0.5));
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 38px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 36px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.65), 0 0 25px rgba(212, 160, 85, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.phone-display-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 55px rgba(0,0,0,0.7), 0 0 35px rgba(212, 160, 85, 0.22);
}
@media (max-width: 680px) {
  .phone-display-section {
    padding: 24px 28px;
    max-width: 95%;
  }
}
.phone-label-small {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}
.phone-row-main {
  display: flex;
  align-items: center;
  gap: 16px;
}
.phone-link {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 6.8vw, 3.2rem);
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.phone-link:hover {
  color: var(--accent);
  text-shadow: 0 0 15px rgba(212, 160, 85, 0.5);
}
.phone-sub-display {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 10px;
  letter-spacing: 0.5px;
}
.phone-tooltip-bubble {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--card-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: var(--shadow);
  z-index: 10;
}
.phone-tooltip-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.btn-copy-mini {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}
.btn-copy-mini:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--border-2);
}

/* ── Live Ongoing Games Grid ── */
.home-live-games {
  padding: 80px 24px;
  background: rgba(28, 20, 12, 0.2);
  border-bottom: 1px solid var(--border);
  position: relative;
  width: 100%;
}
.live-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.live-game-card {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
}
.live-game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.live-game-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--best);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.live-game-pulse {
  width: 6px;
  height: 6px;
  background: var(--best);
  border-radius: 50%;
  position: relative;
}
.live-game-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--best);
  animation: pulse-small 1.5s infinite ease-in-out;
}
@keyframes pulse-small {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}
.live-game-players {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.live-game-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.live-game-source {
  background: rgba(212, 160, 85, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}
.btn-watch {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-watch:hover {
  background: var(--accent);
  color: #110c07;
  border-color: var(--accent);
}
.live-game-placeholder-card {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 40px;
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}

/* ── Footer styling ── */
.footer {
  padding: 40px 24px;
  background: rgba(17, 12, 7, 0.95);
  border-top: 1px solid var(--border);
  width: 100%;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-copy {
  font-size: 13px;
  color: var(--text-3);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-link {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-link:hover {
  color: var(--accent);
}
@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ── About view styling ── */
.about-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  width: 100%;
}
.about-card {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.about-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 24px;
  margin-bottom: 10px;
}
.about-card h3:first-of-type {
  margin-top: 0;
}
.about-card p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ── Use Cases / Designed for Every Player section ── */
.home-use-cases {
  padding: 100px 24px;
  background: rgba(17, 12, 7, 0.95);
  border-bottom: 1px solid var(--border);
  position: relative;
  width: 100%;
}
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
@media (min-width: 768px) {
  .use-cases-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .use-cases-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.use-case-card {
  background: linear-gradient(135deg, var(--card), rgba(36, 26, 15, 0.4));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.use-case-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top left, rgba(212, 160, 85, 0.03) 0%, transparent 60%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.use-case-card:hover {
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 160, 85, 0.05);
}
.use-case-card:hover::before {
  background: radial-gradient(circle at top left, rgba(212, 160, 85, 0.08) 0%, transparent 70%);
}
.use-case-icon-box {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 24px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.3s ease;
}
.use-case-card:hover .use-case-icon-box {
  transform: scale(1.1);
  border-color: var(--accent);
}
.use-case-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.use-case-description {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 20px;
  flex-grow: 1;
}
.use-case-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.keyword-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  background: rgba(212, 160, 85, 0.04);
  border: 1px solid rgba(212, 160, 85, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  user-select: none;
}
.use-case-card:hover .keyword-tag {
  color: var(--text-2);
  background: rgba(212, 160, 85, 0.08);
  border-color: rgba(212, 160, 85, 0.2);
}

/* ── SCREEN READER AND ACCESSIBILITY COMPLIANCE ── */

/* Skip Link styling */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 20px;
  z-index: 9999;
  font-weight: bold;
  border-radius: 0 0 8px 0;
  transition: top 0.2s ease;
  font-family: var(--font);
}
.skip-link:focus {
  top: 0;
  outline: none;
}

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

/* Premium Focus Outlines */
:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 2px !important;
}
input:focus-visible, button:focus-visible, a:focus-visible, [role="button"]:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 2px !important;
}

/* ── TRUST STRIP STYLING ── */
.trust-strip {
  background: rgba(28, 20, 12, 0.6);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  backdrop-filter: blur(8px);
}
.trust-strip-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.trust-item {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.trust-divider {
  color: var(--text-3);
  opacity: 0.4;
}

/* ── STATIC CONTENT PAGES STYLING ── */
.content-page-body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.content-container {
  max-width: 800px;
  margin: 110px auto 80px;
  padding: 0 24px;
  flex: 1;
}
.content-container h1 {
  font-size: 38px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 14px;
  letter-spacing: -0.5px;
}
.content-container h2 {
  font-size: 26px;
  font-weight: 600;
  margin-top: 45px;
  margin-bottom: 16px;
  color: var(--text);
  border-bottom: 1px solid rgba(181,136,99,0.1);
  padding-bottom: 6px;
}
.content-container h3 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
  color: var(--accent);
}
.content-container p {
  margin-bottom: 20px;
  color: var(--text-2);
  line-height: 1.75;
  font-size: 16px;
}
.content-container ul, .content-container ol {
  margin-bottom: 30px;
  padding-left: 26px;
}
.content-container li {
  margin-bottom: 10px;
  color: var(--text-2);
  line-height: 1.7;
  font-size: 16px;
}
.content-container strong {
  color: var(--text);
}
.content-container blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 20px;
  margin: 30px 0;
  font-style: italic;
  color: var(--text-2);
  background: rgba(212, 160, 85, 0.03);
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: 0 8px 8px 0;
}
.content-container code {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--accent);
}
.content-container pre {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
}
.content-container pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  color: var(--text);
}
.content-container a {
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.2s;
}
.content-container a:hover {
  color: var(--text);
}

/* Key value table for command list */
.command-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 30px;
  background: rgba(28, 20, 12, 0.3);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.command-table th, .command-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.command-table th {
  background: rgba(28, 20, 12, 0.7);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.command-table td {
  color: var(--text-2);
  font-size: 15px;
}
.command-table tr:last-child td {
  border-bottom: none;
}
.command-table code {
  font-size: 13px;
}

@media (max-width: 768px) {
  .trust-divider {
    display: none;
  }
  .trust-strip-inner {
    flex-direction: column;
    gap: 8px;
  }
  .content-container {
    margin-top: 90px;
  }
  .content-container h1 {
    font-size: 30px;
  }
}



