:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #7c6af7;
  --before: #e05252;
  --after: #52c07a;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.demo-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.demo-nav a {
  color: var(--muted);
  text-decoration: none;
}

.demo-nav a:hover { color: var(--text); }

.demo-nav .sep { color: var(--border); }

.demo-nav .current-label {
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.demo-nav .current-label.before {
  background: #3a1a1a;
  color: var(--before);
}

.demo-nav .current-label.after {
  background: #1a3a28;
  color: var(--after);
}

.demo-nav .switch-link {
  margin-left: auto;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.75rem;
  transition: opacity 0.15s;
}

.demo-nav .switch-link:hover { opacity: 0.8; }

.demo-nav .switch-link.to-after {
  background: #1a3a28;
  color: var(--after);
  border: 1px solid #2a5a3a;
}

.demo-nav .switch-link.to-before {
  background: #3a1a1a;
  color: var(--before);
  border: 1px solid #5a2a2a;
}

.demo-nav .devtools-hint {
  font-size: 0.7rem;
  color: var(--muted);
  background: #1a1a2a;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}

/* ─── Theme toggle in nav ────────────────────────────────────── */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

#theme-toggle:hover { color: var(--text); border-color: var(--muted); }

/* ─── Light theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --border: #e2e2e2;
    --text: #111111;
    --muted: #777777;
    --accent: #6c5ce7;
    --before: #c94040;
    --after: #389a5e;
  }

  :root:not([data-theme="dark"]) .demo-nav .devtools-hint {
    background: #eeeefc;
    border-color: #c8c8ee;
  }

  :root:not([data-theme="dark"]) .demo-nav .current-label.before {
    background: #fde8e8;
  }

  :root:not([data-theme="dark"]) .demo-nav .current-label.after {
    background: #e8f5ee;
  }

  :root:not([data-theme="dark"]) .demo-nav .switch-link.to-after {
    background: #e8f5ee;
    border-color: #b8e5c8;
  }

  :root:not([data-theme="dark"]) .demo-nav .switch-link.to-before {
    background: #fde8e8;
    border-color: #f5b8b8;
  }
}

:root[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --muted: #777777;
  --accent: #6c5ce7;
  --before: #c94040;
  --after: #389a5e;
}

html[data-theme="light"] .demo-nav .devtools-hint {
  background: #eeeefc;
  border-color: #c8c8ee;
}

html[data-theme="light"] .demo-nav .current-label.before { background: #fde8e8; }
html[data-theme="light"] .demo-nav .current-label.after  { background: #e8f5ee; }

html[data-theme="light"] .demo-nav .switch-link.to-after {
  background: #e8f5ee;
  border-color: #b8e5c8;
}

html[data-theme="light"] .demo-nav .switch-link.to-before {
  background: #fde8e8;
  border-color: #f5b8b8;
}
