/* Shared theme control; light mode preserves the existing site design. */
header .nav nav button.theme-toggle {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  margin: 0 0 0 10px;
  padding: 0;
  border: 1px solid #cfd5da;
  border-radius: 50%;
  background: #f5f6f7;
  color: #28333d;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
header .nav nav button.theme-toggle:hover {background:#e6eaee;border-color:#87939e}
header .nav nav button.theme-toggle:focus-visible {outline:3px solid #3c6b91;outline-offset:3px}
.theme-toggle svg {display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .theme-sun {display:none}
html[data-theme="dark"] {color-scheme:dark;--ink:#d6dfe8;--line:#354252;--blue:#91c8ff;--dark:#182330}
html[data-theme="dark"] .theme-toggle .theme-moon {display:none}
html[data-theme="dark"] .theme-toggle .theme-sun {display:block}
html[data-theme="dark"] header .nav nav button.theme-toggle {background:#233140;border-color:#435469;color:#f1cc78}
html[data-theme="dark"] header .nav nav button.theme-toggle:hover {background:#304153;border-color:#7c8da2}
html[data-theme="dark"] body,html[data-theme="dark"] body main {background:#101720!important;color:#d6dfe8!important}
html[data-theme="dark"] body header {background:#151e29!important;border-color:#354252!important}
html[data-theme="dark"] body header :is(nav>a,.account-trigger,.logout-nav-button,.profile-nav-link) {color:#e4ebf2!important}
html[data-theme="dark"] body header .brand {background:#fff!important;border-radius:6px!important;padding:4px 6px!important}
html[data-theme="dark"] body .account-dropdown {background:#1c2835!important;border-color:#435469!important}
html[data-theme="dark"] body .account-dropdown a {color:#e4ebf2!important}
html[data-theme="dark"] body .account-dropdown a:hover {background:#2a394a!important}
html[data-theme="dark"] body .site-footer {background:#0b1119!important;color:#cad4df!important}
html[data-theme="dark"] body main :is(h1,h2,h3,h4,strong,b) {color:#edf2f7!important}
html[data-theme="dark"] body main :is(p,.body,.notice-detail-body,.about-copy,.eyebrow,.muted,.notice-card-meta,.notice-card-index) {color:#b7c4d2!important}
html[data-theme="dark"] body main :is(.notice-board-heading,.ctf-section-heading,.profile-progress h2,.about-people-section) {border-color:#354252!important}
html[data-theme="dark"] body :is(.about-intro,.auth-page,.login-page) {background:#101720!important}
html[data-theme="dark"] body main :is(.about-intro-card,.notice-card,.notice-empty-card,.notice-detail,.notice-detail-header,.auth-panel,.login-panel,.card,.sidebar-panel,.sidebar-profile,.wargame-set-card,.wargame-activity-card,.wargame-featured-pack-card,.wargame-collection-info-card,.wargame-collection-hero,.wargame-collection-progress,.ctf-overview-card,.ctf-detail-hero,.ctf-detail-summary,.ctf-detail-facts>div,.ctf-challenge-slot,.ctf-challenge-card-link,.stats>div,.message) {
  background:#1b2633!important;
  border-color:#435163!important;
  color:#d6dfe8!important;
}
html[data-theme="dark"] body main :is(.notice-card,.wargame-set-card,.wargame-activity-card,.card):hover {background:#223140!important;border-color:#71869c!important}
html[data-theme="dark"] body main :is(.notice-title,.notice-table-row,.home-challenge-row,.wargame-collection-row,.wargame-collection-row-main strong,.sidebar-profile-name,.sidebar-score-row,.wargame-featured-pack-action,.wargame-featured-pack-copy strong) {color:#e0e8f0!important;border-color:#354252!important}
html[data-theme="dark"] body main :is(.notice-table-wrap,.home-notice-row,.home-challenge-row,.round-browser,.round-directory,.wargame-collection-list) {background:#1b2633!important;border-color:#435163!important}
html[data-theme="dark"] body main :is(.platform-hero,.wargame-hero,.wargame-search-hero,.home-feature-slide) {background:linear-gradient(115deg,#1b2633,#202f3e)!important;border-color:#435163!important}
html[data-theme="dark"] body.home-page .home-feature-carousel {background:linear-gradient(120deg,#101720,#182330)!important;border-color:#354252!important}
html[data-theme="dark"] body.home-page .home-feature-carousel::before,html[data-theme="dark"] body.home-page .home-feature-carousel::after {opacity:.12}
html[data-theme="dark"] body main :is(.platform-hero-brand,.home-feature-brand,.platform-hero-metrics>div,.home-feature-metrics>div) {color:#b7c4d2!important;border-color:#435163!important}
html[data-theme="dark"] body main :is(.platform-hero-metrics span,.home-feature-metrics span,.card small,.card .meta,.stats small,.ctf-detail-facts dt,.ctf-detail-facts dd) {color:#b7c4d2!important}
html[data-theme="dark"] body main :is(.platform-hero-action,.home-feature-action,.leaderboard-title-badge,.leaderboard-tabs a,.wargame-page-badge,.notice-heading-badge,.challenge-category-heading) {border-color:#526277!important}
html[data-theme="dark"] body main :is(.ctf-language-button,.challenge-control,.search-controls button) {background:#243344!important;border-color:#526277!important;color:#edf2f7!important}
html[data-theme="dark"] body main .ctf-language-button[aria-pressed="true"] {border-color:#d0ad55!important}
html[data-theme="dark"] body main :is(input,select,textarea) {background:#111b26!important;border-color:#526277!important;color:#edf2f7!important}
html[data-theme="dark"] body main :is(input,textarea)::placeholder {color:#91a0b2!important;opacity:1}
html[data-theme="dark"] body main :is(label,.auth-panel h1,.login-links,.auth-links,.form-wrap,.auth-field,.auth-panel .helptext) {color:#d6dfe8!important}
html[data-theme="dark"] body main :is(.leaderboard-table-wrap,table,.notice-table) {background:#1b2633!important;border-color:#435163!important;color:#d6dfe8!important}
html[data-theme="dark"] body main table th {background:#111b26!important;border-color:#354252!important;color:#b7c4d2!important}
html[data-theme="dark"] body main table tbody td {background:#1b2633!important;border-color:#354252!important;color:#d6dfe8!important}
html[data-theme="dark"] body main table tbody tr:nth-child(even) td {background:#202d3b!important}
html[data-theme="dark"] body main table tbody tr:hover td {background:#293a4b!important}
html[data-theme="dark"] body main table td a,html[data-theme="dark"] body main .body a {color:#91c8ff!important}
html[data-theme="dark"] body main :is(.ctf-panel-kicker,.ctf-event-next-kicker,.ctf-empty-status,.wargame-eyebrow) {color:#d0ad55!important}
html[data-theme="dark"] body main .about-person-card :is(p,h2) {color:#e0e8f0!important}
html[data-theme="dark"] body .about-intro-card .about-image img {filter:invert(1);mix-blend-mode:screen}
@media(max-width:760px) {
  header .nav {position:relative}
  header .nav nav button.theme-toggle{position:absolute;top:12px;right:15px;flex-basis:32px;width:32px;height:32px;min-height:32px;margin:0}
}
@media(prefers-reduced-motion:reduce) {header .nav nav button.theme-toggle{transition:none}}
