/* Design tokens. Every color goes through a variable so light/dark is one
   switch — never hardcode a color in a component rule.

   Palettes are lifted from Topside: Dice Drop so the two products read as the
   same family — "Classic" (warm cream, orange) for light, "Dice Drop" (dark
   brown, red) for dark.

   --stage-* is the preview backdrop, and it is deliberately the OPPOSITE
   theme's background: an overlay is judged against footage, so showing it on
   the same surface as the surrounding UI tells you nothing about how it will
   composite. Inverting gives a real contrast check for free, and it is what
   the checkerboard was clumsily approximating. */

:root {
  --bg: #FAF6EE;
  --bg-soft: #F2EAD8;
  --panel: #FEFCF8;
  --line: #E8D8BC;
  --fg: #1F1A14;
  --dim: #705A40;
  --acc: #F08A2C;
  /* Dark ink on the orange, not white. Dice Drop pairs white with this accent,
     but that is 2.51:1 — fine on large dice faces, unreadable on a 14px
     button label. Same hue, legible at UI sizes. */
  --acc-fg: #1F1A14;
  --ok: #17724a;
  --err: #C8302C;
  --shadow: 0 1px 2px rgba(60, 40, 20, .07), 0 8px 24px rgba(60, 40, 20, .07);
  --stage-bg: #1C1008;
  --stage-fg: #FFE4C0;
  --stage-dim: #C88E5C;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1C1008;
  --bg-soft: #281510;
  --panel: #2E1A0C;
  --line: #4A2A14;
  --fg: #FFE4C0;
  --dim: #C88E5C;
  /* Deepened from Dice Drop's #D94050: white on the original is 4.38:1, just
     under AA for body text. This clears it without shifting the hue. */
  --acc: #C4303F;
  --acc-fg: #FFFFFF;
  --ok: #35c98a;
  --err: #FF5544;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .3);
  --stage-bg: #FAF6EE;
  --stage-fg: #1F1A14;
  --stage-dim: #705A40;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .18s ease, color .18s ease;
}

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

/* --- theme switch --------------------------------------------------------- */

.themer {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.themer button {
  all: unset;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  line-height: 1.4;
}
.themer button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

/* --- shared bits ---------------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin: 13px 0 5px;
  font-weight: 550;
}
label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font: 13px/1.4 inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--acc) 45%, transparent);
  outline-offset: 1px;
}
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
  min-height: 110px;
}
input[type=range] { padding: 0; accent-color: var(--acc); }
input[type=file] { padding: 6px; }

button.btn {
  width: 100%;
  background: var(--acc);
  color: var(--acc-fg);
  border: 0;
  border-radius: 10px;
  padding: 11px;
  font: 600 14px inherit;
  cursor: pointer;
  margin-top: 16px;
}
button.btn:disabled { opacity: .5; cursor: default; }
button.btn.ghost {
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--line);
  margin-top: 8px;
}

.hint { font-size: 11px; color: var(--dim); margin-top: 4px; }
.err { color: var(--err); }
