/* 仅替换燕园红强调色。页面底色、白色卡片、普通正文、表格、边框和布局保持原样；现场大屏不引入本文件。 */
:root {
  color-scheme: light;
  --theme-accent: #9b2432;
  --theme-accent-hover: #831e2b;
  --theme-accent-text: #8e2130;
  --theme-accent-soft: #f9e9ec;
  --theme-accent-ring: #9b243224;
  --theme-accent-border: #c9a8b0;
  --theme-on-accent: #ffffff;
  --theme-sidebar: #701c28;
  --theme-sidebar-end: #701c28;
  --theme-sidebar-soft: #e5b7bf;
  --theme-login-start: #961f33;
  --theme-login-end: #741528;
  --theme-login-soft: #e7bec5;
  --theme-focus: #c56f7a;
}
:root[data-theme="dark"] {
  --theme-accent: #0d1117;
  --theme-accent-hover: #000000;
  --theme-accent-text: #0d1117;
  --theme-accent-soft: #eeeeee;
  --theme-accent-ring: #0d111724;
  --theme-accent-border: #a9a9a9;
  --theme-sidebar: #0d1117;
  --theme-sidebar-end: #0d1117;
  --theme-sidebar-soft: #dedede;
  --theme-login-start: #0d1117;
  --theme-login-end: #0d1117;
  --theme-login-soft: #e3e3e3;
  --theme-focus: #666666;
}
:root[data-theme="blue"] {
  --theme-accent: #1f4079;
  --theme-accent-hover: #050cad;
  --theme-accent-text: #1f4079;
  --theme-accent-soft: #eff0fd;
  --theme-accent-ring: #1f407924;
  --theme-accent-border: #a3a7f9;
  --theme-sidebar: #1f4079;
  --theme-sidebar-end: #1f4079;
  --theme-sidebar-soft: #e0e3fe;
  --theme-login-start: #1f4079;
  --theme-login-end: #1f4079;
  --theme-login-soft: #e0e3fe;
  --theme-focus: #6970f2;
}

/* 原样式中的 --green 在管理端也是品牌红，并非成功状态绿色。 */
html:not([data-theme="red"]) {
  --red: var(--theme-accent);
  --red-dark: var(--theme-accent-hover);
  --wine: var(--theme-accent);
  --green: var(--theme-accent);
}

/* 主按钮、焦点和勾选控件。 */
html:not([data-theme="red"]) :is(button.primary, .btn.primary, .submit, .score-submit, .ec-primary, .numeric-keypad-grid .keypad-action, .projects-list button.active) {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) :is(button.primary, .btn.primary, .submit, .score-submit, .ec-primary):hover:not(:disabled) {
  background: var(--theme-accent-hover);
  border-color: var(--theme-accent-hover);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) :is(.layout, dialog, .ec-modal, .ec-template-dialog) button:hover:not(:disabled):not(.primary):not(.ec-primary):not(.keypad-action):not(.theme-choice):not(.theme-switch) {
  background: var(--theme-accent-soft);
}
html:not([data-theme="red"]) :is(button, a, input, select, textarea):focus-visible {
  outline-color: var(--theme-focus);
}
html:not([data-theme="red"]) :is(input, select, textarea):focus {
  border-color: var(--theme-accent);
  outline-color: var(--theme-focus);
}
html:not([data-theme="red"]) :is(input[type="checkbox"], input[type="radio"], .ec-check input, .ec-format-list input, .ec-judges input, .ec-preview-options input) {
  accent-color: var(--theme-accent);
}
html:not([data-theme="red"]) :is(button.danger, .btn.danger, .danger-text, .ec-danger, .ec-invalid, .ec-template-error) {
  color: var(--theme-accent-text);
}

