/* Shared by every page (Draft Strategist, Lineup Strategist, T-Score): tokens, resets, chrome, forms,
   buttons, badges, tooltips, toasts, shared cards. Each app links its own css/mds.css or css/mls.css
   after this file. Split from styles.css in refactor chunk 4A; rules keep their original order.
   The rules after the drag-and-drop section style Lineup Strategist features the owner chose to
   share with Draft Strategist (refactor 4C/4D): the rankings upload preview, layout and spacing
   helpers, the info banner, the keyboard hint, freshness labels, the processing/success lines, the
   setup checklist and player-name autocomplete. They sit at the end so they still beat every
   earlier shared rule, as they did from mls.css. A few app-only rules stay earlier in this file
   because a shared rule on the same element would otherwise change what wins (docs/refactor/LOG.md, 4D). */

/* --- OUTFIT, SELF-HOSTED (improvements S17) --- */
/* The site's font, served from /fonts/ instead of Google Fonts: Google's stylesheet held up the first paint while
   the browser opened two more connections (fonts.googleapis.com, then fonts.gstatic.com); without them a phone's
   first visit paints about a second sooner. The same files Google serves for Outfit 400-700 (v15, one variable font
   per subset, so one file covers every weight), with Google's subsets and display: swap, so text shows in the
   fallback font until Outfit arrives. The latin file is preloaded in each page's <head>; both are in sw.js's
   PRECACHE_ASSETS. Licence: fonts/OFL.txt. */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(../fonts/outfit-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(../fonts/outfit-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- SHARED CSS VARIABLES & ROOT DESIGN TOKENS --- */
:root {
    color-scheme: dark;
    /* MOTION (Material 3 Expressive; improvements M18). Every transition and animation in the four stylesheets uses these
       (tests/unit/motionTokens.test.mjs checks). Expressive's motion is springs (androidx Compose's
       ExpressiveMotionTokens: spatial fast 0.6 damping / 800 stiffness, default 0.8 / 380, slow 0.8 / 200; effects
       critically damped at 3800 / 1600 / 800). CSS has no springs, so each one is sampled into a linear() easing over
       the time it takes to settle, the way material-web's labs do it (labs/gb button group: its fast spatial linear()
       is the first line below, to 0.002). Spatial: things that move or change size or shape (a little overshoot: 9.5%
       fast, 1.5% default and slow). Effects: colour and opacity (no overshoot). Fast for small things, default for
       most, slow for whole screens. Browsers without linear() get Material's cubic-bezier stand-ins (further down). */
    --motion-spatial-fast: linear(0, 0.099, 0.317, 0.561, 0.775, 0.934, 1.034, 1.083, 1.095, 1.084, 1.063, 1.04, 1.02, 1.005, 0.996, 0.992, 0.991, 0.992, 0.994, 0.996, 1);
    --motion-spatial-fast-ms: 350ms;
    --motion-spatial-default: linear(0, 0.066, 0.213, 0.383, 0.546, 0.685, 0.796, 0.878, 0.935, 0.973, 0.996, 1.008, 1.014, 1.015, 1.014, 1.012, 1.009, 1.007, 1.005, 1.003, 1.002, 1.001, 1, 1, 1);
    --motion-spatial-default-ms: 500ms;
    --motion-spatial-slow: linear(0, 0.052, 0.171, 0.317, 0.464, 0.598, 0.713, 0.805, 0.875, 0.927, 0.964, 0.988, 1.003, 1.011, 1.014, 1.015, 1.014, 1.012, 1.01, 1.008, 1.006, 1.004, 1.003, 1.002, 1.001, 1, 1);
    --motion-spatial-slow-ms: 650ms;
    --motion-effects-fast: linear(0, 0.181, 0.456, 0.672, 0.813, 0.897, 0.945, 0.971, 0.985, 0.992, 0.996, 0.998, 1);
    --motion-effects-fast-ms: 150ms;
    --motion-effects-default: linear(0, 0.144, 0.385, 0.594, 0.745, 0.845, 0.908, 0.947, 0.969, 0.983, 0.99, 0.995, 1);
    --motion-effects-default-ms: 200ms;
    --motion-effects-slow: linear(0, 0.124, 0.342, 0.543, 0.697, 0.805, 0.878, 0.925, 0.954, 0.972, 0.984, 0.99, 0.994, 0.997, 1);
    --motion-effects-slow-ms: 300ms;
    /* Material 3's easing curves (material-web's md.sys.motion tokens), for what enters and leaves the screen: a drawer
       or a sheet comes in decelerating and goes out accelerating, so nothing overshoots past the screen's edge.
       Emphasized is also standard (material-web sets one to the other). */
    --motion-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --motion-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
    --motion-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
    --motion-duration-short2: 100ms;
    --motion-duration-short4: 200ms;
    --motion-duration-medium2: 300ms;
    --motion-duration-medium4: 400ms;
    /* State layers (material-web's ripple): the hover tint comes almost at once (15 ms), the press tint in 100 ms. */
    --motion-state-hover-ms: 15ms;
    /* The snackbar (toasts): material-web labs/gb's 150 ms in, 75 ms out, on Material's legacy decelerate and
       accelerate curves (md.sys.motion.easing.legacy.*). */
    --motion-legacy-decelerate: cubic-bezier(0, 0, 0.2, 1);
    --motion-legacy-accelerate: cubic-bezier(0.4, 0, 1, 1);
    --motion-snackbar-enter-ms: 150ms;
    --motion-snackbar-exit-ms: 75ms;
    /* A pressed button's corners tighten (improvements M2): the fast spatial spring. */
    --press-morph: var(--motion-spatial-fast-ms) var(--motion-spatial-fast);
    /* Deeper, more premium dark mode backgrounds */
    --bg-color: #0a0e17; 
    --card-bg: #131b2c; 
    
    /* Text Colors - Off-white is easier on the eyes than pure white */
    --text-main: #f3f4f6; 
    --text-muted: #9ca3af;
    --border: #1f2937;
    /* The line where a dialog's scrolling middle meets its pinned title or buttons (improvements F10): --border is
       too faint to see on a phone. */
    --modal-edge: #334155;
    /* Room on phones (improvements M17). Inside a card nothing is boxed again: a nested block (a folded section, a toggle
       row, a "needs you" box) is this one shade lighter than the card, with no border, and rows are list rows split by
       --divider, a step brighter than --border so they read on the dark card (owner's choice). M14 folds both into its
       surface tokens. */
    --surface-inset: #182237;
    --divider: #2a3546;

    /* Premium Accents (Desaturated for better contrast) */
    --primary-green: #10b981; 
    
    /* Call Out & Target Colors - Using subtle background opacities */
    --target-bg: rgba(16, 185, 129, 0.1); 
    --target-border: #10b981;
    
    --avoid-bg: rgba(239, 68, 68, 0.1); 
    --avoid-border: #ef4444;
    
    --dart-bg: rgba(59, 130, 246, 0.1); 
    --dart-border: #3b82f6;
    
    --stack-color: #f97316;

    /* Status colors for flashButton (js/shared/ui/flashButton.js), the error toast border, and inline error
       text. These used to be referenced with hard-coded fallbacks but never defined.
       --error-color is the strong red for fills and borders. --error-text is the lighter red
       for text on dark cards, where #ea4335 would be too dim to read comfortably. */
    --success-color: #4ade80;
    --error-color: #ea4335;
    --error-text: #fca5a5;

    /* Button accent colors -- previously hardcoded directly in .btn-blue/.btn-purple below.
       Named for what they are (a specific button's color), not reused from --dart-border/
       --pos-wr-border even though they currently share the same blue: those represent an
       unrelated concept (fantasy "dart throw" / WR position color) that happens to look the
       same today, and could reasonably change independently of what a button looks like. */
    --btn-blue-bg: #3b82f6;
    --btn-purple-bg: #8b5cf6;

    /* Positional Colors - Muted backgrounds with vibrant borders */
    --pos-qb: rgba(239, 68, 68, 0.15);   --pos-qb-border: #ef4444;
    --pos-rb: rgba(16, 185, 129, 0.15);  --pos-rb-border: #10b981;
    --pos-wr: rgba(59, 130, 246, 0.15);  --pos-wr-border: #3b82f6;
    --pos-te: rgba(245, 158, 11, 0.15);  --pos-te-border: #f59e0b;
    --pos-k: rgba(167, 139, 250, 0.15);   --pos-k-border: #a78bfa; /* Sleeper Kicker Lavender */
    --pos-def: rgba(146, 93, 72, 0.15);   --pos-def-border: #925d48; /* Sleeper DEF Rust */
    /* Flex-type slots (owner's choice, improvements S1): no color of their own, so their border (or,
       for plain-text labels, their text) runs through the colors of the positions they accept. Used
       by .flex-blend / .sflex-blend / .wt-blend at the end of this file and .slot-badge in css/mls.css. */
    --flex-blend: linear-gradient(90deg, var(--pos-rb-border), var(--pos-wr-border), var(--pos-te-border));
    --sflex-blend: linear-gradient(90deg, var(--pos-qb-border), var(--pos-rb-border), var(--pos-wr-border), var(--pos-te-border));
    --wt-blend: linear-gradient(90deg, var(--pos-wr-border), var(--pos-te-border));
    --wr-blend: linear-gradient(90deg, var(--pos-rb-border), var(--pos-wr-border));
    --blend-fill: linear-gradient(rgba(23, 30, 45, 0.92), rgba(23, 30, 45, 0.92));

    /* Spacing scale -- a token version of the ad-hoc rem values (0.4rem, 0.6rem, 0.85rem...)
       scattered through inline styles. The margin/padding/gap utilities below, and the
       .stack/.cluster layout primitives, are built on these so vertical/horizontal rhythm
       stays consistent instead of every element picking its own number. Values match what
       was already in use most often, so existing spacing mostly doesn't visibly shift --
       this is about giving those values one shared source, not a visual redesign. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
}
/* Browsers without linear() easings (Safari before 17.2): the cubic-bezier curves Material 3 Expressive gives for the web,
   with the same overshoot and length as each spring (the fast spatial one is labs/gb's pressed-button curve). */
@supports not (transition-timing-function: linear(0, 1)) {
    :root {
        --motion-spatial-fast: cubic-bezier(0.42, 1.67, 0.21, 0.90);
        --motion-spatial-default: cubic-bezier(0.38, 1.21, 0.22, 1.00);
        --motion-spatial-slow: cubic-bezier(0.39, 1.29, 0.35, 0.98);
        --motion-effects-fast: cubic-bezier(0.31, 0.94, 0.34, 1.00);
        --motion-effects-default: cubic-bezier(0.34, 0.80, 0.34, 1.00);
        --motion-effects-slow: cubic-bezier(0.34, 0.88, 0.34, 1.00);
    }
}

/* --- GLOBAL RESETS --- */
* { 
    box-sizing: border-box; 
    margin: 0; /* Reset margins globally to prevent unwanted scrollbars */
    padding: 0;
}

/* Visually hides content while keeping it available to screen readers -- the standard,
   widely-used pattern (as opposed to display:none, which hides it from assistive tech too). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link: off-screen until a keyboard user tabs to it, then pinned top-left above the
   sticky header (z-index 100). Offset by the notch inset for the installed iPhone PWA. */
.skip-link {
    position: absolute;
    top: calc(0.5rem + env(safe-area-inset-top));
    left: 0.5rem;
    z-index: 1000;
    padding: 0.6rem 1rem;
    background: var(--primary-green);
    color: #0a0e17;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transform: translateY(-200%);
}
.skip-link:focus-visible {
    transform: none;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    
    /* Apply our new premium font */
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif; 
    
    /* CRITICAL FOR FANTASY FOOTBALL: Makes all numbers line up perfectly in columns */
    font-variant-numeric: tabular-nums; 
    
    /* Makes text render crisper on modern screens */
    -webkit-font-smoothing: antialiased;
    
    padding-bottom: 70px; 
    overflow-x: hidden; 
}

.container { 
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto; 
    /* Doubled the spacing to let the design breathe */
    padding: 2rem 1.5rem; 
}

/* --- STICKY HEADER --- */
.header { 
    /* Premium Glassmorphism replacing the heavy gradient */
    background: rgba(10, 14, 23, 0.85); /* Uses var(--bg-color) base */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* For Safari */
    
    border-bottom: 1px solid var(--border); 
    padding: 0.75rem 1.5rem; 
    /* Installed PWA uses the black-translucent status bar, so push content below the notch.
       env() is 0 in a normal browser tab, so this is a no-op there. */
    padding-top: calc(0.75rem + env(safe-area-inset-top));
    position: sticky; 
    top: 0; 
    z-index: 100; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    /* Subtly colored shadow instead of generic black */
    box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.4); 
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- Header League Select --- */
/* Phones only (under 600px, Material 3's compact window; improvements F27): from 600px a window has the room for the
   app's name and a league picker of normal width, as a computer does, instead of the phone header stretched across it.
   The bigger league arrows below stay up to 840px, where the screen is usually a touch screen. */
@media (max-width: 599.98px) {
    /* 1. Reduce the wide left/right padding on the ends of the header */
    .header {
        padding: 0.5rem 0.5rem; 
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    /* 2. Reduce the gap between the hamburger menu and the logo */
    .header-left {
        gap: 0.5rem;
    }
    
    /* 3. Hide the app title text to free up massive space for the controls */
    .logo-text {
        display: none;
    }

    /* 4. Implement the missing class to hide the word "Sync" inside the button */
    .hide-on-mobile {
        display: none;
    }
    
    /* 5. (Draft Strategist's draft drop-down used to be capped at 130px here; since improvements M2 it takes the free
       space like Lineup Strategist's: HEADER PICKER.) */
}
@media (max-width: 839.98px) {

    /* 6. Bigger, easier-to-tap prev/next league buttons on mobile. Desktop keeps the
       original compact size (set inline via .league-nav-btn's base rule below) --
       Shift+Arrow already covers fast league-cycling with a keyboard, so the larger
       touch target and accent border are only needed where a fingertip has to land on
       it precisely. 44px is the standard minimum recommended touch-target size. */
    .league-nav-btn {
        padding: 0.7rem 0.85rem;
        min-width: 44px;
        min-height: 44px;
        border: 1.5px solid var(--primary-green);
    }
    .league-nav-btn svg {
        width: 20px;
        height: 20px;
    }
}
/* --- HAMBURGER MENU & DRAWER --- */
.menu-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(10, 14, 23, 0.7); /* Slightly warmer, softer dark overlay */
    backdrop-filter: blur(4px); /* Blurs the background when menu is open */
    -webkit-backdrop-filter: blur(4px);
    z-index: 999; 
    display: none; 
}

.hamburger-menu { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 280px; 
    height: 100%; 
    background: var(--card-bg); 
    z-index: 1000; 
    
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--motion-duration-short4) var(--motion-emphasized-accelerate), visibility 0s linear var(--motion-duration-short4); 
    
    border-right: 1px solid var(--border); 
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4); 
    display: flex; 
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden; 
    overscroll-behavior: contain;
}

/* Keep a field reached by Tab from landing under the sticky .header (matches the
   scroll-margin-top on #rosRankingsCard). */
html { scroll-padding-top: 5rem; }

/* --- MODAL OVERLAY CHROME (shared) + RANKINGS UPLOAD PREVIEW MODAL (both apps since 8C) --- */
/* The .mds-modal-overlay / .mds-modal pair is the generic backdrop-and-card treatment, also
   used by the shared confirm dialog (showConfirm in js/shared/ui/confirm.js). The .preview-*
   selectors alongside them are the rankings upload preview's (lineup/index.html and, since
   refactor 8C, index.html). They were .mls-preview-* until 8C. */
.preview-overlay,
.mds-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* Clear of a phone's notch and home bar (improvements F10). The pages use viewport-fit=cover. */
    padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right))
             max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    overscroll-behavior: contain;
}

