/* T-Score page (/t-score/) styles. Loaded after css/base.css.
   Refactor 4B: the first two sections are the T-Score-only rules 4A left in base.css, moved
   unchanged and kept ahead of the rest, as they were; everything from "T-Score Specific Styles"
   on is the page's former inline <style>, moved unchanged apart from its indentation. */

/* --- DENSE DATA TABLE STICKY SCROLLING (SCOPED) --- */
.table-container th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-surface, #121212);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1); 
}

.table-container th:first-child, 
.table-container td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background-color: var(--bg-surface, #121212);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.1); 
}

.table-container th:first-child {
  z-index: 15;
}

/* --- TABLE HEADER TOOLTIP FIXES --- */

/* Tooltip Container on Table Headers */
.table-header-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}

/* Tooltip Popup Bubble: Material 3's *plain* tooltip, since these name a column in a few words (improvements F16,
   round 3; the owner's choice): the inverse surface (a light box, dark text, on the dark page), 4px corners (shape
   "extra small"), 8px padding, at least 24px tall, and no border or shadow (elevation 0). The app's (i) tooltips are
   M3's *rich* tooltip instead (css/base.css). Closed it's display: none, like the shared tooltip, so it takes no room. */
.table-header-tooltip .tooltip-text {
    display: none;
    visibility: hidden;
    position: absolute;
    z-index: 999;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    
    /* Strict Text Wrapping & Sizing */
    width: max-content;
    max-width: 220px;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box;
    
    /* Typography */
    text-align: center;
    font-weight: 400;
    font-size: 0.75rem;
    line-height: 1.4;
    text-transform: none; /* Keeps original casing without forcing layout-breaking uppercase */
    
    /* Styling */
    background: #e5e7eb;
    color: #111827;
    padding: 4px 8px;
    min-height: 24px;
    border-radius: 4px;
    border: 0;
    box-shadow: none;
    opacity: 0;
    transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), visibility var(--motion-effects-default-ms) linear;
    transition: opacity var(--motion-effects-default-ms) var(--motion-effects-default), visibility var(--motion-effects-default-ms) linear, display var(--motion-effects-default-ms) allow-discrete;
    /* Improvements M3: M3's motion tokens here too (see the shared tooltip in css/base.css). */
    pointer-events: none;
    /* Slid back inside the window by js/shared/ui/tooltips.js (place), as the shared tooltip is. */
    translate: var(--tt-dx, 0px) 0;
}

/* Hover Trigger (and the 1.5s linger after the mouse leaves: css/base.css, tt-linger) */
.table-header-tooltip:hover .tooltip-text {
    display: block;
    visibility: visible;
    opacity: 1;
    @starting-style { opacity: 0; }
}

/* A tap or the keyboard opens it too (improvements F16, round 4): the header is a tooltip trigger in
   js/shared/ui/tooltips.js (Tab shows it, Enter or Space toggles it, Escape hides it, a tap toggles it). The shared
   .mobile-visible rule (css/base.css) shows it; this keeps the header tooltip's own centring and fade. */
.table-header-tooltip:focus-visible .tooltip-text:not(.tt-dismissed),
.table-header-tooltip .tooltip-text.mobile-visible {
    display: block;
    visibility: visible;
    opacity: 1;
    @starting-style { opacity: 0 !important; }
}
.table-header-tooltip .tooltip-text.mobile-visible { transform: translateX(-50%) !important; }
.table-header-tooltip.align-right .tooltip-text.mobile-visible { transform: none !important; }
.table-header-tooltip:hover .tooltip-text.tt-dismissed:not(.mobile-visible) { display: none; }

/* Below the header row, above every header (improvements T3, the owner's screenshot): the tooltip used to hang 6px
   under the header's words, inside the row, and each header cell is sticky (its own stacking layer), so the next header
   and the locked Player one drew over it. Anchored to the header cell (sticky is a containing block) it opens under the
   whole row, and its cell rises above the others while it shows. */
th > .table-header-tooltip { position: static; }
th:has(> .table-header-tooltip:hover),
th:has(> .table-header-tooltip:focus-visible),
th:has(> .table-header-tooltip > .tooltip-text:is(.mobile-visible, .tt-linger)) { z-index: 20 !important; }

