:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #161a21;
  --text: #e6e8eb;
  --muted: #8a93a3;
  --heading: #f3f4f6;
  --strong: #f3f4f6;
  --em: #c2c8d2;
  --border: #2a2f3a;
  --input-bg: #1b2029;
  --input-border: #2f3644;
  --accent: #d2b48c;
  --accent-hover: #e3c8a3;
  --accent-disabled: #6b5a3f;
  --accent-tint: rgba(210, 180, 140, 0.1);
  --code-bg: #1b2029;
  --tip-bg: #2a2113;
  --tip-fg: #f3d6a000;
  --tip-border: #5a4423;
  --error-bg: #2a1414;
  --error-fg: #fca5a5;
  --error-border: #4c1d1d;
  --info-bg: #11203a;
  --info-fg: #93c5fd;
  --info-border: #1e3a66;
  --success-bg: #0f2418;
  --success-fg: #86efac;
  --success-border: #1d4a31;
  --spinner-track: #2c3a55;
  --spinner-head: #d2b48c;
  --focus-ring: rgba(210, 180, 140, 0.3);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --heading: #111;
  --strong: #111;
  --em: #444;
  --border: #e5e7eb;
  --input-bg: #ffffff;
  --input-border: #ccc;
  --accent: #8b6b3f;
  --accent-hover: #6e5430;
  --accent-disabled: #c5b08a;
  --accent-tint: rgba(139, 107, 63, 0.08);
  --code-bg: #f1f3f5;
  --tip-bg: #fffbeb;
  --tip-fg: #713f12;
  --tip-border: #fde68a;
  --error-bg: #fef2f2;
  --error-fg: #b91c1c;
  --error-border: #fecaca;
  --info-bg: #eff6ff;
  --info-fg: #1e40af;
  --info-border: #bfdbfe;
  --success-bg: #f0fdf4;
  --success-fg: #166534;
  --success-border: #bbf7d0;
  --spinner-track: #d8c9ad;
  --spinner-head: #8b6b3f;
  --focus-ring: rgba(139, 107, 63, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  background: var(--bg);
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}
.theme-toggle:hover {
  background: var(--input-bg);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: inline;
}
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: inline;
}
:root[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}
