        :root {
            --gold: #ae9042;
            --gold-dark: #8a7235;
            --charcoal: #1a1a1a;
            --charcoal-light: #2a2a2a;
            --charcoal-lighter: #3a3a3a;
            --text: #e8e8e8;
            --text-muted: #888;
            --birdie: #2e7d32;
            --eagle: #1565c0;
            --bogey: #b45309;
            --double: #b91c1c;
            --par-bg: transparent;
            --border-subtle: rgba(255, 255, 255, 0.14);
            --border-color: rgba(255, 255, 255, 0.18);
            --border-medium: rgba(255, 255, 255, 0.22);
            --shadow-color: rgba(0, 0, 0, 0.5);
            --card-bg: rgba(58, 58, 58, 0.92);
            --card-text: #e8e8e8;
            --card-radius: 14px;
            --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
            --hover-bg: rgba(255, 255, 255, 0.08);
            --row-stripe: rgba(255, 255, 255, 0.02);
            --row-hover: rgba(174, 144, 66, 0.08);
            --footer-bg: rgba(30, 30, 30, 0.95);

            /* Z-Index Scale */
            --z-sticky: 10;
            --z-sticky-nav: 20;
            --z-sticky-bar: 100;
            --z-sidebar: 200;
            --z-modal: 5001;
            --z-toast: 6000;
        }

        [data-theme="light"] {
            --charcoal: #f0f0f0;
            --charcoal-light: #f8f8f8;
            --charcoal-lighter: #e2e2e2;
            --text: #1a1a1a;
            --text-muted: #666;
            --border-subtle: rgba(0, 0, 0, 0.12);
            --border-color: rgba(0, 0, 0, 0.18);
            --border-medium: rgba(0, 0, 0, 0.2);
            --shadow-color: rgba(0, 0, 0, 0.1);
            --card-bg: rgba(255, 255, 255, 0.92);
            --card-text: #222;
            --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
            --hover-bg: rgba(0, 0, 0, 0.05);
            --row-stripe: rgba(0, 0, 0, 0.02);
            --row-hover: rgba(174, 144, 66, 0.08);
            --footer-bg: rgba(255, 255, 255, 0.95);
            --birdie: #2e7d32;
            --eagle: #1565c0;
            --bogey: #b45309;
            --double: #b91c1c;
        }

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

        html {
            overflow-x: hidden;
            width: 100%;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--charcoal);
            color: var(--text);
            min-height: 100vh;
            min-height: 100dvh;
            width: 100%;
            overflow-x: hidden;
            overscroll-behavior-x: none;
            position: relative;
        }

        /* Pull-to-refresh indicator */
        .ptr-indicator {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            overflow: hidden;
            background: var(--charcoal-light);
            color: var(--text-muted);
            font-size: 0.8rem;
            transition: height 0.2s ease, opacity 0.2s ease;
        }

        .ptr-spinner {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
        }

        .ptr-spinner circle {
            fill: none;
            stroke: var(--gold);
            stroke-width: 3;
            stroke-dasharray: 50;
            stroke-dashoffset: 50;
            stroke-linecap: round;
            transform-origin: center;
        }

        .ptr-indicator.refreshing .ptr-spinner {
            animation: ptr-spin 0.8s linear infinite;
        }

        @keyframes ptr-spin {
            to { transform: rotate(360deg); }
        }

        [data-theme="light"] .ptr-indicator {
            background: var(--charcoal-lighter);
            color: var(--text-muted);
        }

        /* Background image on picker */
        .bg-scene {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
            background: url('images/login-background.jpg') center/cover no-repeat;
        }

        .bg-scene::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(0, 0, 0, 0.88), rgba(20, 20, 20, 0.85));
            backdrop-filter: blur(2px);
            -webkit-backdrop-filter: blur(2px);
        }

        [data-theme="light"] .bg-scene::after {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(245, 245, 245, 0.85));
        }

        /* Header */
        .header {
            background: linear-gradient(135deg, var(--charcoal-light) 0%, var(--charcoal) 100%);
            border-bottom: 3px solid var(--gold);
            padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem 1rem;
            text-align: center;
            position: sticky;
            top: 0;
            z-index: var(--z-sticky-bar);
            width: 100%;
        }

        .header-brand {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
            position: relative;
        }

        .header-home {
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: 1px solid var(--border-medium);
            color: var(--text);
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s;
            text-decoration: none;
        }

        .header-home:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        .header-home svg {
            width: 16px;
            height: 16px;
        }

        [data-theme="light"] .header-home:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        .header-brand .theme-toggle {
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
        }

        .header-brand img {
            height: 36px;
            width: auto;
        }

        .brand-dark {
            display: inline;
        }

        .brand-light {
            display: none;
        }

        [data-theme="light"] .brand-dark {
            display: none;
        }

        [data-theme="light"] .brand-light {
            display: inline;
        }

        .header-brand svg {
            flex-shrink: 0;
        }

        .header h1 {
            font-size: 1.5rem;
            color: var(--gold);
            font-weight: 700;
        }

        .header-meta {
            font-size: 0.8rem;
            color: var(--text-muted);
            display: flex;
            gap: 1rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        /* Dashboard-style tournament header */
        .dash-header {
            background: linear-gradient(135deg, var(--charcoal-light) 0%, var(--charcoal) 100%);
            border-bottom: 3px solid var(--gold);
            padding: calc(0.5rem + env(safe-area-inset-top, 0px)) 1rem 0.5rem;
            position: sticky;
            top: 0;
            z-index: var(--z-sticky-bar);
        }

        /* Top utility row: back, logo, actions */
        .dash-top-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            max-width: 1200px;
            margin: 0 auto 0.35rem;
            position: relative;
        }

        .dash-top-left {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            flex-shrink: 0;
        }

        .dash-back {
            background: none;
            border: 1px solid var(--border-medium);
            color: var(--text);
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s;
            flex-shrink: 0;
        }

        .dash-back:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        .dash-back svg {
            width: 16px;
            height: 16px;
        }

        .dash-logo-center {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        .dash-logo-center img {
            height: 28px;
            width: auto;
        }

        .dash-top-actions {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-shrink: 0;
        }

        /* Tournament info row */
        .dash-info {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.6rem;
            max-width: 1200px;
            margin: 0 auto;
            flex-wrap: wrap;
            text-align: center;
            min-width: 0;
        }

        .dash-info .tournament-logo {
            height: 28px;
            width: auto;
            flex-shrink: 0;
        }

        .dash-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--gold);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .dash-meta {
            display: flex;
            align-items: center;
            justify-content: space-evenly;
            width: 100%;
            flex-shrink: 0;
        }

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

        .dash-stat .label {
            font-size: 0.55rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
        }

        .dash-stat .value {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text);
        }

        .dash-refresh {
            font-size: 0.6rem;
            color: var(--text-muted);
            text-align: center;
            max-width: 1200px;
            margin: 0.2rem auto 0;
        }

        @media (max-width: 480px) {
            .dash-header {
                padding: calc(0.4rem + env(safe-area-inset-top, 0px)) 0.75rem 0.4rem;
            }

            .dash-top-left {
                gap: 0.3rem;
            }

            .dash-top-left .spec-follow-btn {
                padding: 0.25rem 0.5rem;
                font-size: 0.65rem;
            }

            .dash-top-actions {
                gap: 0.3rem;
            }

            .dash-top-actions .share-btn {
                padding: 0.25rem 0.4rem !important;
                font-size: 0.65rem !important;
            }

            .dash-logo-center img {
                height: 24px;
            }

            .dash-title {
                font-size: 0.9rem;
            }

            .dash-info {
                gap: 0.4rem;
            }

            .dash-meta {
                justify-content: space-evenly;
                width: 100%;
            }
        }

        .live-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            background: #e74c3c;
            color: white;
            padding: 0.15rem 0.6rem;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            animation: pulse-live 2s infinite;
        }

        .live-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: white;
            animation: blink 1s infinite;
        }

        @keyframes pulse-live {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.75;
            }
        }

        @keyframes blink {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.3;
            }
        }

        .refresh-info {
            font-size: 0.7rem;
            color: var(--text-muted);
            padding: 0.25rem 0;
        }

        /* Tabs */
        .tabs {
            display: flex;
            background: var(--charcoal-light);
            border-bottom: 1px solid var(--border-subtle);
            position: sticky;
            top: 0;
            z-index: var(--z-sticky-bar);
        }

        .tab-btn {
            flex: 1;
            padding: 0.75rem;
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.2s;
        }

        .tab-btn.active {
            color: var(--gold);
            border-bottom-color: var(--gold);
        }

        /* Container */
        .container {
            max-width: 1100px;
            margin: 0 auto;
            padding: 0 1rem;
        }

        /* Desktop: widen container to ~92% for hole-by-hole */
        @media (min-width: 1100px) {
            .container {
                max-width: 92%;
            }
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

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

        .leaderboard th {
            background: var(--charcoal-light);
            padding: 0.6rem 0.5rem;
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
            font-weight: 600;
            text-align: left;
            position: sticky;
            top: 0;
            z-index: var(--z-sticky);
            border-bottom: 1px solid var(--border-color);
        }

        .leaderboard th.center,
        .leaderboard td.center {
            text-align: center;
        }

        .leaderboard td {
            padding: 0.65rem 0.5rem;
            font-size: 0.85rem;
            border-bottom: 1px solid var(--border-subtle);
            vertical-align: middle;
        }

        .leaderboard tbody tr {
            cursor: pointer;
            transition: background 0.15s;
        }

        .leaderboard tbody tr:hover {
            background: var(--row-hover);
        }

        .leaderboard tbody tr:nth-child(even) {
            background: var(--row-stripe);
        }

        .leaderboard tbody tr:nth-child(even):hover {
            background: var(--row-hover);
        }

        .rank-cell {
            font-weight: 700;
            color: var(--gold);
            width: 35px;
            text-align: center;
        }

        /* ─── Sortable Headers ─── */
        th.sortable {
            cursor: pointer;
            user-select: none;
            position: relative;
            padding-right: 1.1rem;
            transition: color 0.15s;
        }

        th.sortable:hover {
            color: var(--gold);
        }

        th.sortable::after {
            content: '⇅';
            position: absolute;
            right: 0.2rem;
            top: 50%;
            transform: translateY(-50%);
            font-size: 0.6rem;
            opacity: 0.35;
            transition: opacity 0.15s;
        }

        th.sortable.sort-active::after {
            opacity: 0.9;
            color: var(--gold);
        }

        th.sortable.sort-asc::after {
            content: '▲';
        }

        th.sortable.sort-desc::after {
            content: '▼';
        }

        .player-name {
            font-weight: 600;
        }

        .player-school {
            font-size: 0.7rem;
            color: var(--text-muted);
        }

        /* ─── School Logo Badge ─── */
        .school-logo {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            object-fit: contain;
            flex-shrink: 0;
            background: var(--hover-bg);
            padding: 2px;
        }

        .school-logo-fallback {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 0.7rem;
            color: #fff;
            text-transform: uppercase;
            letter-spacing: -0.5px;
        }

        .player-info-cell {
            display: flex;
            align-items: center;
            gap: 0.45rem;
        }

        .player-info-text {
            min-width: 0;
        }

        .school-logo-sm {
            width: 22px;
            height: 22px;
        }

        .school-logo-sm.school-logo-fallback {
            width: 22px;
            height: 22px;
            font-size: 0.55rem;
        }

        .full-scorecard .player-cell .player-info-cell {
            gap: 0.35rem;
        }

        .full-scorecard .school-logo,
        .full-scorecard .school-logo-fallback {
            width: 22px;
            height: 22px;
            font-size: 0.55rem;
        }

        .indiv-table .school-logo,
        .indiv-table .school-logo-fallback {
            width: 20px;
            height: 20px;
            font-size: 0.5rem;
        }

        .indiv-table .player-info-cell {
            display: inline-flex;
            gap: 0.35rem;
        }

        .to-par {
            font-weight: 700;
            font-size: 0.95rem;
        }

        .to-par.under {
            color: var(--birdie);
        }

        .to-par.over {
            color: var(--bogey);
        }

        .to-par.even {
            color: var(--text);
        }

        .thru-cell {
            color: var(--text-muted);
            font-size: 0.8rem;
        }

        .thru-start {
            font-size: 0.68rem;
            color: var(--gold, #ae9142);
            font-weight: 600;
            white-space: nowrap;
        }

        /* ── Mobile Pairings Cards ── */
        .mobile-pairings {
            padding: 0;
        }

        .mp-group {
            background: var(--card-bg, #1e1e1e);
            border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
            border-radius: 10px;
            margin-bottom: 0.65rem;
            overflow: hidden;
        }

        .mp-group-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.6rem 0.85rem;
            background: var(--charcoal-lighter, #2a2a2a);
            font-weight: 600;
            font-size: 0.82rem;
            color: var(--primary-light, #d4b94e);
        }

        .mp-group-start {
            font-size: 0.72rem;
            color: var(--text-muted);
            font-weight: 500;
        }

        .mp-player {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.5rem 0.85rem;
            border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
            cursor: pointer;
        }

        .mp-player:active {
            background: rgba(174, 145, 66, 0.08);
        }

        .mp-player-info {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex: 1;
            min-width: 0;
        }

        .mp-name {
            font-size: 0.82rem;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mp-stats {
            display: flex;
            gap: 0.75rem;
            align-items: center;
            flex-shrink: 0;
            font-size: 0.78rem;
        }

        .mp-topar {
            min-width: 30px;
            text-align: center;
        }

        .mp-topar.over {
            color: var(--bogey, #e74c3c);
        }

        .mp-topar.under {
            color: var(--birdie, #2ecc71);
        }

        .mp-topar.even {
            color: var(--text-muted);
        }

        .mp-thru {
            min-width: 32px;
            text-align: center;
            color: var(--text-muted);
        }

        .mp-score {
            min-width: 28px;
            text-align: center;
            font-weight: 600;
        }

        .score-cell {
            font-weight: 600;
        }

        .jv-badge {
            font-size: 0.6rem;
            background: var(--hover-bg);
            padding: 0.1rem 0.35rem;
            border-radius: 8px;
            color: var(--text-muted);
            margin-left: 0.35rem;
            vertical-align: middle;
        }

        /* Team Standings */
        .team-card {
            background: var(--card-bg);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-color);
            border-radius: var(--card-radius);
            margin: 0.5rem 0.75rem;
            overflow: hidden;
            box-shadow: var(--card-shadow);
        }

        .team-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.85rem 1rem;
            border-bottom: 1px solid var(--border-subtle);
        }

        .team-rank {
            font-size: 1.4rem;
            font-weight: 800;
            color: var(--gold);
            min-width: 35px;
        }

        .team-info h3 {
            font-size: 0.95rem;
            font-weight: 700;
        }

        .team-info .team-label {
            font-size: 0.7rem;
            color: var(--text-muted);
        }

        .team-score {
            text-align: right;
        }

        .team-total {
            font-size: 1.3rem;
            font-weight: 800;
        }

        .team-to-par {
            font-size: 0.75rem;
        }

        .team-players {
            padding: 0.5rem 1rem;
        }

        .team-player-row {
            display: flex;
            justify-content: space-between;
            padding: 0.3rem 0;
            font-size: 0.8rem;
            color: var(--text-muted);
        }

        .team-player-row.counting {
            color: var(--text);
            font-weight: 500;
        }

        .team-player-row.not-counting {
            opacity: 0.5;
        }

        .team-player-row .tp-name {
            flex: 1;
        }

        .team-player-row .tp-score {
            font-weight: 700;
            min-width: 32px;
            text-align: right;
        }

        .team-player-row .tp-topar {
            min-width: 38px;
            text-align: right;
            font-size: 0.72rem;
        }

        .team-player-row .tp-topar.over {
            color: var(--bogey);
        }

        .team-player-row .tp-topar.under {
            color: var(--birdie);
        }

        .team-player-row .tp-topar.even {
            color: var(--text-muted);
        }

        /* ─── Advancing Section ─── */
        .advancing-group {
            margin: 0.5rem 0.75rem;
        }

        .advancing-group-title {
            font-size: 0.78rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--gold);
            margin-bottom: 0.4rem;
            padding: 0.3rem 0;
            border-bottom: 1px solid rgba(212, 175, 55, 0.3);
        }

        .advancing-badge {
            display: inline-block;
            background: rgba(46, 125, 50, 0.2);
            color: #66bb6a;
            font-size: 0.65rem;
            font-weight: 700;
            padding: 0.15rem 0.4rem;
            border-radius: 4px;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            margin-left: 0.4rem;
        }

        .team-card.advancing {
            border: 1px solid rgba(46, 125, 50, 0.35);
        }

        /* ─── Top Individuals Table ─── */
        .indiv-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.82rem;
            margin: 0 0.5rem;
        }

        .indiv-table th {
            text-align: left;
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            color: var(--text-muted);
            padding: 0.5rem 0.4rem;
            border-bottom: 2px solid var(--border-color);
        }

        .indiv-table td {
            padding: 0.45rem 0.4rem;
            border-bottom: 1px solid var(--border-subtle);
        }

        .indiv-table tr:hover {
            background: var(--hover-bg);
        }

        .indiv-table tr.advancing-row td {
            background: rgba(46, 125, 50, 0.08);
        }

        .indiv-table .rank-col {
            width: 36px;
            text-align: center;
            font-weight: 700;
            color: var(--gold);
        }

        .indiv-table .school-col {
            color: var(--text-muted);
            font-size: 0.72rem;
        }

        .indiv-table .score-col {
            text-align: right;
            font-weight: 700;
        }

        .indiv-table .topar-col {
            text-align: right;
        }

        .indiv-table .thru-col {
            text-align: center;
            color: var(--text-muted);
            font-size: 0.75rem;
        }

        [data-theme="light"] .indiv-table th {
            border-bottom-color: var(--border-color);
        }

        [data-theme="light"] .indiv-table td {
            border-bottom-color: var(--border-subtle);
        }

        [data-theme="light"] .indiv-table tr:hover {
            background: var(--hover-bg);
        }

        /* ─── Top Teams Filter ─── */
        .teams-filter-bar {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin: 0 0.75rem 0.5rem;
        }

        .teams-filter-bar select {
            background: var(--charcoal-lighter);
            color: var(--text);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 0.35rem 0.5rem;
            font-size: 0.78rem;
        }

        .teams-filter-bar label {
            font-size: 0.72rem;
            color: var(--text-muted);
            font-weight: 600;
        }

        /* Player Scorecard Modal */
        .scorecard-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: var(--z-modal);
            align-items: flex-end;
            justify-content: center;
        }

        .scorecard-overlay.active {
            display: flex;
        }

        .scorecard-panel {
            background: var(--card-bg);
            backdrop-filter: blur(10px);
            border: 1.5px solid var(--border-medium);
            border-radius: 16px 16px 0 0;
            width: 100%;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            animation: slideUp 0.3s ease;
            padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
        }

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

            to {
                transform: translateY(0);
            }
        }

        .scorecard-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem;
            border-bottom: 2px solid var(--gold);
            position: sticky;
            top: 0;
            background: var(--card-bg);
            z-index: var(--z-sticky);
        }

        .scorecard-header h2 {
            font-size: 1.1rem;
            color: var(--gold);
        }

        .scorecard-header .school-label {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 400;
        }

        .scorecard-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1.8rem;
            cursor: pointer;
            line-height: 1;
        }

        .scorecard-summary {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            padding: 0.75rem;
            border-bottom: 1px solid var(--border-subtle);
        }

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

        .summary-stat .value {
            font-size: 1.4rem;
            font-weight: 800;
            color: var(--gold);
        }

        .summary-stat .label {
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: uppercase;
        }

        /* Hole-by-hole scorecard */
        .holes-table {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

        /* First column (Hole/Par/Score label) and last column (OUT/IN total) get fixed widths */
        .holes-table th:first-child,
        .holes-table td:first-child {
            width: 38px;
        }

        .holes-table th:last-child,
        .holes-table td:last-child {
            width: 34px;
        }

        .holes-table th,
        .holes-table td {
            padding: 0.45rem 0.15rem;
            text-align: center;
            font-size: 0.8rem;
            border: 1px solid var(--border-subtle);
            overflow: hidden;
        }

        .holes-table th {
            background: var(--charcoal-light);
            color: var(--text-muted);
            font-size: 0.65rem;
            text-transform: uppercase;
            font-weight: 600;
        }

        .holes-table .par-row td {
            color: var(--text-muted);
            font-size: 0.75rem;
        }

        .holes-table .score-row td {
            font-weight: 700;
            font-size: 0.9rem;
        }

        .hole-score {
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            font-weight: 700;
        }

        .hole-score.eagle {
            background: var(--eagle);
            color: white;
        }

        .hole-score.birdie {
            background: var(--birdie);
            color: white;
        }

        .hole-score.par {
            background: transparent;
            color: var(--text);
        }

        .hole-score.bogey {
            background: var(--bogey);
            color: white;
        }

        .hole-score.double {
            background: var(--double);
            color: white;
        }

        .hole-score.empty {
            color: var(--text-muted);
        }

        [data-theme="light"] .hole-score.eagle {
            background: #1565c0;
            color: #fff;
        }

        [data-theme="light"] .hole-score.birdie {
            background: #2e7d32;
            color: #fff;
        }

        [data-theme="light"] .hole-score.bogey {
            background: #b45309;
            color: #fff;
        }

        [data-theme="light"] .hole-score.double {
            background: #b91c1c;
            color: #fff;
        }

        .nine-total {
            font-weight: 800;
            color: var(--gold);
        }

        /* ─── Mobile Scorecard Compacting ─── */
        @media (max-width: 480px) {
            .scorecard-panel {
                max-height: 95vh;
            }

            .scorecard-header {
                padding: 0.5rem 0.75rem;
                border-bottom-width: 1.5px;
            }

            .scorecard-header h2 {
                font-size: 0.9rem;
            }

            .scorecard-header .school-label {
                font-size: 0.65rem;
            }

            .scorecard-close {
                font-size: 1.4rem;
            }

            .scorecard-summary {
                gap: 0.75rem;
                padding: 0.4rem 0.5rem;
            }

            .summary-stat .value {
                font-size: 1.05rem;
            }

            .summary-stat .label {
                font-size: 0.55rem;
            }

            .holes-table th,
            .holes-table td {
                padding: 0.25rem 0.15rem;
                font-size: 0.7rem;
            }

            .holes-table th {
                font-size: 0.55rem;
            }

            .holes-table .par-row td {
                font-size: 0.65rem;
            }

            .holes-table .score-row td {
                font-size: 0.75rem;
            }

            .hole-score {
                width: 22px;
                height: 22px;
                font-size: 0.7rem;
            }
        }

        /* Tournament selector */
        .tournament-selector {
            padding: 1rem 0;
        }

        /* Filters for picker */
        /* Spectator tabs */
        .spec-tabs {
            display: flex;
            gap: 0;
            margin-bottom: 1rem;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            overflow: hidden;
            width: 100%;
        }

        .spec-tab {
            flex: 1;
            padding: 0.65rem 0.5rem;
            text-align: center;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-muted);
            background: transparent;
            border: none;
            cursor: pointer;
            transition: color 0.2s, background 0.2s;
            position: relative;
            white-space: nowrap;
        }

        .spec-tab:not(:last-child) {
            border-right: 1px solid var(--border-color);
        }

        .spec-tab:hover {
            color: var(--text);
            background: var(--hover-bg);
        }

        .spec-tab.active {
            color: var(--charcoal);
            background: var(--gold);
        }

        [data-theme="light"] .spec-tab.active {
            color: #fff;
        }

        .spec-tab .tab-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 18px;
            height: 18px;
            padding: 0 5px;
            border-radius: 9px;
            font-size: 0.65rem;
            font-weight: 800;
            margin-left: 4px;
            vertical-align: middle;
        }

        .spec-tab .tab-badge.live-badge {
            background: #e74c3c;
            color: #fff;
            animation: pulse-badge 2s ease-in-out infinite;
        }

        .spec-tab .tab-badge.upcoming-badge {
            background: var(--gold);
            color: var(--charcoal);
        }

        .spec-tab.active .tab-badge.upcoming-badge {
            background: rgba(0, 0, 0, 0.25);
            color: #fff;
        }

        @keyframes pulse-badge {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.6;
            }
        }

        /* Sub-filters row (search + gender) */
        .picker-sub-filters {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
            width: 100%;
        }

        .picker-sub-filters select,
        .picker-sub-filters input {
            background: var(--card-bg);
            color: var(--text);
            border: 1px solid var(--border-color);
            padding: 0.45rem 0.6rem;
            border-radius: 8px;
            font-size: 0.82rem;
            min-width: 0;
        }

        .picker-sub-filters select {
            flex: 0 0 auto;
            min-width: 100px;
        }

        .picker-sub-filters input {
            flex: 1 1 auto;
            min-width: 0;
        }

        .picker-sub-filters input::placeholder {
            color: var(--text-muted);
        }

        /* Tournament grid */
        .tournament-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.75rem;
            width: 100%;
        }

        @media (min-width: 640px) {
            .tournament-grid {
                grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            }
        }

        @media (min-width: 960px) {
            .tournament-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        .tournament-list-item {
            display: flex;
            flex-direction: column;
            gap: 0.65rem;
            padding: 1rem;
            background: var(--card-bg);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-color);
            border-radius: var(--card-radius);
            cursor: pointer;
            transition: border-color 0.2s, transform 0.15s;
            overflow: hidden;
            min-width: 0;
            box-shadow: var(--card-shadow);
        }

        .tournament-list-item:hover {
            border-color: var(--gold);
            transform: translateY(-2px);
        }

        .t-card-top {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            min-width: 0;
            overflow: hidden;
        }

        .t-card-logo {
            width: 38px;
            height: 38px;
            border-radius: 8px;
            object-fit: contain;
            background: var(--hover-bg);
            flex-shrink: 0;
        }

        .t-card-logo-placeholder {
            width: 38px;
            height: 38px;
            border-radius: 8px;
            background: var(--hover-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            color: var(--text-muted);
            font-size: 1.1rem;
        }

        .t-card-info {
            flex: 1;
            min-width: 0;
        }

        .tournament-list-item .t-name {
            font-weight: 600;
            font-size: 0.95rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .tournament-list-item .t-school {
            font-size: 0.72rem;
            color: var(--gold-dark);
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 0.3rem;
        }

        /* Favorite star button on tournament cards */
        .t-fav-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.85rem;
            color: var(--text-muted);
            opacity: 0.4;
            padding: 0 2px;
            line-height: 1;
            transition: opacity 0.2s, color 0.2s, transform 0.15s;
        }

        .t-fav-btn:hover {
            opacity: 0.8;
            transform: scale(1.2);
        }

        .t-fav-btn.favorited {
            color: var(--gold);
            opacity: 1;
        }

        .t-fav-btn.favorited:hover {
            opacity: 0.8;
        }

        /* Favorites filter toggle button */
        .spec-fav-toggle {
            display: flex;
            align-items: center;
            gap: 0.3rem;
            background: var(--card-bg);
            color: var(--text-muted);
            border: 1px solid var(--border-color);
            padding: 0.45rem 0.7rem;
            border-radius: 8px;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s, background 0.2s;
            flex-shrink: 0;
            white-space: nowrap;
        }

        .spec-fav-toggle:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        .spec-fav-toggle.active {
            background: linear-gradient(135deg, rgba(174, 145, 66, 0.15), rgba(174, 145, 66, 0.08));
            border-color: var(--gold);
            color: var(--gold);
        }

        .spec-fav-toggle .fav-count {
            font-size: 0.65rem;
            background: var(--gold);
            color: var(--bg);
            border-radius: 8px;
            padding: 0 5px;
            min-width: 16px;
            text-align: center;
            font-weight: 700;
            line-height: 1.4;
        }

        .spec-fav-toggle .fav-count:empty {
            display: none;
        }

        .tournament-list-item .t-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Spectator start-time countdown on upcoming tournament cards */
        .spec-start-countdown {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.3rem 0.6rem;
            margin-top: 0.3rem;
            border-radius: 8px;
            font-size: 0.78rem;
            font-weight: 700;
            background: linear-gradient(135deg, rgba(174, 145, 66, 0.10), rgba(174, 145, 66, 0.04));
            border: 1px solid rgba(174, 145, 66, 0.2);
            color: var(--gold);
        }

        .spec-start-countdown:empty {
            display: none;
        }

        .spec-start-countdown .cd-icon {
            font-size: 0.9rem;
        }

        .spec-start-countdown .cd-label {
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            color: var(--text-muted);
            font-weight: 600;
        }

        .spec-start-countdown .cd-time {
            font-variant-numeric: tabular-nums;
            font-weight: 800;
            font-size: 0.88rem;
            letter-spacing: 0.5px;
            color: var(--gold);
            animation: spec-cd-pulse 2s ease-in-out infinite;
        }

        .spec-start-countdown.cd-started {
            background: linear-gradient(135deg, rgba(40, 167, 69, 0.12), rgba(40, 167, 69, 0.06));
            border-color: rgba(40, 167, 69, 0.3);
            color: #28a745;
            animation: spec-cd-flash 1s ease-in-out infinite;
        }

        /* Spectator go-live countdown on tournament cards */
        .spec-golive-countdown {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.3rem 0.6rem;
            margin-top: 0.3rem;
            border-radius: 8px;
            font-size: 0.78rem;
            font-weight: 700;
            background: linear-gradient(135deg, rgba(174, 145, 66, 0.12), rgba(174, 145, 66, 0.06));
            border: 1px solid rgba(174, 145, 66, 0.25);
            color: var(--gold);
            animation: spec-cd-pulse 2s ease-in-out infinite;
        }

        .spec-golive-countdown:empty {
            display: none;
        }

        .spec-golive-countdown .cd-icon {
            font-size: 0.9rem;
        }

        .spec-golive-countdown .cd-label {
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            color: var(--text-muted);
            font-weight: 600;
        }

        .spec-golive-countdown .cd-time {
            font-variant-numeric: tabular-nums;
            font-weight: 800;
            font-size: 0.88rem;
            letter-spacing: 0.5px;
            text-shadow: 0 0 6px rgba(174, 145, 66, 0.25);
        }

        .spec-golive-countdown.cd-live-now {
            background: linear-gradient(135deg, rgba(40, 167, 69, 0.12), rgba(40, 167, 69, 0.06));
            border-color: rgba(40, 167, 69, 0.3);
            color: #28a745;
            animation: spec-cd-flash 1s ease-in-out infinite;
        }

        /* Spectator header countdown */
        .spec-header-cd-wrap .spec-cd-time {
            font-variant-numeric: tabular-nums;
            font-weight: 800;
            font-size: 0.95rem;
            color: var(--gold);
            letter-spacing: 0.4px;
            text-shadow: 0 0 8px rgba(174, 145, 66, 0.3);
            animation: spec-cd-pulse 2s ease-in-out infinite;
        }

        .spec-header-cd-wrap .cd-live-now {
            color: #28a745;
            animation: spec-cd-flash 1s ease-in-out infinite;
        }

        @keyframes spec-cd-pulse {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.7;
            }
        }

        @keyframes spec-cd-flash {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.5;
            }
        }

        .status-badge {
            padding: 0.2rem 0.6rem;
            border-radius: 12px;
            font-size: 0.65rem;
            font-weight: 700;
            text-transform: uppercase;
            flex-shrink: 0;
            white-space: nowrap;
        }

        .status-badge.in_progress {
            background: #27ae60;
            color: white;
        }

        .status-badge.completed {
            background: var(--text-muted);
            color: var(--charcoal);
        }

        .status-badge.upcoming {
            background: var(--gold);
            color: var(--charcoal);
        }

        /* Loading / empty */
        .loading,
        .empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--text-muted);
        }

        .loading::after {
            content: '';
            display: block;
            width: 30px;
            height: 30px;
            border: 3px solid var(--border-color);
            border-top-color: var(--gold);
            border-radius: 50%;
            margin: 1rem auto 0;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        /* Share button */
        .share-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            background: var(--gold);
            color: var(--charcoal);
            border: none;
            padding: 0.4rem 0.85rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s;
        }

        .share-btn:hover {
            background: var(--gold-dark);
        }

        .back-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            background: none;
            border: 1px solid var(--border-medium);
            color: var(--text);
            padding: 0.4rem 0.85rem;
            border-radius: 20px;
            font-size: 0.8rem;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .back-btn:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        /* Legend */
        .legend {
            display: flex;
            justify-content: center;
            gap: 0.75rem;
            padding: 0.5rem;
            flex-wrap: wrap;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 0.25rem;
            font-size: 0.65rem;
            color: var(--text-muted);
        }

        .legend-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
        }

        /* Spectator Gender Toggle (Mixed tournaments) */
        #specGenderWrap:empty {
            display: none;
        }

        .spec-gender-toggle {
            display: inline-flex;
            gap: 0;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            overflow: hidden;
        }

        .spec-gender-toggle .gender-toggle-btn {
            padding: 0.3rem 0.7rem;
            border: none;
            border-radius: 0;
            background: transparent;
            color: var(--text-muted);
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s ease;
            white-space: nowrap;
            letter-spacing: 0.02em;
        }

        .spec-gender-toggle .gender-toggle-btn:not(:last-child) {
            border-right: 1px solid var(--border-color);
        }

        .spec-gender-toggle .gender-toggle-btn:hover:not(.active) {
            background: rgba(174, 145, 66, 0.1);
            color: var(--text);
        }

        .spec-gender-toggle .gender-toggle-btn.active {
            background: var(--gold);
            color: #fff;
            font-weight: 700;
        }

        /* Filter bar toggle row */
        .filter-bar-toggles {
            display: flex;
            gap: 0.4rem;
            align-items: center;
            margin-left: auto;
        }

        /* Filter */
        .filter-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            margin-top: 0.5rem;
            background: var(--charcoal-light);
            border-bottom: 1px solid var(--border-subtle);
            border-radius: 8px;
            align-items: center;
        }

        @media (max-width: 520px) {
            .filter-bar {
                gap: 0.4rem;
            }

            .filter-bar input {
                flex: 1 1 100%;
                order: -1;
            }

            .filter-bar select {
                flex: 1 1 auto;
                min-width: 0;
                font-size: 0.75rem;
            }

            .filter-bar-toggles {
                flex: 1 1 100%;
                justify-content: center;
            }
        }

        .filter-bar select {
            background: var(--charcoal-lighter);
            color: var(--text);
            border: 1px solid var(--border-color);
            padding: 0.35rem 0.5rem;
            border-radius: 6px;
            font-size: 0.8rem;
        }

        .filter-bar input {
            flex: 1;
            background: var(--charcoal-lighter);
            color: var(--text);
            border: 1px solid var(--border-color);
            padding: 0.35rem 0.5rem;
            border-radius: 6px;
            font-size: 0.8rem;
        }

        .filter-bar input::placeholder {
            color: var(--text-muted);
        }

        @media (max-width: 480px) {

            .leaderboard td,
            .leaderboard th {
                padding: 0.5rem 0.3rem;
                font-size: 0.78rem;
            }

            .rank-cell {
                width: 28px;
            }

            .tournament-grid {
                grid-template-columns: 1fr;
            }
        }

        /* Leaderboard bg */
        .leaderboard-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            background: url('images/login-background.jpg') center/cover no-repeat;
        }

        .leaderboard-bg::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(0, 0, 0, 0.88), rgba(20, 20, 20, 0.85));
            backdrop-filter: blur(2px);
            -webkit-backdrop-filter: blur(2px);
        }

        [data-theme="light"] .leaderboard-bg::after {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(245, 245, 245, 0.85));
        }

        /* account for fixed footer + safe area */
        #leaderboardView .container {
            padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
        }

        /* ── Engagement UI ── */
        .spec-follow-btn {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 0.3rem 0.7rem;
            font-size: 0.72rem;
            font-weight: 600;
            border-radius: 6px;
            border: 1px solid rgba(174, 145, 66, 0.35);
            background: rgba(174, 145, 66, 0.12);
            color: var(--gold);
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .spec-follow-btn:hover {
            background: rgba(174, 145, 66, 0.25);
        }

        .spec-follow-btn.following {
            background: rgba(239, 68, 68, 0.12);
            color: #ef4444;
            border-color: rgba(239, 68, 68, 0.35);
        }

        .spec-follow-btn.following svg {
            fill: #ef4444;
        }

        .spec-follow-btn.following:hover {
            background: rgba(239, 68, 68, 0.25);
        }

        .spec-engagement-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 14px;
            padding: 6px 0 2px;
        }

        .spec-eng-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--text-muted);
            padding: 3px 9px;
            border-radius: 12px;
            background: var(--card-bg);
            border: 1px solid var(--border-subtle);
        }

        .spec-eng-badge svg {
            width: 12px;
            height: 12px;
            opacity: 0.7;
        }

        .spec-eng-badge.followers svg {
            stroke: #ef4444;
            fill: none;
        }

        .spec-eng-badge.checkins svg {
            stroke: #2e7d32;
            fill: none;
        }

        .spec-eng-badge.players svg {
            stroke: var(--gold);
            fill: none;
        }

        /* Player follow in scorecard */
        .scorecard-follow-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px 10px;
            font-size: 0.7rem;
            font-weight: 600;
            border-radius: 6px;
            border: 1px solid rgba(174, 145, 66, 0.35);
            background: rgba(174, 145, 66, 0.12);
            color: var(--gold);
            cursor: pointer;
            transition: all 0.2s;
            margin-top: 4px;
        }

        .scorecard-follow-btn:hover {
            background: rgba(174, 145, 66, 0.25);
        }

        .scorecard-follow-btn.following {
            background: rgba(239, 68, 68, 0.12);
            color: #ef4444;
            border-color: rgba(239, 68, 68, 0.35);
        }

        .scorecard-follow-btn.following svg {
            fill: #ef4444;
        }

        /* Scorecard actions row (follow + share) */
        .scorecard-actions {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-top: 4px;
        }

        .scorecard-share-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px 10px;
            font-size: 0.7rem;
            font-weight: 600;
            border-radius: 6px;
            border: 1px solid var(--border-color);
            background: var(--hover-bg);
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.2s;
        }

        .scorecard-share-btn:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        /* My Players tab badge */
        .spec-tab .tab-badge.my-players-badge {
            background: var(--gold);
            color: var(--bg);
        }

        /* ── My Players Cards ── */
        .my-player-card {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding: 1rem;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: var(--card-radius);
            cursor: pointer;
            transition: border-color 0.2s, transform 0.15s;
            box-shadow: var(--card-shadow);
        }

        .my-player-card:hover {
            border-color: var(--gold);
            transform: translateY(-2px);
        }

        .mp-top {
            display: flex;
            align-items: center;
            gap: 0.6rem;
        }

        .mp-logo {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            object-fit: contain;
            background: var(--hover-bg);
            flex-shrink: 0;
        }

        .mp-logo-fallback {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            color: #fff;
            font-weight: 700;
            font-size: 0.9rem;
        }

        .mp-info {
            flex: 1;
            min-width: 0;
        }

        .mp-name {
            font-weight: 600;
            font-size: 0.95rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mp-school {
            font-size: 0.72rem;
            color: var(--gold-dark);
            font-weight: 500;
        }

        .mp-tournament {
            font-size: 0.75rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mp-stats {
            display: flex;
            align-items: baseline;
            gap: 0.75rem;
        }

        .mp-score {
            display: flex;
            align-items: baseline;
            gap: 0.3rem;
        }

        .mp-total {
            font-size: 1.3rem;
            font-weight: 800;
            color: var(--gold);
            font-variant-numeric: tabular-nums;
        }

        .mp-to-par {
            font-size: 0.8rem;
            color: var(--text-muted);
            font-weight: 600;
        }

        .mp-thru {
            font-size: 0.72rem;
            color: var(--text-muted);
        }

        .mp-nines {
            font-size: 0.68rem;
            color: var(--text-muted);
            font-variant-numeric: tabular-nums;
        }

        .mp-live-tag {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            background: #27ae60;
            color: #fff;
            font-size: 0.55rem;
            font-weight: 800;
            padding: 2px 6px;
            border-radius: 4px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex-shrink: 0;
        }

        .mp-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #fff;
            animation: pulse-badge 1.5s ease-in-out infinite;
        }

        .mp-final-tag {
            font-size: 0.55rem;
            font-weight: 800;
            padding: 2px 6px;
            border-radius: 4px;
            background: var(--hover-bg);
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex-shrink: 0;
        }

        .mp-upcoming-tag {
            font-size: 0.55rem;
            font-weight: 800;
            padding: 2px 6px;
            border-radius: 4px;
            background: rgba(174, 145, 66, 0.12);
            color: var(--gold);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex-shrink: 0;
        }

        .mp-share-btn {
            position: absolute;
            bottom: 0.75rem;
            right: 0.75rem;
            background: none;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 5px 8px;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.2s;
        }

        .mp-share-btn:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        /* ── Social Share Modal ── */
        .share-modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            z-index: var(--z-modal);
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(6px);
            justify-content: center;
            align-items: flex-end;
        }

        .share-modal-overlay.active {
            display: flex;
        }

        .share-modal {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 20px 20px 0 0;
            width: 100%;
            max-width: 480px;
            max-height: 85vh;
            overflow-y: auto;
            padding: 0;
            animation: share-slide-up 0.25s ease-out;
            box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
        }

        @keyframes share-slide-up {
            from {
                transform: translateY(100%);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @media (min-width: 640px) {
            .share-modal-overlay {
                align-items: center;
            }

            .share-modal {
                border-radius: 16px;
                max-height: 70vh;
            }
        }

        .share-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem 0.5rem;
            border-bottom: 1px solid var(--border-color);
        }

        .share-modal-header h3 {
            font-size: 1rem;
            font-weight: 700;
            color: var(--text);
            margin: 0;
        }

        .share-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1.6rem;
            cursor: pointer;
            line-height: 1;
            padding: 4px;
        }

        .share-preview {
            padding: 0.75rem 1.25rem;
            border-bottom: 1px solid var(--border-color);
        }

        .share-preview-text {
            font-size: 0.78rem;
            color: var(--text-muted);
            line-height: 1.5;
            background: var(--hover-bg);
            border-radius: 10px;
            padding: 0.75rem 1rem;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
            white-space: pre-wrap;
            word-break: break-word;
        }

        .share-social-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0;
            padding: 0.75rem 0.5rem 1.5rem;
        }

        .share-social-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 1rem 0.5rem;
            background: none;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: background 0.15s;
            color: var(--text);
        }

        .share-social-btn:hover {
            background: var(--hover-bg);
        }

        .share-social-btn svg {
            flex-shrink: 0;
        }

        .share-social-btn span {
            font-size: 0.68rem;
            font-weight: 600;
            color: var(--text-muted);
            white-space: nowrap;
        }

        .share-social-btn[data-platform=\"twitter\"] svg {
            color: var(--text);
        }

        .share-social-btn[data-platform=\"sms\"] svg {
            color: #34C759;
            stroke: #34C759;
        }

        .share-social-btn[data-platform=\"email\"] svg {
            color: var(--gold);
            stroke: var(--gold);
        }

        .share-social-btn[data-platform=\"copy\"] svg {
            color: var(--text-muted);
            stroke: var(--text-muted);
        }

        /* Sign-up prompt modal */
        .spec-auth-prompt {
            display: none;
            position: fixed;
            inset: 0;
            z-index: var(--z-modal);
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            align-items: center;
            justify-content: center;
        }

        .spec-auth-prompt.active {
            display: flex;
        }

        .spec-auth-prompt-card {
            background: var(--card-bg);
            border: 1px solid var(--gold);
            border-radius: 16px;
            padding: 2rem 1.8rem;
            max-width: 380px;
            width: 90%;
            text-align: center;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        }

        .spec-auth-prompt-card h3 {
            font-size: 1.1rem;
            margin-bottom: 0.5rem;
            color: var(--gold);
        }

        .spec-auth-prompt-card p {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin-bottom: 1.2rem;
            line-height: 1.5;
        }

        .spec-auth-prompt-card .prompt-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .spec-auth-prompt-card .prompt-btn {
            display: block;
            padding: 10px 16px;
            border-radius: 8px;
            font-size: 0.85rem;
            font-weight: 600;
            text-decoration: none;
            text-align: center;
            cursor: pointer;
            transition: opacity 0.2s;
            border: none;
        }

        .spec-auth-prompt-card .prompt-btn:hover {
            opacity: 0.85;
        }

        .prompt-btn.primary {
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            color: #fff;
        }

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

        /* Footer — matches main site .app-footer */
        .spectator-footer {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: var(--footer-bg);
            border-top: 1px solid var(--gold);
            padding: 0.5rem 2rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
            z-index: var(--z-sticky-bar);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }

        .spectator-footer .footer-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
            max-width: 100%;
            margin: 0;
            padding: 0 20px;
        }

        .spectator-footer .footer-content p {
            margin: 0;
            color: #888;
            font-size: 0.75rem;
        }

        [data-theme="light"] .spectator-footer {
            background: var(--footer-bg);
        }

        /* Light picker cards — handled by CSS variables */
        [data-theme="light"] .picker-sub-filters select,
        [data-theme="light"] .picker-sub-filters input {
            background-color: var(--card-bg);
            color: var(--card-text);
            border-color: var(--border-color);
        }

        [data-theme="light"] .filter-bar select,
        [data-theme="light"] .filter-bar input {
            background-color: var(--card-bg);
            color: var(--card-text);
            border-color: var(--border-color);
        }

        [data-theme="light"] .scorecard-overlay {
            background: rgba(0, 0, 0, 0.4);
        }

        /* Theme toggle */
        .theme-toggle {
            background: none;
            border: 1px solid var(--border-medium);
            color: var(--text);
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: border-color 0.2s;
        }

        .theme-toggle:hover {
            border-color: var(--gold);
        }

        .theme-toggle svg {
            width: 16px;
            height: 16px;
        }

        .theme-toggle .icon-sun {
            display: inline;
        }

        .theme-toggle .icon-moon {
            display: none;
        }

        [data-theme="light"] .theme-toggle {
            border-color: var(--border-color);
        }

        [data-theme="light"] .theme-toggle .icon-sun {
            display: none;
        }

        [data-theme="light"] .theme-toggle .icon-moon {
            display: inline;
        }

        /* ─── View Toggle (Leaderboard vs Pairings) ─── */
        .view-toggle {
            display: flex;
            gap: 0.25rem;
            background: var(--charcoal-lighter);
            border-radius: 8px;
            padding: 0.15rem;
        }

        .view-toggle-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            padding: 0.3rem 0.7rem;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .view-toggle-btn.active {
            background: var(--gold);
            color: var(--charcoal);
        }

        /* ─── Desktop Full Scorecard Table ─── */
        .full-scorecard-wrap {
            display: none;
            overflow-x: auto;
            margin-top: 0.5rem;
            background: rgba(26, 26, 26, 0.85);
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            padding: 2px;
        }

        [data-theme="light"] .full-scorecard-wrap {
            background: rgba(255, 255, 255, 0.88);
        }

        .mobile-leaderboard {
            background: rgba(26, 26, 26, 0.85);
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            overflow: hidden;
        }

        [data-theme="light"] .mobile-leaderboard {
            background: rgba(255, 255, 255, 0.88);
        }

        @media (min-width: 1100px) {
            .full-scorecard-wrap {
                display: block;
            }

            .mobile-leaderboard {
                display: none;
            }
        }

        @media (max-width: 1099px) {
            .full-scorecard-wrap {
                display: none !important;
            }

            .mobile-leaderboard {
                display: block;
            }
        }

        .full-scorecard {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.78rem;
            table-layout: fixed;
        }

        .full-scorecard th,
        .full-scorecard td {
            padding: 0.35rem 0.2rem;
            text-align: center;
            border-bottom: 1px solid var(--border-subtle);
            white-space: nowrap;
        }

        /* Fixed column widths */
        .full-scorecard .col-pos {
            width: 32px;
        }

        .full-scorecard .col-name {
            width: 160px;
            text-align: left;
        }

        .full-scorecard .col-par {
            width: 28px;
        }

        .full-scorecard .col-hole {
            width: 30px;
            min-width: 28px;
        }

        .full-scorecard .col-out {
            width: 34px;
        }

        .full-scorecard .col-in {
            width: 34px;
        }

        .full-scorecard .col-tot {
            width: 38px;
        }

        .full-scorecard .col-topar {
            width: 42px;
        }

        .full-scorecard .col-thru {
            width: 36px;
        }

        /* Sticky header rows */
        .full-scorecard thead {
            position: sticky;
            top: 0;
            z-index: var(--z-sticky-nav);
        }

        .full-scorecard thead th {
            background: var(--charcoal-light);
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            color: var(--text-muted);
            font-weight: 600;
        }

        .full-scorecard .par-header-row th {
            background: var(--charcoal-lighter);
            color: var(--text-muted);
            font-size: 0.7rem;
            font-weight: 500;
            border-bottom: 2px solid var(--gold);
        }

        .full-scorecard tbody tr {
            transition: background 0.15s;
            cursor: pointer;
        }

        .full-scorecard tbody tr:hover {
            background: var(--row-hover);
        }

        .full-scorecard tbody tr:nth-child(even) {
            background: var(--row-stripe);
        }

        .full-scorecard tbody tr:nth-child(even):hover {
            background: var(--row-hover);
        }

        .full-scorecard .player-cell {
            text-align: left;
            padding-left: 0.4rem;
        }

        .full-scorecard .player-cell .p-name {
            font-weight: 600;
            font-size: 0.8rem;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .full-scorecard .player-cell .p-school {
            font-size: 0.6rem;
            color: var(--text-muted);
        }

        /* Inline score chips */
        .sc-chip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            font-weight: 700;
            font-size: 0.75rem;
            line-height: 1;
        }

        .sc-chip.eagle {
            background: var(--eagle);
            color: white;
        }

        .sc-chip.birdie {
            background: var(--birdie);
            color: white;
        }

        .sc-chip.par {
            background: transparent;
            color: var(--text);
        }

        .sc-chip.bogey {
            background: var(--bogey);
            color: white;
        }

        .sc-chip.double {
            background: var(--double);
            color: white;
        }

        .sc-chip.empty {
            color: var(--text-muted);
            background: transparent;
        }

        [data-theme="light"] .sc-chip.eagle {
            background: #1565c0;
            color: #fff;
        }

        [data-theme="light"] .sc-chip.birdie {
            background: #2e7d32;
            color: #fff;
        }

        [data-theme="light"] .sc-chip.bogey {
            background: #b45309;
            color: #fff;
        }

        [data-theme="light"] .sc-chip.double {
            background: #b91c1c;
            color: #fff;
        }

        .nine-total-cell {
            font-weight: 800;
            color: var(--gold);
            font-size: 0.82rem;
        }

        .total-cell {
            font-weight: 800;
            font-size: 0.88rem;
        }

        .topar-cell {
            font-weight: 700;
            font-size: 0.85rem;
        }

        .topar-cell.over {
            color: var(--bogey);
        }

        .topar-cell.under {
            color: var(--birdie);
        }

        .topar-cell.even {
            color: var(--text);
        }

        /* ─── Pairing Group Sections ─── */
        .pairing-section {
            margin-bottom: 0.5rem;
        }

        .pairing-header {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.55rem 0.75rem;
            background: var(--charcoal-light);
            border-left: 4px solid var(--gold);
            margin: 0.5rem 0 0;
            border-radius: 0 6px 6px 0;
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--gold);
        }

        .pairing-header .ph-meta {
            font-size: 0.7rem;
            font-weight: 400;
            color: var(--text-muted);
        }

        [data-theme="light"] .pairing-header {
            background: var(--charcoal-light);
        }

        /* Prevent any element from exceeding viewport */
        #tournamentPicker,
        #leaderboardView {
            max-width: 100vw;
            overflow-x: hidden;
        }
