/* /css/global-styles.css */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700&display=optional');

/* Reset and General Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Default keyboard-focus ring. Low specificity so any element with its
 * own custom focus styling (input/select rules across the codebase pair
 * `outline: none` with a `box-shadow` ring) wins via the cascade and
 * keeps its branded look. Targets `:focus-visible` so mouse clicks don't
 * trigger an outline — only keyboard / screen-reader navigation does.
 * The fallback color matches the consolidated accent for legacy pages
 * where css/tokens.css isn't loaded. */
*:focus-visible {
    outline: 2px solid var(--color-accent, #2563eb);
    outline-offset: 2px;
}

body { font-family: Arial, sans-serif; background-color: #f4f4f4; color: #333; line-height: 1.6; transition: background-color 0.3s, color 0.3s; }
h1, h2, h3, h4 { color: #333; transition: color 0.3s; }
main { padding: 2rem; max-width: 1200px; margin: 0 auto; transition: opacity 0.3s; }
.page-header { text-align: center; margin-bottom: 2rem; }
.page-header h2 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.loading { text-align: center; padding: 3rem; color: #666; font-size: 1.1rem; }
.error { text-align: center; padding: 2rem; color: #dc3545; background-color: #f8d7da; border-radius: 4px; margin: 1rem; }

/* Shared modal entrance motion. Most game-detail modals are opened by
 * toggling display directly, so the animation belongs at the CSS layer. */
.modal {
    animation: rkl-modal-backdrop-in 140ms ease-out both;
    overscroll-behavior: contain;
}

.modal-content {
    animation: rkl-modal-dialog-in 150ms ease-out both;
}

#game-modal .modal-content {
    display: flex;
    flex-direction: column;
    height: auto;
    margin: 2rem auto;
    max-height: calc(100vh - 4rem);
    max-height: calc(100dvh - 4rem);
    overflow: hidden;
}

#game-modal .modal-header {
    flex: 0 0 auto;
}

#game-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

#game-modal .modal-body > #game-details-content-area,
#game-modal .modal-body > #modal-content {
    min-height: 0;
}

#game-modal .modal-body > .loading,
#game-modal .modal-body > #game-details-content-area > .loading,
#game-modal .modal-body > #modal-content > .loading {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: clamp(18rem, 44vh, 30rem);
}

@keyframes rkl-modal-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rkl-modal-dialog-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal,
    .modal-content {
        animation: none !important;
    }
}

@media (max-width: 768px) {
    #game-modal .modal-content {
        height: calc(100vh - 2rem);
        height: calc(100dvh - 2rem);
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
    }
}

