:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #16181b;
  --muted: #6b6f76;
  --line: #e3e1dc;
  --accent: #1f5c4a;
  --accent-ink: #ffffff;
  --pass: #1f7a4d;
  --warn: #a86b00;
  --fail: #b3261e;
  --unknown: #4a5a8a;
  --chip-pass: #e4f3ea;
  --chip-warn: #fbf0db;
  --chip-fail: #fbe5e3;
  --chip-unknown: #e6eaf5;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: "Inter Tight", system-ui, -apple-system, Segoe UI, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315; --panel: #1a1d20; --ink: #eceae6; --muted: #9aa0a8; --line: #2b2f34;
    --accent: #5fbf9a; --accent-ink: #0d1a15;
    --chip-pass: #16301f; --chip-warn: #33280f; --chip-fail: #3a1714; --chip-unknown: #1d2438;
    --pass: #6fd49b; --warn: #e6b04a; --fail: #ff8a80; --unknown: #9fb2ee;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
nav { display: flex; gap: 10px; align-items: center; }
main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; }
.step { display: flex; gap: 14px; align-items: baseline; }
.step .n { font: 600 12px var(--mono); color: var(--muted); min-width: 22px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
button, .btn { font: 600 14px var(--sans); border-radius: 8px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input, select, textarea { width: 100%; font: 14px var(--sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { padding: 2px; width: 44px; height: 38px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two { grid-template-columns: 1fr; } main { padding: 20px 16px 60px; } .top { padding: 12px 16px; } }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
.chip { display: inline-block; font: 600 12px var(--sans); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.PASS, .chip.built { background: var(--chip-pass); color: var(--pass); }
.WARN { background: var(--chip-warn); color: var(--warn); }
.FAIL, .chip.failed { background: var(--chip-fail); color: var(--fail); }
.UNKNOWN, .chip.todo { background: var(--chip-unknown); color: var(--unknown); }
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.card.chosen { outline: 3px solid var(--accent); outline-offset: -1px; }
.card .img { background: #111; aspect-ratio: 1 / 2; display: grid; place-items: center; }
.card .img img { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.stage { position: relative; width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #111; }
.stage img { display: block; width: 100%; }
.box { position: absolute; border: 2px solid; border-radius: 3px; pointer-events: none; }
.box .tag { position: absolute; top: -22px; left: -2px; font: 600 11px var(--sans); padding: 2px 6px; border-radius: 4px; white-space: nowrap; color: #fff; }
.mono { font-family: var(--mono); font-size: 13px; }
pre { white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow: auto; max-height: 420px; }
.runs li { margin: 4px 0; }
.muted { color: var(--muted); }
.err { color: var(--fail); font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }
.login { max-width: 360px; margin: 12vh auto 0; }
.files a { display: inline-block; margin: 0 12px 6px 0; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: s 0.8s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }

.roles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.role { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 6px 10px; }
.role.on { background: var(--bg); box-shadow: 0 0 0 2px var(--accent) inset; }
.role .pick { border: 0; background: none; padding: 2px 0; font-weight: 600; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.stage.draw .band { position: absolute; border: 1px dashed rgba(255,255,255,.55); cursor: pointer; }
.stage.draw .band:hover { background: rgba(255,255,255,.12); border-style: solid; }
.stage .box { pointer-events: none; }
