/* ============================================================
   ROWEL CHESS OS — style.css
   Design system: Deep space dark, gold accents, Cinzel display
   ============================================================ */

/* ===== TOKENS ===== */
:root {
  --bg: #0A0A0F;
  --bg-2: #111118;
  --bg-card: #16161f;
  --bg-hover: #1e1e2a;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(240,180,41,0.3);

  --gold: #F0B429;
  --gold-dim: #C8922A;
  --gold-glow: rgba(240,180,41,0.2);
  --teal: #2DD4BF;
  --teal-dim: #0D9488;
  --purple: #A78BFA;
  --red: #F87171;
  --green: #34D399;

  --text: #F5F0E8;
  --text-2: #9999AA;
  --text-3: #555566;

  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-gold: 0 0 40px rgba(240,180,41,0.15);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.5);

  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  --nav-h: 70px;
}

[data-theme="light"] {
  --bg: #F8F7F2;
  --bg-2: #EEEAE0;
  --bg-card: #FFFFFF;
  --bg-hover: #F0EDE3;
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(240,180,41,0.4);
  --text: #1A1A2E;
  --text-2: #555566;
  --text-3: #AAAAAA;
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.08);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-glow);
  border: 1px solid rgba(240,180,41,0.25);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

.section-header p {
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #0A0A0F;
}
.btn-primary:hover {
  background: #FFCC55;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(240,180,41,0.35);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--text);
  background: var(--bg-hover);
}

.btn-sm { padding: 8px 18px; font-size: 0.875rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }
.btn-full { width: 100%; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

[data-theme="light"] .navbar {
  background: rgba(248,247,242,0.9);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon {
  font-size: 1.5rem;
  color: var(--gold);
  filter: drop-shadow(0 0 8px var(--gold));
}
.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.logo-accent { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--bg-hover); }

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

.lang-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition);
  letter-spacing: 0.05em;
}
.lang-btn.active, .lang-btn:hover {
  background: var(--gold);
  color: #0A0A0F;
}

.theme-toggle {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--gold); }

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
}
.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-top: var(--nav-h);
}

.hero-board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.hero-board .cell {
  border: 1px solid rgba(240,180,41,0.3);
  transition: opacity 1s ease;
}
.hero-board .cell.light { background: rgba(240,180,41,0.15); }
.hero-board .cell.pulse { opacity: 0.6 !important; }

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  padding: 40px 24px;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(45,212,191,0.1);
  border: 1px solid rgba(45,212,191,0.25);
  padding: 5px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}
.hero-title-main {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.hero-title-accent {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(240,180,41,0.4);
  letter-spacing: -0.01em;
}
.hero-title-sub {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}

.hero-desc {
  color: var(--text-2);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--gold));
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ===== CHESS BOARD ===== */
.play-section { background: var(--bg-2); }

.play-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: start;
}

.board-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.chess-board {
  width: min(480px, calc(100vw - 48px));
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 3px solid var(--gold-dim);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-gold);
  user-select: none;
}

.chess-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.chess-cell.light-sq { background: #E8CFA0; }
.chess-cell.dark-sq { background: #6B4226; }
.chess-cell.selected { background: rgba(240,180,41,0.6) !important; }
.chess-cell.possible-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  background: rgba(240,180,41,0.5);
  border-radius: 50%;
}
.chess-cell.possible-capture {
  box-shadow: inset 0 0 0 3px rgba(240,180,41,0.6);
}
.chess-cell:hover { filter: brightness(1.15); }
.chess-cell .piece {
  font-size: inherit;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 1;
  pointer-events: none;
}

.board-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== COACH PANEL ===== */
.coach-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 540px;
  overflow: hidden;
}

.coach-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
}

.coach-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--gold-glow);
}

.coach-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}
.coach-status {
  font-size: 0.8rem;
  color: var(--teal);
  font-family: var(--font-mono);
}

.coach-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.coach-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgFadeIn 0.3s ease;
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.coach-msg p {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}
.coach-msg.user-msg p {
  background: rgba(240,180,41,0.12);
  border-color: rgba(240,180,41,0.2);
  border-radius: 12px 12px 4px 12px;
  margin-left: auto;
}
.msg-icon { font-size: 1rem; margin-top: 10px; flex-shrink: 0; }

.coach-input-area {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.coach-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}
.coach-input:focus { border-color: var(--gold); }

.coach-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots span {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== FEATURES ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, var(--gold-glow));
  opacity: 0;
  transition: opacity var(--transition);
}
.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
}
.feature-card:hover::before { opacity: 1; }

.feature-card--large {
  grid-column: span 2;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}
