/* EL3AB Design System v2 — Redesigned from scratch */

:root {
  /* Backgrounds — deeper contrast between layers */
  --bg-0: #030A12;
  --bg-1: #081420;
  --bg-2: #0F1F30;
  --bg-3: #182B42;
  --bg-surface: #0C1926;
  --bg-elevated: #142438;

  /* Brand */
  --gold: #F5B731;
  --gold-dim: rgba(245, 183, 49, 0.12);
  --gold-dark: #D49A18;
  --cyan: #00D4FF;
  --cyan-dim: rgba(0, 212, 255, 0.10);
  --cyan-dark: #00A8CC;
  --blue: #3B82F6;
  --purple: #8B5CF6;
  --green: #10B981;

  /* Status */
  --success: #34D399;
  --error: #F87171;
  --warning: #FBBF24;
  --online: #22C55E;

  /* Text — WCAG AA compliant on bg-0 */
  --text-1: #F8FAFC;
  --text-2: #CBD5E1;
  --text-3: #8B9DB7;
  --text-inverse: #0F172A;

  /* Border */
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 212, 255, 0.5);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow-gold: 0 0 20px rgba(245, 183, 49, 0.15);
  --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);

  /* Layout */
  --header-h: 52px;
  --nav-h: 60px;
  --sidebar-w: 240px;
  --content-max: 640px;
  --touch: 44px;

  /* Fonts */
  --font-ar: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
}

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

html {
  direction: rtl;
  font-family: var(--font-ar);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--r-full); }

/* === TYPOGRAPHY === */
.t-display { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.5px; }
.t-heading { font-size: 20px; font-weight: 700; line-height: 1.3; }
.t-subhead { font-size: 16px; font-weight: 600; line-height: 1.4; }
.t-body { font-size: 14px; font-weight: 400; line-height: 1.5; }
.t-caption { font-size: 12px; font-weight: 500; line-height: 1.4; color: var(--text-3); }
.t-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* === LAYOUT SHELL === */
.shell {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

@media (min-width: 1024px) {
  .shell {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr;
  }
}

/* === HEADER === */
.hdr {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  background: rgba(3, 10, 18, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

@media (min-width: 1024px) {
  .hdr {
    grid-column: 2;
    padding: 0 var(--sp-6);
  }
}

.hdr-brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: -1px;
}

.hdr-center {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.hdr-rating {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 10px;
  background: var(--bg-2);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.hdr-rating-icon {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.hdr-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}

.hdr-btn:hover { background: var(--bg-2); color: var(--text-2); }

.hdr-dot {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-0);
}

/* === SIDEBAR (Desktop) === */
.sidebar {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-3);
  overflow-y: auto;
  z-index: 50;
}

@media (min-width: 1024px) {
  .sidebar { display: flex; }
}

.sidebar-brand {
  font-weight: 800;
  font-size: 24px;
  color: var(--gold);
  letter-spacing: -1px;
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-6);
}

.sidebar-section {
  margin-bottom: var(--sp-5);
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-1);
}

.sidebar-item.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.sidebar-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  background: var(--gold);
  color: var(--text-inverse);
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--r-md);
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: var(--shadow-glow-gold);
}

.sidebar-play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(245, 183, 49, 0.25);
}

.sidebar-play-btn:active { transform: scale(0.97); }

/* === BOTTOM NAV (Mobile) === */
.nav-m {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  padding-top: var(--sp-2);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(3, 10, 18, 0.92);
  backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--border);
}

@media (min-width: 1024px) {
  .nav-m { display: none; }
}

.nav-m-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) 0;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
  position: relative;
  min-height: var(--touch);
  justify-content: center;
}

.nav-m-item.active { color: var(--cyan); }

.nav-m-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--cyan);
  border-radius: 0 0 var(--r-full) var(--r-full);
}

.nav-m-item .icon {
  width: 22px;
  height: 22px;
}

/* Floating play button in center */
.nav-m-play {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) - 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 41;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(245, 183, 49, 0.35);
  transition: transform 0.15s var(--ease-bounce);
}

@media (min-width: 1024px) {
  .nav-m-play { display: none; }
}

.nav-m-play:active { transform: translateX(-50%) scale(0.9); }
.nav-m-play .icon { width: 24px; height: 24px; color: var(--text-inverse); stroke-width: 2.5; }

/* === MAIN CONTENT === */
.main {
  padding: var(--sp-5) var(--sp-4) calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-8));
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 1024px) {
  .main {
    grid-column: 2;
    padding: var(--sp-6) var(--sp-8) var(--sp-8);
    max-width: 720px;
  }
}

