:root {
  color-scheme: dark;
  --bg: #101318;
  --surface: #181d25;
  --surface-raised: #202733;
  --surface-soft: #141920;
  --ink: #eef1f6;
  --secondary: #bec7d6;
  --muted: #99a6ba;
  --line: #2d3644;
  --feature-line: #7c6d48;
  --accent: #e7c77c;
  --accent-hover: #f3dba5;
  --accent-soft: #28251e;
  --action: #e7c77c;
  --action-hover: #f1d795;
  --action-ink: #1b2028;
  --header: rgba(16, 19, 24, .92);
  --glow: rgba(216, 176, 91, .10);
  --shadow: 0 16px 48px rgba(0, 0, 0, .18);
  --shadow-hover: 0 20px 54px rgba(0, 0, 0, .25);
  --focus: #edc970;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #eef1f5;
  --ink: #202b3a;
  --secondary: #4b5c73;
  --muted: #596a80;
  --line: #dce2ea;
  --feature-line: #cfb77e;
  --accent: #89621c;
  --accent-hover: #63440d;
  --accent-soft: #f4eddb;
  --action: #e3bd65;
  --action-hover: #eccc81;
  --action-ink: #24291f;
  --header: rgba(255, 255, 255, .94);
  --glow: rgba(211, 171, 82, .12);
  --shadow: 0 12px 40px rgba(28, 44, 65, .05);
  --shadow-hover: 0 18px 44px rgba(28, 44, 65, .10);
  --focus: #92650e;
}
::selection { background: var(--accent); color: var(--bg); }
.theme-toggle {
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 86px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 600 13px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .03);
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s, border-color .18s, box-shadow .18s;
}
.theme-toggle:not([hidden]) { display: inline-flex; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.theme-symbol { color: var(--accent); font: 21px/1 sans-serif; width: 22px; text-align: center; }
@media (max-width: 650px) {
  .theme-toggle { min-width: 76px; padding: 8px 10px; gap: 6px; font-size: 12px; }
  .theme-symbol { width: 19px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print { .theme-toggle { display: none !important; } }
