#theme-toggle { flex: none; min-width: 40px; min-height: 40px; padding: 4px; font-size: 20px; }
html[data-theme=dark] { color-scheme: dark; }
html[data-theme=dark] body {
  --bg: #101626;
  --ink: #eef2ff;
  --muted: #adbcd8;
  --line: #435472;
  --green: #a8e4cc;
  background: var(--bg);
  color: var(--ink);
}
html[data-theme=dark] body > header,
html[data-theme=dark] :is(.dock,.motion,.judge-card,.team,.team-chat,.create-card,.home-training-row,.profile-section,.profile-overview,.club-overview,.speaker-card,.game-card,.archive-team,.cc-calendar-body,.cc-detail,.cc-cell,.cc-agenda-event,dialog) {
  background-color: #222e49;
  color: #eef2ff;
  border-color: #435472;
}
html[data-theme=dark] :is(.team,.judge-card,.motion,.dock,.create-card,.home-training-row,.cc-detail,dialog) { background-image: none; }
html[data-theme=dark] :is(.secondary,.square,input,textarea,select,.cc-nav button,.cc-day-options button) {
  background: #2a3855;
  color: #eef2ff;
  border-color: #425370;
}
html[data-theme=dark] .primary { background: #355496; color: #fff; }
html[data-theme=dark] :is(.brand .wordmark,.site-nav a,.site-footer a,.cc-detail a:not(.primary),.club-link[href]) { color: #a8c4ff; }
html[data-theme=dark] :is(.cc-month,.cc-day,.timer-circle,.timer-circle strong,.timer-panel select,.team h2,.team h3,.speaker-card strong) { color: #abc5ff; }
html[data-theme=dark] :is(.cc-weekdays,.cc-kicker,.cc-format,.cc-detail-time,.cc-empty,.cc-footer,.cc-agenda-info small,.game-info,.muted,.profile-login) { color: #adbcd8; }
html[data-theme=dark] :is(.cc-cell.cc-other,.cc-week-label) { background: #151d30; border-color: #435472; }
html[data-theme=dark] :is(.cc-cell.cc-selected,.cc-agenda-event[aria-pressed=true]) { background: #233452; }
html[data-theme=dark] .cc-event { background: #253a60; color: #dbe8ff; }
html[data-theme=dark] #home-open-calendar .cc-event-tournament:not(.cc-event-finished) { background: #392b53; color: #f2dfff; }
html[data-theme=dark] .cc-event-finished { background: #2c3449; color: #bcc6dc; }
html[data-theme=dark] #home-open-calendar .cc-history-player { background: #263d63; color: #d4e3ff; }
html[data-theme=dark] #home-open-calendar .cc-history-judge { background: #21473f; color: #c7f5e4; }
html[data-theme=dark] .cc-event small { color: #bdcbe8; }
html[data-theme=dark] .cc-cell { border-color: #435472; }
html[data-theme=dark] :is(.cc-status,.cc-role,.judge-symbol) { background: #273754; color: #d5e4ff; }
html[data-theme=dark] .cc-tournament-meta { color: #adbcd8; }
html[data-theme=dark] :is(.form-error,.logout-button) { color: #ffb4bc; }

/* Club styles retain their artwork while using dark profile surfaces. */
html[data-theme=dark] body {
  --profile-gradient: linear-gradient(115deg,#222e49 25%,#24375b);
  --profile-soft: #2a3855;
  --profile-border: #435472;
  --profile-accent: #a8c4ff;
}
html[data-theme=dark] #profile-page :is(.profile-section,.profile-overview,.speaker-card),
html[data-theme=dark] #private-speaker-statistics {
  background-color: #222e49;
  border-color: #435472;
}
html[data-theme=dark] #profile-page :is(.pencil-button,.club-role-badge,.score-round-card,.score-round-value) {
  background: #253451;
  color: #eef2ff;
  border-color: #425370;
}
html[data-theme=dark] #profile-page .score-round-card:hover { background: #2d4165; }
html[data-theme=dark] #profile-page .score-round-info small { color: #adbcd8; }
html[data-theme=dark] #profile-page .score-delta.positive { color: #a8e4cc; }
html[data-theme=dark] #profile-page .score-delta.negative { color: #ffb4bc; }
html[data-theme=dark] #profile-page .score-delta.neutral { color: #adbcd8; }
html[data-theme=dark] #profile-page .logout-button { background: #382637; border-color: #704856; }
html[data-theme=dark] #profile-page .club-link[href] { color: #a8c4ff; }

html[data-theme=dark] :is(#club-page,#profile-page) .club-calendar { background: transparent; }
html[data-theme=dark] :is(#club-page,#profile-page) :is(.profile-section h2,.cc-nav button,.cc-owner a,.cc-capacity strong) { color: #a8c4ff; }
html[data-theme=dark] :is(#club-page,#profile-page) :is(.profile-section,.cc-owner,.cc-footer,.cc-undated,.cc-nav button) { border-color: #435472; }
html[data-theme=dark] :is(#club-page,#profile-page) .cc-cell.cc-selected { background: #233452; }
html[data-theme=dark] :is(#club-page,#profile-page) .cc-event:not(.cc-event-finished) { background: #253a60; color: #dbe8ff; }
html[data-theme=dark] :is(#club-page,#profile-page) .cc-status { background: #273754; color: #d5e4ff; }
html[data-theme=dark] .cc-nav .cc-add-game { background: #355496; color: #fff; }
html[data-theme=dark] .cc-spots span:not(.filled) { background: #435472; }
html[data-theme=dark] :is(.cc-day[aria-pressed=true],.cc-day-options button[aria-pressed=true]) { background: #355496; color: #fff; }
html[data-theme=dark] .cc-registered { background: #21473f; color: #c7f5e4; }

html[data-theme=dark] :is(#club-page,#profile-page) :is(.speaker-card,.club-open-button),
html[data-theme=dark] :is(#game-dialog .pencil-button,#game-dialog .allocation-entry,#copy-code,#room-format,.room-options summary,.room-options-menu) {
  background: #2a3855;
  color: #dbe8ff;
  border-color: #425370;
}
html[data-theme=dark] :is(#club-page,#profile-page) .speaker-card:hover,
html[data-theme=dark] .room-options-menu button:hover { background: #293a58; }
html[data-theme=dark] :is(#club-page,#profile-page) .speaker-card.club-role-leader {
  background: #302740;
  border-color: #735e90;
}
html[data-theme=dark] :is(#club-page,#profile-page,#game-dialog) .speaker-card small,
html[data-theme=dark] #game-dialog :is(.eyebrow,.allocation-entry>small,.allocation-table-heading>span,.text-button) { color: #adbcd8; }
html[data-theme=dark] :is(.profile-avatar,.allocation-initials,.club-role-badge) { background: #273754; color: #d5e4ff; }
html[data-theme=dark] .club-role-leader .club-role-badge { background: #473356; color: #ead5fa; }
html[data-theme=dark] :is(.club-member-remove,#leave.room-leave) { background: #382637; border-color: #704856; color: #ffb4bc; }
html[data-theme=dark] #leave.room-leave:hover { background: #4c2b40; }

html[data-theme=dark] #game-dialog :is(h2,h3,h4,.allocation-person b) { color: #eef2ff; }
html[data-theme=dark] #game-dialog :is(.game-registration-section,.game-registration-share,.table-allocation,.archive-team,.team-registration-row) { border-color: #425370; }
html[data-theme=dark] #game-dialog .team-registration-row { background: #2a3855; }
html[data-theme=dark] #game-dialog :is(.allocation-pool,.allocation-slot) {
  background: #151d30;
  color: #b8c9ec;
  border-color: #526686;
}
html[data-theme=dark] #game-dialog .allocation-table { border-inline-color: #425370; border-bottom-color: #425370; }
html[data-theme=dark] #game-dialog .allocation-entry.selected { border-color: #8eaff7; box-shadow: 0 0 0 2px #3a527f; }
html[data-theme=dark] #game-dialog .allocation-remove { color: #ffb4bc; }
html[data-theme=dark] .round-step { background: #222e49; border-color: #425370; border-left-color: #759cf2; }
html[data-theme=dark] .round-step p { color: #adbcd8; }
html[data-theme=dark] .room-options-menu button { color: #eef2ff; }

html[data-theme=dark] #room :is(.round-step,.motion,.judge-card,.team) {
  background-color: #222e49;
  border-color: #4a5d80;
}
html[data-theme=dark] #room .round-step { border-left-color: #8aafff; }
html[data-theme=dark] #room :is(.team,.motion,.judge-card) .secondary {
  background-color: #18243d;
  border-color: #526686;
}

html[data-theme=dark] :is(.home-training-row,.profile-section,.profile-overview,.club-overview,.cc-detail,.cc-calendar-body,.judge-card,.motion,.team,.dock,.team-chat,dialog) {
  box-shadow: 0 4px 16px #080d1940;
}
html[data-theme=dark] :is(.game-registration-section,.table-allocation,.archive-team,.allocation-table,.registration-confirmation,.cc-undated,.cc-undated button) {
  background-color: #222e49;
  border-color: #526686;
  color: #eef2ff;
}
html[data-theme=dark] #game-dialog :is(.allocation-pool,.allocation-slot) { background-color: #2a3855; }

html[data-theme=dark] #room :is(#judge-select,.call-summary,#people > *, .seat button,.durations,.poi,.prep-entry:disabled) {
  background: #2a3855;
  color: #dbe8ff;
  border-color: #526686;
}
html[data-theme=dark] #room :is(.durations .selected,.seat button:hover) {
  background: #435f95;
  color: #fff;
}
html[data-theme=dark] #room .seat.active { background: #42345e; }
html[data-theme=dark] #room .seat.active .seat-copy b { color: #f0deff; }
html[data-theme=dark] #room .opp .avatar { background: #42345e; color: #e5d4ff; }
html[data-theme=dark] #room :is(.prep-entry,.poi):disabled {
  background: #25324c;
  color: #aebfdf;
  opacity: 1;
}
html[data-theme=dark] #toast {
  background: #293d60;
  color: #fff;
  border: 1px solid #6884b4;
}

html[data-theme=dark] .club-calendar .cc-day.cc-today:not([aria-pressed=true]) {
  background: #293d60;
  color: #eef2ff;
  box-shadow: inset 0 0 0 1px #809bd0;
}
html[data-theme=dark] .club-calendar .cc-delete-game {
  background: #382637;
  color: #ffb4bc;
  border-color: #704856;
}
html[data-theme=dark] .club-calendar .cc-delete-game:hover { background: #4c2b40; }

html[data-theme=dark] .site-footer {
  background: #222e49;
  border-color: #435472;
}

html[data-theme=dark] #tournaments-page .tournament-card {
  background: #222e49;
  color: #eef2ff;
  border-color: #435472;
}
html[data-theme=dark] :is(.tournament-team,.tournament-partner,.tournament-person) {
  background: #2a3855;
  color: #eef2ff;
  border-color: #526686;
}
html[data-theme=dark] .tournament-person:hover { background: #354766; }
html[data-theme=dark] body[class*="club-theme-"] :is(#club-page,#profile-page) .speaker-card:not(.club-role-leader) {
  background: #2a3855;
  border-color: #526686;
}
html[data-theme=dark] body[class*="club-theme-"] :is(#club-page,#profile-page) .speaker-card:not(.club-role-leader):hover {
  background: #354766;
  border-color: #809bd0;
}

html[data-theme=dark] #room .team.result-place-1 { --result-panel: #203b36; --result-edge: #568978; --result-badge: #315d50; --result-text: #c1f3da; }
html[data-theme=dark] #room .team.result-place-2 { --result-panel: #203848; --result-edge: #557e9c; --result-badge: #305672; --result-text: #d1edff; }
html[data-theme=dark] #room .team.result-place-3 { --result-panel: #3a3324; --result-edge: #96804b; --result-badge: #65512b; --result-text: #fff0bd; }
html[data-theme=dark] #room .team.result-place-4 { --result-panel: #3e2936; --result-edge: #926175; --result-badge: #643e50; --result-text: #ffd7e5; }
html[data-theme=dark] #room .team:is(.result-place-1,.result-place-2,.result-place-3,.result-place-4) {
  background-color: var(--result-panel);
  border-color: var(--result-edge);
}
html[data-theme=dark] #room .team-place {
  background: var(--result-badge, #2a3855);
  color: var(--result-text, #eef2ff);
}
html[data-theme=dark] #room .seat-score-number { color: #eef2ff; }

html[data-theme=dark] #game-dialog .allocation-person :is(img,.allocation-initials) {
  border: 1px solid #809bd0;
}
html[data-theme=dark] #game-dialog .allocation-initials {
  background: #405780;
  color: #f4f7ff;
}

html[data-theme=dark] .judge-card #wing-panel { border-top-color: #526686; }
html[data-theme=dark] #wing-panel .wing-person {
  background: #2a3855;
  color: #eef2ff;
  border-color: #526686;
}
html[data-theme=dark] #wing-panel .wing-person.mic-on {
  background: #21473f;
  border-color: #629e88;
}
html[data-theme=dark] #wing-panel :is(.avatar,.avatar-reaction) {
  background: #405780;
  color: #eef2ff;
}

html[data-theme=dark] .timer-circle.speech-overtime { background: #402832; }

html[data-theme=dark] #room .preparation-clock{background:#293c59;border:1px solid #56749b;color:#dbe8ff}
html[data-theme=dark] #room .preparation-clock strong{color:#e4edff}
html[data-theme=dark] #room .preparation-clock :is(p,span){color:#c4d1e8}
html[data-theme=dark] #room #mic{background:#482e39;color:#ffc6ce;border-color:#98606e}
html[data-theme=dark] #room #mic.raised,
html[data-theme=dark] #room .judge-mic-status{background:#214e40;color:#c7f5dd;border-color:#619e83}
html[data-theme=dark] #wing-panel .wing-person>span:not(.avatar){background:#2d5e4e;color:#d7ffe8;border-radius:8px;padding:6px 9px}
