*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

:root,
[data-theme="light"] {
  --radius2: 16px;
  --panel-glass: rgba(15, 23, 42, 0.6);
  --header-height: 61px;
  --bg: #f0f2f5;
  --bg-gradient: linear-gradient(135deg, #f0f2f5 0%, #e8edf2 100%);
  --panel: #ffffff;
  --panel-elevated: #ffffff;
  --text: #0f172a;
  --text-inverse: #ffffff;
  --muted: #475569;
  --line: rgba(15, 23, 42, 0.12);
  --brand: #059669;
  --brand-hover: #047857;
  --brand-glow: rgba(5, 150, 105, 0.12);
  --brand2: #2563eb;
  --good: #059669;
  --bad: #dc2626;
  --warn: #d97706;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-hover: rgba(255, 255, 255, 1);
  --radius: 12px;
  --radius2: 16px;
  --max: 1200px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  --bg: #0a0f1a;
  --bg-gradient: linear-gradient(145deg, #0a0f1a 0%, #111827 50%, #0a0f1a 100%);
  --panel: rgba(17, 24, 39, 0.7);
  --panel-elevated: rgba(30, 41, 59, 0.5);
  --text: #f1f5f9;
  --text-inverse: #0a0f1a;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.08);
  --brand: #10b981;
  --brand-hover: #34d399;
  --brand-glow: rgba(16, 185, 129, 0.2);
  --brand2: #3b82f6;
  --good: #10b981;
  --bad: #f87171;
  --warn: #fbbf24;
  --glass: rgba(15, 23, 42, 0.6);
  --glass-hover: rgba(30, 41, 59, 0.4);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ─── Theme Toggle System ─── */
.theme-toggle {
  background: var(--glass-hover);
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-glow);
  transform: scale(1.08);
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
  /* Hidden by default, shown per-theme below */
}

/* Show sun in dark mode (click to go light), moon in light (click to go dark) */
[data-theme="dark"] .theme-icon--sun {
  display: block !important;
}

[data-theme="dark"] .theme-icon--moon {
  display: none !important;
}

[data-theme="light"] .theme-icon--sun {
  display: none !important;
}

[data-theme="light"] .theme-icon--moon {
  display: block !important;
}

.logo-light-mode,
.logo-dark-mode {
  display: none;
}

[data-theme="dark"] .logo-dark-mode {
  display: block;
}

[data-theme="light"] .logo-light-mode {
  display: block;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(var(--max), calc(100% - 12px));
  margin: 0 auto;
}

.hstack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.vstack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 16px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Brand Wordmark ─── */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand__logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
}

.brand__text {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -1.2px;
  line-height: 1;
  color: var(--text);
  margin-left: -4px;
}


.brand__name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.4px;
}

/* Hide topbar nav on mobile, rely on bottom tab bar */
.nav {
  display: none;
}

/* Dropdown styling for top bar */
.nav__dropdown {
  position: relative;
  display: inline-block;
}

.nav__dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--panel);
  min-width: 160px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 100;
  padding: 8px 0;
}

.nav__dropdown-content a {
  color: var(--text);
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
}

.nav__dropdown-content a:hover {
  background-color: var(--glass-hover);
  color: var(--brand);
}

.nav__dropdown:hover .nav__dropdown-content {
  display: block;
}

.userbadge {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.userbadge__email {
  color: var(--muted);
  font-size: 13px;
  display: none;
}

@media (min-width: 860px) {
  .userbadge__email {
    display: inline;
  }
}

.pill {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--line);
  color: var(--muted);
}

.pill--pro {
  color: var(--brand);
  background: rgba(34, 197, 94, 0.15);
}

.pill--admin {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.15);
}

.pill--free {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pill--live {
  background: var(--brand);
  color: #fff;
  animation: pulse-live 2s infinite;
}

.pill--injury {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}

@keyframes goal-pulse {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.1); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes pulse-fav {
  0% { background: rgba(16, 185, 129, 0.05); }
  50% { background: rgba(16, 185, 129, 0.2); }
  100% { background: rgba(16, 185, 129, 0.05); }
}

/* Custom Match Metadata Indicators */
.team-meta-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.goal-indicator {
  font-size: 8.5px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-glow);
  padding: 2px 5px;
  border-radius: 4px;
  max-width: fit-content;
  animation: pulse-live 1.5s infinite;
  margin-bottom: -2px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 0 1px var(--brand);
}

