/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 500;
  justify-content: center;
}

/* user-badge removed for a cleaner top bar */

.tab-item {
  color: #ccc;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.tab-item.active {
  background: #F59E0B;
  color: #000;
  font-weight: 700;
}

/* Ensure modals stylesheet is served and loaded; entry is via routes.rs */

/* Page container */
.page {
  padding: 16px;
}

.page .page-container {
  max-width: min(1280px, 94vw);
  margin: 0 auto;
}

/* Allow the stats page to escape the inner width cap for full-bleed sections */
/* Make leaderboard behave like stats hero: centered with responsive max width */
.stats-page .leaderboard-section {
  background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(124,58,237,0.12) 100%);
  border-color: rgba(245,158,11,0.3);
  margin-bottom: 12px; /* spacing below leaderboard */
}

.stats-page .leaderboard-section,
.stats-page .stats-hero {
  width: clamp(320px, 60vw, 1000px);
  margin-left: auto !important;
  margin-right: auto !important;
  left: 50%;
  transform: translateX(-50%);
  position: relative;
  display: block;
}

@media (min-width: 1200px) {
  .stats-page .leaderboard-section,
  .stats-page .stats-hero {
    width: clamp(480px, 52vw, 1100px);
  }
}

/* Narrow screens: use full container width and remove transform offset */
@media (max-width: 720px) {
  .stats-page .leaderboard-section,
  .stats-page .stats-hero {
    width: 100%;
    left: 0;
    transform: none;
  }
}

/* Add spacing above Global Statistics */
.stats-page .stats-hero { margin-top: 12px; }

.page-title {
  margin: 6px 0 16px 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .2px;
}

/* Allow the account page to breathe more on large displays */
.account-page {
  max-width: min(1400px, 96vw);
}

/* Allow specific sections to escape the inner width cap */
.account-page .full-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

@media (min-width: 1200px) {
  /* Re-center the 60vw full-bleed block so it sits nicely in the viewport */
  .account-page .full-bleed {
    width: 60vw;
    margin-left: calc(50% - 30vw);
    margin-right: calc(50% - 30vw);
  }
}

/* Auth page tweaks using existing auth styles */
.auth-page .auth-forms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.auth-page .profile .profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.auth-page .profile .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00ff88;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

/* Account page modern styles */
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.help-page .help-header { text-align: center; margin-bottom: 16px; }
.help-page .game-intro { color:#9CA3AF; margin-top:6px; }
.help-page .help-section.card { margin-bottom: 12px; }
.help-page .section-title { margin: 0 0 8px 0; font-weight: 800; }
.help-page .mechanics-list, .help-page .tips-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; }
.help-page .abilities-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; }
.help-page .mechanic-item, .help-page .tip-card, .help-page .ability-card { background: rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); border-radius:10px; padding:10px; }
.help-page .rule-group { background: rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08); border-radius:10px; padding:10px; }
.help-page .rule-list { margin: 8px 0 0 16px; }
.help-page .mechanic-title, .help-page .tip-title, .help-page .ability-name, .help-page .rule-title { margin:0 0 6px 0; font-weight:800; }
.help-page .mechanic-desc, .help-page .tip-desc, .help-page .ability-desc { color:#cbd5e1; font-size: 0.95rem; }

@media (max-width: 900px) {
  .help-page .mechanics-list, .help-page .tips-grid, .help-page .abilities-grid { grid-template-columns: 1fr; }
}
.stats-hero.gradient { background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(124,58,237,0.12)); }
.stats-hero .stats-tiles { display:flex; flex-wrap:wrap; gap:12px; justify-content:center; }
.stats-hero .tile { min-width:140px; padding:16px; border-radius:12px; border:1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); text-align:center; }
.stats-hero .tile.accent { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.25); }
.stats-hero .label { font-size:12px; opacity:.8; }
.stats-hero .value { font-size:22px; font-weight:800; }
/* Center content inside tiles */
.stats-hero .tile .tile-content { display:flex; flex-direction:column; align-items:center; }
.stats-hero .tile .tile-icon { font-size:18px; margin-bottom:6px; }

