/* ============================================
   PUZZ.COM — THE WORD BATTLE GAME
   Dark Theme Game Lobby Stylesheet
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --bg-darkest: #0a0a14;
  --bg-dark: #12121f;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-elevated: #252545;
  --bg-input: #16162a;
  --border: #2a2a4a;
  --border-focus: #6c63ff;

  --text-primary: #e8e8f0;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --text-bright: #ffffff;

  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --accent-glow: rgba(108, 99, 255, 0.4);
  --accent-soft: rgba(108, 99, 255, 0.15);

  --green: #4ade80;
  --green-dark: #22c55e;
  --green-soft: rgba(74, 222, 128, 0.15);

  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.15);

  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.15);

  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.15);

  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.15);

  --tile-bg: #e8dcc8;
  --tile-text: #1a1a2e;
  --tile-border: #c4b8a0;

  --nav-height: 60px;
  --sidebar-width: 280px;
  --chat-width: 320px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

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

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-darkest);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-bright); }

::selection {
  background: var(--accent);
  color: white;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

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

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

.btn-xl {
  padding: 16px 36px;
  font-size: 18px;
  border-radius: var(--radius);
}

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  font-size: 16px;
  transition: all var(--transition);
}
.btn-icon:hover {
  color: var(--text-bright);
  background: var(--bg-card-hover);
}

.btn-glow {
  box-shadow: var(--shadow-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(108,99,255,0.2); }
}

/* ---------- Navigation ---------- */
.puzz-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(18, 18, 31, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
}

.nav-left { display: flex; align-items: center; }
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}
.logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-bright);
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-center {
  display: flex;
  gap: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition);
}
.nav-link:hover {
  color: var(--text-bright);
  background: var(--bg-card);
}
.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-online-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}
.online-dot {
  color: var(--green);
  font-size: 8px;
  animation: blink-dot 2s ease-in-out infinite;
}
@keyframes blink-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* User Dropdown */
.user-dropdown { position: relative; }
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition);
}
.user-avatar-btn:hover { border-color: var(--accent); }

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1001;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  transition: background var(--transition);
}
.dropdown-menu a:hover {
  background: var(--bg-card-hover);
  color: var(--text-bright);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- Main Content ---------- */
.puzz-main {
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
  padding-bottom: 80px;
}

.page { display: none; }
.page.active { display: block; }

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
}
.section-title {
  font-size: 28px;
  margin-bottom: 32px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.section-title i {
  color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  padding: 60px 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.15) 0%, transparent 70%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(108,99,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 640px;
  text-align: center;
  z-index: 1;
}

.hero-title {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-bright) 0%, var(--accent) 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Floating tile animation */
.floating-tile {
  position: absolute;
  width: 48px;
  height: 48px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: var(--tile-text);
  opacity: 0.12;
  animation: float-tile linear infinite;
}
.floating-tile .tile-points {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 700;
}

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

/* ---------- Game Mode Cards ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition);
}
.mode-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.mode-card:hover::before {
  transform: scaleX(1);
}

.mode-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 16px;
}
.mode-icon.ranked { background: var(--gold-soft); color: var(--gold); }
.mode-icon.friends { background: var(--green-soft); color: var(--green); }
.mode-icon.tournament { background: var(--orange-soft); color: var(--orange); }
.mode-icon.speed { background: var(--red-soft); color: var(--red); }
.mode-icon.ai { background: var(--blue-soft); color: var(--blue); }

.mode-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}
.mode-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.mode-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.mode-meta i { margin-right: 4px; }

.mode-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-popular {
  background: var(--green-soft);
  color: var(--green);
}
.badge-competitive {
  background: var(--gold-soft);
  color: var(--gold);
}
.badge-premium {
  background: var(--orange-soft);
  color: var(--orange);
}

/* ---------- Daily Challenge ---------- */
.daily-challenge-card {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.daily-info { flex: 1; }
.daily-info h3 { margin-bottom: 8px; }
.daily-info p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.daily-leaderboard { flex: 1; }
.daily-leaderboard h4 { margin-bottom: 12px; color: var(--text-secondary); font-size: 14px; }

.daily-rack, .daily-rack-large {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.daily-rack .tile, .daily-rack-large .tile {
  width: 44px;
  height: 44px;
  background: var(--tile-bg);
  border: 2px solid var(--tile-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: var(--tile-text);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.daily-rack-large .tile {
  width: 56px;
  height: 56px;
  font-size: 26px;
}

.daily-header { text-align: center; padding: 48px 24px 24px; }
.daily-desc { color: var(--text-secondary); font-size: 16px; margin-top: 8px; }
.daily-main { text-align: center; padding: 24px; }
.daily-rack-large { justify-content: center; margin-bottom: 24px; }
.daily-countdown {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 14px;
}
#daily-timer {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.daily-scores-table {
  max-width: 700px;
  margin: 32px auto;
  padding: 0 24px;
}
.daily-scores-table h3 {
  margin-bottom: 16px;
}

.mini-leaderboard { display: flex; flex-direction: column; gap: 8px; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-dark);
  border-radius: var(--radius-xs);
  font-size: 14px;
}
.mini-row.skeleton {
  height: 36px;
  background: linear-gradient(90deg, var(--bg-dark) 25%, var(--bg-elevated) 50%, var(--bg-dark) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Features ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: all var(--transition);
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.feature-card i {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 16px;
}
.feature-card h4 {
  margin-bottom: 8px;
  font-size: 16px;
}
.feature-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 960px;
  margin: 0 auto;
}
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  position: relative;
  transition: all var(--transition);
}
.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: scale(1.04);
}
.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.pricing-tier {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.pricing-price {
  font-size: 40px;
  font-weight: 800;
  color: var(--text-bright);
  margin-bottom: 24px;
}
.pricing-price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-secondary);
}
.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}
.pricing-features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pricing-features li i { font-size: 12px; }
.pricing-features li .fa-check { color: var(--green); }
.pricing-features li .fa-times { color: var(--text-muted); }
.pricing-features li.disabled { color: var(--text-muted); }