.red-card-indicator {
  width: 9px;
  height: 13px;
  background-color: var(--bad);
  border-radius: 2px;
  margin: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  box-shadow: 0 2px 4px rgba(220,38,38,0.3);
}

.pill--brand {
  background: var(--brand-glow);
  color: var(--brand);
}

.main {
  padding: 18px 0 36px;
  min-height: calc(100vh - 140px);
}

.muted {
  color: var(--muted);
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
  border: 0;
}

.hstack {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
  transform: scale(0.96);
}

.btn--sm {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 14px var(--brand-glow);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn--danger {
  border-color: rgba(220, 38, 38, .22);
  background: rgba(220, 38, 38, .08);
  color: #991b1b;
}

.btn--primary:hover {
  box-shadow: 0 8px 25px var(--brand-glow);
  transform: translateY(-1px);
}

.btn--ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-glow);
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New";
  background: rgba(15, 23, 42, .04);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card--link {
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.card--link:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-hover), 0 0 0 1px var(--brand-glow);
  background: var(--panel-elevated);
}

.card__title {
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 6px;
  color: var(--text);
}

.card__meta {
  color: var(--brand);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 700;
}

.card__desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Removed legacy media query */

.desktop-layout {
  display: flex;
  min-height: 100vh;
}

/* 2. Mobile Navigation Stability (Solving Transparency) */
.topbar--mobile {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1000;
  background: var(--panel) !important;
  /* Solid background */
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.bottomNav {
  background: var(--panel) !important;
  /* Solid background */
  z-index: 1000 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* 3. Main Content Containers */
.main--mobile {
  padding: 16px 0;
}

.main--desktop {
  flex: 1;
  padding: 24px;
  background: var(--bg);
}

.container--desktop {
  max-width: 1400px;
  margin: 0 auto;
}

/* 4. Fix Uneven Team Names & Icons */
.matchrow__side,
.m-team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  /* Allow text truncate */
}

.matchrow__name,
.m-team-cell span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.logoimg,
.m-header-crest,
.crest {
  flex-shrink: 0;
  object-fit: contain;
  background: transparent;
  /* Ensure logo background is consistent */
}

/* 5. Mobile-Specific League Selector (Compact List rows) */
.mobile-layout .card-grid-mobile {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-layout .league-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.mobile-layout .league-row img {
  width: 32px;
  height: 32px;
}

/* 6. Fix for overlapping text in header */
.brand {
  overflow: hidden;
}

/* 7. Segmented Control for Mobile Tabs (Stats | Lineups | H2H) */
.mobile-layout .tabs {
  background: var(--line);
  padding: 4px;
  border-radius: 12px;
  display: flex;
  gap: 4px;
  border: none;
}

.mobile-layout .tab {
  flex: 1;
  padding: 10px 4px;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--muted);
}

.mobile-layout .tab--active {
  background: var(--panel);
  color: var(--brand);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 8. Fix Win Probability garbling on tiny screens */
.mobile-layout .prob-bar-label {
  font-size: 10px !important;
}

/* 9. Dark Mode Refinement for Panel Backgrounds */
[data-theme=\"dark\"] .topbar--mobile,
[data-theme=\"dark\"] .bottomNav {
  background: #111827 !important;
}

[data-theme=\"dark\"] .mobile-layout .tab--active {
  background: #1f2937;
}


/* 10. Desktop Sidebar Navigation (Pro Dashboard) */
.sidebar {
  width: 260px;
  background: #0b1220;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}

[data-theme=\"light\"] .sidebar {
  background: #f8fafc;
}

.sidebar__header {
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.sidebar__nav {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.sidebar__section {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 24px 8px 8px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar__link:hover {
  background: var(--line);
}

.sidebar__link--active {
  background: var(--brand);
  color: #fff;
}

.sidebar__icon {
  font-size: 18px;
}

.sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar__user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.sidebar__user-name {
  font-weight: 700;
  font-size: 14px;
}

.sidebar__user-status {
  font-size: 11px;
  color: var(--muted);
}

/* 11. Top Utility Bar (Desktop Only) */
.top-util-bar {
  height: 60px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  background: var(--bg);
}

/* 12. Desktop Content Adjustments */
.desktop-layout .grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.desktop-layout .main {
  max-width: 1600px;
  margin: 0 auto;
}


/* 13. Mobile Pro Menu (App-like Overlay) */
.mobile-pro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-pro-overlay--active {
  opacity: 1;
  visibility: visible;
}

.mobile-pro-menu {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border-radius: 24px 24px 0 0;
  z-index: 2001;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-pro-menu--active {
  bottom: 0;
}

.mobile-pro-menu__header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.mobile-pro-menu__close {
  background: var(--line);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.mobile-pro-menu__scroll {
  overflow-y: auto;
  padding: 16px;
}

.mobile-pro-menu__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.mobile-pro-menu__icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  background: var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.mobile-pro-menu__title {
  font-weight: 800;
  font-size: 15px;
}

.mobile-pro-menu__desc {
  font-size: 12px;
  color: var(--muted);
}


/* ─── Fixtures Page Specifics ─── */
.daytabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 12px 16px;
  margin-bottom: 24px;
  position: relative; /* CRITICAL for JS offsetLeft accuracy */
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

.daytabs::-webkit-scrollbar {
  display: none;
}

.daytab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  min-width: 80px;
  transition: all 0.2s;
  flex-shrink: 0;
  scroll-snap-align: center;
}

.daytab--active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.daytab strong {
  font-size: 13px;
  font-weight: 800;
}

.logoimg {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

/* ─── Match Row Styles ─── */
.matchrow-container {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line);
  transition: background 0.2s;
  position: relative;
}

.matchrow-container:hover {
  background: rgba(255, 255, 255, 0.04);
}

.matchrow {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  align-items: center;
  padding: 2px 16px 2px 16px; /* Tight vertical padding */
  min-width: 0;
  border-bottom: none !important;
}

.matchrow__side {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1; /* Key for symmetrical names */
}

.matchrow__side--home {
  justify-content: flex-end;
  text-align: right;
}
.matchrow__side--away {
  justify-content: flex-start;
}

@keyframes pulse-bell {
  0% { filter: drop-shadow(0 0 2px var(--brand)); opacity: 0.7; }
  50% { filter: drop-shadow(0 0 10px var(--brand)) drop-shadow(0 0 4px var(--brand)); opacity: 1; }
  100% { filter: drop-shadow(0 0 2px var(--brand)); opacity: 0.7; }
}

.matchrow__notify {
  width: 44px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  z-index: 5;
  padding: 0;
  margin-right: 4px;
}

.matchrow__notify:hover {
  color: var(--brand);
}

.matchrow__notify--active {
  color: var(--brand) !important;
  animation: pulse-bell 2s infinite ease-in-out;
}

/* Match Detail Header Notification */
.match-detail-notify {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.match-detail-notify:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.match-detail-notify--active {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand);
  box-shadow: 0 0 15px var(--brand-glow);
}

/* Global Modal & Overlay (Used for Pro Menu and Notifications) */
.mobile-pro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-pro-overlay--active {
  opacity: 1;
  visibility: visible;
}

.mobile-pro-menu {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  z-index: 9001;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.mobile-pro-menu--active {
  transform: translateY(0);
}

.mobile-pro-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.mobile-pro-menu__close {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
}

.mobile-pro-menu__scroll {
  overflow-y: auto;
  flex: 1;
}

.vstack { display: flex; flex-direction: column; }
.hstack { display: flex; flex-direction: row; align-items: center; }
.text-sm { font-size: 13px; }

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 9999;
  padding: 8px 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
}

.bell-icon {
  pointer-events: none;
}

.matchrow__name {
  font-weight: 700;
  font-size: 11px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile-Specific Overrides for Fixtures */
.mobile-layout .matchrow__name,
.mobile-layout .comphead span {
  font-size: 11px !important;
}

.matchrow__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;
}

.matchrow__score {
  font-weight: 900;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 8px;
  min-width: 60px;
  text-align: center;
}

.matchrow__score--future {
  font-size: 12px;
  color: var(--brand);
  font-weight: 800;
}

.fixtures-list {
  touch-action: pan-y;
}

/* ─── Comp Block Styles ─── */
.compblock {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  margin-left: 2px;
  margin-right: 2px;
  box-shadow: var(--shadow);
}

.comphead {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.compchev {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}

.mobile-layout .tabs {
  background: var(--line) !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 4px !important;
  display: flex !important;
}

.mobile-layout .tab {
  background: transparent !important;
  border: none !important;
  color: var(--muted) !important;
  flex: 1 !important;
  text-align: center !important;
  padding: 8px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

.mobile-layout .tab--active {
  background: var(--panel) !important;
  color: var(--brand) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}


/* ==========================================================================
   PHASE 2 & 3: SSR ARCHITECTURE RESET & POLISH
   ========================================================================== */

/* 1. Reset Legacy Layouts */
.topbar,
.bottomNav {
  display: none !important;
}

/* Hide old navigation systems */

/* 2. Global Mobile Instance (Native App) */
.mobile-layout {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

.mobile-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #0b1220;
  border-bottom: 1px solid var(--line);
  z-index: 2000;
  padding: 0 16px;
  display: flex;
  align-items: center;
}

[data-theme=\"light\"] .mobile-topbar {
  background: #fff;
}

.mobile-main {
  padding-top: 76px;
  /* 60px header + 16px gap */
  padding-bottom: 100px;
  /* Space for bottom nav */
  min-height: 100vh;
}

.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: #0b1220;
  border-top: 1px solid var(--line);
  z-index: 2000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme=\"light\"] .mobile-nav {
  background: #fff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.mobile-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  flex: 1;
}

.mobile-nav__item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  opacity: 0.6;
}

.mobile-nav__item--active {
  color: var(--brand);
}

.mobile-nav__item--active svg {
  opacity: 1;
}

/* 3. Global Desktop Instance (Pro Dashboard) */
.desktop-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.desktop-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Prevent flex blowout */
}

.desktop-top-bar {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.container--desktop {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* 4. Segmented Tabs Polish (High Specificity) */
.mobile-layout .tabs {
  display: flex !important;
  background: var(--line) !important;
  padding: 4px !important;
  border-radius: 12px !important;
  border: none !important;
  gap: 4px !important;
  margin: 20px 0 !important;
  overflow: hidden !important;
}

.mobile-layout .tab {
  flex: 1 !important;
  padding: 10px 4px !important;
  border-radius: 9px !important;
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-align: center !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
}

.mobile-layout .tab--active {
  background: var(--panel) !important;
  color: var(--brand) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* 5. Mobile Table Polish */
.mobile-layout .table--compact th,
.mobile-layout .table--compact td {
  padding: 10px 8px !important;
  font-size: 12px !important;
}

/* 6. Fix for Image IMG_8738 (Logo/Sidebar Leak) */
/* Removed legacy media query */

/* ==========================================================================
   UI RESTORATION: Lineups, Stats, Tabs
   ========================================================================== */

/* 1. RESTORED: Pitch Visualization Styles */
.pitchWrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius2);
  overflow: hidden;
  border: 1px solid #2a6e3a;
  background: repeating-linear-gradient(to bottom,
      #1a6b2e 0px,
      #1a6b2e 44px,
      #166128 44px,
      #166128 88px);
}

.pitch-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.pitchWrap .playerDot {
  z-index: 10;
}

/* Pitch team header/footer bars */
.pitch-team-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--glass);
}

.pitch-team-bar--home {
  border-radius: var(--radius2) var(--radius2) 0 0;
  border-bottom: none;
  background: rgba(34, 197, 94, 0.05);
}

.pitch-team-bar--away {
  border-radius: 0 0 var(--radius2) var(--radius2);
  border-top: none;
  background: rgba(96, 165, 250, 0.05);
}

.pitch-team-bar__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  width: 100%;
}

.pitch-team-bar__name {
  font-weight: 800;
  color: var(--text);
}

.pitch-team-bar__chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  margin-left: 4px;
}

.pitch-team-bar__chip--home {
  background: rgba(34, 197, 94, 0.15);
  color: var(--brand);
}

.pitch-team-bar__chip--away {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  margin-left: 0;
  margin-right: 4px;
}

.pitch-team-bar--away .pitch-team-bar__inner {
  justify-content: flex-end;
}

.playerDot {
  position: absolute;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  z-index: 10;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
}

.playerDot:hover {
  transform: translate(-50%, -50%) scale(1.18);
  z-index: 20;
}

.playerDot__badge {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #1a3a4a;
}

.playerDot__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  background: #fff;
}

.playerDot--home .playerDot__badge {
  border-color: var(--brand);
  background: #0b2d1e;
}

.playerDot--away .playerDot__badge {
  border-color: #ef4444;
  background: #450a0a;
}

.playerDot__initials {
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
}

.playerDot__name {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

.playerDot__rating {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #fff;
  z-index: 2;
}

@media (min-width: 768px) {
  .pitchWrap {
    aspect-ratio: 3 / 4;
  }
}

/* 2. RESTORED: Stats Bar Styles */
.srow {
  margin-bottom: 24px;
}

.srow:last-child {
  margin-bottom: 0;
}

.srow__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}

.srow__name {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 800;
}

.srow__val--best {
  color: var(--brand);
}

.sbar-split {
  display: flex;
  gap: 8px;
  height: 4px;
}

.sbar-half {
  flex: 1;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.sbar-fill {
  height: 100%;
  background: var(--muted);
  opacity: 0.3;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.sbar-fill--best {
  background: var(--brand);
  opacity: 1;
}

.sbar-half--home .sbar-fill {
  position: absolute;
  right: 0;
}

.sbar-half--away .sbar-fill {
  position: absolute;
  left: 0;
}

/* ─── Persistent Match Header Redesign (Sofascore Style) ─── */
.m-detail-header {
  padding: 24px;
  margin-bottom: 24px;
  border-radius: var(--radius2);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md), 0 0 40px var(--brand-glow);
  position: relative;
  overflow: hidden;
}

.m-header-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 10px 0;
  position: relative;
  z-index: 2;
}

.m-header-team {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
  min-width: 0;
}

.m-header-team:hover {
  transform: scale(1.02);
}

.m-header-team--home {
  flex-direction: row-reverse;
  text-align: right;
  justify-content: flex-end;
}

.m-header-team--away {
  flex-direction: row;
  text-align: left;
  justify-content: flex-start;
}

.m-header-crest {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--glass-hover);
  border: 1px solid var(--line);
  padding: 10px;
  object-fit: contain;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.m-header-team-name {
  font-weight: 900;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.8px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-header-score-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}

.m-header-score {
  font-weight: 900;
  font-size: 42px;
  letter-spacing: -2px;
}

@media (max-width: 768px) {
  .m-detail-header {
    padding: 16px 12px;
    margin-bottom: 16px;
  }
  .m-header-main {
    gap: 8px;
  }
  
  .m-header-team {
    gap: 8px;
  }
  
  .m-header-crest {
    width: 44px;
    height: 44px;
    padding: 6px;
  }
  
  .m-header-team-name {
    font-size: 14px;
    letter-spacing: -0.4px;
  }

  .m-header-score {
    font-size: 28px;
  }

  .m-header-score-area {
    min-width: 80px;
  }
}

/* RESTORED: Base Tab Styles */
.tabs {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.tabs--scrollable {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0 12px;
}

.tabs--scrollable::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
  min-width: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab:hover {
  color: var(--text);
}

.tab--active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

/* RESTORED: Responsive Grid System */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* --- PWA Install Prompt --- */
.pwa-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 24px 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  border-radius: 24px 24px 0 0;
}
.pwa-prompt--visible {
  transform: translateY(0);
}
.pwa-prompt__header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pwa-prompt__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg);
  padding: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.pwa-prompt__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(15, 23, 42, 0.05);
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
[data-theme="dark"] .pwa-prompt__close {
  background: rgba(255, 255, 255, 0.05);
}
@media (min-width: 768px) {
  .pwa-prompt {
    bottom: 24px;
    left: auto;
    right: 24px;
    width: 380px;
    border: 1px solid var(--line);
    border-radius: 20px;
  }
}


.sub-indicator {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  z-index: 3;
  border: 1px solid var(--panel);
}
.sub-indicator--off {
  background: var(--bad);
}
.sub-indicator--on {
  background: var(--brand);
}
.sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.sub-row:last-child {
  border-bottom: none;
}
.sub-photo-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.sub-photo-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  background: #fff;
}

/* ==========================================================================
   PREVIEW TAB REDESIGN
   ========================================================================== */

/* Section Container */
.preview-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.preview-section__title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

/* Team Form — Compact Rows */
.preview-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.preview-form__col {
  display: flex;
  flex-direction: column;
}

.preview-form__col:first-child {
  border-right: 1px solid var(--line);
}

.preview-form__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.7;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.preview-form__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.preview-form__row:last-child {
  border-bottom: none;
}

.preview-form__row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.preview-form__crest {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.preview-form__score {
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 6px;
  min-width: 44px;
  text-align: center;
  color: #fff;
  letter-spacing: 0.3px;
}

.preview-form__score--w {
  background: var(--brand);
}

.preview-form__score--d {
  background: var(--warn);
  color: #1a1a1a;
}

.preview-form__score--l {
  background: var(--bad);
  opacity: 0.85;
}

/* Insights — Single Column Cards */
.preview-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: background 0.15s ease;
}

.preview-insight:hover {
  background: rgba(255, 255, 255, 0.04);
}

.preview-insight__bar {
  width: 3px;
  min-height: 16px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}

.preview-insight__bar--home {
  background: var(--brand);
}

.preview-insight__bar--away {
  background: var(--brand2);
}

.preview-insight__text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

/* Injury Status Pills */
.injury-pill {
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  color: #fff;
}

.injury-pill--inj {
  background: var(--warn);
  color: #1a1a1a;
}

.injury-pill--sus {
  background: var(--bad);
}

/* ==========================================================================
   H2H TAB REDESIGN
   ========================================================================== */

/* H2H Summary — Pills + Split Bar */
.h2h-summary {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 24px 16px 16px;
  gap: 12px;
}

.h2h-summary__pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 900;
}

.h2h-summary__pill span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.h2h-summary__pill--home {
  color: var(--bad);
}

.h2h-summary__pill--draw {
  color: var(--muted);
}

.h2h-summary__pill--away {
  color: var(--warn);
}

.h2h-summary__bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 0 16px 20px;
}