/* 管理端：只换侧栏、红色文字、红色按钮和浅红选中状态。 */
html:not([data-theme="red"]) :is(aside, .sidebar) {
  background: var(--theme-sidebar);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) :is(.sidebar .brand, .sidebar .nav button, .sidebar .side-link) {
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) :is(.sidebar .brand small, .sidebar .workspace, .sidebar .aside-note) {
  color: var(--theme-sidebar-soft);
}
html:not([data-theme="red"]) :is(.admin-avatar, .progress span, .bar-fill, .screen-template-image span) {
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) button.admin-logout {
  background: #ffffff;
  color: var(--theme-accent-text);
  border-color: var(--theme-accent-border);
}
html:not([data-theme="red"]) :is(.eyebrow, .finalist-result, .letter-canvas-heading) {
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) :is(.tag, .badge:not(.gray):not(.open), .live-order) {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) :is(.tabs button.active, .letter-types button.active, .letter-text-selector button.active) {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) :is(.finalist-score.score-changed, .finalist-score[aria-invalid="true"]) {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent);
}
html:not([data-theme="red"]) :is(.screen-template-card:hover, .screen-template-card.active) {
  border-color: var(--theme-accent);
}
html:not([data-theme="red"]) #toast {
  background: var(--theme-sidebar);
  color: var(--theme-on-accent);
}

/* 函件编辑器的红色选择控制随主题变化，信纸画布及导出文件不变。 */
html:not([data-theme="red"]) :is(.letter-live-block:hover, .letter-live-block.selected) {
  border-color: var(--theme-accent-border);
}
html:not([data-theme="red"]) .letter-live-block.selected {
  box-shadow: 0 0 0 1px var(--theme-accent-ring);
}
html:not([data-theme="red"]) :is(.letter-live-title:focus, .letter-live-body:focus, #letter-live-signature-text:focus) {
  box-shadow: inset 0 0 0 1px var(--theme-accent-border);
}
html:not([data-theme="red"]) .letter-text-drag-handle {
  border-color: var(--theme-accent-border);
  background-image: radial-gradient(circle, var(--theme-accent) 1px, transparent 1.2px);
}
html:not([data-theme="red"]) .letter-text-drag-handle:focus {
  outline-color: var(--theme-focus);
}

/* 评委端和选手端：普通白色工作区不变。 */
html:not([data-theme="red"]) :is(.badge:not(.open):not(.gray), .score-card-status) {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) :is(.score-card-head h3, .score-rule-line strong, .total-score-field>label span, #review-completion-message, .completion-dialog h2, .numeric-keypad-head strong, .judge-overview-head h2, .judge-overview-head>strong, .judge-project-name>b, .judge-project-score, .judge-sort label, .judge-detail-empty h2, .register-box h1, .password-box h1, .register-link) {
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) :is(.score-card-panel .score-input:focus, .score-card-panel .score-input.keypad-active) {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px var(--theme-accent-ring);
}
html:not([data-theme="red"]) .score-card-panel .score-input.keypad-active {
  background: var(--theme-accent-soft);
}
html:not([data-theme="red"]) .numeric-keypad-grid button:active {
  background: var(--theme-accent-soft);
}
html:not([data-theme="red"]) .numeric-keypad-grid .keypad-action {
  box-shadow: 0 3px 0 var(--theme-accent-hover);
}
html:not([data-theme="red"]) .judge-project-item:hover {
  background: var(--theme-accent-soft);
}
html:not([data-theme="red"]) .judge-project-item.active {
  background: var(--theme-accent-soft);
  box-shadow: inset 0 0 0 1px var(--theme-accent-border);
}
html:not([data-theme="red"]) :is(.judge-project-item:focus-visible, .judge-sort select:focus-visible) {
  outline-color: var(--theme-focus);
}

/* 五页签赛事配置：弹窗米白底、白色区域和普通表单保持不变。 */
html:not([data-theme="red"]) :is(.ec-kicker, .ec-tabs button.active, .ec-add, .ec-template-tool, .ec-template-item summary) {
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) .ec-status {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
  border-color: var(--theme-accent-border);
}
html:not([data-theme="red"]) .ec-tabs button.active {
  border-bottom-color: var(--theme-accent);
}
html:not([data-theme="red"]) .ec-tabs button.active i {
  background: var(--theme-accent);
  border-color: var(--theme-accent);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) :is(.ec-field input:focus, .ec-field select:focus, .ec-field textarea:focus) {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px var(--theme-accent-ring);
}
html:not([data-theme="red"]) :is(.ec-order, .ec-options>span) {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) .ec-preview-head {
  background: var(--theme-sidebar);
  color: var(--theme-on-accent);
}