.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.feature-card p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 14px;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feature-list li {
  font-size: 0.8rem;
  color: var(--text-2);
  padding-left: 18px;
  position: relative;
}
.feature-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--gold);
}

.feature-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  margin-top: 14px;
  font-weight: 600;
}
.feature-tag.free { background: rgba(52,211,153,0.15); color: var(--green); }
.feature-tag.premium { background: rgba(240,180,41,0.15); color: var(--gold); }
.feature-tag.pro { background: rgba(167,139,250,0.15); color: var(--purple); }

/* ===== MISSIONS ===== */
.missions-section { background: var(--bg-2); }

.missions-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
}

.missions-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  cursor: pointer;
}
.mission-item:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.mission-item.completed { border-color: rgba(52,211,153,0.3); }
.mission-item.locked { opacity: 0.5; cursor: not-allowed; }

.mission-icon { font-size: 1.6rem; flex-shrink: 0; }
.mission-content { flex: 1; }
.mission-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.mission-desc { font-size: 0.8rem; color: var(--text-2); }
.mission-xp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  background: var(--gold-glow);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(240,180,41,0.2);
  flex-shrink: 0;
}
.mission-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.mission-check.done { background: rgba(52,211,153,0.2); color: var(--green); }
.mission-check.pending { background: var(--bg-2); border: 2px solid var(--border); }

.progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.xp-bar-wrapper { display: flex; flex-direction: column; gap: 8px; }
.xp-label { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.xp-level { font-family: var(--font-display); font-size: 1.4rem; color: var(--gold); font-weight: 700; }
.xp-bar { height: 8px; background: var(--bg-2); border-radius: 100px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 100px; transition: width 1s ease; }
.xp-numbers { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-3); }

.streak-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(240,100,41,0.1);
  border: 1px solid rgba(240,100,41,0.2);
  padding: 12px 16px;
  border-radius: var(--radius);
}
.streak-fire { font-size: 1.5rem; }
.streak-count { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: #F97316; line-height: 1; }

.badges-row { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  width: 42px;
  height: 42px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
}
.badge:hover { border-color: var(--gold); transform: scale(1.1); }
.badge.badge-locked { opacity: 0.35; filter: grayscale(1); }

/* ===== FEED ===== */
.feed-section { background: var(--bg); }

.feed-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 40px;
  align-items: start;
}

.feed-mobile-frame {
  background: #111;
  border: 8px solid #333;
  border-radius: 32px;
  height: 600px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.feed-scroll {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed-scroll::-webkit-scrollbar { display: none; }

.feed-item {
  height: 100%;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 16px;
  flex-shrink: 0;
}

.feed-item-bg {
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.feed-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 40%, transparent);
}

.feed-item-content { position: relative; z-index: 1; }
.feed-item-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--gold);
  color: #000;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 8px;
}
.feed-item-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.feed-item-desc { font-size: 0.8rem; color: rgba(255,255,255,0.8); line-height: 1.4; }

.feed-controls {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feed-nav-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-size: 0.9rem;
  transition: all var(--transition);
}
.feed-nav-btn:hover { background: var(--gold); color: #000; border-color: var(--gold); }

.feed-sidebar h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.feed-topics { display: flex; flex-direction: column; gap: 10px; }
.feed-topic {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition);
}
.feed-topic:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.feed-topic-name { font-size: 0.9rem; font-weight: 500; }
.feed-topic-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--gold); }

/* ===== MIND MAP ===== */
.mindmap-section { background: var(--bg-2); }

.mindmap-layout {
  display: grid;
  grid-template-columns: 500px 1fr;
  gap: 48px;
  align-items: center;
}

#mindMapCanvas {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.mindmap-legend {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 14px;
}
.legend-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.legend-item span:nth-child(2) { flex: 1; font-size: 0.95rem; }
.legend-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
}

/* ===== ANALYTICS ===== */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}
.analytics-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.analytics-card--wide { grid-column: span 2; }

.analytics-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.analytics-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1; margin-bottom: 6px; }
.analytics-change { font-size: 0.8rem; color: var(--green); }
.analytics-change.down { color: var(--red); }

.mini-chart {
  height: 60px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  margin-top: 12px;
}
.mini-bar {
  flex: 1;
  background: linear-gradient(to top, var(--gold-dim), var(--gold));
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease;
  opacity: 0.8;
  min-height: 4px;
}

/* ===== SOCIAL ===== */
.social-section { background: var(--bg); }