.h2h-summary__bar > div {
  min-width: 2px;
  transition: width 0.3s ease;
}

/* H2H Match Rows */
.h2h-match {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.h2h-match__date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.h2h-match__comp {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 8px;
  float: right;
  margin-top: -18px;
}

.h2h-match__teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.h2h-match__side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.h2h-match__side span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h2h-match__side--home {
  justify-content: flex-end;
  text-align: right;
}

.h2h-match__side--away {
  justify-content: flex-start;
}

.h2h-match__crest {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.h2h-match__score {
  font-size: 14px;
  font-weight: 900;
  min-width: 50px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* ─── WinMate Knockout Bracket System ─── */
.bracket-wrapper {
  margin: 20px -12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 20px 12px 40px;
}

.bracket-canvas {
  display: flex;
  gap: 60px; /* Space for SVG connectors */
  min-width: fit-content;
  position: relative;
}

.bracket-stage {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 20px;
  min-width: 180px;
}

.bracket-stage__title {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 12px;
}

.bracket-tie {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.bracket-tie:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  background: var(--panel-elevated);
}

.bracket-tie--active {
  border-color: var(--brand);
  box-shadow: 0 0 20px var(--brand-glow);
  z-index: 10;
}

.bracket-team {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.bracket-team--winner {
  color: var(--brand);
}

.bracket-team--loser {
  opacity: 0.5;
}

.bracket-team img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.bracket-team span {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.bracket-team__score {
  font-weight: 900;
  font-size: 13px;
  min-width: 20px;
  text-align: right;
}

.bracket-tie__agg {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* SVG Connectors */
.bracket-connectors {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.bracket-path {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  transition: all 0.5s ease;
}

.bracket-path--active {
  stroke: var(--brand);
  stroke-width: 3;
  filter: drop-shadow(0 0 6px var(--brand));
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawPath 2s forwards ease-in-out;
}

@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

.bracket-trophy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 120px;
}

.bracket-trophy__icon {
  font-size: 48px;
  filter: drop-shadow(0 0 10px var(--warn));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

.wm-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wm-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.wm-table td {
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.wm-table tr:last-child td {
  border-bottom: none;
}

.wm-table tr--highlight {
  background: var(--brand-glow);
}

.wm-table tr--highlight td {
  color: var(--brand);
}

/* Sticky Team Column */
.wm-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 5;
  background: inherit;
  text-align: left;
  padding-left: 12px;
  min-width: 140px;
}

.wm-table th.sticky-col {
  background: rgba(30, 41, 59, 1);
  z-index: 6;
}

.wm-table tr:nth-child(even) .sticky-col {
  background: inherit;
}

.wm-table td.sticky-col::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: var(--line);
  box-shadow: 4px 0 8px rgba(0,0,0,0.1);
}

/* Form Circles */
.form-indicator {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.form-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.form-dot--w { background: var(--brand); }
.form-dot--d { background: var(--warn); color: #1a1a1a; }
.form-dot--l { background: var(--bad); }

.table-pos {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  margin-right: 8px;
}

.table-team-name {
  font-weight: 700;
  font-size: 13px;
}

.table-pts {
  font-weight: 900;
  color: var(--brand);
}

@media (max-width: 768px) {
  .wm-table .sticky-col {
    min-width: 120px;
  }
}

 / *   C o m i n g   S o o n   B a d g e s   * / 
 . b a d g e - - s o o n   { 
     b a c k g r o u n d :   v a r ( - - l i n e ) ; 
     c o l o r :   v a r ( - - m u t e d ) ; 
     f o n t - s i z e :   8 p x ; 
     f o n t - w e i g h t :   9 0 0 ; 
     p a d d i n g :   2 p x   6 p x ; 
     b o r d e r - r a d i u s :   4 p x ; 
     t e x t - t r a n s f o r m :   u p p e r c a s e ; 
     l e t t e r - s p a c i n g :   0 . 5 p x ; 
     m a r g i n - l e f t :   8 p x ; 
 } 
 
 . m e n u - i t e m - - d i s a b l e d   { 
     o p a c i t y :   0 . 5 ; 
     f i l t e r :   g r a y s c a l e ( 1 ) ; 
     c u r s o r :   n o t - a l l o w e d   ! i m p o r t a n t ; 
 } 
 
 
 / *    % % %  T e a m   V i e w   R e d e s i g n    % % %  * / 
 . t e a m - h e a d e r   { 
     p a d d i n g :   3 2 p x   1 6 p x ; 
     b a c k g r o u n d :   v a r ( - - p a n e l ) ; 
     b o r d e r - b o t t o m :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     m a r g i n :   - 1 6 p x   - 1 6 p x   2 4 p x ; 
 } 
 
 . t e a m - h e a d e r _ _ c r e s t - w r a p   { 
     w i d t h :   8 0 p x ; 
     h e i g h t :   8 0 p x ; 
     p a d d i n g :   1 2 p x ; 
     b a c k g r o u n d :   v a r ( - - b g ) ; 
     b o r d e r - r a d i u s :   2 0 p x ; 
     b o r d e r :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     b o x - s h a d o w :   v a r ( - - s h a d o w - m d ) ; 
 } 
 
 . t e a m - h e a d e r _ _ c r e s t   { 
     w i d t h :   1 0 0 % ; 
     h e i g h t :   1 0 0 % ; 
     o b j e c t - f i t :   c o n t a i n ; 
 } 
 
 . k p i - g r i d   { 
     d i s p l a y :   g r i d ; 
     g r i d - t e m p l a t e - c o l u m n s :   r e p e a t ( a u t o - f i t ,   m i n m a x ( 1 4 0 p x ,   1 f r ) ) ; 
     g a p :   1 2 p x ; 
     m a r g i n - b o t t o m :   2 4 p x ; 
 } 
 
 . k p i - c a r d   { 
     b a c k g r o u n d :   v a r ( - - p a n e l ) ; 
     b o r d e r :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     b o r d e r - r a d i u s :   1 6 p x ; 
     p a d d i n g :   1 6 p x ; 
     d i s p l a y :   f l e x ; 
     f l e x - d i r e c t i o n :   c o l u m n ; 
     g a p :   4 p x ; 
 } 
 
 . k p i - c a r d _ _ l a b e l   { 
     f o n t - s i z e :   1 0 p x ; 
     f o n t - w e i g h t :   8 0 0 ; 
     t e x t - t r a n s f o r m :   u p p e r c a s e ; 
     l e t t e r - s p a c i n g :   0 . 5 p x ; 
     c o l o r :   v a r ( - - m u t e d ) ; 
 } 
 
 . k p i - c a r d _ _ v a l u e   { 
     f o n t - s i z e :   2 4 p x ; 
     f o n t - w e i g h t :   9 0 0 ; 
     c o l o r :   v a r ( - - t e x t ) ; 
 } 
 
 . k p i - c a r d _ _ s u b   { 
     f o n t - s i z e :   1 1 p x ; 
     f o n t - w e i g h t :   6 0 0 ; 
     c o l o r :   v a r ( - - b r a n d ) ; 
 } 
 
 
 / *    % % %  P l a y e r   V i e w   R e d e s i g n    % % %  * / 
 . p l a y e r - h e a d e r   { 
     p a d d i n g :   4 0 p x   1 6 p x ; 
     b a c k g r o u n d :   v a r ( - - p a n e l ) ; 
     b o r d e r - b o t t o m :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     m a r g i n :   - 1 6 p x   - 1 6 p x   2 4 p x ; 
 } 
 
 . p l a y e r - h e a d e r _ _ p h o t o - w r a p   { 
     w i d t h :   1 0 0 p x ; 
     h e i g h t :   1 0 0 p x ; 
     b a c k g r o u n d :   v a r ( - - b g ) ; 
     b o r d e r - r a d i u s :   2 4 p x ; 
     b o r d e r :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     o v e r f l o w :   h i d d e n ; 
     b o x - s h a d o w :   v a r ( - - s h a d o w - m d ) ; 
 } 
 
 . p l a y e r - h e a d e r _ _ p h o t o   { 
     w i d t h :   1 0 0 % ; 
     h e i g h t :   1 0 0 % ; 
     o b j e c t - f i t :   c o v e r ; 
     o b j e c t - p o s i t i o n :   t o p ; 
 } 
 
 . p l a y e r - r a t i n g - p i l l   { 
     f o n t - s i z e :   2 8 p x ; 
     f o n t - w e i g h t :   9 0 0 ; 
     p a d d i n g :   1 2 p x   2 0 p x ; 
     b o r d e r - r a d i u s :   1 6 p x ; 
     b a c k g r o u n d :   v a r ( - - b g ) ; 
     b o r d e r :   1 p x   s o l i d   v a r ( - - l i n e ) ; 
     b o x - s h a d o w :   v a r ( - - s h a d o w ) ; 
 } 
 
 . s t a t - g r i d - 3   { 
     d i s p l a y :   g r i d ; 
     g r i d - t e m p l a t e - c o l u m n s :   r e p e a t ( 3 ,   1 f r ) ; 
     g a p :   1 2 p x ; 
     m a r g i n - b o t t o m :   2 4 p x ; 
 } 
 
 . p l a y e r - m a t c h - h i g h l i g h t   { 
     b o r d e r :   1 p x   s o l i d   v a r ( - - b r a n d - g l o w ) ; 
     b a c k g r o u n d :   l i n e a r - g r a d i e n t ( 1 4 5 d e g ,   v a r ( - - b r a n d - g l o w )   0 % ,   t r a n s p a r e n t   1 0 0 % ) ; 
 } 
 
 
/* ==========================================================================
   TEAM & PLAYER VIEW REDESIGN EXTRAS
   ========================================================================== */

/* --- KPI Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,255,255,0.1);
}

.kpi-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 8px;
}

.kpi-card__value {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-card__sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.7;
}

/* --- Stat Grid (3 Cols) --- */
.stat-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* --- Generic Panels --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.panel__title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

/* --- Utility Pills --- */
.pill--good {
  background: rgba(34, 197, 94, 0.15);
  color: var(--brand);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.pill--warn {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.pill--bad {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pill--muted {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* --- Form Guide Match row --- */

.team-form-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Coming Soon Badges */
.badge--soon {
  background: var(--line);
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.menu-item--disabled {
  opacity: 0.5;
  filter: grayscale(1);
  cursor: not-allowed !important;
}

/* H2H Season Comparison */
.h2h-compare__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.h2h-compare__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.h2h-compare__val {
  font-size: 14px;
  font-weight: 900;
  width: 40px;
}

.h2h-compare__val--home { text-align: left; }
.h2h-compare__val--away { text-align: right; }

.h2h-compare__val--better {
  color: var(--brand);
}

.h2h-compare__label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.h2h-compare__bars {
  display: flex;
  gap: 4px;
  height: 6px;
}

.h2h-compare__bar-wrap {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.h2h-compare__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.h2h-compare__fill--home {
  float: right;
  background: var(--brand);
  opacity: 0.8;
}

.h2h-compare__fill--away {
  float: left;
  background: var(--brand2, #3b82f6);
  opacity: 0.8;
}

.h2h-compare__fill--best {
  opacity: 1;
  box-shadow: 0 0 8px var(--brand-glow);
}
