        /* ============ HEADER & NAVIGATION ============ */
        header {
            background-color: white;
            padding: 20px 0;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            position: sticky;
            top: 0;
            z-index: 100;
            display: none;
        }

        header.active {
            display: block;
        }

        .header-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .logo {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-img {
            height: 44px;
            width: auto;
            object-fit: contain;
            display: block;
        }

        .user-menu {
            position: relative;
        }

        .user-menu-button {
            background: none;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            border-radius: 6px;
            transition: all 0.3s ease;
            font-size: 14px;
            color: #333;
        }

        .user-menu-button:hover {
            background: #f0f0f0;
        }

        .user-badge {
            display: inline-block;
            padding: 4px 8px;
            background: #667eea;
            color: white;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
        }

        .user-menu-dropdown {
            position: absolute;
            top: 100%;
            right: 0;
            background: white;
            border: 1px solid #ddd;
            border-radius: 6px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            display: none;
            z-index: 200;
            min-width: 200px;
            margin-top: 8px;
        }

        .user-menu-dropdown.active {
            display: block;
        }

        .user-menu-item {
            padding: 12px 16px;
            border-bottom: 1px solid #eee;
            font-size: 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .user-menu-item:last-child {
            border-bottom: none;
        }

        .user-menu-item.info {
            cursor: default;
            color: #666;
        }

        .user-menu-item.action {
            cursor: pointer;
            color: #667eea;
            font-weight: 600;
        }

        .user-menu-item.action:hover {
            background: #f8f8f8;
        }

        .team-dot {
            width: 12px;
            height: 12px;
            border-radius: 2px;
            display: inline-block;
            margin-right: 4px;
        }

        nav {
            display: flex;
            gap: 30px;
            justify-content: center;
            flex-wrap: wrap;
            width: 100%;
        }

        nav a {
            text-decoration: none;
            color: #666;
            font-weight: 600;
            font-size: 14px;
            padding: 8px 12px;
            border-radius: 4px;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        nav a:hover {
            color: #e63333;
        }

        nav a.active {
            background-color: #f0f0f0;
            color: #e63333;
        }

        nav a.hidden {
            display: none;
        }

        /* ============ NAV DROPDOWN BUTTONS ============ */
        .nav-dropdown-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: #666;
            font-weight: 600;
            font-size: 14px;
            padding: 8px 12px;
            border-radius: 4px;
            transition: all 0.3s ease;
            font-family: inherit;
        }

        .nav-dropdown-btn:hover {
            color: #e63333;
        }

        .nav-dropdown-btn.active {
            background-color: #f0f0f0;
            color: #e63333;
        }

        .nav-dropdown {
            position: relative;
        }

        .nav-dropdown-menu {
            display: none;
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: white;
            border: 1px solid #ddd;
            border-radius: 6px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 200;
            min-width: 140px;
            margin-top: 4px;
            overflow: hidden;
        }

        .nav-dropdown-menu.open {
            display: block;
        }

        .nav-dropdown-menu a {
            display: block;
            padding: 10px 16px;
            color: #444;
            font-size: 13px;
            font-weight: 600;
            text-decoration: none;
            cursor: pointer;
            border-bottom: 1px solid #f0f0f0;
            transition: background 0.15s;
        }

        .nav-dropdown-menu a:last-child {
            border-bottom: none;
        }

        .nav-dropdown-menu a:hover {
            background: #f8f8f8;
            color: #e63333;
        }

        /* ============ LEAGUES NAV (direct link wrapper) ============ */
        #leaguesDropdown {
            display: flex;
            align-items: center;
            gap: 30px;
        }

        /* ============ LEAGUE SUBNAV ============ */
        #leagueSubnav {
            display: none;
            gap: 4px;
            justify-content: center;
            flex-wrap: wrap;
            width: 100%;
            border-top: 1px solid #f0f0f0;
            padding-top: 12px;
        }

        #leagueSubnav.active {
            display: flex;
        }

        .subnav-link {
            text-decoration: none;
            color: #888;
            font-weight: 600;
            font-size: 13px;
            padding: 6px 14px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .subnav-link:hover {
            color: #e63333;
            background: #f8f8f8;
        }

        .subnav-link.active {
            color: #e63333;
            background: #f0f0f0;
        }

        /* ============ SUBNAV LEAGUE SWITCHER ============ */
        .subnav-league-ctx {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 5px 12px;
            border-radius: 20px;
            background: rgba(230, 51, 51, 0.08);
            color: #e63333;
            font-size: 12px;
            font-weight: 800;
            cursor: pointer;
            letter-spacing: 0.2px;
            position: relative;
            user-select: none;
            transition: background 0.15s;
            white-space: nowrap;
            max-width: 180px;
        }
        .subnav-league-ctx:hover { background: rgba(230, 51, 51, 0.15); }

        .subnav-ctx-label {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 130px;
        }
        .subnav-ctx-caret { font-size: 9px; flex-shrink: 0; opacity: 0.7; }

        .subnav-league-picker {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            background: #fff;
            border: 1.5px solid #e5e7eb;
            border-radius: 14px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.13);
            min-width: 230px;
            z-index: 2000;
            overflow: hidden;
        }
        .subnav-picker-item {
            padding: 12px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            font-weight: 600;
            color: #1a1a2e;
            transition: background 0.12s;
            border-bottom: 1px solid #f3f4f6;
        }
        .subnav-picker-item:last-child { border-bottom: none; }
        .subnav-picker-item:hover { background: #f8f8fa; }
        .subnav-picker-item.active-league { background: rgba(230,51,51,0.05); }
        .subnav-picker-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
        .subnav-picker-active-badge {
            margin-left: auto;
            color: #e63333;
            font-size: 10px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .subnav-picker-hub {
            padding: 10px 16px;
            color: #888;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            border-top: 1px solid #f0f0f4;
            text-align: center;
            transition: background 0.12s;
        }
        .subnav-picker-hub:hover { color: #e63333; background: #fafafa; }

        /* ============ MAIN CONTENT ============ */
        main {
            display: none;
            max-width: 1400px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        main.active {
            display: block;
        }

        /* ============ PAGE VISIBILITY ============ */
        .page {
            display: none;
        }

        .page.active {
            display: block;
        }

        /* ============================================================
           MOBILE — BOTTOM TAB BAR & RESPONSIVE NAV IMPROVEMENTS
           Applies on phones (≤ 768px). Desktop is completely unaffected.
           ============================================================ */

        /* --- Bottom tab bar base: hidden on desktop --- */
        .mobile-tab-bar {
            display: none;
        }

        @media (max-width: 768px) {

            /* ── 1. Hide top nav links — replaced by bottom tab bar ── */
            #mainNav {
                display: none !important;
            }

            /* Tighten the header so it's just logo + user menu on mobile */
            .header-container {
                gap: 0;
                padding: 10px 16px;
            }

            /* ── 2. League subnav: horizontal scroll strip ── */
            #leagueSubnav.active {
                overflow-x: auto;
                flex-wrap: nowrap;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
                padding: 6px 12px 8px;
                gap: 2px;
                justify-content: flex-start;
            }
            #leagueSubnav::-webkit-scrollbar { display: none; }

            .subnav-link {
                white-space: nowrap;
                flex-shrink: 0;
                padding: 7px 13px;
                font-size: 13px;
            }

            .subnav-league-ctx {
                flex-shrink: 0;
            }

            /* ── 3. Main content: pad bottom so tab bar never covers content ── */
            main {
                padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
            }

            /* ── 4. Bottom tab bar ── */
            nav.mobile-tab-bar {
                display: flex !important;
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                height: calc(56px + env(safe-area-inset-bottom));
                padding-bottom: env(safe-area-inset-bottom);
                background: #fff;
                border-top: 1px solid #e5e7eb;
                box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
                z-index: 500;
                /* Reset inherited nav styles */
                gap: 0;
                flex-wrap: nowrap;
                justify-content: stretch;
                width: 100%;
            }

            .mtb-item {
                flex: 1;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 3px;
                cursor: pointer;
                color: #bbb;
                text-decoration: none;
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
                transition: color 0.15s;
                padding: 8px 6px;
                position: relative;
                -webkit-tap-highlight-color: transparent;
                min-height: 44px; /* WCAG tap target */
                border-radius: 0;
            }

            .mtb-icon {
                font-size: 20px;
                line-height: 1;
            }

            .mtb-label {
                font-size: 10px;
                font-weight: 700;
                letter-spacing: 0.3px;
                text-transform: uppercase;
                line-height: 1;
            }

            /* Active tab: red text + top indicator dot */
            nav.mobile-tab-bar .mtb-item.active {
                color: #e63333 !important;
                background: none !important;
            }

            nav.mobile-tab-bar .mtb-item.active .mtb-icon {
                transform: scale(1.12);
            }

            /* Inactive hover */
            nav.mobile-tab-bar .mtb-item:hover {
                color: #e63333;
                background: none;
            }

            /* Prevent desktop nav a.active gray-bg rule from leaking in */
            nav.mobile-tab-bar a.active {
                background-color: transparent !important;
                color: #e63333 !important;
            }

            /* ── 5. Improve touch targets throughout the app on mobile ── */
            .subnav-link,
            .nav-dropdown-btn,
            .ll-btn-red,
            .auth-button,
            .profile-setup-submit,
            .verify-primary-btn,
            .verify-secondary-btn {
                min-height: 44px;
            }

            /* ── 6. Auth card: full-width on small phones ── */
            .auth-card {
                border-radius: 16px;
                padding: 28px 20px;
            }

            /* ── 7. Profile settings modal: full-screen sheet on mobile ── */
            .profile-settings-overlay {
                align-items: flex-end;
                padding: 0;
            }
            .profile-settings-card {
                border-radius: 20px 20px 0 0;
                max-height: 90vh;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
        }

        /* ── Desktop: never show bottom tab bar ── */
        @media (min-width: 769px) {
            .mobile-tab-bar {
                display: none !important;
            }
        }