/* ---------- Rooms Page ---------- */
.rooms-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 16px;
}
.rooms-header h2 {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rooms-header h2 i { color: var(--accent); }
.rooms-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  flex: 1;
  min-width: 200px;
}
.search-box i { color: var(--text-muted); font-size: 14px; }
.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 10px 8px;
  font-size: 14px;
  width: 100%;
  outline: none;
  font-family: inherit;
}

select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}
select:focus { border-color: var(--accent); }

.rooms-list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: grid;
  gap: 12px;
}

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.room-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.room-mode-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.room-mode-icon.classic { background: var(--accent-soft); color: var(--accent); }
.room-mode-icon.speed { background: var(--red-soft); color: var(--red); }
.room-mode-icon.team { background: var(--green-soft); color: var(--green); }

.room-info { flex: 1; }
.room-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}
.room-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}
.room-meta span { display: flex; align-items: center; gap: 4px; }

.room-players {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.room-player-count {
  font-size: 14px;
  color: var(--text-secondary);
}
.room-player-dots {
  display: flex;
  gap: 4px;
}
.room-player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.room-player-dot.filled { background: var(--green); }

.room-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.room-status.waiting {
  background: var(--green-soft);
  color: var(--green);
}
.room-status.playing {
  background: var(--blue-soft);
  color: var(--blue);
}
.room-status.full {
  background: var(--red-soft);
  color: var(--red);
}

.room-join-btn {
  padding: 8px 20px;
  flex-shrink: 0;
}

.rooms-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  display: none;
}
.rooms-empty.visible { display: block; }
.rooms-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.rooms-empty h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ---------- Leaderboard ---------- */
.leaderboard-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 0;
  text-align: center;
}
.leaderboard-header h2 {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.leaderboard-header h2 i { color: var(--gold); }

.leaderboard-tabs {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 32px;
}
.tab-btn {
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.tab-btn:hover {
  color: var(--text-bright);
  border-color: var(--text-secondary);
}
.tab-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto 40px;
  padding: 0 24px;
}
.podium-slot {
  text-align: center;
  flex: 1;
}
.podium-crown {
  font-size: 28px;
  color: var(--gold);
  margin-bottom: 8px;
  animation: crown-float 3s ease-in-out infinite;
}
@keyframes crown-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.podium-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin: 0 auto 8px;
}
.first .podium-avatar {
  width: 72px;
  height: 72px;
  border-color: var(--gold);
  font-size: 24px;
  background: var(--gold-soft);
  color: var(--gold);
}
.second .podium-avatar {
  border-color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}
