/* ==========================================================================
   DESIGN SYSTEM & CSS VARIABLES
   ========================================================================== */
:root {
  --primary: #384a95;
  --primary-dark: #263366;
  --primary-deeper: #1a2347;
  --primary-light: #4e63bd;
  --primary-subtle: #edf1fa;
  --accent: #ffb800;
  --bg-body: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-main: #1a202c;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --finish-spin: #0284c7;
  --finish-burst: #ea580c;
  --finish-ko: #7c3aed;
  --finish-extreme: #dc2626;

  --status-eligible: #10b981;
  --status-ineligible: #ef4444;
  --status-pending: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(56, 74, 149, 0.08);
  --shadow-lg: 0 12px 28px -4px rgba(56, 74, 149, 0.16);

  --header-height: 68px;
  --bottom-nav-height: 64px;
  --font-family: "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-weight: 500;
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
  text-rendering: optimizeSpeed;
  overflow-x: hidden;
  width: 100%;
}

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-family);
  font-weight: 700;
  color: var(--primary-deeper);
  line-height: 1.25;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

.container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-ineligible {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-ineligible);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.finish-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  display: inline-block;
}
.finish-spin {
  background-color: var(--finish-spin);
}
.finish-burst {
  background-color: var(--finish-burst);
}
.finish-ko {
  background-color: var(--finish-ko);
}
.finish-extreme {
  background-color: var(--finish-extreme);
}

/* ==========================================================================
   QUALIFIER PODIUM MEDALS (GOLD, SILVER, BRONZE)
   ========================================================================== */
.medal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Swiss King 👑 Royal Purple/Gold Medal */
.medal-swiss-king {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(245, 158, 11, 0.25) 100%);
  color: #6b21a8;
  border: 1.5px solid #a855f7;
  box-shadow: 0 1px 4px rgba(168, 85, 247, 0.2);
}

[data-theme="dark"] .medal-swiss-king {
  background: rgba(168, 85, 247, 0.2);
  color: #e9d5ff;
  border-color: #c084fc;
}

.modal-q-item.has-swiss-king {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
}

.medal-gold {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 184, 0, 0.4) 100%);
  color: #92400e;
  border: 1.5px solid #f59e0b;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.25);
}

.medal-silver {
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.7) 0%, rgba(203, 213, 225, 0.8) 100%);
  color: #1e293b;
  border: 1.5px solid #94a3b8;
  box-shadow: 0 1px 4px rgba(148, 163, 184, 0.2);
}

.medal-bronze {
  background: linear-gradient(135deg, rgba(254, 215, 170, 0.45) 0%, rgba(251, 146, 60, 0.3) 100%);
  color: #9a3412;
  border: 1.5px solid #ea580c;
  box-shadow: 0 1px 4px rgba(234, 88, 12, 0.2);
}

.medal-none {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

[data-theme="dark"] .medal-gold {
  background: rgba(255, 215, 0, 0.18);
  color: #fde047;
  border-color: #eab308;
}

[data-theme="dark"] .medal-silver {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border-color: #94a3b8;
}

[data-theme="dark"] .medal-bronze {
  background: rgba(234, 88, 12, 0.2);
  color: #fdba74;
  border-color: #f97316;
}

[data-theme="dark"] .medal-none {
  background: var(--primary-dark);
  color: var(--primary-deeper);
  border: 1.5px solid var(--primary-deeper);
}

/* Medals Row in Team Card */
.team-card-medals-row {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  flex-wrap: nowrap;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  cursor: grab;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.team-card-medals-row:active {
  cursor: grabbing;
}

.team-card-medals-row::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.team-card-medals-row .medal-badge {
  flex-shrink: 0;
}

.no-medals-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px dashed var(--border-color);
  background: var(--bg-body);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* 5-Column Qualifier Scores Strip in Team Card */
.team-qualifiers-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  text-align: center;
}

.team-q-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.team-q-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
}

.team-q-val {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-deeper);
}

.team-q-medal-icon {
  font-size: 0.72rem;
  line-height: 1;
}

/* ==========================================================================
   FULLSCREEN PRELOADER
   ========================================================================== */
.app-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #263366 0%, #1a2347 50%, #0d1224 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  padding: 2rem;
  text-align: center;
  transition:
    opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.45s ease;
}

.app-preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo-loader-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 2rem;
  display: block;
}