/* A column (improvements F10): the title, a middle that scrolls (.preview-body / .mds-modal-body) and the button row,
   which stays at the bottom however long the middle gets. Before, the whole card scrolled as one block, and on a phone
   with many leagues Cancel and Replace Set sat below the fold. Every width: it's the same dialog everywhere (owner).
   A short dialog lays out exactly as before: nothing scrolls, and the body's padding is taken back by its margins.
   max-height: dvh follows the phone's toolbars (vh is the fallback), and 100% is the overlay's height, which
   watchModal (js/shared/ui/modalLayout.js) fits above an on-screen keyboard. */
.preview-modal,
.mds-modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    max-height: min(85dvh, 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem;
    overscroll-behavior: contain;
}

/* The scrolling middle reaches into the card's padding (negative margins, the same padding back), so a focus ring at
   its edge isn't clipped and the content sits where it always did. */
.preview-body,
.mds-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: -4px -1.5rem;
    padding: 4px 1.5rem;
}

.preview-modal > h3,
.mds-modal > h3,
.preview-actions,
.mds-modal-actions { flex: none; }

/* The upload previews and the league picker are wider on computers (improvements F10, round 2): 400px squeezed the
   league rows. Phones are narrower than either, so they're unchanged. The confirm and prompt cards stay 400px. */
.preview-modal { max-width: 520px; }

/* The title is the top edge of the scrolling middle: its 0.5rem gap is padding on the card's colour (was a margin),
   drawn above the body, so content scrolled up passes under it. With content above the fold (watchModal's
   .is-scrolled-down) it gets the same line as the pinned button row. */
.preview-modal > h3,
.mds-modal > h3 {
    position: relative;
    z-index: 1;
    padding-bottom: 0.5rem;
    background: var(--card-bg);
}
.preview-modal.is-scrolled-down > h3,
.mds-modal.is-scrolled-down > h3 {
    box-shadow: 0 1px 0 var(--modal-edge), 0 10px 12px -10px rgba(0, 0, 0, 0.6);
}

.preview-modal h3,
.mds-modal h3 {
    margin: 0; /* its 0.5rem gap below is padding now (see above) */
    font-size: 1.1rem;
}

.preview-actions,
.mds-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.preview-actions .btn,
.mds-modal-actions .btn {
    width: auto;
    flex: 1;
    /* Half the usual side padding, so two labels fit one line each in a phone's half-width buttons (F10, round 2). */
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* --- SHARED IN-APP CONFIRM DIALOG (showConfirm in js/shared/ui/confirm.js) --- */
/* Used by MDS, MLS and T-Score in place of window.confirm(). The backdrop and card chrome are
   the generalized .mds-modal-overlay/.mds-modal pair above (same rules the rankings preview
   modal uses), so only the message body and the button row are specific to this dialog. */
.mds-confirm-body p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
}

.mds-confirm-body p:last-child {
    margin-bottom: 0;
}

/* The preview modal's own content blocks each carry a bottom margin, so .preview-actions
   needs no top spacing of its own; the confirm dialog's body doesn't, so it adds one here. */
.mds-modal-actions {
    margin-top: 1.25rem;
}

/* --- SHARED IN-APP TEXT-INPUT DIALOG (showPrompt in js/shared/ui/prompt.js, improvements S2) --- */
/* The same .mds-modal-overlay/.mds-modal card as the confirm dialog, plus a labeled input and a
   message line under it: a validation error (red) or a warning that doesn't block saving (amber). */
.mds-prompt-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    /* 0.75rem below the title: the title's own 0.5rem plus this (they collapsed before the label moved into
       .mds-modal-body, improvements F10). */
    margin: 0.25rem 0 0.4rem 0;
}

.mds-prompt-msg {
    font-size: 0.8rem;
    line-height: 1.4;
    min-height: 1.1em;
    margin: 0.4rem 0 0 0;
    color: var(--text-muted);
}

.mds-prompt-msg.is-error { color: var(--error-text); }
.mds-prompt-msg.is-warning { color: var(--pos-te-border); }

.mds-prompt-modal .mds-modal-actions {
    margin-top: 0.75rem;
}

/* While content sits under the pinned row (watchModal adds the class): a line and a shadow above the buttons, on the
   card's colour so nothing shows between them. The band is padding taken back by a negative margin, so the buttons
   don't move when it comes and goes. --actions-gap is each row's usual margin-top. */
.preview-actions { --actions-gap: 0px; }
.mds-modal-actions { --actions-gap: 1.25rem; }
.mds-prompt-modal .mds-modal-actions { --actions-gap: 0.75rem; }
.preview-actions.is-scrolled-under,
.mds-modal-actions.is-scrolled-under {
    position: relative;
    margin-top: calc(var(--actions-gap) - 0.75rem - 1px);
    padding-top: 0.75rem;
    border-top: 1px solid var(--modal-edge);
    background: var(--card-bg);
    box-shadow: 0 -10px 12px -10px rgba(0, 0, 0, 0.6);
}

.hamburger-menu.open { 
    transform: translateX(0); 
    visibility: visible;
    transition: transform var(--motion-duration-medium4) var(--motion-emphasized-decelerate), visibility 0s linear 0s;
}

/* Header inside the drawer */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.menu-logo-section { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
    font-size: 1.1rem; 
    color: var(--text-muted);
}

.menu-logo-section span strong {
    color: var(--text-main);
}

.menu-logo-img {
    height: 28px;
    width: auto; /* Guarantees 1:1 square ratio */
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2); 
}

.close-menu-btn { 
    background: none; 
    border: none; 
    color: var(--text-muted); 
    cursor: pointer; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 6px;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

.close-menu-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Nav Links Container */
.menu-nav-links {
    padding: 1rem 0;
    flex-grow: 1; /* Pushes the footer to the bottom */
}

/* Navigation Buttons */
.hamburger-menu .nav-btn { 
    background: transparent; 
    border: none; 
    padding: 0.85rem 1.5rem; 
    text-align: left; 
    font-size: 1rem; 
    color: var(--text-muted); 
    font-weight: 500; 
    cursor: pointer; 
    width: 100%; 
    display: flex;
    align-items: center;
    gap: 0.85rem;
    
    /* We set a transparent border so adding color on hover doesn't shift text */
    border-left: 3px solid transparent; 
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast), border-color var(--motion-effects-fast-ms) var(--motion-effects-fast); 
}

/* SVG Icon styling inside buttons */
.hamburger-menu .nav-btn svg {
    opacity: 0.7;
    transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast);
}

.hamburger-menu .nav-btn:hover { 
    background: rgba(255, 255, 255, 0.03); 
    color: var(--text-main); 
}

.hamburger-menu .nav-btn:hover svg {
    opacity: 1;
}

.hamburger-menu .nav-btn.active, 
.hamburger-menu .nav-btn.active-link { 
    background: var(--target-bg); 
    color: var(--primary-green); 
    border-left-color: var(--primary-green); 
}

.hamburger-menu .nav-btn.active svg {
    opacity: 1;
}

/* External / Premium Link Styling */
.premium-link-btn {
    margin-top: 1rem;
    position: relative;
}

.premium-link-btn::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: var(--border);
    border-top: 1px dashed var(--text-muted);
    opacity: 0.2;
}

.hamburger-menu .premium-link-btn:hover {
    color: var(--primary-green);
}

.hamburger-menu .premium-link-btn:hover svg {
    transform: translateX(3px); /* Cute little arrow scoot on hover */
}

/* Footer & Ko-fi: our own "Support on Ko-fi" button (improvements K2), in place of Ko-fi's PNG badge from
   storage.ko-fi.com. Nothing loads from Ko-fi; the green, the cup (Feather's coffee) and the words are ours. */
.menu-footer {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
}

/* SUPPORT (K2): the Ko-fi button and "Share with your league" (drawer foot, Dashboard feet, the Guides' note). */
.btn.kofi-btn, .btn.share-btn {
    width: auto;
    min-height: 48px;
    padding: 0 1.25rem;
    border-radius: 8px;
    text-decoration: none;
}
.btn.share-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--modal-edge, #374151);
}
.kofi-note {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}
.support-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* --- LOGO & TITLE --- */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none; /* Prevents accidental highlighting */
}

.logo-img {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    object-fit: cover;
    /* Tinted glow instead of harsh border */
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2); 
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.logo-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.1;
}

.logo-text span {
    display: block;
    font-weight: 700;
    color: var(--text-main);
}

.header-controls { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
}

/* HEADER PICKER: Lineup Strategist's league and Draft Strategist's draft (improvements S16, owner's choice; shared and
   used by Draft Strategist since M2, owner: "consistent with Lineup Strategist"). The name is drawn by a label laid
   over the drop-down (#headerLeagueLabel / #draftProfileLabel, kept in step by syncHeaderLeagueLabel in
   js/mls/leagues/sync.js and refreshDraftDropdown in js/mds/state.js), so a long name ends in "…" instead of a cut
   letter; the drop-down itself is still what you tap, with its text made transparent. Desktop: the drop-down fits the
   longest name, up to 22rem. Phones: the logo button hides (the tab bar's Dashboard does the same) and the name takes
   all the room the menu button and the buttons beside it leave, at any width. T-Score has no picker, so keeps its logo. */
.header-picker { position: relative; display: block; flex: 0 1 auto; min-width: 0; max-width: 22rem; }
.header-picker > select.form-input { width: auto; max-width: 100%; color: transparent; }  /* beats select.form-input, later in this file */
.header-picker > select option { color: var(--text-main); background-color: var(--card-bg); }
.header-picker-label {
    position: absolute;
    top: 50%;
    left: 17px;   /* the drop-down's 1px border + 16px padding */
    right: 34px;  /* clear of the arrow (it sits in the drop-down's last 31px); the 7px of slack keeps a name the
                     drop-down was sized to fit from ending in "…" */
    transform: translateY(-50%);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    color: var(--text-main);
    pointer-events: none;
}
/* From 600 to 839px (F27) the picker sits beside the app's name, at most its usual 22rem, and narrows to fit when the
   window is narrow (at 600px the drop-down's own width, its longest league's name, made the page scroll sideways). */
@media (min-width: 600px) and (max-width: 839.98px) {
    .header:has(.header-picker) .header-controls { min-width: 0; }
    .header:has(.header-picker) .header-controls > .cluster { flex: 0 1 auto; min-width: 0; }
    .header-picker { flex: 0 1 22rem; }
    .header-picker > select.form-input { width: 100%; }
    /* The picker narrows, not the buttons beside it (Draft Strategist's Sync kept its word but lost its width). */
    .header-controls > .cluster > :not(.header-picker) { flex: none; }
}
/* Phones only (F27): from 600px the picker keeps its normal width beside the app's name. */
@media (max-width: 599.98px) {
    .header:has(.header-picker) .logo-container { display: none; }
    .header:has(.header-picker) .header-controls { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
    .header:has(.header-picker) .header-controls > .cluster { flex: 1 1 auto; min-width: 0; }
    .header-picker { flex: 1 1 auto; max-width: none; }
    .header-picker > select.form-input { width: 100%; }
}
/* --- BOTTOM TAB NAVIGATION --- */
.nav-bar { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    /* Glassmorphism to match the top header */
    /* The header's navy (improvements S26, owner's choice): the header, the bar and the rail read as one frame, with the
       cards the lighter layer. Was the card navy, rgba(19, 27, 44, 0.85). */
    background: rgba(10, 14, 23, 0.85); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    border-top: 1px solid var(--border); 
    display: flex; 
    justify-content: space-around; 
    
    /* CRITICAL: env() adds padding for the iPhone/Android home swipe bar. The 1px border, 3px and 60px items: Material
       3's 64dp bar (improvements S26). */
    padding: 3px 0.5rem env(safe-area-inset-bottom); 
    z-index: 98; 
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    transform: translateZ(0); /* Forces iOS hardware acceleration */
    will-change: transform;   /* Stops the jitter on scroll */ 
}

.nav-bar .nav-btn { 
    background: transparent; 
    border: none; 
    display: flex;
    flex-direction: column; /* Stacks the icon above the text */
    align-items: center;
    /* Material 3 (improvements S26): a 24dp icon (the markup's) in a 32dp-tall indicator, 4dp from it to a 12/16 label,
       6dp above and below. Our indicator is the green marker, not a pill, so that's 10px above the icon (padding plus
       the bar's), 8px to the label and 6px below it. */
    gap: 8px;
    font-size: 0.75rem; /* Smaller text for mobile tabs */
    line-height: 1.3334; /* 16px at 12px, and it grows with the text */
    color: var(--text-muted); 
    font-weight: 500; 
    /* Little padding at the sides: with five tabs a label like "Scoreboard" needs nearly the whole fifth of a phone,
       and Material 3 says not to wrap, cut or shrink labels (improvements S21). The whole fifth is still the tap area. */
    padding: 6px 2px; 
    white-space: nowrap;
    cursor: pointer; 
    flex: 1; 
    min-width: 0; /* equal widths whatever the labels (improvements S21: a bold label must not widen its tab, or the marker misses it) */
    border-radius: 8px;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast); 
    position: relative;
    z-index: 10;
}
.nav-btn * {
    pointer-events: none;
}

/* Tab Icon Animation */
.nav-bar .nav-btn svg {
    transition: transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast), filter var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

