/*
  styles.css — Consolidated CSS (Phase 1)
  ------------------------------------------------------------
  Purpose: Begin consolidation of multiple CSS files into a single
  industry-standard bundle. This initial phase merges:
    1) variables.css (design tokens)
    2) fonts.css (@font-face declarations)
    3) base.css (reset, base elements, utilities)
    4) unified-spacing.css (layout spacing system)

  Next phases will merge components, page-specific styles, responsive
  rules, and utilities, followed by removing the remaining individual
  CSS links from HTML once visual parity is validated.
*/

/* ===================== 1) CSS VARIABLES ===================== */
/* Source: css/variables.css */
:root {
  /* Official FPL Colors */
  --primary-color: #37003c; /* Official FPL Purple */
  --secondary-color: #00ff87; /* FPL Green (slightly adjusted from #00ff85) */
  --accent-color: #5bbad5; /* Official FPL Teal/Cyan */

  /* Background Colors */
  --background-color: #f8f9fa; /* Softer gray, closer to FPL */
  --card-background: #fff; /* Pure white like FPL */

  /* Text Colors */
  --text-color: #212529; /* Slightly darker for better contrast */
  --heading-color: #37003c; /* Use primary color for headings */
  --text-muted: #666; /* Increased contrast for WCAG AA compliance */

  /* Layout */
  --border-radius: var(--radius-lg); /* More conservative radius like FPL */
  --light-gray: #f1f3f4; /* For subtle backgrounds */
  --border-color: #e9ecef; /* For subtle borders */

  /* Standardized Spacing System */
  --spacing-xs: 4px; /* Tiny elements, tight spacing */
  --spacing-sm: 8px; /* Small components, compact spacing */
  --spacing-md: 16px; /* Standard spacing, most common */
  --spacing-lg: 24px; /* Large spacing, section separation */
  --spacing-xl: 32px; /* Extra large spacing, major sections */

  /* Responsive Spacing Multipliers */
  --spacing-mobile-multiplier: 0.75; /* 75% of desktop spacing on mobile */
  --spacing-tablet-multiplier: 0.875; /* 87.5% of desktop spacing on tablet */

  /* Standardized Border Radius System */
  --radius-sm: 4px; /* Small elements (badges, small buttons) */
  --radius-md: 6px; /* Medium elements (cards, inputs) */
  --radius-lg: 8px; /* Large elements (sections, main containers) */
  --radius-xl: 12px; /* Extra large elements (hero sections) */

  /* Container Sizes */
  --container-max-width: 1200px; /* Increased from 1000px for better screen utilization */
  --container-wide-max-width: 1400px; /* Increased from 1200px for ultra-wide screens */

  /* Breakpoints (for JS reference) */
  --mobile-max: 600px;
  --tablet-max: 1024px;
  --desktop-min: 1025px;

  /* Table Highlight Colors */
  --gold-1: #f9a825; /* Gold for 1st place */
  --silver-1: #9e9e9e; /* Silver for 2nd place */
  --bronze-1: #d4b106; /* Bronze for 3rd place */

  /* Global prize palette — solid fills */
  --gold-solid-bg: #f5c443;
  --gold-solid-text: #2f2300;
  --silver-solid-bg: #e0e0e0;
  --silver-solid-text: #2b2b2b;
  --bronze-solid-bg: #c67c2e;
  --bronze-solid-text: #ffffff;

  /* Global prize palette — translucent/soft fills (for previews/badges) */
  --gold-soft-bg: rgba(245, 196, 67, 0.18);
  --silver-soft-bg: rgba(224, 224, 224, 0.35);
  --bronze-soft-bg: rgba(198, 124, 46, 0.20);

  /* Table Surface Colors */
  --surface: var(--card-background); /* Unified surface color */

  /* Mobile stat box tuning */
  --stat-box-mobile-height: 160px; /* Consistent mobile card height */
  --stat-box-mobile-max: 360px; /* Centered max width for single-column */

  /* Global buttons */
  --btn-height: 42px;
  --btn-radius: 8px;
  --btn-pad-x: 16px;
  --btn-gap: 8px;
  --btn-font-size: 0.95rem;
  --btn-font-weight: 600;
  --btn-shadow: 0 2px 6px rgba(55, 0, 60, 0.15);
  --btn-shadow-hover: 0 6px 12px rgba(55, 0, 60, 0.22);
  --btn-shadow-active: 0 2px 6px rgba(55, 0, 60, 0.18);
  --btn-raise: -2px;
  --btn-press: 1px;
}

/* FIX: mobile sticky header opacity — adaptive backdrop token */
:root {
  --page-backdrop: var(--background-color);
  /* Global table row height scales */
  --row-h-compact: 44px;
  --row-h-cozy: 52px;
  --row-h-comfortable: 60px;
}

/* Respect system dark mode for page backdrop only (non-destructive) */
@media (prefers-color-scheme: dark) {
  :root {
    --page-backdrop: #1f1a1a; /* unified dark backdrop */
  }
}

/* ===================== 2) FONTS ===================== */
/* Source: css/fonts.css */
/* Self-hosted Poppins (latin subset) */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/poppins/poppins-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/poppins/poppins-latin-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/poppins/poppins-latin-700.woff2') format('woff2');
}

/* ===================== 3) RESET & BASE ===================== */
/* Source: css/base.css */
* {
  box-sizing: border-box;
}

body {
  font-family:
    'Poppins',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.7;
  margin: 0;
  background-color: var(--background-color);
  color: var(--text-color);
}

/* FIX: mobile sticky header opacity — solid page background + reduce rubber-band flash */
html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--page-backdrop, var(--background-color));
  overscroll-behavior: none;
}

/* =============== CONTAINER =============== */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: var(--spacing-lg) auto; /* Use spacing variable instead of hardcoded 20px */
  padding: 0 var(--spacing-md); /* Use spacing variable instead of hardcoded 16px */
  /* FIX: mobile sticky header opacity — revert to adaptive/transparent container */
  background-color: transparent;
}

/* Enhanced container for wide screens */
@media (min-width: 1201px) {
  .container {
    max-width: var(--container-wide-max-width);
    padding: 0 var(--spacing-lg); /* Use spacing variable instead of hardcoded 24px */
  }
}

/* =============== UTILITIES =============== */
.is-hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.rounded {
  border-radius: var(--border-radius) !important;
}

/* Screen reader only content */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip Navigation Links */
.skip-navigation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10000;
  background: var(--primary-color);
  padding: 0;
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  padding: var(--spacing-sm) var(--spacing-lg); /* Use spacing variables */
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); /* Use radius variable */
  border: 2px solid var(--secondary-color);
  transition: all 0.2s ease;
}

.skip-link:focus,
.skip-link:active {
  position: static;
  left: auto;
  width: auto;
  height: auto;
  overflow: visible;
  display: inline-block;
  margin: 0 4px 4px 0;
}

.skip-link:hover:focus {
  background: var(--heading-color);
  transform: translateY(1px);
}

/* Ensure skip links appear above everything */
.skip-navigation .skip-link:focus {
  position: relative;
  z-index: 10001;
}

/* Focus management for skip link targets */
#main-content:focus,
#league-statistics:focus,
#registration:focus,
#winners-section:focus,
#leaderboard-section:focus,
#prize-structure:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Make skip link target sections focusable */
#main-content,
#league-statistics,
#registration,
#winners-section,
#leaderboard-section,
#prize-structure {
  scroll-margin-top: 20px; /* Space from top when scrolled to */
}

/* Utility: prevent wrapping for short, important headings */
.nowrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

.muted-small {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.note-small {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* =============== TABLE ALIGNMENT UTILITIES =============== */
/* Use nth-child to avoid touching markup */
.table-align-rank th:nth-child(1),
.table-align-rank td:nth-child(1) {
  text-align: center;
}

.table-align-player th:nth-child(2),
.table-align-player td:nth-child(2) {
  text-align: left;
}

.table-align-prize th:nth-child(3),
.table-align-prize td:nth-child(3) {
  text-align: right;
}

.table-align-points th:nth-child(4),
.table-align-points td:nth-child(4) {
  text-align: right;
}

.table-align-highlights th:nth-child(4),
.table-align-highlights td:nth-child(4) {
  text-align: right;
}

/* =============== MAIN CONTENT =============== */
main {
  padding: 0;
}

main > * {
  margin-bottom: 20px;
}

main > *:last-child {
  margin-bottom: 0;
}

/* =============== SECTIONS =============== */
section {
  background-color: var(--card-background);
  padding: 30px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  width: 100%;
}

/* Shared section card utility for consistent container padding/radius */
.section-card {
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-lg);
  background-color: var(--card-background);
}

h2 {
  color: var(--heading-color);
  border-bottom: 2px solid #f0f2f5;
  padding-bottom: 10px;
  margin-top: 0;
  font-size: 1.35rem; /* Mobile baseline - responsive overrides will handle desktop */
}

/* Desktop h2 sizing to match .winners-heading */
@media (min-width: 768.01px) {
  h2 {
    font-size: 1.8rem;
  }
}

/* Section heading emoji icons should follow global icon sizing */
h2 > span.section-emoji,
h1 > span.section-emoji,
.heading-main > span.section-emoji {
  font-size: var(--icon-size, 1.8rem);
  margin-right: 0.5rem;
}

/* =============== FOOTER =============== */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 20px;
}

/* Unified site timestamp styling */
.site-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
  margin-bottom: 0;
  font-style: italic;
  opacity: 0.85;
}

