/* ==========================================================================
   EsportsXBD — Clean White Mode Responsive Design System
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --bg: #f6f6fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f1eff9;
  --surface-hover: #faf9fe;
  --header-bg: rgba(255, 255, 255, 0.94);
  --dock-bg: rgba(255, 255, 255, 0.96);

  --text: #110d20;
  --text-secondary: #433c5c;
  --text-muted: #6c6487;

  --primary: #7c3aed;
  --primary-strong: #6d28d9;
  --primary-soft: rgba(124, 58, 237, 0.1);
  --primary-glow: rgba(124, 58, 237, 0.22);
  --accent: #4f46e5;

  --border: rgba(17, 13, 32, 0.09);
  --border-strong: rgba(124, 58, 237, 0.24);
  --border-hover: rgba(124, 58, 237, 0.44);

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);

  --shadow-sm: 0 1px 2px rgba(17, 13, 32, 0.05);
  --shadow-card: 0 8px 26px -6px rgba(17, 13, 32, 0.07), 0 1px 3px rgba(17, 13, 32, 0.04);
  --shadow-hover: 0 16px 36px -10px rgba(109, 40, 217, 0.18), 0 4px 12px rgba(17, 13, 32, 0.05);
  --shadow-modal: 0 24px 60px rgba(17, 13, 32, 0.22);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --header-h: 68px;
  --mobile-dock-h: 66px;
  --container-max: 1220px;

  --transition-fast: 160ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-med: 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, h4, .brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

::selection {
  background: rgba(124, 58, 237, 0.2);
  color: var(--text);
}

@media (min-width: 769px) {
  ::-webkit-scrollbar {
    width: 7px;
    height: 7px;
  }
  ::-webkit-scrollbar-track {
    background: var(--bg);
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.28);
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.55);
  }
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* -------------------- TOP HEADER (CLEAN WHITE, NO NAV BOX) -------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  /* Crisp subtle drop shadow so white wings & purple facets stand out cleanly on white */
  filter: drop-shadow(0 2px 5px rgba(79, 29, 149, 0.35));
}

.brand-logo.small {
  width: 34px;
  height: 34px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
}

.brand-accent {
  color: var(--primary);
}

.brand-sub {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Desktop Navigation — NO outer pill/grey container behind items */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}

.nav-link:not(.active) .nav-badge {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Header Right Utility */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 0.84rem;
  font-weight: 600;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.wallet-chip:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.wallet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.45);
}

.wallet-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.wallet-amount {
  color: var(--text);
  font-weight: 700;
}

/* -------------------- MAIN LAYOUT & VIEWS -------------------- */
.main-content {
  padding: 24px 0 56px;
}

.view[hidden] {
  display: none;
}

.view.active {
  display: block;
  animation: viewFadeIn 220ms ease-out;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------- BUTTONS -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px var(--primary-glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.btn-poster-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
}

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

.btn-ghost {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-ghost:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* -------------------- HERO POSTER BANNER -------------------- */
.hero-poster {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 360px;
  box-shadow: var(--shadow-hover);
  border: 1px solid var(--border-strong);
  background: #140b29;
}

.hero-poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
}

.hero-poster-overlay {
  position: relative;
  z-index: 2;
  min-height: 360px;
  padding: 34px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(
    95deg,
    rgba(13, 8, 28, 0.92) 0%,
    rgba(17, 11, 36, 0.72) 48%,
    rgba(17, 11, 36, 0.26) 100%
  );
}

.hero-poster-content {
  max-width: 560px;
  color: #ffffff;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.28);
  border: 1px solid rgba(196, 181, 253, 0.35);
  color: #ede9fe;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-title {
  font-size: clamp(1.8rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
  color: #ffffff;
}

.hero-desc {
  color: rgba(243, 240, 255, 0.86);
  font-size: 0.96rem;
  margin-bottom: 20px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-poster-highlight {
  flex-shrink: 0;
  width: 280px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
}

.hero-hl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.hero-hl-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.hero-hl-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-hl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* -------------------- STATS STRIP -------------------- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 28px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
}

.stat-pill-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-pill-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

/* -------------------- MODE POSTERS GRID (BELOW HERO) -------------------- */
.section-head-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-heading {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
}

.mode-posters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.mode-poster-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 16 / 9.5;
  background: #140d26;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med);
}

.mode-poster-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.mode-poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mode-poster-card:hover .mode-poster-img {
  transform: scale(1.045);
}

.mode-poster-scrim {
  position: relative;
  z-index: 2;
  padding: 22px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(
    to top,
    rgba(11, 7, 22, 0.94) 0%,
    rgba(11, 7, 22, 0.56) 52%,
    rgba(11, 7, 22, 0.16) 100%
  );
  color: #ffffff;
}

.mode-poster-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-count-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
}

