/*
  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.
*/

/* ===================== CSS CASCADE LAYERS ===================== */
/* Define layer ordering for predictable specificity */
@layer reset, base, components, utilities;

/* ===================== 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: 1440px; /* Updated to match 2xl breakpoint */

  /* Responsive Breakpoint Tokens (Shared with JS) */
  --bp-xs: 375px; /* Extra Small - Mobile portrait (optional) */
  --bp-sm: 480px; /* Small - Mobile landscape */
  --bp-md: 768px; /* Medium - Tablet portrait */
  --bp-lg: 1024px; /* Large - Tablet landscape / Small desktop */
  --bp-xl: 1200px; /* Extra Large - Desktop */
  --bp-2xl: 1440px; /* 2X Large - Large desktop */

  /* Legacy breakpoints (deprecated, use tokens above) */
  --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.2);

  /* 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;

  /* Section accent widths */
  --section-accent-mobile: 2px; /* mobile/tablet default left accent */
  --section-accent-desktop: 4px; /* desktop/tablet >=768px */
  --section-accent-width: var(--section-accent-mobile);
}

/* 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 */
  }
}

/* Promote thicker accent for larger screens via variable */
@media (min-width: 768px) {
  :root {
    --section-accent-width: var(--section-accent-desktop);
  }
}

/* ===================== 2) FONTS & FALLBACKS ===================== */
/* Source: css/fonts.css + css/fallbacks.css consolidated */

/* System Font Fallbacks (from fallbacks.css) */
.font-fallback {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'Roboto',
    'Oxygen',
    'Ubuntu',
    'Cantarell',
    'Fira Sans',
    'Droid Sans',
    'Helvetica Neue',
    sans-serif;
}

/* Fallback for when Google Fonts fail */
.poppins-fallback {
  font-family:
    'Poppins',
    'Inter',
    'SF Pro Display',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'Roboto',
    'Oxygen',
    'Ubuntu',
    'Cantarell',
    sans-serif;
}

/* 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);
  -webkit-tap-highlight-color: transparent; /* remove blue tap highlight globally */
}

/* FIX: mobile sticky header opacity — solid page background + reduce rubber-band flash */
html {
  /* Fluid typography: scales between 14px (mobile) and 18px (desktop) */
  font-size: clamp(14px, 1.6vw, 18px);
}

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: 1200px) {
  .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;
}

.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
   Use :focus-visible to avoid showing outlines on mouse/touch clicks
   while preserving keyboard accessibility. */
#main-content:focus-visible,
#league-statistics:focus-visible,
#registration:focus-visible,
#winners-section:focus-visible,
#leaderboard-section:focus-visible,
#prize-structure:focus-visible {
  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;
}

/* ==========================================================================
   CSS LAYER DEFINITIONS - Cascade Control (Phase 5.1)
   ========================================================================== */
@layer base, components, utilities, overrides;

/* ==========================================================================
   UTILITY CLASSES - Utilities Layer (Phase 3.3 + 5.1)
   ========================================================================== */

/* Text Alignment Utilities - Replace 66+ duplicates */
@layer utilities {
  .u-text-left {
    text-align: left;
  }

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

  .u-text-right {
    text-align: right;
  }

  .u-text-justify {
    text-align: justify;
  }
}

/* Font Weight Utilities - Replace 90+ duplicates */
@layer utilities {
  .u-font-light {
    font-weight: 300;
  }

  .u-font-normal {
    font-weight: 400;
  }

  .u-font-medium {
    font-weight: 500;
  }

  .u-font-semibold {
    font-weight: 600;
  }

  .u-font-bold {
    font-weight: 700;
  }

  .u-font-black {
    font-weight: 900;
  }
}

/* Display Utilities */
@layer utilities {
  .u-block {
    display: block;
  }

  .u-inline {
    display: inline;
  }

  .u-inline-block {
    display: inline-block;
  }

  .u-flex {
    display: flex;
  }

  .u-inline-flex {
    display: inline-flex;
  }

  .u-grid {
    display: grid;
  }

  .u-hidden {
    display: none;
  }
}

/* Flexbox Utilities */
@layer utilities {
  .u-flex-row {
    flex-direction: row;
  }

  .u-flex-col {
    flex-direction: column;
  }

  .u-flex-wrap {
    flex-wrap: wrap;
  }

  .u-flex-nowrap {
    flex-wrap: nowrap;
  }

  .u-justify-start {
    justify-content: flex-start;
  }

  .u-justify-center {
    justify-content: center;
  }

  .u-justify-end {
    justify-content: flex-end;
  }

  .u-justify-between {
    justify-content: space-between;
  }

  .u-items-start {
    align-items: flex-start;
  }

  .u-items-center {
    align-items: center;
  }

  .u-items-end {
    align-items: flex-end;
  }

  .u-items-stretch {
    align-items: stretch;
  }
}

/* Color Utilities */
.u-text-primary {
  color: var(--primary-color);
}

.u-text-secondary {
  color: var(--secondary-color);
}

.u-text-accent {
  color: var(--accent-color);
}

.u-text-muted {
  color: var(--text-muted);
}

.u-text-white {
  color: #fff;
}

.u-text-black {
  color: #000;
}