/* Global Twemoji defaults */
img.emoji,
img.twemoji {
  width: 1em;
  height: 1em;
  vertical-align: -0.1em;
}

/* Season-specific utility classes */
.pre-season {
  margin-bottom: 12px !important;
}

.pre-season:last-of-type {
  margin-bottom: 16px !important;
}

/* ===================== 4) UNIFIED SPACING ===================== */
/* Source: css/unified-spacing.css */
/* =============== UNIFIED SPACING & LAYOUT SYSTEM =============== */
/* Consistent spacing and border radius across all containers and breakpoints */
/* IMPORTANT: This file loads early in cascade to provide consistent foundation */

/* =============== CONSISTENT LAYOUT FOUNDATION =============== */
/* Apply consistent spacing now that cascade order is fixed */
main > * {
  margin-bottom: var(--spacing-lg); /* No !important needed with proper cascade */
}

section {
  margin-bottom: var(--spacing-lg); /* No !important needed with proper cascade */
  padding: var(--spacing-xl); /* No !important needed with proper cascade */
}

/* Consistent border radius */
.winner-scorecard,
.season-section,
.league-stats {
  border-radius: var(--radius-lg); /* No !important needed with proper cascade */
}

/* =============== DESKTOP/TABLET STANDARDIZATION (≥769px) =============== */
@media (min-width: 768.01px) {
  /* Main container and section spacing */
  .container {
    margin: var(--spacing-lg) auto; /* 24px top/bottom */
  }

  /* Standardized section spacing */
  main > * {
    margin-bottom: var(--spacing-lg); /* 24px between all sections */
  }

  main > *:last-child {
    margin-bottom: 0; /* Remove last margin */
  }

  /* All sections - consistent padding and radius */
  section {
    padding: var(--spacing-xl); /* 32px internal padding */
    margin-bottom: var(--spacing-lg); /* 24px between sections */
    border-radius: var(--radius-lg); /* 8px corners */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  }

  /* Header standardization */
  .site-header {
    margin-bottom: var(--spacing-lg); /* 24px after header wrapper */
  }
  header {
    margin-bottom: 0; /* spacing handled by .site-header to avoid double gap */
    padding: var(--spacing-xl) var(--spacing-lg); /* 32px vertical, 24px horizontal */
    border-radius: var(--radius-lg); /* 8px corners */
  }

  /* Footer standardization */
  footer {
    margin-top: var(--spacing-xl); /* 32px before footer */
    padding: var(--spacing-lg); /* 24px internal */
  }

  /* Stats row and stat boxes */
  .stats-row {
    gap: var(--spacing-lg); /* 24px between stat boxes */
    margin-bottom: var(--spacing-lg); /* 24px after stats */
  }

  .stat-box {
    padding: var(--spacing-lg) var(--spacing-md); /* 24px vertical, 16px horizontal */
    border-radius: var(--radius-lg); /* 8px corners */
  }

  /* Winner cards standardization */
  .winner-preview {
    gap: var(--spacing-md); /* 16px between winner cards */
    margin: var(--spacing-lg) 0; /* 24px top/bottom */
  }

  .winner-card {
    padding: var(--spacing-md); /* 16px internal */
    border-radius: var(--radius-md); /* 6px corners */
  }

  /* Leaderboard table standardization */
  .leaderboard-table {
    border-radius: var(--radius-lg); /* 8px corners */
    margin: var(--spacing-lg) 0; /* 24px top/bottom */
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: var(--spacing-sm) var(--spacing-md); /* 8px vertical, 16px horizontal */
  }

  /* Buttons standardization */
.cta-button,
.view-all-winners,
.btn-primary,
.btn-secondary,
.leaderboard-nav-btn,
.winner-nav-btn,
.btn.nav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  padding: 0 var(--btn-pad-x);
  height: var(--btn-height);
  min-height: var(--btn-height);
  border-radius: var(--btn-radius);
  margin-top: var(--spacing-sm);
  line-height: 1;
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  box-shadow: var(--btn-shadow);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    filter 0.18s ease;
}

/* Secondary button variant: same sizing, neutral style */
.btn-secondary {
  background: #fff;
  color: var(--heading-color);
  border: 1px solid var(--border-color);
}

/* Unified hover/active interactions */
.cta-button:hover,
.view-all-winners:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn.nav-back:hover,
.leaderboard-nav-btn:hover:not(:disabled),
.winner-nav-btn:hover:not(:disabled) {
  transform: translateY(var(--btn-raise));
  box-shadow: var(--btn-shadow-hover);
  filter: brightness(1.03);
}

.cta-button:active,
.view-all-winners:active,
.btn-primary:active,
.btn-secondary:active,
.btn.nav-back:active,
.leaderboard-nav-btn:active:not(:disabled),
.winner-nav-btn:active:not(:disabled) {
  transform: translateY(var(--btn-press));
  box-shadow: var(--btn-shadow-active);
  filter: none;
}

  /* Navigation standardization */
  .leaderboard-navigation {
    gap: var(--spacing-md); /* 16px between nav elements */
    padding: var(--spacing-md) 0; /* 16px top/bottom */
  }

  .leaderboard-nav-btn {
    padding: var(--spacing-sm) var(--spacing-md); /* 8px vertical, 16px horizontal */
    border-radius: var(--radius-sm); /* 4px corners */
  }

  /* Prize cards standardization */
  .prize-summary {
    gap: var(--spacing-md); /* 16px between prize cards */
    margin: var(--spacing-lg) 0; /* 24px top/bottom */
  }

  .prize-card {
    padding: var(--spacing-md); /* 16px internal */
    border-radius: var(--radius-md); /* 6px corners */
  }

  /* Small elements standardization */
  .highlight-badge {
    padding: var(--spacing-xs) var(--spacing-sm); /* 4px vertical, 8px horizontal */
    border-radius: var(--radius-sm); /* 4px corners */
  }
}

/* =============== TABLET OPTIMIZATION (769px - 1024px) =============== */
@media (min-width: 768.01px) and (max-width: 1024px) {
  /* Slightly reduced spacing for tablets */
  .container {
    margin: calc(var(--spacing-lg) * var(--spacing-tablet-multiplier)) auto; /* ~21px */
  }

  section {
    padding: calc(var(--spacing-xl) * var(--spacing-tablet-multiplier)); /* ~28px */
    margin-bottom: calc(var(--spacing-lg) * var(--spacing-tablet-multiplier)); /* ~21px */
  }

  header {
    padding: calc(var(--spacing-xl) * var(--spacing-tablet-multiplier))
      calc(var(--spacing-lg) * var(--spacing-tablet-multiplier)); /* ~28px vertical, ~21px horizontal */
  }
}

/* =============== MOBILE STANDARDIZATION (≤768px) =============== */
@media (max-width: 768px) {
  /* Uniform header/body row heights for leaderboard on mobile */
  .leaderboard-table thead th,
  .leaderboard-table tbody tr {
    height: 44px;
  }
  .leaderboard-table thead th {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .leaderboard-table td {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  /* Mobile container spacing */
  .container {
    margin: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)) auto; /* ~12px */
    padding: 0 calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px horizontal */
  }

  /* Mobile section spacing */
  main > * {
    margin-bottom: calc(
      var(--spacing-md) * var(--spacing-mobile-multiplier)
    ); /* ~12px between sections */
  }

  /* All sections - mobile optimized */
  section {
    padding: calc(var(--spacing-lg) * var(--spacing-mobile-multiplier)); /* ~18px internal */
    margin-bottom: calc(
      var(--spacing-md) * var(--spacing-mobile-multiplier)
    ); /* ~12px between sections */
    border-radius: var(--radius-md); /* 6px corners (slightly smaller) */
  }

  /* Header mobile optimization */
  .site-header {
    margin-bottom: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px after */
  }
  header {
    margin-bottom: 0; /* spacing handled by .site-header */
    padding: calc(var(--spacing-lg) * var(--spacing-mobile-multiplier)); /* ~18px internal */
    border-radius: var(--radius-md); /* 6px corners */
  }

  /* Footer mobile optimization */
  footer {
    margin-top: calc(var(--spacing-lg) * var(--spacing-mobile-multiplier)); /* ~18px before */
    padding: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px internal */
  }

  /* Stats mobile optimization */
  .stats-row {
    gap: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px between */
    margin-bottom: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px after */
  }

  .stat-box {
    padding: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px internal */
    border-radius: var(--radius-md); /* 6px corners */
    /* Enforce consistent mobile height across pages */
    height: var(--stat-box-mobile-height, 160px);
    min-height: auto;
  }

  /* Winner cards mobile optimization */
  .winner-preview {
    gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
    margin: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)) 0; /* ~12px top/bottom */
  }

  .winner-card {
    padding: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px internal */
    border-radius: var(--radius-sm); /* 4px corners */
  }

  /* Leaderboard mobile optimization */
  .leaderboard-table {
    border-radius: var(--radius-md); /* 6px corners */
    margin: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)) 0; /* ~12px top/bottom */
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: calc(var(--spacing-xs) * var(--spacing-mobile-multiplier))
      calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~3px vertical, ~6px horizontal */
  }

  /* Buttons mobile optimization */
  .cta-button,
  .view-all-winners,
  .btn-primary {
    padding: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier))
      calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~6px vertical, ~12px horizontal */
    border-radius: var(--radius-sm); /* 4px corners */
    margin-top: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px top */
  }

  /* Navigation mobile optimization */
  .leaderboard-navigation {
    gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
    padding: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)) 0; /* ~6px top/bottom */
  }

  .leaderboard-nav-btn {
    padding: calc(var(--spacing-xs) * var(--spacing-mobile-multiplier))
      calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~3px vertical, ~6px horizontal */
    border-radius: var(--radius-sm); /* 4px corners */
  }

  /* Prize cards mobile optimization */
  .prize-summary {
    gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
    margin: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)) 0; /* ~12px top/bottom */
  }

  .prize-card {
    padding: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px internal */
    border-radius: var(--radius-sm); /* 4px corners */
  }

  /* Small elements mobile optimization */
  .highlight-badge {
    padding: calc(var(--spacing-xs) * 0.5)
      calc(var(--spacing-xs) * var(--spacing-mobile-multiplier)); /* 2px vertical, ~3px horizontal */
    border-radius: var(--radius-sm); /* 4px corners */
  }
}

