<html> HTML
<!-- Toggle: manually add class="theme-dark" to the <html> element to force dark mode (no JS) -->
<div class="panel">
  <h2>Theme Demo</h2>
  <p>This UI reads all colors from CSS variables.</p>
  <button class="btn" type="button">Action</button>
</div>
# CSS
/* TASK
  1) Define variables on :root (light defaults):
     --bg, --text, --surface, --accent, --border, --accent-contrast
  2) OS dark mode:
     @media (prefers-color-scheme: dark) {
  :root {
  ...same vars, dark values...
}
}
3) Manual override:
     html.theme-dark {
  ...same vars, dark values...
}
IMPORTANT: place html.theme-dark AFTER the media query so it always wins.
  Constraint:
    - .panel and .btn must use ONLY variables for colors (no literal colors).
*/
/* Base page styles using variables (you will define them) */
html, body {
  height: 100%;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 2rem;
}
.panel {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  max-width: 520px;
}
.btn {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 0;
  padding: .5rem .9rem;
  border-radius: .6rem;
  font-weight: 600;
}
Live preview updates as you type
Building preview…