/* 登录和注册：仅左侧品牌色、红色文字及主按钮换色，右侧白色表单不变。 */
html:not([data-theme="red"]) .side,
html:not([data-theme="red"]) .card>.side {
  background: linear-gradient(145deg, var(--theme-login-start), var(--theme-login-end));
}
html:not([data-theme="red"]) :is(.side .brand small, .side .slogan, .side>p, .side .side-bottom, .side .side-foot) {
  color: var(--theme-login-soft);
}
html:not([data-theme="red"]) .side-bottom::before {
  background: var(--theme-login-soft);
}
html:not([data-theme="red"]) :is(.input-wrap:focus-within, .field input:focus) {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px var(--theme-accent-ring);
}
html:not([data-theme="red"]) :is(.form-pane .notice, .text-button:hover, .back:hover, #register-entry, #demo-entry, .register-link) {
  color: var(--theme-accent-text);
}
html:not([data-theme="red"]) .success a {
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}
html:not([data-theme="red"]) .success a:hover {
  background: var(--theme-accent-hover);
}

/* 设置页主题控件沿用原有白色面板，仅选中态使用主题强调色。 */
.theme-settings { margin-bottom: 4px; }
.theme-settings .settings-section-head { align-items: flex-start; margin-bottom: 14px; }
.theme-settings .settings-section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.theme-current { flex: none; padding: 5px 10px; border-radius: 999px; background: var(--theme-accent-soft); color: var(--theme-accent-text); font-size: 12px; font-weight: 650; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-choice { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr) 20px; align-items: center; gap: 12px; min-height: 78px; padding: 12px 14px; text-align: left; background: #ffffff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
.theme-choice:hover { background: var(--theme-accent-soft); border-color: var(--theme-accent-border); }
.theme-choice[aria-checked="true"] { background: var(--theme-accent-soft); border-color: var(--theme-accent); box-shadow: 0 0 0 1px var(--theme-accent); }
.theme-choice:focus-visible, .theme-switch:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
.theme-choice-copy { min-width: 0; }
.theme-choice-copy strong, .theme-choice-copy small { display: block; }
.theme-choice-copy strong { font-size: 15px; }
.theme-choice-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.theme-choice-check { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--theme-accent-border); border-radius: 50%; color: transparent; font-size: 12px; }
.theme-choice[aria-checked="true"] .theme-choice-check { background: var(--theme-accent); border-color: var(--theme-accent); color: var(--theme-on-accent); }
.theme-choice[aria-checked="true"] .theme-choice-check::before { content: "✓"; }
.theme-swatch { position: relative; display: block; width: 54px; height: 44px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #ffffff; color: #83777a; }
.theme-swatch::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 15px; }
.theme-swatch::after { content: ""; position: absolute; left: 22px; right: 7px; top: 10px; height: 5px; border-radius: 3px; box-shadow: 0 10px 0 currentColor, 0 20px 0 currentColor; opacity: .55; }
.theme-swatch-red::before { background: #701c28; }
.theme-swatch-red::after { background: #9b2432; }
.theme-swatch-dark::before { background: #0d1117; }
.theme-swatch-dark::after { background: #0d1117; }
.theme-swatch-blue::before { background: #1f4079; }
.theme-swatch-blue::after { background: #1f4079; }
.theme-system-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.theme-system-row strong { font-size: 13px; }
.theme-system-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.theme-switch { display: inline-flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 104px; min-height: 44px; padding: 6px 0 6px 10px; border: 0; background: transparent; color: var(--muted); }
.theme-switch:hover { background: transparent; color: var(--ink); }
.theme-switch-track { position: relative; flex: none; width: 44px; height: 24px; border: 1px solid var(--line); border-radius: 999px; background: #f1edef; }
.theme-switch-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transform: translateX(0); }
.theme-switch[aria-checked="true"] .theme-switch-track { background: var(--theme-accent); border-color: var(--theme-accent); }
.theme-switch[aria-checked="true"] .theme-switch-knob { background: var(--theme-on-accent); transform: translateX(20px); }
.theme-switch-label { min-width: 40px; font-size: 12px; white-space: nowrap; }
.theme-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
@media (max-width: 760px) {
  .theme-options { grid-template-columns: 1fr; }
  .theme-choice { min-height: 72px; }
}
@media (max-width: 480px) {
  .theme-system-row { align-items: flex-start; gap: 12px; }
  .theme-switch { min-width: 98px; padding-left: 0; }
  .theme-settings .settings-section-head { gap: 10px; }
}