/* Global pill (used in tables & cards) */
.pill {
  display: inline-block;
  background: var(--light-gray);
  color: var(--text-color);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.pill .rank { opacity: 0.8; margin-right: 6px; }
.pill-gold { background: var(--gold-solid-bg); color: var(--gold-solid-text); }
.pill-silver { background: var(--silver-solid-bg); color: var(--silver-solid-text); }
.pill-bronze { background: var(--bronze-solid-bg); color: var(--bronze-solid-text); }
.pill-gw { background: var(--secondary-color); color: var(--primary-color); }
.pill-gm { background: #ff6b6b; color: #fff; }

/* =============== ULTRA-COMPACT MOBILE (≤480px) =============== */
@media (max-width: 480px) {
  /* Further reduced spacing for very small screens */
  section {
    padding: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px internal */
    margin-bottom: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
  }

  .stats-row {
    gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
  }

  .winner-preview {
    gap: calc(var(--spacing-xs) * var(--spacing-mobile-multiplier)); /* ~3px between */
  }
}

/* =============== ULTRA-WIDE DESKTOP (≥1401px) =============== */
@media (min-width: 1400.01px) {
  /* Slightly increased spacing for ultra-wide screens */
  .container {
    margin: calc(var(--spacing-xl) * 1.25) auto; /* 40px top/bottom */
  }

  section {
    padding: calc(var(--spacing-xl) * 1.25); /* 40px internal */
    margin-bottom: calc(var(--spacing-xl)); /* 32px between sections */
  }

  header {
    padding: calc(var(--spacing-xl) * 1.25) var(--spacing-xl); /* 40px vertical, 32px horizontal */
  }
}

/* =============== MOBILE LANDSCAPE & SMALL HEIGHT SPACING =============== */

/* Compact spacing for landscape mode on mobile */
@media (orientation: landscape) and (max-height: 480px) {
  .site-header {
    margin-bottom: clamp(8px, 2svh, 16px); /* Reduced gap after header */
  }

  section {
    padding: clamp(8px, 2svh, 16px); /* Much more compact section padding */
    margin-bottom: clamp(6px, 1.5svh, 12px); /* Reduced gaps between sections */
  }

  main > * {
    margin-bottom: clamp(4px, 1svh, 8px); /* Tight spacing in main content */
  }
}

/* General small-height spacing optimizations */
@media (max-height: 560px) {
  .site-header {
    margin-bottom: clamp(8px, 2svh, 16px);
  }

  section {
    padding: clamp(12px, 2.5svh, 20px);
    margin-bottom: clamp(8px, 1.5svh, 16px);
  }
}

/* Ultra-compact for very short screens */
@media (max-height: 400px) {
  .site-header {
    margin-bottom: clamp(4px, 1svh, 8px);
  }

  section {
    padding: clamp(6px, 1.5svh, 12px);
    margin-bottom: clamp(4px, 1svh, 8px);
  }

  main > * {
    margin-bottom: clamp(2px, 0.5svh, 6px);
  }
}

/* ===================== END PHASE 1 MERGE ===================== */

/* ===================== 5) COMPONENTS ===================== */
/* Source: css/components.css */
/* 
 * =============== COMPONENTS.CSS - MASTER SHARED STYLES ===============
 */
:root {
  /* FLEXIBLE DIMENSIONS - Mobile First */
  --box-min-width: 140px;
  --box-max-width: 280px;
  --box-gap: 12px;
  --box-padding: 16px 16px 12px 16px;

  /* TYPOGRAPHY SCALE - Mobile (Compact Spacing) */
  --icon-size: 1.5rem;
  --icon-size-primary: 1.7rem;
  --icon-margin: 4px;

  --number-size: 1.8rem;
  --number-size-primary: 2rem;
  --number-margin: 2px;

  --title-size: 0.85rem;
  --title-size-primary: 0.9rem;

  /* COUNTDOWN STYLING */
  --countdown-text-size: 0.75rem;

  /* VISUAL STYLING */
  --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --box-shadow-primary: 0 4px 12px rgba(55, 0, 60, 0.12);
  --box-shadow-primary-hover: 0 6px 20px rgba(55, 0, 60, 0.18);

  --primary-background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(248, 249, 250, 0.8));
}

@media (min-width: 700.01px) {
  :root {
    --box-min-width: 160px;
    --box-gap: 16px;
    --box-padding: 16px 18px 12px 18px;
    --icon-size: 1.8rem;
    --icon-size-primary: 2rem;
    --icon-margin: 6px;
    --number-size: 2rem;
    --number-size-primary: 2.2rem;
    --number-margin: 4px;
    --title-size: 0.9rem;
    --title-size-primary: 0.95rem;
    --countdown-text-size: 0.85rem;
    --box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  }
}

@media (min-width: 1024.01px) {
  :root {
    --box-min-width: 160px;
    --box-max-width: 280px;
    --box-gap: 16px;
    --box-padding: 18px 20px 16px 20px;
    --icon-size: 2rem;
    --icon-size-primary: 2.3rem;
    --icon-margin: 8px;
    --number-size: 2.2rem;
    --number-size-primary: 2.5rem;
    --number-margin: 6px;
    --title-size: 0.9rem;
    --title-size-primary: 1rem;
    --countdown-text-size: 1rem;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  }

  .stats-row {
    justify-content: space-between;
    gap: 0;
    max-width: none !important;
    margin: 0 !important;
    width: 100%;
  }

  .stat-box {
    flex: 1 1 0;
    margin: 0 8px;
  }
  .stat-box:first-child {
    margin-left: 0;
  }
  .stat-box:last-child {
    margin-right: 0;
  }
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--box-gap);
  justify-content: center;
  align-items: stretch;
  margin-bottom: var(--spacing-lg, 20px);
  width: 100%;
}

@media (max-width: 700px) {
  .stats-row {
    flex-direction: column;
    align-items: center; /* center stacked stat boxes */
  }
  .stat-box {
    width: 100%;
    max-width: var(--stat-box-mobile-max, 360px);
    height: var(--stat-box-mobile-height, 160px);
    min-height: auto;
    margin: 0 auto; /* center within container */
  }
  .stat-box__title {
    margin-bottom: 0;
  }
}

/* Larger mobile: two-column stat layout for compactness */
@media (min-width: 480px) and (max-width: 700px) {
  .stats-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--box-gap);
    align-items: stretch;
    justify-items: stretch;
  }
  .stat-box {
    max-width: none; /* let grid define width */
    margin: 0; /* remove centering margins in 2-col */
    width: 100%;
    height: var(--stat-box-mobile-height, 160px);
  }
}

.stat-box {
  flex: 1 1 0;
  min-width: var(--box-min-width);
  max-width: var(--box-max-width);
  background: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: var(--box-padding);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border: 2px solid transparent;
}

.stat-box__icon {
  font-size: var(--icon-size);
  color: var(--primary-color);
  margin-bottom: var(--icon-margin);
  opacity: 0.9;
}
.stat-box__icon img.emoji,
.stat-box__icon img.twemoji {
  width: var(--icon-size);
  height: auto;
  display: block;
}
.stat-box__icon .emoji-text {
  font-size: var(--icon-size);
  line-height: 1;
}