/* Hover & Active States */
.nav-bar .nav-btn:hover { color: var(--text-main); }
/* Hover and press: the shared state layer (STATE LAYERS, end of this file; improvements M2), not a tint and a 92% shrink. */

.nav-bar .nav-btn.active { 
    color: var(--primary-green); 
    font-weight: 700; /* Material 3: a bold label for the selected tab, medium for the rest (improvements S21) */
}
/* Material 3: a filled icon for the selected tab, or a heavier one where there's no filled version (our icons are
   strokes). Every tab keeps its label (improvements S21; round 6 tried showing only the active one, which M3 rules out). */
.nav-bar .nav-btn.active svg { stroke-width: 2.6; }

.nav-bar .nav-btn.active svg {
    /* No lift: Material 3 keeps the active icon in place (its heavier stroke and color mark it), and the 2px lift ate
       into the space above it (improvements S26). */
    filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
}

/* --- TAB CONTENT ANIMATIONS --- */
.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
    /* Upgraded bezier curve for a smoother fade-in */
    animation: fadeIn var(--motion-effects-slow-ms) var(--motion-effects-slow) forwards; 
}

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

/* --- SETUP TAB & HERO --- */
.setup-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}
.hero-logo {
    width: 100%;
    max-width: 500px;
    height: auto; /* Guarantees proportional scaling */
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
/* The Dashboard foot (both apps, K2): a line, then Support on Ko-fi and Share with your league. */
.hero-kofi {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.hero-kofi .kofi-note { font-size: 0.9rem; }
.hero-kofi .support-actions { justify-content: center; }

/* "About this project", the first thing in both Guides (K2). */
.about-project {
    border-left: 3px solid var(--primary-green);
    background: rgba(16, 185, 129, 0.06);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
}
.about-project h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--text-main);
}
.about-project p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    text-wrap: pretty;
}

/* The header's Ko-fi cup (K2): computers only, from 840px (where the menu is in the rail), at the header's right end.
   Muted until hovered so it doesn't compete with the picker; its tooltip is a ::before (::after is the touch target). */
.header-kofi { display: none; }
@media (min-width: 840px) {
    .header-kofi {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        margin-block: -8px;   /* a 48px target that doesn't make the header taller (T-Score's is the shortest) */
        flex: none;
        border-radius: 50%;
        color: var(--text-muted);
        transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
    }
    .header-kofi:hover, .header-kofi:focus-visible {
        color: var(--primary-green);
        background-color: color-mix(in srgb, var(--primary-green) 10%, transparent);
    }
    .header-kofi::before {
        content: attr(data-tip);
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        white-space: nowrap;
        padding: 0.35rem 0.6rem;
        border-radius: 6px;
        background: var(--card-bg);
        border: 1px solid var(--border);
        color: var(--text-main);
        font-size: 0.8rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), visibility var(--motion-effects-default-ms) linear;
    }
    .header-kofi:hover::before, .header-kofi:focus-visible::before { opacity: 1; visibility: visible; }
}
@media (prefers-reduced-motion: reduce) {
    .header-kofi, .header-kofi::before { transition: none; }
}

/* --- GUIDE BANNER --- */
/* .mt-2 belongs to the spacing-utility family (with mt-4/mb-1/mb-4) defined together
   further down -- removed the standalone duplicate that used to live here. */
.guide-banner {
    width: 100%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), rgba(19, 27, 44, 0.9));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color var(--motion-effects-fast-ms) var(--motion-effects-fast), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast);
    text-align: left;
}
.guide-banner:hover {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(19, 27, 44, 1));
    border-color: rgba(16, 185, 129, 0.6);
    transform: translateY(-2px);
}
.guide-arrow {
    color: var(--primary-green);
    transition: transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast);
}
.guide-banner:hover .guide-arrow {
    transform: translateX(4px);
}

/* --- CARDS & LAYOUT --- */
.settings-card { 
    background: var(--card-bg); 
    padding: 1.5rem; 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    margin-bottom: var(--space-4); /* was 1.25rem -- tightened per feedback that card-to-card spacing felt too loose */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
}
.highlight-card {
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.5), var(--card-bg));
}
.card-header {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.step-num {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.8rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}
.card-divider {
    border: 0; 
    border-top: 1px solid var(--border); 
    margin: 1.25rem 0;
}
.divider-text {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin: 1.25rem 0 0.5rem 0;
    position: relative;
}

/* --- FORMS & INPUTS --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}
.flex-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.form-input { 
    width: 100%; 
    padding: 0.75rem 1rem; 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    font-size: 0.95rem; 
    background: rgba(0,0,0,0.2); 
    color: var(--text-main); 
    transition: border-color var(--motion-effects-fast-ms) var(--motion-effects-fast), box-shadow var(--motion-effects-fast-ms) var(--motion-effects-fast);
    font-family: inherit;
}
/* Focus: the 2px green outline from FOCUS (end of this file) on the field's border (improvements M2). */
.form-input:focus { border-color: var(--primary-green); }
.text-center { text-align: center; }

/* Grid Layouts */
.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 0.75rem;
}
.roster-grid .input-group { margin-bottom: 0; }
.roster-grid label { font-size: 0.75rem; text-align: center; color: var(--text-muted); }
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* --- PREMIUM TOGGLE SWITCHES (Replaces checkboxes) --- */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface-inset); /* one shade lighter, no border (improvements M17) */
    border-radius: 8px;
    margin-bottom: 1rem;
    gap: 16px;
}
.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.toggle-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* Toggle titles that are (or contain) a <label for> toggle their switch when clicked, so show
   the hand cursor to say so. */
label.toggle-title,
.toggle-title > label { cursor: pointer; }
.toggle-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.toggle-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background var(--motion-effects-fast-ms) var(--motion-effects-fast);
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch:checked {
    background: var(--primary-green);
}
.toggle-switch:checked::after {
    transform: translateX(20px);
}

/* --- BUTTONS --- */
.btn { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none; 
    padding: 0.8rem 1.5rem; 
    border-radius: 6px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    cursor: pointer; 
    width: 100%; 
    transition: border-radius var(--press-morph);
    font-family: inherit;
}
/* Hover and press: the shared state layer and pressed corners (STATE LAYERS, end of this file; improvements M2), which
   replaced the 1px lift, the 98% press and the primary's brightness filter. */