/* Right-side Column Alignment (Prevents horizontal scrolling & right-edge clipping) */
.table-header-tooltip.align-right .tooltip-text {
    left: auto;
    right: 0;
    transform: none;
}

/* T-Score Specific Styles */
.tscore-hero {
    padding: 3rem 1.5rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-color) 100%);
    border-bottom: 1px solid var(--border);
}

.tscore-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.tscore-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Sticky Sub-Nav for Tabs */
.tscore-nav-wrapper {
    position: sticky;
    top: 60px;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 599.98px) {
    .tscore-nav-wrapper {
        top: 49px;
    }
}
.tscore-nav-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    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);
}

.tscore-nav-btn:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.tscore-nav-btn.active {
    background: var(--target-bg);
    color: var(--primary-green);
    border-color: var(--primary-green);
}

/* Tab Content Visibility Guarantee */
.tab-content {
    display: none !important;
}
.tab-content.active {
    display: block !important;
}

.settings-card {
    display: block !important;
    background: var(--card-bg, #131b2c);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-main, #f3f4f6);
}

.card-desc {
    color: var(--text-muted, #9ca3af);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

/* Editorial Reading Typography */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #d1d5db;
}

.article-content h2 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin: 2.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.article-content h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin: 1.5rem 0 0.75rem 0;
}

.article-content p {
    margin-bottom: 1.25rem;
    text-wrap: pretty;
}

.article-content ul {
    margin: 0 0 1.5rem 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.math-block {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #60a5fa;
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    font-family: monospace;
    font-size: 1.1rem;
    margin: 1.5rem 0;
    color: #93c5fd;
    overflow-x: auto;
}

/* Premium Data Tables */
.data-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    margin-bottom: 2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--card-bg, #131b2c);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: var(--card-bg, #1a1a1a);
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.1);
}

.data-table th:nth-child(2) {
    z-index: 15; 
}

.data-table td {
    padding: 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Label Badges */
.label-elite { color: #a855f7; background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.label-high { color: #3b82f6; background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.label-strong { color: #10b981; background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.label-quality { color: #f59e0b; background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.label-boom { color: #ef4444; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.label-depth { color: var(--text-muted); background: rgba(255, 255, 255, 0.1); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }

/* Value Badges */
.val-badge { padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.85rem; }
.val-fire { color: #10b981; background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.val-warn { color: #ef4444; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Position Toggle Styles */
.pos-toggle-wrapper {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem 0;
}

.pos-toggle-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    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);
}

.pos-toggle-btn:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.3);
}

.pos-toggle-btn.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary-green);
    border-color: var(--primary-green);
}