.stat-box__number {
  font-size: clamp(1.5rem, 4vw, var(--number-size));
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
  margin-bottom: var(--number-margin);
  line-height: 1.1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.stat-box__title {
  font-size: var(--title-size);
  font-weight: 600;
  color: var(--heading-color);
  margin: 0;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Backward compatibility */
.stat-icon {
  font-size: var(--icon-size);
  color: var(--primary-color);
  margin-bottom: var(--icon-margin);
  opacity: 0.9;
}
.stat-title {
  font-size: var(--title-size);
  font-weight: 600;
  color: var(--heading-color);
  margin: 0;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}
.stat-number {
  font-size: clamp(1.5rem, 4vw, var(--number-size));
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
  margin-bottom: var(--number-margin);
  line-height: 1.1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.stat-box--primary {
  box-shadow: var(--box-shadow-primary);
  background: var(--primary-background);
  border-color: transparent;
}
.stat-box--primary:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-primary-hover);
  border-color: var(--primary-color);
}
.stat-box--primary .stat-box__icon {
  font-size: var(--icon-size-primary);
  opacity: 1;
}
.stat-box--primary .stat-box__number {
  font-size: clamp(1.8rem, 4vw, var(--number-size-primary));
  font-weight: 800;
}
.stat-box--primary .stat-box__title {
  font-size: var(--title-size-primary);
  font-weight: 700;
  color: var(--heading-color);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin-cmp 1s linear infinite;
}
@keyframes spin-cmp {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
.error-state {
  padding: 20px;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--radius-lg);
  text-align: center;
  color: #d32f2f;
}
.error-state .fas {
  font-size: 2rem;
  margin-bottom: 16px;
  opacity: 0.8;
}
.error-message {
  font-size: 1rem;
  line-height: 1.5;
  max-width: 400px;
}
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.cta-button {
  display: inline-flex;
  background-color: var(--secondary-color);
  color: var(--primary-color);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
}
.btn-primary .emoji-icon,
.cta-button .emoji-icon,
.view-all-winners .emoji-icon {
  width: 18px;
  height: 18px;
}
.view-all-winners {
  display: inline-flex;
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  text-decoration: none;
  text-align: center;
}

/* ================== Modal (rules) ================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal-overlay.is-hidden { display: none; }
.modal {
  width: min(560px, 92vw);
  max-height: 70vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  padding: 10px; /* create inset so header doesn't touch edges */
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px; /* ultra-compact header */
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  border-radius: var(--radius-md);
  min-height: 70px; /* ensure compact ~70px header on widescreen */
}
.modal-header h3 { margin: 0; font-size: 1.3rem; line-height: 1.1; display: inline-flex; align-items: center; gap: 6px; }
.modal-header .emoji-icon { width: 16px; height: 16px; }
.modal-body { padding: 8px 10px; font-size: 0.95rem; }
.modal-body h4 { margin: 8px 0 4px; color: var(--heading-color); font-size: 0.95rem; }
.modal-body ul { margin: 0 0 6px 0; padding-left: 12px; list-style-position: inside; }
.modal-body li { margin: 4px 0; }
.modal-footer { display: none !important; }
.modal-close { background: transparent; border: none; font-size: 16px; cursor: pointer; color: #fff; }

.prize-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 0;
  background: transparent;
}
@media (min-width: 768.01px) {
  .prize-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
.prize-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--card-background);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}
.prize-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.prize-card .pc-header { display: none; }
.prize-card .pc-line { width: 100%; display: flex; align-items: center; justify-content: center; }
.prize-card .icon-line { display: flex; align-items: center; justify-content: center; gap: 8px; }
.emoji-icon { width: 26px; height: 26px; display: inline-block; vertical-align: middle; }
.prize-card .icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-color), #59215e);
  color: #fff;
  font-size: 1.05rem;
}
.prize-card .pc-label {
  font-weight: 700;
  color: var(--heading-color);
  font-size: 1rem;
  text-align: center;
}
.prize-card .amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  white-space: nowrap;
  text-align: center;
}
.prize-card .breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
}
.prize-card .pill {
  background: var(--light-gray);
  color: var(--text-color);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.prize-card .pill .rank {
  opacity: 0.8;
  margin-right: 6px;
}
/* Rank-themed pills */
.prize-card .pill.pill-gold {
  background: var(--gold-solid-bg);
  color: var(--gold-solid-text);
  border: none;
}
.prize-card .pill.pill-silver {
  background: var(--silver-solid-bg);
  color: var(--silver-solid-text);
  border: none;
}
.prize-card .pill.pill-bronze {
  background: var(--bronze-solid-bg);
  color: var(--bronze-solid-text);
  border: none;
}
.prize-card .more-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--heading-color);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
}
.prize-card .popup-panel {
  position: absolute;
  right: 12px;
  bottom: -8px;
  transform: translateY(100%);
  z-index: 50;
  width: min(360px, 92vw);
  max-height: 50vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
}
.prize-card .popup-panel.open { opacity: 1; visibility: visible; }
.popup-panel .more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
@media (max-width: 480px) { .popup-panel .more-list { grid-template-columns: 1fr; } }
.popup-panel .more-item { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; background:#fff; border:1px solid var(--border-color); border-radius: var(--radius-sm); }

/* ================== Prize card overlays ================== */
.prize-card .overlay-action {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--heading-color);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  z-index: 5;
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.prize-card .overlay-action:hover { background: rgba(55,0,60,0.06); box-shadow: 0 2px 6px rgba(0,0,0,.12); transform: translateY(-1px); }
.prize-card .overlay-action:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.prize-card .overlay-action .emoji-icon { width: 18px; height: 18px; }
.prize-card .overlay-action .dots-icon { font-size: 22px; line-height: 1; font-weight: 700; }
@media (max-width: 480px) { .prize-card .overlay-action { width: 30px; height: 30px; } .prize-card .overlay-action .dots-icon { font-size: 20px; } }

.prize-card .tooltip-panel {
  position: absolute;
  top: 36px; /* just below the icon */
  right: 8px;
  z-index: 60;
  width: min(360px, 92vw);
  max-height: 50vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 150ms ease;
}
.prize-card .tooltip-panel.open { opacity: 1; visibility: visible; }
.tooltip-panel .more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
@media (max-width: 480px) { .tooltip-panel .more-list { grid-template-columns: 1fr; } }
.tooltip-panel .more-item { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; background:#fff; border:1px solid var(--border-color); border-radius: var(--radius-sm); }

/* Mobile fine-tuning to avoid line wrapping */
@media (max-width: 480px) {
  .emoji-icon { width: 22px; height: 22px; }
  .prize-card { gap: 6px; padding: 12px; }
  .prize-card .pc-label { white-space: nowrap; }
  .prize-card .amount { font-size: 1.2rem; }
  .prize-card .breakdown { gap: 6px; }
  .prize-card .pill { padding: 3px 6px; font-size: 0.78rem; }
}
.svg-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  fill: currentColor;
}
.prize-card .icon .svg-icon {
  width: 20px;
  height: 20px;
}
.stat-icon .svg-icon {
  width: 1em;
  height: 1em;
}

/* Table containment helpers */
.table-scroll,
.card-table {
  overflow: hidden;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table,
.card-table table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  background: transparent;
}
.table-scroll thead th,
.card-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-scroll thead th:first-child {
  border-top-left-radius: var(--radius-md);
}
.table-scroll thead th:last-child {
  border-top-right-radius: var(--radius-md);
}
.table-scroll .leaderboard-table thead th,
.table-scroll .winner-table thead th {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
}
.table-scroll tbody tr,
.card-table tbody tr {
  position: relative;
  background-clip: padding-box;
}
.table-scroll tbody tr.highlight-top1,
.table-scroll tbody tr.winner-gold {
  box-shadow: inset 4px 0 0 var(--gold-1);
  background: linear-gradient(145deg, #fffbf0, #fff8e1);
}
.table-scroll tbody tr.highlight-top2,
.table-scroll tbody tr.winner-silver {
  box-shadow: inset 4px 0 0 var(--silver-1);
  background: linear-gradient(145deg, #f8f9fa, #f1f3f4);
}
.table-scroll tbody tr.highlight-top3,
.table-scroll tbody tr.winner-bronze {
  box-shadow: inset 4px 0 0 var(--bronze-1);
  background: linear-gradient(145deg, #fef7e0, #fff3cd);
}

@media (min-width: 768.01px) {
  .prize-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768.01px) and (max-width: 1024px) {
  .prize-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}
@media (min-width: 1024.01px) {
  .prize-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .stats-row > .stat-box .stat-box__icon,
  .stats-row > .stat-box .stat-icon {
    font-size: var(--icon-size);
  }
  .stats-row > .stat-box .stat-box__title,
  .stats-row > .stat-box .stat-title {
    font-size: var(--title-size);
    line-height: 1.2;
  }
  .stats-row > .stat-box .stat-box__number,
  .stats-row > .stat-box .stat-number {
    font-size: clamp(1.5rem, 4vw, var(--number-size));
  }
  .stats-row > .stat-box {
    padding: var(--box-padding);
  }
}
@media (min-width: 768.01px) and (max-width: 1024px) {
  .stats-row > .stat-box .stat-box__number,
  .stats-row > .stat-box .stat-number {
    font-size: var(--number-size);
  }
  .stats-row > .stat-box.stat-box--primary .stat-box__number {
    font-size: var(--number-size-primary);
  }
}

/* ===================== 6) HEADER COMPONENT ===================== */
/* Source: css/header.css */
:root {
  --header-bg: var(--page-backdrop);
  --safe-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --header-bg: #0d0815;
  }
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--header-bg);
  padding-top: calc(8px + var(--safe-top));
  padding-bottom: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
  /* Progressive auto-hide via JS-updated CSS variables */
  transform: translateY(calc(-1 * var(--header-offset, 0px)));
  will-change: transform;
}
.header-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0;
  /* Optional fade as header hides */
  opacity: var(--header-opacity, 1);
}
header {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  text-align: center;
  padding: clamp(12px, 4svh, 50px) clamp(8px, 2vw, 20px);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2svh, 20px);
  flex-wrap: wrap;
  position: relative;
  width: 100%;
  background-clip: padding-box;
  min-height: clamp(64px, 16svh, 140px);
}
.header-main {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
header h1 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 2.5rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
header p {
  margin: 5px 0 0;
  font-size: clamp(0.8rem, 3vw, 1.1rem);
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.countdown-clock {
  flex: 0 0 auto;
  max-width: 300px;
  width: auto;
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 15px 20px;
  border: 2px solid rgba(91, 186, 213, 0.4);
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.1),
    0 0 20px rgba(91, 186, 213, 0.3);
  text-align: center;
  animation: pulseBorder 3s infinite;
}
.countdown-clock.is-hidden {
  display: block !important;
  visibility: hidden;
}
@keyframes pulseBorder {
  0%,
  100% {
    border-color: rgba(91, 186, 213, 0.4);
    box-shadow:
      0 4px 15px rgba(0, 0, 0, 0.1),
      0 0 20px rgba(91, 186, 213, 0.3);
  }
  50% {
    border-color: rgba(91, 186, 213, 0.7);
    box-shadow:
      0 4px 15px rgba(0, 0, 0, 0.1),
      0 0 30px rgba(91, 186, 213, 0.5);
  }
}
.countdown-label {
  font-size: var(--countdown-text-size, 1rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  opacity: 0.9;
  animation: flash 2s infinite;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
@keyframes flash {
  0%,
  50% {
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
  25%,
  75% {
    opacity: 0.7;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
  }
}
.countdown-time {
  font-family: 'Courier New', monospace;
  font-size: var(--countdown-text-size, 1rem);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--secondary-color);
  text-shadow: 0 0 8px rgba(0, 255, 133, 0.4);
  line-height: 1.1;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  margin-top: 5px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  text-align: center;
  gap: 0;
}
.countdown-separator.is-hidden,
.countdown-unit-label.is-hidden {
  display: none !important;
}
.countdown-time.live-mode {
  display: block !important;
  text-align: center !important;
}
.countdown-time.live-mode .countdown-unit:not(:first-child),
.countdown-time.live-mode .countdown-separator {
  display: none !important;
}
.countdown-time.live-mode .countdown-unit:first-child {
  width: 100%;
  text-align: center;
  display: block;
}
#countdown-days {
  font-size: 1em;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
  display: inline-block;
}
.countdown-separator {
  animation: pulse 1s infinite;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
  font-family: 'Courier New', monospace;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.countdown-unit {
  display: inline-flex;
  min-width: 0;
  text-align: left;
  line-height: 1;
  margin: 0;
  padding: 0;
  align-items: baseline;
}
.countdown-unit-label {
  font-family: 'Courier New', monospace;
  font-size: 1em;
  font-weight: inherit;
  text-transform: uppercase;
  letter-spacing: 0;
  opacity: 0.9;
  margin-left: 0;
  display: inline-block;
  vertical-align: baseline;
}
.sync-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #c8e6c9;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 250ms ease;
}
.sync-badge.show {
  opacity: 1;
}
.admin-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
  border-radius: 999px;
}
@media (max-width: 480px) {
  .site-header {
    padding-top: calc(6px + var(--safe-top));
    padding-bottom: 0;
  }
  .header-inner {
    padding: 0;
  }
}
@media (min-width: 1024.01px) {
  .site-header header .countdown-clock {
    max-width: 300px;
  }
}
@media (max-width: 600px) {
  .site-header header .countdown-clock {
    max-width: 200px;
  }
}
.page-scroll {
  overscroll-behavior-y: contain;
}
@media (orientation: landscape) and (max-height: 480px) {
  .site-header {
    padding-block: clamp(4px, 1svh, 8px);
  }
  header {
    padding: clamp(6px, 2svh, 16px) clamp(8px, 2vw, 16px);
    min-height: clamp(56px, 12svh, 88px);
    gap: clamp(6px, 1.5svh, 12px);
  }
  .header-main {
    gap: clamp(4px, 1svh, 8px);
  }
  header h1,
  header p {
    line-height: 1.1;
  }
  header p {
    display: none;
  }
  .countdown-clock {
    transform: scale(0.95);
    padding: clamp(8px, 1.5svh, 12px) clamp(10px, 2vw, 15px);
  }
}
@media (max-height: 560px) {
  header {
    min-height: clamp(56px, 16svh, 96px);
    padding-block: clamp(8px, 2svh, 16px);
  }
  .site-header {
    padding-block: clamp(4px, 1svh, 6px);
  }
  .countdown-clock {
    padding: clamp(8px, 1.5svh, 12px) clamp(10px, 2vw, 15px);
  }
}
@media (max-height: 400px) {
  .site-header {
    padding-block: 2px;
  }
  header {
    padding: clamp(4px, 1.5svh, 8px) clamp(6px, 1.5vw, 12px);
    min-height: clamp(48px, 10svh, 64px);
    gap: clamp(4px, 1svh, 8px);
  }
  header p {
    display: none;
  }
  .countdown-clock {
    transform: scale(0.9);
    padding: clamp(6px, 1svh, 8px) clamp(8px, 1.5vw, 12px);
  }
}

/* Respect accessibility preference to reduce motion */
@media (prefers-reduced-motion: reduce) {
  .site-header {
    transform: none !important;
  }
  .header-inner {
    opacity: 1 !important;
  }
}

/* ===================== 7) PAGE STYLES ===================== */
/* Source: css/winners.css */
.muted {
  color: #6b7280;
  font-size: 12px;
}
.winner-scorecard {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  padding: 30px;
  margin-bottom: 20px;
}
.winner-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.winner-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--secondary-color);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  position: relative;
}