.loader-ambient-glow {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 184, 0, 0.35) 0%, rgba(78, 99, 189, 0.25) 50%, transparent 70%);
  filter: blur(20px);
  animation: ambientBreath 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ambientBreath {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

.loader-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 184, 0, 0.4);
  opacity: 0;
  animation: radarRipple 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
  pointer-events: none;
}

.loader-pulse-ring.ring-2 {
  animation-delay: 1.3s;
}

@keyframes radarRipple {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  70% {
    opacity: 0.3;
  }
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}

.loader-track-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 184, 0, 0.5);
  animation: spinReverse 9s linear infinite;
  pointer-events: none;
}

@keyframes spinReverse {
  100% {
    transform: rotate(-360deg);
  }
}

.loader-spinner-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, transparent 50%, rgba(78, 99, 189, 0.4) 75%, #4e63bd 88%, #ffb800 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
  filter: drop-shadow(0 0 10px #ffb800) drop-shadow(0 0 18px rgba(78, 99, 189, 0.8));
  animation: spinForward 1.25s linear infinite;
}

@keyframes spinForward {
  100% {
    transform: rotate(360deg);
  }
}

.loader-logo-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  overflow: hidden;
}

.loader-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  margin: auto;
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,
  100% {
    transform: scale(0.96);
  }
  50% {
    transform: scale(1.05);
  }
}

.preloader-text-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preloader-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.preloader-title span {
  color: var(--accent);
}

.preloader-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.preloader-status-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.preloader-shimmer-line {
  width: 160px;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  position: relative;
  overflow: hidden;
}

.preloader-shimmer-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: shimmerSlide 1.5s ease-in-out infinite;
}

@keyframes shimmerSlide {
  100% {
    left: 140%;
  }
}

.preloader-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: dotGlow 1.2s ease-in-out infinite alternate;
}

@keyframes dotGlow {
  from {
    opacity: 0.4;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1.2);
  }
}

.preloader-error-box {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  max-width: 420px;
  margin-top: 1.5rem;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: relative;
  width: 100%;
  height: var(--header-height);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  z-index: 1000;
}

@media (min-width: 992px) {
  body {
    padding-top: var(--header-height);
    padding-bottom: 0;
  }

  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.brand-logo-apex {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon-svg {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title span {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--border-color);
}

.sponsor-mark {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

.sponsor-logo-svg {
  height: 24px;
  width: auto;
  aspect-ratio: 628 / 290;
  object-fit: contain;
  flex-shrink: 0;
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 0.35rem;
}

@media (min-width: 992px) {
  .desktop-nav {
    display: flex;
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0 2.25rem;
  }

  .modal-box {
    max-width: 1440px;
  }

  .teams-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
  }

  .video-cinema-box {
    max-width: 1100px;
  }

  .secondary-logos-grid {
    max-width: 1100px;
    gap: 1.75rem;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 1680px;
    padding: 0 3rem;
  }
}

@media (min-width: 640px) {
  .unified-matches-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

@media (min-width: 992px) {
  .unified-matches-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .site-header .container {
    padding: 0 0.75rem;
  }

  .header-inner {
    gap: 0.5rem;
  }

  .brand-group {
    gap: 0.45rem;
    min-width: 0;
  }

  .logo-icon-svg {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 0.95rem;
    line-height: 1;
  }

  .brand-title span {
    font-size: 0.58rem;
  }

  .brand-divider {
    height: 20px;
    margin: 0 2px;
  }

  .sponsor-mark {
    display: flex !important;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
  }

  .sponsor-logo-svg {
    height: 18px;
    width: auto;
  }

  .header-actions {
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .live-badge,
  .cached-badge {
    padding: 6px;
    border-radius: var(--radius-full);
  }

  .live-badge span#statusText,
  .cached-badge span#statusText {
    display: none;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .btn-icon svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 360px) {
  .sponsor-mark span {
    display: none;
  }
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--primary-subtle);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--status-eligible);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.2);
  white-space: nowrap;
}

.cached-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--status-ineligible);
  background: rgba(185, 16, 16, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(185, 16, 16, 0.2);
  white-space: nowrap;
}

.cached-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-ineligible);
  animation: pulseGlowRed 1.8s infinite;
}