/* The Research's last line: what the site's visitor counts record (improvements A1). */
/* The support line and buttons at the end of The Research (improvements K2), just above Visitor counts. */
.article-content .tscore-support { margin-top: 2rem; }
.article-content .tscore-support p {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.article-content .tscore-support .kofi-btn { color: #0a0e17; }
.article-content .tscore-support + p.tscore-privacy { margin-top: 1.25rem; }

.article-content p.tscore-privacy {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* The In-Season tab (improvements T1): the status line and "Buy & Sell only" above the table, the Move arrows, the
   Buy and Sell chips, the plain message for a sheet that can't be read, and the data credit. */
.tscore-inseason-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}
.tscore-inseason-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.tscore-inseason-tools .tscore-buysell-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
.tscore-inseason-message {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
}
.tscore-inseason-message[hidden],
.data-table-wrapper[hidden] { display: none; }
.tscore-inseason-empty {
    color: var(--text-muted);
    text-align: center;
}
.tscore-move {
    /* Holds its .sr-only words (position: absolute): without it they'd be placed against the page, outside the
       table's scroll box, and widen the page on phones. */
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 700;
}
.tscore-move.is-up { color: #10b981; }
.tscore-move.is-down { color: #ef4444; }
.tscore-move.is-flat { color: var(--text-muted); font-weight: 400; }
.tscore-chip { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.tscore-chip-buy { color: #10b981; background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.tscore-chip-sell { color: #ef4444; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }
.tscore-inseason-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.tscore-inseason-terms {
    margin: 0 0 0.5rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.tscore-inseason-terms li { margin-bottom: 0.35rem; }
.tscore-credit {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.tscore-credit a { color: inherit; text-decoration: underline; }
/* Its links keep their text's size: css/base.css, TOUCH TARGETS, links inside a sentence (improvements F20). */
/* The Research's In-Season section (improvements T1): its dated note, and the preseason-vs-in-season table's first
   column (row names, not sticky player names). */
.article-content p.tscore-article-note { font-size: 0.9rem; color: var(--text-muted); }
.tscore-compare-table td { white-space: normal; }
.tscore-compare-table td:first-child { font-weight: 600; white-space: nowrap; }
.tscore-compare-table th:nth-child(2),
.tscore-compare-table td:nth-child(2) { position: static; box-shadow: none; }
/* Below the sticky header and tab bar when "How it differs…" scrolls to it. */
#inSeasonModel { scroll-margin-top: 140px; }
@media (max-width: 599.98px) {
    /* All three columns on a phone's width, no sideways scroll. */
    .tscore-compare-table th,
    .tscore-compare-table td { padding: 0.6rem 0.5rem; font-size: 0.82rem; white-space: normal; }
    .tscore-compare-table td:first-child { white-space: normal; }
}

/* The In-Season table on phones (improvements T3): on main the locked Player column took most of a 360px screen. The
   name column narrows to the short name with the position rank and team under it ("P. Nacua / WR1 · LA"), the ROS
   and Team columns go (that line carries them), the Label moves after the stats, and the headers may wrap ("ROS /
   PPG"), so the name and three stat columns show at 360px; the rest scroll sideways inside the table. Wide windows
   are unchanged: the short name, its line and the second Label cell are hidden there. */
.tscore-inseason-table .tscore-phone-only,
.tscore-inseason-table .tscore-name-short,
.tscore-inseason-table .tscore-name-sub { display: none; }
@media (max-width: 599.98px) {
    .tscore-inseason-table .tscore-wide-only { display: none; }
    .tscore-inseason-table .tscore-phone-only { display: table-cell; }
    .tscore-inseason-table th,
    .tscore-inseason-table td { padding: 0.75rem 0.375rem; font-size: 0.875rem; }
    .tscore-inseason-table th { white-space: normal; font-size: 0.75rem; vertical-align: bottom; }
    /* Its first visible column, the ROS one being hidden here: 16px in from the screen's edge (ROOM ON PHONES, below). */
    .tscore-inseason-table th:nth-child(2),
    .tscore-inseason-table td:nth-child(2) { padding-left: 16px; }
    /* The full name stays for screen readers (the short one is aria-hidden); as .sr-only in css/base.css. */
    .tscore-inseason-table .tscore-name-full {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .tscore-inseason-table .tscore-name-short {
        display: block;
        max-width: 7rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .tscore-inseason-table .tscore-name-sub {
        display: block;
        font-size: 0.75rem;
        color: var(--text-muted);
    }
}

/* --- ROOM ON PHONES (improvements T3, round 3; the apps' M17 in css/base.css) ---
   Material 3's compact window: under 600px each section runs to the screen's edges with 16px margins, and lists (here
   the tables) run edge to edge. The apps get this through .has-nav-bar, which this page doesn't have, so it had a framed
   card with 24px of padding inside an 8px page padding, and a second framed box around each table: 66px of a 360px
   screen. Now a card has no frame and 16px side padding, 8px apart; The Research and 2024 articles have 16px margins;
   a table directly in a card or article loses its frame and runs to the screen's edges, its first and last columns
   16px in. A table inside a fold (Model Weights, the baseline variables) stays framed inside it. From 600px up nothing
   changes. */
@media (max-width: 599.98px) {
    main.container { padding-left: 0; padding-right: 0; }
    .settings-card {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding-left: 16px;
        padding-right: 16px;
        margin-bottom: 8px;
    }
    .article-content { padding-left: 16px; padding-right: 16px; }
    :is(.settings-card, .article-content) .data-table-wrapper:not(details *) {
        width: auto;
        margin-left: -16px;
        margin-right: -16px;
        border: 0;
        border-radius: 0;
    }
    :is(.settings-card, .article-content) .data-table-wrapper:not(details *) :is(th, td):first-child { padding-left: 16px; }
    :is(.settings-card, .article-content) .data-table-wrapper:not(details *) :is(th, td):last-child { padding-right: 16px; }
}