/* Status colors */
.u-text-success {
  color: var(--success-color, #28a745);
}

.u-text-warning {
  color: var(--warning-color, #ffc107);
}

.u-text-error {
  color: var(--error-color, #dc3545);
}

.u-text-info {
  color: var(--info-color, #17a2b8);
}

/* Background Colors */
.u-bg-primary {
  background-color: var(--primary-color);
}

.u-bg-secondary {
  background-color: var(--secondary-color);
}

.u-bg-white {
  background-color: #fff;
}

.u-bg-gray {
  background-color: var(--light-gray);
}

.u-bg-transparent {
  background-color: transparent;
}

/* Spacing Utilities - All Sides Margin */
.u-margin-0 {
  margin: 0 !important;
}

.u-margin-xs {
  margin: var(--spacing-xs); /* 4px */
}

.u-margin-sm {
  margin: var(--spacing-sm); /* 8px */
}

.u-margin-md {
  margin: var(--spacing-md); /* 16px */
}

.u-margin-lg {
  margin: var(--spacing-lg); /* 24px */
}

.u-margin-xl {
  margin: var(--spacing-xl); /* 32px */
}

/* Directional Margins */
.u-margin-top-0 {
  margin-top: 0 !important;
}

.u-margin-top-sm {
  margin-top: var(--spacing-sm);
}

.u-margin-right-md {
  margin-right: var(--spacing-md);
}

.u-margin-bottom-lg {
  margin-bottom: var(--spacing-lg);
}

.u-margin-left-xl {
  margin-left: var(--spacing-xl);
}

/* Axis Margins */
.u-margin-x-auto {
  margin-left: auto;
  margin-right: auto;
}

.u-margin-y-0 {
  margin-top: 0;
  margin-bottom: 0;
}

/* Spacing Utilities - All Sides Padding */
.u-padding-0 {
  padding: 0 !important;
}

.u-padding-xs {
  padding: var(--spacing-xs); /* 4px */
}

.u-padding-sm {
  padding: var(--spacing-sm); /* 8px */
}

.u-padding-md {
  padding: var(--spacing-md); /* 16px */
}

.u-padding-lg {
  padding: var(--spacing-lg); /* 24px */
}

/* Directional Paddings */
.u-padding-top-sm {
  padding-top: var(--spacing-sm);
}

.u-padding-right-md {
  padding-right: var(--spacing-md);
}

.u-padding-bottom-lg {
  padding-bottom: var(--spacing-lg);
}

.u-padding-left-xl {
  padding-left: var(--spacing-xl);
}

/* Project-Specific Utilities */
/* Leaderboard-Specific */
.u-rank-gold {
  color: var(--gold-1);
}

.u-rank-silver {
  color: var(--silver-1);
}

.u-rank-bronze {
  color: var(--bronze-1);
}

.u-movement-up {
  color: var(--movement-up-color);
}

.u-movement-down {
  color: var(--movement-down-color);
}

.u-movement-same {
  color: var(--movement-same-color);
}

.u-movement-new {
  color: var(--movement-new-color);
}

.u-tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Table-Specific */
.u-table-fixed {
  table-layout: fixed;
}

.u-table-auto {
  table-layout: auto;
}

.u-border-collapse {
  border-collapse: collapse;
}

.u-border-separate {
  border-collapse: separate;
}

/* Visibility & State Utilities */
.u-visible {
  visibility: visible;
}

.u-invisible {
  visibility: hidden;
}

.u-opacity-0 {
  opacity: 0;
}

.u-opacity-50 {
  opacity: 0.5;
}

.u-opacity-100 {
  opacity: 1 !important;
}

/* =============== 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;
}

/* Enhanced 5-column leaderboard alignment utilities */
.table-align-gw th:nth-child(3),
.table-align-gw td:nth-child(3) {
  text-align: right;
}

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

.table-align-deficit th:nth-child(5),
.table-align-deficit td:nth-child(5) {
  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: 768px) {
  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: 768px) {
  /* 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,
  .stats__row {
    gap: var(--spacing-lg); /* 24px between stat boxes */
    margin-bottom: var(--spacing-lg); /* 24px after stats */
  }

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

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

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

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

  .leaderboard-table th,
  .leaderboard-table td,
  .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,
  .nav__button,
  .nav__button--compact,
  .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),
  .nav__button: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),
  .nav__button:active:not(:disabled) {
    transform: translateY(var(--btn-press));
    box-shadow: var(--btn-shadow-active);
    filter: none;
  }

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

  .leaderboard-nav-btn,
  .nav__button,
  .nav__button--compact {
    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: 768px) 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 thead th,
  .leaderboard-table tbody tr,
  .leaderboard__table tbody tr {
    height: 44px;
  }
  .leaderboard-table thead th,
  .leaderboard__table thead th {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .leaderboard-table td,
  .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,
  .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,
  .stats__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,
  .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,
  .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,
  .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,
  .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,
  .nav__leaderboard {
    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,
  .nav__button,
  .nav__button--compact {
    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(--primary-color);
  color: var(--secondary-color);
}
.pill-gm {
  background: var(--accent-color);
  color: #fff;
}

/* Tooltip for pills - shows position breakdown */
.pill {
  position: relative;
  cursor: help;
}

.pill .tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(55, 0, 60, 0.95);
  backdrop-filter: blur(8px);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 135, 0.3);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(55, 0, 60, 0.4);
  display: flex;
  flex-direction: column;
}

.pill .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(55, 0, 60, 0.95);
}

.pill:hover .tooltip {
  opacity: 1;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
  width: 100%;
  min-width: max-content;
}

.tooltip-row + .tooltip-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 255, 135, 0.2);
}

.tooltip-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
}

.tooltip-value {
  font-weight: 600;
  color: white;
}

/* League rank text - left aligned */
.rank-text {
  text-align: left;
}

/* League rank number - right aligned in fixed-width container */
.rank-number {
  display: inline-block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =============== 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,
  .stats__row {
    gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
  }

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

/* =============== ULTRA-WIDE DESKTOP (≥1401px) =============== */
@media (min-width: 1440px) {
  /* 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 + assets/css/components/table.css consolidated */

/* =============== TABLE COMPONENT =============== */
/* Generic table component with BEM methodology */

/* container must own the overflow for sticky headers to work */
.c-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  width: 100%;
  padding-top: 80px;
  margin-top: -80px;
}

.c-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* guard against migration overrides */
.c-table th,
.c-table td {
  display: table-cell;
  padding: 14px 16px;
  vertical-align: middle;
  border: none;
}

/* sticky header, single row across 4 columns */
.c-table--winners thead th {
  position: sticky;
  top: -80px;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-left: none;
  border-right: none;
}

/* Grid layout for HIGHLIGHTS column - 3 sub-columns for alignment (body cells only) */
.c-table--winners tbody td.col-highlights {
  display: grid;
  grid-template-columns: 60px 60px auto;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

/* Center align HIGHLIGHTS header text and ensure it doesn't use grid */
.c-table--winners thead th.col-highlights {
  text-align: center !important;
  display: table-cell !important;
}

/* Center-align pill content */
.c-table--winners .col-highlights .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Ensure empty placeholder spans don't show any styling */
.c-table--winners .col-highlights span:empty {
  display: inline-block;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
}
.c-table--winners thead th:first-child {
  border-top-left-radius: 8px;
}
.c-table--winners thead th:last-child {
  border-top-right-radius: 8px;
}

/* Basic row styling */
.c-table--winners tbody tr {
  position: relative;
}
/* Remove left accent bar to keep perfect column alignment across all rows */
.c-table--winners tbody tr::before {
  display: none;
}

/* Light zebra rows (subtle) for all rows */
.c-table--winners tbody tr:nth-child(odd) {
  background: #fafafa;
}
.c-table--winners tbody tr:nth-child(even) {
  background: #ffffff;
}

/* TOP 3 WINNER HIGHLIGHTING — match leaderboard implementation exactly */
.c-table--winners tbody tr.winner-gold td:first-child {
  border-left: 4px solid #ffd700;
  background: rgba(255, 215, 0, 0.1);
  color: #d4a017;
  font-weight: 700;
}
.c-table--winners tbody tr.winner-silver td:first-child {
  border-left: 4px solid #c0c0c0;
  background: rgba(192, 192, 192, 0.1);
  color: #6c6c6c;
  font-weight: 700;
}
.c-table--winners tbody tr.winner-bronze td:first-child {
  border-left: 4px solid #cd7f32;
  background: rgba(205, 127, 50, 0.1);
  color: #cd7f32;
  font-weight: 700;
}

/* Column widths and alignment */
.c-table--winners td:nth-child(1),
.c-table--winners th:nth-child(1) {
  width: 72px;
  text-align: center;
  font-weight: 700;
}

.c-table--winners td:nth-child(2),
.c-table--winners th:nth-child(2) {
  text-align: left;
  font-weight: 600;
}

/* numeric right align */
.c-table--winners td.is-num,
.c-table--winners td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary-color);
}
.c-table--winners th.is-num,
.c-table--winners thead th:nth-child(3) {
  text-align: right;
  color: #fff;
}

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