/* =================================== */
/* Header, Navigation & Auth Status    */
/* ================================== */
header { background-color: #333; color: #fff; padding: 1rem; text-align: center; position: relative; }
header h1 { color: var(--hdr-fg, white) !important; font-family: 'Sora', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 2rem; margin: 0; display: flex; align-items: center; justify-content: center; }
.header-logo { width: 46px; height: 46px; object-fit: contain; }
h1 a.header-link, h1 a.header-link:hover {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

/* Ensure logo imagery renders cleanly and remains circular with transparent backgrounds */
img.header-logo,
img.header-icon,
img.team-logo,
.team-logo {
    background-color: transparent;
}

img.header-icon,
img.team-logo,
.team-logo {
    border-radius: 50%;
    overflow: hidden;
}
/* Side insets use max(1rem, env(safe-area-inset-X)) so with
 * viewport-fit=cover header controls don't slide under the iPhone
 * notch / rounded corners in landscape. The 1rem floor preserves
 * desktop / non-notched mobile spacing. */
#auth-status { position: absolute; top: 0.5rem; left: max(1rem, env(safe-area-inset-left)); font-size: 0.9rem; color: var(--hdr-fg-muted, #ccc); z-index: 103; }
#auth-status a { color: var(--hdr-fg, #fff); text-decoration: underline; cursor: pointer; margin-left: 0.5rem; }
#theme-toggle-btn { position: absolute; top: 1.2rem; right: max(1rem, env(safe-area-inset-right)); background: none; border: none; color: var(--hdr-fg, white); font-size: 1.5rem; cursor: pointer; padding: 0.5rem; line-height: 1; z-index: 102; }
#theme-toggle-btn svg { width: 1.4rem; height: 1.4rem; display: block; }
#theme-toggle-btn .moon-icon { display: none; }
nav { position: relative; }
.nav-toggle { display: none; background: none; border: none; color: var(--hdr-fg, white); font-size: 1.8rem; cursor: pointer; padding: 0.5rem 1rem; position: absolute; top: -2.8rem; right: max(1rem, env(safe-area-inset-right)); }
nav ul { display: flex; justify-content: center; list-style: none; margin-top: 1rem; flex-wrap: wrap; }
nav ul li { margin: 0.5rem 1rem; }
nav ul li a { color: #fff; text-decoration: none; font-size: 1.1rem; transition: color 0.3s ease; white-space: nowrap; }
nav ul li a:hover { color: #ccc; }
.dropdown { position: relative; display: inline-block; }
.dropdown .dropbtn { background: none; border: none; cursor: pointer; color: #fff; text-decoration: none; font-size: 1.1rem; font-family: inherit; }
.dropdown-content { display: none; position: absolute; background-color: #333; min-width: 180px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 101; border-radius: 4px; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 0.5rem; }
.dropdown-content a { color: white; padding: 12px 16px; text-decoration: none; display: block; text-align: left; font-size: 1rem; }
.dropdown-content a:hover { background-color: #555; }
.dropdown:hover .dropdown-content { display: block; }

/* =================================== */
/* Login Page Styles                   */
/* =================================== */
.login-container { padding: 2rem; max-width: 450px; margin: 2rem auto; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); text-align: center; transition: background-color 0.3s, box-shadow 0.3s; }
.login-container h2 { font-size: 2rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group input { width: 100%; padding: 0.75rem; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; background-color: #fff; color: #333; }
.login-btn { background-color: #007bff; color: white; border: none; padding: 0.8rem 1.5rem; border-radius: 6px; cursor: pointer; transition: all 0.3s ease; font-weight: 500; font-size: 1rem; width: 100%; }
.login-btn:hover { background-color: #0056b3; }
#error-message { color: #dc3545; margin-top: 1rem; font-weight: 500; }

/* =================================== */
/* Badges & Indicators                 */
/* =================================== */
.rookie-badge {
    background-color: #6c757d;
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.all-star-badge {
    color: gold;
    text-shadow: 0 0 2px #a18000;
    font-size: 1.1em;
    line-height: 1;
    display: inline-block;
    /* Sit the ★ so its lower points rest on the text baseline. `middle`
       dropped the glyph too low; this baseline-relative value is tuned against
       Segoe UI Symbol (Windows). Length, not `middle`, so it's ignored when the
       badge is a flex item and stays centered there. */
    vertical-align: -0.04em;
    margin-left: 0.5rem;
    cursor: default;
}

/* =================================== */
/* Footer Styles                       */
/* =================================== */
footer { text-align: center; margin-top: 3rem; padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom)); background-color: #333; color: #fff; display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; }
footer p { margin: 0; }
footer a { color: #fff; text-decoration: underline; display: inline-block; margin-top: 0; }

/* =================================== */
/* Mobile & Responsive Styles          */
/* =================================== */
.mobile-hide { display: table-cell; }
@media (max-width: 768px) {
    .mobile-hide { display: none; }

    /* Collapse the nav into the hamburger + stacked menu at the same 768px
       breakpoint the season pages use (apps/web globals.css), so the full
       nav and the hamburger never disagree between 601-768px. */
    header nav { position: static; }
    .nav-toggle { display: block; }
    header .nav-toggle {
        position: absolute;
        top: 1rem;
        right: max(0.5rem, env(safe-area-inset-right));
        z-index: 104;
        pointer-events: auto;
    }
    #nav-menu { display: none; }
    #nav-menu.active { display: flex !important; }
    nav ul { display: none; position: absolute; top: calc(100% - 1rem); left: 0; right: 0; background-color: #444; flex-direction: column; align-items: center; gap: 0rem; margin-top: 0; padding: 0.5rem 0; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 100; }
    nav ul.active { display: flex; }
    nav ul li { margin: 0; width: 100%; text-align: center; }
    nav ul li a { display: block; padding: 0.8rem 1rem; }
    nav ul li a:hover { background-color: #555; }
    .dropdown { display: block; width: 100%; }
    .dropdown .dropbtn { width: 100%; padding: 0.8rem 1rem; }
    .dropdown .dropbtn:hover { background-color: #555; }
    .dropdown-content { display: none; position: static; box-shadow: none; background-color: #4a4a4a; border-radius: 0; padding-top: 0; transform: none; left: auto; top: auto; }
    .dropdown-content a { padding-left: 2.5rem; }
    .dropdown.active .dropdown-content,
    .dropdown.dropdown-open .dropdown-content { display: block; }
    .dropdown:hover .dropdown-content { display: none; }
    .dropdown.active:hover .dropdown-content,
    .dropdown.dropdown-open:hover .dropdown-content { display: block; }
}
@media (max-width: 600px) {
  #auth-status { display: none; }
  #theme-toggle-btn { left: max(1rem, env(safe-area-inset-left)); right: auto; }
  .header-text { display: none; }
  .header-logo { width: 50px; height: 50px; }
}

/* =================================== */
/* Dark Mode Styles                    */
/* =================================== */
.dark-mode body { background-color: #121212; color: #e0e0e0; }
.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4 { color: #f5f5f5; }
.dark-mode #theme-toggle-btn .sun-icon { display: none; }
.dark-mode #theme-toggle-btn .moon-icon { display: block; }
.dark-mode #auth-status { color: #aaa; }
.dark-mode #auth-status a { color: #f5f5f5; }
.dark-mode footer a { color: #f5f5f5; }
.dark-mode .error { background-color: #5d1c21; color: #f8d7da; }
.dark-mode nav .dropdown-content { background-color: #444; }
.dark-mode nav .dropdown-content a:hover { background-color: #666; }
.dark-mode nav ul.active { background-color: #444; }
.dark-mode nav ul li a:hover { background-color: #555; }
.dark-mode nav .dropdown.active .dropdown-content,
.dark-mode nav .dropdown.dropdown-open .dropdown-content { background-color: #4a4a4a; }
.dark-mode .login-container { background-color: #1e1e1e; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.dark-mode .login-container h2 { color: #e5e7eb; }
.dark-mode .form-group input { background-color: #2c2c2c; border-color: #444; color: #e0e0e0; }
.dark-mode .rookie-badge { background-color: #9e9e9e; color: #121212; }
.dark-mode main a { color: #8ab4f8; }
.dark-mode main a:visited { color: #8ab4f8; }

/* Styles for index.html (Homepage) */
.dark-mode .hero-section,
.dark-mode .nav-card,
.dark-mode .season-history,
.dark-mode .info-section,
.dark-mode .footer-section {
    background-color: #1e1e1e;
}

.dark-mode .nav-card {
    border-color: #444;
}

.dark-mode .nav-card:hover {
    background-color: #2c2c2c;
}

.dark-mode .nav-card-title {
    color: #f5f5f5;
}

.dark-mode .hero-logo {
    border-color: #444;
}

.dark-mode .hero-subtitle,
.dark-mode .nav-card-description,
.dark-mode .season-status,
.dark-mode .season-stat-label,
.dark-mode .info-content p,
.dark-mode .info-content ul {
    color: #aaa;
}

.dark-mode .hero-description {
    color: #ccc;
}

.dark-mode .cta-button {
    background-color: #f5f5f5;
    color: #1e1e1e;
    font-weight: bold;
}

.dark-mode .cta-button:hover {
    background-color: #e0e0e0;
    color: #121212;
}

.dark-mode .footer-links a {
    color: #8ab4f8;
}

.dark-mode .season-card {
    background-color: #1e1e1e;
    border-color: #333;
}

.dark-mode .season-card:hover {
    background-color: #2c2c2c;
}

.dark-mode .season-title {
    color: #f5f5f5;
}

.dark-mode .season-stat-value {
    color: #8ab4f8;
}

.dark-mode .season-card.current .season-stat-value {
    color: white;
}

.dark-mode .season-card.current .season-stat-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Dark mode scrollbar styles */
.dark-mode, .dark-mode body {
  scrollbar-color: #555 #1e1e1e;
  scrollbar-width: thin;
}
.dark-mode::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
.dark-mode::-webkit-scrollbar-track {
  background: #1e1e1e;
}
.dark-mode::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 20px;
  border: 3px solid #1e1e1e;
}
.dark-mode::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}
/* =================================== */
/* OAuth & Activation Styles           */
/* =================================== */

/* OAuth Section */
.oauth-section {
    margin-bottom: 1.5rem;
}

.oauth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0.75rem 1.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.oauth-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.oauth-btn:active {
    transform: scale(0.98);
}

.oauth-btn.google-btn:hover {
    border-color: #4285f4;
}

.oauth-btn.apple-btn {
    background-color: #000;
    color: #fff;
    border-color: #000;
}

.oauth-btn.apple-btn:hover {
    background-color: #333;
    border-color: #333;
}

.oauth-icon {
    width: 20px;
    height: 20px;
}

.privacy-note {
    margin-top: 0.75rem;
    margin-bottom: 0;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

.privacy-note small {
    font-size: 0.85rem;
}

/* Login Divider */
.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #666;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dark mode OAuth styles */
.dark-mode .oauth-btn {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border-color: #444;
}

.dark-mode .oauth-btn:hover {
    background-color: #3c3c3c;
}

.dark-mode .oauth-btn.apple-btn {
    background-color: #000;
    border-color: #444;
}

.dark-mode .oauth-btn.apple-btn:hover {
    background-color: #222;
}

.dark-mode .login-divider {
    color: #999;
}

.dark-mode .login-divider::before,
.dark-mode .login-divider::after {
    border-bottom-color: #444;
}

.dark-mode .privacy-note {
    color: #999;
}

/* ====================================================================== */
/* MODERN STYLE OVERRIDES (only apply when data-style-rollout="modern") */
/* ====================================================================== */

[data-style-rollout="modern"] body {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #0f172a;
}

/* Static-page load reveal — eases the main content in on load so the portal /
   login / static pages feel as smooth as the Next pages' <main> crossfade. The
   header stays instant (persistent-chrome parity). `both` holds the from-state
   until the animation runs (incl. a portal <main> shown after the auth check),
   so there's no flash. Motion-respecting. Mirrors the apps/web 260ms ease. */
@keyframes rkl-page-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
    [data-style-rollout="modern"] body main {
        animation: rkl-page-in 260ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
    }
}

[data-style-rollout="modern"] header {
    /* Theme-aware header chrome. Light by default; dark values are restored
       under .dark-mode below. These custom properties inherit down into the
       nav pill, the dropdowns, the mobile menu and the toggle/hamburger icons,
       so the whole static/portal header flips with the theme from this one
       place — a port of the apps/web globals.css --hdr-* system so the portals
       match the public Next site (light header in light mode). */
    --hdr-bg: linear-gradient(135deg, #ffffff, #eef2f7);
    --hdr-fg: #0f172a;
    --hdr-fg-muted: #475569;
    --hdr-border: #e2e8f0;
    --hdr-pill-bg: rgba(15, 23, 42, 0.04);
    --hdr-pill-border: rgba(148, 163, 184, 0.35);
    --hdr-item-hover-bg: rgba(15, 23, 42, 0.06);
    --hdr-menu-bg: #ffffff;
    --hdr-menu-border: #e2e8f0;
    --hdr-menu-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
    background: var(--hdr-bg);
    border-bottom: 1px solid var(--hdr-border);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

[data-style-rollout="modern"] #nav-menu li a,
[data-style-rollout="modern"] #nav-menu .dropbtn {
    color: var(--hdr-fg, #fff);
}

/* =====================================================================
 * Canonical modern nav — mirror of the season-home pill nav defined in
 * apps/web/src/app/globals.css (body.s9-page #nav-menu). global-styles.css
 * is loaded by every static page (the public pages AND the GM / Commish /
 * Admin / Scorekeeper portals) and is NOT loaded by the Next season pages,
 * so these rules are the single source of truth that makes every static
 * page render the same nav as the season homepage. Keep the values in sync
 * with the apps/web block.
 *
 * Dropdown open-state keys on :hover, :focus-within, .dropdown.active and
 * .dropdown-open. js/main.js toggles both tap classes so static and Next
 * naming stay in sync.
 * ===================================================================== */
@media (min-width: 769px) {
    [data-style-rollout="modern"] header nav {
        width: 100%;
    }

    [data-style-rollout="modern"] #nav-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        /* apps/web uses nowrap; static pages carry slightly longer labels
           (e.g. "Standings & Rankings") so we allow a graceful wrap inside
           the pill instead of overflowing on narrow desktops. */
        flex-wrap: wrap;
        gap: 0.5rem clamp(0.8rem, 1.35vw, 1.35rem);
        width: min(100% - 1rem, 1220px);
        margin: 1rem auto 0;
        padding: 0.8rem 1.85rem;
        border: 1px solid var(--hdr-pill-border, rgba(148, 163, 184, 0.18));
        border-radius: 12px;
        background: var(--hdr-pill-bg, rgba(15, 23, 42, 0.34));
        box-shadow: none;
        box-sizing: border-box;
    }

    [data-style-rollout="modern"].dark-mode #nav-menu {
        border-color: rgba(96, 165, 250, 0.16);
        background: rgba(15, 23, 42, 0.52);
    }

    [data-style-rollout="modern"] #nav-menu > li {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        min-height: 34px;
        margin: 0;
    }

    [data-style-rollout="modern"] #nav-menu > li > a,
    [data-style-rollout="modern"] #nav-menu > li > .dropbtn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 34px;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--hdr-fg, #fff);
        font: inherit;
        font-size: 0.94rem;
        line-height: 1;
        text-decoration: none;
        white-space: nowrap;
    }

    [data-style-rollout="modern"] #nav-menu > li > a:hover,
    [data-style-rollout="modern"] #nav-menu > li > a.active,
    [data-style-rollout="modern"] #nav-menu .dropdown:hover .dropbtn,
    [data-style-rollout="modern"] #nav-menu .dropdown:focus-within .dropbtn,
    [data-style-rollout="modern"] #nav-menu .dropdown.active .dropbtn,
    [data-style-rollout="modern"] #nav-menu .dropdown.dropdown-open .dropbtn {
        color: var(--hdr-fg-muted, #ccc);
    }

    [data-style-rollout="modern"] #nav-menu .dropdown {
        display: flex;
        align-items: center;
    }

    /* Keep the menu mounted and toggle via visibility/opacity so a short
       close delay lets a diagonal move into the submenu land (hover grace). */
    [data-style-rollout="modern"] #nav-menu .dropdown-content {
        display: block;
        visibility: hidden;
        opacity: 0;
        overflow: hidden;
        /* 0.45rem gap matches the season pages, where css/public-shell.css
           contributes this offset on top of the apps/web shell. */
        top: calc(100% + 0.45rem);
        min-width: 205px;
        padding: 0.5rem;
        border: 1px solid var(--hdr-menu-border, rgba(148, 163, 184, 0.18));
        border-radius: 12px;
        background: var(--hdr-menu-bg, linear-gradient(145deg, #111827, #0f172a));
        box-shadow: var(--hdr-menu-shadow, 0 18px 40px rgba(2, 6, 23, 0.32));
        transition: opacity 0.2s ease 0.2s, visibility 0s linear 0.4s;
    }

    [data-style-rollout="modern"].dark-mode #nav-menu .dropdown-content {
        border-color: #243047;
        background: linear-gradient(145deg, #0b1220, #111827);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    }

    [data-style-rollout="modern"] #nav-menu .dropdown:hover .dropdown-content,
    [data-style-rollout="modern"] #nav-menu .dropdown:focus-within .dropdown-content,
    [data-style-rollout="modern"] #nav-menu .dropdown.active .dropdown-content,
    [data-style-rollout="modern"] #nav-menu .dropdown.dropdown-open .dropdown-content {
        visibility: visible;
        opacity: 1;
        transition: opacity 0.1s ease 0s, visibility 0s;
    }

    [data-style-rollout="modern"] #nav-menu .dropdown-content a {
        display: block;
        width: 100%;
        min-height: 0;
        padding: 0.65rem 1rem;
        color: var(--hdr-fg, #fff);
        font-size: 0.95rem;
        line-height: 1.25;
        text-align: left;
        white-space: nowrap;
        border-radius: 8px;
    }

    [data-style-rollout="modern"] #nav-menu .dropdown-content a:hover {
        background: var(--hdr-item-hover-bg, rgba(37, 99, 235, 0.22));
        color: var(--hdr-fg, #fff);
    }

    [data-style-rollout="modern"].dark-mode #nav-menu .dropdown-content a:hover {
        background: rgba(96, 165, 250, 0.2);
    }
}

/* =====================================================================
 * Canonical modern nav — MOBILE (≤768px). Mirror of the apps/web season
 * pages' mobile nav (globals.css @media max-width:768px). Without this the
 * static / portal pages fall back to the generic mobile block above and the
 * hamburger menu renders as the legacy gray (#444) absolutely-positioned
 * panel instead of the dark, inline-expanding navy list the season pages use.
 *
 * The menu drops in the normal flow on the dark header (transparent in light,
 * navy gradient in dark) and each dropdown stacks inline as a navy panel.
 * Open-state still keys on the `.active` class js/main.js toggles on tap.
 * Keep the values in sync with the apps/web block.
 * ===================================================================== */
@media (max-width: 768px) {
    /* Compact right-anchored dropdown CARD — parity with the apps/web season
       pages' mobile menu (was a full-width inline-expanding list). Absolutely
       positioned so it OVERLAYS the page instead of pushing content down;
       anchored to <nav>. Open/close is animated via .is-open / .is-closing
       (js/main.js keeps it mounted display:flex while closing). The card flips
       light/dark with the header via the inherited --hdr-* tokens. */
    [data-style-rollout="modern"] #nav-menu {
        position: absolute;
        /* Anchored to <nav> (the offset parent); the hamburger is also in <nav>
           at top:1rem (~2.8rem tall), so 3.95rem reliably clears it. Both share
           the same offset parent, so this holds regardless of header height. */
        top: 3.95rem;
        right: max(0.5rem, env(safe-area-inset-right));
        flex-direction: column;
        width: max-content;
        min-width: 200px;
        max-width: min(86vw, 300px);
        margin: 0;
        padding: 0.35rem;
        gap: 0.1rem;
        border: 1px solid var(--hdr-menu-border, rgba(148, 163, 184, 0.18));
        border-radius: 12px;
        background: var(--hdr-menu-bg, linear-gradient(145deg, #111827, #0f172a));
        box-shadow: var(--hdr-menu-shadow, 0 18px 44px rgba(0, 0, 0, 0.4));
        overflow: hidden;
        z-index: 200;
    }

    /* Mount-and-fade open/close. .active is the from-state; .is-open the visible
       state. js/main.js adds .is-open on the next frame after mounting, and
       removes it (keeping the node mounted) until transitionend on close. */
    [data-style-rollout="modern"] #nav-menu.active {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
        transform-origin: top right;
        transition: opacity 180ms cubic-bezier(0.22, 0.61, 0.36, 1),
                    transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
        will-change: opacity, transform;
    }

    [data-style-rollout="modern"] #nav-menu.active.is-open {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    [data-style-rollout="modern"] #nav-menu > li {
        width: 100%;
        margin: 0;
        text-align: left;
    }

    [data-style-rollout="modern"] #nav-menu > li > a,
    [data-style-rollout="modern"] #nav-menu > li > .dropbtn {
        display: block;
        width: 100%;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        background: transparent;
        color: var(--hdr-fg, #fff);
        font-size: 0.95rem;
        font-weight: 500;
        text-align: left;
    }

    [data-style-rollout="modern"] #nav-menu > li > a:hover,
    [data-style-rollout="modern"] #nav-menu > li > a.active,
    [data-style-rollout="modern"] #nav-menu .dropdown.active > .dropbtn,
    [data-style-rollout="modern"] #nav-menu .dropdown.dropdown-open > .dropbtn,
    [data-style-rollout="modern"] #nav-menu > li > .dropbtn:hover {
        background: var(--hdr-item-hover-bg, rgba(255, 255, 255, 0.1));
        color: var(--hdr-fg, #fff);
    }

    [data-style-rollout="modern"] #nav-menu .dropdown {
        display: block;
        width: 100%;
    }

    /* Submenu stacks inline within the card, indented; display toggled by
       `.dropdown.active` / `.dropdown-open` — matches the season pages. */
    [data-style-rollout="modern"] #nav-menu .dropdown-content {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    [data-style-rollout="modern"] #nav-menu .dropdown-content a {
        padding: 0.4rem 0.75rem 0.4rem 1.4rem;
        border-radius: 8px;
        color: var(--hdr-fg-muted, #cbd5e1);
        font-size: 0.88rem;
        text-align: left;
    }

    [data-style-rollout="modern"] #nav-menu .dropdown-content a:hover {
        background: var(--hdr-item-hover-bg, rgba(37, 99, 235, 0.22));
        color: var(--hdr-fg, #fff);
    }
}

[data-style-rollout="modern"] .login-container {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.1);
}

[data-style-rollout="modern"] .login-container h2,
[data-style-rollout="modern"] .form-group label,
[data-style-rollout="modern"] .login-divider {
    color: #0f172a;
}

[data-style-rollout="modern"] .form-group input {
    border-color: #e5e7eb;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-style-rollout="modern"] .login-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #f8fafc;
    border: 1px solid #1e40af;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
}

[data-style-rollout="modern"] .login-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

[data-style-rollout="modern"] .oauth-btn {
    background: linear-gradient(135deg, #ffffff, #f3f6fb);
    border-color: #e5e7eb;
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

[data-style-rollout="modern"] .oauth-btn:hover {
    background: linear-gradient(135deg, #f8fbff, #eef2ff);
    border-color: #bfdbfe;
}

[data-style-rollout="modern"] .oauth-btn.google-btn:hover {
    border-color: #60a5fa;
}

[data-style-rollout="modern"] .login-divider::before,
[data-style-rollout="modern"] .login-divider::after {
    border-bottom-color: #e5e7eb;
}

/* Light footer in light mode to match the light header chrome; the dark navy
   footer is restored under .dark-mode below. */
[data-style-rollout="modern"] footer {
    background: linear-gradient(135deg, #ffffff, #eef2f7);
    border-top: 1px solid #e2e8f0;
    color: #475569;
}

[data-style-rollout="modern"] footer a {
    color: #2563eb;
}

[data-style-rollout="modern"] footer a:hover {
    color: #1d4ed8;
}

[data-style-rollout="modern"].dark-mode body {
    background: linear-gradient(135deg, #1a1f2e, #1e2433);
    color: #e5e7eb;
}

[data-style-rollout="modern"].dark-mode header {
    --hdr-bg: linear-gradient(135deg, #111827, #1b2435);
    --hdr-fg: #e5e7eb;
    --hdr-fg-muted: #cbd5e1;
    --hdr-border: #2d3748;
    --hdr-pill-bg: rgba(15, 23, 42, 0.52);
    --hdr-pill-border: rgba(96, 165, 250, 0.16);
    --hdr-item-hover-bg: rgba(255, 255, 255, 0.1);
    --hdr-menu-bg: linear-gradient(145deg, #0b1220, #111827);
    --hdr-menu-border: #243047;
    --hdr-menu-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    background: var(--hdr-bg);
    border-bottom-color: var(--hdr-border);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

[data-style-rollout="modern"].dark-mode nav ul li a,
[data-style-rollout="modern"].dark-mode .dropdown .dropbtn {
    color: #e5e7eb;
}

[data-style-rollout="modern"].dark-mode .dropdown-content {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), rgba(17, 24, 39, 0.98));
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

[data-style-rollout="modern"].dark-mode .login-container {
    background: linear-gradient(145deg, #0f1419, #111827);
    border-color: #2d3748;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
}

[data-style-rollout="modern"].dark-mode .login-container h2,
[data-style-rollout="modern"].dark-mode .form-group label,
[data-style-rollout="modern"].dark-mode .form-group label span {
    color: #e5e7eb;
}

[data-style-rollout="modern"].dark-mode .form-group input {
    background: #0b1015;
    border-color: #2d3748;
    color: #e5e7eb;
}

[data-style-rollout="modern"].dark-mode .login-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

[data-style-rollout="modern"].dark-mode .oauth-btn {
    background: linear-gradient(135deg, #0f172a, #1f2937);
    border-color: #2d3748;
    color: #e5e7eb;
}

[data-style-rollout="modern"].dark-mode .oauth-btn:hover {
    background: linear-gradient(135deg, #111827, #1f2937);
    border-color: #3b4a61;
}

/* Public auth pages: align login/activate surfaces with the modern RKL/RKML shell. */
[data-style-rollout="modern"] body.public-page.login-page,
[data-style-rollout="modern"] body.public-page.activate-page {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(243, 246, 251, 0.96) 360px),
        #f3f6fb;
    color: #0f172a;
}

[data-style-rollout="modern"].dark-mode body.public-page.login-page,
[data-style-rollout="modern"].dark-mode body.public-page.activate-page {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(11, 17, 32, 0.98) 360px),
        #0b1120;
    color: #e5e7eb;
}

[data-style-rollout="modern"] body.public-page .public-main {
    width: min(560px, calc(100% - 2rem));
    margin: 1.5rem auto 2.75rem;
    padding: 0;
}

[data-style-rollout="modern"] body.public-page .login-container {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: 8px;
    border-color: #d9e2ee;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

[data-style-rollout="modern"].dark-mode body.public-page .login-container {
    border-color: #263345;
    background: #111827;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

[data-style-rollout="modern"] body.public-page .form-group input,
[data-style-rollout="modern"] body.public-page .form-group select {
    box-sizing: border-box;
    border-radius: 8px;
}

[data-style-rollout="modern"] body.public-page .login-btn,
[data-style-rollout="modern"] body.public-page .oauth-btn {
    box-sizing: border-box;
    border-radius: 8px;
}

@media (max-width: 640px) {
    [data-style-rollout="modern"] body.public-page .public-main {
        width: calc(100% - 1rem);
        margin-top: 1rem;
    }
}

[data-style-rollout="modern"].dark-mode .login-divider,
[data-style-rollout="modern"].dark-mode .login-divider span {
    color: #cbd5e1;
}

[data-style-rollout="modern"].dark-mode .login-divider::before,
[data-style-rollout="modern"].dark-mode .login-divider::after {
    border-bottom-color: #2d3748;
}

[data-style-rollout="modern"].dark-mode footer {
    background: linear-gradient(135deg, #1a1f2e, #1e2433);
    border-top: 1px solid #2d3748;
}

[data-style-rollout="modern"].dark-mode footer a {
    color: #60a5fa;
}

[data-style-rollout="modern"].dark-mode footer a:hover {
    color: #93c5fd;
}

/* ===================================================================
 * Touch-friendly interaction states
 * ===================================================================
 *
 * On iOS Safari (and most mobile browsers), :hover styles linger
 * after a tap until the user taps elsewhere — the user sees the
 * card stay raised, the link stay highlighted, etc., which reads
 * as "broken". These rules reverse hover transforms / shadows for
 * any device without true hover capability.
 *
 * Paired with :active rules below for tactile press feedback on
 * touch (and clean reset of hover transforms when the press lifts).
 *
 * Source: docs/ux-audit/02-mobile-ux.md top issues #1, #3,
 * §Touch interactions, §Quick wins 5 + 7.
 */

@media (hover: none), (pointer: coarse) {
    /* Cancel hover lifts/shadows that would otherwise stick after tap. */
    .nav-card:hover,
    .team-cell:hover,
    .game-item:hover,
    .pick-item-enhanced:hover,
    .back-button:hover,
    .card:hover,
    .panel:hover,
    .season-card:hover,
    .table-wrapper:hover,
    .season-grid-item:hover {
        transform: none;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    /* Hover-triggered nav dropdowns are unreachable on touch.
     * Mobile nav already handles tap-to-open via .active class
     * (see js/main.js navToggle wiring). */
    .dropdown:hover .dropdown-content {
        display: none;
    }
    .dropdown.active .dropdown-content,
    .dropdown.dropdown-open .dropdown-content {
        display: block;
    }
}

/* Tactile press feedback for tappable cards/buttons. Subtle scale,
 * fast transition; reads as "I pressed this" without competing with
 * the navigation that follows. */
.nav-card:active,
.team-cell:active,
.game-item:active,
.pick-item-enhanced:active,
.back-button:active {
    transform: scale(0.98);
    transition: transform 100ms ease-out;
}
