:root {
    --primary: #1E3A8A; /* Default Blue */
    --primary-light: #3B82F6;
    --primary-dark: #1E40AF;
    --secondary: #10B981; /* Emerald */
    --background: #0F172A; /* Dark Slate */
    --surface: #1E293B;
    --surface-hover: #334155;
    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --border: #334155;
    --error: #EF4444;
    --success: #22C55E;
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Prevent image / media blowout */
img, video, iframe, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
    word-break: break-word;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* Base Form Inputs & Controls */
input, select, textarea {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

select option {
    background-color: var(--surface);
    color: var(--text);
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Main Layout Container (provides comfortable gap from sticky header navbar) */
main.container {
    padding-top: 1.75rem;
    padding-bottom: 3rem;
    min-height: calc(100vh - 64px - 80px);
    box-sizing: border-box;
}

/* Top Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    gap: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    min-width: 0;
    flex: 1 1 auto;
    max-width: calc(100% - 50px);
}

.brand-logo {
    height: 36px;
    max-width: 140px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}

.brand-text {
    font-size: clamp(0.85rem, 3.2vw, 1.35rem);
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    min-width: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.hamburger {
    display: none;
}

@media (min-width: 769px) {
    .nav-actions {
        display: none;
    }
    .brand {
        flex: 0 0 auto !important;
        max-width: none !important;
    }
    .nav-links {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        flex-wrap: nowrap !important;
        gap: 0.75rem !important;
        position: static !important;
        width: auto !important;
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    .nav-primary-menu {
        display: flex;
        align-items: center;
        gap: 1.15rem;
        min-width: 0;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .nav-primary-menu > .nav-item {
        flex-shrink: 0;
    }
    .nav-utility-items {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex-shrink: 0;
    }
}

/* Navigation Menu Dividers */
.menu-nav-divider {
    width: 1px;
    height: 22px;
    background-color: var(--border);
    margin: 0 0.5rem;
    align-self: center;
    flex-shrink: 0;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.4rem 0;
    width: 100%;
}

.nav-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--text);
}

/* More Dropdown for Desktop Overflow */
.nav-more-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease;
    user-select: none;
    border: 1px solid transparent;
}

.nav-more-btn:hover,
.nav-more-dropdown:hover .nav-more-btn,
.nav-more-dropdown.open .nav-more-btn {
    color: var(--text) !important;
    background: var(--surface-hover);
    border-color: var(--border);
}

.nav-more-btn.has-active-child {
    color: var(--secondary) !important;
    font-weight: 600;
    border-color: rgba(16, 185, 129, 0.4);
}

.nav-more-dropdown .dropdown-content {
    right: 0 !important;
    left: auto !important;
    min-width: 210px;
    max-width: 290px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--surface);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    padding: 0.5rem 0;
    margin-top: 0.35rem;
    z-index: 105;
}

.nav-more-dropdown .dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.dropdown.open .dropdown-content {
    display: block;
}

.nav-more-link {
    color: var(--text) !important;
    padding: 0.65rem 1.25rem !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}

.nav-more-link:hover {
    background-color: var(--surface-hover) !important;
    color: var(--text) !important;
}

.nav-more-link.active {
    color: var(--secondary) !important;
    background: rgba(16, 185, 129, 0.08) !important;
    font-weight: 600;
}

.nav-more-group-title {
    padding: 0.5rem 1.25rem 0.25rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.nav-more-subitem {
    padding-left: 2rem !important;
    font-size: 0.85rem !important;
}

.nav-item-overflowed {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(30, 58, 138, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.4);
}

.btn-secondary {
    background-color: var(--surface-hover);
    color: var(--text);
}

.btn-secondary:hover {
    background-color: var(--border);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

/* Badges & Pills */
.badge,
.badge-pill,
.role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap; /* Pills do not wrap or split words/icons by default */
    vertical-align: middle;
    box-sizing: border-box;
    max-width: 100%;
}

.badge i,
.badge-pill i,
.role-badge i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Multi-line Badge support (when badge explicitly permits wrapping without distortion) */
.badge.badge-multiline,
.badge-pill.badge-multiline,
.role-badge.badge-multiline {
    white-space: normal;
    text-align: left;
    border-radius: 8px; /* Switch from oval pill to rounded box to prevent distortion */
    line-height: 1.35;
    padding: 0.35rem 0.65rem;
    word-break: break-word;
}

/* Role Specific Badges */
.role-badge-superadmin {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-weight: 700;
    text-transform: uppercase;
}

.role-badge-teamadmin {
    background: rgba(59, 130, 246, 0.18);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.35);
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge-player {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-weight: 600;
    text-transform: uppercase;
}

/* Light Theme overrides for Role Badges */
body.theme-light .role-badge-superadmin {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.3);
}

body.theme-light .role-badge-teamadmin {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.3);
}

body.theme-light .role-badge-player {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(5, 150, 105, 0.3);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3.5rem 1rem;
    animation: fadeIn 0.6s ease-out;
}

