/* System-aware light/dark presentation. Loaded last so every league view shares one theme. */
:root{color-scheme:dark}
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f4f0e8;
  --panel:#fffdf8;
  --panel2:#eee9df;
  --panel3:#ded6c8;
  --line:rgba(24,50,51,.17);
  --cream:#182a2b;
  --muted:#5b6d6b;
  --amber:#85591f;
  --red:#963f32;
  --turf:#006f72;
  --shadow:0 10px 28px rgba(33,46,43,.12);
  --shadow-sm:0 5px 16px rgba(33,46,43,.08);
  --shadow-lg:0 18px 44px rgba(33,46,43,.14);
  --surface-glow:linear-gradient(145deg,#fffdf8,#e8f0ec 58%,rgba(133,89,31,.05));
}

.theme-toggle{
  display:grid;
  flex:0 0 40px;
  width:40px;
  height:40px;
  place-items:center;
  padding:0;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--panel);
  color:var(--cream);
  cursor:pointer;
  transition:border-color .15s ease,background .15s ease,color .15s ease,transform .15s ease;
}
.theme-toggle:hover{border-color:var(--amber);color:var(--amber);transform:translateY(-1px)}
.theme-toggle:focus-visible{outline:3px solid var(--amber);outline-offset:2px}
.theme-icon{grid-area:1/1;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.theme-icon-moon{fill:currentColor;stroke:none}
.theme-icon-sun{display:none}
html[data-theme="dark"] .theme-icon-sun{display:block}
html[data-theme="dark"] .theme-icon-moon{display:none}

html[data-theme="light"] body{
  background:
    radial-gradient(1000px 520px at 10% -8%,rgba(0,111,114,.11),transparent 62%),
    radial-gradient(760px 440px at 100% 0%,rgba(133,89,31,.09),transparent 58%),
    var(--bg);
}
html[data-theme="light"] .topbar{background:rgba(250,247,240,.96);box-shadow:0 10px 26px rgba(33,46,43,.1)}
html[data-theme="light"] .brand-logo{border-color:rgba(0,111,114,.28);background:linear-gradient(145deg,#edf4f1,#e4ece8)}
html[data-theme="light"] nav.tabs button.active{color:var(--cream)}
html[data-theme="light"] .hero{background:linear-gradient(125deg,#fffdf8,#eaf1ed)}
html[data-theme="light"] .hero h1 span,
html[data-theme="light"] .hero-season-year{color:#294143}
html[data-theme="light"] .hero-meta-grid div{background:rgba(255,255,255,.55)}
html[data-theme="light"] .btn-primary{color:#fffdf8}
html[data-theme="light"] .btn-primary:hover{background:#704817}
html[data-theme="light"] .btn-ghost:hover{background:rgba(0,111,114,.06)}
html[data-theme="light"] :is(.section-status.is-live,.section-status-bar.is-live,.transaction-sync.is-live){color:#416a52}
html[data-theme="light"] .member-help #memberDataSource{color:#315a59}
html[data-theme="light"] .quick-card .num{color:#c6bdaf}
html[data-theme="light"] .corkboard{background:#d8bd91}
html[data-theme="light"] .pin-note{box-shadow:0 6px 16px rgba(66,45,25,.13)}
html[data-theme="light"] :is(.member-initials,.member-modal-initials){color:#f5ebd9;text-shadow:0 3px 10px rgba(0,0,0,.38)}
html[data-theme="light"] .member-modal-head{background:linear-gradient(180deg,var(--panel) 84%,rgba(255,253,248,.94))}

html[data-theme="light"] :is(input,select,textarea){background:var(--panel);color:var(--cream)}
html[data-theme="light"] :is(.composer input,.auth-fields input,.staff-form input,.staff-form textarea,.staff-form select,.staff-item select,.content-field input,.content-field textarea,.community-compose input,.community-compose select,.community-compose textarea,.comment-form input,.trade-board-form input,.trade-board-form textarea,.trade-board-comment-form textarea,.player-controls select,.player-controls input,.playoff-toolbar select){background:var(--panel);color:var(--cream)}
html[data-theme="light"] :is(input,textarea)::placeholder{color:#71817e}
html[data-theme="light"] :is(.bar-track,.poll-vote-option .bar-track,.mock-poll-option .bar-track,.title-odds-bar>div){background:#d9d4ca}

html[data-theme="light"] :is(.public-member-card,.transaction-intro,.trade-intro){background:linear-gradient(135deg,#fffdf8,#e8f0ec)}
html[data-theme="light"] :is(.champ-banner,.content-member-card,.staff-summary-card,.player-record-grid article,.bracket-matchup,.trophy-card){background:linear-gradient(145deg,var(--panel),var(--panel2))}
html[data-theme="light"] :is(.champion-entry,.public-record-card){background:linear-gradient(145deg,var(--panel2),var(--panel))}
html[data-theme="light"] .record-rank{color:rgba(24,42,43,.075)}
html[data-theme="light"] .champ-banner-hook{background:var(--panel);border-color:rgba(24,50,51,.3)}
html[data-theme="light"] .champ-banner-year{text-shadow:none}
html[data-theme="light"] .futures-row{background:linear-gradient(145deg,var(--panel),#f5f1e8)}
html[data-theme="light"] .futures-row.is-favorite{background:linear-gradient(145deg,rgba(133,89,31,.13),var(--panel) 62%)}
html[data-theme="light"] :is(.season-hero-final,.rundown-block,.playoff-result-row:nth-child(even),.draft-recap-list li:nth-child(even),.archive-path-card,.archive-season-card){background:var(--panel2)}
html[data-theme="light"] :is(.rundown-story p,.community-thread-main>p,.transaction-item strong){color:var(--cream)}
html[data-theme="light"] .archive-overview-panel{background:linear-gradient(135deg,rgba(0,111,114,.09),var(--panel) 52%,rgba(133,89,31,.07))!important}

html[data-theme="light"] :is(.ia-subnav,#history .history-subnav){background:rgba(255,253,248,.97);box-shadow:0 8px 20px rgba(33,46,43,.1)}
html[data-theme="light"] :is(.ia-subnav,#history .history-subnav) button{color:var(--muted)}
html[data-theme="light"] :is(.ia-subnav,#history .history-subnav) button:hover{background:var(--panel2);color:var(--cream)}
html[data-theme="light"] :is(.ia-subnav,#history .history-subnav) button.active,
html[data-theme="light"] :is(.ia-subnav,#history .history-subnav) button[aria-selected="true"]{background:linear-gradient(135deg,rgba(0,111,114,.1),rgba(133,89,31,.1));color:var(--amber)}
html[data-theme="light"] #history :is(.matchup-record-card,.player-record-grid article){background:linear-gradient(145deg,var(--panel2),var(--panel));border-color:var(--line)}

html[data-theme="light"] #board,
html[data-theme="light"] #votes{--community-surface:linear-gradient(150deg,rgba(0,111,114,.07),rgba(255,253,248,.98) 52%,rgba(133,89,31,.04))}
html[data-theme="light"] .announcement-avatar{background:#e2ece8}
html[data-theme="light"] :is(.community-comments,.comment-form){background:rgba(24,50,51,.035)}
html[data-theme="light"] :is(.poll-vote-option,.mock-poll-option){border-color:var(--line);background:rgba(255,255,255,.7)}
html[data-theme="light"] :is(.transaction-sync,.transaction-filter-bar,.transaction-ledger){background:rgba(255,255,255,.55)}
html[data-theme="light"] .transaction-ledger-row:hover{background:rgba(0,111,114,.035)}
html[data-theme="light"] .trade-card-head{background:var(--panel2)}
html[data-theme="light"] .trade-board-post.closed{background:rgba(150,63,50,.07)}

html[data-theme="light"] :is(.player-mode-nav button,.player-year-nav button,.playoff-seed-card>span,.bracket-seed){background:var(--panel2)}
html[data-theme="light"] .player-table th{background:#e4ded3}
html[data-theme="light"] :is(.player-table tr:hover,.season-archive-table tbody tr:hover,.week-standings-table tbody tr:hover,.rivalry-self){background:rgba(0,111,114,.035)}
html[data-theme="light"] :is(.staff-comment-row,.content-career span,.content-season-row.head){background:var(--panel2)}
html[data-theme="light"] .content-toast{background:var(--cream);color:var(--panel)}

html[data-theme="light"] .phone-dock{background:rgba(250,247,240,.97);box-shadow:0 -10px 28px rgba(33,46,43,.12)}
html[data-theme="light"] .phone-more-backdrop{background:rgba(24,42,43,.42)}
html[data-theme="light"] .phone-more-handle{background:rgba(24,50,51,.24)}
html[data-theme="light"] :is(.auth-modal,.content-modal,.member-modal){background:rgba(24,42,43,.52)}

@media(max-width:760px){
  .theme-toggle{flex-basis:38px;width:38px;height:38px;border-radius:9px}
}
@media(max-width:390px){
  .topbar-inner{gap:8px}
  .theme-toggle{flex-basis:36px;width:36px;height:36px}
}
@media(prefers-reduced-motion:reduce){.theme-toggle{transition:none}.theme-toggle:hover{transform:none}}
