:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --accent: #3366cc;
}

/* Follow system preference until the user picks explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a;
    --fg: #f0f0f0;
    --accent: #7fa8ff;
  }
}

/* Explicit choice always wins, in either direction */
:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #f0f0f0;
  --accent: #7fa8ff;
}

body {
  font-family: system-ui, sans-serif;
  max-width: 40rem;
  margin: 4rem auto;
  padding: 0 1.5rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}

a {
  color: var(--accent);
}

#theme-toggle {
  font: inherit;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--fg);
  border-radius: 0.3rem;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

#theme-toggle:hover {
  background: var(--fg);
  color: var(--bg);
}
