:root {
  --bg-color: #08110B;
  --surface-color: #112017;
  --surface-alt: #173125;
  --accent-green: #32D17C;
  --accent-green-glow: rgba(50, 209, 124, 0.22);
  --accent-blue: #7CC7FF;
  --accent-gold: #F4C542;
  --accent-silver: #C0C7D1;
  --accent-bronze: #CD7F32;
  --danger: #e63946;
  --info: #7CC7FF;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: #112017;
  --font-family: 'Manrope', system-ui, sans-serif;
  --font-display: 'Barlow Condensed', 'Manrope', sans-serif;
  --radius-card: 18px;
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.28);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 199, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(50, 209, 124, 0.06), transparent 50%),
    radial-gradient(ellipse 50% 30% at 10% 80%, rgba(50, 209, 124, 0.04), transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  color-scheme: dark;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: none;
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.85rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.65rem; }

p {
  line-height: 1.55;
  margin-bottom: 1rem;
}

.text-gradient {
  font-family: var(--font-display);
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: unset;
}

.font-display {
  font-family: var(--font-display);
}

.text-danger { color: var(--danger); }
.text-success { color: var(--accent-green); }
.text-gold { color: var(--accent-gold); }
.text-blue { color: var(--accent-blue); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-weight-bold { font-weight: 700; }
.font-weight-500 { font-weight: 500; }
.m-0 { margin: 0; }

/* Layout & Containers */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Raised surfaces (legacy class name kept) */
.glass-card {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 45%),
    var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
  border-color: var(--border-color);
}

.surface-raised {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  background-color: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: rgba(50, 209, 124, 0.55);
  box-shadow: 0 0 0 3px var(--accent-green-glow);
}

select.form-control {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 2.5rem;
  background-color: var(--surface-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px 8px;
}

select.form-control:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2332D17C' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
}

select.form-control option,
select.form-control optgroup {
  background-color: var(--surface-color);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  font-family: var(--font-family);
  gap: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-green);
  color: #04140C;
  box-shadow: 0 4px 16px var(--accent-green-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(50, 209, 124, 0.35);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }

