/* ===== Design Tokens ===== */
:root {
    /* Text */
    --color-text-primary: #111827;
    --color-text-secondary: #374151;
    --color-text-tertiary: #6b7280;
    --color-text-dimmed: #9ca3af;

    /* Backgrounds */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f9fafb;
    --color-bg-tertiary: #f3f4f6;
    --color-bg-muted: #e5e7eb;

    /* Borders */
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    --color-border-strong: #d1d5db;

    /* Interactive */
    --color-link: #2563eb;
    --color-link-hover: #1d4ed8;
    --color-accent: #3b82f6;

    /* Semantic: Win/Lose/Push */
    --color-win: #10b981;
    --color-win-strong: #059669;
    --color-win-bg: rgba(16, 185, 129, 0.15);
    --color-win-bg-solid: #ecfdf5;
    --color-win-bg-solid-strong: #d1fae5;
    --color-lose: #ef4444;
    --color-lose-strong: #dc2626;
    --color-lose-bg: rgba(239, 68, 68, 0.15);
    --color-lose-bg-solid: #fef2f2;
    --color-lose-bg-solid-strong: #fee2e2;
    --color-push-bg: rgba(234, 179, 8, 0.15);

    /* Injury status */
    --color-injury-out: #FF3300;
    --color-injury-doubtful: #FF9900;
    --color-injury-questionable: #FFFF00;
    --color-injury-probable: #66FF00;
    --color-injury-available: #00EE00;

    /* Flash messages */
    --color-flash-bg: #cae6f6;
    --color-flash-border: #377ba8;

    /* Typography */
    --font-sans: "Open Sans", sans-serif;
    --font-mono: "Noto Sans Mono", monospace;
    --font-icon: "Material Symbols Outlined";

    /* Spacing */
    --content-max-width: 1040px;
    --content-padding: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-pill: 100px;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --color-text-primary: #f9fafb;
        --color-text-secondary: #e5e7eb;
        --color-text-tertiary: #9ca3af;
        --color-text-dimmed: #6b7280;

        --color-bg-primary: #111827;
        --color-bg-secondary: #1f2937;
        --color-bg-tertiary: #374151;
        --color-bg-muted: #4b5563;

        --color-border: #374151;
        --color-border-light: #1f2937;
        --color-border-strong: #4b5563;

        --color-link: #60a5fa;
        --color-link-hover: #93c5fd;
        --color-accent: #3b82f6;

        --color-win-bg-solid: #064e3b;
        --color-win-bg-solid-strong: #065f46;
        --color-lose-bg-solid: #7f1d1d;
        --color-lose-bg-solid-strong: #991b1b;

        --color-flash-bg: #1e3a5f;
        --color-flash-border: #60a5fa;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    }
}

html.dark {
    --color-text-primary: #f9fafb;
    --color-text-secondary: #e5e7eb;
    --color-text-tertiary: #9ca3af;
    --color-text-dimmed: #6b7280;

    --color-bg-primary: #111827;
    --color-bg-secondary: #1f2937;
    --color-bg-tertiary: #374151;
    --color-bg-muted: #4b5563;

    --color-border: #374151;
    --color-border-light: #1f2937;
    --color-border-strong: #4b5563;

    --color-link: #60a5fa;
    --color-link-hover: #93c5fd;
    --color-accent: #3b82f6;

    --color-win-bg-solid: #064e3b;
    --color-win-bg-solid-strong: #065f46;
    --color-lose-bg-solid: #7f1d1d;
    --color-lose-bg-solid-strong: #991b1b;

    --color-flash-bg: #1e3a5f;
    --color-flash-border: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* ===== Base Elements ===== */
html {
    font-family: var(--font-sans);
    color: var(--color-text-primary);
}

body {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--content-padding) 12px var(--content-padding);
    background: var(--color-bg-primary);
}

h1 {
    font-family: var(--font-sans);
    font-size: 40px;
    margin: 1.5rem 0;
}

