/* LiveDash 全站主题：默认浅色；html[data-theme="dark"] 为暗色 */

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eef4;
  --muted: #94a3b8;
  --line: #2a3544;
  --panel: #151b24;
  --canvas: #0c1017;
  --grid: #1e293b;
  --brand: #34d399;
  --brand-deep: #6ee7b7;
  --brand-soft: #0f2a22;
  --brand-ring: #065f46;
  --warn: #fbbf24;
  --err: #f87171;
  --ok: #34d399;
  --accent: #34d399;
  --accent-2: #fb923c;
  --bg0: #0c1017;
  --bg1: #151b24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  /* auth 页别名 */
  --auth-ink: #e8eef4;
  --auth-muted: #94a3b8;
  --auth-line: #2a3544;
  --auth-mist: #0c1017;
  --auth-panel: #151b24;
  --auth-panel-top: #10151d;
  --auth-panel-bottom: #0c1017;
  --auth-input-bg: #0f141c;
  --auth-input-placeholder: #64748b;
  --auth-input-hover: #3d4b5c;
  --auth-link: #5eead4;
  --auth-link-hover-bg: #1a222e;
  --auth-signal: #2dd4bf;
  --auth-signal-deep: #0f766e;
  --auth-booth: #0a1620;
  --auth-wire: #fb923c;
  --auth-ok: #34d399;
  --auth-err: #f87171;
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.dash-body,
html[data-theme="dark"] body.auth-body {
  color: var(--ink);
  background: var(--canvas, var(--bg0));
}

html[data-theme="dark"] body:not(.dash-body) .bg,
html[data-theme="dark"] .bg {
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(52, 211, 153, 0.12), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(251, 146, 60, 0.08), transparent 55%),
    linear-gradient(160deg, #0a0e14 0%, #121820 45%, #0c1218 100%);
}

/* —— Shell —— */
html[data-theme="dark"] .dash-brand .dash-mark,
html[data-theme="dark"] .mark {
  background-image: url("./logo-white.svg");
}

html[data-theme="dark"] .dash-side {
  background: #111821;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .dash-main {
  background: var(--canvas);
  color: var(--ink);
}