/* Uniform row sizing like index table */
.c-table--winners thead th,
.c-table--winners tbody tr {
  height: 56px;
}
.c-table--winners th,
.c-table--winners td {
  padding: 14px 16px;
}

/* badge */
.c-chip {
  display: inline-block;
  min-width: 40px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  background: #28f0b0;
  color: #0b1330;
  text-align: center;
}

/* responsive table adjustments */
@media (max-width: 767px) {
  .c-table th,
  .c-table td {
    padding: 12px;
  }
}

/* 
 * =============== 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: 768px) {
  :root {
    --box-min-width: 150px;
    --box-gap: 14px;
    --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: 1024px) {
  :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: 767px) {
  .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: 767px) {
  .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: center;
  text-align: center;
  padding: var(--box-padding);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border: 2px solid transparent;
}

.stat-box:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  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:active {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-primary-hover);
  border: 2px solid 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, 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: 768px) {
  .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, 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, 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, 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, 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-y: 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 .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: 768px) {
  .prize-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .prize-summary {
    gap: 20px;
  }
}

@media (max-width: 767px) {
  .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: 768px) 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: 1024px) {
  .site-header header .countdown-clock {
    max-width: 300px;
  }
}
@media (max-width: 767px) {
  .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,
.winner__preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 1200px) {
  .winner-preview,
  .winner__preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.winner__preview {
  margin-bottom: 0;
}
.winner-card,
.winner__card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  -webkit-tap-highlight-color: transparent; /* remove blue tap highlight */
  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,
.winner__card:hover,
.winner__card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.winner-card.rank-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,
.winner__card--rank-1:hover {
  box-shadow: 0 4px 15px rgba(249, 168, 37, 0.25);
}
.winner-card.rank-2,
.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,
.winner__card--rank-2:hover {
  box-shadow: 0 4px 15px rgba(158, 158, 158, 0.25);
}
.winner-card.rank-3,
.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,
.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,
.leaderboard__table {
  width: 100%;
  min-width: 600px; /* Increased for 5-column layout */
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  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,
.leaderboard__cell--rank {
  position: relative;
  overflow: hidden;
}
.leaderboard-table th,
.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),
.leaderboard__table th:nth-child(1) {
  text-align: center;
}
.leaderboard-table thead tr:first-child th:first-child,
.leaderboard__table thead tr:first-child th:first-child {
  border-top-left-radius: var(--radius-lg);
}
.leaderboard-table th:nth-child(2),
.leaderboard__table th:nth-child(2) {
  text-align: left;
}
.leaderboard-table th:nth-child(3),
.leaderboard__table th:nth-child(3) {
  text-align: right;
  width: 140px;
}
.leaderboard-table th:nth-child(4),
.leaderboard__table th:nth-child(4) {
  text-align: right;
  width: 110px;
}
.leaderboard-table th:nth-child(5),
.leaderboard__table th:nth-child(5) {
  text-align: right;
  width: 110px;
  border-top-right-radius: var(--radius-lg);
}
.leaderboard-table td,
.leaderboard__table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}
.leaderboard-table td:nth-child(1),
.leaderboard__table td:nth-child(1) {
  padding: 0;
}
.leaderboard-table tbody tr,
.leaderboard__table tbody tr {
  height: 56px;
}
.leaderboard-table tbody tr:nth-child(even),
.leaderboard__table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}
.leaderboard-table tbody tr:nth-child(odd),
.leaderboard__table tbody tr:nth-child(odd) {
  background-color: #fff;
}
.leaderboard-table tbody tr:hover,
.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,
.leaderboard__table tbody tr:last-child td {
  border-bottom: none;
}
.leaderboard-rank,
.leaderboard__cell--rank {
  text-align: center;
  font-weight: 700;
  color: var(--primary-color);
  position: relative;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  box-sizing: border-box;
}

.rank-number {
  display: inline-block;
  text-align: center;
  min-width: 3ch;
}

.rank-movement {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.leaderboard-rank.rank-1,
.leaderboard__cell--rank.rank-1 {
  border-left: 4px solid #ffd700;
  color: #d4a017;
  font-weight: 700;
  background: rgba(255, 215, 0, 0.1);
}
.leaderboard-rank.rank-2,
.leaderboard__cell--rank.rank-2 {
  border-left: 4px solid #c0c0c0;
  color: #6c6c6c;
  font-weight: 700;
  background: rgba(192, 192, 192, 0.1);
}
.leaderboard-rank.rank-3,
.leaderboard__cell--rank.rank-3 {
  border-left: 4px solid #cd7f32;
  color: #cd7f32;
  font-weight: 700;
  background: rgba(205, 127, 50, 0.1);
}
.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,
.leaderboard__cell--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;
}

/* Enhanced 5-column leaderboard styles */
.leaderboard-gw,
.leaderboard__cell--gw {
  text-align: right;
  font-weight: 600;
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
}

.leaderboard-total,
.leaderboard__cell--total {
  text-align: right;
  font-weight: 700;
  color: #333;
  font-variant-numeric: tabular-nums;
}

.leaderboard-deficit,
.leaderboard__cell--deficit {
  text-align: right;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-style: italic;
}

/* Movement indicators */
.rank-movement {
  font-size: 1em;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  line-height: 1;
}

.movement-up {
  color: #28a745;
}

.movement-down {
  color: #dc3545;
}

.movement-same {
  color: #6c757d;
}

.movement-new {
  color: #007bff;
}

/* Player team name styling */
.player-team {
  font-weight: 600;
  color: var(--heading-color);
}