@keyframes pulseGlowRed {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
    box-shadow: 0 0 0 0 rgba(185, 16, 16, 0.7);
  }
  70% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    opacity: 0.8;
    box-shadow: 0 0 0 0 rgba(185, 16, 16, 0);
  }
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-eligible);
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    opacity: 0.8;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--primary);
  color: var(--text-white);
}

.btn-icon.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  z-index: 100;
}

@media (min-width: 992px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 0;
  min-height: 44px;
  transition: color 0.15s ease;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--primary);
}

/* ==========================================================================
   HERO & STATS TICKER
   ========================================================================== */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, var(--primary-deeper) 100%);
  color: var(--text-white);
  padding: 2.75rem 0 3rem;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(255, 184, 0, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: clamp(1.85rem, 5vw, 3.25rem);
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-title span {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 720px;
  margin-bottom: 1.75rem;
  font-weight: 500;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 44px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary-deeper);
  box-shadow: 0 4px 14px rgba(255, 184, 0, 0.35);
}

.btn-primary:hover {
  background: #ffc424;
  transform: translateY(-2px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.22);
}

.stats-ticker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.ticker-item {
  text-align: center;
}

.ticker-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.ticker-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-champions-bar {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 184, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.champions-bar-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.champions-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
}

.champion-mini-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.champion-cat-name {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champion-player-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champion-stat-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

/* ==========================================================================
   TOURNAMENT DETAILS & POINTING SYSTEM
   ========================================================================== */
.about-section {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 2.75rem 0;
  content-visibility: auto;
  contain-intrinsic-size: 400px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 2.25rem;
}

.points-matrix-wrapper {
  margin-top: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.about-card {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 4px solid var(--primary);
}

.about-card h3 {
  font-size: 1.1rem;
  color: var(--primary-deeper);
}

.about-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
}

.about-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   OFFICIAL TEASER VIDEO SECTION
   ========================================================================== */
.video-section {
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
  padding: 2.75rem 0 3.25rem;
  content-visibility: auto;
  contain-intrinsic-size: 500px;
}

.video-cinema-box {
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(56, 74, 149, 0.25);
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.video-wrapper-16-9 {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.video-wrapper-16-9 video,
.video-wrapper-16-9 iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.video-caption-bar {
  background: var(--primary-deeper);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
}

.video-thumb-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0f19;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.video-thumb-overlay.playing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.video-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-btn-circle {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(56, 74, 149, 0.9);
  border: 3px solid var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(255, 184, 0, 0.45);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.play-btn-circle svg {
  width: 30px;
  height: 30px;
  margin-left: 4px;
}

.video-thumb-overlay:hover .play-btn-circle {
  transform: scale(1.1);
  background: var(--primary);
}

/* ==========================================================================
   UNIFIED QUALIFIER RESULTS
   ========================================================================== */
.section-wrap {
  padding: 2.75rem 0;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}

.section-header {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

@media (min-width: 768px) {
  .section-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.section-title {
  font-size: 1.5rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.unified-matches-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.match-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.match-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.match-card.is-completed {
  border-left: 4.5px solid var(--primary);
  background: linear-gradient(135deg, rgba(56, 74, 149, 0.04) 0%, var(--bg-surface) 65%);
}

.match-card.is-completed .score-badge {
  background: #ffffff;
  border-color: rgba(56, 74, 149, 0.25);
  color: var(--primary-deeper);
  box-shadow: 0 2px 6px rgba(56, 74, 149, 0.08);
}

.match-card.is-completed .team-box.winner .team-info-name {
  color: var(--primary);
  font-weight: 800;
}

.match-card.is-completed .team-box.winner .team-avatar-img {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(56, 74, 149, 0.25);
}

.match-card.is-scheduled {
  border-left: 4.5px solid var(--status-pending);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, var(--bg-surface) 65%);
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.match-teams-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

.team-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}

.team-box.p1 {
  justify-content: flex-start;
  text-align: left;
}

.team-box.p2 {
  justify-content: flex-end;
  text-align: right;
  flex-direction: row-reverse;
}

.team-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(56, 74, 149, 0.2);
}

.team-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(56, 74, 149, 0.2);
  background: var(--primary-subtle);
  display: block;
}

.team-info-name {
  font-weight: 700;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.score-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--bg-body);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--primary-dark);
  white-space: nowrap;
  flex-shrink: 0;
}

.score-badge.tbd {
  font-size: 0.75rem;
  color: var(--status-pending);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   MOBILE-SPECIFIC REFINEMENTS (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .section-wrap .container {
    padding: 0 0.85rem;
  }

  .match-card {
    padding: 0.9rem 0.85rem;
    gap: 0.7rem;
  }

  .match-teams-row {
    gap: 0.45rem;
  }

  .team-avatar-img,
  .team-avatar-placeholder {
    width: 30px;
    height: 30px;
  }

  .team-info-name {
    font-size: 0.84rem;
  }

  .score-badge {
    font-size: 1rem;
    padding: 0.25rem 0.55rem;
  }
}

/* ==========================================================================
   TOP 8 STANDINGS SNAPSHOT
   ========================================================================== */
.table-container {
  width: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th {
  background: var(--bg-body);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--primary-subtle);
}

.clickable-row {
  cursor: pointer;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  background: var(--bg-body);
  color: var(--text-main);
}

.rank-1 {
  background: #ffd700;
  color: #422006;
}
.rank-2 {
  background: #cbd5e1;
  color: #1e293b;
}
.rank-3 {
  background: #fdba74;
  color: #7c2d12;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--primary-deeper);
}

.team-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

.team-tag-pill {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 700;
}

/* ==========================================================================
   TOP 3 TEAM CARDS PODIUM BORDERS (GOLD, SILVER, BRONZE)
   ========================================================================== */
.team-card.rank-1-card {
  border: 2px solid #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
}
.team-card.rank-1-card:hover {
  border-color: #d97706;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.28);
}

.team-card.rank-2-card {
  border: 2px solid #94a3b8;
  box-shadow: 0 4px 14px rgba(148, 163, 184, 0.18);
}
.team-card.rank-2-card:hover {
  border-color: #64748b;
  box-shadow: 0 8px 24px rgba(148, 163, 184, 0.3);
}

.team-card.rank-3-card {
  border: 2px solid #ea580c;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.16);
}
.team-card.rank-3-card:hover {
  border-color: #c2410c;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.28);
}

[data-theme="dark"] .team-card.rank-1-card {
  border-color: #eab308;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.22);
}
[data-theme="dark"] .team-card.rank-2-card {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(203, 213, 225, 0.18);
}
[data-theme="dark"] .team-card.rank-3-card {
  border-color: #f97316;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.22);
}

/* ==========================================================================
   ROSTER MODAL QUALIFIERS BANNER & PODIUM IS-TOTAL
   ========================================================================== */
.modal-qualifiers-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 641px) {
  .modal-qualifiers-banner {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.25rem;
  }
}

.modal-q-item.is-total.podium-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18) 0%, rgba(254, 243, 199, 0.5) 100%);
  border-color: #f59e0b;
}
.modal-q-item.is-total.podium-1 .team-q-val {
  color: #b45309 !important;
}