/* Badges — broadcast chips */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-success {
  background: rgba(50, 209, 124, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(50, 209, 124, 0.35);
}

.badge-danger {
  background: rgba(230, 57, 70, 0.12);
  color: #ff6b76;
  border: 1px solid rgba(230, 57, 70, 0.35);
}

.badge-warning {
  background: rgba(244, 197, 66, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(244, 197, 66, 0.35);
}

.badge-info {
  background: rgba(124, 199, 255, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(124, 199, 255, 0.35);
}

.badge-live {
  background: rgba(124, 199, 255, 0.14);
  color: var(--accent-blue);
  border: 1px solid rgba(124, 199, 255, 0.4);
  animation: livePulse 2s ease-in-out infinite;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-ghost {
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border-color);
  opacity: 0.75;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* League top bar */
.league-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.league-top-bar-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  margin: 0;
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.league-top-bar-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.league-top-bar-spacer {
  width: 5.5rem;
  flex-shrink: 0;
}

/* Layout variations */
.main-content {
  padding-top: 0;
  padding-bottom: 2rem;
}

.main-content.league-main-content,
.main-content.login-main-content {
  padding-top: 0;
  padding-bottom: 0;
}

.main-content.login-main-content {
  min-height: 100vh;
}

/* Animations
   End keyframes must use transform: none (not translateY(0)).
   A non-none transform on .animate-fade-in parents creates a containing
   block for position:fixed, so modals center in the page instead of the
   viewport — on mobile users have to scroll to find them. */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.45s ease forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-shake { animation: shake 0.4s ease; }

.shimmer-bg {
  background: linear-gradient(90deg, var(--surface-color) 25%, var(--surface-alt) 50%, var(--surface-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-card);
}

/* Grid Systems */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.15rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.matchday-fixtures-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.settings-container { max-width: 720px; }
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.settings-grid .glass-card:hover { transform: none; }
.settings-section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}
.rules-container { max-width: 820px; }
.rules-card:hover { transform: none; }
.rules-list,
.rules-sublist {
  list-style: none;
  counter-reset: rule;
}
.rules-list > li {
  counter-increment: rule;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.35rem;
  line-height: 1.65;
}
.rules-list > li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.3;
}
.rules-sublist {
  counter-reset: subrule;
  margin-top: 0.75rem;
}
.rules-sublist > li {
  counter-increment: subrule;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}
.rules-sublist > li::before {
  content: counter(subrule, lower-alpha);
  position: absolute;
  left: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent-blue);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.border-top { border-top: 1px solid var(--border-color); }
.pt-3 { padding-top: 1rem; }

/* Desktop adjustments */
@media (min-width: 768px) {
  .main-content {
    padding-bottom: 2rem;
  }

  .main-content.league-main-content,
  .main-content.login-main-content {
    padding-top: 0;
    padding-bottom: 0;
  }

  .matchday-fixtures-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Team Crest */
.team-crest-container {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.team-crest-sm {
  width: 36px;
  height: 36px;
}
.team-crest-lg {
  width: 72px;
  height: 72px;
}
.team-crest-md {
  width: 58px;
  height: 58px;
}

.team-crest-xl {
  width: 88px;
  height: 88px;
}

.your-matchup-side.is-picked .team-crest-container {
  border-color: rgba(50, 209, 124, 0.45);
  box-shadow: 0 0 0 2px rgba(50, 209, 124, 0.18);
}

.your-matchup-side.is-opponent .team-crest-container {
  opacity: 0.85;
}

.team-crest-placeholder {
  background: transparent;
  border-style: dashed;
}

.team-crest-placeholder::before {
  content: "";
  width: 26px;
  height: 30px;
  border: 2px solid var(--text-muted);
  clip-path: polygon(50% 0, 100% 18%, 88% 76%, 50% 100%, 12% 76%, 0 18%);
  opacity: 0.55;
}

.team-crest {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.team-crest-fallback {
  background: linear-gradient(135deg, var(--surface-color), var(--surface-alt));
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 8, 0.78);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
    var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: auto;
  box-shadow: var(--shadow-soft);
  transform: translateY(20px);
  transition: transform var(--transition-fast);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* Add to Home Screen sheet */
.a2hs-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  padding: 0 1rem max(1rem, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.a2hs-sheet.is-open {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

.a2hs-sheet-inner {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.25rem 1.35rem 1rem;
  border-radius: 20px 20px 16px 16px;
  border: 1px solid var(--border-color);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, transparent 45%),
    var(--surface-color);
  box-shadow: var(--shadow-soft);
}

.a2hs-sheet-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.a2hs-sheet-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
}

.a2hs-sheet-title {
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
}

.a2hs-sheet-body {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.a2hs-sheet-steps {
  margin: 0 0 1.1rem;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.a2hs-sheet-steps li + li {
  margin-top: 0.4rem;
}

.a2hs-sheet-actions {
  display: flex;
  gap: 0.65rem;
}

.a2hs-sheet-actions .btn {
  flex: 1;
}

.a2hs-sheet-never {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.a2hs-sheet-never:hover {
  color: var(--text-secondary);
}

/* ========== HOME ========== */
.home-page {
  padding-top: 0.5rem;
}

.home-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.home-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.home-brand-icon {
  width: clamp(4.5rem, 14vw, 6rem);
  height: clamp(4.5rem, 14vw, 6rem);
  object-fit: contain;
  flex-shrink: 0;
}

.home-brand-name {
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 16vw, 6.8rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 0.95;
  text-transform: uppercase;
  white-space: nowrap;
}

.home-user-btn {
  display: inline-flex;
  align-items: center;
  max-width: 40%;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.home-user-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.16);
  background: var(--surface-alt);
}

.home-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.home-section-header h2 {
  margin-bottom: 0.15rem;
}

.home-fixtures-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
}

.home-fixtures-heading h2 {
  margin: 0;
}

.home-summary-countdown {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.home-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.home-section-actions .btn {
  text-decoration: none;
}

.home-leagues-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.league-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.25rem;
  transition: border-color var(--transition-fast);
}

.league-card:hover {
  border-color: rgba(50, 209, 124, 0.35);
}

.league-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.league-card-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin: 0;
  line-height: 1.15;
}

.league-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
}

.league-card-code {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.home-fixtures-section {
  margin-bottom: 2rem;
}

/* Stadium perimeter ad rails — variable height (AdSense forbids fixed-height hosts) */
.ad-stadium-strip {
  --ad-rail-accent: var(--accent-green);
  --ad-rail-accent-soft: rgba(50, 209, 124, 0.35);
  position: relative;
  display: block;
  width: 100%;
  min-height: 52px;
  height: auto;
  margin: 0 0 1.25rem;
  border-radius: 4px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 28%),
    linear-gradient(90deg, #0a1610 0%, var(--surface-alt) 45%, #0a1610 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 18px color-mix(in srgb, var(--ad-rail-accent) 18%, transparent);
}

.ad-stadium-strip::before,
.ad-stadium-strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: none;
  z-index: 2;
}

.ad-stadium-strip::before {
  top: 0;
  background: linear-gradient(90deg, transparent, var(--ad-rail-accent-soft), transparent);
}

.ad-stadium-strip::after {
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.ad-stadium-strip--green {
  --ad-rail-accent: var(--accent-green);
  --ad-rail-accent-soft: rgba(50, 209, 124, 0.4);
}

.ad-stadium-strip--gold {
  --ad-rail-accent: var(--accent-gold);
  --ad-rail-accent-soft: rgba(244, 197, 66, 0.4);
}

.ad-stadium-strip--blue {
  --ad-rail-accent: var(--accent-blue);
  --ad-rail-accent-soft: rgba(124, 199, 255, 0.4);
}

.ad-stadium-strip-label {
  position: absolute;
  top: 3px;
  left: 8px;
  z-index: 3;
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.45);
  pointer-events: none;
}

.ad-stadium-strip-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  height: auto;
  padding: 0.55rem 0;
  text-decoration: none;
  color: inherit;
}

/* Host for AdSense <ins> — must grow with the creative */
.ad-stadium-strip-host {
  display: block;
  width: 100%;
  min-height: 52px;
  height: auto;
  padding: 0.35rem 0.25rem;
  text-align: center;
  overflow: visible;
}

.ad-stadium-strip-board {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
  padding: 0 1rem;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--ad-rail-accent) 10%, transparent) 50%,
    transparent 100%
  );
}

.ad-stadium-strip-brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-shadow: 0 0 12px color-mix(in srgb, var(--ad-rail-accent) 45%, transparent);
  line-height: 1;
}