.btn-primary { 
    background: var(--primary-green); 
    color: #0a0e17; 
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.btn-secondary { background: var(--border); color: var(--text-main); }

.btn-blue { background: var(--btn-blue-bg); color: #0a0e17; }
.btn-purple { background: var(--btn-purple-bg); color: #0a0e17; }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid #ef4444; }
/* Base small button styling with smooth spring transitions */
.btn-sm { 
    padding: 0.4rem 0.8rem; 
    border: none; 
    border-radius: 6px; 
    font-weight: 600; 
    font-size: 0.75rem; 
    cursor: pointer; 
    font-family: inherit;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast), border-color var(--motion-effects-fast-ms) var(--motion-effects-fast), box-shadow var(--motion-effects-fast-ms) var(--motion-effects-fast), opacity var(--motion-effects-default-ms) var(--motion-effects-default), border-radius var(--press-morph);
    letter-spacing: 0.3px;
}
/* .swap-btn / .lock-btn (MLS roster swap+lock controls) defined near their actual
   markup context further down -- removed the earlier duplicate that lived here. */

/* --- HAMBURGER BUTTON --- */
.hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

/* Hover and press: the shared state layer (STATE LAYERS, end of this file; improvements M2), not a tint and a shrink. */
.hamburger-btn:hover { color: var(--text-main); }

/* --- UTILITIES --- */
.flex-column { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-3); }
.mt-2 { margin-top: var(--space-2); }
 /* was referenced (trade-group-header, Save Manual SoS button) but never defined -- those margins were silently no-ops until now */
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

/* --- LAYOUT PRIMITIVES --- */
/* .stack: vertical rhythm for a run of same-kind items, replacing ad-hoc
   "display:flex; flex-direction:column; gap:0.5rem" inline styles. Pair with a size
   modifier for the gap (.stack-sm, further down) -- same size names as .cluster's sm/md,
   both keyed to the --space-* tokens, so a "sm" gap means the same thing whether the items
   stack or run horizontally. */
.stack { display: flex; flex-direction: column; }

/* Same rationale as .roster-grid .input-group above: a grid's own gap already handles
   spacing between cells, so an input-group inside a settings-grid shouldn't add its own
   bottom margin on top of it. */
.settings-grid .input-group { margin-bottom: 0; }

/* Smaller variant of .close-banner-btn for banners with less vertical room. Written with both
   classes so it beats the two later .close-banner-btn rules (MODERNIZED FILE UPLOAD BUTTON and
   FULL-WIDTH DRAFT BOARD); the 44px touch target and the ::after hit area still apply. */
.close-banner-btn.close-banner-btn-sm { font-size: 0.85rem; padding: var(--space-1); }
.app-version { text-align: center; color: var(--text-muted); font-size: 0.8rem; margin: 2rem 0; }

/* Call Out Dots */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.bg-target { background: var(--target-border); box-shadow: 0 0 8px var(--target-border); }
.bg-avoid { background: var(--avoid-border); box-shadow: 0 0 8px var(--avoid-border); }

/* Market-source attribution under Fetch Market Value (renamed from its LeagueLogs-era class in refactor 5D) */
.market-attribution { margin-top: 1rem; text-align: center; }
.market-attribution a {
    display: inline-flex; align-items: baseline; gap: 6px;
    font-family: Georgia, 'Times New Roman', serif; font-size: 14px;
    line-height: 1; color: currentColor; text-decoration: none;
}
.market-attribution span:first-child { color: var(--text-muted); }
.market-attribution em { font-weight: 600; letter-spacing: -0.01em; color: var(--text-main); font-style: normal; }
.dot-accent { width: 5px; height: 5px; border-radius: 50%; background: #ffe24c; display: inline-block; }

/* --- BADGES & POSITIONAL STYLING --- */
.badge { 
    background: #3a506b; padding: 2px 5px; border-radius: 4px; font-weight: bold; 
    font-size: 0.7rem; color: #f1f5f9; display: inline-block; white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Restrict fixed 32px width only to roster/lineup contexts */
.lineup-slot .pos-badge,
.roster-item .pos-badge,
.draft-cell .pos-badge {
    width: 32px;
    min-width: 32px !important;
    max-width: 32px;
    padding: 2px 0 !important;
    text-align: center !important;
    display: inline-block;
    box-sizing: border-box;
}

/* Position-specific colors remain untouched */
.pos-badge.QB { background-color: var(--pos-qb); color: #fca5a5; border: 1px solid var(--pos-qb-border); }
.pos-badge.RB { background-color: var(--pos-rb); color: #86efac; border: 1px solid var(--pos-rb-border); }
.pos-badge.WR { background-color: var(--pos-wr); color: #93c5fd; border: 1px solid var(--pos-wr-border); }
.pos-badge.TE { background-color: var(--pos-te); color: #fde047; border: 1px solid var(--pos-te-border); }
.pos-badge.K { background-color: var(--pos-k); color: #e2e8f0; border: 1px solid var(--pos-k-border); }
.pos-badge.DEF { background-color: var(--pos-def); color: #e9d8fd; border: 1px solid var(--pos-def-border); }
.badge-rookie { background: #281442; color: #e9d8fd; border: 1px solid #9f7aea; font-size: 0.65rem; margin-left: 4px; }
.early-badge { background: #fbbc04; color: #0b132b; font-weight: bold; border: 1px solid #f59e0b; padding: 1px 4px; font-size: 0.70rem; margin-left: 4px;}
.inj-badge { background: #ea4335; color: white; border: none; padding: 1px 4px; font-size: 0.65rem; font-weight: bold; margin-left: 4px; }
/* Shown only when a player's bye falls on the CURRENTLY active NFL week (see
   getByeBadgeHTML() in js/mls/lineup/gameInfo.js) -- distinct from inj-badge's solid red (hard-out) and
   early-badge's yellow (early kickoff) so all three read as different kinds of "heads up". */
.bye-badge { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid #f97316; padding: 1px 4px; font-size: 0.65rem; font-weight: bold; margin-left: 4px; }

/* Taxi squad. Deliberately borrows .badge-rookie's exact violet rather than introducing a
   seventh badge hue: taxi slots exist to stash rookies, so the two read as the same family of
   "roster status, informational" -- unlike inj/bye/early, nothing here needs acting on. The
   violet used by .slot-badge.slot-FLEX is a different, lighter shade, and the two can never
   collide on one row anyway (a taxi row's slot badge is always TX, never FLEX). */
/* .ir-slot-badge: the Sleeper IR-slot badge on Roster and Lineup rows (improvements S9), styled like TAXI. */
.taxi-badge, .ir-slot-badge { background: #281442; color: #e9d8fd; border: 1px solid #9f7aea; padding: 1px 4px; font-size: 0.65rem; font-weight: bold; margin-left: 4px; }

/* Kickoff-time badge (see getKickoffBadgeHTML() in js/mls/lineup/gameInfo.js) -- neutral/informational blue, since
   unlike bye/inj/early this isn't a warning, just a fact the person can use to verify FLEX
   kickoff ordering at a glance. */
.kickoff-badge { background: rgba(96, 165, 250, 0.15); color: #93c5fd; border: 1px solid #60a5fa; padding: 1px 4px; font-size: 0.65rem; font-weight: 600; margin-left: 4px; }

/* Lock-state text badges on Lineup starter rows (see lockBadge in renderLineupUI, js/mls/render/lineup.js).
   Colours match each padlock icon's tint -- green for a manual season-long lock, blue for an
   auto-lock at kickoff -- so badge and icon read as one signal, but the words carry the meaning
   on their own (the tint alone was the only difference before, and title= never shows on touch). */
.mls-lock-badge { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid var(--primary-green); padding: 1px 4px; font-size: 0.65rem; font-weight: bold; margin-left: 4px; }
.mls-autolock-badge { background: rgba(96, 165, 250, 0.15); color: #93c5fd; border: 1px solid #60a5fa; padding: 1px 4px; font-size: 0.65rem; font-weight: bold; margin-left: 4px; }

/* Dashboard Status Icons */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- TOOLTIPS (Refined for Dark Mode) --- */
.tooltip, .tooltip-container { position: relative; display: inline-flex; align-items: center; cursor: help; 
                             user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
                             }
.tooltip-icon { 
    background: rgba(255,255,255,0.1); color: var(--text-muted); border: 1px solid var(--border);
    border-radius: 50%; width: 18px; height: 18px; display: inline-flex; justify-content: center; 
    align-items: center; font-size: 11px; font-weight: bold; line-height: 1; font-family: monospace;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
    /* Always a lowercase "i": inside an uppercase label (the Trade Analyzer verdict's "BY YOUR RANKINGS") it used to
       inherit text-transform and read "I" (improvements S19, round 8). */
    text-transform: none; letter-spacing: normal;
}
.tooltip-container:hover .tooltip-icon { background: var(--border); color: var(--text-main); }
/* Closed, a tooltip is display: none, so it takes no room (improvements F16): visibility: hidden still laid it out under
   its trigger, and a long one hung below a short page (the pre-kickoff Scoreboard) as empty scroll. Opening sets
   display: block; @starting-style below gives the fade-in its start, and `display ... allow-discrete` keeps it shown
   while it fades out (browsers without these just show and hide it at once). Screen readers still get the text:
   aria-describedby reads a hidden element. */
.tooltip .tooltip-text, .tooltip-container .tooltip-text { 
    display: none; visibility: hidden; width: 260px; 
    /* Material 3's rich tooltip (improvements F16, round 2): an opaque surface (no see-through blur), 12px corners
       (shape "medium"), 12px top, 8px bottom and 16px side padding, and elevation level 2's shadow. */
    background: rgb(15, 23, 42);
    color: #f1f5f9; text-align: left; border-radius: 12px; padding: 12px 16px 8px; 
    position: absolute; z-index: 1001; top: calc(100% + 8px); right: -10px; 
    opacity: 0; transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast), visibility var(--motion-effects-default-ms) linear;
    transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast), visibility var(--motion-effects-default-ms) linear, display var(--motion-effects-default-ms) allow-discrete;
    /* Improvements M3: swap 0.2s ease for M3's motion tokens (an "effects" curve, no overshoot) in both transition lines,
       the @starting-style lines below, and css/tscore.css's header tooltip. Keep display ... allow-discrete. */
    font-size: 0.85rem; font-weight: 400; 
    border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15); 
    pointer-events: none; line-height: 1.5;
    transform: translateY(-4px);
    /* Kept inside the window (improvements S19, round 7): never wider than it, and slid sideways by --tt-dx, which
       js/shared/ui/tooltips.js (place) sets when a tooltip would cross an edge. */
    max-width: calc(100vw - 16px);
    translate: var(--tt-dx, 0px) 0;
    text-transform: none; letter-spacing: normal;
}
.tooltip:hover .tooltip-text, .tooltip-container:hover .tooltip-text { 
    display: block; visibility: visible; opacity: 1; transform: translateY(0);
    @starting-style { opacity: 0; transform: translateY(-4px); }
}

/* Keyboard: an icon with keyboard focus shows its tooltip (see initTooltips in
   js/shared/ui/tooltips.js), unless Escape/Enter dismissed it. cursor: pointer on the icon is also what
   makes iOS Safari deliver the tap to the document-level handler at all. */
.tooltip-icon { cursor: pointer; }
.tooltip-icon:focus-visible {
    background: var(--border);
    color: var(--text-main);
}
.tooltip-icon:focus-visible + .tooltip-text:not(.tt-dismissed) {
    display: block; visibility: visible; opacity: 1; transform: translateY(0);
    @starting-style { opacity: 0; transform: translateY(-4px); }
}
.tooltip-container:hover .tooltip-text.tt-dismissed:not(.mobile-visible) {
    display: none; visibility: hidden; opacity: 0;
}
/* Icon-less tooltips, where the badge/status icon/cell itself is the trigger (data-tt-self is
   set by initTooltips in js/shared/ui/tooltips.js): League Command Center status icons and badges, Power
   Rankings cells, the T-Score badge on Draft Tracker cards. */
.tooltip-container[data-tt-self]:focus-visible > .tooltip-text:not(.tt-dismissed) {
    display: block; visibility: visible; opacity: 1; transform: translateY(0);
    @starting-style { opacity: 0; transform: translateY(-4px); }
}

/* A long tooltip opens wider, and scrolls inside if it still runs past the window's bottom (js/shared/ui/tooltips.js,
   place; improvements S27 round 2). Set each time one is about to show, from its own length. */
.tooltip .tooltip-text.tt-wide, .tooltip-container .tooltip-text.tt-wide { width: 480px; }
/* On a phone a wide one fills the window, and M3's 16px sides cost the Scoreboard's 197-word tip its last line (it would
   scroll inside at 375px): keep 12px there until F19 shortens it (improvements F16, round 2). Improvements F19: once
   no tooltip needs this, delete this block (tooltips-onscreen.spec.mjs's "a long tooltip opens wider" checks the fit). */
@media (max-width: 480px) {
    .tooltip .tooltip-text.tt-wide, .tooltip-container .tooltip-text.tt-wide { padding-left: 12px; padding-right: 12px; }
}
.tooltip .tooltip-text.tt-scroll, .tooltip-container .tooltip-text.tt-scroll { max-height: var(--tt-maxh, 60vh); overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; }

/* Lingering after the mouse leaves (Material 3: a hovered tooltip stays 1.5s after the pointer leaves its trigger;
   improvements F16, round 2). js/shared/ui/tooltips.js adds tt-linger as a mouse pointer leaves a shown tooltip's
   trigger and takes it off after 1.5s, or at once when another tooltip opens, on any tap or click, or on Escape. */
.tooltip .tooltip-text.tt-linger, .tooltip-container .tooltip-text.tt-linger,
.table-header-tooltip .tooltip-text.tt-linger {
    display: block; visibility: visible; opacity: 1; transform: translateY(0);
}

/* Mobile tap-to-toggle class */
.tooltip-text.mobile-visible {
    display: block;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    @starting-style { opacity: 0 !important; transform: translateY(-4px) !important; }
}

/* --- MLS LINEUP & ROSTER TAB SPECIFIC STYLES --- */
.mls-pos-badge-sizing { min-width: 26px; padding: 2px 4px; text-align: center; }

/* --- Lineup Slots & Roster Rows --- */
/* List rows inside their card (improvements M17, Material 3: "don't force content into cards"): no box, border, side
   padding or gap of their own, a divider between rows. A row whose state carries meaning (locked, swapping) keeps a 3px
   coloured edge (css/mls.css). On hover a computer gets M2's state layer as a tone. */
.lineup-slot, .roster-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0.8rem 0; 
    transition: background-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
    gap: 1rem;
}
.lineup-slot + .lineup-slot, .roster-item + .roster-item { border-top: 1px solid var(--divider); }

@media (hover: hover) {
    .lineup-slot:hover, .roster-item:hover { background-color: rgba(255, 255, 255, 0.08); }
}

/* 1. Fix position badge width so it never shifts */
.roster-item .pos-badge { 
    width: 38px;
    min-width: 38px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.8rem;
}
/* 2. UNIVERSAL FIX: Force whatever player data is in the middle to left-align and fill space */
.roster-item > *:not(:first-child):not(:last-child),
.lineup-slot > *:not(:first-child):not(:last-child) {
    flex-grow: 1;
    text-align: left;
}

/* Responsive adjustments */
/* Responsive adjustments for optimal mobile density */
@media (max-width: 480px) {
    .lineup-slot, .roster-item { 
        padding: 0.5rem 0; 
        gap: 0.4rem; 
    }
    
    .roster-item .pos-badge { 
        width: 32px; 
        min-width: 32px; 
        font-size: 0.7rem; 
    }
    .badge { 
        padding: 2px 4px; 
        font-size: 0.65rem; 
    }
}

/* --- COLLAPSIBLE WAIVER UPGRADE SECTIONS (Scout tab, Auto-Find Upgrades) ---
   Reuses .rankings-card/.rankings-card-header/.rankings-card-body (see the Roster/Lineup
   tabs' upload cards) purely for the expand/collapse mechanics -- those classes don't require
   .settings-card, so they work fine nested inside the Waiver Wire Assistant card without
   double-applying its box styling. .mls-waiver-section supplies its own lighter box instead. */
/* Strength of Schedule (SoS) Grid Styles */
.sos-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
}

/* --- MLS SETUP TAB SPECIFIC STYLES --- */

.button-row-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Danger Zone Card Styling */
.danger-card {
    border: 1px dashed rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03), var(--card-bg));
}

.text-danger {
    color: #ef4444 !important;
}

/* --- COLLAPSIBLE RANKINGS CARDS (Roster/Lineup tabs) ---
   The toggle is <h3><button class="rankings-card-toggle">Title + chevron</button></h3>, with
   the freshness readout and tooltip as siblings OUTSIDE the button (a role="button" header
   used to swallow the heading and nest the tooltip control inside it). Two CSS tricks keep
   the old look and feel:
   1. The button's ::after stretches over the whole header, so clicking anywhere on it still
      toggles the card. The tooltip stays its own control without any z-index: it's positioned
      and comes after the button in the markup, so it already paints above that layer (and no
      z-index means its popup isn't trapped in a new stacking context).
   2. In the ROS/Weekly cards the chevron lives inside the button but is pinned to the header's
      right edge, where it used to sit after the tooltip. */
/* Accordion styling for Manual SoS */
/* A folded section inside a card: one shade lighter, no border (improvements M17). */
.sos-details-accordion {
    margin-top: 1.25rem;
    background: var(--surface-inset);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

/* The Settings page's last switch row sits at the card's foot without the row gap below it (S45). */
#settingsTab .settings-card > .toggle-row:last-child { margin-bottom: 0; }

/* The Danger Zone accordion (MLS Setup, Advanced Settings): its red stays as a 3px edge (improvements M17), on square
   left corners so it's a straight stripe rather than a bracket. It has to come after the rule above, or its background
   wins. */
.sos-details-accordion.danger-card {
    border: 0;
    background: var(--surface-inset);
    box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.6);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Toggle rows and folds that follow one another in a card are one lighter block with dividers, a list, rather than a
   stack of separate strips (improvements M17, round 3: Advanced Settings, Draft Strategist's Dashboard). */
.settings-card > :is(.toggle-row:not(.toggle-row-flush), .sos-details-accordion):has(+ :is(.toggle-row:not(.toggle-row-flush), .sos-details-accordion)) {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.settings-card > :is(.toggle-row:not(.toggle-row-flush), .sos-details-accordion) + :is(.toggle-row:not(.toggle-row-flush), .sos-details-accordion) {
    margin-top: 0;
    border-top: 1px solid var(--divider);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.sos-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #60a5fa;
    padding: 0.25rem 0;
    user-select: none;
}

.sos-summary:hover {
    color: var(--text-main);
}
/* --- MDS SPECIFIC STYLES (Tracker, Board, Limits) --- */

/* Tracker Controls */
.tracker-controls-card {
    padding: 1rem;
    margin-bottom: 1rem;
}

.flex-grow {
    flex-grow: 1;
}
/* --- TEAM TAB UTILITIES --- */

/* Horizontal scrolling for the table if on a very small mobile screen */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Scroll-shadow cue: a subtle inset shadow on the right edge, toggled by initScrollShadows()
   in js/shared/ui/scrollShadows.js rather than always-on, so it only appears while there's actually more content
   to scroll to and disappears once the user reaches the end. Shared by .table-responsive
   (Command Center) and .sos-table-wrapper (Strength of Schedule grid) -- deliberately NOT
   applied to the Positional Power Rankings heatmap, which uses overflow: visible on purpose
   so its tooltips aren't clipped; adding this class there would require overflow-x: auto
   and break that. */
.table-responsive.has-scroll-shadow,
.sos-table-wrapper.has-scroll-shadow {
    box-shadow: inset -14px 0 10px -10px rgba(0, 0, 0, 0.5);
}

/* Map text colors to the CSS variables defined in :root */
.pos-text-qb { color: var(--pos-qb-border) !important; }
.pos-text-rb { color: var(--pos-rb-border) !important; }
.pos-text-wr { color: var(--pos-wr-border) !important; }
.pos-text-te { color: var(--pos-te-border) !important; }
.pos-text-k { color: var(--pos-k-border) !important; }
.pos-text-def { color: var(--pos-def-border) !important; }

/* Subtitle styling for headers */
.header-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
    text-transform: none;
}
/* --- LIVE INDICATOR --- */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes btn-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.btn-pulse {
    animation: btn-pulse-anim 2s infinite;
}

@keyframes border-pulse-anim {
    0% { border-color: rgba(16, 185, 129, 0.8); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
    50% { border-color: rgba(16, 185, 129, 0.3); box-shadow: 0 0 2px rgba(16, 185, 129, 0.1); }
    100% { border-color: rgba(16, 185, 129, 0.8); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
}

.pulse-border {
    animation: border-pulse-anim 2.5s infinite;
    /* No border-radius: the pulsing element keeps its own corners (a .settings-card's 12px). */
}

@keyframes nav-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0); }
    50% { box-shadow: 0 0 12px 2px rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.15); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); background: rgba(16, 185, 129, 0); }
}

.nav-pulse {
    animation: nav-pulse-anim 2s infinite;
    border-radius: 8px;
}

/* Reduced motion: stop the pulses but keep a static highlight, so the
   "this is next" cue survives without the animation. (.pulse-dot's part is in css/mds.css.) */
@media (prefers-reduced-motion: reduce) {
    .btn-pulse,
    .pulse-border,
    .nav-pulse {
        animation: none;
    }
    .btn-pulse {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    }
    .pulse-border {
        border-color: rgba(16, 185, 129, 0.8);
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    }
    .nav-pulse {
        background: rgba(16, 185, 129, 0.15);
    }
    .tab-content.active {
        animation: none;
    }
}
/* --- READING WIDTH (improvements M18) ---
   Material 3 bounds line length on wide windows: running text stops at about 70 characters a line instead of stretching
   across a 1,100px card (the Guides' paragraphs reached 143). Only prose: the Guides (a centred column, below), the
   setup steps' explanations and T-Score's Research, notes and the About text. Narrower windows never reach the cap. */
:root { --reading-width: 70ch; }
/* The Guides (both apps) are one card of prose: the card itself is a centred reading column (F27), so its boxes and
   paragraphs share one width. Capping only the paragraphs (M18) left a third of the wide card empty beside them. */
#guideTab > .settings-card { max-width: calc(var(--reading-width) + 3rem); margin-left: auto; margin-right: auto; }
.setup-step-how,
#researchTab :where(p, li),
.tscore-article-note,
.tscore-support p,
.tscore-privacy { max-width: var(--reading-width); }
/* Sync Loading Spinner */
@keyframes spin {
    100% { transform: rotate(360deg); }
}
.sync-spinner {
    animation: spin 1s linear infinite; /* a turn at a constant speed: linear is the curve (tests/unit/motionTokens.test.mjs) */
}
/* Reduce Motion (improvements M18): the spinner stops turning and fades softly instead, so a wait still shows. */
@keyframes spin-reduced { to { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
    .sync-spinner { animation: spin-reduced 1s var(--motion-emphasized) infinite alternate; }
}
/* --- INFO & GUIDE TAB --- */
.guide-content {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-top: 1rem;
}

.guide-step {
    position: relative;
}

.step-title {
    color: var(--text-main);
    font-size: 1.05rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Custom step color for the guide */
.blue-step {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.step-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 0 2.2rem; /* Indents the text to align perfectly past the circle number */
    text-wrap: pretty;
}

.guide-list {
    margin: 0.75rem 0 0 2.2rem;
    padding-left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.guide-list li {
    margin-bottom: 0.75rem;
}

/* A list inside a guide item (the Scoreboard's parts): indented under it, tighter. */
.guide-list ul {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
}

.guide-list ul li {
    margin-bottom: 0.35rem;
}

.text-main {
    color: var(--text-main);
    font-weight: 600;
}
/* --- DARK MODE SELECT DROPDOWNS --- */
select.form-input, 
select {
    background-color: rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Custom sleek dropdown arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: border-color var(--motion-effects-fast-ms) var(--motion-effects-fast), box-shadow var(--motion-effects-fast-ms) var(--motion-effects-fast);
    width: 100%;
}

select.form-input:focus,
select:focus { border-color: var(--primary-green); }

/* Forces dropdown option lists to respect dark theme where supported */
select option {
    background-color: var(--card-bg);
    color: var(--text-main);
    padding: 0.75rem;
}
optgroup {
    background-color: var(--bg-color);
    color: var(--primary-green, #4ade80);
    font-weight: 600;
    font-style: normal;
    padding: 4px 8px;
}
/* --- MODERNIZED FILE UPLOAD BUTTON --- */
input[type="file"]::file-selector-button {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.75rem;
    transition: background var(--motion-effects-fast-ms) var(--motion-effects-fast), border-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* WebKit / Safari compatibility prefix */
input[type="file"]::-webkit-file-upload-button {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.75rem;
    transition: background var(--motion-effects-fast-ms) var(--motion-effects-fast), border-color var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

input[type="file"]::-webkit-file-upload-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}
.close-banner-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast);
}

.close-banner-btn:hover {
    color: var(--text-main);
}
/* Reclaim horizontal space for player cards on mobile. Phones only (F27): from 600px the page keeps 24px margins,
   Material 3's for a medium window, and cards their own padding. */
@media (max-width: 599.98px) {
    .container {
        /* Reduces the outer screen edge gap from 1.5rem to 0.5rem */
        padding: 1.25rem 0.5rem; 
    }

    .settings-card {
        /* Reduces the inner card gap from 1.5rem to 0.75rem */
        padding: 1rem 0.75rem; 
    }
}

/* --- ACCESSIBILITY & MICRO-INTERACTIONS --- */
/* .btn-bare: shared reset for controls that used to be role="button" <div>s (logo, banners,
   queue/lock-countdown/rankings-card toggles) and are now real <button>/<a> elements. It only
   strips the browser's button/link chrome so they look exactly as before. Wrapped in :where()
   so it has zero specificity: every existing class rule (.queue-header's padding, the banners'
   inline styles, etc.) still wins over the reset regardless of source order. */
:where(.btn-bare) {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

/* --- TOAST NOTIFICATIONS (Material 3's snackbar; improvements M18) ---
   Centred at the bottom, over the page and clear of the rail; above the tab bar where there is one. Under dialogs and
   sheets (2000), so a dialog is never covered (a toast that arrives while one is open waits for it to close:
   js/shared/ui/toast.js). Motion as material-web's labs/gb snackbar: it grows up out of its bottom edge in 150 ms
   (legacy decelerate) and leaves with a 75 ms fade at full size (legacy accelerate); it used to slide up with a large
   overshoot. The navy card with the green (red for errors) edge is the site's own, not Material's inverse surface. */
.mds-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: calc(50% + var(--rail-inset, 0px) / 2);
  translate: -50% 0;
  width: max-content;
  background-color: var(--card-bg, #131b2c); 
  color: var(--text-main, #f3f4f6);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-green, #10b981);
  transform-origin: center bottom;
  scale: 1 0;
  opacity: 0;
  /* visibility (and the collapsed scale) flip only after the fade-out finishes, so a hidden toast's ✕ drops out of
     the tab order without cutting the exit short, and the fade happens at full size */
  visibility: hidden;
  transition: opacity var(--motion-snackbar-exit-ms) var(--motion-legacy-accelerate), scale 0s linear var(--motion-snackbar-exit-ms), visibility 0s linear var(--motion-snackbar-exit-ms);
  z-index: 1900;
  pointer-events: none;
  max-width: min(672px, calc(100vw - 32px - var(--rail-inset, 0px)));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.mds-toast.show {
  scale: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--motion-snackbar-enter-ms) var(--motion-legacy-decelerate), scale var(--motion-snackbar-enter-ms) var(--motion-legacy-decelerate), visibility 0s;
}

/* Pointer events, only while shown and only where needed. A success toast stays click-through
   except for its ✕: it lands over the lower lineup rows, and quick lock/swap taps must reach
   the buttons underneath. Error toasts take the whole box, so a long message can be hovered or
   tapped to hold it open (see getToastElement in js/shared/ui/toast.js). Nothing hidden takes taps -- an
   invisible toast parked over the bottom nav must not swallow them. */
.mds-toast.show.toast-error,
.mds-toast.show .toast-dismiss-btn,
.mds-toast.show .toast-action-btn {
  pointer-events: auto;
}

/* A toast's optional action (showToast's options.action, improvements S35): a text button in the accent colour, between
   the message and the ✕. */
.mds-toast .toast-action-btn {
  background: none;
  border: none;
  color: var(--primary-green, #10b981);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}
.mds-toast .toast-action-btn[hidden] { display: none; }

.mds-toast.toast-error {
  border-color: var(--error-color);
}

.mds-toast .toast-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  /* ~32px tap target for phones; the negative margins keep it from growing the toast */
  padding: 8px;
  margin: -8px -12px -8px auto;
  flex-shrink: 0;
}

.mds-toast .toast-dismiss-btn:hover {
  color: var(--text-main);
}

@media (max-width: 839.98px) {
  /* Clears .nav-bar, which pads itself by the same env() inset for the home indicator.
     (env() is 0 until the viewport meta adds viewport-fit=cover; this keeps them in step.) */
  .has-nav-bar .mds-toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* --- CHEVRONS (improvements F11) ---
   Every fold's chevron, in all three pages: <svg class="chevron"> as a direct child of its toggle, which is a
   <summary> or a button with aria-expanded. It turns on Material 3 Expressive's fast spatial spring (a small thing
   that moves; improvements M18, was S16's --vt-ms), and not at all with Reduce Motion. Two resting pairs, so no
   fold's look changed: .chevron points right when closed and down when open (the Dashboard's); .chevron-flip
   points down when closed and up when open (the rankings cards, Draft Strategist's player cards). A <summary> with one
   gets .chevron-summary in place of the browser's marker. Folds that redraw their toggle on every click turn the new
   chevron from the old one's angle with turnChevronAcrossRedraw (js/shared/ui/chevron.js). */
.chevron { transform: rotate(-90deg); transition: transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast); }
:is(details[open] > summary, [aria-expanded="true"]) > .chevron { transform: none; }
.chevron.chevron-flip { transform: none; }
:is(details[open] > summary, [aria-expanded="true"]) > .chevron.chevron-flip { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    .chevron { transition: none; }
}
.chevron-summary { list-style: none; display: flex; align-items: center; gap: 0.4rem; }
.chevron-summary::-webkit-details-marker { display: none; }
.chevron-summary > .chevron { flex-shrink: 0; }

/* --- PLAYER CARD GRID LAYOUT --- */
.actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* --- MOBILE COLLAPSIBLE CARDS CONDITIONAL LAYOUT --- */
.tooltip-container, 
.tooltip-icon, 
.tooltip-text {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* --- FULL-WIDTH DRAFT BOARD FOR DESKTOP --- */
/* Accessibility: Ensure Minimum Mobile Touch Targets (44x44px) */
.close-banner-btn,
.close-menu-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* Optional: If a small icon visual size needs to be preserved, expand hit area via pseudo-element */
.close-banner-btn {
    padding: 0.5rem;
    position: relative;
}

/* Its 48px hit area: TOUCH TARGETS, end of this file (improvements M2). */
/* Remove default browser underlines from link buttons */
a.nav-btn,
.nav-btn {
    text-decoration: none;
}
/* --- Drag-and-drop file upload (see enableFileDrop in js/shared/ui/fileDrop.js) --- */
/* The card (or MLS position box) under a dragged file. An outline rather than a border so
   nothing shifts; the tint makes the whole target read as one drop area. */
.mds-drop-active {
    outline: 2px dashed var(--primary-green);
    outline-offset: -4px;
    background-color: rgba(16, 185, 129, 0.06);
}
/* "Or drop a file here" hint under the upload inputs. Hidden on touch-only devices, where
   there's nothing to drag from. */
.mds-drop-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
}
@media (hover: none) {
    .mds-drop-hint { display: none; }
}

/* --- MODAL OVERLAY CHROME (shared) + RANKINGS UPLOAD PREVIEW MODAL (both apps since 8C) --- */
.preview-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
}

.preview-list {
    list-style: none;
    margin: 0 0 1rem 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.preview-list li {
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.preview-list li:last-child {
    border-bottom: none;
}

.preview-rank {
    color: var(--primary-green);
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 2.2rem;
}

.preview-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    margin: 0 0 1rem 0;
}

/* Destination line directly above the preview modal's buttons. Neutral by default (new set);
   the .is-replace variant matches .btn-danger, since that case overwrites existing data. */
.preview-target {
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    margin: 0 0 1rem 0;
}

.preview-target.is-replace {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

/* --- UTILITIES --- */
.mt-1 { margin-top: var(--space-1); }
.mt-3 { margin-top: var(--space-3); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.ml-3 { margin-left: var(--space-3); }
.mr-2 { margin-right: var(--space-2); }
.pt-3 { padding-top: var(--space-3); }
.pl-2 { padding-left: var(--space-2); }

/* --- LAYOUT PRIMITIVES --- */
.stack-sm { gap: var(--space-2); }

/* .cluster: a horizontal run of items, replacing ad-hoc "display:flex; align-items:center;
   gap:...rem" inline styles used for icon+label rows, button rows, and similar. Every inline
   style this replaced had no flex-wrap set (i.e. nowrap), including rows with a <select> or
   a margin-left:auto push-to-edge element that only render correctly unwrapped -- so nowrap
   is the default here too, matching what was actually there before. For a row of purely
   reflowable content (e.g. icon + long text) where wrapping is actually desired on narrow
   screens, add flex-wrap: wrap to that row. */
.cluster { display: flex; align-items: center; }
.cluster-sm { gap: var(--space-2); }
.cluster-md { gap: var(--space-3); }

/* Small text-level helper for the many "font-size: 0.75rem; color: var(--text-muted)"
   inline captions/hints scattered through the markup. */
.text-helper { font-size: 0.75rem; color: var(--text-muted); }

/* Padding for a <details> body, replacing the repeated inline style="padding-top: 1rem;"
   used on every accordion's content wrapper. */
.accordion-body { padding-top: var(--space-4); }

/* Modifier for a .card-header that sits directly above a list of accordions/sub-sections
   rather than a card's main content -- no divider needed underneath it. */
.card-header-flush { border-bottom: none; padding-bottom: 0; }

/* The "or" separator row used between two alternative inputs (e.g. upload a file / auto-fetch
   instead). Was three inline-styled divs repeated wherever this pattern appears. */
.or-divider { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0; }
.or-divider .divider-line { flex: 1; height: 1px; background: var(--border); }
.or-divider span { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

/* Groups related settings (e.g. Trade Analyzer's Waiver Adjustment) into their own visually
   distinct sub-section, set off from the primary inputs above it with a border/background,
   rather than letting a toggle+input run directly into a card's main content. */
.settings-subsection {
    margin-top: var(--space-5);
    padding: var(--space-4);
    background: var(--surface-inset); /* one shade lighter, no border (improvements M17) */
    border-radius: 8px;
}
.settings-subsection .toggle-row { padding: 0; border: none; background: none; margin-bottom: var(--space-3); }
.settings-subsection .input-group:last-child { margin-bottom: 0; }

/* A .toggle-row that needs to sit flush inside another container (a settings-grid cell,
   paired with a dropdown) instead of looking like its own bordered card -- was three
   identical inline overrides (padding/border/background stripped, font-size shrunk). */
.toggle-row-flush { padding: 0; border: none; background: none; }
.toggle-row-flush .toggle-title { font-size: 0.85rem; }
/* Bottom-aligns a grid cell's content with its sibling (e.g. a toggle lining up with an
   adjacent dropdown's baseline). */
.input-group-end { display: flex; flex-direction: column; justify-content: flex-end; }

/* A .mls-btn-sm styled to read as a plain inline text link rather than a button. */
.btn-link-inline { background: none; padding: 0; color: var(--primary-green); }

/* --- MLS LINEUP & ROSTER TAB SPECIFIC STYLES --- */
.weekly-success-feedback {
    color: #60a5fa;
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
    text-align: center;
    margin-top: 0.75rem;
}

/* --- MATCHUP SIMULATOR (MONTE CARLO) RESULTS --- */
.info-banner {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.info-banner-icon {
    background: #3b82f6;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: serif;
    flex-shrink: 0;
    margin-top: 2px;
}

/* --- MLS SETUP TAB SPECIFIC STYLES --- */
/* Keyboard hint -- only on devices with a real pointer (desktop), where Enter-to-add applies */
.mls-manual-key-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
}
.mls-manual-key-hint kbd {
    font-family: inherit;
    font-size: 0.7rem;
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}
@media (hover: none) {
    .mls-manual-key-hint { display: none; }
}

/* --- MLS ROSTER TAB SPECIFIC STYLES --- */
.freshness-ok {
    color: var(--text-muted);
    font-weight: 500;
}

.freshness-stale {
    color: #f59e0b;
    font-weight: 700;
}

/* A sync that actually failed, as opposed to data that's merely aged (.freshness-stale, amber).
   Red so it doesn't read as the same "getting old" signal -- this roster is known to be behind,
   not just unrefreshed. Same red as .status-danger. */
.sync-failed {
    color: #ef4444;
    font-weight: 700;
}

/* --- COLLAPSIBLE RANKINGS CARDS (Roster/Lineup tabs) ---
   The toggle is <h3><button class="rankings-card-toggle">Title + chevron</button></h3>, with
   the freshness readout and tooltip as siblings OUTSIDE the button (a role="button" header
   used to swallow the heading and nest the tooltip control inside it). Two CSS tricks keep
   the old look and feel:
   1. The button's ::after stretches over the whole header, so clicking anywhere on it still
      toggles the card. The tooltip stays its own control without any z-index: it's positioned
      and comes after the button in the markup, so it already paints above that layer (and no
      z-index means its popup isn't trapped in a new stacking context).
   2. In the ROS/Weekly cards the chevron lives inside the button but is pinned to the header's
      right edge, where it used to sit after the tooltip. */
.success-feedback {
    color: var(--primary-green);
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
    text-align: center;
    margin-top: 0.75rem;
}

/* Rankings upload in-progress indicator -- shown between file selection and the preview
   modal appearing (or an error toast), so a slow .xlsx parse never looks like nothing
   happened. Empty/hidden by default; setProcessingStatus() in js/shared/ui/statusFeedback.js fills and toggles it
   (refactor 8B renamed it from .mls-upload-processing; Draft Strategist uses it too). */
.upload-processing {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

/* --- LIVE INDICATOR --- */
/* Setup progress checklist (Dashboard) -- the text version of the pulse prompts */
.setup-checklist {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: var(--space-4);
}
.setup-checklist-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}
.setup-checklist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.setup-checklist-list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.setup-checklist-list li.is-done {
    color: var(--text-main);
}
.setup-step-mark {
    width: 1em;
    flex-shrink: 0;
    text-align: center;
    font-weight: 700;
}
.setup-checklist-list li.is-done .setup-step-mark {
    color: var(--primary-green);
}
.setup-step-body {
    min-width: 0;
}
.setup-checklist-list li.is-actionable .setup-step-label {
    color: var(--text-main);
    font-weight: 600;
}
.setup-step-how {
    margin: 0.15rem 0 0.25rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}
/* The jump link is `mls-btn-sm btn-link-inline setup-step-go` on Lineup Strategist and
   `btn-sm btn-link-inline setup-step-go` on Draft Strategist (8A). The padding is .mls-btn-sm's,
   which already wins over .btn-link-inline's 0 on MLS; stating it here gives MDS the same link. */
.setup-checklist .setup-step-go {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
}

/* --- TABLE HEADER TOOLTIP FIXES --- */
/* Player-name autocomplete dropdown */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: #111827;
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.autocomplete-item:hover, .autocomplete-item.highlighted {
    background: rgba(16, 185, 129, 0.12);
}
.autocomplete-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.75rem;
    white-space: nowrap;
}

/* --- ALL-LEAGUES PLAYER SEARCH (Scout tab, Scan Pasted List -> "All My Leagues") ---
   One card per player, with a per-league ownership row beneath the header. Markup comes from
   runAllLeaguesSearch in js/mls/scout/allLeaguesSearch.js. The card is deliberately its own box rather than a
   .scout-result-card: those are single-line summaries, while each of these carries a variable
   number of league rows and needs a header/body split to stay readable at five-plus leagues. */
/* Unmatched-name warning inside the rankings upload preview modal (see openRankingsPreview). */
.preview-unmatched { background: rgba(252, 165, 165, 0.08); border: 1px solid var(--avoid-border); border-radius: 6px; padding: 0.7rem 0.8rem; margin-top: 0.75rem; margin-bottom: 1rem; text-align: left; }
.preview-unmatched-title { color: #fca5a5; font-weight: 700; font-size: 0.82rem; margin-bottom: 0.3rem; }
.preview-unmatched-list { font-size: 0.82rem; color: var(--text-main); line-height: 1.45; }
.preview-unmatched-hint { font-size: 0.75rem; color: var(--text-muted); line-height: 1.45; margin: 0.4rem 0 0; }
.preview-derived { background: rgba(147, 197, 253, 0.08); border: 1px solid var(--dart-border, rgba(147, 197, 253, 0.35)); border-radius: 6px; padding: 0.7rem 0.8rem; margin-top: 0.75rem; margin-bottom: 1rem; text-align: left; }
/* "Why?" under the derived-ranks note (Lineup Strategist, improvements F10 round 2): the long explanation, folded. */
.preview-derived-more { margin-top: 0.3rem; font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }
.preview-derived-more > summary { cursor: pointer; color: #93c5fd; font-weight: 600; width: fit-content; }
.preview-derived-detail { margin: 0.3rem 0 0; }
.preview-derived-title { color: #93c5fd; font-weight: 700; font-size: 0.82rem; margin-bottom: 0.3rem; }
.preview-derived-body { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin: 0; }

/* --- POSITION FILTER BUTTONS (both apps) ---
   Draft Strategist's Tracker filters (js/mds/tracker.js) and Lineup Strategist's Waiver Wire Assistant
   position chips (lineup/index.html). Moved here from css/mds.css in improvements S1; kept at the end
   of base.css so .pos-filter still beats the shared .badge rule it overrides. Each button also carries
   .badge plus .pos-badge.<POS> for its color, or .badge-all for ALL, or .flex-blend for FLEX (end of this file). */
.pos-filter { 
    cursor: pointer; 
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    transition: color var(--motion-effects-fast-ms) var(--motion-effects-fast), background-color var(--motion-effects-fast-ms) var(--motion-effects-fast), border-color var(--motion-effects-fast-ms) var(--motion-effects-fast), box-shadow var(--motion-effects-fast-ms) var(--motion-effects-fast), transform var(--motion-spatial-fast-ms) var(--motion-spatial-fast), opacity var(--motion-effects-default-ms) var(--motion-effects-default), filter var(--motion-effects-fast-ms) var(--motion-effects-fast); 
    font-size: 0.85rem;
    font-weight: 600;
    width: auto;
    min-width: 0;
    max-width: none;
    
    /* Visually mute non-selected filters */
    opacity: 0.35;
    filter: grayscale(85%);
}

.pos-filter:hover { 
    color: var(--text-main);
    /* No lift or tint (improvements M2): the shared state layer shows the hover. Slightly illuminate when hovering over an inactive filter */
    opacity: 0.7;
    filter: grayscale(40%);
}

.pos-filter.active-filter { 
    /* Snaps the filter back to full vibrancy, inheriting its native positional color */
    opacity: 1;
    filter: grayscale(0%);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08); 
}

/* Specific rule for ALL button so it turns green when active, since it lacks a positional color */
.pos-filter.badge-all.active-filter {
    color: var(--primary-green);
    background: var(--target-bg);
    border-color: var(--primary-green); 
}

/* Position filters used to be <div>s and are now <button>s: strip the browser's button font and
   chrome so they look exactly as before. */
button.pos-filter {
  font-family: inherit;
  line-height: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.pos-filter:focus-visible { opacity: 1; }

/* --- FLEX-TYPE BADGES (both apps) ---
   A badge or button for a slot that takes several positions: a border blended from those positions'
   colors (the --*-blend variables in :root). Last in the file so it beats .pos-filter's background
   and border, including on hover. Draft Strategist's Team tab colors its plain-text slot labels with
   the same variables (.roster-label.flex-blend-text > .roster-label-text etc. in css/mds.css). */
.flex-blend, .sflex-blend, .wt-blend { color: #e2e8f0; border: 1px solid transparent; }
.flex-blend, .pos-filter.flex-blend:hover { background: var(--blend-fill) padding-box, var(--flex-blend) border-box; }
.sflex-blend, .pos-filter.sflex-blend:hover { background: var(--blend-fill) padding-box, var(--sflex-blend) border-box; }
.wt-blend, .pos-filter.wt-blend:hover { background: var(--blend-fill) padding-box, var(--wt-blend) border-box; }

/* --- BADGE LEGEND (improvements S10) ---
   "What the badges mean", the Guide tab's legend in both apps (js/mls/legend.js, js/mds/legend.js), and the
   "What do these mean?" links that open it. Each line is a sample drawn with the app's own badge markup and
   classes, then a sentence. Samples aren't interactive (pointer-events: none), and their badges drop the
   left margin they carry beside a name, since the gap spaces them here. On phones a line stacks: samples,
   then the sentence. */
.badge-legend { scroll-margin-top: 5rem; }
.badge-legend-body { margin: 0.75rem 0 0 2.2rem; }
.badge-legend-group + .badge-legend-group { margin-top: 1.25rem; }
.badge-legend-group-title { margin: 0 0 0.25rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-main); }
.badge-legend-list { margin: 0; }
.badge-legend-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 0.4rem 1rem; align-items: start; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.badge-legend-row:first-child { border-top: 0; }
.badge-legend-sample { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; pointer-events: none; }
.badge-legend-sample .badge { margin-left: 0; }
.badge-legend-sample .lineup-needs-box, .badge-legend-sample .bye-warning-banner, .badge-legend-sample .tier-divider { margin: 0; }
.badge-legend-text { margin: 0; min-width: 0; font-size: 0.85rem; line-height: 1.55; color: var(--text-muted); overflow-wrap: anywhere; }
@media (max-width: 599.98px) {
    .badge-legend-body { margin-left: 0; }
    .badge-legend-row { grid-template-columns: minmax(0, 1fr); }
}
.badge-legend-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--primary-green); white-space: nowrap; cursor: pointer; }
.badge-legend-link:hover { text-decoration: underline; }
/* On phones the link reads "Badges", so the card titles beside it keep their line. */
.badge-legend-link-short { display: none; }
@media (max-width: 480px) {
    .badge-legend-link-long { display: none; }
    .badge-legend-link-short { display: inline; }
}
/* A link on a line of its own: above Draft Strategist's Tracker chips (no card header there) and Lineup Strategist's
   Roster position counts (its header is full on a phone with a long league name). */
.badge-legend-link-row { display: flex; justify-content: flex-end; margin: -0.25rem 0 0.5rem; }

/* --- THE SHEET (improvements M11; js/shared/ui/sheet.js) ---
   One modal sheet for both apps, from round 2 of the Material 3 review: a bottom sheet on phones (half height,
   drag handle, swipe down or tap the scrim to close, scrolling inside), a side sheet from the right from 840px (the
   rail's window size). It slides with Material 3's emphasized curves, the menu's: decelerate in (400ms), accelerate
   out (200ms). Reduce Motion: no slide, no fade. The badge legend opens in it; S32 reuses it. */
.sheet-host { position: fixed; inset: 0; z-index: 2000; }
.sheet-scrim {
    position: absolute; inset: 0;
    background: rgba(10, 14, 23, 0.7);
    opacity: 0;
    transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default);
    touch-action: none;
}
.sheet-host.is-open .sheet-scrim { opacity: 1; transition-duration: var(--motion-duration-medium4); }
.sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 50vh; height: 50dvh;
    display: flex; flex-direction: column;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--modal-edge);
    border-bottom: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform var(--motion-duration-short4) var(--motion-emphasized-accelerate), height var(--motion-duration-medium2) var(--motion-emphasized);
}
.sheet-host.is-open .sheet { transform: none; transition: transform var(--motion-duration-medium4) var(--motion-emphasized-decelerate), height var(--motion-duration-medium2) var(--motion-emphasized); }
.sheet.is-expanded { height: calc(100vh - 48px); height: calc(100dvh - max(48px, env(safe-area-inset-top))); }
.sheet.is-dragging, .sheet-host.is-open .sheet.is-dragging { transition: none; }
.sheet-grip { display: flex; justify-content: center; touch-action: none; cursor: grab; }
/* Material 3's drag handle: 32 x 4px, in a 48px target. */
.sheet-handle { width: 48px; height: 36px; padding: 0; border: 0; background: none; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.sheet-handle span { width: 32px; height: 4px; border-radius: 2px; background: var(--text-muted); opacity: 0.6; }
.sheet-header { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.5rem 0.5rem 1.25rem; touch-action: none; }
.sheet-title { flex: 1; margin: 0; font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.sheet-title:focus { outline: none; }
.sheet-close { flex: none; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; }
.sheet-close:hover { color: var(--text-main); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 1.25rem 1rem; }
.sheet-footer { flex: none; border-top: 1px solid var(--border); padding: 0.25rem 1.25rem; }
.sheet-footer-link { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 48px; font-size: 0.9rem; font-weight: 600; color: var(--primary-green); cursor: pointer; }
.sheet-footer-link:hover { text-decoration: underline; }
.sheet .badge-legend-body { margin: 0; }
.sheet .badge-legend-row { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 840px) {
    .sheet {
        left: auto; top: 0;
        width: min(400px, calc(100vw - 56px)); height: auto;
        border: 0; border-left: 1px solid var(--modal-edge);
        border-radius: 16px 0 0 16px;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) 0;
        transform: translateX(100%);
    }
    /* A sheet opened expanded (S30) is full height here too, like every side sheet. */
    .sheet.is-expanded { height: auto; }
    .sheet-grip { display: none; }
    .sheet-header { padding: 1rem 0.75rem 0.75rem 1.5rem; touch-action: auto; }
    .sheet-body { padding: 0 1.5rem 1rem; }
    .sheet-footer { padding: 0.25rem 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .sheet, .sheet-host.is-open .sheet, .sheet-scrim, .sheet-host.is-open .sheet-scrim { transition: none; }
}

/* --- VIEW TRANSITIONS (improvements S16) ---
   js/shared/ui/viewTransition.js runs tab switches, your own league switches, and the League Command Center's
   folds and reorders through document.startViewTransition, and marks <html> while one runs: data-vt="tab" |
   "league" | "cards", data-vt-dir="forward" | "back" (tabs, by the tab bar's order). The header and the tab bar
   get names only then, so they stay put while the page between them moves, and nothing changes outside a
   transition. Owner's choices: tabs slide on phones and fade ("soft + rise") wider; 275 ms on phones; wider, 500 ms
   for tab and league fades and 375 ms for the Dashboard cards.
   Reduce Motion: the helper never starts one, and none of this applies. */
:root {
    /* On the motion tokens since improvements M18 (they were 275 ms on phones, 375 ms wider, and 500 ms for the wider
       fades, all on cubic-bezier(0.2, 0, 0, 1)). What moves (the phone slide, the Dashboard's cards) uses Material 3
       Expressive's default spatial spring, in 300 ms (F27, below); the fades ("soft + rise", tab and league) are effects, the slow one, 300 ms
       at every width (a fade has no overshoot, and Material keeps effects at 300 ms or less). */
    /* 300 ms, not the spring's own 500 (improvements F27): while a view transition runs the browser sends taps to the
       page behind it, so a tap right after a Dashboard card folded or moved did nothing for half a second, though the
       move looked done at 200 ms. The same spring shape, played in Material's 300 ms (medium2). (Tab and league
       switches use --vt-fade-ms below, 300 ms already.) */
    --vt-ms: var(--motion-duration-medium2);
    --vt-ease: var(--motion-spatial-default);
    --vt-fade-ms: var(--motion-effects-slow-ms);
    --vt-fade-ease: var(--motion-effects-slow);
    --vt-shift: 48px;
}
@media (prefers-reduced-motion: no-preference) {
    html[data-vt] .header { view-transition-name: vt-header; }
    html[data-vt] .nav-bar { view-transition-name: vt-nav; }
    /* The league's name changes on its own, a short slide up, while the page fades. */
    html[data-vt="league"] #headerLeagueLabel { view-transition-name: vt-league-name; }

    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation-duration: var(--vt-ms);
        animation-timing-function: var(--vt-ease);
    }

    /* "Soft + rise" (owner's choice after two reviews as a user): the old screen fades out over the first 60%, the new
       one fades in from 25% while rising 8px, over the page's own navy (round 6: the owner preferred it to the card
       navy), at --vt-fade-ms (500 ms on wider screens). A plain crossfade showed both screens at once (the same layout's text ghosting on a
       league switch); a full fade-through dipped to near-black, which read as a flash. For a league switch, and for
       tabs where they don't slide (wider screens, below). */
    html[data-vt="league"]::view-transition,
    html[data-vt="tab"]::view-transition { background: var(--bg-color); }
    html[data-vt="league"]::view-transition-group(*),
    html[data-vt="league"]::view-transition-old(*),
    html[data-vt="league"]::view-transition-new(*),
    html[data-vt="tab"]::view-transition-group(*),
    html[data-vt="tab"]::view-transition-old(*),
    html[data-vt="tab"]::view-transition-new(*) { animation-duration: var(--vt-fade-ms); animation-timing-function: var(--vt-fade-ease); }
    html[data-vt="league"]::view-transition-old(root),
    html[data-vt="tab"]::view-transition-old(root) { animation-name: vt-fade-out; }
    html[data-vt="league"]::view-transition-new(root),
    html[data-vt="tab"]::view-transition-new(root) { animation-name: vt-fade-in-rise; }

    html[data-vt="league"]::view-transition-old(vt-league-name) { animation-name: vt-out-up; }
    html[data-vt="league"]::view-transition-new(vt-league-name) { animation-name: vt-in-up; }
    /* The name is small and moves: the fast spatial spring. */
    html[data-vt="league"]::view-transition-group(vt-league-name),
    html[data-vt="league"]::view-transition-old(vt-league-name),
    html[data-vt="league"]::view-transition-new(vt-league-name) {
        animation-duration: var(--motion-spatial-fast-ms);
        animation-timing-function: var(--motion-spatial-fast);
    }

    /* League Command Center cards (js/mls/render/leagueCards.js names each one while a "cards" transition runs):
       a card that folds or unfolds changes height in place, and the cards below or around it move to their new
       places. Each card's pictures keep their size and are clipped to the card's box as it grows or shrinks,
       instead of being stretched. */
    ::view-transition-group(.vt-card) { overflow: clip; }
    ::view-transition-old(.vt-card),
    ::view-transition-new(.vt-card) {
        width: 100%;
        height: auto;
        object-fit: none;
        object-position: top;
    }

    /* The tab bar's marker slides to the active tab: along the bar, or up and down the rail (improvements S26). Material's
       navigation bar and rail move their indicator in 200 ms, emphasized (material-web labs/gb; M18, was 500 ms wider). */
    .nav-marker { --marker-motion: var(--motion-duration-short4) var(--motion-emphasized); transition: left var(--marker-motion), width var(--marker-motion), top var(--marker-motion), height var(--marker-motion); }
}
/* Phones: the old tab leaves and the new one arrives in the direction of travel (a swipe left, or a tab further
   right, moves forward). Wider screens fade (above). */
@media (prefers-reduced-motion: no-preference) and (max-width: 839.98px) {
    html[data-vt="tab"][data-vt-dir="forward"]::view-transition-old(root) { animation-name: vt-out-left; }
    html[data-vt="tab"][data-vt-dir="forward"]::view-transition-new(root) { animation-name: vt-in-right; }
    html[data-vt="tab"][data-vt-dir="back"]::view-transition-old(root) { animation-name: vt-out-right; }
    html[data-vt="tab"][data-vt-dir="back"]::view-transition-new(root) { animation-name: vt-in-left; }
}
/* Browsers with View Transitions animate the switch itself, so the tab's own fade-in (fadeIn above) is cut to 1 ms
   there: inside a transition it would play twice. Not `none` or 0s: the tab must end exactly as the finished fade-in
   leaves it, or corners and text render a few pixels differently (the screenshots caught it). Browsers without View
   Transitions keep the 0.3s fade-in. */
@supports (view-transition-name: none) {
    .tab-content.active { animation-duration: 1ms; }
}
@keyframes vt-out-left { to { transform: translateX(calc(-1 * var(--vt-shift))); opacity: 0; } }
@keyframes vt-in-right { from { transform: translateX(var(--vt-shift)); opacity: 0; } }
@keyframes vt-out-right { to { transform: translateX(var(--vt-shift)); opacity: 0; } }
@keyframes vt-in-left { from { transform: translateX(calc(-1 * var(--vt-shift))); opacity: 0; } }
@keyframes vt-fade-out { 0% { opacity: 1; } 60%, 100% { opacity: 0; } }
@keyframes vt-fade-in-rise { 0%, 25% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes vt-out-up { to { transform: translateY(-40%); opacity: 0; } }
@keyframes vt-in-up { from { transform: translateY(40%); opacity: 0; } }

/* The tab bar's marker (js/shared/ui/viewTransition.js, placeTabMarker): a short green bar along the top of the
   active tab. */
.nav-marker { position: absolute; top: 0; left: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary-green); pointer-events: none; }

/* Toasts grow up from their bottom edge (above); with Reduce Motion they only fade. */
@media (prefers-reduced-motion: reduce) {
    .mds-toast, .mds-toast.show { scale: 1; transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), visibility 0s linear var(--motion-effects-default-ms); }
    .mds-toast.show { transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), visibility 0s; }
}

/* --- NAVIGATION RAIL AND TABLET BAR (improvements S26, Material 3's window sizes) ---
   One set of tab buttons, laid out three ways by CSS alone, so showTab, swipes, number keys, the drawer and the
   screen-reader announcement don't know which one shows:
   - phones (under 600px): the bottom bar as before, icon over label;
   - tablets (600-839px): the bottom bar with each icon beside its label, the tabs centred;
   - computers (840px and up): a 96px navigation rail at the left edge, the menu button at its top. The menu button
     opens the drawer, restyled as the expanded rail (280px, over the page with a dimmed backdrop: M3's "modal"
     configuration); the header's own menu button hides. The marker slides up and down beside the active tab
     (placeTabMarker measures whichever way the bar runs). */
/* --rail-inset: how far the rail pushes the page in (0 without it), for anything sized from the window's width
   (set on body.has-nav-bar below). */
:root { --rail-w: 96px; --rail-inset: 0px; }
.nav-rail-menu,
.menu-section-label,
.close-menu-btn .icon-collapse,
.nav-bar .nav-rail-settings { display: none; }

@media (min-width: 600px) and (max-width: 839.98px) {
    .nav-bar { justify-content: center; gap: 4px; padding-left: 16px; padding-right: 16px; }
    /* Equal widths (the marker and the bold label, as on phones), sized for "Scoreboard" in bold beside its icon. */
    .nav-bar .nav-btn { flex: 0 1 8.5rem; flex-direction: row; justify-content: center; gap: 4px; padding: 18px 4px; } /* M3: 4dp from icon to label; the 64dp bar */
}

@media (min-width: 840px) {
    /* Only the two apps have the bar (body.has-nav-bar); T-Score shares this stylesheet and keeps its own layout. */
    body.has-nav-bar { --rail-inset: var(--rail-w); padding-left: var(--rail-w); padding-bottom: 0; }
    .has-nav-bar .header .hamburger-btn { display: none; }

    .nav-bar {
        top: 0;
        right: auto;
        width: var(--rail-w);
        flex-direction: column;
        justify-content: flex-start;
        gap: 4px; /* Material 3: 4dp between items */
        padding: 12px 0 calc(1rem + env(safe-area-inset-bottom));
        border-top: 0;
        border-right: 1px solid var(--border);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    /* Settings at the rail's foot (S45); on phones and tablets it's in the menu. */
    .nav-bar .nav-rail-settings { display: flex; margin-top: auto; }
    .nav-rail-menu { display: flex; align-self: center; flex: 0 0 auto; width: 48px; height: 48px; margin-bottom: 28px; }
    /* Material 3's collapsed rail: 64dp items 4dp apart (6dp, the 32dp indicator round the 24dp icon, 4dp, the 16dp
       label, 6dp), from 88px down. */
    .nav-bar .nav-btn { flex: 0 0 auto; padding: 10px 4px 6px; border-radius: 0; white-space: normal; }
    /* Material 3: the whole label stays visible at up to 2x text size; it may break onto two lines ("Dash-board")
       rather than be cut. At normal size every label fits on one line. */
    .nav-bar .nav-btn span { max-width: 100%; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
    /* Beside the active tab, at the rail's left edge (top and height set by placeTabMarker). */
    .nav-marker { width: 3px; height: 0; border-radius: 0 3px 3px 0; }

    /* The expanded rail: the drawer, opened from the rail's menu button, with its collapse button in the same spot.
       It grows out of the collapsed rail (Material 3: the two transform into each other): its right edge moves out from
       the rail's while what's in it stays put, its icons are 36px in like the rail's, and its 56px rows (Material 3's)
       start where the rail's 68px-apart items are and close up as it opens (--rail-row below), so nothing jumps. Done with two opposite transforms (the panel from 184px left,
       its contents from 184px right, same timing, so they cancel), which the browser animates on the GPU; animating
       clip-path redrew the panel on the main thread every frame and stuttered. Material 3's motion: 400ms emphasized
       decelerate to open, 200ms emphasized accelerate to close. */
    .has-nav-bar .hamburger-menu,
    .has-nav-bar .hamburger-menu > * {
        transition: transform var(--motion-duration-short4) var(--motion-emphasized-accelerate), visibility 0s linear var(--motion-duration-short4);
    }
    .has-nav-bar .hamburger-menu { transform: translateX(calc(var(--rail-w) - 100%)); }
    .has-nav-bar .hamburger-menu > * { transform: translateX(calc(280px - var(--rail-w))); }
    .has-nav-bar .hamburger-menu.open,
    .has-nav-bar .hamburger-menu.open > * {
        transform: none;
        transition: transform var(--motion-duration-medium4) var(--motion-emphasized-decelerate), visibility 0s linear 0s;
    }
    .has-nav-bar .hamburger-menu .menu-nav-links { padding-top: 14px; } /* the first icon at 102px, as on the rail */
    .has-nav-bar .hamburger-menu .menu-nav-links > * {
        transform: translateY(calc(var(--rail-row, 4) * 12px)); /* 68px - 56px per row above it */
        /* Only on the way out (owner): closing, the rows stay put while the panel slides away, and move back to the
           rail's spacing once it's hidden, ready for the next opening. */
        transition: transform 0s linear var(--motion-duration-short4);
    }
    .has-nav-bar .hamburger-menu.open .menu-nav-links > * {
        transform: none;
        transition: transform var(--motion-duration-medium4) var(--motion-emphasized-decelerate);
    }
    .has-nav-bar .menu-nav-links > :nth-child(1) { --rail-row: 0; }
    .has-nav-bar .menu-nav-links > :nth-child(2) { --rail-row: 1; }
    .has-nav-bar .menu-nav-links > :nth-child(3) { --rail-row: 2; }
    .has-nav-bar .menu-nav-links > :nth-child(4) { --rail-row: 3; }
    .has-nav-bar .hamburger-menu .nav-btn { padding-left: 33px; } /* + the 3px edge: icons 36px in, as on the rail */
    .has-nav-bar .hamburger-menu .menu-header { justify-content: flex-start; padding: 12px 24px; border-bottom: 0; }
    .has-nav-bar .hamburger-menu .menu-logo-section { display: none; }
    .has-nav-bar .close-menu-btn { width: 48px; height: 48px; }
    .has-nav-bar .close-menu-btn .icon-close { display: none; }
    .has-nav-bar .close-menu-btn .icon-collapse { display: block; }
    .menu-section-label {
        display: block;
        margin: 0.75rem 0 0;
        padding: 12px 1.5rem 8px; /* Material 3's section header: 12 above, 8 below */
        border-top: 1px solid var(--border);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    .menu-section-label + .nav-btn { margin-top: 0; }

    /* Fixed elements stay clear of the rail: dialogs centre on the page (toasts too, through --rail-inset). */
    .has-nav-bar .preview-overlay,
    .has-nav-bar .mds-modal-overlay { padding-left: calc(1.5rem + var(--rail-w)); }
}

/* The menu's rows (the expanded rail on computers, the drawer on phones and tablets): Material 3's 56dp rows, 24dp icons
   (the markup's) and a 14px label (improvements S26). Lineup and Draft Strategist only; T-Score's menu is its own. */
.has-nav-bar .hamburger-menu .nav-btn { min-height: 56px; padding-top: 0; padding-bottom: 0; font-size: 0.875rem; }
/* The menu's backdrop fades in and out with the menu (setBackdrop, js/shared/ui/navMenu.js) instead of dimming and
   blurring the whole page in one frame (improvements S26). */
.has-nav-bar .menu-overlay { opacity: 0; pointer-events: none; transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default); }
.has-nav-bar .menu-overlay.open { opacity: 1; pointer-events: auto; transition-duration: var(--motion-duration-medium4); }
@starting-style { .has-nav-bar .menu-overlay.open { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .has-nav-bar .hamburger-menu,
    .has-nav-bar .hamburger-menu.open,
    .has-nav-bar .hamburger-menu > *,
    .has-nav-bar .hamburger-menu.open > *,
    .has-nav-bar .hamburger-menu .menu-nav-links > *,
    .has-nav-bar .hamburger-menu.open .menu-nav-links > *,
    .has-nav-bar .menu-overlay,
    .has-nav-bar .menu-overlay.open { transition: none; }
}

/* "Don't count this device" / "Count this device again" at the end of each Visitor Counts line (improvements A1;
   js/shared/analytics.js swaps the text). The site's green, like the Guide's badge-legend link. */
a[data-nocount-link] { color: var(--primary-green); font-weight: 600; white-space: nowrap; text-underline-offset: 2px; }

/* --- FOCUS, TOUCH TARGETS AND STATE LAYERS (improvements M2, Material 3) ---
   Every page (both apps and T-Score) loads this file, so these rules hold site-wide. Per-component rules that only
   repeated them are gone; what's left differs for a reason (an inset ring where a parent clips it). */

/* FOCUS: one ring for every control a keyboard reaches: Material 3's focus indicator, 3px green with a 2px gap
   (material-web's md.sys.state.focus-indicator: 3px thick, 2px outside, 3px inside where a parent clips it;
   improvements M18, was 2px). Text fields and selects: a 2px green outline on the field's own border instead
   (Material 3's focused text field, 2dp). */
:focus-visible { outline: 3px solid var(--primary-green); outline-offset: 2px; }
:is(input:not([type=checkbox], [type=radio], [type=range], [type=button], [type=submit]), select, textarea):focus-visible {
    outline-width: 2px;
    outline-offset: -1px;
}

/* TOUCH TARGETS: Material 3's 48dp target. Each control gets an invisible ::after, centred on it, that grows it to 48px
   in any direction where it's smaller (the pattern .close-banner-btn already used); a control 48px or bigger gets none.
   :where() keeps both at zero specificity, so a component's own position or ::after wins. Not for .rankings-card-toggle,
   whose ::after already stretches over its whole card header and whose chevron is placed against that header. Inputs and selects can't have an
   ::after; the toggle switches use ::before instead (their ::after is the handle). Left out: the Lineup row's swap and
   lock (side by side on wider screens, where nothing measures them; on phones the lock is the photo and the swap has its
   own area, css/mls.css PHONE ROWS, improvements S32), and tooltip containers that are position: static
   on purpose (their popup is placed against the card or table, and so would the area be). tests/touch-targets.spec.mjs
   measures every tab at 375px and fails when an area covers a neighbour. */
:where(button, a[href], summary, [role=button], [role=tab]):where(:not(.rankings-card-toggle, .skip-link, .swap-btn, .lock-btn, .mls-lc-status > .tooltip-container, .mls-power-table td .tooltip-container)) { position: relative; }
:where(button, a[href], summary, [role=button], [role=tab]):where(:not(.rankings-card-toggle, .skip-link, .swap-btn, .lock-btn, .mls-lc-status > .tooltip-container, .mls-power-table td .tooltip-container))::after,
.toggle-switch::before {
    content: '';
    position: absolute;
    top: min(0px, (100% - 48px) / 2);
    bottom: min(0px, (100% - 48px) / 2);
    left: min(0px, (100% - 48px) / 2);
    right: min(0px, (100% - 48px) / 2);
}
/* Links inside a sentence (directly in a paragraph or a list item) keep their text's size: WCAG 2.5.8's inline
   exception, as tests/touch-targets.spec.mjs treats them. On a phone's wrapped lines one link's area would cover the
   link on the line above (T-Score's "The Data": improvements F20). A link standing alone (Ko-fi, "Powered by
   FantasyCalc", "Read Methodology") isn't directly in a <p> or <li> and keeps its area; the spec still checks those.
   Zero specificity, like the rule above, so a component's own ::after still wins. The ::after stays, at the link's own
   size: without it Chromium anti-aliased the ")" right after a link differently (T-Score's Research screenshots). */
:where(p, li) > :where(a[href])::after { inset: 0; }
/* Where neighbours sit closer than 48px, they split the gap (LOG M2). A close button grows away from what it closes (a
   banner's link or text sits to its left). The phone header's menu button sits right before the league arrow
   (Lineup) or 8px before the logo (T-Score). */
.close-banner-btn::after { left: 0; right: min(0px, 100% - 48px); }
.header #prevLeagueBtn::after { left: 0; right: -4px; }   /* touches the menu button; 8px before the league menu */
.header .logo-container::after { left: -4px; }            /* 8px after the menu button */
/* The menu button sits 8px from the top-left corner; its area stops 4px short of it, so the corner (where the
   screenshots park the mouse, tests/visual.spec.mjs) hovers nothing. */
.header .hamburger-btn::after { top: -4px; }
/* Draft Strategist's Tracker card: the queue star and the colour dot sit 2px apart, so the star grows left and the dot
   right. */
.player-card [data-action="toggleQueue"]::after { left: min(0px, 100% - 47px); right: -1px; }
.player-card [data-action="cycleAffinity"]::after { left: -1px; right: min(0px, 100% - 47px); }
/* A card header's "i" 12px after the Badges link (half the gap each), and the Scoreboard's Refresh right after its "i"
   (Refresh doesn't grow toward it). */
.header-actions-inline .badge-legend-link ~ .tooltip-container .tooltip-icon::after { left: -6px; }
.mls-week-refresh::after { left: 0; }
/* Lists whose rows sit 2 to 4px apart (Who to root for): each row keeps its own half of the gap. */
.mls-root-player::after { top: -1px; bottom: -1px; }
/* A dynasty league's Roster row: the In-Season | Dyn badge sits 3px above the gap chip ("Long-term > now"). */
.mls-rank-dual-tip::after { bottom: -1px; }
.mls-gap-chip::after { top: -1px; }
/* Best available's View sits 6px under the "N dismissed · Restore" line on phones; Fetch Market Value 16px above
   "Powered by FantasyCalc"; the Scoreboard's fold toggles close above one another (found on CI's fonts, where they're
   2px shorter than in a cloud session). */
.mls-ba-actions .mls-btn-sm::after { top: -3px; }
.market-attribution a::after { top: -12px; bottom: -16px; }
.mls-week-fold-toggle::after { top: -4px; bottom: -4px; }
/* "This lineup needs you" (a full-width title) sits right above its first fix button. */
.lineup-needs-box .mls-btn-sm::after { top: 0; }
/* Live Sync and Auto-Sync are drawn at 85% (an inline transform in index.html): an area reaching past them changed how
   Chromium drew the scaled switch (a blurrier handle). They keep their own size; their label beside them toggles them. */
#trackerSyncToggle::before, #boardSyncToggle::before { inset: 0; }
/* The Lineup tab's live matchup strip grows down into its own margin, not up: reaching above it changed how Chromium
   rasterised the rest of the tab (a few anti-aliased pixels in the screenshots). */
.mls-matchup-strip::after { top: 0; bottom: min(0px, 100% - 48px); }

/* TAP HIGHLIGHT (improvements F23): no browser flash on a tap, on any page. Chrome on Android lays its own translucent
   box over whatever was tapped; the press tint below is the app's answer instead. Inherited, so this one line covers
   every element (before F23 only the tab bar had it). */
:root { -webkit-tap-highlight-color: transparent; }

/* STATE LAYERS: hover, focus and press answer the same way on every button (Material 3's states): the content's own
   colour laid over the control, 8% on hover (only where there's a pointer that hovers), 10% while pressed. Timing as
   material-web's ripple (improvements M18; was 150 ms both): the hover tint comes in 15 ms, the press tint in 100 ms,
   both linear. (The ripple also lets a press fade out over 375 ms; with one layer for both, the release takes the
   hover's 15 ms.) Nothing moves or shrinks any more. Disabled controls get none. The owner also picked Expressive's pressed shape
   morph: the site's 6px buttons tighten to 4px while pressed (--press-morph, :root), never with Reduce Motion. */
:where(button, [role=button], a.btn, a.btn-sm):where(:not(.premium-link-btn, .rankings-card-toggle))::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: transparent;
    pointer-events: none;
    transition: background-color var(--motion-state-hover-ms) linear;
}
/* A colour, not opacity: an always-present opacity: 0 layer over the text changed how CI's Chromium anti-aliased every
   button's label (a few hundred pixels per screenshot), though it drew nothing. */
@media (hover: hover) {
    :where(button, [role=button], a.btn, a.btn-sm):where(:not(:disabled, [aria-disabled=true])):hover::before { background-color: color-mix(in srgb, currentColor 8%, transparent); }
}
:where(button, [role=button], a.btn, a.btn-sm):where(:not(:disabled, [aria-disabled=true])):active::before { background-color: color-mix(in srgb, currentColor 10%, transparent); transition-duration: var(--motion-duration-short2); }
/* What opens something without being a button answers a press the same way (improvements F23, owner's choice): folds
   (<summary>), the cross-app banner links and the menu's links to the other pages, the ROS/Weekly rankings card headers
   (and Auto-Find's sections, the same toggle; their ::after already covers the header, so it carries the tint) and the
   menu's link to the other app (its ::before is the dashed divider, so the link itself takes the tint). Press only:
   their hover stays as M2 left it. Links inside a sentence get nothing. */
:where(summary, .guide-banner > a, a.nav-btn:not(.premium-link-btn))::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: transparent;
    pointer-events: none;
    transition: background-color var(--motion-state-hover-ms) linear;
}
:where(summary, .guide-banner > a, a.nav-btn:not(.premium-link-btn)):active::before,
:where(.rankings-card-toggle):active::after,
.premium-link-btn:active { background-color: color-mix(in srgb, currentColor 10%, transparent); transition-duration: var(--motion-duration-short2); }
:where(.rankings-card-toggle)::after { transition: background-color var(--motion-state-hover-ms) linear; }
/* A fold in a lighter block (.sos-details-accordion) tints its whole row, the block's padding included, like a list
   row; open, only the header row. */
.sos-details-accordion > summary::before { inset: -0.75rem -1rem; border-radius: 8px; }
.sos-details-accordion[open] > summary::before { bottom: 0; border-radius: 8px 8px 0 0; }
/* :is(), not :where(): the corners must beat each button's own border-radius. */
:is(.btn, .btn-sm, .mds-btn-sm, .mls-btn-sm, .btn-header):active:not(:disabled) { border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
    :where(button, [role=button], a.btn, a.btn-sm, summary, .guide-banner > a, a.nav-btn)::before,
    :where(.rankings-card-toggle)::after { transition: none; }
    :is(.btn, .btn-sm, .mds-btn-sm, .mls-btn-sm, .btn-header) { transition-property: none; }
}

/* --- ALERT CARD (improvements N2, js/shared/ui/notify.js showPageAlert) ---
   An alert stays on the page until dismissed: bottom right on computers, above the tab bar on phones (the toasts'
   places). Over the content and the bar, under sheets and dialogs (2000) and toasts. Amber, like the "needs you" box. */
.notify-card {
    position: fixed;
    right: 24px;
    bottom: 80px;
    z-index: 1500;
    width: min(400px, calc(100vw - 32px));
    max-height: min(60vh, 420px);
    overflow-y: auto;
    /* The ✕'s 48px tap area (the shared ::after, TOUCH TARGETS) reaches past the right edge, which gave the card a
       needless horizontal scrollbar (owner's report on Windows, N2 round 7). */
    overflow-x: hidden;
    padding: 14px 16px;
    background: var(--card-bg, #131b2c);
    color: var(--text-main, #f3f4f6);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    line-height: 1.4;
}
.notify-card-head { display: flex; align-items: flex-start; gap: 8px; color: #f59e0b; }
.notify-card-head > svg { flex: none; margin-top: 2px; }
.notify-card-title { flex: 1; margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text-main, #f3f4f6); }
.notify-card-close {
    flex: none; margin: -6px -8px 0 0; padding: 4px 8px; border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font-size: 1rem; line-height: 1;
}
.notify-card-group { margin: 10px 0 0; font-size: 0.85rem; font-weight: 600; color: var(--text-main, #f3f4f6); }
.notify-card-lines { margin: 4px 0 0; padding-left: 1.1rem; display: grid; gap: 4px; color: var(--text-muted); }
.notify-card-body > .notify-card-lines:first-child { margin-top: 8px; }
.notify-card-actions { margin-top: 12px; display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.notify-card-link { color: var(--text-muted); font-size: 0.85rem; text-decoration: underline; cursor: pointer; }
@media (max-width: 839.98px) {
    .notify-card { left: 8px; right: 8px; width: auto; bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (min-width: 840px) {
    .has-nav-bar .notify-card { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* --- ROOM ON PHONES (improvements M17; U1 round 2's R2, docs/improvements/organization.md section 7) ---
   Material 3's compact window: under 600px both apps run each section to the screen's edges with 16px margins ("lists
   should extend edge-to-edge in compact windows"), instead of a card in an 8px page padding with its own boxes inside.
   .container loses its side padding; a card loses its side borders, corners and shadow and keeps 16px of padding;
   sections are split by an 8px band of the page colour (owner's choice, over a divider). Setup Progress is a section
   too. What isn't (banners, the tier chips, the matchup strip) keeps 16px margins and its frame. Draft Strategist's player cards
   become list rows (css/mds.css), and the Draft Board's grid still runs to the screen's edges (css/mds.css). From 600px
   up the cards keep their frame, with flat rows inside (the rules above). T-Score (no nav bar) keeps its page padding;
   its folds follow the rules above like everything else. The image exports lay their clone out at a computer's width, so they never get
   this (EXPORT_WINDOW, js/shared/ui/exportImage.js). */
@media (max-width: 599.98px) {
    .has-nav-bar .container { padding-left: 0; padding-right: 0; }
    .has-nav-bar .settings-card {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding-left: 16px;
        padding-right: 16px;
        margin-bottom: 8px;
    }
    .has-nav-bar .container > :not(.tab-content):not(.settings-card):not(.setup-checklist):not(.sr-only),
    .has-nav-bar .container > .tab-content > :not(.settings-card):not(.setup-checklist):not(.sr-only):not(.player-pool-container):not(.draft-board-container):not(:has(> .settings-card)) {
        margin-left: 16px;
        margin-right: 16px;
        width: calc(100% - 32px);
    }
    /* A wrapper that holds cards (Draft Strategist's Team tab: the part Export Team captures) runs to the edges like
       them, with the same 8px band between its cards (round 3). */
    .has-nav-bar .container > .tab-content > :has(> .settings-card) { gap: 8px; }
    /* Setup Progress is content you work through, so it's a section like the cards (owner, round 4). The banners and the
       matchup strip stay framed boxes at 16px margins on purpose: they come and go, and the frame says so (Material 3
       has no banner component; a message that stays until acted on is a card in the content). */
    .has-nav-bar .setup-checklist {
        border: 0;
        border-radius: 0;
        padding-left: 16px;
        padding-right: 16px;
        margin-bottom: 8px;
    }
}
/* The "this is next" glow on a setup card (.pulse-border) survives the flat card: with Reduce Motion it's a static
   box-shadow, which the rule above would remove (round 3; mds-setup.spec.mjs). */
@media (max-width: 599.98px) and (prefers-reduced-motion: reduce) {
    .has-nav-bar .settings-card.pulse-border { box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
}