.mode-prize-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.88);
  color: #ffffff;
}

.mode-poster-title {
  font-size: clamp(1.22rem, 2vw, 1.55rem);
  font-weight: 800;
  margin-bottom: 4px;
}

.mode-poster-sub {
  font-size: 0.86rem;
  color: rgba(243, 240, 255, 0.84);
  margin-bottom: 10px;
}

.mode-poster-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #ddd6fe;
}

.mode-poster-cta svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.mode-poster-card:hover .mode-poster-cta svg {
  transform: translateX(4px);
}

/* -------------------- MODE DRILL-DOWN MATCHES VIEW -------------------- */
.mode-drill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mode-banner-compact {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 140px;
  margin-bottom: 18px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-end;
  background: #140b29;
}

.mode-banner-compact img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mode-banner-compact-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 20px 24px;
  background: linear-gradient(95deg, rgba(12, 7, 24, 0.92) 0%, rgba(12, 7, 24, 0.55) 100%);
  color: #ffffff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-banner-compact-inner h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.mode-banner-compact-inner p {
  font-size: 0.88rem;
  color: rgba(243, 240, 255, 0.84);
}

/* -------------------- TOOLBAR & FILTERS -------------------- */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.filter-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.search-box {
  position: relative;
  min-width: 240px;
  flex: 0 1 290px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* -------------------- TOURNAMENT GRID & CARDS -------------------- */
.tournament-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.t-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-med), border-color var(--transition-med), box-shadow var(--transition-med);
}