.ad-stadium-strip-tagline {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 22rem);
}

.ad-stadium-strip-link:hover .ad-stadium-strip-brand {
  color: var(--ad-rail-accent);
}

.home-fixtures-section .ad-stadium-strip {
  margin-top: 1rem;
  margin-bottom: 0;
}

.home-fixtures-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-fixture-card {
  padding: 1rem 1.15rem;
}

.home-fixture-card .your-matchup-name {
  font-size: 0.95rem;
}

.home-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.home-empty-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

/* ========== LOGIN ========== */
.login-page {
  min-height: calc(100vh - 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.login-brand-icon {
  width: clamp(2.5rem, 9vw, 3.5rem);
  height: clamp(2.5rem, 9vw, 3.5rem);
  flex-shrink: 0;
  object-fit: contain;
}

.login-brand-name {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 12vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  line-height: 0.95;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(124, 199, 255, 0.18);
}

.login-brand-tag {
  margin-top: 0.65rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.login-panel {
  padding: 1.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(50, 209, 124, 0.08), transparent 55%),
    var(--surface-color);
  box-shadow: var(--shadow-soft);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-color);
}

.auth-tab {
  padding: 0.7rem 0.5rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.auth-tab.active {
  background: var(--surface-alt);
  color: var(--accent-green);
}

/* ========== LEAGUE ========== */
.match-centre {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.match-centre-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.match-centre-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  min-width: 0;
}

.match-centre-heading h3 {
  margin: 0;
}

.matchday-fixtures-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.matchday-fixtures-page {
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
  text-align: center;
}

.broadcast-fixture {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-color);
}

.broadcast-fixture:last-child {
  border-bottom: 0;
}

.broadcast-time {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.broadcast-teams {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 0;
}

.broadcast-vs {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0.35rem;
}

.your-team-plate {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.your-team-plate.has-pick {
  border-color: rgba(50, 209, 124, 0.35);
}

.your-team-plate > .flex-1 {
  display: flex;
  align-items: center;
  justify-content: center;
}

.your-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.your-matchup-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  text-align: center;
}

.your-matchup-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: break-word;
  word-break: normal;
  color: var(--text-secondary);
}

.your-matchup-name.is-picked {
  font-weight: 800;
  color: var(--accent-green);
}

.your-matchup-name.is-opponent {
  font-weight: 600;
  color: var(--text-muted);
}

.your-team-title {
  font-size: 1.35rem;
  line-height: 1.2;
}

.your-team-deadline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-top: 0.55rem;
}