.modal-q-item.is-total.podium-2 {
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.6) 0%, rgba(241, 245, 249, 0.8) 100%);
  border-color: #94a3b8;
}
.modal-q-item.is-total.podium-2 .team-q-val {
  color: #334155 !important;
}

.modal-q-item.is-total.podium-3 {
  background: linear-gradient(135deg, rgba(254, 215, 170, 0.35) 0%, rgba(255, 237, 213, 0.6) 100%);
  border-color: #ea580c;
}
.modal-q-item.is-total.podium-3 .team-q-val {
  color: #9a3412 !important;
}

[data-theme="dark"] .modal-q-item.is-total.podium-1 {
  background: rgba(255, 215, 0, 0.14);
  border-color: #eab308;
}
[data-theme="dark"] .modal-q-item.is-total.podium-1 .team-q-val {
  color: #fde047 !important;
}

[data-theme="dark"] .modal-q-item.is-total.podium-2 {
  background: rgba(148, 163, 184, 0.15);
  border-color: #cbd5e1;
}
[data-theme="dark"] .modal-q-item.is-total.podium-2 .team-q-val {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-q-item.is-total.podium-3 {
  background: rgba(234, 88, 12, 0.15);
  border-color: #f97316;
}
[data-theme="dark"] .modal-q-item.is-total.podium-3 .team-q-val {
  color: #fdba74 !important;
}

/* ==========================================================================
   MOBILE UN-CROWD ROSTER MODAL HEADER
   ========================================================================== */
@media (max-width: 640px) {
  #rosterModal .modal-header {
    padding: 0.75rem 0.9rem;
    gap: 0.5rem;
    align-items: flex-start;
  }

  #rosterModal .modal-body {
    padding: 0.85rem;
  }

  .roster-modal-logo-wrap {
    width: 36px;
    height: 36px;
  }

  #rosterModalTeamTitle {
    font-size: 1.05rem !important;
  }

  #rosterModalTeamRankBadge {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  #backToTeamsModalBtn {
    font-size: 0.72rem !important;
    padding: 3px 7px !important;
    min-height: 30px !important;
  }

  #rosterModal .close-btn {
    width: 30px;
    height: 30px;
    font-size: 1.15rem;
  }

  #rosterModalTeamMeta {
    font-size: 0.72rem !important;
    line-height: 1.35;
    margin-top: 2px !important;
  }
}

