/* 语义色覆盖置于各模块样式之后；不对 img/video/canvas 使用滤镜，保留作品原色。 */
:root[data-theme="light"] { color-scheme:light; }
html[data-theme="dark"] .announcement-toolbar { --ui-accent-soft: var(--blue-soft); }
:root[data-theme="dark"] {
  color-scheme:dark;
  --ink:#e5ecf5; --muted:#a7b5c9; --subtle:#8d9eb6;
  --line:#303e52; --line-strong:#455a76; --paper:#101722; --white:#192330;
  --paper-warm:#27251d; --blue:#78a7ff; --blue-soft:#213959;
  --portal-blue:#80adff; --portal-blue-deep:#a2c3ff; --portal-surface:#151f2d; --portal-line:#303e52;
  --aw-text:#e5ecf5; --aw-muted:#a7b5c9; --aw-line:#303e52; --aw-soft:#202c3d; --aw-blue:#80adff;
  --shadow:0 18px 44px #0005; --shadow-soft:0 10px 26px #0003;
}
.appearance-options { display:flex; gap:6px; padding:6px 8px 12px; }
.appearance-options[hidden] { display:none !important; }
#userAccountMenu .appearance-options button { flex:1; justify-content:center; padding:9px 5px; min-height:34px; font-size:12px; border:1px solid var(--line); border-radius:7px; background:var(--white); color:var(--muted); }
#userAccountMenu .appearance-options button[aria-checked="true"] { background:var(--blue-soft); color:var(--blue); border-color:var(--blue); }
.admin-forgot-password { display:block; justify-self:end; margin:0; padding:6px 0; border:0; background:transparent; color:var(--blue); font:inherit; font-size:13px; cursor:pointer; }
html[data-theme="dark"] body { background:#101722 !important; color:var(--ink); }
/* 固定壳层、表单和内容容器使用独立深色表面，海报/视频/文章嵌入图像不参与覆盖。 */
html[data-theme="dark"] body :is(.topbar,.conversation-rail,.user-account-menu,.account-menu,.notification-panel,.notification-popover,.contact-popover,.membership-sidebar,.profile-sidebar,.case-sidebar,.case-library-sidebar,.library-sidebar,.sim-lobby,.defense-setup-form,.defense-setup-aside,.defense-room-header,.defense-review-panel,.defense-toolbar,.beta-card,.modal-card,.dialog-card,.admin-login-card,.admin-header,.admin-topbar) {
  background:#192330 !important; color:var(--ink) !important; border-color:var(--line) !important;
}
html[data-theme="dark"] body :is(.panel,.membership-panel,.membership-plan-card,.billing-recharge-card,.account-menu-balance,.membership-invite-card,.library-card,.home-section,.consultation-scenario,.consultation-starter-card,.consultation-composer-shell,.ppt-workbench-input-panel,.ppt-creation-center,.ppt-creation-card,.creation-record,.ppt-creation-record,.image-prompt-editor,.image-instruction-box,.sim-lobby-room,.defense-room-panel,.admin-content-panel,.admin-stat-card,.admin-content-editor,.admin-list-card,.admin-contact-preview,.contact-qr-frame,.beta-waiting,dialog,.modal-content) {
  background:#192330 !important; color:var(--ink) !important; border-color:var(--line) !important; box-shadow:none;
}
html[data-theme="dark"] body :is(.material-workspace,.workspace-main,.material-main,.membership-main,.membership-page,.case-library-main,.case-library-content,.library-content,.sim-hall,.simulation-workspace,.defense-room,.admin-main,#adminWorkspace,#page-admin,#page-billing,#page-user,#simHall,#simLobby,#defenseSetup,#defenseRoom,#pptCreationGallery,#pptCreationCenter) { background-color:#101722 !important; color:var(--ink); }
html[data-theme="dark"] body :is(.material-form,.consultation-workspace,.consultation-main,.ppt-workspace,.ppt-studio,.ppt-workbench,.ppt-creation-gallery,.membership-hero,.membership-summary,.billing-section-heading,.admin-panel-head,.case-admin-list,.case-editor-form,.article-editor-form,.article-editor-sidebar,.article-rich-editor,.article-rich-toolbar,.admin-table,.admin-table-wrap,.admin-list-heading) { background-color:#192330 !important; color:var(--ink) !important; border-color:var(--line) !important; }
html[data-theme="dark"] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),textarea,select,[contenteditable="true"]) { background-color:#121d2b !important; color:#e5ecf5 !important; border-color:#3b4c63 !important; caret-color:#a7c7ff; }
html[data-theme="dark"] body :is(input,textarea)::placeholder { color:#8d9eb6 !important; }
html[data-theme="dark"] body :is(h1,h2,h3,h4,h5,label,.membership-plan-card > strong,.billing-recharge-card span,.billing-recharge-card strong,.membership-balance strong,.account-menu-name,.account-menu-balance strong,.library-card-title,.sim-lobby-room strong) { color:#e5ecf5 !important; }
html[data-theme="dark"] body :is(.membership-main,.ppt-workbench-input-panel,.ppt-creation-center,.account-menu,.user-account-menu,.admin-content-panel,.beta-card,.contact-popover,.library-card) :is(p,small,.muted) { color:#a7b5c9 !important; }
html[data-theme="dark"] body :is(.membership-main,.ppt-creation-center,.ppt-workbench-input-panel,.defense-setup-form,#userAccountMenu,#adminWorkspace) button:not(.primary):not([type="submit"]):not(.active):not([aria-checked="true"]):not([aria-selected="true"]) { background-color:#202d40 !important; color:#cad8ec !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] body :is(.button.primary,button[type="submit"],.membership-plan-card.featured button) { background:#246ae1 !important; color:#fff !important; border-color:#4487fa !important; }
html[data-theme="dark"] body :is(.active,.featured,[aria-selected="true"]) { border-color:#5e91e3; }
html[data-theme="dark"] body :is(.main-nav a.active,.nav-slider,.rail-slider,.new-chat-button.active,.membership-nav button.active,.defense-mode-options button.active,.appearance-options button[aria-checked="true"]) { background:#213959 !important; color:#94bbff !important; }
html[data-theme="dark"] body :is(.membership-main,.ppt-creation-center,#adminWorkspace) :is(th,.table-header,.list-header) { background:#202d40 !important; color:#afc0d7 !important; border-color:#303e52 !important; }
html[data-theme="dark"] body :is(.membership-main,.ppt-creation-center,#adminWorkspace) :is(td,tr,.panel-head,.case-admin-row,.article-admin-row,.billing-order-row) { border-color:#303e52 !important; }
html[data-theme="dark"] body :is(.topbar,.membership-main,.ppt-workbench-input-panel,.ppt-creation-center,.conversation-rail,#userAccountMenu) button:hover { filter:brightness(1.12); }
html[data-theme="dark"] body .contact-qr-frame img { background:#fff; }
html[data-theme="dark"] body :is(.beta-description,.beta-note,.beta-footer,.beta-brand small,.beta-card label) { color:#a7b5c9 !important; }
html[data-theme="dark"] body :is(.auth-message,.form-message,.beta-message) { color:#ffb0bc; }
@media(prefers-reduced-motion:no-preference) { .appearance-options button { transition:background-color .15s,color .15s,border-color .15s; } }

/* 后台模块在自身作用域重声明了色板，因此深色模式也在同一作用域赋值。 */
html[data-theme="dark"] #page-admin #adminWorkspace .admin-view {
 --aw-text:#e5ecf5; --aw-muted:#a7b5c9; --aw-line:#303e52; --aw-soft:#202c3d; --aw-blue:#80adff;
}
html[data-theme="dark"] body :is(.topbar .brand,.topbar .brand strong,.topbar .main-nav a,.membership-sidebar-title,.membership-menu-group button,.membership-identity strong,.account-menu-profile strong,.account-menu-balance-button) { color:#dce7f7 !important; }
html[data-theme="dark"] body :is(.topbar .notification-entry,.topbar .member-entry,.topbar .header-account-pill,.topbar .header-credit-entry,.topbar .user-avatar-toggle,.membership-invite,.membership-overview-card,.membership-badge) { background-color:#202d40 !important; color:#dce7f7 !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] #page-billing :is(.membership-menu-group button.active,.membership-plan-card.featured,.billing-recharge-card.active) { background-color:#213959 !important; color:#a7c7ff !important; }
html[data-theme="dark"] body .membership-main :is(strong,b):not(#creditBalance) { color:#e5ecf5 !important; }
html[data-theme="dark"] body :is(.topbar .user-account,.topbar .header-plan-badge) { background:#202d40 !important; color:#afc0d7 !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] body .membership-invite strong { color:#e5ecf5 !important; }
html[data-theme="dark"] body :is(.membership-menu-group svg,.topbar-search,.search-toggle) { color:#afc0d7 !important; }
html[data-theme="dark"] #page-billing :is(.membership-sidebar-title,.membership-plan-card > div) { border-color:#303e52 !important; }
/* 各业务页保留图片原色，仅切换承载图片的页面与卡片表面。 */
html[data-theme="dark"] body :is(.ppt-visual-studio,.defense-studio,#page-case,.admin-app-shell) { background-color:#101722 !important; color:#e5ecf5 !important; }
html[data-theme="dark"] body :is(.case-left-nav,.creation-center-head,.creation-card,.profile-account-band,.profile-panel,.contest-side-card,.home-article-card,.admin-workspace-header,.admin-file-picker,.image-instruction-editor,.ppt-workbench-style-button) { background-color:#192330 !important; color:#e5ecf5 !important; border-color:#303e52 !important; }
html[data-theme="dark"] body :is(.assistant-nav-indicator,.ppt-workbench-task-switch,.creation-center-tabs,.image-generation-switch,.image-segmented,.defense-setup-options > label,.defense-training-options > label,.sim-human-count,.creation-cover-empty) { background-color:#202d40 !important; color:#afc0d7 !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] body :is(.creation-card,.creation-center-head,.profile-account-band,.profile-panel,.home-article-card,.contest-side-card,.defense-setup-form,.sim-lobby-room) :is(strong,b,a) { color:#e5ecf5 !important; }
html[data-theme="dark"] body :is(.creation-card,.profile-panel,.profile-account-band,.home-article-card,.contest-side-card,.defense-setup-form,.sim-lobby-room) :is(p,small,span:not(.button):not(.sim-status)) { color:#a7b5c9; }
html[data-theme="dark"] body :is(.case-left-nav,.profile-sidebar,.contest-side-card,.contest-hall-tabs,.case-library-content) button:not(.active):not(.primary) { background-color:#202d40 !important; color:#cad8ec !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] body :is(.case-left-nav,.profile-sidebar,.contest-side-card,.contest-hall-tabs) button.active { background-color:#213959 !important; color:#94bbff !important; }
html[data-theme="dark"] body .home-hero { background:#192330 !important; border-color:#303e52 !important; }
html[data-theme="dark"] body .home-hero::before { background:#192330; }
html[data-theme="dark"] body .home-hero-visual::before { background:linear-gradient(90deg,#192330,transparent 70%); }
html[data-theme="dark"] body :is(.home-hero-copy p,.case-library-hero p,.contest-hall-hero p) { color:#afc0d7 !important; }
html[data-theme="dark"] body .case-library-hero { background-color:#192330; }
html[data-theme="dark"] body :is(.contest-hall-hero,.teacher-hall-hero) { background-image:linear-gradient(90deg,#192330 0%,#192330ed 38%,#19233055 80%),url('../assets/contest-hall-hero-trophy.png') !important; }
html[data-theme="dark"] body #pptWorkbench.image-generator-mode #pptWorkbenchGenerate { border-color:#192330 !important; outline-color:#192330; box-shadow:0 -8px 20px #192330; }
html[data-theme="dark"] #page-material .new-chat-button,
html[data-theme="dark"] #page-material :is(.ppt-field > span,.ppt-workbench-style-trigger strong,.ppt-workbench-style-label,.image-generation-settings h3),
html[data-theme="dark"] #defenseStudio :is(.defense-mode-field > span,.defense-setup-form label > span,.defense-section-title strong) { color:#c7d7ec !important; }
html[data-theme="dark"] #defenseStudio { --sim-line:#303e52; --sim-text:#e5ecf5; --sim-muted:#a7b5c9; }
html[data-theme="dark"] #defenseStudio .sim-arrangement label { background:#202d40 !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] #defenseStudio :is(.sim-setup-header button,.sim-lobby-status button) { background:#202d40 !important; color:#cad8ec !important; border-color:#3b4c63 !important; }
html[data-theme="dark"] body :is(#pptWorkbenchGenerate,#defenseCreate) { background:#246ae1 !important; color:#fff !important; border-color:#4487fa !important; }
html[data-theme="dark"] #page-material .ppt-workbench-task-switch button.active { background:#213959 !important; color:#94bbff !important; }
html[data-theme="dark"] body :is(.creation-card footer,.creation-card-prompt,.creation-record-detail,.image-instruction-editor > header,.image-instruction-editor > footer) { border-color:#303e52 !important; }
