:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.92);
  --bg-card-soft: rgba(15, 23, 42, 0.8);
  --bg-card-quiet: rgba(15, 23, 42, 0.7);
  --bg-input: rgba(15, 23, 42, 0.9);
  --bg-pill: rgba(30, 41, 59, 0.8);
  --text: #e2e8f0;
  --text-strong: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-quiet: #94a3b8;
  --text-faint: #64748b;
  --accent: #4cc9f0;
  --accent-hover: #22d3ee;
  --accent-on: #0f1729;
  --accent-soft-08: rgba(76, 201, 240, 0.08);
  --accent-soft-10: rgba(76, 201, 240, 0.10);
  --accent-soft-12: rgba(76, 201, 240, 0.12);
  --accent-soft-15: rgba(76, 201, 240, 0.15);
  --accent-soft-30: rgba(76, 201, 240, 0.30);
  --border: rgba(51, 65, 85, 0.8);
  --border-soft: rgba(51, 65, 85, 0.5);
  --hr: #334155;
  --ok-bg: #064e3b;
  --ok-text: #6ee7b7;
  --err-bg: #450a0a;
  --err-text: #fca5a5;
  --err-bright: #dc2626;
  --info-bg: #1e3a5f;
  --info-text: #93c5fd;
  --warn-bg: #422006;
  --warn-text: #fbbf24;
  --warn-orange: #f59e0b;
  --warn-orange-bg: rgba(245, 158, 11, 0.05);
  --warn-orange-border: rgba(245, 158, 11, 0.25);
  --pill-bg: #78350f;
  --pill-text: #fde68a;
  --disclaimer-bg: #7f1d1d;
  --disclaimer-text: #fecaca;
  --shadow-card: 0 4px 16px rgba(76, 201, 240, 0.10);
  --shadow-btn: 0 2px 12px rgba(76, 201, 240, 0.30);
  --tooltip-bg: rgba(76, 201, 240, 0.15);
  --offline-bar-bg: #7f1d1d;
  --offline-bar-text: #fef2f2;
  --themecolor: #0b1120;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-alt: #ffffff;
  --bg-card: #ffffff;
  --bg-card-soft: #ffffff;
  --bg-card-quiet: #f1f5f9;
  --bg-input: #ffffff;
  --bg-pill: #e2e8f0;
  --text: #0f172a;
  --text-strong: #020617;
  --text-muted: #1e293b;
  --text-quiet: #475569;
  --text-faint: #64748b;
  --accent: #0369a1;
  --accent-hover: #075985;
  --accent-on: #ffffff;
  --accent-soft-08: rgba(3, 105, 161, 0.06);
  --accent-soft-10: rgba(3, 105, 161, 0.10);
  --accent-soft-12: rgba(3, 105, 161, 0.12);
  --accent-soft-15: rgba(3, 105, 161, 0.18);
  --accent-soft-30: rgba(3, 105, 161, 0.40);
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --hr: #e2e8f0;
  --ok-bg: #d1fae5;
  --ok-text: #065f46;
  --err-bg: #fee2e2;
  --err-text: #991b1b;
  --err-bright: #b91c1c;
  --info-bg: #dbeafe;
  --info-text: #1e3a8a;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --warn-orange: #b45309;
  --warn-orange-bg: rgba(180, 83, 9, 0.08);
  --warn-orange-border: rgba(180, 83, 9, 0.30);
  --pill-bg: #fef3c7;
  --pill-text: #78350f;
  --disclaimer-bg: #fee2e2;
  --disclaimer-text: #991b1b;
  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-btn: 0 2px 12px rgba(3, 105, 161, 0.18);
  --tooltip-bg: rgba(3, 105, 161, 0.12);
  --offline-bar-bg: #fee2e2;
  --offline-bar-text: #7f1d1d;
  --themecolor: #f8fafc;
}

html, body { background: var(--bg); color: var(--text); }

#theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--accent-soft-30);
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
#theme-toggle:hover { transform: scale(1.08); border-color: var(--accent); background: var(--bg-card-soft); }
#theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) {
  #theme-toggle { top: 10px; right: 10px; width: 36px; height: 36px; font-size: 18px; }
}