.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:active {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border: 2px solid 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-card.primary-metric:active {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(55, 0, 60, 0.18);
  border: 2px solid 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: 5%;
  text-align: center;
  min-width: 50px;
}
.winner-table th:nth-child(2) {
  width: 20%;
  text-align: left;
  min-width: 140px;
}
.winner-table th:nth-child(3) {
  width: 15%;
  text-align: right;
  min-width: 100px;
}
.winner-table th:nth-child(4) {
  width: 60%;
  text-align: right;
  min-width: 240px;
}
.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,
.nav__leaderboard,
.nav__leaderboard--compact {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.winner-nav-btn,
.nav__button,
.nav__button--compact {
  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),
.nav__button:hover:not(:disabled) {
  background: var(--heading-color);
}
.winner-nav-btn:disabled,
.nav__button:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.winner-nav-btn:focus-visible,
.nav__button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
.page-info,
.nav__page-info {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
  white-space: nowrap;
}
@media (max-width: 767px) {
  .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: 767px) {
  .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: 768px) {
  .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: 767px) {
  .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: 1200px) {
  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: 768px) {
  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: 768px) and (max-width: 1023px) {
  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: 767px) {
  .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,
  .winner__preview {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .winner-card,
  .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,
  .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,
  .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,
  .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,
  .winner__rank {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--primary-color);
    line-height: 1;
  }
  .winner-name,
  .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,
  .winner__prize {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary-color);
    line-height: 1;
  }
  .winner-highlights,
  .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;
  }
  .leaderboard__table {
    font-size: 0.78rem;
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
  }
  .leaderboard__header .leaderboard__cell {
    font-size: 0.72rem;
    padding: 10px 6px;
    letter-spacing: 0.02em;
  }
  .leaderboard__cell {
    padding: 10px 6px;
  }
  .leaderboard__cell--rank {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    text-align: center;
    width: 100%;
    padding: 10px 8px;
  }
  .leaderboard__header .leaderboard__cell--rank {
    justify-content: center;
    padding: 14px 4px;
    min-height: 56px;
    box-sizing: border-box;
  }
  .leaderboard__cell--rank .rank-number {
    min-width: 2ch;
  }
  .leaderboard__cell--rank .rank-movement {
    position: static;
    transform: none;
    font-size: 0.7rem;
    line-height: 1;
  }
  .leaderboard__cell--player {
    font-size: 0.82rem;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }
  .leaderboard__cell--player .player-team {
    display: block;
    font-weight: 600;
  }
  .leaderboard__cell--gw,
  .leaderboard__cell--total,
  .leaderboard__cell--deficit {
    font-size: 0.75rem;
  }
  .leaderboard__table colgroup col:nth-child(1) {
    width: 18%;
  }
  .leaderboard__table colgroup col:nth-child(2) {
    width: 34%;
  }
  .leaderboard__table colgroup col:nth-child(3),
  .leaderboard__table colgroup col:nth-child(4),
  .leaderboard__table colgroup col:nth-child(5) {
    width: 16%;
  }
  .leaderboard__table tbody tr:hover {
    transform: none;
    box-shadow: none;
  }
  .nav__leaderboard,
  .nav__leaderboard--compact {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 6px;
  }
  .nav__button,
  .nav__button--compact {
    flex: 0 0 auto;
    min-width: 90px;
    height: 36px;
    padding: 4px 10px;
    font-size: 0.85rem;
  }
  .nav__page-info {
    flex: 0 0 auto;
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .season-section .winner-preview .winner-card:nth-child(n + 7),
  .section__card--season .winner__preview .winner__card:nth-child(n + 7),
  .section__card--during-season .winner__preview .winner__card:nth-child(n + 7) {
    display: none;
  }
  .leaderboard-table,
  .leaderboard__table {
    font-size: 0.86rem;
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: auto;
  }
  .leaderboard-table thead,
  .leaderboard__table thead {
    display: table-header-group;
  }
  .leaderboard-table thead th,
  .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,
  .leaderboard__table th,
  .leaderboard__table td {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .leaderboard-table thead th.col-rank,
  .leaderboard__table thead th.col-rank {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    letter-spacing: 0;
  }
  .leaderboard-table td,
  .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),
  .leaderboard-table thead th:nth-child(5),
  .leaderboard-table tbody td:nth-child(5) {
    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: 479px) {
  .leaderboard-table .leaderboard-player {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
  }

  /* Enhanced 5-column layout mobile adjustments */
  .leaderboard-table col:nth-child(1) {
    width: 4ch !important; /* Rank */
  }
  .leaderboard-table col:nth-child(3) {
    width: 4ch !important; /* GW */
  }
  .leaderboard-table col:nth-child(4) {
    width: 6ch !important; /* Total */
  }
  .leaderboard-table col:nth-child(5) {
    width: 5ch !important; /* Deficit */
  }

  /* Movement indicators mobile adjustments */
  .rank-movement {
    font-size: 0.9em;
    margin-right: 3px;
    font-weight: 600;
  }
  .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: 767px) {
  .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: 767px) {
  .btn-primary,
  .btn-secondary,
  .cta-button,
  .view-all-winners,
  .winner-nav-btn,
  .nav__button,
  .nav__button--compact,
  .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: 1024px) {
  .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: 768px) 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: 767px) {
  .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: 1440px) {
  .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,
  .winner__preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
  }
  .winner-card,
  .winner__card {
    padding: 14px;
  }
  .winner-rank,
  .winner__rank {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  .winner-name,
  .winner__name {
    margin-bottom: 8px;
  }
  .winner-prize,
  .winner__prize {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }
  .leaderboard-table,
  .leaderboard__table {
    max-width: none;
    width: 100%;
    margin: 0;
  }
}
@media (min-width: 1024px) and (max-width: 1439px) {
  .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,
  .winner__preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
  }
  .winner-card,
  .winner__card {
    padding: 12px;
    min-height: 120px;
  }
  .leaderboard-table,
  .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: 768px) 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,
  .stats__row {
    gap: 20px;
    margin: 0;
  }
  .winner-preview,
  .winner__preview {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 16px 0;
  }
  .winner-card,
  .winner__card {
    padding: 14px;
    min-height: 130px;
  }
  .prize-card {
    padding: 14px;
    min-height: 130px;
  }
  .leaderboard-table,
  .leaderboard__table {
    font-size: 0.85rem;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 8px 10px;
  }
  .leaderboard-table tbody tr {
    height: 44px;
  }

  /* Tablet-specific column widths for leaderboard */
  .leaderboard-table colgroup col:nth-child(1) {
    width: 2ch !important;
  }
  .leaderboard-table colgroup col:nth-child(2) {
    width: 160px !important;
  }
  .leaderboard-table colgroup col:nth-child(3) {
    width: 2ch !important;
  }
  .leaderboard-table colgroup col:nth-child(4) {
    width: 3ch !important;
  }
  .leaderboard-table colgroup col:nth-child(5) {
    width: 3ch !important;
  }
}
@media (min-width: 768px) {
  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: 1024px) {
  .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);
  }

  /* Desktop-specific column widths for leaderboard */
  .leaderboard-table colgroup col:nth-child(1) {
    width: 2ch !important;
  }
  .leaderboard-table colgroup col:nth-child(2) {
    width: 180px !important;
  }
  .leaderboard-table colgroup col:nth-child(3) {
    width: 2ch !important;
  }
  .leaderboard-table colgroup col:nth-child(4) {
    width: 3ch !important;
  }
  .leaderboard-table colgroup col:nth-child(5) {
    width: 3ch !important;
  }
}
@media (min-width: 768px) {
  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: 768px) {
  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: 767px) {
  .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,
  .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: 479px) {
  .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: 1440px) {
  .container {
    max-width: var(--container-wide-max-width) !important;
    padding-left: var(--spacing-lg) !important;
    padding-right: var(--spacing-lg) !important;
  }
}
@media (min-width: 1024px) and (max-width: 1439px) {
  .container {
    max-width: var(--container-max-width) !important;
    padding-left: var(--spacing-lg) !important;
    padding-right: var(--spacing-lg) !important;
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 100% !important;
    padding-left: var(--spacing-md) !important;
    padding-right: var(--spacing-md) !important;
  }
}
@media (max-width: 767px) {
  .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: 1024px) {
  main > * {
    margin-bottom: var(--spacing-md) !important;
  }
  section {
    margin-bottom: var(--spacing-md) !important;
  }
}