.social-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  margin: 0 auto 32px;
}
.social-tab {
  background: none;
  border: none;
  color: var(--text-2);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.social-tab.active, .social-tab:hover {
  background: var(--gold);
  color: #0A0A0F;
}

.leaderboard-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px 100px;
  gap: 16px;
  padding: 14px 20px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.leaderboard-row:hover { background: var(--bg-hover); }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row.header { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); background: var(--bg-2); }
.rank { font-family: var(--font-display); font-weight: 700; color: var(--gold); }
.rank.gold { color: #FFD700; }
.rank.silver { color: #C0C0C0; }
.rank.bronze { color: #CD7F32; }
.player-cell { display: flex; align-items: center; gap: 12px; }
.player-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; flex-shrink: 0; }
.player-name { font-weight: 600; font-size: 0.9rem; }
.player-country { font-size: 0.75rem; color: var(--text-3); }
.rating-cell { font-family: var(--font-mono); font-size: 0.9rem; color: var(--gold); }
.winrate-cell { font-family: var(--font-mono); font-size: 0.85rem; }
.trend-cell { display: flex; gap: 2px; align-items: flex-end; height: 24px; }
.trend-bar { width: 4px; background: var(--gold); border-radius: 2px; }

/* ===== PRICING ===== */
.pricing-section { background: var(--bg-2); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: stretch;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.pricing-card--featured {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
  box-shadow: var(--shadow-gold);
}

.pricing-card--academy {
  border-style: dashed;
  border-color: var(--teal-dim);
}

.plan-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--gold);
  color: #000;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
}

.plan-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.plan-price {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.plan-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-3); }

.plan-tagline { font-size: 0.85rem; color: var(--text-2); margin-top: -10px; }

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.plan-features li { font-size: 0.875rem; color: var(--text-2); }
.plan-features li.plan-locked { color: var(--text-3); }

/* ===== CONTACT ===== */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.contact-info { display: flex; flex-direction: column; gap: 24px; }
.contact-item { display: flex; align-items: flex-start; gap: 16px; }
.contact-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.contact-label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.contact-value { font-size: 1rem; color: var(--gold); font-weight: 500; transition: color var(--transition); }
.contact-value:hover { color: #FFCC55; }

.contact-form { display: flex; flex-direction: column; gap: 12px; }
.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--gold); }
select.form-input option { background: var(--bg-2); }
textarea.form-input { resize: vertical; }

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 60px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.footer-brand { display: flex; flex-direction: column; gap: 14px; }
.footer-brand p { font-size: 0.875rem; color: var(--text-2); max-width: 280px; line-height: 1.6; }
.footer-email { font-family: var(--font-mono); font-size: 0.85rem; color: var(--gold); }
.footer-email:hover { color: #FFCC55; }

.footer-links h4 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.footer-links ul { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.875rem; color: var(--text-2); transition: color var(--transition); }
.footer-links a:hover { color: var(--gold); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-3);
}
.footer-bottom a { color: var(--gold); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}
.toast.success { border-color: rgba(52,211,153,0.4); }
.toast.error { border-color: rgba(248,113,113,0.4); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== SCROLL ANIMATIONS ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 1100px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-card--large { grid-column: span 2; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-card--wide { grid-column: span 2; }
  .mindmap-layout { grid-template-columns: 1fr; }
  #mindMapCanvas { max-width: 380px; margin: 0 auto; }
}

@media (max-width: 900px) {
  .play-layout { grid-template-columns: 1fr; }
  .coach-panel { height: 420px; }
  .missions-layout { grid-template-columns: 1fr; }
  .feed-container { grid-template-columns: 1fr; }
  .feed-mobile-frame { margin: 0 auto; }
  .feed-controls { right: 8px; }
  .contact-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--bg-2); padding: 16px; border-bottom: 1px solid var(--border); }
}

@media (max-width: 600px) {
  section { padding: 64px 0; }
  .hero-stats { gap: 28px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-card--wide { grid-column: span 1; }
  .footer-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .feature-card--large { grid-column: span 1; }
  .leaderboard-row { grid-template-columns: 40px 1fr 70px; }
  .winrate-cell, .trend-cell { display: none; }
  .social-tabs { flex-wrap: wrap; }
  .lang-switcher { display: none; }
}

/* ===== RTL (Arabic) ===== */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .nav-links { margin-left: 0; margin-right: auto; }
[dir="rtl"] .feature-list li { padding-left: 0; padding-right: 18px; }
[dir="rtl"] .feature-list li::before { left: auto; right: 0; }
[dir="rtl"] .coach-msg.user-msg p { border-radius: 12px 12px 12px 4px; margin-right: auto; margin-left: 0; }