h2 {
    font-family: var(--font-sans);
    font-size: 32px;
}

h3 {
    background-color: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
    font-size: 1.44em;
    padding: 16px 32px;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border-strong);
}

p {
    font-size: 32px;
    line-height: 54px;
}

/* ===== Navigation ===== */
header .action {
    display: block;
    padding: 0.5rem;
}

nav {
    padding: 40px var(--content-padding);
    margin: 0 calc(-1 * var(--content-padding));
    border-bottom: 1px solid var(--color-border-strong);
}

nav div {
    display: flex;
    align-items: center;
}

nav div a {
    font-size: 2.5em;
    margin-right: 1em;
    text-decoration: none;
}

nav div a.active {
    background-color: var(--color-accent);
    border-radius: var(--radius-pill);
    color: var(--color-bg-primary);
    padding: 24px 36px;
}

.theme-toggle {
    background: none;
    border: 2px solid var(--color-border-strong);
    border-radius: 50%;
    cursor: pointer;
    padding: 12px;
    line-height: 1;
    color: var(--color-text-secondary);
    font-size: 2em;
    margin-left: auto;
    transition: background 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* ===== Content Layout ===== */
.content>header {
    background-color: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 3;
}

.content>header h1 {
    flex: auto;
    font-size: 48px;
    margin: 8px 0
}

.flash {
    margin: 1em 0;
    padding: 1em;
    background: var(--color-flash-bg);
    border: 1px solid var(--color-flash-border);
}

.injuries {
    padding: 8px 16px;
    color: var(--color-text-secondary);
    font-size: 1em;
    font-style: italic;
    line-height: 1.2em;
}

.post>header {
    display: flex;
    align-items: flex-end;
    font-size: 0.85em;
}

.post>header>div:first-of-type {
    flex: auto;
}

.post>header h1 {
    font-size: 1.5em;
    margin-bottom: 0;
}

.post .about {
    color: var(--color-text-tertiary);
    font-style: italic;
}

.post .body {
    white-space: pre-line;
}

.content:last-child {
    margin-bottom: 0;
}

.content form {
    margin: 1em 0;
    display: flex;
    flex-direction: column;
}

.content label {
    font-weight: bold;
    margin-bottom: 0.5em;
}

.content input,
.content textarea {
    margin-bottom: 1em;
}

.content textarea {
    min-height: 12em;
    resize: vertical;
}

input.danger {
    color: var(--color-lose-strong);
}

input[type=submit] {
    align-self: start;
    min-width: 10em;
}

/* ===== Components ===== */
div.button-flow-box {
    display: inline-flex;
    flex-direction: column;
    margin-bottom: 16px;
    margin-right: 32px;
}

td.injury-status {
    border-radius: var(--radius-md);
    font-weight: bold;
    text-align: center;
}

.alpha-search {
    display: flex;
    flex-direction: column;
    float: right;
    height: 92vh;
    justify-content: space-between;
    padding-top: 16px;
    position: sticky;
    top: 0px;
}

.buttons {
    display: block;
    padding: 12px 0;
}

.centered-buttons {
    display: flex;
    justify-content: space-around;
    padding: 24px 16px;
}

.crumb-header {
    padding: 32px 0;
}

.emphasized {
    font-weight: bold;
}

/* ===== Games ===== */
.games-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.games-row {
    background-color: var(--color-bg-tertiary);
    border-radius: 32px;
    display: flex;
    font-size: 2.4em;
    justify-content: space-between;
    padding: 0.5em 1em;
    margin-top: 1em;
}

.games-row .scores .team-name {
    font-size: 42px;
    line-height: 80px;
    padding: 0.25em 0;
    width: 320px;
}

.games-row .scores .team-points {
    font-size: 42px;
    line-height: 80px;
    padding: 0.25em 0;
    text-align: right;
    width: 60px;
}

.games-row .status {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.games-row .links {
    display: flex;
}

.games-row .button {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.games-row .winner {
    border: solid 2px var(--color-win-strong);
}

/* ===== Font Utilities ===== */
.icon {
    font-family: var(--font-icon);
}

.mono {
    font-family: var(--font-mono);
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    margin: 0 calc(-1 * var(--content-padding));
    padding: 16px var(--content-padding);
    background-color: var(--color-bg-tertiary);
}

.player-container {
    display: flex;
    justify-content: space-between;
}

.separator {
    color: var(--color-border-strong);
    font-size: 32px;
    padding: 0 16px;
}

/* ===== Tables ===== */
.wide {
    width: 100%
}

.wide2 {
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    padding: 16px;
    width: 100%;
}

/* ===== Buttons ===== */
a.button,
label.button {
    border: var(--color-accent) solid 3px;
    display: inline-block;
    font-weight: bold;
    font-size: 28px;
    text-decoration: none;
    border-radius: var(--radius-pill);
    line-height: 2em;
    margin-bottom: 8px;
    margin-right: 16px;
    min-width: 48px;
    padding: 16px 32px;
    text-align: center;
    color: var(--color-link);
}

a.date-button {
    border: var(--color-accent) solid 3px;
    border-radius: var(--radius-lg);
    display: inline-block;
    font-weight: bold;
    font-size: 24px;
    text-decoration: none;
    line-height: 1.2em;
    margin-bottom: 8px;
    margin-right: 16px;
    min-width: 48px;
    padding: 16px 24px;
    text-align: center;
}

a.back-button {
    background-color: var(--color-bg-primary);
    border: solid 2px var(--color-border-strong);
    border-radius: 100%;
    display: inline-block;
    font-weight: bold;
    font-size: 48px;
    text-decoration: none;
    margin-right: 32px;
    padding: 16px;
}

a.button.on,
label.button.on,
a.button:hover,
label.button:hover {
    background-color: var(--color-accent);
    color: var(--color-bg-primary);
}

a.button.big {
    border-radius: var(--radius-pill);
    font-size: 40px;
    padding: 12px 32px;
}

a.button.dot {
    font-size: 28px;
    padding: 4px 16px;
}

a.button.nomargin {
    margin: 0;
}

a.button.button-small {
    font-size: 16px;
    padding: 6px 16px;
    line-height: 1.4em;
    margin-right: 8px;
    margin-bottom: 4px;
}

.model-pill-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin: var(--space-sm) 0 var(--space-md) 0;
}

.model-pill-bar a.button {
    font-size: 15px;
    padding: 5px 14px;
    line-height: 1.4em;
    margin: 0;
}

a.button.model-pill-active,
a.button.model-pill-active:hover {
    background-color: var(--color-accent);
    color: var(--color-bg-primary);
}

/* ===== Table Cells ===== */
th,
td {
    font-size: 32px;
    line-height: 54px;
    text-align: left;
    text-wrap: nowrap
}

td {
    border-radius: var(--radius-md);
    padding-right: 8px;
}

td.green {
    color: var(--color-win);
}

td.red {
    color: var(--color-lose);
}

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

th.r,
td.r {
    text-align: right;
}

th.clickable {
    color: var(--color-link);
}

th.active {
    text-decoration-line: overline;
    text-decoration-thickness: 4px;
    -webkit-text-decoration-line: overline;
}

th.big,
td.big {
    font-size: 48px;
    line-height: 80px;
}

th.medium,
td.medium {
    font-size: 40px;
    line-height: 72px;
}

/* ===== Result Row Colors ===== */
.win {
    background-color: var(--color-win-bg);
}

.push {
    background-color: var(--color-push-bg);
}

.lose {
    background-color: var(--color-lose-bg);
}

/* ===== Page Header 2025 ===== */
.header-2025 {
    display: flex;
    width: 100%;
}

.header-2025 .back {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.header-2025 .titles h1 {
    color: var(--color-text-primary);
    font-size: 48px;
    line-height: 60px;
    margin: 0;
}

.header-2025 .titles h2 {
    color: var(--color-text-secondary);
    font-size: 32px;
    line-height: 48px;
    margin: 4px 0 0 0;
}

.puffy {
    padding: 6px;
    border-radius: 12px;
}

.ul {
    border-bottom: solid 1px var(--color-accent);
}

select {
    border: solid 4px var(--color-accent);
    border-radius: var(--radius-md);
    color: var(--color-link);
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: bold;
    padding: 12px 16px;
}

/* ===== Utilities ===== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-dimmed {
    color: var(--color-text-dimmed) !important;
}

.no-padding {
    padding: 0 !important;
}

/* ===== Timeline Component ===== */
.timeline-wrapper {
    position: relative;
    overflow-x: auto;
}

.timeline-header {
    display: flex;
    align-items: flex-end;
    height: 60px;
    border-bottom: 2px solid var(--color-text-secondary);
    background: var(--color-bg-primary);
    position: sticky;
    top: 0;
    z-index: 2;
}

.player-label-col {
    width: 240px;
    flex-shrink: 0;
    padding-right: 20px;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--color-border-strong);
}

.timeline-intervals {
    flex-grow: 1;
    position: relative;
    height: 100%;
}

.interval-marker {
    position: absolute;
    bottom: 0;
    height: 100%;
    transform: translateX(-50%);
}

.marker-label {
    position: absolute;
    top: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.grid-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--color-border-light);
}

.timeline-header .grid-line {
    height: 10px;
    background: var(--color-text-secondary);
    bottom: -2px;
}

.timeline-body {
    position: relative;
    padding-top: 10px;
}

.player-row {
    display: flex;
    height: 60px;
    align-items: center;
    border-bottom: 1px solid var(--color-bg-tertiary);
    transition: background 0.2s;
}

.player-row:hover {
    background: var(--color-bg-secondary);
}

.player-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.shift-track {
    flex-grow: 1;
    position: relative;
    height: 100%;
    background-image: linear-gradient(to right, var(--color-bg-secondary) 1px, transparent 1px);
    background-size: 6.25% 100%;
}

.shift-bar {
    position: absolute;
    top: 12px;
    bottom: 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
}

@media (max-width: 768px) {
    .player-label-col {
        width: 120px;
    }

    .player-name {
        font-size: 16px;
    }
}

/* ===== Injury Timeline ===== */
.tl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    padding: 16px 0 32px;
    font-size: 24px;
}