.winner-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.winner-card.rank-1 {
  background: linear-gradient(145deg, #fffbf0, #fff8e1);
  border-left-color: #f9a825;
  box-shadow: 0 2px 10px rgba(249, 168, 37, 0.15);
}
.winner-card.rank-1:hover {
  box-shadow: 0 4px 15px rgba(249, 168, 37, 0.25);
}
.winner-card.rank-2 {
  background: linear-gradient(145deg, #f8f9fa, #f1f3f4);
  border-left-color: #9e9e9e;
  box-shadow: 0 2px 10px rgba(158, 158, 158, 0.15);
}
.winner-card.rank-2:hover {
  box-shadow: 0 4px 15px rgba(158, 158, 158, 0.25);
}
.winner-card.rank-3 {
  background: linear-gradient(145deg, #fef7e0, #fff3cd);
  border-left-color: #d4b106;
  box-shadow: 0 2px 10px rgba(212, 177, 6, 0.15);
}
.winner-card.rank-3:hover {
  box-shadow: 0 4px 15px rgba(212, 177, 6, 0.25);
}
.winner-rank {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
}
.winner-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 12px;
  margin-top: 0;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Clamp long names to two lines to keep highlights close to prize */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.winner-prize {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
}
.winner-highlights {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
}
.highlight-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.highlight-badge.soft-gold { background: var(--gold-soft-bg); color: var(--gold-solid-text); }
.highlight-badge.soft-silver { background: var(--silver-soft-bg); color: var(--silver-solid-text); }
.highlight-badge.soft-bronze { background: var(--bronze-soft-bg); color: var(--bronze-solid-text); }
.highlight-badge.gw {
  background: var(--secondary-color);
  color: var(--primary-color);
}
.highlight-badge.gm {
  background: #ff6b6b;
  color: #fff;
}
.winner-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}
.winner-error {
  text-align: center;
  padding: 40px;
  color: #d32f2f;
  background: #ffebee;
  border-radius: var(--radius-lg);
  margin-top: 20px;
}
.winner-summary {
  text-align: center;
  margin-top: 15px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.section-heading .heading-subtitle {
  font-weight: 400;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}
.section-heading .heading-subtitle.show {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .section-heading .heading-subtitle,
  .section-heading .heading-subtitle.show {
    transition: none;
    transform: none;
  }
}

/* Source: css/leaderboard.css */
.leaderboard-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}
.leaderboard-table {
  width: 100%;
  min-width: 560px;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  font-variant-numeric: tabular-nums;
}
.leaderboard-rank {
  position: relative;
  overflow: hidden;
}
.leaderboard-table th {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
}
.leaderboard-table th:nth-child(1) {
  width: 80px;
  text-align: center;
}
.leaderboard-table th:nth-child(2) {
  text-align: left;
}
.leaderboard-table th:nth-child(3) {
  text-align: right;
  width: 140px;
}
.leaderboard-table th:nth-child(4) {
  text-align: right;
  width: 110px;
}
.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}
.leaderboard-table tbody tr {
  height: 56px;
}
.leaderboard-table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}
.leaderboard-table tbody tr:nth-child(odd) {
  background-color: #fff;
}
.leaderboard-table tbody tr:hover {
  background-color: #e3f2fd !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}
.leaderboard-rank {
  text-align: center;
  font-weight: 700;
  color: var(--primary-color);
  width: 80px;
}
.leaderboard-rank.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #8b4513;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.leaderboard-rank.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #808080);
  color: #2f4f4f;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.leaderboard-rank.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: #fff;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.leaderboard-table th.col-rank {
  white-space: nowrap;
  text-overflow: clip;
  overflow: visible;
  letter-spacing: 0;
}
.leaderboard-table td.col-rank {
  white-space: nowrap;
}
.leaderboard-player {
  font-weight: 600;
  color: var(--heading-color);
  text-align: left;
}
.leaderboard-prize {
  text-align: right;
  font-weight: 700;
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
}
.leaderboard-score {
  text-align: right;
  font-weight: 700;
  color: #333;
  font-variant-numeric: tabular-nums;
}
.leaderboard-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 15px 0;
}
.leaderboard-nav-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
  min-width: 96px;
}
.leaderboard-nav-btn:hover:not(:disabled) {
  background: var(--heading-color);
}
.leaderboard-nav-btn:disabled {
  background: #e0e0e0;
  color: #555;
  cursor: not-allowed;
}
.leaderboard-nav-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
.page-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Source: css/winners-specific.css */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}
.summary-card {
  background: #fff;
  padding: 25px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border: 2px solid transparent;
}
.summary-card.primary-metric {
  box-shadow: 0 6px 20px rgba(55, 0, 60, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(248, 249, 250, 0.8));
}
.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: var(--secondary-color);
}
.summary-card.primary-metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(55, 0, 60, 0.18);
  border-color: var(--primary-color);
}
.summary-icon {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 12px;
  opacity: 0.8;
}
.summary-card.primary-metric .summary-icon {
  font-size: 2.2rem;
  opacity: 1;
}
.summary-number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
}
.summary-card.primary-metric .summary-number {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.summary-label {
  color: #666;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-card.primary-metric .summary-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: 0.6px;
}
.winner-table {
  width: 100%;
  min-width: 560px;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 20px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  font-variant-numeric: tabular-nums;
}
.winner-table th {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
}
.winner-table th:nth-child(1) {
  width: 8%;
  text-align: center;
  min-width: 60px;
}
.winner-table th:nth-child(2) {
  width: 25%;
  text-align: left;
  min-width: 150px;
}
.winner-table th:nth-child(3) {
  width: 15%;
  text-align: right;
  min-width: 100px;
}
.winner-table th:nth-child(4) {
  width: 52%;
  text-align: right;
  min-width: 200px;
}
.winner-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}
.winner-table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}
.winner-table tbody tr:nth-child(odd) {
  background-color: #fff;
}
.winner-table tbody tr:hover {
  background-color: #e3f2fd !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.winner-table td:nth-child(1) {
  text-align: center;
  font-weight: 600;
}
.winner-table td:nth-child(2) {
  text-align: left;
}
.winner-table td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.winner-table td:nth-child(4) {
  text-align: right;
}
.winner-table tr:last-child td {
  border-bottom: none;
}
.player-name {
  font-weight: 600;
  color: var(--heading-color);
}
.prize-amount {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.1rem;
}
.highlights {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.highlight-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s ease;
}
.highlight-badge:hover {
  transform: translateY(-1px);
}
.highlight-badge.gw {
  background: var(--secondary-color);
  color: var(--primary-color);
}
.highlight-badge.gm {
  background: #ff6b6b;
  color: #fff;
}
.winner-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.winner-nav-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--btn-gap);
}
.winner-nav-btn:hover:not(:disabled) {
  background: var(--heading-color);
}
.winner-nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.winner-nav-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
.page-info {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .stats-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .summary-card {
    padding: 18px 12px;
  }
  .summary-card.primary-metric {
    padding: 22px 15px;
  }
  .summary-icon {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }
  .summary-card.primary-metric .summary-icon {
    font-size: 1.8rem;
    margin-bottom: 10px;
  }
  .summary-number {
    font-size: 1.6rem;
  }
  .summary-card.primary-metric .summary-number {
    font-size: 2.2rem;
  }
  .summary-label {
    font-size: 0.75rem;
    font-weight: 600;
  }
}