/* ==========================================================================
   PLAYER RANKINGS / LEADERBOARDS
   ========================================================================== */
.leaderboard-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 0.6rem 1.1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  min-height: 44px;
}

.tab-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(56, 74, 149, 0.2);
}

.leaderboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
}

.category-info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--primary-deeper);
  font-size: 1.05rem;
}

.eligible-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-eligible);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.leaderboard-row-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.leaderboard-row-card:hover {
  border-color: var(--primary-light);
  transform: translateX(3px);
}

.leaderboard-row-card.podium-1 {
  border-left: 5px solid #ffd700;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.06) 0%, var(--bg-surface) 60%);
}
.leaderboard-row-card.podium-2 {
  border-left: 5px solid #94a3b8;
}
.leaderboard-row-card.podium-3 {
  border-left: 5px solid #fdba74;
}

.player-details-col {
  display: flex;
  flex-direction: column;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-name-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.player-sub-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.player-stat-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-main-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.stat-label-small {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

/* ==========================================================================
   TEAMS DIRECTORY & ROSTER MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  will-change: opacity;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1120px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  contain: content;
  transform: translateZ(0);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 20;
}

.modal-body {
  padding: 1.5rem;
}

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-body);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #e2e8f0;
}

.search-input-wrap {
  width: 100%;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  background: var(--bg-body);
  font-weight: 600;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(56, 74, 149, 0.15);
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
}

.modal-table-wrapper {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 520px;
}

.roster-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.roster-table th,
.roster-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  text-align: center;
}

.roster-table th {
  background: #f1f5f9;
  color: var(--primary-deeper);
  font-weight: 700;
  font-size: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.roster-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-surface);
  text-align: left;
  font-weight: 700;
  min-width: 170px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.04);
}

.roster-table thead .sticky-col {
  z-index: 15;
  background: #f1f5f9;
}

.roster-table tbody tr:hover .sticky-col {
  background: var(--primary-subtle);
}

.teams-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  contain: layout;
}

@media (min-width: 768px) {
  .teams-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.15rem;
  }
}

.team-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  position: relative;
  contain: content;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
  will-change: transform;
  justify-content: space-between;
  height: 100%;
}

.team-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: 0 8px 20px rgba(56, 74, 149, 0.12);
}

.team-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.team-card-logo-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.team-card-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.team-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.team-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-card-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--primary-deeper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.team-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  text-align: center;
}

.team-stat-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.team-stat-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-deeper);
}

.team-stat-label {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.team-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
  margin-top: auto;
}

.roster-modal-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.roster-modal-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   SPONSORS: 1740 STUDIOS & PARTNERS
   ========================================================================== */
.sponsor-section {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 3.5rem 0;
  content-visibility: auto;
  contain-intrinsic-size: 450px;
}

.sponsor-headline {
  text-align: center;
  margin-bottom: 2.25rem;
}

.principal-sponsor-card {
  background: linear-gradient(135deg, var(--primary-subtle) 0%, #ffffff 100%);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-md);
  max-width: 620px;
  margin: 0 auto 2.5rem;
}

.principal-sponsor-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sponsor-logo-box {
  width: 160px;
  height: auto;
  aspect-ratio: 628 / 290;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sponsor-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.secondary-sponsors-heading {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.secondary-logos-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  max-width: 320px;
  margin: 0 auto;
}

.sponsor-logo-wrapper {
  width: calc(50% - 0.5rem);
  max-width: 130px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.sponsor-logo-wrapper:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.sponsor-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.sponsor-logo-wrapper:hover .sponsor-logo-img {
  opacity: 1;
}

@media (min-width: 641px) and (max-width: 1023px) {
  .secondary-logos-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
    max-width: 660px;
  }

  .sponsor-logo-wrapper {
    width: 100%;
    max-width: none;
    grid-column: span 2;
  }

  .sponsor-logo-wrapper:nth-child(5) {
    grid-column-start: 2;
  }
}

@media (min-width: 1024px) {
  .secondary-logos-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1.15rem;
    max-width: 980px;
  }

  .sponsor-logo-wrapper {
    width: 100%;
    max-width: none;
    grid-column: span 1;
  }

  .sponsor-logo-wrapper:nth-child(5) {
    grid-column-start: auto;
  }
}

/* ==========================================================================
   CUSTOM SCROLLBARS
   ========================================================================== */
.modal-box::-webkit-scrollbar,
.modal-table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 4px;
}

.modal-box::-webkit-scrollbar-track,
.modal-table-wrapper::-webkit-scrollbar-track {
  background: var(--bg-body);
  border-radius: var(--radius-full);
}

.modal-box::-webkit-scrollbar-thumb,
.modal-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(56, 74, 149, 0.25);
  border-radius: var(--radius-full);
}

.modal-box::-webkit-scrollbar-thumb:hover,
.modal-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.modal-box,
.modal-table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 74, 149, 0.3) transparent;
}