.lb-tabs { display:flex; gap:8px; margin-bottom:10px; }
.lb-tab { background: rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:#fff; padding:6px 10px; border-radius:8px; cursor:pointer; font-size:12px; }
.lb-tab.active { background:#F59E0B; color:#000; border-color:transparent; font-weight:800; }
.lb-table-wrap { width:100%; overflow-x:auto; }
.lb-table { width:100%; min-width:860px; border-collapse:separate; border-spacing:0; }
.lb-table thead th { position: sticky; top: 0; z-index: 1; background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)); text-transform:uppercase; font-size:12px; color:#9CA3AF; letter-spacing:.06em; padding:14px 16px; backdrop-filter: blur(6px); }
.lb-table th, .lb-table td { text-align: center; vertical-align: middle; }
.lb-table td { padding:14px 16px; border-top:1px solid rgba(255,255,255,0.08); }
.lb-table tbody tr { transition: transform .12s ease, background .12s ease; }
.lb-table tbody tr:hover { background: rgba(0,0,0,0.25); transform: translateY(-1px); }
.lb-table tbody tr:nth-child(odd) td { background: rgba(255,255,255,0.015); }

/* Leaderboard visual enhancements */
/* Remove emoji medals for a cleaner look */
.lb-table tr td:first-child::before { content: ''; margin-right: 0; }

.score-pill { background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(124,58,237,0.18)); border: 1px solid rgba(245,158,11,0.35); color:#f6d7a6; padding:6px 10px; border-radius: 999px; font-weight:800; box-shadow: 0 0 0 1px rgba(245,158,11,0.08) inset; }

/* Player cell enhancements */
/* Removed avatar styles to simplify player cell */
.player-cell { text-align: center !important; }
.player-cell .player-info { display: inline-flex; align-items: center; justify-content: center; gap: 2px; max-width: 100%; overflow: hidden; }
.player-cell .player-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Constrain player column on wide screens */
.lb-table .player-col { width: clamp(140px, 20vw, 220px); }
.lb-table td.player-cell { max-width: clamp(140px, 20vw, 220px); }

/* Narrow screen tweaks for tighter columns */
@media (max-width: 720px) {
  .lb-table thead th { padding: 8px 10px; }
  .lb-table td { padding: 8px 10px; }
  .lb-table .rank-col { width: 44px; }
  .lb-table .score-col { width: 86px; }
  .lb-table .player-col { max-width: 120px; }
  .player-cell .player-info { gap: 2px; }
}

/* Add top spacing above leaderboard table for breathing room */
.stats-page #leaderboard-section { margin-top: 16px; }
.card.subtle { background: rgba(255,255,255,0.03); }
.card.accent { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.25); }
.card.elevated { box-shadow: 0 18px 44px rgba(0,0,0,0.35); }

.account-page .section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.account-page .section-header h3 { margin: 0; }
.account-page .section-subtitle { color: #9CA3AF; font-size: 12px; }

.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.account-hero.gradient {
  background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(124,58,237,0.12) 100%);
  border-color: rgba(245,158,11,0.3);
}
.account-hero .hero-left { display: flex; align-items: center; gap: 14px; }
/* avatar removed for cleaner UI */
.account-hero .identity .username { margin: 0; }
.account-hero .subtext { opacity: 0.75; font-size: 12px; }

.quick-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.chip .chip-value { font-weight: 800; margin-left: 6px; }
.chip.accent { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.25); color: #f6d7a6; }

.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.18); color: #fff; border-radius: 10px; padding: 10px 14px; }
.btn.ghost:hover { background: rgba(255,255,255,0.08); }
/* Center the logout button on narrow screens and limit width */
@media (max-width: 720px) {
  #logout-btn { display:block; margin: 12px auto 0; width: auto; min-width: 140px; max-width: 220px; text-align:center; }
}

.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.win { background: rgba(16,185,129,0.15); color: #10B981; border: 1px solid rgba(16,185,129,0.35); }
.badge.loss { background: rgba(239,68,68,0.15); color: #EF4444; border: 1px solid rgba(239,68,68,0.35); }
.badge.draw { background: rgba(245,158,11,0.15); color: #F59E0B; border: 1px solid rgba(245,158,11,0.35); }

.pill { padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); font-size: 12px; }

@media (max-width: 720px) {
  .account-hero { flex-direction: column; align-items: flex-start; }
  .account-hero .hero-actions { width: 100%; display: flex; justify-content: flex-end; }
}

/* Horizontal scroll for history on small widths */
.history-scroll { width: 100%; }
.history-scroll::-webkit-scrollbar {
  height: 10px;
}
.history-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
}
/* Only allow horizontal scroll on narrow screens */
@media (max-width: 1024px) {
  .history-scroll { overflow-x: auto; }
}

/* Ensure the header area does not overlay the scrollable area visually */
.history-scroll { background: transparent; }

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-header .identity { flex: 1; }
.profile-header .username { margin: 0; font-weight: 800; letter-spacing: 0.2px; }
.profile-header .subtext { opacity: 0.75; font-size: 12px; }
.profile-header .actions { display: flex; gap: 8px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.stat .label { font-size: 12px; opacity: 0.8; margin-bottom: 6px; }
.stat .value { font-size: 20px; font-weight: 800; }

.btn.primary { background: #F59E0B; color: #000; border: none; border-radius: 8px; padding: 10px 14px; }
.btn.primary:hover { background: #00e07a; }

/* Play page CTA placement */
.matchmaking-host { display:flex; justify-content:center; margin: 12px 0 10px; }
.controls-large { display:flex; justify-content:center; }
.primary-cta { font-size: 1.25rem; padding: 16px 28px; border-radius: 14px; box-shadow: 0 8px 22px rgba(245,158,11,0.28); min-width: 220px; font-weight: 800; letter-spacing: .2px; }
.primary-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(245,158,11,0.35); }
.primary-cta:disabled { opacity: .6; }
.discord-section.bottom { display:flex; justify-content:center; margin-top: 14px; }
.discord-logo.large { height: 64px; }

@media (max-width: 700px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}