.hero h1 {
    font-size: 2.75rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.hero-has-bg h1 {
    color: #ffffff !important;
    background: none !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.hero-has-bg p {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Panels */
.panel {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 2rem;
    transition: var(--transition);
    max-width: 100%;
    overflow: hidden;
}

.glass-panel {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Reusable Responsive Grid Utilities (replace hardcoded inline grids) */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.grid-sidebar {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.75rem;
}

.grid-sidebar-wide {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 1.75rem;
}

/* Base Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius);
}

table, .table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

th, td {
    padding: 0.75rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }

/* Standings Table (Mobile-First, matching Screenshot_20260922_090320_Chrome.jpg) */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}

.standings-table th,
.standings-table td {
    padding: 0.6rem 0.3rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.standings-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.standings-table .col-pos {
    width: 6%;
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    padding-left: 0.2rem;
}

.standings-table .col-team {
    width: 32%;
    text-align: left;
    font-weight: 600;
    padding-left: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standings-table .col-team a {
    color: var(--text);
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standings-table .col-num,
.standings-table .col-p,
.standings-table .col-w,
.standings-table .col-d,
.standings-table .col-l,
.standings-table .col-f,
.standings-table .col-a {
    text-align: center;
    width: 6.5%;
    color: var(--text-muted);
}

.standings-table .col-diff {
    text-align: center;
    width: 8.5%;
    font-weight: 600;
}

.standings-table .col-pts {
    text-align: center;
    width: 11%;
    font-weight: 800;
}

.standings-table .pts-badge {
    display: inline-block;
    background: var(--secondary, #10b981);
    color: #ffffff;
    font-weight: 800;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 28px;
    text-align: center;
}

/* Stats Table (Mobile-First) */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.stats-table .col-num {
    text-align: center;
    width: 38px;
}

/* Match Hub Date Carousel & Match Rows */
.match-hub-carousel {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.match-hub-date-card {
    flex: 0 0 110px;
    scroll-snap-align: start;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.match-hub-date-card.active {
    background: var(--surface-hover, #334155);
    border-color: var(--secondary, #10b981);
    box-shadow: 0 0 0 1px var(--secondary, #10b981);
}

.match-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.match-card-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.match-team-home {
    flex: 1;
    text-align: right;
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
    min-width: 0;
}

.match-team-away {
    flex: 1;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
    min-width: 0;
}

.match-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary, #10b981);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    min-width: 58px;
    letter-spacing: 1px;
}

.match-vs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    min-width: 44px;
}

/* Match Row Columns */
.match-meta-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    min-width: 75px;
}

.match-time-tag {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.match-time-tag.match-time-ft {
    color: var(--secondary, #10b981);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
}

.match-time-tag.match-time-live {
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 800;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.match-round-tag {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    padding: 0.08rem 0.38rem;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.15;
    display: inline-block;
}

.match-center-cell {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 65px;
}

/* Match Card Action Button */
.match-action-cell,
.match-card-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 75px;
}

/* Fixture Item Card & Separator Styling (Fixtures & Results Listings) */
.fixture-item-card {
    display: flex;
    flex-direction: column;
    padding: 0.35rem 0.5rem 0.55rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s ease;
}

.fixture-item-card:hover {
    background: rgba(255, 255, 255, 0.025);
}

.fixture-item-card .match-card-row {
    border-bottom: none !important;
    padding: 0.4rem 0.25rem 0.25rem 0.25rem;
}

.fixture-item-card .match-card-row:hover {
    background: transparent !important;
}

.fixture-item-subline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.15rem 0.35rem 0.15rem 0.35rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Clear separator line between fixtures */
.fixture-item-card:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.45rem;
}

.match-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    color: var(--primary-light);
    border: 1px solid var(--border);
    background: var(--surface-hover);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Match Card Interactive Entity & Venue Links */
.match-venue-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
    cursor: pointer;
}

.match-venue-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.match-venue-static {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.venue-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(220px, 45vw);
}

.match-entity-link {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
    cursor: pointer;
}

.match-entity-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.match-comp-badge {
    transition: opacity 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.match-comp-badge:hover {
    border-color: var(--primary-light) !important;
    opacity: 0.85;
}

.match-hub-fixture-card,
.fixture-clickable-card {
    cursor: pointer;
}

.match-hub-fixture-card:focus-visible,
.fixture-clickable-card:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.match-card-btn:hover {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
}

.match-card-btn-live {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.match-card-btn-live:hover {
    color: #ffffff;
    background: #ef4444;
    border-color: #ef4444;
}

/* Match Hub Fixture Card (Interactive Link & Hover) */
a.fixture-item-card,
.match-hub-fixture-card {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

a.fixture-item-card:hover,
.match-hub-fixture-card:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.match-hub-fixture-card:hover .match-team-name {
    color: var(--primary-light, #38bdf8);
}

.match-hub-fixture-card:hover .match-card-btn:not(.match-card-btn-live) {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

/* Player Avatars & Thumbnails */
.player-thumb-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 0.5rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.player-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.player-hero-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--primary-light);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    color: var(--primary-light);
    font-size: 2.5rem;
}

/* Admin Modals */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.admin-modal.show {
    display: flex !important;
}

.admin-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

.admin-modal-dialog {
    position: relative;
    background: var(--surface, #1e293b);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius, 12px);
    width: 100%;
    max-width: 580px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    z-index: 2;
    overflow: hidden;
    animation: adminFadeIn 0.2s ease-out;
}

.admin-modal-dialog form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin: 0;
}

@keyframes adminFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.admin-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-light, #38bdf8);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: var(--transition, all 0.2s ease);
}

.admin-modal-close:hover {
    color: var(--text, #f8fafc);
    background: rgba(255, 255, 255, 0.1);
}

.admin-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

/* Mobile Bottom Navigation Bar (Matching Screenshot_20260922_090309_Chrome.jpg) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 62px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    z-index: 999;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #94a3b8);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 0.4rem 0;
    transition: var(--transition, all 0.2s);
    gap: 0.25rem;
    border: none;
    background: none;
    cursor: pointer;
}

.mobile-nav-item i,
.mobile-nav-item svg {
    font-size: 1.25rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--secondary, #10b981);
}

.mobile-nav-item.active i,
.mobile-nav-item.active svg {
    color: var(--secondary, #10b981);
    transform: translateY(-1px);
}

/* Mobile Drawer for 'More' Menu */
.mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.mobile-drawer.open {
    display: block;
}

.mobile-drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mobile-drawer-sheet {
    position: absolute;
    bottom: 62px; /* Just above bottom nav */
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: var(--surface, #1e293b);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1rem 1.75rem 1rem;
    overflow-y: auto;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    animation: slideUp 0.22s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.mobile-drawer-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.mobile-drawer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.mobile-drawer-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.mobile-drawer-btn i {
    font-size: 1.1rem;
    color: var(--primary-light);
}

.mobile-drawer-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================= */
/* RESPONSIVE MEDIA QUERIES (TABLETS & PHONES <= 768px) */
/* ================================================= */
@media (max-width: 768px) {
    .container {
        padding: 0 0.85rem;
    }

    main.container {
        padding-top: 1.25rem;
        padding-bottom: 2.25rem;
    }

    body.has-bottom-nav {
        padding-bottom: 74px; /* Space for fixed bottom bar */
    }

    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .hero {
        padding: 2.5rem 0.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .panel {
        padding: 1.1rem 0.85rem;
        margin-bottom: 1.5rem;
    }

    /* Collapse all multi-column layout grids into clean 1-column stack */
    .grid-2-col,
    .grid-3-col,
    .grid-sidebar,
    .grid-sidebar-wide,
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 1fr 3fr"],
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    /* Modal dialog sizing on mobile */
    .admin-modal {
        padding: 0.5rem;
    }

    .admin-modal-dialog {
        width: 96% !important;
        max-width: 96% !important;
        margin: auto !important;
        max-height: 94vh !important;
    }

    .admin-modal-header {
        padding: 1rem !important;
    }

    .admin-modal-body {
        padding: 1rem !important;
    }

    .admin-modal-footer {
        padding: 0.75rem 1rem !important;
    }

    /* Inputs in modals on mobile stack cleanly */
    .admin-modal-body div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Navbar mobile layout */
    .nav-content {
        height: 56px;
        gap: 0.5rem;
    }

    .brand {
        gap: 0.45rem;
        max-width: calc(100% - 44px);
    }

    .brand-logo {
        height: 30px;
        max-width: 90px;
    }

    .brand-text {
        font-size: clamp(0.78rem, 3.2vw, 1.15rem);
        letter-spacing: -0.2px;
    }

    /* Navbar hamburger & links */
    .hamburger {
        display: block;
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 0.5rem;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 56px;
        left: 0;
        background: var(--surface);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        align-items: stretch;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .nav-links .menu-nav-divider {
        width: 100%;
        height: 1px;
        margin: 0.5rem 0;
        background-color: var(--border);
    }

    .nav-primary-menu {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-utility-items {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .nav-utility-divider {
        display: none !important;
    }

    .nav-more-dropdown {
        display: none !important;
    }
}

/* ================================================= */
/* MOBILE & TABLET RESPONSIVENESS (<= 640px and <= 480px) */
/* ================================================= */

/* Scorecard Responsive Frame Grid */
.scorecard-frame-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.scorecard-player-label {
    display: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

.scorecard-label-home {
    color: var(--primary-light);
}

.scorecard-label-away {
    color: var(--secondary);
}

.scorecard-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Bracket Mobile Navigation Pills */
.bracket-nav-pills {
    display: none;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.bracket-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    transition: var(--transition);
}

.bracket-pill-btn.active, .bracket-pill-btn:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
    font-weight: 600;
}

/* Media Query: Tablets & Mobiles <= 640px */
@media (max-width: 640px) {
    /* Scorecards stack vertically on mobile */
    .scorecard-frame-grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        padding: 0.85rem 0.65rem;
    }

    .scorecard-player-label {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    .scorecard-center-col {
        margin: 0.25rem 0;
    }

    /* Bracket Mobile Stacked View */
    .bracket-nav-pills {
        display: flex;
    }

    .bracket-tree-wrapper.mobile-stacked {
        overflow-x: visible !important;
    }

    .bracket-tree-wrapper.mobile-stacked .bracket-rounds-row {
        flex-direction: column !important;
        min-width: 0 !important;
        width: 100% !important;
        gap: 1.5rem !important;
    }

    .bracket-tree-wrapper.mobile-stacked .bracket-round-col {
        width: 100% !important;
    }

    /* Responsive Card Tables for Admin & Roster */
    .responsive-card-table thead {
        display: none;
    }

    .responsive-card-table,
    .responsive-card-table tbody,
    .responsive-card-table tr,
    .responsive-card-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .responsive-card-table tr {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.85rem;
        margin-bottom: 0.85rem;
    }

    .responsive-card-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.45rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
        font-size: 0.85rem;
        word-break: break-word;
    }

    .responsive-card-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        text-align: left;
        flex-shrink: 0;
        margin-right: 0.75rem;
        letter-spacing: 0.5px;
    }

    .responsive-card-table td.actions-cell {
        border-bottom: none;
        padding-top: 0.65rem;
        justify-content: flex-end;
    }

    .responsive-card-table td.actions-cell::before {
        display: none;
    }

    /* Neutralize rigid inline min-widths on mobile to prevent container blowout */
    div[style*="min-width"],
    input[style*="min-width"],
    select[style*="min-width"] {
        min-width: 0 !important;
    }
}

/* ================================================= */
/* SMALL MOBILE PHONES (<= 480px, e.g. iPhone SE, 360-430px) */
/* ================================================= */
@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    main.container {
        padding-top: 1rem;
        padding-bottom: 2rem;
    }

    .nav-content {
        height: 52px;
        gap: 0.35rem;
    }

    .brand {
        gap: 0.35rem;
        max-width: calc(100% - 40px);
    }

    .brand-logo {
        height: 26px;
        max-width: 75px;
    }

    .brand-text {
        font-size: clamp(0.72rem, 3.2vw, 0.95rem);
        letter-spacing: -0.25px;
    }

    .panel {
        padding: 0.75rem 0.4rem;
    }

    .hero h1 {
        font-size: 1.55rem;
    }

    /* Complete Fit Full Standings Table - NO COLUMNS HIDDEN */
    .standings-table.full-standings-table,
    .full-standings-table {
        font-size: 0.72rem;
        table-layout: fixed;
        width: 100%;
        margin-top: 0.25rem;
    }

    .standings-table.full-standings-table th,
    .standings-table.full-standings-table td,
    .full-standings-table th,
    .full-standings-table td {
        padding: 0.35rem 1px;
        text-align: center;
    }

    .standings-table.full-standings-table th,
    .full-standings-table th {
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0;
    }

    .standings-table.full-standings-table .col-pos,
    .full-standings-table .col-pos {
        width: 5.5%;
        padding-left: 1px;
        padding-right: 1px;
        font-size: 0.7rem;
    }

    .standings-table.full-standings-table .col-team,
    .full-standings-table .col-team {
        width: 33.5%;
        text-align: left;
        padding-left: 2px;
        padding-right: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .standings-table.full-standings-table .col-team a,
    .full-standings-table .col-team a {
        font-size: 0.75rem;
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .standings-table.full-standings-table.no-draw-table .col-team,
    .full-standings-table.no-draw-table .col-team {
        width: 39.7%;
    }

    .standings-table.full-standings-table .col-num,
    .standings-table.full-standings-table .col-p,
    .standings-table.full-standings-table .col-w,
    .standings-table.full-standings-table .col-d,
    .standings-table.full-standings-table .col-l,
    .full-standings-table .col-num,
    .full-standings-table .col-p,
    .full-standings-table .col-w,
    .full-standings-table .col-d,
    .full-standings-table .col-l {
        width: 6.2%;
        padding-left: 0;
        padding-right: 0;
        font-size: 0.72rem;
    }

    .standings-table.full-standings-table .col-f,
    .standings-table.full-standings-table .col-a,
    .full-standings-table .col-f,
    .full-standings-table .col-a {
        width: 7%;
        padding-left: 0;
        padding-right: 0;
        font-size: 0.72rem;
    }

    .standings-table.full-standings-table .col-diff,
    .full-standings-table .col-diff {
        width: 8.5%;
        padding-left: 0;
        padding-right: 0;
        font-size: 0.7rem;
    }

    .standings-table.full-standings-table .col-pts,
    .full-standings-table .col-pts {
        width: 12%;
        padding-left: 1px;
        padding-right: 1px;
    }

    .standings-table.full-standings-table .pts-badge,
    .full-standings-table .pts-badge {
        padding: 0.12rem 0.25rem;
        font-size: 0.72rem;
        min-width: 22px;
        border-radius: 4px;
        display: inline-block;
    }

    /* Home summary standings widget (4 columns: #, Team, P, PTS) */
    .standings-table:not(.full-standings-table) {
        width: 100%;
        table-layout: fixed;
    }
    .standings-table:not(.full-standings-table) .col-pos { width: 10%; text-align: center; }
    .standings-table:not(.full-standings-table) .col-team { width: 55%; text-align: left; }
    .standings-table:not(.full-standings-table) .col-num { width: 15%; text-align: center; }
    .standings-table:not(.full-standings-table) .col-pts { width: 20%; text-align: center; }

    /* Compact stats table on narrow screens */
    .stats-table {
        font-size: 0.78rem;
        table-layout: fixed;
        width: 100%;
    }

    .stats-table th:nth-child(1), .stats-table td:nth-child(1) { width: 38%; }
    .stats-table th:nth-child(2), .stats-table td:nth-child(2) { width: 28%; }
    .stats-table th:nth-child(3), .stats-table td:nth-child(3) { width: 11%; }
    .stats-table th:nth-child(4), .stats-table td:nth-child(4) { width: 11%; }
    .stats-table th:nth-child(5), .stats-table td:nth-child(5) { width: 12%; }

    .stats-table th,
    .stats-table td {
        padding: 0.35rem 0.2rem;
    }

    .stats-table .player-thumb-sm {
        width: 20px;
        height: 20px;
        margin-right: 0.2rem;
    }

    /* Match rows */
    .match-team-home,
    .match-team-away {
        font-size: 0.825rem;
    }

    .match-score-badge {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        min-width: 44px;
    }

    .match-vs-badge {
        font-size: 0.72rem;
        padding: 0.15rem 0.35rem;
        min-width: 30px;
    }

    .match-hub-date-card {
        flex: 0 0 90px;
        padding: 0.5rem 0.3rem;
    }

    /* Match Hub set breakdown or date details */
    .match-detail-sm {
        font-size: 0.72rem;
    }

    .match-action-cell {
        min-width: 50px;
    }

    .match-card-btn {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
        gap: 0.2rem;
    }
}

/* ==========================================================================
   Live Scoring, Form Streak & Head-to-Head Styling
   ========================================================================== */

/* Pulsing Live Badge */
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #ef4444;
    animation: livePulseDot 1.4s infinite ease-in-out;
}

@keyframes livePulseDot {
    0% {
        transform: scale(0.85);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
        box-shadow: 0 0 12px #ef4444;
    }
    100% {
        transform: scale(0.85);
        opacity: 0.6;
    }
}

/* Form Streak Badges */
.form-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.form-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: default;
    transition: transform 0.15s ease;
    user-select: none;
}

.form-badge:hover {
    transform: translateY(-2px);
}

.form-badge-w {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.form-badge-l {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.form-badge-d {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.5);
}

/* Match Night Hero Card */
.hero-match-card {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.hero-match-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

/* Head to Head Comparison Meter & Layout */
.h2h-meter-container {
    width: 100%;
    height: 10px;
    background: rgba(239, 68, 68, 0.4);
    border-radius: 9999px;
    overflow: hidden;
    display: flex;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
}

.h2h-meter-p1 {
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

.h2h-meter-p2 {
    height: 100%;
    background: #10b981;
    transition: width 0.4s ease;
}

.h2h-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.h2h-stat-row:last-child {
    border-bottom: none;
}

.h2h-val-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    text-align: left;
}

.h2h-stat-label {
    flex: 0 0 auto;
    text-align: center;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 0.5rem;
    letter-spacing: 0.02em;
}

.h2h-val-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    text-align: right;
}

.h2h-results-box {
    padding: 1.25rem;
}

/* Bracket Component & Responsive View */
.bracket-pill-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.bracket-pill-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.bracket-nav-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.bracket-tree-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding: 0.5rem 0;
}

.bracket-rounds-row {
    display: flex;
    gap: 1.5rem;
    min-width: max-content;
}

.bracket-round-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 240px;
    max-width: 100%;
}

/* Stacked view on mobile or when toggled */
.bracket-tree-wrapper.mobile-stacked .bracket-rounds-row {
    flex-direction: column;
    min-width: 0;
    width: 100%;
    gap: 1.5rem;
}

.bracket-tree-wrapper.mobile-stacked .bracket-round-col {
    width: 100%;
    max-width: 100%;
}

/* ================================================= */
/* COMPREHENSIVE LIGHT MODE PARITY SYSTEM            */
/* ================================================= */
:root:has(body.theme-light),
html.theme-light-applied,
html.theme-light,
html:has(body.theme-light) {
    --primary: #2563EB;
    --primary-light: #1D4ED8;
    --primary-dark: #1E40AF;
    --secondary: #059669;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;
    --text: #0F172A;
    --text-muted: #475569;
    --border: #CBD5E1;
    --error: #DC2626;
    --success: #16A34A;
    color-scheme: light;
    background-color: #F8FAFC !important;
}

body.theme-light {
    --primary: #2563EB;
    --primary-light: #1D4ED8;
    --primary-dark: #1E40AF;
    --secondary: #059669;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;
    --text: #0F172A;
    --text-muted: #475569;
    --border: #CBD5E1;
    --error: #DC2626;
    --success: #16A34A;
    color-scheme: light;
    background-color: var(--background) !important;
    color: var(--text) !important;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light h4 {
    color: var(--text) !important;
}

body.theme-light p {
    color: var(--text) !important;
}

body.theme-light .text-muted {
    color: var(--text-muted) !important;
}

/* Input & Select Light Mode Overrides */
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

body.theme-light select option {
    background: #ffffff !important;
    color: #0f172a !important;
}

/* Navigation & Topbar Light Mode */
body.theme-light .navbar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.theme-light .nav-links {
    background: #ffffff !important;
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light .nav-links a {
    color: var(--text) !important;
    border-bottom-color: var(--border) !important;
}

body.theme-light .nav-links a:hover {
    color: var(--primary) !important;
}

body.theme-light .dropdown-content {
    background-color: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08) !important;
}

body.theme-light .dropdown-content a {
    color: var(--text) !important;
}

body.theme-light .dropdown-content a:hover {
    background-color: var(--surface-hover) !important;
}

body.theme-light .hamburger {
    color: var(--text) !important;
}

/* Hero Section Light Mode */
body.theme-light .hero h1 {
    background: linear-gradient(135deg, #0f172a, #475569) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

body.theme-light .hero p {
    color: var(--text-muted) !important;
}

/* Panels & Cards Light Mode */
body.theme-light .panel {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    color: var(--text) !important;
}

body.theme-light .glass-panel {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    color: var(--text) !important;
}

/* Mobile Bottom Nav Light Mode */
body.theme-light .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06) !important;
}

body.theme-light .mobile-nav-item {
    color: var(--text-muted) !important;
}

body.theme-light .mobile-nav-item.active,
body.theme-light .mobile-nav-item:hover {
    color: var(--secondary) !important;
}

body.theme-light .mobile-nav-item.active i,
body.theme-light .mobile-nav-item.active svg {
    color: var(--secondary) !important;
}

/* Mobile Drawer Light Mode */
body.theme-light .mobile-drawer-sheet {
    background: #ffffff !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.12) !important;
    color: var(--text) !important;
}

body.theme-light .mobile-drawer-header {
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light .mobile-drawer-btn {
    background: var(--surface-hover) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .mobile-drawer-btn:hover {
    background: #e2e8f0 !important;
}

/* Match Hub Date Cards & Rows Light Mode */
body.theme-light .match-hub-date-card {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light .match-hub-date-card.active {
    background: var(--surface-hover) !important;
    border-color: var(--secondary) !important;
    box-shadow: 0 0 0 1px var(--secondary) !important;
}

body.theme-light .match-card-row {
    border-bottom: 1px solid var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .match-card-row:hover {
    background: var(--surface-hover) !important;
}

body.theme-light .match-vs-badge {
    background: var(--surface-hover) !important;
    color: var(--text-muted) !important;
}

body.theme-light .fixture-item-card .match-card-row {
    border-bottom: none !important;
    background: transparent !important;
}

body.theme-light .fixture-item-card:not(:last-child) {
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light a.fixture-item-card:hover,
body.theme-light .match-hub-fixture-card:hover,
body.theme-light .fixture-clickable-card:hover {
    background: var(--surface-hover) !important;
}

body.theme-light .match-venue-link {
    color: var(--text-muted);
}

body.theme-light .match-venue-link:hover {
    color: var(--primary) !important;
}

body.theme-light .match-entity-link {
    color: var(--text);
}

body.theme-light .match-entity-link:hover {
    color: var(--primary) !important;
}

body.theme-light .match-hub-fixture-card:hover .match-team-name {
    color: var(--primary) !important;
}

/* Table Light Mode */
body.theme-light table,
body.theme-light .table {
    color: var(--text) !important;
}

body.theme-light th {
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light td {
    color: var(--text) !important;
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light tr:hover td {
    background-color: var(--surface-hover) !important;
}

body.theme-light .standings-table .col-team a {
    color: var(--text) !important;
}

/* Responsive Card Table in Light Mode */
body.theme-light .responsive-card-table tr {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light .responsive-card-table td {
    border-bottom: 1px solid var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .responsive-card-table td::before {
    color: var(--text-muted) !important;
}

/* Scorecard & Bracket Light Mode */
body.theme-light .scorecard-frame-grid {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.theme-light .bracket-pill-btn {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
}

body.theme-light .bracket-pill-btn.active,
body.theme-light .bracket-pill-btn:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
}

/* Hero Match & H2H Light Mode */
body.theme-light .hero-match-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

body.theme-light .h2h-stat-row {
    border-bottom: 1px solid var(--border) !important;
}

/* Buttons Light Mode */
body.theme-light .btn-outline {
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    background: transparent !important;
}

body.theme-light .btn-outline:hover {
    background: var(--surface-hover) !important;
    border-color: var(--text) !important;
}

body.theme-light .hero .btn-outline {
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

body.theme-light .hero .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
}

body.theme-light .btn-secondary {
    background-color: var(--surface-hover) !important;
    color: var(--text) !important;
}

body.theme-light .theme-switcher {
    border-color: var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .theme-switcher:hover {
    background: var(--surface-hover) !important;
}

/* Admin Elements Light Mode */
body.theme-light .admin-sidebar {
    background: rgba(255, 255, 255, 0.98) !important;
    border-right: 1px solid var(--border) !important;
}

body.theme-light .admin-sidebar-header {
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light .admin-nav-item {
    color: var(--text-muted) !important;
}

body.theme-light .admin-nav-item:hover,
body.theme-light .admin-nav-item.active {
    color: var(--text) !important;
    background: var(--surface-hover) !important;
}

body.theme-light .admin-topbar {
    border-bottom: 1px solid var(--border) !important;
}

body.theme-light .admin-modal-dialog {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .admin-modal-header,
body.theme-light .admin-modal-footer {
    background: var(--surface-hover) !important;
    border-color: var(--border) !important;
}

body.theme-light .admin-modal-close {
    color: var(--text-muted) !important;
}

body.theme-light .admin-modal-close:hover {
    color: var(--text) !important;
    background: rgba(0, 0, 0, 0.06) !important;
}

body.theme-light .admin-sidebar-close {
    background: var(--surface-hover) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

body.theme-light .mobile-toggle {
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

/* Map Containers in Light Mode */
body.theme-light #singleVenueMap,
body.theme-light #masterVenuesMap,
body.theme-light #addVenueMap,
body.theme-light #editVenueMap {
    background: #e2e8f0 !important;
}

/* Points Badge & Filter Pills Light Mode */
.pts-badge {
    display: inline-block;
    font-weight: 800;
    color: #ffffff;
    background: var(--secondary, #10b981);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 28px;
    text-align: center;
}

body.theme-light .pts-badge {
    background: #059669 !important;
    color: #ffffff !important;
}

.pts-badge.pts-has-deduction {
    background: #dc2626 !important;
    color: #ffffff !important;
}

body.theme-light .pts-badge.pts-has-deduction {
    background: #dc2626 !important;
    color: #ffffff !important;
}

.deduction-subtag {
    display: block;
    font-size: 0.65rem;
    color: #ef4444;
    font-weight: 700;
    line-height: 1;
    margin-top: 3px;
    letter-spacing: -0.2px;
}

.deduction-star {
    color: #ef4444;
    font-weight: 800;
    margin-left: 2px;
    cursor: help;
}

.standings-rules-badge {
    display: inline-flex;
    align-items: center;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.standings-deductions-note {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface-hover);
    border-radius: var(--radius);
}

.standings-deductions-header {
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.standings-deductions-list {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.6;
}

.deduction-val {
    color: #ef4444;
    font-weight: 700;
}

body.theme-light .match-score-badge {
    background: #059669 !important;
    color: #ffffff !important;
}

/* Division / Competition Switcher Tabs & Pills (Homepage & Standings) */
.home-division-tabs,
.comp-filter-tabs {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.home-div-tab-btn,
.comp-filter-btn {
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface-hover);
    border-radius: 9999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.home-div-tab-btn:hover,
.comp-filter-btn:hover {
    color: var(--text);
    border-color: var(--primary-light);
    text-decoration: none;
}

.home-div-tab-btn.active,
.comp-filter-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    font-weight: 600;
}

body.theme-light .home-div-tab-btn,
body.theme-light .comp-filter-btn {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-muted);
}

body.theme-light .home-div-tab-btn:hover,
body.theme-light .comp-filter-btn:hover {
    color: var(--text);
    border-color: var(--primary-light);
}

body.theme-light .home-div-tab-btn.active,
body.theme-light .comp-filter-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

body.theme-light .match-card-btn {
    background: #F1F5F9 !important;
    border-color: #CBD5E1 !important;
    color: var(--primary) !important;
}

body.theme-light .match-card-btn:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

body.theme-light .match-card-btn-live {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #dc2626 !important;
}

body.theme-light .match-card-btn-live:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
}

/* Bracket Match Venue Badges */
.bracket-match-venue {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.bracket-match-venue i {
    color: var(--primary-light);
    font-size: 0.7rem;
}
.badge-neutral-tbd {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
}

/* ==========================================================================
   Match Card Frame Breakdown
   ========================================================================== */
.frame-set-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.frame-set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.frame-set-title {
    margin: 0;
    color: var(--primary-light);
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.frame-set-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface-hover);
    padding: 0.18rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    font-weight: 500;
}

.frame-set-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.frame-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.frame-row:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(255, 255, 255, 0.05);
}

.frame-player {
    min-width: 0;
    line-height: 1.35;
}

.frame-player-home {
    text-align: right;
}

.frame-player-away {
    text-align: left;
}

.frame-player-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.frame-player-home .frame-player-name {
    justify-content: flex-end;
}

.frame-player-away .frame-player-name {
    justify-content: flex-start;
}

.frame-player-name a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frame-player-name a:hover {
    color: var(--primary-light);
}

.frame-player.is-winner .frame-player-name a,
.frame-player.is-winner .frame-player-name {
    font-weight: 700;
    color: var(--text);
}

.frame-player.is-loser .frame-player-name a,
.frame-player.is-loser .frame-player-name {
    color: var(--text-muted);
    font-weight: 400;
}

.frame-win-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    font-size: 0.72rem;
    margin: 0 0.35rem;
    flex-shrink: 0;
}

.frame-doubles-partner {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.frame-doubles-partner a {
    color: inherit;
    text-decoration: none;
}

.frame-doubles-partner a:hover {
    color: var(--primary-light);
}

/* Center Status Widget: [W] [F1] [L] */
.frame-center-unit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex-shrink: 0;
    user-select: none;
}

.frame-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.2px;
    transition: all 0.2s ease;
}

.frame-status-badge.badge-win {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.frame-status-badge.badge-loss {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border);
    opacity: 0.7;
}

.frame-status-badge.badge-pending {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    font-size: 0.72rem;
    opacity: 0.4;
}

.frame-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.22rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 42px;
}

/* Light Mode Overrides */
body.theme-light .frame-set-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.theme-light .frame-set-header {
    border-color: #e2e8f0;
}

body.theme-light .frame-set-count {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

body.theme-light .frame-row {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.theme-light .frame-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body.theme-light .frame-status-badge.badge-win {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
    box-shadow: none;
}

body.theme-light .frame-status-badge.badge-loss {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

body.theme-light .frame-status-badge.badge-pending {
    background: transparent;
    border-color: #cbd5e1;
    color: #94a3b8;
}

body.theme-light .frame-pill {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #475569;
}

/* Mobile responsive adjustments */
@media (max-width: 540px) {
    .frame-set-card {
        padding: 0.75rem 0.55rem;
    }
    
    .frame-row {
        padding: 0.5rem 0.55rem;
        gap: 0.4rem;
    }
    
    .frame-player-name {
        font-size: 0.8rem;
    }
    
    .frame-doubles-partner {
        font-size: 0.7rem;
    }
    
    .frame-center-unit {
        gap: 0.25rem;
    }
    
    .frame-status-badge {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
        border-radius: 5px;
    }
    
    .frame-pill {
        padding: 0.15rem 0.45rem;
        font-size: 0.68rem;
        min-width: 34px;
    }
    
    .frame-win-tick {
        font-size: 0.65rem;
        margin: 0 0.2rem;
    }
}

/* ==========================================================================
   Fixtures Page & Results Cross-Table Matrix
   ========================================================================== */
.fixtures-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.view-toggle-group {
    display: inline-flex;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 3px;
    gap: 2px;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.view-toggle-btn:hover {
    color: var(--text);
}

.view-toggle-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Fixture Matrix / Cross-Table Styles */
.fixture-matrix-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.75rem;
    position: relative;
    scrollbar-width: thin;
}

.fixture-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 580px;
    font-size: 0.85rem;
}

.fixture-matrix-table th,
.fixture-matrix-table td {
    padding: 0.65rem 0.5rem;
    text-align: center;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.fixture-matrix-table th:last-child,
.fixture-matrix-table td:last-child {
    border-right: none;
}

.fixture-matrix-table tr:last-child td {
    border-bottom: none;
}

.matrix-corner-th {
    background: var(--surface-hover);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 3;
    min-width: 150px;
    text-align: left !important;
    padding-left: 0.85rem !important;
    border-right: 2px solid var(--border) !important;
}

.matrix-col-header {
    background: var(--surface-hover);
    color: var(--text);
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 75px;
    white-space: nowrap;
}

.matrix-row-header {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    text-align: left !important;
    padding-left: 0.85rem !important;
    border-right: 2px solid var(--border) !important;
    white-space: nowrap;
    min-width: 150px;
}

.matrix-diagonal-cell {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    opacity: 0.4;
    cursor: not-allowed;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255, 255, 255, 0.05) 4px, rgba(255, 255, 255, 0.05) 8px);
}

.matrix-cell-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none !important;
    transition: all 0.15s ease;
    min-width: 52px;
}

.matrix-cell-win {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.matrix-cell-loss {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.matrix-cell-draw {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.matrix-cell-unplayed {
    background: var(--surface-hover);
    color: var(--primary-light) !important;
    border: 1px dashed var(--border);
    font-size: 0.72rem;
    font-weight: 600;
}

.matrix-cell-link:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Light Mode Overrides for Fixtures & Matrix */
body.theme-light .fixtures-control-bar {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

body.theme-light .view-toggle-group {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body.theme-light .view-toggle-btn {
    color: #64748b;
}

body.theme-light .view-toggle-btn:hover {
    color: #0f172a;
}

body.theme-light .view-toggle-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
}

body.theme-light .fixture-matrix-wrapper {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

body.theme-light .matrix-corner-th,
body.theme-light .matrix-col-header {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

body.theme-light .matrix-row-header {
    background: #ffffff;
    color: #0f172a;
    border-right-color: #cbd5e1 !important;
    border-bottom-color: #e2e8f0;
}

body.theme-light .fixture-matrix-table th,
body.theme-light .fixture-matrix-table td {
    border-color: #e2e8f0;
}

body.theme-light .matrix-diagonal-cell {
    background: #f8fafc;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0, 0, 0, 0.04) 4px, rgba(0, 0, 0, 0.04) 8px);
}

body.theme-light .matrix-cell-win {
    background: #ecfdf5;
    color: #059669 !important;
    border-color: #a7f3d0;
}

body.theme-light .matrix-cell-loss {
    background: #fef2f2;
    color: #dc2626 !important;
    border-color: #fecaca;
}

body.theme-light .matrix-cell-draw {
    background: #fffbeb;
    color: #d97706 !important;
    border-color: #fde68a;
}

body.theme-light .matrix-cell-unplayed {
    background: #f8fafc;
    color: var(--primary) !important;
    border-color: #cbd5e1;
}

body.theme-light .match-round-tag {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

body.theme-light .match-time-tag {
    color: #0f172a;
}

body.theme-light .match-time-tag.match-time-ft {
    color: #059669;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

body.theme-light .fixture-item-card:hover {
    background: #f8fafc;
}

body.theme-light .fixture-item-card:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 640px) {
    .fixtures-control-bar {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
    }
    
    .view-toggle-btn {
        padding: 0.3rem 0.65rem;
        font-size: 0.75rem;
    }
    
    .matrix-row-header {
        min-width: 120px;
        font-size: 0.8rem;
    }
    
    .matrix-corner-th {
        min-width: 120px;
    }

    .match-meta-left {
        min-width: 58px;
        gap: 0.1rem;
    }

    .match-time-tag {
        font-size: 0.72rem;
    }

    .match-time-tag.match-time-ft {
        font-size: 0.65rem;
        padding: 0.05rem 0.25rem;
    }

    .match-round-tag {
        font-size: 0.62rem;
        padding: 0.04rem 0.25rem;
    }

    .match-card-action {
        min-width: 52px;
    }

    .fixture-item-card {
        padding: 0.25rem 0.2rem 0.45rem 0.2rem;
    }

    .fixture-item-subline {
        padding: 0.1rem 0.25rem 0.1rem 0.25rem;
        font-size: 0.72rem;
    }
}

/* Deep link target highlight for frame-row */
.frame-row:target {
    border-color: var(--primary, #3b82f6) !important;
    background: rgba(59, 130, 246, 0.12) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.35);
}

/* Player Profile Match History with Frame Breakdown */
.player-history-match-card {
    background: var(--surface-hover, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius, 10px);
    overflow: hidden;
    margin-bottom: 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.player-history-match-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.player-history-match-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    padding: 0.65rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.player-history-match-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.player-history-score-bar {
    padding: 1rem 1rem 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.player-history-frames-section {
    padding: 0.75rem 1rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.12);
}

.player-history-frame-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    gap: 0.6rem;
    transition: all 0.15s ease;
}

.player-history-frame-item:last-child {
    margin-bottom: 0;
}

.player-history-frame-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.player-history-frame-item.frame-won {
    border-left: 3px solid #10b981;
}

.player-history-frame-item.frame-lost {
    border-left: 3px solid #ef4444;
}

@media (max-width: 640px) {
    .player-history-score-bar {
        flex-direction: column;
        text-align: center;
    }
    .player-history-frame-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .player-history-frame-actions {
        align-self: flex-end;
    }
}

/* ==========================================================================
   FargoRate Styles & UI Components
   ========================================================================== */

.fargo-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text);
    white-space: nowrap;
    vertical-align: middle;
}

.fargo-val {
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: -0.3px;
}

.fargo-tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
}

.tier-elite {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.tier-advanced {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.tier-upper-int {
    background: rgba(6, 182, 212, 0.18);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.tier-intermediate {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.tier-lower-int {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.tier-novice {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.fargo-robustness-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.fargo-robustness-pill.established {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
}

.fargo-hero-card {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.fargo-hero-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

/* Head-to-Head Fargo Prediction Component */
.h2h-fargo-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.fargo-odds-bar-wrap {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 9999px;
    height: 14px;
    overflow: hidden;
    display: flex;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
}

.fargo-odds-fill-p1 {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fargo-odds-fill-p2 {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================= */
/* STATS TABLE RESPONSIVE MOBILE-FIRST DESIGN */
/* ================================================= */
.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 0.65rem 0.5rem;
    vertical-align: middle;
}

.stats-mobile-team {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.stats-mobile-robust {
    display: none;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.stats-mobile-record {
    display: none;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* On tablets and mobile phones: <= 768px */
@media (max-width: 768px) {
    /* Hide desktop-only columns completely on mobile to eliminate horizontal scrolling */
    .stats-col-desktop {
        display: none !important;
    }

    .stats-table th,
    .stats-table td {
        padding: 0.5rem 0.35rem;
        font-size: 0.85rem;
    }

    .stats-mobile-team {
        display: block;
    }

    .stats-mobile-robust {
        display: block;
    }

    .stats-mobile-record {
        display: block;
    }

    .fargo-rating-badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.8rem;
    }

    .fargo-rating-badge i {
        font-size: 0.65rem;
    }

    .fargo-val {
        font-size: 0.85rem;
    }

    .fargo-tier-pill {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }

    /* Head-to-Head Fargo Card Mobile Stack */
    .h2h-fargo-card {
        padding: 0.85rem 0.65rem;
    }

    .h2h-fargo-grid {
        grid-template-columns: 1fr !important;
    }

    /* Frame player row on mobile */
    .frame-player-name {
        flex-wrap: wrap;
        gap: 0.2rem;
    }

    .frame-player-name a {
        min-width: 0;
        max-width: 100%;
    }

    .frame-player-name .fargo-rating-badge {
        font-size: 0.65rem;
        padding: 0.05rem 0.3rem;
    }

    /* Head-to-Head Modal & Comparison Mobile Responsiveness */
    .h2h-modal-dialog {
        padding: 1rem 0.65rem !important;
        width: 95% !important;
    }

    .h2h-results-box {
        padding: 0.75rem 0.5rem !important;
    }

    .h2h-stat-row {
        flex-wrap: wrap;
        padding: 0.55rem 0;
        gap: 0.2rem 0;
    }

    .h2h-stat-label {
        order: 1;
        width: 100%;
        flex: 0 0 100%;
        text-align: center;
        margin-bottom: 0.25rem;
        font-size: 0.72rem;
        padding: 0;
    }

    .h2h-val-left {
        order: 2;
        width: 50%;
        flex: 0 0 50%;
        justify-content: flex-start;
        font-size: 0.82rem;
    }

    .h2h-val-right {
        order: 3;
        width: 50%;
        flex: 0 0 50%;
        justify-content: flex-end;
        font-size: 0.82rem;
    }

    /* Scale form streak badges inside H2H comparisons to fit cleanly on mobile */
    .h2h-stat-row .form-streak {
        gap: 0.2rem;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .h2h-stat-row .form-badge {
        width: 20px;
        height: 20px;
        font-size: 0.62rem;
        flex-shrink: 0;
    }

    .h2h-players-header {
        gap: 0.35rem !important;
    }

    .h2h-players-header .h2h-player-summary div[style*="font-size: 1.75rem"] {
        font-size: 1.35rem !important;
    }
}

/* Ultra-compact mobile screens down to 320px */
@media (max-width: 360px) {
    .h2h-modal-dialog {
        padding: 0.75rem 0.4rem !important;
        width: 98% !important;
    }

    .h2h-results-box {
        padding: 0.6rem 0.35rem !important;
    }

    .h2h-stat-row .form-badge {
        width: 18px;
        height: 18px;
        font-size: 0.58rem;
    }

    .h2h-stat-row .form-streak {
        gap: 0.15rem;
    }

    .h2h-val-left,
    .h2h-val-right {
        font-size: 0.75rem;
    }
}

/* Quill Editor Placeholder Dark Mode Visibility */
.ql-editor.ql-blank::before {
    color: var(--text-muted, #94a3b8) !important;
    font-style: italic;
    opacity: 0.65;
}

body.theme-light .ql-editor.ql-blank::before,
html.theme-light .ql-editor.ql-blank::before {
    color: #64748b !important;
    opacity: 0.75;
}

/* ==========================================================================
   Closest Date Scroll & Target Highlight Animation
   ========================================================================== */
@keyframes targetDatePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
        border-color: var(--primary-light);
    }
    30% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.3);
        border-color: #38bdf8;
        background-color: rgba(59, 130, 246, 0.12);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        border-color: var(--border);
    }
}

@keyframes targetRowPulse {
    0% {
        background-color: rgba(59, 130, 246, 0.35) !important;
    }
    40% {
        background-color: rgba(59, 130, 246, 0.2) !important;
    }
    100% {
        background-color: transparent !important;
    }
}

.highlight-target-date {
    animation: targetDatePulse 2.4s ease-out forwards;
    scroll-margin: 90px;
    position: relative;
    z-index: 5;
}

tr.highlight-target-date {
    animation: targetRowPulse 2.4s ease-out forwards;
    scroll-margin: 90px;
    outline: 2px solid var(--primary-light);
    outline-offset: -2px;
}

.btn-closest-date {
    transition: all 0.25s ease;
}

.btn-closest-date:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
    transform: translateY(-1px);
}

body.theme-light .highlight-target-date {
    animation-name: targetDatePulseLight;
}

@keyframes targetDatePulseLight {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.6);
        border-color: #2563eb;
    }
    30% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.2);
        border-color: #2563eb;
        background-color: rgba(37, 99, 235, 0.08);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
        border-color: var(--border);
    }
}

body.theme-light tr.highlight-target-date {
    animation-name: targetRowPulseLight;
    outline-color: #2563eb;
}

@keyframes targetRowPulseLight {
    0% {
        background-color: rgba(37, 99, 235, 0.25) !important;
    }
    40% {
        background-color: rgba(37, 99, 235, 0.12) !important;
    }
    100% {
        background-color: transparent !important;
    }
}

/* ==========================================================================
   Break & Run / Dish Badges
   ========================================================================== */
.dish-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.2px;
    text-transform: none;
    vertical-align: middle;
}
.dish-break {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.dish-reverse {
    background: rgba(168, 85, 247, 0.16);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   Live SSE Score Pulse Animation
   ========================================================================== */
.live-pulse-update {
    animation: liveScoreFlash 1.6s ease-out;
}
@keyframes liveScoreFlash {
    0% {
        transform: scale(1.15);
        background-color: rgba(239, 68, 68, 0.4) !important;
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    }
    100% {
        transform: scale(1);
        background-color: transparent;
        box-shadow: none;
    }
}

/* ==========================================================================
   Achievements & Milestone Badges
   ========================================================================== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 0.75rem;
}
.achievement-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.achievement-card.achieved {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(16, 185, 129, 0.08));
}
.achievement-card.locked {
    opacity: 0.55;
    filter: grayscale(0.5);
}
.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.achievement-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.achievement-card.achieved .achievement-icon-wrap {
    box-shadow: 0 0 12px currentColor;
}
.achievement-info {
    flex: 1;
    min-width: 0;
}
.achievement-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.achievement-progress-wrap {
    margin-top: 0.4rem;
    width: 100%;
}
.achievement-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}
.achievement-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ==========================================================================
   Share Card Canvas & Social Modal
   ========================================================================== */
.share-modal-dialog {
    max-width: 580px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    border: 1px solid var(--border);
    position: relative;
    padding: 1.25rem;
}
.share-canvas-container {
    text-align: center;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px solid var(--border);
}
.share-canvas-preview {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: block;
    margin: 0 auto;
}
.share-text-box {
    width: 100%;
    min-height: 110px;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    resize: vertical;
    box-sizing: border-box;
}

/* ==========================================================================
   PWA Mobile Install Banner & iOS Install Guide
   ========================================================================== */
.pwa-install-banner {
    display: none;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 8px);
    max-width: min(480px, calc(100vw - 20px));
    margin: 0 auto;
    background: var(--surface, #1e293b);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    padding: 0.65rem 0.8rem;
    z-index: 1001;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-sizing: border-box;
    animation: pwaSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.pwa-install-banner-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.pwa-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    object-fit: cover;
}

.pwa-install-text {
    min-width: 0;
    overflow: hidden;
}

.pwa-install-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.pwa-install-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: 1px;
}

.pwa-install-banner-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.pwa-btn-install {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

.pwa-btn-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 1.05rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    box-sizing: border-box;
}

.pwa-btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text, #f8fafc);
}

/* Light mode adjustments */
body.theme-light .pwa-install-banner {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
}

body.theme-light .pwa-btn-dismiss:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Hide on desktop viewports */
@media (min-width: 769px) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* iOS instructions sheet modal */
.pwa-ios-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10005;
}

.pwa-ios-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pwa-ios-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    max-height: 80vh;
    background: var(--surface, #1e293b);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1.15rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) 1.15rem;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.22s ease-out;
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.85rem;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    background: var(--surface-hover, rgba(255, 255, 255, 0.04));
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    line-height: 1.35;
}

.pwa-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary, #1e3a8a);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ==========================================================================
   Footer Privacy & Cookie Links
   ========================================================================== */
.footer-links-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem 0.65rem;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.5;
}

.footer-link {
    color: var(--text-muted, #94a3b8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--text, #f8fafc);
    text-decoration: underline;
}

.footer-link-btn {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: var(--transition);
}

.footer-link-btn:hover {
    color: var(--text, #f8fafc);
    text-decoration: underline;
}

.footer-divider {
    color: var(--border, #334155);
    user-select: none;
}

/* ==========================================================================
   Cookie Consent Banner & Preferences Modal (GDPR / PECR Compliant)
   ========================================================================== */
.cookie-consent-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: calc(100% - 48px);
    max-width: 480px;
    background: rgba(30, 41, 59, 0.94);
    border: 1px solid var(--border, #334155);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10020;
    box-sizing: border-box;
    animation: cookieBannerSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cookieBannerSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cookie-consent-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.cookie-consent-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cookie-consent-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.cookie-consent-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text, #f8fafc);
}

.cookie-consent-desc {
    font-size: 0.83rem;
    color: var(--text-muted, #94a3b8);
    line-height: 1.5;
    margin: 0;
}

.cookie-inline-link {
    color: var(--primary-light, #38bdf8);
    text-decoration: underline;
}

.cookie-inline-link:hover {
    color: var(--text, #fff);
}

.cookie-consent-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.cookie-btn-accept {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
}

.cookie-btn-essential {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
}

.cookie-btn-custom {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.82rem !important;
    color: var(--text-muted, #94a3b8) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.cookie-btn-custom:hover {
    color: var(--text, #fff) !important;
    background: var(--surface-hover) !important;
}

/* Mobile responsive layout for cookie banner (clears fixed mobile nav) */
@media (max-width: 768px) {
    .cookie-consent-banner {
        left: 10px;
        right: 10px;
        bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 8px);
        width: auto;
        max-width: calc(100vw - 20px);
        margin: 0 auto;
        padding: 0.85rem;
    }

    .cookie-consent-actions button {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 90px;
    }
}

@media (max-width: 380px) {
    .cookie-consent-actions {
        flex-direction: column;
        width: 100%;
    }
    .cookie-consent-actions button {
        width: 100%;
    }
}

/* Cookie Preferences Modal Backdrop & Sheet */
body.cookie-modal-open {
    overflow: hidden !important;
}

.cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10025;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.cookie-modal-sheet {
    position: relative;
    background: var(--surface, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    animation: cookieModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cookieModalPop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.cookie-modal-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-light, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.cookie-modal-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cookie-modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.cookie-cat-card {
    background: var(--surface-hover, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.95rem 1rem;
    margin-bottom: 0.85rem;
}

.cookie-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.cookie-cat-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cookie-cat-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.cookie-badge-required {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cookie-badge-optional {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-light, #60a5fa);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cookie-cat-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

/* Custom modern toggle switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-switch-slider {
    position: absolute;
    inset: 0;
    background-color: var(--border, #475569);
    border-radius: 24px;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-switch-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.cookie-switch input:checked + .cookie-switch-slider {
    background-color: var(--secondary, #10b981);
}

.cookie-switch input:checked + .cookie-switch-slider::before {
    transform: translateX(20px);
}

.cookie-switch input:focus-visible + .cookie-switch-slider {
    box-shadow: 0 0 0 2px var(--primary-light);
}

.cookie-modal-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .cookie-modal-footer {
        flex-direction: column;
        width: 100%;
    }
    .cookie-modal-footer button {
        width: 100%;
    }
}

/* Light Mode Overrides */
body.theme-light .cookie-consent-banner {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
}

body.theme-light .cookie-modal-sheet {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
}

body.theme-light .cookie-cat-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.theme-light .cookie-btn-custom:hover {
    background: #f1f5f9 !important;
}