html[data-theme="dark"] .dash-top {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .side-nav a,
html[data-theme="dark"] .nav-group-main,
html[data-theme="dark"] .nav-sub a,
html[data-theme="dark"] .dash-side-link {
  color: var(--muted);
}

html[data-theme="dark"] .side-nav a:hover,
html[data-theme="dark"] .nav-sub a:hover,
html[data-theme="dark"] .side-nav a.active,
html[data-theme="dark"] .nav-group-main.active,
html[data-theme="dark"] .nav-sub a.active {
  color: var(--ink);
  background: var(--brand-soft);
}

html[data-theme="dark"] .dash-collapse,
html[data-theme="dark"] .dash-menu-btn {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

/* 新建场次：保持品牌色按钮，勿被灰底覆盖 */
html[data-theme="dark"] .dash-new {
  color: #fff !important;
  background: linear-gradient(145deg, #34d399, #059669) !important;
  border: none;
}

html[data-theme="dark"] .dash-new:hover {
  filter: brightness(1.08);
}

html[data-theme="dark"] .dash-side-link:hover {
  background: #1a2330;
  color: var(--ink);
}

html[data-theme="dark"] .dash-top-user .nav-user-text,
html[data-theme="dark"] .dash-top-user .btn,
html[data-theme="dark"] .dash-top-user > button,
html[data-theme="dark"] .dash-top-user .btn-sm {
  background: #1a2330;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .dash-top-user .nav-probe-speed {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(12, 74, 110, 0.45);
}

html[data-theme="dark"] .dash-top-user .nav-user-text.warn {
  color: var(--warn);
  border-color: #854d0e;
  background: #2a2110;
}

html[data-theme="dark"] .dash-status .off i {
  background: #64748b;
}

/* —— 通用控件 / 面板 —— */
html[data-theme="dark"] .panel,
html[data-theme="dark"] .preflight-card,
html[data-theme="dark"] .card-list li,
html[data-theme="dark"] .inter-row,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .home-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .guide-card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .feed li,
html[data-theme="dark"] .preflight-list li,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .live-feed-filter-panel,
html[data-theme="dark"] .live-user-mute-panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink);
}

html[data-theme="dark"] .stat .value,
html[data-theme="dark"] .preflight-card h2,
html[data-theme="dark"] .preflight-list .pf-label,
html[data-theme="dark"] .card-list .title {
  color: var(--ink) !important;
}

html[data-theme="dark"] .stat .label,
html[data-theme="dark"] .preflight-sub,
html[data-theme="dark"] .preflight-pct,
html[data-theme="dark"] .preflight-list .pf-detail,
html[data-theme="dark"] .preflight-list .pf-status,
html[data-theme="dark"] .card-list .sub {
  color: var(--muted) !important;
}
html[data-theme="dark"] .preflight-list li.is-ok .pf-status {
  color: #4ade80 !important;
}
html[data-theme="dark"] .preflight-list li.is-fail .pf-status,
html[data-theme="dark"] .preflight-list li.is-pending .pf-status {
  color: inherit !important;
}
html[data-theme="dark"] .preflight-msg.is-ok {
  color: #4ade80;
}

html[data-theme="dark"] .credits-split > .panel {
  background: color-mix(in srgb, var(--panel) 88%, #000 12%) !important;
}
html[data-theme="dark"] .credits-split .credits-log-list > li {
  background: color-mix(in srgb, var(--panel) 78%, #000 22%) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .pill.warn {
  color: var(--warn) !important;
  border-color: #854d0e !important;
  background: #2a2110 !important;
}

html[data-theme="dark"] .pill.ok {
  color: #6ee7b7 !important;
  border-color: #065f46 !important;
  background: #0f2a22 !important;
}

html[data-theme="dark"] .preflight-progress {
  background: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .preflight-msg.is-err {
  color: #fca5a5;
}

/* 直播中心：正在直播卡片 */
html[data-theme="dark"] .card-list li.card-row.is-live {
  background: #2a1518 !important;
  border-color: #7f1d1d !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12);
}

html[data-theme="dark"] .card-list .tag {
  color: #6ee7b7;
  background: #0f2a22;
  border-color: #065f46;
}

html[data-theme="dark"] .card-list .tag.tag-live {
  color: #fca5a5 !important;
  background: #3f1515 !important;
  border-color: #7f1d1d !important;
}

html[data-theme="dark"] .card-list li.active {
  background: var(--brand-soft) !important;
  border-color: var(--brand-ring) !important;
}

html[data-theme="dark"] a.stat.account-link:hover {
  border-color: var(--brand-ring);
  background: var(--brand-soft) !important;
}

html[data-theme="dark"] a.btn.ghost,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] button.ghost {
  background: #1a2330 !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f141c !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .panel button.ghost,
html[data-theme="dark"] button.ghost,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .modal button.ghost {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

/* 新建直播：类型卡片（label + radio） */
html[data-theme="dark"] .live-type-card {
  background: #1a2330 !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] .live-type-card strong {
  color: var(--ink) !important;
}
html[data-theme="dark"] .live-type-card > span {
  color: var(--muted) !important;
}
html[data-theme="dark"] .live-type-card:hover {
  background: #222c3a !important;
  border-color: var(--accent) !important;
}
html[data-theme="dark"] .live-type-card.is-active,
html[data-theme="dark"] .live-type-card:has(input:checked) {
  background: var(--brand-soft) !important;
  border-color: var(--brand-ring) !important;
  box-shadow: inset 0 0 0 1px var(--brand-ring);
}

html[data-theme="dark"] .feed li,
html[data-theme="dark"] .live-feed li {
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .feed li.feed-decision {
  background: #2a2110 !important;
  border-left-color: #f59e0b;
}

html[data-theme="dark"] .feed li.feed-decision .d-progress {
  background: rgba(245, 158, 11, 0.2);
}

/* 直播播放：暗色主题下的条带与历史 */
html[data-theme="dark"] .now-pipeline {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(52, 211, 153, 0.08), transparent 55%),
    #151b24;
}

html[data-theme="dark"] .now-row {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .now-k-decision { color: #6ee7b7; }
html[data-theme="dark"] .now-k-reply { color: #7dd3fc; }
html[data-theme="dark"] .now-k-play { color: #fbbf24; }

html[data-theme="dark"] .now-v { color: #f1f5f9; }
html[data-theme="dark"] .now-st { color: #94a3b8; }

html[data-theme="dark"] .now-row.is-active[data-row="decision"] .now-st { color: #6ee7b7; }
html[data-theme="dark"] .now-row.is-active[data-row="reply"] .now-st { color: #7dd3fc; }
html[data-theme="dark"] .now-row.is-active[data-row="play"] .now-st { color: #fbbf24; }

html[data-theme="dark"] .play-history-box {
  background: #151b24;
  border-color: var(--line);
}

html[data-theme="dark"] .play-history-head {
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .play-history .ph-float-actions {
  background: color-mix(in srgb, #151b24 94%, transparent);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .play-history li {
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

html[data-theme="dark"] .play-history .ph-tag {
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

html[data-theme="dark"] .play-history .ph-tag.is-src { color: #e2e8f0; }

html[data-theme="dark"] .play-history .ph-tag.is-act {
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(15, 118, 110, 0.25);
}

html[data-theme="dark"] .play-history .ph-tag.is-wait {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.35);
}

html[data-theme="dark"] .play-history .ph-tag.is-fail {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.28);
}

html[data-theme="dark"] .play-history .ph-text { color: #e2e8f0; }

/* AI 行为控制台：深色面板样式优先 */
html[data-theme="dark"] .ai-behavior-console .strategy-chip {
  background: #2a313c;
  border: 0;
  color: #f3f6fa;
}
html[data-theme="dark"] .ai-behavior-console .strategy-chip.is-active {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.45);
}
html[data-theme="dark"] .ai-behavior-console .action-chip {
  border-color: rgba(255, 255, 255, 0.22);
  color: #f3f6fa;
  background: transparent;
}
html[data-theme="dark"] .ai-behavior-console .action-chip.is-active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
}
html[data-theme="dark"] .ai-behavior-console .insight-chip {
  background: #2a313c;
  border: 0;
  color: rgba(243, 246, 250, 0.88);
}
html[data-theme="dark"] .ai-behavior-console .insight-chip:hover:not(:disabled) {
  background: #343c49;
}
html[data-theme="dark"] .ai-behavior-console .insight-chip.picked {
  background: #0f766e;
  color: #fff;
}
html[data-theme="dark"] .ai-behavior-console .insight-chip i {
  background: rgba(255, 255, 255, 0.1);
  color: #86efac;
}
html[data-theme="dark"] .ai-behavior-console .insight-chip.picked i {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
html[data-theme="dark"] .ai-behavior-console .insights-suggest-detail {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(243, 246, 250, 0.58);
}
html[data-theme="dark"] .ai-behavior-console .live-decision-intent,
html[data-theme="dark"] .ai-behavior-console .live-decision-conclusion {
  color: #f3f6fa;
}
html[data-theme="dark"] .ai-behavior-console .live-decision-orientation,
html[data-theme="dark"] .ai-behavior-console .insights-summary {
  color: rgba(243, 246, 250, 0.58);
}

html[data-theme="dark"] .insights-summary {
  color: var(--ink);
}

html[data-theme="dark"] .live-decision {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.22);
}
html[data-theme="dark"] .ai-behavior-console .live-decision {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .live-decision-intent,
html[data-theme="dark"] .live-decision-conclusion {
  color: var(--ink);
}

html[data-theme="dark"] .live-decision-orientation {
  color: var(--muted);
}

html[data-theme="dark"] .insights-charts-col > .label,
html[data-theme="dark"] .insights-block > .label,
html[data-theme="dark"] .activity-head .label,
html[data-theme="dark"] .insights-advice-col > .label,
html[data-theme="dark"] .insights-suggs-col > .label,
html[data-theme="dark"] .live-decision-head .label {
  color: var(--ink);
}
html[data-theme="dark"] .insights-block {
  background: var(--panel);
  border-color: var(--line);
}
html[data-theme="dark"] .insights-advice-hint,
html[data-theme="dark"] .live-advice-empty {
  color: var(--muted);
}
html[data-theme="dark"] .live-advice-card {
  background: color-mix(in srgb, var(--panel) 88%, #000);
  border-color: var(--line);
  color: var(--ink);
}
html[data-theme="dark"] .live-advice-card:hover {
  border-color: rgba(52, 211, 153, 0.45);
}
html[data-theme="dark"] .live-advice-q {
  color: var(--muted);
}
html[data-theme="dark"] .live-advice-a {
  color: var(--ink);
}
html[data-theme="dark"] .live-advice-reason {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}
html[data-theme="dark"] .ai-behavior-console .label {
  color: rgba(243, 246, 250, 0.58);
}
html[data-theme="dark"] .ai-behavior-console .insights-summary {
  color: rgba(243, 246, 250, 0.58);
}

html[data-theme="dark"] .activity-filters label {
  color: var(--muted);
}

html[data-theme="dark"] .demand-empty,
html[data-theme="dark"] .activity-empty {
  color: var(--muted);
}

/* —— 首页：统计卡 / 场次列表 / 指引 —— */
html[data-theme="dark"] .dash-stat,
html[data-theme="dark"] .dash-panel {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .dash-stat .value,
html[data-theme="dark"] .dash-panel-head h2,
html[data-theme="dark"] .dash-room .name,
html[data-theme="dark"] .dash-metric .big,
html[data-theme="dark"] .dash-metric-sub strong,
html[data-theme="dark"] .dash-faq strong {
  color: var(--ink);
}

html[data-theme="dark"] .dash-icon-btn {
  background: #1a2330;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .dash-icon-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand-ring);
  color: var(--brand-deep);
}

html[data-theme="dark"] .dash-room {
  background: #1a2330 !important;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .dash-room:hover {
  background: #203040 !important;
  border-color: var(--brand-ring);
}

html[data-theme="dark"] .dash-room .sub,
html[data-theme="dark"] .dash-room .when,
html[data-theme="dark"] .dash-room .go {
  color: var(--muted);
}

html[data-theme="dark"] .dash-room .go {
  border-color: var(--line);
}

html[data-theme="dark"] .dash-room.is-active {
  background: var(--brand-soft) !important;
  border-color: var(--brand-ring);
}

html[data-theme="dark"] .dash-room.is-active .when {
  color: var(--brand-deep);
}

html[data-theme="dark"] .dash-room .thumb {
  background-color: var(--brand-soft);
}

html[data-theme="dark"] .dash-empty {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

html[data-theme="dark"] .dash-empty a {
  color: var(--brand-deep);
}

html[data-theme="dark"] .dash-metric,
html[data-theme="dark"] .dash-metric-sub {
  border-color: var(--line);
}

html[data-theme="dark"] .dash-faq a {
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .dash-faq a:hover {
  background: #1a2330;
}

html[data-theme="dark"] .dash-stat .ico.doc {
  background-color: #172554;
}

html[data-theme="dark"] .dash-stat .ico.mic {
  background-color: #2e1065;
}

html[data-theme="dark"] .dash-stat .ico.bolt {
  background-color: #431407;
}

/* —— Auth —— */
html[data-theme="dark"] .auth-panel-wrap {
  background:
    radial-gradient(600px 320px at 100% 0%, rgba(45, 212, 191, 0.08), transparent 60%),
    linear-gradient(
      180deg,
      var(--auth-panel-top) 0%,
      var(--auth-panel) 40%,
      var(--auth-panel-bottom) 100%
    );
}

html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .auth-card {
  background: transparent;
  color: var(--auth-ink);
  border-color: var(--auth-line);
}

html[data-theme="dark"] .auth-card h2,
html[data-theme="dark"] .auth-note strong {
  color: var(--auth-ink);
}

html[data-theme="dark"] .auth-card-lead,
html[data-theme="dark"] .auth-field span,
html[data-theme="dark"] .auth-note {
  color: var(--auth-muted);
}

html[data-theme="dark"] .auth-field input {
  color: var(--auth-ink);
  background: var(--auth-input-bg);
  border-color: var(--auth-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .auth-field input::placeholder {
  color: var(--auth-input-placeholder);
}

html[data-theme="dark"] .auth-field input:hover {
  border-color: var(--auth-input-hover);
}

html[data-theme="dark"] .auth-field input:focus {
  border-color: var(--auth-signal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.22);
}

/* 浏览器自动填充在暗色下也保持可读 */
html[data-theme="dark"] .auth-field input:-webkit-autofill,
html[data-theme="dark"] .auth-field input:-webkit-autofill:hover,
html[data-theme="dark"] .auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-ink);
  caret-color: var(--auth-ink);
  box-shadow: 0 0 0 1000px var(--auth-input-bg) inset;
  transition: background-color 99999s ease-out;
}

html[data-theme="dark"] .auth-actions button {
  background: linear-gradient(145deg, var(--auth-signal), var(--auth-signal-deep));
  color: #042f2e;
}

html[data-theme="dark"] .auth-btn-secondary {
  background: var(--auth-panel);
  border-color: var(--auth-line);
  color: var(--auth-link);
}

html[data-theme="dark"] .auth-btn-secondary:hover:not(:disabled) {
  border-color: var(--auth-signal);
  color: var(--auth-signal);
  background: rgba(45, 212, 191, 0.08);
}

html[data-theme="dark"] .auth-actions a {
  color: var(--auth-link);
}

html[data-theme="dark"] .auth-actions a:hover {
  border-color: var(--auth-line);
  background: var(--auth-link-hover-bg);
}

html[data-theme="dark"] .auth-note {
  border-top-color: var(--auth-line);
}

html[data-theme="dark"] .auth-booth {
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(15, 118, 110, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(251, 146, 60, 0.16), transparent 50%),
    linear-gradient(160deg, #0a1620 0%, #122030 100%);
}

/* —— 主题切换按钮 —— */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

.theme-toggle .theme-toggle-ico {
  font-size: 0.95rem;
  line-height: 1;
}

.dash-side-foot .theme-toggle {
  margin: 0;
}

.dash-top-right .theme-toggle {
  flex-shrink: 0;
}

.auth-theme-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
}

.admin-theme-wrap {
  display: inline-flex;
  align-items: center;
}

/* —— 游戏设置多选芯片 —— */
html[data-theme="dark"] .game-settings-panel {
  background: transparent;
  border: none;
}

html[data-theme="dark"] .game-check {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .game-check:hover {
  border-color: var(--accent);
  background: transparent;
}

html[data-theme="dark"] .game-check:has(input:checked) {
  border-color: var(--accent);
  background: transparent;
  color: var(--ink);
}

html[data-theme="dark"] .game-check input[type="checkbox"] {
  background: var(--bg0) !important;
  border-color: #3d4b5c !important;
}

html[data-theme="dark"] .game-setting-row input[type="number"],
html[data-theme="dark"] .game-setting-row input[type="text"],
html[data-theme="dark"] .game-setting-row select {
  background: var(--bg0);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .game-bg-preview {
  background: var(--bg0);
  border-color: var(--line);
}

html[data-theme="dark"] .game-bg-upload-actions .btn-upload,
html[data-theme="dark"] .game-bg-upload-actions button.ghost {
  background: var(--bg0);
  border-color: var(--line);
  color: var(--ink);
}

/* —— 管理后台：覆盖 admin.css 浅色硬编码 —— */
html[data-theme="dark"] .nav a {
  color: var(--muted) !important;
  background: #1a2330 !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] .nav a.active,
html[data-theme="dark"] .nav a:hover {
  color: var(--ok) !important;
  border-color: var(--brand-ring) !important;
  background: var(--brand-soft) !important;
}

html[data-theme="dark"] .brand h1,
html[data-theme="dark"] .panel-head h2,
html[data-theme="dark"] .detail-sub,
html[data-theme="dark"] .modal-head h3 {
  color: var(--ink);
}

html[data-theme="dark"] .panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .stat,
html[data-theme="dark"] .now,
html[data-theme="dark"] .cfg-list li,
html[data-theme="dark"] .card-list .card-row,
html[data-theme="dark"] .user-table-wrap,
html[data-theme="dark"] .detail-meta,
html[data-theme="dark"] .user-toolbar input[type="search"] {
  background: #1a2330 !important;
  border-color: var(--line) !important;
  color: var(--ink);
}

html[data-theme="dark"] .stat .value,
html[data-theme="dark"] .now .text,
html[data-theme="dark"] .cfg-list .title,
html[data-theme="dark"] .card-list .title,
html[data-theme="dark"] .user-table .row-name,
html[data-theme="dark"] .detail-meta strong {
  color: var(--ink) !important;
}

html[data-theme="dark"] .cfg-list li:hover,
html[data-theme="dark"] .cfg-list li.active,
html[data-theme="dark"] .card-list .card-row.is-clickable:hover,
html[data-theme="dark"] .card-list .card-row.is-selected,
html[data-theme="dark"] .user-row:hover,
html[data-theme="dark"] .user-row.is-selected {
  background: var(--brand-soft) !important;
  border-color: var(--brand-ring) !important;
  box-shadow: none;
}

html[data-theme="dark"] .user-row.is-selected {
  box-shadow: inset 3px 0 0 var(--ok);
}

html[data-theme="dark"] .cfg-list .tag {
  color: var(--ok) !important;
  border-color: var(--brand-ring) !important;
  background: var(--brand-soft) !important;
}

html[data-theme="dark"] .user-table th,
html[data-theme="dark"] .card-table th {
  color: var(--muted) !important;
  background: #121820 !important;
  border-bottom-color: var(--line) !important;
}

html[data-theme="dark"] .user-table td,
html[data-theme="dark"] .card-table td {
  border-bottom-color: var(--line) !important;
  color: var(--ink);
}

/* 主按钮：暗色下薄荷绿底 + 深色字，避免白字对比不足 */
html[data-theme="dark"] .layout.admin button:not(.ghost):not(.theme-toggle),
html[data-theme="dark"] .layout.admin a.btn:not(.ghost),
html[data-theme="dark"] .modal-card button:not(.ghost) {
  background: #34d399 !important;
  color: #06241c !important;
}

html[data-theme="dark"] .chip {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  background: #121820 !important;
}

html[data-theme="dark"] .chip-admin {
  color: #fdba74 !important;
  border-color: #9a3412 !important;
  background: #2a1a10 !important;
}

html[data-theme="dark"] .chip-ok {
  color: var(--ok) !important;
  border-color: var(--brand-ring) !important;
  background: var(--brand-soft) !important;
}

html[data-theme="dark"] .chip-off {
  color: #fcd34d !important;
  border-color: #854d0e !important;
  background: #2a2110 !important;
}

html[data-theme="dark"] .modal-card {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .msg.err {
  color: #fca5a5 !important;
}

html[data-theme="dark"] .msg.ok,
html[data-theme="dark"] .msg:not(.err):not(.banner) {
  color: var(--accent);
}

html[data-theme="dark"] .msg.banner:not(.ok):not(.err) {
  color: var(--muted) !important;
  background: color-mix(in srgb, var(--panel) 88%, #000 12%) !important;
  border-color: var(--line) !important;
  font-weight: 500;
}

html[data-theme="dark"] .msg.banner.ok {
  color: var(--ok) !important;
  background: color-mix(in srgb, var(--brand-soft, #0f2a22) 80%, var(--panel) 20%) !important;
  border-color: var(--brand-ring, #065f46) !important;
}

html[data-theme="dark"] .msg.banner.err {
  color: #fca5a5 !important;
  background: color-mix(in srgb, #450a0a 55%, var(--panel) 45%) !important;
  border-color: #7f1d1d !important;
}

html[data-theme="dark"] .hint,
html[data-theme="dark"] .field span,
html[data-theme="dark"] .brand p {
  color: var(--muted) !important;
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea {
  background: #0f141c !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .admin-theme-wrap .theme-toggle {
  background: #1a2330;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .cfg-list li.cfg-empty,
html[data-theme="dark"] .user-empty {
  color: var(--muted) !important;
  background: transparent !important;
  border-color: transparent !important;
}

/* 界面语言切换 */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel, #fff) 88%, transparent);
  flex-shrink: 0;
}
.lang-switch-btn {
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-switch-btn.is-active {
  background: var(--accent, #0d9488);
  color: #fff;
}
.lang-switch-btn:hover {
  color: var(--ink, #0f172a);
}
.lang-switch-btn.is-active:hover {
  color: #fff;
  filter: brightness(1.06);
}
.lang-switch-inline {
  margin-right: 8px;
}
.dash-side-tools .lang-switch {
  margin-right: 4px;
}
.lp-nav-links .lang-switch {
  margin-left: 4px;
  margin-right: 6px;
}
.auth-theme-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-theme-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
html[data-theme="dark"] .lang-switch {
  background: #1a2330;
  border-color: var(--line);
}
html[data-theme="dark"] .lang-switch-btn.is-active {
  background: var(--accent, #34d399);
  color: #0b1220;
}
html[data-theme="dark"] .lang-switch-btn.is-active:hover {
  color: #0b1220;
}

/* 深色：截取参考片段轨道/手柄提亮；起止手柄同一套样式 */
html[data-theme="dark"] .audio-trim {
  background: #121821;
  border-color: #3a4a5c;
}
html[data-theme="dark"] .range-dual-track {
  background: #3d4f63;
  border-color: #5b6f86;
}
html[data-theme="dark"] .range-dual-fill {
  background: #34d399;
  opacity: 1;
}
html[data-theme="dark"] .panel .range-dual-thumb,
html[data-theme="dark"] .range-dual-thumb {
  background: #f8fafc !important;
  border-color: #34d399 !important;
  box-shadow:
    0 0 0 2px #0c1017,
    0 0 0 4px rgba(52, 211, 153, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.65);
}