.t-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.t-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.t-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-mode {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-map {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-status-open {
  background: var(--success-soft);
  color: var(--success);
}

.badge-status-soon {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-status-full {
  background: var(--danger-soft);
  color: var(--danger);
}

.t-title {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.t-schedule {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.t-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.t-metric span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.t-metric strong {
  font-size: 0.92rem;
  color: var(--text);
}

.t-metric strong.prize {
  color: var(--primary);
}

.slot-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.slot-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}

.slot-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transition: width 320ms ease;
}

.slot-fill.nearly-full {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.t-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: auto;
}

/* -------------------- HOW IT WORKS STRIP -------------------- */
.arena-info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.info-tile {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.info-step {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.info-tile h3 {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.info-tile p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* -------------------- VIEW HEADERS & CONTROLS -------------------- */
.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.view-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.view-title {
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 800;
}

.toolbar-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.seg-btn {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.select-input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
}

/* -------------------- SHARED SURFACE CARD -------------------- */
.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-subtitle {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.muted-text {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* -------------------- MY MATCHES VIEW -------------------- */
.matches-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.match-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.match-room-box {
  padding: 13px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px dashed var(--border-strong);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.room-cred {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
}

.room-cred span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.room-cred strong {
  font-size: 0.9rem;
}

.copy-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}

.copy-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.match-roster-line {
  font-size: 0.84rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* -------------------- TOP PLAYERS VIEW -------------------- */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.podium-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.podium-card.rank-1 {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.podium-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rank-medal {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.rank-1 .rank-medal {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.rank-2 .rank-medal {
  background: rgba(148, 163, 184, 0.22);
  color: var(--text);
}

.rank-3 .rank-medal {
  background: rgba(180, 83, 9, 0.22);
  color: #b45309;
}

.podium-player {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.podium-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.podium-stats span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.podium-stats strong {
  font-size: 0.92rem;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
}

.data-table th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-subtle);
  font-weight: 700;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.player-cell {
  display: flex;
  flex-direction: column;
}

.player-cell strong {
  font-weight: 700;
}

.player-cell span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* -------------------- RESULTS VIEW -------------------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-winners {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.winner-box {
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.winner-box.first {
  border-color: var(--border-strong);
  background: var(--primary-soft);
}

.winner-box span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.winner-box strong {
  display: block;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winner-box em {
  font-style: normal;
  font-size: 0.76rem;
  color: var(--primary);
  font-weight: 600;
}

.result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* -------------------- PROFILE VIEW -------------------- */
.profile-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.profile-sidebar,
.profile-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-hero-card {
  padding: 0;
  overflow: hidden;
}

.profile-banner {
  height: 82px;
  background: linear-gradient(135deg, #2e1065 0%, var(--primary) 60%, var(--accent) 100%);
}

.profile-identity {
  padding: 0 20px 18px;
  margin-top: -32px;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid var(--border-strong);
  padding: 8px;
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(79, 29, 149, 0.35));
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-ign {
  font-size: 1.28rem;
  font-weight: 800;
}

.verified-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
}

.profile-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 10px;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.profile-quick-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--border);
}

.profile-quick-stats > div {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.profile-quick-stats > div:nth-child(2n) {
  border-right: none;
}

.profile-quick-stats > div:nth-last-child(-n+2) {
  border-bottom: none;
}

.q-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.q-val {
  font-size: 1.08rem;
  font-weight: 700;
}

.accent-val {
  color: var(--primary);
}

/* Wallet Card */
.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wallet-balance-lg {
  font-size: 2rem;
  font-weight: 700;
  margin: 2px 0 4px;
}

.wallet-btn-group {
  display: flex;
  gap: 10px;
}

.wallet-methods {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.method-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-field input,
.form-field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.full-span {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* Transactions */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.tx-row strong {
  display: block;
  font-size: 0.88rem;
}

.tx-row span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.tx-amt {
  font-weight: 700;
  font-size: 0.92rem;
}

.tx-amt.plus {
  color: var(--success);
}

.tx-amt.minus {
  color: var(--danger);
}

/* -------------------- EMPTY STATE -------------------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 44px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
}

.empty-state h3 {
  font-size: 1.12rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* -------------------- FOOTER -------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-note {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* -------------------- MOBILE BOTTOM DOCK -------------------- */
.mobile-bottom-nav {
  display: none;
}

/* -------------------- MODAL -------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 10, 28, 0.56);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  animation: modalPop 180ms ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 2;
}

.modal-title {
  font-size: 1.12rem;
  font-weight: 700;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--surface-subtle);
}

.modal-close:hover {
  color: var(--text);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.modal-stat {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.modal-stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-stat strong {
  font-size: 0.96rem;
}

.rules-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* -------------------- TOAST NOTIFICATIONS -------------------- */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastIn 200ms ease-out;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.toast.success .toast-dot {
  background: var(--success);
}

.toast.error .toast-dot {
  background: var(--danger);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1080px) {
  .tournament-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-layout {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 900px) {
  .desktop-nav {
    display: none;
  }

  .hero-poster-overlay {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    background: linear-gradient(
      180deg,
      rgba(13, 8, 28, 0.56) 0%,
      rgba(13, 8, 28, 0.9) 62%,
      rgba(13, 8, 28, 0.96) 100%
    );
  }

  .hero-poster-highlight {
    width: 100%;
  }

  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .podium-grid,
  .arena-info-strip {
    grid-template-columns: 1fr;
  }

  .matches-list,
  .results-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: calc(var(--mobile-dock-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px env(safe-area-inset-bottom, 0px);
    background: var(--dock-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-strong);
    box-shadow: 0 -8px 28px rgba(17, 13, 32, 0.08);
  }

  .mobile-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 10px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
  }

  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .mobile-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    display: grid;
    place-items: center;
  }

  .main-content {
    padding-bottom: calc(var(--mobile-dock-h) + 32px + env(safe-area-inset-bottom, 0px));
  }

  .site-footer {
    padding-bottom: calc(var(--mobile-dock-h) + 24px + env(safe-area-inset-bottom, 0px));
  }

  .toast-container {
    bottom: calc(var(--mobile-dock-h) + 14px + env(safe-area-inset-bottom, 0px));
    left: 14px;
    right: 14px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-sub,
  .wallet-label {
    display: none;
  }

  .mode-posters-grid,
  .tournament-grid,
  .form-grid,
  .match-room-box,
  .result-winners {
    grid-template-columns: 1fr;
  }

  .mode-poster-card {
    aspect-ratio: 16 / 10;
  }

  .hero-poster-overlay {
    padding: 18px;
  }

  .search-box {
    flex: 1 1 100%;
    min-width: 0;
  }

  .hero-cta-row .btn {
    flex: 1 1 auto;
  }

  .modal-summary-grid {
    grid-template-columns: 1fr;
  }
}