/* ===================== 8) QA PANEL, ERROR, ENHANCEMENTS ===================== */
/* Source: css/qa-panel.css */
.qa-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  background: #1f1f1f;
  color: #eaeaea;
  border: 1px solid #444;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  line-height: 1.4;
  backdrop-filter: saturate(120%) blur(2px);
}
.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.qa-toggle {
  background: transparent;
  color: #eee;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.qa-toggle:hover {
  background: #2a2a2a;
}
.qa-panel h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}
.qa-info {
  margin: 0;
  padding: 0;
}
.qa-kv {
  margin: 6px 0;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}
.qa-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.qa-btn {
  background: #333;
  color: #eee;
  border: 1px solid #555;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
}
.qa-btn:hover {
  background: #444;
}

/* Collapsed state */
.qa-panel.is-collapsed {
  padding: 8px 10px;
  max-width: 180px;
}
.qa-panel.is-collapsed .qa-info,
.qa-panel.is-collapsed .qa-actions {
  display: none;
}
.qa-panel.is-collapsed .qa-toggle {
  aria-expanded: false;
}
.floating-toggle {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 9999;
  background: #1f1f1f;
  color: #eaeaea;
  border: 1px solid #444;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.floating-toggle button {
  background: transparent;
  color: inherit;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

/* Source: css/error-handling.css */
.error-handler-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 2rem;
  color: #666;
  text-align: center;
}
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.error-handler-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  background-color: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--border-radius);
  color: #c53030;
}
.error-icon {
  font-size: 2rem;
  opacity: 0.8;
}
.error-message {
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 400px;
}
.error-message small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.8;
}
.error-retry-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.error-retry-btn:hover:not(:disabled) {
  background: var(--heading-color);
  transform: translateY(-1px);
}
.error-retry-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}
.error-fallback {
  margin-top: 1rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #4a5568;
}
.network-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideDown 0.3s ease-out;
}
.network-banner.offline {
  background: #fed7d7;
  color: #c53030;
  border-bottom: 1px solid #feb2b2;
}
.network-banner.online {
  background: #c6f6d5;
  color: #2f855a;
  border-bottom: 1px solid #9ae6b4;
}
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.error-boundary {
  min-height: 100px;
  position: relative;
}
.winner-loading .error-handler-loading,
.leaderboard-loading .error-handler-loading {
  min-height: 200px;
}
.winner-error .error-handler-error,
.leaderboard-error .error-handler-error {
  min-height: 150px;
  margin: 1rem 0;
}
.stat-box .error-handler-error {
  background: transparent;
  border: none;
  padding: 1rem 0;
  color: #999;
}
.stat-box .error-icon {
  font-size: 1.5rem;
}
.stat-box .error-message {
  font-size: 0.8rem;
  max-width: 200px;
}
.stat-box .error-retry-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}
.error-compact .error-handler-error {
  padding: 1rem;
  gap: 0.5rem;
}
.error-compact .error-icon {
  font-size: 1.2rem;
}
.error-compact .error-message {
  font-size: 0.85rem;
}
.error-compact .error-retry-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}
@media (max-width: 600px) {
  .error-handler-error {
    padding: 1.5rem 1rem;
    gap: 0.75rem;
  }
  .error-message {
    font-size: 0.9rem;
  }
  .error-retry-btn {
    width: 100%;
    padding: 1rem 1.5rem;
  }
  .network-banner {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }
}
@media (prefers-color-scheme: dark) {
  .error-handler-loading {
    color: #a0aec0;
  }
  .loading-spinner {
    border-color: #4a5568;
    border-top-color: var(--primary-color);
  }
  .error-handler-error {
    background-color: #2d3748;
    border-color: #e53e3e;
    color: #feb2b2;
  }
  .error-fallback {
    background: #2d3748;
    color: #cbd5e0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    border-top-color: var(--primary-color);
  }
  .network-banner {
    animation: none;
  }
  .error-retry-btn:hover {
    transform: none;
  }
}
.error-retry-btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}
@media print {
  .network-banner,
  .error-handler-loading,
  .error-retry-btn {
    display: none;
  }
  .error-handler-error {
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
  }
}

/* Source: css/countdown-enhancements.css */
.countdown-hero-mode {
  color: #fff;
  padding: 20px;
  border-radius: 8px;
}
.countdown-hero-mode .countdown-mega {
  text-align: center;
}
.countdown-hero-mode .countdown-label {
  font-weight: 800;
  letter-spacing: 1px;
}
.countdown-hero-mode .countdown-time {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  margin-top: 6px;
}
.countdown-hero-mode .countdown-urgent-message {
  margin-top: 10px;
  text-align: center;
}
.countdown-alert {
  background: linear-gradient(135deg, #1976d2, #0d47a1);
}
.countdown-warning {
  background: linear-gradient(135deg, #fb8c00, #ef6c00);
}
.countdown-critical {
  background: linear-gradient(135deg, #e53935, #b71c1c);
}

/* ===================== GLOBAL HEADING SYSTEM ===================== */
/* Ensure section titles and subtitles follow the unified pattern */
.section-heading {
  display: block;
  margin: 0 0 0.5rem 0;
}
.section-heading .heading-main {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0;
}
.section-heading .heading-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}
@media (min-width: 768.01px) {
  .section-heading .heading-main {
    font-size: 1.8rem;
  }
  .section-heading .heading-subtitle {
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 4px;
  }
}
/* Legacy support */
.section-title .subtitle,
.heading-subtitle,
.section-desc {
  color: var(--text-muted);
  font-weight: 400;
}

/* Winners description row with back button (desktop/tablet default) */
.winners-descrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--spacing-xs) 0 var(--spacing-sm);
  gap: var(--spacing-sm);
}

/* ===================== ACCESSIBLE TOOLTIP ===================== */
.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: help;
}
.tooltip .tooltip-content {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 50;
  background: #111;
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  line-height: 1.4;
  display: none;
}
.tooltip:focus .tooltip-content,
.tooltip:hover .tooltip-content {
  display: block;
}
.tooltip:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}
.tooltip .tooltip-arrow {
  position: absolute;
  top: -6px;
  left: 12px;
  width: 10px;
  height: 10px;
  background: #111;
  transform: rotate(45deg);
}
@media (max-width: 600px) {
  .tooltip .tooltip-content {
    left: 0;
    right: auto;
    max-width: 90vw;
  }
}