.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tl-legend-dot {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tl-legend-dot--game { background: var(--color-border-strong); }
.tl-legend-dot--out { background: var(--color-injury-out); }
.tl-legend-dot--doubtful { background: var(--color-injury-doubtful); }
.tl-legend-dot--questionable { background: var(--color-injury-questionable); border: 1px solid var(--color-border-strong); }
.tl-legend-dot--probable { background: var(--color-injury-probable); }
.tl-legend-dot--available { background: var(--color-injury-available); }

.tl-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 22px minmax(0, 3fr);
    column-gap: 20px;
}

.tl-spine {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tl-spine::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: var(--color-border-strong);
}

.tl-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid var(--color-bg-primary);
    box-shadow: 0 0 0 2px var(--color-text-dimmed);
    position: relative;
    z-index: 1;
    margin-top: 14px;
    flex-shrink: 0;
}

.tl-left,
.tl-right {
    padding-bottom: 36px;
}

.tl-left {
    text-align: right;
}

.tl-right {
    text-align: left;
}

.tl-game-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.tl-game-link:hover .tl-score {
    text-decoration: underline;
}

.tl-score {
    font-size: 32px;
    font-weight: bold;
    line-height: 44px;
}

.tl-win {
    color: var(--color-win);
}

.tl-loss {
    color: var(--color-lose);
}