.third .podium-avatar {
  border-color: #cd7f32;
  background: rgba(205, 127, 50, 0.1);
  color: #cd7f32;
}
.podium-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.podium-elo {
  font-size: 12px;
  color: var(--text-muted);
}
.podium-bar {
  margin-top: 12px;
  border-radius: 6px 6px 0 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
}
.first .podium-bar { height: 100px; background: linear-gradient(180deg, var(--gold-soft), var(--bg-card)); border-color: var(--gold); }
.second .podium-bar { height: 70px; }
.third .podium-bar { height: 50px; }

.leaderboard-table-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
}
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}
.leaderboard-table tbody tr {
  transition: background var(--transition);
}
.leaderboard-table tbody tr:hover {
  background: var(--bg-card);
}
.rank-col { width: 50px; text-align: center; }
.player-col { min-width: 200px; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}
.rank-1 { background: var(--gold-soft); color: var(--gold); }
.rank-2 { background: rgba(148,163,184,0.15); color: #94a3b8; }
.rank-3 { background: rgba(205,127,50,0.15); color: #cd7f32; }

.player-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-cell .avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}
.player-cell .player-name {
  font-weight: 600;
}
.player-cell .player-tier {
  font-size: 11px;
  color: var(--text-muted);
}

.elo-cell {
  font-weight: 700;
  color: var(--accent);
}

.streak-positive { color: var(--green); }
.streak-negative { color: var(--red); }

/* ---------- Profile Page ---------- */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}
.profile-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 32px;
}
.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0 auto 16px;
}
.profile-info h2 { margin-bottom: 4px; }
.profile-tier {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
}
.profile-joined { font-size: 13px; color: var(--text-muted); }
.profile-stats-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.history-result {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.history-result.win { background: var(--green-soft); color: var(--green); }
.history-result.loss { background: var(--red-soft); color: var(--red); }
.history-result.draw { background: var(--blue-soft); color: var(--blue); }
.history-info { flex: 1; }
.history-opponent { font-weight: 600; font-size: 14px; }
.history-details { font-size: 12px; color: var(--text-muted); }
.history-score { font-weight: 700; font-size: 16px; }

/* ---------- Friends Sidebar ---------- */
.friends-sidebar {
  position: fixed;
  top: var(--nav-height);
  right: -var(--sidebar-width);
  width: var(--sidebar-width);
  height: calc(100vh - var(--nav-height));
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
  z-index: 900;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
}
.friends-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friend-search {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.friend-search input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.friend-search input:focus { border-color: var(--accent); }

.friend-sections {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.friend-section {
  margin-bottom: 20px;
}
.friend-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.friend-list { display: flex; flex-direction: column; gap: 4px; }

.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--transition);
}
.friend-item:hover { background: var(--bg-card); }

.friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.friend-avatar .status-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
}
.status-indicator.online { background: var(--green); }
.status-indicator.offline { background: var(--text-muted); }

.friend-name {
  font-size: 13px;
  font-weight: 500;
}
.friend-status {
  font-size: 11px;
  color: var(--text-muted);
}