/* ===================== NAVIGATION BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition:
    background-color 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
  border: none;
  line-height: 1;
}
.btn.nav-back {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  border: 0;
  font-size: 0.9rem;
}
.btn.nav-back:hover {
  filter: brightness(1.03);
}
.btn.nav-back.nav-back--sm {
  font-size: 0.9rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
}
@media (max-width: 768px) {
  .winners-descrow {
    display: block;
  }
  .winners-descrow .btn.nav-back.nav-back--sm {
    width: 100%;
    margin-top: var(--spacing-sm);
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
  }
}

/* ===================== 9) RESPONSIVE ===================== */
/* Source: css/responsive.css */
/* Wide screens */
@media (min-width: 1201px) {
  header {
    padding: 40px;
    justify-content: space-between;
    align-items: center;
  }
  .container {
    max-width: var(--container-wide-max-width);
  }
  .header-main {
    flex: 1 1 auto;
    text-align: center;
    padding-right: 20px;
  }
  .countdown-clock {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

/* Tablets and medium screens */
@media (max-width: 1024px) and (min-width: 768.01px) {
  header h1 {
    font-size: clamp(1.3rem, 3.5vw, 2rem);
    letter-spacing: -0.3px;
  }
  header p {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
  }
  .header-main {
    flex: 1 1 60%;
    text-align: center;
  }
  .countdown-clock {
    flex: 0 0 auto;
    max-width: 250px;
    margin-left: auto;
  }
}

/* Small tablets */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .header-main {
    width: 100%;
  }
  .countdown-clock {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }
}

/* Specific fix for iPad Air, Surface Pro (820-950px) */
@media (min-width: 820px) and (max-width: 950px) {
  header {
    padding: 30px 15px;
  }
  header h1 {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
  }
  header p {
    font-size: 0.9rem;
  }
  .countdown-clock {
    padding: 12px 15px;
  }
}

/* Mobile devices */
@media (max-width: 600px) {
  .container {
    padding: 0 12px;
  }
  header {
    padding: clamp(16px, 3svh, 24px) clamp(8px, 2vw, 12px);
    flex-direction: column;
    gap: clamp(12px, 2.5svh, 18px);
    min-height: clamp(80px, 16svh, 120px);
  }
  .header-main {
    width: 100%;
  }
  header h1 {
    font-size: clamp(1rem, 5vw, 1.6rem);
  }
  header p {
    font-size: clamp(0.8rem, 3.5vw, 1rem);
  }
  main > * {
    margin-bottom: 12px;
  }
  section {
    padding: 16px;
  }
  h2 {
    font-size: 1.5rem;
  }
  .stats-row {
    flex-direction: column;
    gap: 16px;
  }
  .countdown-clock {
    max-width: 200px;
    padding: 12px 15px;
  }
  .winner-preview {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .winner-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    min-height: unset;
  }
  .winner-card.rank-1 {
    background: linear-gradient(145deg, #fff9e6, #ffecb3) !important;
    border: 2px solid #f57c00 !important;
    border-left: 5px solid #f57c00 !important;
    box-shadow: 0 3px 12px rgba(245, 124, 0, 0.25) !important;
  }
  .winner-card.rank-2 {
    background: linear-gradient(145deg, #f5f5f5, #e0e0e0) !important;
    border: 2px solid #757575 !important;
    border-left: 5px solid #757575 !important;
    box-shadow: 0 3px 12px rgba(117, 117, 117, 0.25) !important;
  }
  .winner-card.rank-3 {
    background: linear-gradient(145deg, #fff3e0, #ffe0b2) !important;
    border: 2px solid #ff8f00 !important;
    border-left: 5px solid #ff8f00 !important;
    box-shadow: 0 3px 12px rgba(255, 143, 0, 0.25) !important;
  }
  .winner-rank {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--primary-color);
    line-height: 1;
  }
  .winner-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
    color: var(--heading-color);
    /* Keep clamp on mobile as well */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .winner-prize {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary-color);
    line-height: 1;
  }
  .winner-highlights {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
    justify-content: flex-end;
  }
  .highlight-badge {
    padding: 2px 6px;
    border-radius: var(--radius-lg);
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
  }
  .season-section .winner-preview .winner-card:nth-child(n + 7) {
    display: none;
  }
  .leaderboard-table {
    font-size: 0.86rem;
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: auto;
  }
  .leaderboard-table thead {
    display: table-header-group;
  }
  .leaderboard-table thead th {
    font-size: 0.8rem;
    padding: 8px 8px;
    line-height: 1.15;
    white-space: normal;
    word-break: keep-all;
    min-height: 40px;
    position: relative;
    padding-right: 0.6rem;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .leaderboard-table thead th.col-rank {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    letter-spacing: 0;
  }
  .leaderboard-table td {
    white-space: nowrap;
    vertical-align: middle;
    padding: 8px 8px;
  }
  .leaderboard-table thead th:nth-child(1),
  .leaderboard-table tbody td:nth-child(1) {
    text-align: center;
  }
  .leaderboard-table thead th:nth-child(3),
  .leaderboard-table tbody td:nth-child(3),
  .leaderboard-table thead th:nth-child(4),
  .leaderboard-table tbody td:nth-child(4) {
    text-align: right;
  }
  .leaderboard-table .leaderboard-player {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .leaderboard-navigation {
    flex-direction: row;
    gap: 10px;
    padding: 10px 0;
  }
  .leaderboard-nav-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    min-height: 40px;
    min-width: 84px;
  }
  .page-info {
    font-size: 0.9rem;
    order: 2;
  }
  .cta-button {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 255, 133, 0.2);
  }
  .cta-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 133, 0.3);
  }
  .view-all-winners {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(93, 33, 99, 0.2);
  }
  .view-all-winners:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(93, 33, 99, 0.3);
  }
}

@media (max-width: 375px) {
  .leaderboard-table .leaderboard-player {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
  }
  .leaderboard-table col:nth-child(3) {
    width: 7ch !important;
  }
  .leaderboard-table col:nth-child(4) {
    width: 5.5ch !important;
  }
  .leaderboard-table thead th {
    font-size: 0.75rem;
    padding: 6px 6px;
  }
  .leaderboard-table th.col-rank,
  .leaderboard-table td.col-rank {
    width: 4.75ch;
  }
}

/* Ultra-narrow stacked layout and other utilities omitted here for brevity in consolidation. Full behavior retained from source files. */

/* Winners table headers: allow wrapping on narrow screens too */
@media (max-width: 600px) {
  .winner-table thead th {
    font-size: 0.8rem;
    padding: 8px 10px;
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
    min-height: 40px;
  }
}

/* Mobile CTA unification: same size, radius, font, and full-width layout */
@media (max-width: 600px) {
  .btn-primary,
  .btn-secondary,
  .cta-button,
  .view-all-winners,
  .leaderboard-nav-btn,
  .winner-nav-btn,
  .btn.nav-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    width: 100%;
    height: var(--btn-height);
    min-height: var(--btn-height);
    border-radius: var(--btn-radius);
    padding: 0 var(--btn-pad-x);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    box-shadow: var(--btn-shadow);
    margin-top: var(--spacing-sm);
  }
}

/* Final countdown standardization from responsive.css */
@media (min-width: 1024.01px) {
  .site-header header .countdown-clock {
    max-width: 300px;
  }
  .site-header header .countdown-label {
    font-size: 1rem;
  }
  .site-header header .countdown-time {
    font-size: 0.85rem;
  }
  .site-header header .countdown-unit {
    min-width: 0 !important;
  }
  .site-header header #countdown-days,
  .site-header header #countdown-hours,
  .site-header header #countdown-minutes {
    font-size: 1em;
  }
}
@media (min-width: 600.01px) and (max-width: 1024px) {
  .site-header header .countdown-clock {
    max-width: 250px;
  }
  .site-header header .countdown-label {
    font-size: 0.9rem;
  }
  .site-header header .countdown-time {
    font-size: 0.8rem;
  }
  .site-header header .countdown-unit {
    min-width: 0 !important;
  }
  .site-header header #countdown-days,
  .site-header header #countdown-hours,
  .site-header header #countdown-minutes {
    font-size: 1em;
  }
}
@media (max-width: 600px) {
  .site-header header .countdown-clock {
    max-width: 200px;
  }
  .site-header header .countdown-label,
  .site-header header .countdown-time {
    font-size: 0.7rem;
  }
  .site-header header .countdown-unit {
    min-width: 0 !important;
  }
  .site-header header #countdown-days,
  .site-header header #countdown-hours,
  .site-header header #countdown-minutes {
    font-size: 1em;
  }
}