@media (min-width: 768px) 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;
  }
}

/* ==========================================================================
   LEADERBOARD COMPONENT - BEM Structure (Phase 4.1 + 5.2)
   ========================================================================== */

@layer components {
  /* BLOCK: Main leaderboard component */
  .leaderboard {
    /* Component container - allows for future expansion */
    position: relative;
  }

  /* ELEMENT: Table within leaderboard */
  .leaderboard__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 600px;
    table-layout: fixed;
    margin-top: 20px;
    font-variant-numeric: tabular-nums;
  }

  /* ELEMENT: Table sections */
  .leaderboard__header {
    background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
  }

  .leaderboard__body {
    background: #fff;
  }

  /* ELEMENT: Row within leaderboard table */
  .leaderboard__row {
    border-bottom: 1px solid #f0f2f5;
    transition:
      background-color 0.2s ease,
      transform 0.2s ease,
      box-shadow 0.2s ease;
    height: 56px;
  }

  /* ELEMENT: Generic cell within leaderboard */
  .leaderboard__cell {
    padding: var(--spacing-sm) var(--spacing-md);
    vertical-align: middle;
    font-size: 0.9rem;
  }

  /* Header cell styling */
  .leaderboard__header .leaderboard__cell {
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.95rem;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* MODIFIER: Specific cell types */
  .leaderboard__cell--rank {
    /* Rank-specific cell styling */
    font-weight: 600;
    min-width: 3ch;
    text-align: center;
  }

  .leaderboard__cell--player {
    /* Player name cell styling */
    font-weight: 500;
    min-width: 180px;
    text-align: left;
  }

  .leaderboard__cell--gw {
    /* Gameweek points cell styling */
    font-weight: 600;
    min-width: 3ch;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .leaderboard__cell--total {
    /* Total points cell styling */
    font-weight: 600;
    min-width: 4ch;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .leaderboard__cell--deficit {
    /* Deficit cell styling */
    font-weight: 500;
    min-width: 4ch;
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-style: italic;
    color: var(--text-muted);
  }

  .leaderboard__header .leaderboard__cell--deficit {
    font-style: normal;
  }

  /* Row zebra striping & hover */
  .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;
  }

  /* MODIFIER: Table density variations */
  .leaderboard__table--compact .leaderboard__cell {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.85rem;
  }

  .leaderboard__table--compact .leaderboard__header .leaderboard__cell {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
  }

  .leaderboard__table--comfortable .leaderboard__cell {
    /* Default spacing - inherits from base .leaderboard__cell */
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .leaderboard__table--spacious .leaderboard__cell {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
  }

  /* Rank highlighting for top positions */
  .leaderboard__cell--rank.rank-1 {
    color: var(--gold-1, #ffd700);
    font-weight: 700;
  }

  .leaderboard__cell--rank.rank-2 {
    color: var(--silver-1, #c0c0c0);
    font-weight: 700;
  }

  .leaderboard__cell--rank.rank-3 {
    color: var(--bronze-1, #cd7f32);
    font-weight: 700;
  }

  /* Column widths */
  .leaderboard__table th:nth-child(1) {
    width: 80px;
    text-align: center;
  }

  .leaderboard__table th:nth-child(3) {
    width: 140px;
    text-align: right;
  }

  .leaderboard__table th:nth-child(4) {
    width: 110px;
    text-align: right;
  }

  .leaderboard__table th:nth-child(5) {
    text-align: right;
  }

  .leaderboard__table colgroup col:nth-child(1) {
    width: 70px;
  }

  .leaderboard__table colgroup col:nth-child(2) {
    width: auto;
  }

  .leaderboard__table colgroup col:nth-child(3) {
    width: 140px;
  }

  .leaderboard__table colgroup col:nth-child(4) {
    width: 110px;
  }

  .leaderboard__table colgroup col:nth-child(5) {
    width: 110px;
  }
} /* End @layer components for leaderboard */

/* ==========================================================================
   LEADERBOARD RESPONSIVE STYLES
   ========================================================================== */

/* Mobile styles (up to 768px) */
@media (max-width: 768px) {
  .leaderboard__table {
    font-size: 0.8rem;
  }

  .leaderboard__cell {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .leaderboard__cell--player {
    min-width: 120px;
  }

  /* Stack table horizontally on very small screens */
  .leaderboard__table--compact .leaderboard__cell {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

/* Tablet styles (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .leaderboard__cell {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .leaderboard__cell--player {
    min-width: 150px;
  }
}

/* Desktop styles (1024px+) */
@media (min-width: 1024px) {
  .leaderboard__table {
    font-size: 0.9rem;
  }

  .leaderboard__cell {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .leaderboard__cell--player {
    min-width: 180px;
  }
}

/* ==========================================================================
   WINNER COMPONENT - BEM Structure
   ========================================================================== */

/* BLOCK: Main winner component */
.winner {
  position: relative;
}

/* ELEMENT: Winner card container */
.winner__card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  -webkit-tap-highlight-color: transparent; /* remove blue tap highlight */
  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;
}

/* ELEMENT: Winner card elements */
.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: 8px;
  line-height: 1.3;
}

.winner__prize {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
}

.winner__highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  justify-content: flex-end;
}

/* ELEMENT: Winner preview container */
.winner__preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* STATE MODIFIERS: Card states */
.winner__card:hover,
.winner__card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Focus state for keyboard accessibility */
.winner__card:focus-within,
.winner__card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* RANK MODIFIERS: Rank-specific styling */
.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 RESPONSIVE STYLES
   ========================================================================== */

/* Mobile styles (up to 768px) */
@media (max-width: 768px) {
  .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);
  }

  .winner__name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
    color: var(--heading-color);
    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;
  }

  .winner__preview {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
  }
}

/* Tablet styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .winner__card {
    padding: 14px;
  }

  .winner__rank {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }

  .winner__name {
    margin-bottom: 8px;
  }
}

/* Small desktop styles (1024px - 1200px) */
@media (min-width: 1024px) and (max-width: 1200px) {
  .winner__card {
    padding: 12px;
    min-height: 120px;
  }
}

/* Desktop styles (1200px+) */
@media (min-width: 1200px) {
  .winner__card {
    padding: 14px;
    min-height: 130px;
  }

  .winner__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
  }
}

/* Ultra wide styles (1440px+) */
@media (min-width: 1440px) {
  .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;
  }
}

/* ==========================================================================
   NAVIGATION COMPONENT - BEM Structure
   ========================================================================== */

/* BLOCK: Main navigation component */
.nav {
  position: relative;
}

/* ELEMENT: Navigation container for leaderboard */
.nav__leaderboard {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 15px 0;
}

/* ELEMENT: Navigation button */
.nav__button {
  background: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  padding: var(--spacing-sm) var(--spacing-md); /* 8px vertical, 16px horizontal */
  height: var(--btn-height);
  border-radius: var(--radius-sm); /* 4px corners */
}

/* ELEMENT: Page information display */
.nav__page-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* STATE MODIFIERS: Button states */
.nav__button:hover:not(:disabled) {
  background: var(--heading-color);
  transform: translateY(var(--btn-raise));
  box-shadow: var(--btn-shadow-hover);
  filter: brightness(1.03);
}

.nav__button:active:not(:disabled) {
  transform: translateY(var(--btn-press));
  box-shadow: var(--btn-shadow-active);
  filter: none;
}

.nav__button:disabled {
  background: #e0e0e0;
  color: #555;
  cursor: not-allowed;
}

.nav__button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* TYPE MODIFIERS: Different navigation types */
.nav__leaderboard--compact {
  gap: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)); /* ~6px between */
  padding: calc(var(--spacing-sm) * var(--spacing-mobile-multiplier)) 0; /* ~6px top/bottom */
}