.your-team-deadline-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.your-team-deadline-countdown {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
}

.your-team-deadline.is-locked .your-team-deadline-label {
  color: var(--accent-gold);
  font-weight: 600;
}

.your-matchup-centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 4.5rem;
  padding: 0 0.25rem;
}

.your-matchup-vs {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.your-matchup-when {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.your-matchup-day {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.your-matchup-score {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.your-matchup-kickoff {
  margin-top: 0.35rem;
  margin-bottom: 0.75rem;
}

.standings-rank {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  width: 2rem;
  display: inline-block;
}

.standings-rank.rank-1 { color: var(--accent-gold); }
.standings-rank.rank-2 { color: var(--accent-silver); }
.standings-rank.rank-3 { color: var(--accent-bronze); }

.standings-points {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-gold);
}

/* ========== PICKS ========== */
.pick-tray {
  position: sticky;
  top: 0.5rem;
  z-index: 20;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
    var(--surface-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.pick-tray.has-selection {
  border-color: rgba(50, 209, 124, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(50, 209, 124, 0.15);
}

.pick-tray-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pick-tray-info {
  flex: 1;
  min-width: 140px;
}

.pick-tray-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.pick-tray-team {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.1;
}

.pick-countdown {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-width: 7rem;
}

.pick-countdown-label {
  display: block;
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.pick-summary {
  border-color: var(--border-color);
}

.pick-summary.has-selection {
  border-color: rgba(50, 209, 124, 0.4);
}

.pick-summary-content {
  min-height: 132px;
}

.fixture-card {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.fixture-card.selectable {
  cursor: pointer;
}

.fixture-card.selectable:hover {
  border-color: rgba(50, 209, 124, 0.4);
}

.fixture-card.selected {
  border-color: rgba(50, 209, 124, 0.55);
  background:
    linear-gradient(165deg, rgba(50, 209, 124, 0.08) 0%, transparent 55%),
    var(--surface-color);
}

.fixture-card.used {
  opacity: 0.5;
  filter: grayscale(1);
}

.fixture-card.ineligible {
  opacity: 0.5;
}

.fixture-kickoff {
  text-align: center;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--border-color);
}

.team-selection {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: 12px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  flex: 1;
  border: 1px solid transparent;
  cursor: default;
}

.team-selection.selectable {
  cursor: pointer;
}

.team-selection.selectable:hover {
  background: rgba(255, 255, 255, 0.04);
}

.team-selection.selected-team {
  background: rgba(50, 209, 124, 0.1);
  border-color: rgba(50, 209, 124, 0.4);
}

.team-selection.used {
  opacity: 0.55;
  filter: grayscale(0.8);
}

.selected-marker {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-green);
  text-transform: uppercase;
  white-space: nowrap;
}

.vs-badge {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.leaderboard-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-table tr.current-user {
  background: rgba(50, 209, 124, 0.06);
  box-shadow: inset 3px 0 0 var(--accent-green);
}

.leaderboard-scroll {
  width: 100%;
  overflow-x: auto;
}

.historical-leaderboard th,
.historical-leaderboard td {
  min-width: 140px;
  white-space: nowrap;
  vertical-align: middle;
}

.historical-leaderboard .sticky-username {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 180px;
  background: var(--surface-color);
}

.historical-leaderboard thead .sticky-username {
  z-index: 3;
  background: var(--surface-alt);
}

.historical-leaderboard tr.current-user .sticky-username {
  background: #143024;
}

.history-pick-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.history-points {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
}

.next-fixture-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-color);
}

.next-fixture-row:last-child {
  border-bottom: 0;
}

.calendar-trigger {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.modal-content.calendar-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(92vw, 820px);
  max-width: 820px;
  max-height: min(88vh, 900px);
  overflow: hidden;
  padding: 1.25rem 1.5rem 1.5rem;
}

#matchday-calendar-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.calendar-modal-header {
  position: relative;
  flex-shrink: 0;
  margin-bottom: 1rem;
  padding-top: 0.25rem;
  padding-right: 2rem;
}

.calendar-close {
  position: absolute;
  top: 0;
  right: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.calendar-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.calendar-navigation > button {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-navigation > :last-child {
  justify-self: end;
}

.calendar-fixtures {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.calendar-day + .calendar-day {
  margin-top: 1.5rem;
}

.calendar-day h4 {
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.calendar-fixture {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.18);
}

.calendar-fixture-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.calendar-fixture-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.calendar-team {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.calendar-team span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-team-home {
  justify-content: flex-end;
  text-align: right;
}

.calendar-score {
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.empty-team-slot {
  min-height: 112px;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}

@media (max-width: 900px) {
  .matchday-fixtures-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    padding: 1.25rem 1rem;
  }

  .matchday-fixtures-grid {
    grid-template-columns: 1fr;
  }

  .home-brand-name {
    font-size: clamp(3.5rem, 16vw, 4.8rem);
  }

  .home-brand-icon {
    width: clamp(3.5rem, 14vw, 4.8rem);
    height: clamp(3.5rem, 14vw, 4.8rem);
  }

  .home-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .home-section-actions {
    width: 100%;
  }

  .home-section-actions .btn {
    flex: 1;
  }

  .league-top-bar {
    flex-wrap: wrap;
  }

  .league-top-bar-title {
    order: -1;
    width: 100%;
    flex: none;
    white-space: normal;
  }

  .league-top-bar-meta {
    margin-left: auto;
  }

  .pick-tray-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .pick-tray-inner .team-crest-container {
    margin: 0 auto;
  }

  .broadcast-fixture {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .your-matchup-score {
    font-size: 1.5rem;
  }

  .match-centre-heading {
    flex: 1;
  }

  .next-fixture-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .modal-content.calendar-modal {
    padding: 1rem 1.1rem 1.25rem;
    max-height: 92vh;
  }

  .calendar-modal-header {
    padding-right: 1.75rem;
  }

  .calendar-navigation {
    grid-template-columns: 1fr 1fr;
  }

  .calendar-navigation > .text-center {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .calendar-navigation > button {
    grid-row: 2;
    font-size: 0.75rem;
    justify-self: stretch;
    width: 100%;
  }

  .calendar-navigation > :last-child {
    justify-self: stretch;
  }

  .calendar-fixture-teams {
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    gap: 0.5rem;
  }

  .calendar-team {
    flex-direction: column;
    text-align: center;
    gap: 0.35rem;
  }

  .calendar-team-home {
    flex-direction: column-reverse;
    justify-content: center;
  }
}