/* === CARD === */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card-pad { padding: var(--sp-4); }
.card-pad-lg { padding: var(--sp-5); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--r-md);
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
  background: var(--gold);
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow-gold);
}

.btn-primary:hover { box-shadow: 0 0 30px rgba(245, 183, 49, 0.3); }

.btn-secondary {
  background: var(--cyan);
  color: var(--text-inverse);
}

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

.btn-ghost:hover { background: rgba(255,255,255,0.04); }

.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; font-weight: 700; border-radius: var(--r-lg); }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12px; }

/* === INPUTS === */
.field { margin-bottom: var(--sp-4); }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: var(--sp-2); }

.input {
  width: 100%;
  height: var(--touch);
  padding: 0 var(--sp-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}

.input::placeholder { color: var(--text-3); }

/* === CHIPS (time controls, filters) === */
.chip-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.chip {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip:hover { border-color: var(--text-3); }
.chip.active { background: var(--cyan); border-color: var(--cyan); color: var(--text-inverse); }
.chip-gold.active { background: var(--gold); border-color: var(--gold); color: var(--text-inverse); }

/* === STAT BLOCK === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: var(--sp-2);
}

.stat {
  background: var(--bg-2);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  text-align: center;
}

.stat-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-1);
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* === BADGE === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-full);
}

.badge-gold { background: var(--gold-dim); color: var(--gold); }
.badge-cyan { background: var(--cyan-dim); color: var(--cyan); }
.badge-green { background: rgba(16, 185, 129, 0.12); color: var(--green); }
.badge-red { background: rgba(248, 113, 113, 0.12); color: var(--error); }

/* === AVATAR === */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 72px; height: 72px; }
.avatar-ring { box-shadow: 0 0 0 2px var(--gold); }

/* === ICON BASE === */
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-fill { fill: currentColor; stroke: none; }

/* === GAME CARD (Home) === */
.quick-play-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.qp-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.qp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qp-card:active { transform: translateY(0); }

.qp-card-hero {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qp-card-hero--chess { background: linear-gradient(135deg, #1a2a4a 0%, #2a4a7a 100%); }
.qp-card-hero--ludo { background: linear-gradient(135deg, #2a1a4a 0%, #5a2a7a 100%); }
.qp-card-hero--domino { background: linear-gradient(135deg, #1a3a2a 0%, #2a5a4a 100%); }
.qp-card-hero--backgammon { background: linear-gradient(135deg, #3a2a1a 0%, #6a4a2a 100%); }

.qp-card-hero .icon-xl { color: rgba(255,255,255,0.85); }

.qp-card-body {
  padding: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qp-card-name {
  font-size: 13px;
  font-weight: 700;
}

.qp-card-live {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-3);
}

.qp-card-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--online);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.qp-card-soon {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
}

/* === FEATURED PLAY CARD (Home hero) === */
.hero-play {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid rgba(245, 183, 49, 0.2);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.hero-play::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(245, 183, 49, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-play-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-play-title {
  font-size: 18px;
  font-weight: 700;
}

.hero-play-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.hero-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: var(--text-inverse);
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-glow-gold);
  transition: transform 0.1s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.hero-play-btn::after {
  content: '';
  position: absolute;
  top: 0;
  right: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { right: -100%; }
  100% { right: 200%; }
}

.hero-play-btn:active { transform: scale(0.97); }

/* === STREAK BANNER === */
.streak-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.streak-banner-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 191, 36, 0.1);
  border-radius: var(--r-sm);
  color: var(--warning);
  font-size: 18px;
}

.streak-banner-text { flex: 1; }
.streak-banner-day { font-size: 14px; font-weight: 600; }
.streak-banner-reward { font-size: 12px; color: var(--text-3); }

.streak-banner-btn {
  min-height: 32px;
  padding: 6px 14px;
  background: var(--cyan);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-sm);
  transition: transform 0.1s;
}

.streak-banner-btn:active { transform: scale(0.95); }
.streak-banner-btn:disabled { opacity: 0.4; background: var(--bg-3); color: var(--text-3); }

/* Streak calendar (compact) */
.streak-cal {
  display: flex;
  gap: 6px;
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
}

.streak-cal-day {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-3);
  transition: all 0.2s;
}

.streak-cal-day.claimed {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--text-inverse);
}

.streak-cal-day.current {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

/* === RECENT ACTIVITY === */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.activity-item:last-child { border-bottom: none; }
.activity-item:active { background: rgba(255,255,255,0.02); }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-icon--win { background: rgba(52, 211, 153, 0.12); color: var(--success); }
.activity-icon--loss { background: rgba(248, 113, 113, 0.12); color: var(--error); }
.activity-icon--draw { background: rgba(139, 157, 183, 0.12); color: var(--text-3); }

.activity-detail { flex: 1; min-width: 0; }
.activity-opponent { font-size: 13px; font-weight: 600; }
.activity-meta { font-size: 11px; color: var(--text-3); }
.activity-result { font-size: 12px; font-weight: 700; }
.activity-elo { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }

/* === SECTION HEADERS === */
.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.sec-title {
  font-size: 15px;
  font-weight: 700;
}

.sec-link {
  font-size: 12px;
  color: var(--cyan);
  font-weight: 500;
}

/* === LIVE FRIENDS (social proof) === */
.friends-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-2) 0;
  scrollbar-width: none;
}

.friends-strip::-webkit-scrollbar { display: none; }

.friend-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px 6px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.friend-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-3);
  position: relative;
}

.friend-chip-online {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}

/* === TOAST === */
.toast-wrap {
  position: fixed;
  top: calc(var(--header-h) + var(--sp-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-enter 0.25s var(--ease);
  pointer-events: auto;
}

.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--error); }

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === LOBBY (Play page) === */
.lobby { display: flex; flex-direction: column; gap: var(--sp-4); }

.lobby-hero {
  border-radius: var(--r-xl);
  background: var(--bg-1);
  border: 2px solid rgba(245, 183, 49, 0.2);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.lobby-hero-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.lobby-hero-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-hero-icon .icon-lg { color: white; }

.lobby-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background 0.15s;
}

.lobby-row:hover { background: var(--bg-2); }
.lobby-row:active { background: rgba(255,255,255,0.03); }

.lobby-row-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lobby-row-text { flex: 1; }
.lobby-row-title { font-size: 14px; font-weight: 600; }
.lobby-row-sub { font-size: 12px; color: var(--text-3); }

/* === EMPTY STATE === */
.empty {
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* === SKELETON === */
.skel {
  background: var(--bg-2);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: skel-shimmer 1.5s infinite;
}

@keyframes skel-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* === UTILITIES === */
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-5 > * + * { margin-top: var(--sp-5); }
.stack-6 > * + * { margin-top: var(--sp-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.text-center { text-align: center; }
.w-full { width: 100%; }

.color-gold { color: var(--gold); }
.color-cyan { color: var(--cyan); }
.color-success { color: var(--success); }
.color-error { color: var(--error); }

/* === PAGE ENTER === */
.main {
  animation: page-in 0.25s var(--ease) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === FOCUS / A11Y === */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

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

/* === RESPONSIVE === */
@media (max-width: 380px) {
  .quick-play-grid { gap: var(--sp-2); }
  .qp-card-hero { height: 60px; }
  .hero-play { padding: var(--sp-4); }
  .streak-cal-day { width: 24px; height: 24px; font-size: 9px; }
}

/* === LEADERBOARD === */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-5) 0;
}

.lb-podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
}

.lb-podium-item--first { order: 0; }
.lb-podium-item--second { order: -1; }
.lb-podium-item--third { order: 1; }

.lb-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.lb-rank--1 { background: var(--gold); color: var(--text-inverse); }
.lb-rank--2 { background: var(--text-3); color: var(--text-inverse); }
.lb-rank--3 { background: #CD7F32; color: var(--text-inverse); }

.lb-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.lb-list-item:last-child { border-bottom: none; }

.lb-list-rank {
  width: 28px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-align: center;
}

.lb-list-name { flex: 1; font-size: 14px; font-weight: 600; }
.lb-list-elo { font-size: 14px; font-weight: 700; font-family: var(--font-mono); }

/* === PROFILE === */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.04) 0%, transparent 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
}

.profile-ratings {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  justify-content: center;
}

.profile-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-rating-val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.profile-rating-lbl {
  font-size: 11px;
  color: var(--text-3);
}

/* === SHOP === */
.shop-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.shop-item-preview {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-item-info { flex: 1; min-width: 0; }
.shop-item-name { font-size: 14px; font-weight: 600; }
.shop-item-rarity { font-size: 11px; }

/* === LOGIN === */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--sp-5);
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-brand {
  font-weight: 800;
  font-size: 36px;
  color: var(--gold);
  text-align: center;
  letter-spacing: -1px;
  margin-bottom: var(--sp-2);
}

.auth-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: var(--sp-6);
}

.auth-error {
  padding: var(--sp-3);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--r-md);
  color: var(--error);
  font-size: 13px;
  text-align: center;
  margin-top: var(--sp-4);
}

.auth-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: var(--sp-5);
}

.auth-footer a { color: var(--cyan); font-weight: 500; }