.nav__button--compact {
  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 */
}

/* ==========================================================================
   NAVIGATION RESPONSIVE STYLES
   ========================================================================== */

/* Mobile styles (up to 768px) */
@media (max-width: 768px) {
  .nav__leaderboard {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
  }

  .nav__button {
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    min-height: 40px;
    min-width: 84px;
    flex: 0 0 auto;
  }

  .nav__page-info {
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    order: 0;
  }

  .nav__button:first-of-type {
    order: -1;
  }

  .nav__button:last-of-type {
    order: 1;
  }
}

/* Tablet styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .nav__leaderboard {
    gap: var(--spacing-md); /* 16px between nav elements */
    padding: var(--spacing-md) 0; /* 16px top/bottom */
  }

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

/* Small desktop styles (1024px - 1200px) */
@media (min-width: 1024px) and (max-width: 1200px) {
  .nav__leaderboard {
    padding: 12px 0;
    gap: 16px;
  }

  .nav__button {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 90px;
  }
}

/* Desktop styles (1200px+) */
@media (min-width: 1200px) {
  .nav__button {
    padding: 10px 20px;
    font-size: 1rem;
    min-width: 100px;
    height: var(--btn-height);
  }
}

/* ==========================================================================
   STATS COMPONENT - BEM Structure
   ========================================================================== */

/* BLOCK: Main stats component */
.stats {
  position: relative;
  width: 100%;
}

/* ELEMENT: Stats row container */
.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%;
}

/* ELEMENT: Individual stat box */
.stats__box {
  flex: 1 1 0;
  min-width: var(--box-min-width);
  padding: var(--box-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* ELEMENT: Box elements */
.stats__icon {
  font-size: var(--icon-size);
  color: var(--primary-color);
  margin-bottom: var(--icon-margin);
  opacity: 0.9;
}

.stats__icon img.emoji,
.stats__icon img.twemoji {
  width: var(--icon-size);
  height: auto;
  display: block;
}

.stats__icon .emoji-text {
  font-size: var(--icon-size);
  line-height: 1;
}

.stats__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);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stats__title {
  font-size: var(--title-size);
  font-weight: 600;
  color: var(--heading-color);
  margin: 0;
  line-height: 1.2;
  text-align: center;
}

/* ELEMENT: Stats summary container */
.stats__summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* ELEMENT: Summary card */
.stats__summary-card {
  background: #fff;
  padding: 25px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* STATE MODIFIERS: Box states */
.stats__box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats__box:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats__summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats__summary-card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* TYPE MODIFIERS: Different stat types */
.stats__box--primary {
  background: linear-gradient(135deg, #fff8f0, #fff2e6);
  border: 2px solid var(--primary-color);
}

.stats__box--primary .stats__icon {
  font-size: var(--icon-size-primary);
  opacity: 1;
}

.stats__box--primary .stats__number {
  font-size: clamp(1.8rem, 4vw, var(--number-size-primary));
  font-weight: 800;
}

.stats__box--primary .stats__title {
  font-size: var(--title-size-primary);
  font-weight: 700;
  color: var(--heading-color);
}

.stats__summary-card--primary {
  background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
  color: #fff;
}

/* ==========================================================================
   STATS RESPONSIVE STYLES
   ========================================================================== */

/* Mobile styles (up to 700px) */
@media (max-width: 767px) {
  .stats__row {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .stats__box {
    width: 100%;
    max-width: var(--stat-box-mobile-max, 360px);
    height: var(--stat-box-mobile-height, 160px);
    min-height: auto;
    padding: calc(var(--spacing-md) * var(--spacing-mobile-multiplier)); /* ~12px internal */
    border-radius: var(--radius-md); /* 6px corners */
  }

  .stats__summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stats__summary-card {
    padding: 18px 12px;
  }

  .stats__summary-card--primary {
    padding: 22px 15px;
  }
}

/* Larger mobile: two-column layout (480px - 700px) */
@media (min-width: 480px) and (max-width: 767px) {
  .stats__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--box-gap);
    align-items: stretch;
    justify-items: stretch;
  }

  .stats__box {
    max-width: none; /* let grid define width */
  }
}

/* Tablet styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .stats__row {
    gap: var(--spacing-lg); /* 24px between stat boxes */
    margin-bottom: var(--spacing-lg); /* 24px after stats */
  }

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

  .stats__number {
    font-size: var(--number-size);
  }

  .stats__box--primary .stats__number {
    font-size: var(--number-size-primary);
  }
}