.tl-opp {
    font-size: 26px;
    line-height: 38px;
}

.tl-game-stats {
    display: flex;
    align-items: flex-start;
    padding-top: 10px;
}

.tl-chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 24px;
    line-height: 1;
    background: var(--color-bg-muted);
    border-radius: var(--radius-pill);
    padding: 8px 20px;
    color: var(--color-text-primary);
}

.tl-chip-dnp {
    background: var(--color-bg-tertiary);
    color: var(--color-text-tertiary);
}

.tl-status {
    font-size: 36px;
    font-weight: bold;
    line-height: 48px;
    letter-spacing: 0.04em;
}

.tl-reason {
    font-size: 28px;
    line-height: 42px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.tl-date {
    font-size: 24px;
    line-height: 36px;
}

/* ===== Player Game Events ===== */
.rest-row td {
    padding: 0 !important;
    position: relative;
    text-align: center;
    border: none !important;
}

.vertical-timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dotted var(--color-border-strong);
    z-index: 1;
}

.rest-label {
    position: relative;
    z-index: 2;
    background: var(--color-bg-primary);
    padding: 2px 8px;
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
    display: inline-block;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    margin: 4px 0;
}

.shift-header-row td {
    background-color: var(--color-bg-secondary);
    border-top: 2px solid var(--color-border);
    border-bottom: 2px solid var(--color-border);
}