[data-theme="dark"] .modal-box::-webkit-scrollbar-track {
  background: #0e1424;
}

[data-theme="dark"] .modal-box::-webkit-scrollbar-thumb {
  background: #2a3670;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--primary-deeper);
  color: rgba(255, 255, 255, 0.7);
  padding: 2.5rem 0 2rem;
  font-size: 0.85rem;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

.error-banner {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.offline-bar {
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  display: none;
}

/* ==========================================================================
   DARK MODE ENGINE
   ========================================================================== */
[data-theme="dark"] {
  --primary: #758bf5;
  --primary-dark: #4e63bd;
  --primary-deeper: #f1f5f9;
  --primary-light: #9bb0ff;
  --primary-subtle: #18233f;
  --accent: #ffb800;

  --bg-body: #0a0e17;
  --bg-surface: #121929;
  --bg-card: #151d30;
  --border-color: #212c47;
  --border-subtle: #172138;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-white: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] body {
  background-color: var(--bg-body);
  color: var(--text-main);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 {
  color: #f8fafc;
}

[data-theme="dark"] .section-title {
  color: var(--primary);
}

[data-theme="dark"] .section-desc {
  color: #94a3b8;
}

[data-theme="dark"] .about-section,
[data-theme="dark"] section#standings,
[data-theme="dark"] .sponsor-section {
  background-color: var(--bg-body) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .site-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .brand-title {
  color: var(--primary);
}

[data-theme="dark"] .brand-title span {
  color: #94a3b8;
}

[data-theme="dark"] .nav-link {
  color: #cbd5e1;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
  color: var(--primary-light);
  background: var(--primary-subtle);
}

[data-theme="dark"] .btn-icon {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: #cbd5e1;
}

[data-theme="dark"] .btn-icon:hover {
  background: var(--primary);
  color: #ffffff;
}

[data-theme="dark"] .sponsor-mark {
  background: #18223c;
  border-color: var(--border-color);
}

[data-theme="dark"] .sponsor-mark span {
  color: #9bb0ff !important;
}

[data-theme="dark"] .about-card,
[data-theme="dark"] .match-card,
[data-theme="dark"] .leaderboard-row-card,
[data-theme="dark"] .team-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .points-matrix-wrapper {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .about-card p {
  color: #94a3b8;
}

[data-theme="dark"] .about-list {
  color: #e2e8f0;
}

[data-theme="dark"] .match-meta {
  border-bottom-color: var(--border-subtle);
  color: #94a3b8;
}

[data-theme="dark"] .team-info-name {
  color: #f8fafc;
}

[data-theme="dark"] .score-badge {
  background: #18223c;
  border-color: var(--border-color);
  color: #ffffff;
}

[data-theme="dark"] .score-badge.tbd {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .match-card.is-completed {
  border-left: 4.5px solid var(--primary);
  background: linear-gradient(135deg, rgba(117, 139, 245, 0.1) 0%, #121929 65%);
}

[data-theme="dark"] .match-card.is-completed .score-badge {
  background: #18223c;
  border-color: rgba(117, 139, 245, 0.35);
  color: #ffffff;
}

[data-theme="dark"] .match-card.is-completed .team-box.winner .team-info-name {
  color: #ffffff;
}

[data-theme="dark"] .match-card.is-completed .team-box.winner .team-avatar-img {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(117, 139, 245, 0.35);
}

[data-theme="dark"] .match-card.is-scheduled {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, #121929 60%);
  border-left: 4px solid #f59e0b;
}

[data-theme="dark"] .team-avatar-placeholder {
  background: #18233f;
  color: #9bb0ff;
  border-color: rgba(155, 176, 255, 0.25);
}

[data-theme="dark"] .team-avatar-img {
  border-color: rgba(155, 176, 255, 0.25);
  background: #18233f;
}

[data-theme="dark"] .data-table th,
[data-theme="dark"] .roster-table th {
  background: #18223c;
  color: #cbd5e1;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .data-table td,
[data-theme="dark"] .roster-table td {
  border-bottom: 1px solid var(--border-subtle);
  color: #f1f5f9;
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .roster-table tbody tr:hover td {
  background: #1b253f;
}

[data-theme="dark"] .roster-table .sticky-col {
  background: var(--bg-surface);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .roster-table thead .sticky-col {
  background: #18223c;
}

[data-theme="dark"] .roster-table tbody tr:hover .sticky-col {
  background: #1b253f;
}

[data-theme="dark"] .roster-table td div {
  color: #f8fafc !important;
}

[data-theme="dark"] .rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .team-link {
  color: var(--primary);
}

[data-theme="dark"] .team-tag-pill {
  background: #18223c;
  border-color: var(--border-color);
  color: #cbd5e1;
}

[data-theme="dark"] .modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: #f8fafc;
}

[data-theme="dark"] .modal-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .close-btn {
  background: #1e293b;
  color: #f1f5f9;
}

[data-theme="dark"] .close-btn:hover {
  background: #334155;
}

[data-theme="dark"] .search-input-wrap input {
  background: #0a0e17;
  border-color: var(--border-color);
  color: #ffffff;
}

[data-theme="dark"] .search-input-wrap input::placeholder {
  color: #64748b;
}

[data-theme="dark"] .team-card-name {
  color: #f8fafc;
}

[data-theme="dark"] .team-card-stats {
  background: #0e1424;
  border-color: var(--border-subtle);
}

[data-theme="dark"] .team-stat-val {
  color: #f8fafc;
}

[data-theme="dark"] .team-stat-label {
  color: #94a3b8;
}

[data-theme="dark"] .team-qualifiers-strip,
[data-theme="dark"] .modal-qualifiers-banner {
  background: #0e1424;
  border-color: var(--border-subtle);
}

[data-theme="dark"] .modal-q-item {
  background: #121929;
  border-color: var(--border-color);
}

[data-theme="dark"] .team-card-logo-wrap,
[data-theme="dark"] .roster-modal-logo-wrap {
  background: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .team-card-footer {
  border-top-color: var(--border-subtle);
  color: var(--primary);
}

[data-theme="dark"] .principal-sponsor-card {
  background: linear-gradient(135deg, #17223d 0%, #10162a 100%) !important;
  border-color: #4e63bd !important;
}

[data-theme="dark"] .principal-sponsor-card h4 {
  color: #ffffff;
}

[data-theme="dark"] .principal-sponsor-card p {
  color: #94a3b8;
}

[data-theme="dark"] .sponsor-logo-wrapper {
  background: linear-gradient(135deg, #17223d 0%, #10162a 100%) !important;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sponsor-logo-img.cold {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] .mobile-bottom-nav {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .bottom-nav-item {
  color: #94a3b8;
}

[data-theme="dark"] .bottom-nav-item.active {
  color: var(--primary);
}

[data-theme="dark"] .site-footer {
  background: #070a12;
  border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .video-caption-bar {
  background: #0d1222;
  border: 1px solid var(--border-color);
  border-top: none;
}

body,
.site-header,
.about-card,
.match-card,
.team-card,
.modal-box,
.data-table,
.data-table th,
.roster-table th,
.tab-btn,
.score-badge {
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.2s ease;
}