/* Small desktop styles (1024px+) */
@media (min-width: 1024px) {
  .stats__row {
    justify-content: space-between;
    gap: 20px;
    max-width: none;
    margin: 0;
    width: 100%;
  }
}

/* Ultra wide styles (1440px+) */
@media (min-width: 1440px) {
  .stats__row {
    gap: 8px;
    margin-bottom: 8px;
  }
}

/* ==========================================================================
   SECTION COMPONENT - BEM Structure
   ========================================================================== */

/* BLOCK: Main section component */
.section {
  position: relative;
}

/* ELEMENT: Section card container - BEM and Legacy support */
.section__card,
.section-card {
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-lg);
  background-color: var(--card-background);
  -webkit-tap-highlight-color: transparent; /* remove blue tap highlight on iOS/Android */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* Responsive left accent strip - mobile first */
  border-left: var(--section-accent-width) solid var(--primary-color);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border 0.2s ease;
}

/* Desktop/tablet - thicker accent strip */
@media (min-width: 768px) {
  .section__card,
  .section-card {
    border-left: var(--section-accent-width) solid var(--primary-color);
  }
}

/* ELEMENT: Section heading container */
.section__heading {
  display: block;
  margin: 0 0 0.5rem 0;
}

/* ELEMENT: Heading main text */
.section__heading-main {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0;
}

/* ELEMENT: Heading subtitle */
.section__heading-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

/* ELEMENT: Section emoji icons */
.section__emoji {
  font-size: var(--icon-size, 1.8rem);
  margin-right: 0.5rem;
  display: inline-block;
}

/* ELEMENT: Section description */
.section__desc {
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 1rem;
}

/* STATE MODIFIERS: Section states */
.section__card:hover,
.section-card:hover,
.section__card:active,
.section-card:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* Transition from left strip to full border on hover/touch */
  border: 2px solid var(--primary-color);
}

/* Desktop/tablet hover - maintain 4px left border */
@media (min-width: 768px) {
  .section__card:hover,
  .section-card:hover,
  .section__card:active,
  .section-card:active {
    border: 4px solid var(--primary-color);
  }
}

/* Focus state for keyboard accessibility */
.section__card:focus-within,
.section__card:focus-visible,
.section-card:focus-within,
.section-card:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* Same full border treatment as hover */
  border: 2px solid var(--primary-color);
  outline: none; /* Remove default focus outline since we have custom border */
}

/* Remove default outline on pointer focus while preserving :focus-visible above */
.section__card:focus,
.section-card:focus {
  outline: none;
}

/* Desktop/tablet focus - maintain 4px left border */
@media (min-width: 768px) {
  .section__card:focus-within,
  .section__card:focus-visible,
  .section-card:focus-within,
  .section-card:focus-visible {
    border: 4px solid var(--primary-color);
  }
}

/* On touch devices, avoid sticky hover that turns the accent into a full border */
@media (hover: none) and (pointer: coarse) {
  .section__card:hover:not(:active),
  .section-card:hover:not(:active) {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
    border-left: var(--section-accent-width) solid var(--primary-color);
  }
}

.section__heading-subtitle--show {
  opacity: 1;
  transform: translateY(0);
}

.section__heading-subtitle--animated {
  opacity: 0;
  transform: translateY(4px);
}

