.theme-picker { display: flex; align-items: center; gap: 5px; margin-left: auto; color: var(--text, var(--desk-text)); font-size: .8rem; }
.theme-picker select { background: var(--panel); color: var(--text, var(--desk-text)); border: 1px solid var(--line); min-height: 36px; padding: 4px 5px; font: inherit; border-radius: 3px; }
html[data-theme="dark"] {
  --theme-bg: #20201e; --theme-panel: #2a2926; --theme-raised: #34312c;
  --theme-line: #615a50; --theme-text: #f6eee1; --theme-muted: #d4c8b6; --theme-accent: #f2bda3;
}
html[data-theme="night"] {
  --theme-bg: #0a111c; --theme-panel: #121d2d; --theme-raised: #1a293d;
  --theme-line: #425672; --theme-text: #e9f1fb; --theme-muted: #bdcee4; --theme-accent: #a9cef5;
}
html:is([data-theme="dark"],[data-theme="night"]) {
  color-scheme: dark;
  --bg: var(--theme-bg); --panel: var(--theme-panel); --panel-deep: var(--theme-raised);
  --line: var(--theme-line); --text: var(--theme-text); --paper: var(--theme-text);
  --muted: var(--theme-muted); --ice: var(--theme-accent); --blue: var(--theme-accent);
  --signal: #b8e7c7; --ink: var(--theme-bg); --news-accent: var(--theme-accent);
  --desk-bg: var(--theme-bg); --desk-surface: var(--theme-panel); --desk-raised: var(--theme-raised);
  --desk-rule: var(--theme-line); --desk-text: var(--theme-text); --desk-muted: var(--theme-muted); --desk-blue: var(--theme-accent);
}
html:is([data-theme="dark"],[data-theme="night"]) body :is(input,select,textarea) {
  color: var(--theme-text); background: var(--theme-panel); border-color: var(--theme-line);
}
html:is([data-theme="dark"],[data-theme="night"]) #main #search input::placeholder,
html:is([data-theme="dark"],[data-theme="night"]) #main :is(.feature .time,.feature p,.around p,.league-line small,.score-ribbon small) {
  color: var(--theme-muted);
}
html:is([data-theme="dark"],[data-theme="night"]) :is(.lead-copy small,#main .feature-top b,#main .feature-top span) { color: var(--theme-accent); }
html:is([data-theme="dark"],[data-theme="night"]) :is(.prop-table th,.standings-table th,.standings-table thead) { color: var(--theme-text); background: var(--theme-raised); }
html:is([data-theme="dark"],[data-theme="night"]) :is(.prop-table tr:focus-within td,.prop-table tbody tr:hover td,.standings-table tbody tr:hover td,.quick-tools a:hover,.matchup-shortcuts a:hover) { background: var(--theme-raised); }
html:is([data-theme="dark"],[data-theme="night"]) :is(button:hover,button[aria-pressed=true],#workspace-nav button:hover,#workspace-nav button[aria-pressed=true],.mobile-nav button[aria-pressed=true],.mobile-tools button[aria-pressed=true],.prop-player-list button[aria-pressed=true]) {
  color: var(--theme-accent); background: var(--theme-raised); border-color: var(--theme-accent);
}
html:is([data-theme="dark"],[data-theme="night"]) :is(.lead-cta,.action,.room-search button,.broadcast-link,#main .search-section button,#home-screen > .broadcast-matchup .broadcast-copy > .broadcast-link) {
  background: var(--theme-accent); color: var(--theme-bg); border-color: var(--theme-accent);
}
html:is([data-theme="dark"],[data-theme="night"]) :is(header,.masthead,.newsroom-rail) { border-color: var(--theme-line); }
@media (max-width: 650px) {
  .theme-picker { gap: 2px; flex-shrink: 0; }
  .theme-picker span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .theme-picker select { font-size: 16px; min-height: 40px; }
  header:has(.theme-picker) { gap: 6px; }
  header:has(.theme-picker) .brand { min-width: 0; gap: 6px; }
  header:has(.theme-picker) .brand img { flex-shrink: 0; }
}

/* Shared typography for the homepage and every research route. */
html[data-theme] {
  --type-editorial: Georgia, "Times New Roman", serif;
  --type-interface: system-ui, -apple-system, "Segoe UI", sans-serif;
  --type-ink: var(--theme-text, #1a242a);
  --type-muted: var(--theme-muted, #4b5556);
  --type-link: var(--theme-accent, #294a4c);
}
html[data-theme] body {
  font-family: var(--type-interface);
  color: var(--type-ink);
}
html[data-theme] :is(h1,h2,h3,h4,.brand b,.brand strong) {
  font-family: var(--type-editorial);
  color: var(--type-ink);
}
html[data-theme] :is(button,input,select,textarea,label,summary,table,.report-meta,.tool-context,.score-ribbon,.nav-group > small) {
  font-family: var(--type-interface);
}
html[data-theme] :is(p,label,legend,small,.report-meta,.tool-context,.broadcast-kickoff) {
  color: var(--type-muted);
}
html[data-theme] :where(#view,#home-screen,footer) a {
  color: var(--type-link);
}
html[data-theme] :is(table,.nba-score,.score-ribbon,.team-prop-summary,.scoring-form) {
  font-variant-numeric: tabular-nums;
}
html[data-theme] :is(input,textarea)::placeholder { color: var(--type-muted); opacity: 1; }
html[data-theme] :is(#view,.room-section,#main .around) p { line-height: 1.55; }
html[data-theme] .lead-art span { color: #e6e4de; }
html[data-theme] :is(.action,.lead-cta,.broadcast-link) small { color: inherit; }

/* Keep the field, selected value and native menu on the same palette. */
html[data-theme] {
  --field-surface: var(--theme-panel, #fffdf6);
  --field-ink: var(--theme-text, #1a242a);
  --field-border: var(--theme-line, #918779);
}
html[data-theme] body header .theme-picker select,
html[data-theme] body #main #search select,
html[data-theme] body #main #search input,
html[data-theme] body :is(#view,#home-screen,.masthead,.mobile-tools) :is(select,input,textarea) {
  color: var(--field-ink);
  background: var(--field-surface);
  border-color: var(--field-border);
}
html[data-theme] select :is(option,optgroup) {
  color: var(--field-ink);
  background-color: var(--field-surface);
}
html[data-theme] select option:disabled { color: var(--type-muted); }
html[data-theme="light"] { color-scheme: light; }
html:is([data-theme="dark"],[data-theme="night"]) :is(select,input,textarea) { color-scheme: dark; }

/* Filled links own both colors, including the footer's primary social link. */
html[data-theme] {
  --button-fill: var(--theme-accent, #243d42);
  --button-ink: var(--theme-bg, #fffdf6);
  --button-hover: color-mix(in srgb, var(--button-fill) 86%, var(--button-ink));
}
html[data-theme] body :is(
  :is(.nba-actions,.matchup-shortcuts,.slate-row) a,
  :is(.room-feature,.room-intro,.room-reports,.featured,.heading,.feature,.central-update) > a,
  .social-links a.social-youtube, .action, .lead-cta, .broadcast-copy a.broadcast-link
) {
  color: var(--button-ink);
  background: var(--button-fill);
  border-color: var(--button-fill);
}
html[data-theme] body :is(
  :is(.nba-actions,.matchup-shortcuts,.slate-row) a,
  :is(.room-feature,.room-intro,.room-reports,.featured,.heading,.feature,.central-update) > a,
  .social-links a.social-youtube, .action, .lead-cta, .broadcast-copy a.broadcast-link
):is(:hover,:focus-visible) {
  color: var(--button-ink);
  background: var(--button-hover);
  border-color: var(--button-fill);
}
html[data-theme] .broadcast-copy { min-width: 0; overflow-wrap: anywhere; }
html[data-theme] .broadcast-copy h2 { white-space: normal; }

/* Homepage updates use the same contrast pair in every interaction state. */
html[data-theme] #main .central-update > a {
  color: var(--button-ink);
  background: var(--button-fill);
  border-color: var(--button-fill);
  transition: none;
}
html[data-theme] #main .central-update > a:is(:hover,:focus-visible) {
  background: var(--button-hover);
}

/* Use the same editorial sans-serif hierarchy in the league tools and home desk. */
html[data-theme] { --type-editorial: system-ui,-apple-system,"Segoe UI",sans-serif }
html[data-theme] body :is(h1,h2,h3,h4,.brand b,.brand strong,#tg-output h3) { font-family:var(--type-editorial) }
