:root {
  --bg: #f4f2ee; --panel: #ffffff; --ink: #1d1c1a; --muted: #6b6760; --line: #d8d4cc;
  --accent: #b4441b; --accent-ink: #ffffff; --bad: #a3261b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151413; --panel: #1f1d1b; --ink: #ece8e1; --muted: #a29d94; --line: #3a3732;
          --accent: #e0703f; --accent-ink: #151413; --bad: #ff8a7a; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main {
  display: grid; gap: 8px; padding: 8px 12px; max-width: 1280px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "line" "input" "settings" "run" "output" "more";
}
@media (min-width: 600px) {
  main { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start;
    grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas: "line line" "input output" "settings output" "run output" "more output"; }
}
#line { grid-area: line; margin: 0; font-size: 14px; color: var(--muted); }
#line b { color: var(--ink); font-weight: 600; }
.sep { opacity: .5; padding: 0 2px; }
#input { grid-area: input; }
#settings { grid-area: settings; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: center; }
#settings select { width: 100%; min-width: 0; }
.seedrow { display: flex; gap: 10px; align-items: center; }
.seedrow input[type=number] { width: 7.5em; }
#run { grid-area: run; display: grid; gap: 6px; }
#output { grid-area: output; display: grid; gap: 6px; justify-items: start; }
#more { grid-area: more; color: var(--muted); font-size: 13px; }
textarea {
  width: 100%; resize: none; height: calc(7 * 1.4em + 14px); max-height: calc(7 * 1.4em + 14px);
  padding: 6px 8px; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px;
}
.hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
@media (max-height: 480px) { .hint { display: none; } #line { font-size: 13px; } }
@media (max-width: 599px) { textarea { height: calc(5 * 1.4em + 14px); max-height: calc(5 * 1.4em + 14px); } }
label { font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
select, input[type=number] {
  font: inherit; min-height: 30px; padding: 2px 6px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px;
}
input[type=number] { width: 9.5em; }
.check { color: var(--muted); }
button {
  font: inherit; font-weight: 600; min-height: 42px; padding: 0 16px; cursor: pointer;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 4px;
}
button:disabled { opacity: .55; cursor: default; }
#wipe { min-height: 30px; font-weight: 500; color: var(--ink); background: transparent; border: 1px solid var(--line); }
#status { display: grid; gap: 3px; min-height: 2.6em; }
#bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
#bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#msg { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#msg.bad { color: var(--bad); }
canvas {
  width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 70px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; image-rendering: auto;
}
#save { font-size: 14px; color: var(--accent); }
#save.disabled { pointer-events: none; color: var(--muted); opacity: .6; }
summary { cursor: pointer; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:where(button, input, textarea, select, summary, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent) !important; outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