/* TYPE MODIFIERS: Different section types */
.section__card--season {
  border-left: var(--section-accent-width) solid var(--secondary-color);
  background: linear-gradient(145deg, #fafbfc, #ffffff);
}

.section__card--winner {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.section__card--stats {
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

/* SEASON PHASE MODIFIERS */
.section__card--pre-season {
  border-left-color: #28a745;
}

.section__card--during-season {
  border-left-color: var(--primary-color);
}

.section__card--post-season {
  border-left-color: #6c757d;
}

/* SIZE MODIFIERS */
.section__card--compact {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.section__card--spacious {
  padding: calc(var(--spacing-xl) * 1.5);
  margin-bottom: calc(var(--spacing-lg) * 1.5);
}

/* ==========================================================================
   SECTION RESPONSIVE STYLES
   ========================================================================== */

/* Mobile styles (up to 768px) */
@media (max-width: 768px) {
  .section__card {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-md);
  }

  .section__heading {
    margin-bottom: 12px;
  }

  .section__heading-main {
    font-size: 1.2rem;
  }

  .section__heading-subtitle {
    font-size: 0.8rem;
    margin-top: 2px;
  }

  .section__emoji {
    font-size: 1.5rem;
    margin-right: 0.4rem;
  }

  .section__desc {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
}

/* Tablet styles (768px+) */
@media (min-width: 768px) {
  .section__heading-main {
    font-size: 1.8rem;
  }

  .section__heading-subtitle {
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 4px;
  }
}

/* Small desktop styles (1024px+) */
@media (min-width: 1024px) {
  .section__card {
    padding: 20px 30px;
  }

  .section__heading {
    margin-bottom: 16px;
  }
}

/* Desktop styles (1200px+) */
@media (min-width: 1200px) {
  .section__card--spacious {
    padding: 30px 40px;
    margin-bottom: 30px;
  }
}

/* Ultra wide styles (1440px+) */
@media (min-width: 1440px) {
  .section__desc {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
}

/* ==========================================================================
   SECTION ACCESSIBILITY & MOTION
   ========================================================================== */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .section__heading-subtitle,
  .section__heading-subtitle--show,
  .section__heading-subtitle--animated {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .section__card:hover {
    transform: none;
  }
}

/* Focus states for keyboard navigation */
.section__card:focus-within {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ==========================================================================
   RESPONSIVE UTILITY CLASSES (Phase 3.3)
   ========================================================================== */

/* Small screens and up (640px+) */
@media (min-width: 768px) {
  .u-sm-text-left {
    text-align: left;
  }

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

  .u-sm-text-right {
    text-align: right;
  }

  .u-sm-block {
    display: block;
  }

  .u-sm-flex {
    display: flex;
  }

  .u-sm-grid {
    display: grid;
  }

  .u-sm-hidden {
    display: none;
  }
}

/* Medium screens and up (768px+) */
@media (min-width: 768px) {
  .u-md-text-left {
    text-align: left;
  }

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

  .u-md-text-right {
    text-align: right;
  }

  .u-md-block {
    display: block;
  }

  .u-md-flex {
    display: flex;
  }

  .u-md-grid {
    display: grid;
  }

  .u-md-hidden {
    display: none;
  }

  .u-md-flex-row {
    flex-direction: row;
  }

  .u-md-flex-col {
    flex-direction: column;
  }

  .u-md-justify-center {
    justify-content: center;
  }

  .u-md-justify-between {
    justify-content: space-between;
  }
}

/* Large screens and up (1024px+) */
@media (min-width: 1024px) {
  .u-lg-text-left {
    text-align: left;
  }

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

  .u-lg-text-right {
    text-align: right;
  }

  .u-lg-block {
    display: block;
  }

  .u-lg-flex {
    display: flex;
  }

  .u-lg-grid {
    display: grid;
  }

  .u-lg-hidden {
    display: none;
  }

  .u-lg-flex-row {
    flex-direction: row;
  }

  .u-lg-flex-col {
    flex-direction: column;
  }
}

/* Extra large screens and up (1200px+) */
@media (min-width: 1200px) {
  .u-xl-text-center {
    text-align: center;
  }

  .u-xl-flex {
    display: flex;
  }

  .u-xl-grid {
    display: grid;
  }

  .u-xl-hidden {
    display: none;
  }
}

/* Responsive leaderboard column sizing */
.leaderboard-table col.leaderboard__col--rank,
.leaderboard__table col.leaderboard__col--rank {
  width: 10% !important;
}

.leaderboard-table col.leaderboard__col--player,
.leaderboard__table col.leaderboard__col--player {
  width: 44% !important;
}

.leaderboard-table col.leaderboard__col--gw,
.leaderboard__table col.leaderboard__col--gw {
  width: 14% !important;
}

.leaderboard-table col.leaderboard__col--total,
.leaderboard__table col.leaderboard__col--total {
  width: 16% !important;
}

.leaderboard-table col.leaderboard__col--deficit,
.leaderboard__table col.leaderboard__col--deficit {
  width: 16% !important;
}

@media (max-width: 1023px) {
  .leaderboard-table col.leaderboard__col--rank,
  .leaderboard__table col.leaderboard__col--rank {
    width: 12% !important;
  }

  .leaderboard-table col.leaderboard__col--player,
  .leaderboard__table col.leaderboard__col--player {
    width: 42% !important;
  }

  .leaderboard-table col.leaderboard__col--gw,
  .leaderboard-table col.leaderboard__col--total,
  .leaderboard-table col.leaderboard__col--deficit,
  .leaderboard__table col.leaderboard__col--gw,
  .leaderboard__table col.leaderboard__col--total,
  .leaderboard__table col.leaderboard__col--deficit {
    width: 15.33% !important;
  }
}

@media (max-width: 767px) {
  .leaderboard {
    margin: 12px 0;
  }

  .table-scroll {
    border-radius: var(--radius-lg);
    overflow-y: hidden;
    overflow-x: auto;
  }

  /* Force border-radius on table and header */
  .leaderboard__table {
    border-radius: var(--radius-lg) !important;
    margin-top: 0 !important;
  }

  .leaderboard__table thead th:first-child {
    border-top-left-radius: var(--radius-lg) !important;
  }

  .leaderboard__table thead th:last-child {
    border-top-right-radius: var(--radius-lg) !important;
  }

  .leaderboard-table,
  .leaderboard__table {
    min-width: 100% !important;
    table-layout: fixed;
  }

  .leaderboard-table col.leaderboard__col--rank,
  .leaderboard__table col.leaderboard__col--rank {
    width: 15% !important;
  }

  .leaderboard-table col.leaderboard__col--player,
  .leaderboard__table col.leaderboard__col--player {
    width: 38% !important;
  }

  .leaderboard-table col.leaderboard__col--gw,
  .leaderboard-table col.leaderboard__col--total,
  .leaderboard-table col.leaderboard__col--deficit,
  .leaderboard__table col.leaderboard__col--gw,
  .leaderboard__table col.leaderboard__col--total,
  .leaderboard__table col.leaderboard__col--deficit {
    width: 15.67% !important;
  }

  .leaderboard__header .leaderboard__cell {
    font-size: 0.7rem;
    padding: 14px 6px;
    white-space: normal;
    line-height: 1.2;
    min-height: 56px;
    box-sizing: border-box;
  }

  .leaderboard__cell {
    padding: 8px 6px;
    font-size: 0.82rem;
  }

  .leaderboard__cell--player {
    font-size: 0.88rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 1px; /* Forces ellipsis while allowing column to use allocated width */
  }

  .leaderboard__cell--player .player-team {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .leaderboard__cell--gw,
  .leaderboard__cell--total,
  .leaderboard__cell--deficit {
    font-size: 0.76rem;
  }

  .leaderboard__cell--rank {
    display: flex;
    gap: 3px;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0 4px;
    min-height: 56px;
  }
  .leaderboard__header .leaderboard__cell--rank {
    justify-content: center;
    padding: 14px 4px;
    min-height: 56px;
    box-sizing: border-box;
  }

  .leaderboard__cell--rank .rank-number {
    min-width: 2.7ch;
  }

  .leaderboard__cell--rank .rank-movement {
    position: static;
    font-size: 0.65rem;
    line-height: 1;
  }

  .nav__leaderboard {
    flex-wrap: nowrap !important;
    justify-content: center;
    gap: 10px !important;
    margin: 16px 0 0;
    padding: 10px 0;
  }

  .nav__leaderboard .nav__button {
    flex: 0 0 auto;
    width: clamp(92px, 32vw, 120px);
    min-width: unset;
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .nav__leaderboard .nav__page-info {
    flex: 0 0 auto;
    min-width: 72px;
    text-align: center;
    font-size: 0.82rem;
    white-space: nowrap;
  }
}

@media (max-width: 479px) {
  .leaderboard__header .leaderboard__cell {
    font-size: 0.66rem;
  }

  .leaderboard__cell {
    font-size: 0.78rem;
  }

  .leaderboard__cell--player {
    font-size: 0.82rem;
  }

  .nav__leaderboard .nav__button {
    width: clamp(88px, 40vw, 110px);
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .nav__leaderboard .nav__page-info {
    min-width: 68px;
  }
}