/* ===== Phase 4: Utility Classes for Inline Style Replacement ===== */
.projection-cell {
    width: 1%;
    font-size: 40px;
}

.injury-badge {
    border-radius: 6px;
    font-size: 22px;
    font-weight: bold;
    padding: 3px 10px;
    margin-left: 10px;
    color: var(--color-text-primary);
    vertical-align: middle;
    display: inline-block;
}

.col-w10 { width: 10%; }
.col-w15 { width: 15%; }
.col-w20 { width: 20%; }
.col-w25 { width: 25%; }
.col-w40 { width: 40%; }
.col-w80 { width: 80px; }
.col-w100 { width: 100px; }

a.button.fixed-w {
    width: 100px;
}

a.button.disabled,
label.button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    justify-content: space-between;
}

.pre-block {
    background: var(--color-bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.9em;
    border: 1px solid var(--color-border);
}

.spacer-row td {
    height: 8px;
}

.visually-hidden {
    display: none;
}

.event-type-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.selector-row {
    margin-top: 32px;
}

.selector-label {
    font-size: 24px;
    font-weight: bold;
}

.note-text {
    margin-top: 32px;
    font-size: 24px;
    line-height: 1.4em;
}

.svg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
    body {
        padding: 0 12px 12px 12px;
    }

    nav {
        padding: 20px 12px;
        margin: 0 -12px;
    }

    nav div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    nav div a {
        font-size: 1.6em;
        margin-right: 0;
    }

    nav div a.active {
        padding: 12px 20px;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 24px;
    }

    h3 {
        font-size: 1.1em;
        padding: 12px 20px;
    }

    .content>header h1 {
        font-size: 32px;
    }

    .header-2025 .titles h1 {
        font-size: 32px;
        line-height: 40px;
    }

    .header-2025 .titles h2 {
        font-size: 24px;
        line-height: 32px;
    }

    th, td {
        font-size: 24px;
        line-height: 40px;
    }

    p {
        font-size: 24px;
        line-height: 40px;
    }

    a.button, label.button {
        font-size: 22px;
        padding: 10px 20px;
        margin-right: 8px;
    }

    a.date-button {
        font-size: 18px;
        padding: 10px 16px;
        margin-right: 8px;
    }

    a.button.dot {
        font-size: 20px;
        padding: 4px 12px;
    }

    .games-row {
        flex-direction: column;
        font-size: 1.6em;
        padding: 0.5em;
        border-radius: 20px;
    }

    .games-row .scores .team-name {
        font-size: 28px;
        line-height: 48px;
        width: auto;
    }

    .games-row .scores .team-points {
        font-size: 28px;
        line-height: 48px;
    }

    .best-books-grid {
        grid-template-columns: 1fr;
    }

    .player-container {
        flex-direction: column;
    }

    .wide, .wide2 {
        overflow-x: auto;
        display: block;
    }

    select {
        font-size: 24px;
    }
}
