/* Header chrome and controls remain dark in either theme. */
.header, .header-mobile, .page-heading, .header__secondary, .main-nav { color-scheme: dark; }
.header-mobile__search-control { color: #e7edf4; }
.header-mobile__search-control::placeholder { color: #b3bfcc; opacity: 1; }
.theme-toggle { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: #f3f5f7; font: 700 11px/1.3 Montserrat, sans-serif; text-transform: uppercase; cursor: pointer; }
.theme-toggle input[data-theme-toggle] { appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 42px; width: 42px; height: 24px; margin: 0; padding: 0; border: 1px solid #8b96a4; border-radius: 20px; background: #464f5b; cursor: pointer; vertical-align: middle; }
.theme-toggle input[data-theme-toggle]::before { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: #fff; }
.theme-toggle input[data-theme-toggle]:checked { background: #167ac0; border-color: #73c6ff; }
.theme-toggle input[data-theme-toggle]:checked::before { transform: translateX(18px); }
.theme-toggle input[data-theme-toggle]:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.theme-toggle--desktop, .main-nav__list > .theme-toggle-menu { display: none; }
@media (min-width: 1200px) {
  .header__secondary > .container { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
  .theme-toggle--desktop { display: inline-flex; min-height: 44px; }
}
@media (max-width: 1199px) {
  .main-nav__list > .theme-toggle-menu { display: block; border-bottom: 1px solid #292c31; }
  .theme-toggle--mobile { display: flex; width: 100%; min-height: 54px; padding: 10px 22px; justify-content: space-between; font-size: 12px; }
}

html[data-theme="dark"] { color-scheme: dark; --theme-bg: #12161c; --theme-panel: #1c222b; --theme-raised: #252e39; --theme-border: #3b4654; --theme-text: #e7edf4; --theme-muted: #b3bfcc; --theme-link: #94cfff; background: var(--theme-bg); }
html[data-theme="dark"] body,
html[data-theme="dark"] .site-wrapper,
html[data-theme="dark"] .site-content { background-color: var(--theme-bg); color: var(--theme-text); }
html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6) { color: var(--theme-text); }
html[data-theme="dark"] .site-content a:not(.btn):not(.match-card a):not(.champ__name):not(.bracket-section-switch):not(.player-match-filters a) { color: var(--theme-link); }
html[data-theme="dark"] .site-content a:not(.btn):not(.match-card a):not(.champ__name):not(.bracket-section-switch):not(.player-match-filters a):hover { color: #d0eaff; }
html[data-theme="dark"] :is(.card,.card__content,.widget,.modal-content,.contact-grid,.contact-card,.list-group-item) { background-color: var(--theme-panel); border-color: var(--theme-border); color: var(--theme-text); }
html[data-theme="dark"] .card__header:not(.bracket-section-header):not(.bracket-shell .card__header) { background-color: var(--theme-raised) !important; border-color: var(--theme-border); }
html[data-theme="dark"] :is(.card__footer,.modal-header,.modal-footer,.posts__item,.posts__inner,.widget__content,.contact-card + .contact-card) { border-color: var(--theme-border); }
html[data-theme="dark"] :is(.posts__excerpt,.posts__date,.meta,.widget__title,.text-muted,.player-history-note,.leaderboard-status,.leaderboard-note,.leaderboard-course-key,.leaderboard-table small,.lb-movement) { color: var(--theme-muted); }
html[data-theme="dark"] :is(.sidebar--schedule--event--location,.sidebar--schedule--event--prize-pool,.tournament--information--content--where--date,.tournament--information--content--where--venue--name,.tournament--information--content--events--event--name,.contact-icon) { color: var(--theme-text); }
html[data-theme="dark"] :is(hr,.contact-grid,.leaderboard-controls,.leaderboard-course-key) { border-color: var(--theme-border); }

/* Tables keep their structure and semantic color groups. */
html[data-theme="dark"] .table { color: var(--theme-text); }
html[data-theme="dark"] .site-content .table :is(th,td) { color: var(--theme-text); border-color: var(--theme-border); }
html[data-theme="dark"] .site-content .table thead :is(th,td),
html[data-theme="dark"] .live-leaderboard .leaderboard-table th { background-color: var(--theme-raised); }
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd),
html[data-theme="dark"] .table > tbody > tr.highlighted { background-color: #222b36; }
html[data-theme="dark"] .table-hover > tbody > tr:hover { background-color: #2c3744; color: var(--theme-text); }
html[data-theme="dark"] .leaderboard-table .lb-band-gold { --lb-band-fill: #34301f; }
html[data-theme="dark"] .leaderboard-table .lb-band-gold:nth-child(even) { --lb-band-fill: #3c3522; }
html[data-theme="dark"] .leaderboard-table .lb-band-purple { --lb-band-fill: #2e263d; }
html[data-theme="dark"] .leaderboard-table .lb-band-purple:nth-child(even) { --lb-band-fill: #382d49; }
html[data-theme="dark"] .leaderboard-table .lb-band-pink { --lb-band-fill: #3b2633; }
html[data-theme="dark"] .leaderboard-table .lb-band-pink:nth-child(even) { --lb-band-fill: #462b3b; }
html[data-theme="dark"] :is(.leaderboard-leader,.leaderboard-cut,.leaderboard-course-key b) { color: var(--theme-text); }
html[data-theme="dark"] .player-match-table .player-match-record--win { background-color: #1c382e; }
html[data-theme="dark"] .player-match-table .player-match-record--loss { background-color: #422b31; }
html[data-theme="dark"] .player-match-table.table-hover .player-match-record--win:hover { background-color: #25483b; }
html[data-theme="dark"] .player-match-table.table-hover .player-match-record--loss:hover { background-color: #54333c; }
html[data-theme="dark"] .player-match-table .player-match-record::after { color: rgba(255,255,255,.09); text-shadow: none; }
html[data-theme="dark"] .player-match-table td::before,
html[data-theme="dark"] .player-match-table .player-match-date { color: var(--theme-muted); }
html[data-theme="dark"] .player-match-result--win { color: #92e2ad; }
html[data-theme="dark"] .player-match-result--loss { color: #ffafb7; }
html[data-theme="dark"] .player-match-table tr { border-color: var(--theme-border); }
html[data-theme="dark"] .player-match-filters a[aria-current] { background: #17669c; color: #fff; }

/* Inputs, navigation and dialogs use the same surfaces as the content. */
html[data-theme="dark"] :is(.site-content .form-control,.site-content select,.site-content textarea,.site-content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),.input-group-addon) { background-color: var(--theme-bg); border-color: #657488; color: var(--theme-text); }
html[data-theme="dark"] :is(input,textarea)::placeholder { color: #aab8c7; opacity: 1; }
html[data-theme="dark"] :is(label,legend) { color: var(--theme-text); }
html[data-theme="dark"] .form-control:focus { border-color: #80caff; box-shadow: 0 0 0 2px rgba(56,169,255,.22); }
html[data-theme="dark"] :is(.content-filter,.content-filter__list,.content-filter__item,.nav-tabs,.nav-tabs > li > a,.dropdown-menu,.pagination > li > a,.pagination > li > span,.page-link) { background-color: var(--theme-panel); border-color: var(--theme-border); color: var(--theme-text); }
html[data-theme="dark"] :is(.content-filter__link,.content-filter__link small,.dropdown-item,.nav-tabs .nav-link) { color: var(--theme-muted); }
html[data-theme="dark"] .content-filter__item--active .content-filter__link { color: #fff; }
html[data-theme="dark"] :is(.nav-tabs .nav-link.active,.dropdown-item:hover,.page-link:hover) { background-color: var(--theme-raised); color: #fff; }
html[data-theme="dark"] :is(.btn-default,.btn-outline-secondary,.btn-default.btn-outline) { background-color: var(--theme-raised); border-color: #6b7b8e; color: var(--theme-text); }
html[data-theme="dark"] .btn-primary-inverse { background-color: #2d3b4c; border-color: #526378; color: #e7edf4; }
html[data-theme="dark"] .btn-primary-inverse:is(.active,:hover,:focus) { background-color: #1c6294; border-color: #80caff; color: #fff; }
html[data-theme="dark"] .schedule-calendar-cta .btn { background: linear-gradient(180deg, #354252, #252e39); border-color: #657488; color: var(--theme-text) !important; box-shadow: 0 3px 10px rgba(0,0,0,.25); text-shadow: none; }
html[data-theme="dark"] .schedule-calendar-cta .btn:is(:hover,:focus) { background: #3b4b5e; border-color: #94cfff; }
html[data-theme="dark"] .schedule-calendar-cta .fas { color: var(--theme-text) !important; }
html[data-theme="dark"] .schedule-calendar-menu { background: var(--theme-panel); border-color: var(--theme-border); }
html[data-theme="dark"] .schedule-calendar-menu__item:is(:hover,:focus) { background: var(--theme-raised); color: #fff; }
html[data-theme="dark"] .alert-danger { background: #472b32; border-color: #92525c; color: #ffe0e4; }
html[data-theme="dark"] .alert-success { background: #1c3c2f; border-color: #42785b; color: #d5f5e2; }
html[data-theme="dark"] .alert-info { background: #203a4b; border-color: #477590; color: #d7efff; }

/* Preserve colored bracket headers and winner text; brighten only their paths. */
html[data-theme="dark"] .tournament-bracket__wrapper { background: #171d25; border-color: #3b4654; }
html[data-theme="dark"] .tournament-bracket__round-title { color: var(--theme-text) !important; }
html[data-theme="dark"] .bracket-connector { stroke: #88c7e8; }
html[data-theme="dark"] .bracket-connector--loser { stroke: #f1b781; }
html[data-theme="dark"] .bracket-toggle { background: #1c222b; color: #e7edf4; border-color: #3b4654; }