/* Source: css/desktop-tablet-optimizations.css */
@media (min-width: 1400.01px) {
  .container {
    max-width: var(--container-wide-max-width);
    padding: 0 var(--spacing-lg);
  } /* unify canvas: let sections use full container width */
  .stats-row {
    max-width: none;
    margin: 0;
  }
  .content-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
  }
  .winner-preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
  }
  .winner-card { padding: 14px; }
  .winner-rank { font-size: 1.1rem; margin-bottom: 6px; }
  .winner-name { margin-bottom: 8px; }
  .winner-prize { font-size: 1.4rem; margin-bottom: 8px; }
  .leaderboard-table {
    max-width: none;
    width: 100%;
    margin: 0;
  }
}
@media (min-width: 1024.01px) and (max-width: 1400px) {
  .container {
    max-width: var(--container-max-width);
    padding: 0 var(--spacing-lg);
  }
  section {
    padding: 25px 30px;
    margin-bottom: 16px;
  } /* unify canvas: let stats row span full container */
  .stats-row {
    max-width: none;
    margin: 0;
  }
  .winner-preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
  }
  .winner-card {
    padding: 12px;
    min-height: 120px;
  }
  .leaderboard-table {
    font-size: 0.9rem;
    margin: 20px 0;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 12px;
  }
  .leaderboard-table tbody tr {
    height: 48px;
  }
  .prize-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
  }
  .prize-card {
    padding: 16px;
    min-height: 140px;
  }
}
@media (min-width: 768.01px) and (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 var(--spacing-md);
  }
  section {
    padding: 20px 24px;
    margin-bottom: 14px;
  }
  h2 {
    font-size: 1.6rem;
    margin-bottom: 16px;
  }
  .stats-row {
    gap: 20px;
    margin: 0;
  }
  .winner-preview {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 16px 0;
  }
  .winner-card {
    padding: 14px;
    min-height: 130px;
  }
  .prize-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 16px 0;
  }
  .prize-card {
    padding: 14px;
    min-height: 130px;
  }
  .leaderboard-table {
    font-size: 0.85rem;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 8px 10px;
  }
  .leaderboard-table tbody tr {
    height: 44px;
  }
}
@media (min-width: 768.01px) {
  main > * {
    margin-bottom: 16px;
  }
  .stats-last-updated {
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
  }
  .countdown-clock {
    padding: 15px 20px;
    max-width: 300px;
  }
  .countdown-label {
    font-size: 1rem;
    letter-spacing: 1.5px;
    min-width: 0;
  }
  .countdown-time {
    gap: 0;
  }
  .countdown-unit {
    min-width: 18px;
  }
  .leaderboard-navigation {
    padding: 12px 0;
    gap: 16px;
  }
  .leaderboard-nav-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
  .winner-summary {
    font-size: 0.9rem;
    margin: 12px 0;
    padding: 8px 0;
    color: #666;
  }
  .cta-button,
  .view-all-winners {
    padding: 12px 24px;
    margin-top: 16px;
    font-size: 1rem;
  }
}
@media (min-width: 1024.01px) {
  .main-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
  }
  .during-season #winners-section {
    grid-column: 1;
  }
  .during-season #leaderboard-section {
    grid-column: 1;
  }
  .during-season #late-register {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .winner-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
  }
  .leaderboard-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}
@media (min-width: 768.01px) {
  h2 {
    margin-bottom: 16px;
    padding-bottom: 8px;
  }
  h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
  }
  p {
    margin-bottom: 12px;
    line-height: 1.6;
  }
  ul,
  ol {
    margin-bottom: 16px;
  }
  li {
    margin-bottom: 6px;
  }
  .form-group {
    margin-bottom: 16px;
  }
  #league-statistics {
    padding: 20px 30px;
  }
  #registration {
    padding: 20px 30px;
    text-align: center;
  }
  #registration p {
    max-width: 600px;
    margin: 0 auto 20px;
  }
  #winners-section {
    padding: 20px 30px;
  }
  .section-heading {
    margin-bottom: 16px;
  }
  #leaderboard-section {
    padding: 20px 30px;
  }
  #prize-structure {
    padding: 20px 30px;
  }
  .prize-meta {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
  }
}
@media (min-width: 768.01px) {
  footer {
    padding: 16px 20px;
    margin-top: 20px;
  }
  footer p {
    margin-bottom: 4px;
  }
  .qa-panel {
    max-width: 400px;
    padding: 16px;
  }
  .qa-info {
    font-size: 0.8rem;
  }
  .qa-kv {
    margin-bottom: 6px;
  }
  .qa-actions {
    gap: 8px;
  }
  .qa-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  .floating-toggle {
    padding: 12px;
    bottom: 20px;
    left: 20px;
    right: auto;
  }
  .floating-toggle button {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
}

/* Source: css/mobile-consolidated.css + mobile-optimizations.css + advanced-mobile.css */
@media (max-width: 600px) {
  .container {
    margin: 6px auto;
    padding: 0 8px;
    width: 100%;
    max-width: none;
  }
  header {
    padding: clamp(12px, 3vh, 18px) clamp(8px, 2vw, 12px);
    min-height: clamp(64px, 14vh, 80px);
    margin-bottom: clamp(6px, 2vh, 12px);
  }
  section {
    padding: 16px 12px;
    margin-bottom: 8px;
  }
  main > * {
    margin-bottom: 8px;
  }
  h2 {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 6px;
  }
  .section-desc {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
  .stats-row {
    gap: 8px;
    margin-bottom: 8px;
  }
  .leaderboard {
    margin: 8px 0;
  }
  .leaderboard-table {
    font-size: 0.8rem;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 8px 4px;
  }
  .leaderboard-table th {
    font-size: 0.75rem;
    padding: 6px 4px;
  }
  .winner-preview-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .winner-card {
    padding: 12px;
    margin-bottom: 8px;
  }
  .winner-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  .winner-card p {
    font-size: 0.8rem;
    margin-bottom: 2px;
  }
  #registration {
    padding: 16px 12px;
  }
  .registration-status {
    padding: 12px;
    margin: 8px 0;
  }
  .registration-note {
    font-size: 0.85rem;
    margin-top: 8px;
  }
  .countdown-clock {
    padding: 8px 12px;
    margin: 8px auto;
    max-width: 280px;
  }
  .countdown-time {
    gap: 8px;
  }
  .countdown-unit {
    min-width: 32px;
  }
  /* Ensure numbers and labels are the same size on mobile */
  .countdown-time,
  .countdown-unit span,
  .countdown-unit-label {
    font-size: var(--countdown-text-size);
  }
  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    margin: 4px 2px;
  }
  .nav-back--sm {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  footer {
    padding: 12px;
    font-size: 0.75rem;
  }
  .site-timestamp {
    font-size: 0.7rem;
    margin-top: 4px;
  }
  .mobile-hidden {
    display: none !important;
  }
  .mobile-compact {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
    margin: 2px 0 !important;
  }
  .mobile-tight {
    margin: 0 !important;
    padding: 4px !important;
  }
}
@media (max-width: 480px) {
  .container {
    padding: 0 6px;
  }
  section {
    padding: 12px 8px;
  }
}
@media (max-width: 360px) {
  .container {
    padding: 0 4px;
  }
  header {
    padding: 10px 6px;
    min-height: 60px;
  }
  section {
    padding: 10px 6px;
    margin-bottom: 6px;
  }
  .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* ===================== CANVAS NORMALIZATION (FINAL OVERRIDES) ===================== */
/* Enforce identical container width/padding across pages at key breakpoints */
@media (min-width: 1400.01px) {
  .container {
    max-width: var(--container-wide-max-width) !important;
    padding-left: var(--spacing-lg) !important;
    padding-right: var(--spacing-lg) !important;
  }
}
@media (min-width: 1024.01px) and (max-width: 1400px) {
  .container {
    max-width: var(--container-max-width) !important;
    padding-left: var(--spacing-lg) !important;
    padding-right: var(--spacing-lg) !important;
  }
}
@media (min-width: 768.01px) and (max-width: 1024px) {
  .container {
    max-width: 100% !important;
    padding-left: var(--spacing-md) !important;
    padding-right: var(--spacing-md) !important;
  }
}
@media (max-width: 600px) {
  .container {
    max-width: 100% !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    margin-top: 4px !important;
  }
  .site-header {
    padding-top: calc(4px + var(--safe-top)) !important;
    margin-bottom: 12px !important;
  }
  header {
    padding: 10px 10px !important;
    min-height: 56px !important;
    gap: 8px !important;
  }
  .countdown-clock {
    padding: 8px 10px !important;
    max-width: 200px !important;
  }
}

/* ===================== FOUC GUARD: HEADINGS ===================== */
/* Ensure subtitles render immediately on first paint */
.section-heading .heading-subtitle {
  opacity: 1 !important;
  transform: none !important;
}

/* ===================== TEST MODE CANVAS TWEAKS ===================== */
/* Match winners' perceived top spacing on index when in test mode */
.test-mode-index .container {
  margin-top: 0 !important;
}
.test-mode-winners .container {
  margin-top: 0 !important;
}

/* ===================== CRITICAL INLINE REFERENCE (GUIDE) ===================== */
/*
  Reference for inline critical CSS (kept in HTML for first paint):
  - :root variables needed for header/above-the-fold
  - .site-header, .header-inner, header (compact layout + min-height)
  - .countdown-clock (basic box + border)
  - #league-statistics, .stats-row, .stat-box (minimal structure)

  The live inline critical CSS is embedded in index.html and winners.html and mirrors
  these selectors. Update both if you adjust above-the-fold structure here.
*/

/* ===================== TIGHTER VERTICAL RHYTHM ===================== */
/* Reduce spacing between containers (sections) across viewports */
@media (min-width: 1024.01px) {
  main > * {
    margin-bottom: var(--spacing-md) !important;
  }
  section {
    margin-bottom: var(--spacing-md) !important;
  }
}

@media (min-width: 768.01px) and (max-width: 1024px) {
  main > * {
    margin-bottom: calc(var(--spacing-md) * 0.9) !important;
  }
  section {
    margin-bottom: calc(var(--spacing-md) * 0.9) !important;
  }
}

@media (max-width: 768px) {
  main > * {
    margin-bottom: var(--spacing-sm) !important;
  }
  section {
    margin-bottom: var(--spacing-sm) !important;
  }
}