.friend-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.friends-toggle-btn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  z-index: 899;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.friends-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}
.friend-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Chat Panel ---------- */
.chat-panel {
  position: fixed;
  bottom: 0;
  right: 340px;
  width: var(--chat-width);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 800;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 400px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  user-select: none;
}
.chat-header span {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header span i { color: var(--accent); }

.chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.chat-body.minimized {
  display: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}
.chat-msg.system {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  font-size: 12px;
}
.chat-msg .chat-author {
  font-weight: 600;
  color: var(--accent);
  margin-right: 6px;
}
.chat-msg .chat-text {
  color: var(--text-primary);
}
.chat-msg .chat-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.chat-input-area input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.chat-input-area input:focus { border-color: var(--accent); }

/* ---------- Matchmaking Overlay ---------- */
.matchmaking-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.matchmaking-card h3 { margin-bottom: 8px; font-size: 22px; }
.matchmaking-status {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}
.matchmaking-timer {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}
.matchmaking-info {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.matchmaking-spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  position: relative;
}
.spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}
.spinner-inner {
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  position: relative;
  animation: modal-slide 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 560px; }

@keyframes modal-slide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-bright); }

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.modal-header h2 {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.modal-header h2 i { color: var(--accent); }
.modal-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.modal-form { display: flex; flex-direction: column; gap: 16px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-icon {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--transition);
}
.input-icon:focus-within { border-color: var(--accent); }
.input-icon i { color: var(--text-muted); font-size: 14px; }
.input-icon input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 12px 8px;
  font-size: 14px;
  width: 100%;
  outline: none;
  font-family: inherit;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.form-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
}

.form-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.password-strength {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.password-strength .strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition), background var(--transition);
}

.copy-link-box {
  display: flex;
  gap: 8px;
}
.copy-link-box input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13px;
  font-family: monospace;
}

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

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 12px);
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  min-width: 280px;
  max-width: 400px;
  font-size: 14px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.success i { color: var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.error i { color: var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.info i { color: var(--blue); }
.toast.warning { border-left: 3px solid var(--gold); }
.toast.warning i { color: var(--gold); }

.toast-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ---------- Ad Containers ---------- */
.ad-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  text-align: center;
}
.ad-container ins { min-height: 90px; }

.ad-sidebar {
  position: fixed;
  top: calc(var(--nav-height) + 20px);
  right: 0;
  width: 160px;
  z-index: 100;
}

/* ---------- Footer ---------- */
.puzz-footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand .logo-text {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}
.footer-brand p {
  color: var(--text-secondary);
  font-size: 14px;
}
.footer-copy {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-bright);
}
.footer-links a {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 4px 0;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .ad-sidebar { display: none; }
}

@media (max-width: 768px) {
  .puzz-nav { padding: 0 12px; }
  .nav-center { display: none; }

  .hero { padding: 40px 16px; min-height: auto; }
  .hero-title { font-size: 32px; }
  .hero-subtitle { font-size: 15px; }
  .hero-stats { gap: 24px; }
  .hero-actions { flex-direction: column; align-items: center; }

  .section { padding: 32px 16px; }
  .mode-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }

  .daily-challenge-card { flex-direction: column; }

  .rooms-controls { flex-direction: column; }
  .search-box { min-width: 100%; }
  .room-card { flex-wrap: wrap; }
  .room-meta { flex-wrap: wrap; }

  .form-row { grid-template-columns: 1fr; }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .chat-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }

  .friends-sidebar { width: 100%; }

  .podium { gap: 8px; }
}

@media (max-width: 480px) {
  .footer-content { grid-template-columns: 1fr; }
  .nav-right .btn { padding: 8px 12px; font-size: 12px; }
  .nav-online-count { display: none; }
}

/* ---------- Utility ---------- */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-blue { color: var(--blue); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
