:root {
  --paper: #f5efe3; --card: #fffdf8; --ink: #2a2130; --muted: #6a5f6f; --line: #e3d8c4; --accent: #8c4a0e; --accent-ink: #ffffff; --accent-soft: #f6e4c8;
  --brass: #b5781b; --plum: #6b3d74; --warn: #a3302a; --warn-bg: #f8e2dc; --info-bg: #f1e9da; --ok-bg: #e2efe2; --ok-ink: #2f6235; --field: #fbf7ef;
  --l-ambient: #b5781b; --l-task: #5f6b7a; --l-accent: #7a4a9a;
  --v-short: #a3302a; --v-layer: #8c4a0e; --v-ready: #2f6235; --v-ink: #ffffff;
  --shadow: 0 1px 0 rgba(60, 40, 20, 0.05), 0 8px 22px rgba(60, 40, 20, 0.07);
}
html[data-theme="dark"] {
  --paper: #141019; --card: #1e1825; --ink: #f1e9da; --muted: #b9adbf; --line: #3a3042; --accent: #f2b84b; --accent-ink: #1b1622; --accent-soft: #3a2c1a;
  --brass: #f2b84b; --plum: #c79bff; --warn: #ff9a8c; --warn-bg: #3a2324; --info-bg: #2a2131; --ok-bg: #1d2e22; --ok-ink: #8ee6a8; --field: #19141f;
  --l-ambient: #f2b84b; --l-task: #d8dde6; --l-accent: #c79bff;
  --v-short: #ff9a8c; --v-layer: #f2b84b; --v-ready: #8ee6a8; --v-ink: #1b1622;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.55 "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3, .brand strong { font-family: "Didot", "Bodoni 72", "Iowan Old Style", Georgia, serif; }
code { font-size: 0.88em; background: var(--info-bg); padding: 1px 4px; border-radius: 3px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.88rem; } .muted { color: var(--muted); }

.top, .bar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; box-shadow: var(--shadow); }
.back { text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.logo { width: 26px; height: 26px; }
.lg-shade { fill: #f2b84b; stroke: #8c4a0e; stroke-width: 1; } .lg-stem, .lg-base { fill: #6a5f6f; } .lg-glow { fill: #fff3cf; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-s { font-size: 0.85rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

.btn, .pill { font: inherit; font-size: 0.9rem; border: 1.5px solid var(--accent); color: var(--accent); background: transparent; border-radius: 8px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover:not(:disabled), .pill:hover { background: var(--accent-soft); }
.btn.solid, .pill.solid { background: var(--accent); color: var(--accent-ink); }
.btn.solid:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); color: var(--accent-ink); }
.btn.big { font-size: 1.05rem; padding: 10px 20px; }
.btn.tiny, .pill.tiny { font-size: 0.8rem; padding: 4px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

main { max-width: 1120px; margin: 0 auto; padding: 18px 16px 30px; }
.hero { padding: 16px 0 6px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.78rem; color: var(--brass); font-weight: 600; }
h1 { font-size: 2.6rem; margin: 4px 0 8px; line-height: 1.1; overflow-wrap: anywhere; }
h1 .sub { display: block; font-size: 1.12rem; font-weight: 400; font-style: italic; color: var(--muted); margin-top: 6px; }
.lede { max-width: 760px; }
.samples { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 4px; }
.sample { font: inherit; font-size: 0.86rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 13px; cursor: pointer; }
.sample:hover { border-color: var(--accent); }
.sample.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 18px 0; box-shadow: var(--shadow); }
.ch { margin: 0 0 10px; font-size: 1.36rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh { font-size: 1.05rem; margin: 18px 0 4px; }
.sh .small { font-family: "Avenir Next", Helvetica, Arial, sans-serif; font-weight: 400; }
.no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 0.92rem; font-family: "Avenir Next", Helvetica, Arial, sans-serif; }
.free, .paid { font-family: "Avenir Next", Helvetica, Arial, sans-serif; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; border-radius: 999px; padding: 2px 9px; }
.free { background: var(--ok-bg); color: var(--ok-ink); } .paid { background: var(--warn-bg); color: var(--warn); }
.fld { margin: 8px 0; }
.lab { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 3px; }
.inp { width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.inp:focus, .plan [data-uid]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.inp.narrow { width: auto; max-width: 15em; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.grid3 .wide { grid-column: span 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 4px; }
.actions.tight { margin: 6px 0; gap: 6px; }
.note { background: var(--info-bg); border-left: 3px solid var(--brass); padding: 8px 10px; border-radius: 6px; font-size: 0.9rem; }

.rows { list-style: none; padding: 0; margin: 6px 0; }
.row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; background: var(--field); }
.row.none { color: var(--muted); font-style: italic; display: block; }
.rf { display: flex; flex-direction: column; min-width: 0; }
.rf .lab { font-weight: 500; font-size: 0.72rem; color: var(--muted); margin: 0 0 2px; }
.rf.grow { flex: 1 1 11em; } .rf.short { width: 6.6em; }
.rf select.inp { min-width: 8em; }
.rowno { font-weight: 700; align-self: center; min-width: 2.2em; border-radius: 6px; padding: 2px 6px; text-align: center; background: var(--info-bg); border: 2px solid var(--line); font-size: 0.85rem; }
.rowno.ly-ambient { border-color: var(--l-ambient); } .rowno.ly-task { border-color: var(--l-task); } .rowno.ly-accent { border-color: var(--l-accent); }
.dimbox { font-size: 0.85rem; align-self: center; white-space: nowrap; }
.where { align-self: center; white-space: nowrap; }
.x { font: inherit; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.25rem; line-height: 1; padding: 4px 6px; align-self: center; margin-left: auto; }
.x:hover { color: var(--warn); }

.planwrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.plan { width: 100%; border-radius: 14px; overflow: hidden; -webkit-user-select: none; user-select: none; touch-action: none; }
.plan svg { width: 100%; height: auto; display: block; }
.plan [data-uid] { cursor: grab; }
.plan .focus circle:last-of-type, .plan .focus rect:nth-of-type(2) { filter: drop-shadow(0 0 4px #fff3cf); }
.scenes { display: flex; gap: 6px; flex-wrap: wrap; }
.stab { font: inherit; font-size: 0.85rem; border: 1px solid var(--line); background: var(--field); color: var(--ink); border-radius: 8px; padding: 4px 11px; cursor: pointer; }
.stab.on { background: var(--plum); border-color: var(--plum); color: #ffffff; }
html[data-theme="dark"] .stab.on { color: #1b1622; }
.tinysel { width: auto; padding: 3px 6px; font-size: 0.85rem; }
.faders { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.fader { display: grid; grid-template-columns: minmax(0, 1fr) 8.5em 3em; gap: 8px; align-items: center; }
.fader .lab { margin: 0; font-weight: 500; font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fader input[type="range"] { width: 100%; accent-color: var(--brass); }
.fader .small { grid-column: 1 / -1; margin-top: -6px; }
.fv { font-variant-numeric: tabular-nums; font-size: 0.85rem; text-align: right; }
.readouts { display: flex; flex-direction: column; gap: 8px; }
.ro { border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--field); }
.ro.st-short { border-left-color: var(--v-short); } .ro.st-in { border-left-color: var(--v-ready); } .ro.st-over { border-left-color: var(--v-layer); }
.rohead { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.rohead b { overflow-wrap: anywhere; }
.rolux { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.robar { position: relative; height: 10px; border-radius: 5px; background: var(--info-bg); margin: 5px 0 3px; overflow: hidden; }
.roband { position: absolute; top: 0; bottom: 0; background: var(--ok-bg); border-left: 2px solid var(--v-ready); border-right: 2px solid var(--v-ready); }
.rofill { position: absolute; left: 0; top: 3px; height: 4px; background: var(--brass); border-radius: 2px; }
.verdict { margin-top: 12px; }
.vline { font-size: 0.95rem; margin: 2px 0 6px; }
.vtag { display: inline-block; font-size: 0.78rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; color: var(--v-ink); white-space: nowrap; letter-spacing: 0.02em; }
.vtag.v-short-of-light { background: var(--v-short); } .vtag.v-missing-a-layer { background: var(--v-layer); } .vtag.v-ready-for-scenes { background: var(--v-ready); }
.layers { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.lchip { font-size: 0.78rem; border: 2px solid var(--line); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.lchip.ly-ambient { border-color: var(--l-ambient); } .lchip.ly-task { border-color: var(--l-task); } .lchip.ly-accent { border-color: var(--l-accent); }
.lchip.miss { border-style: dashed; color: var(--muted); }
.findings { padding-left: 18px; font-size: 0.9rem; margin: 6px 0; }
.findings li.bad { color: var(--warn); } .findings li.warn { color: var(--accent); } .findings li.ok { color: var(--ok-ink); }

.progress { border: 1px dashed var(--brass); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.steps { list-style: none; padding: 0; margin: 6px 0; }
.step { color: var(--muted); } .step.done { color: var(--ok-ink); } .step.active { color: var(--ink); font-weight: 600; }
.step-ic { display: inline-block; width: 1em; font-family: monospace; }
.raw { white-space: pre-wrap; background: var(--paper); padding: 10px; border-radius: 8px; font-size: 0.82rem; max-height: 320px; overflow: auto; }

.result { margin-top: 12px; border-top: 2px solid var(--brass); padding-top: 10px; }
.result.empty #rReconH, .result.empty .recon { display: none; }
.rhead { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 0.75rem; letter-spacing: 0.08em; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); }
.badge.on { border-color: var(--accent); color: var(--accent); }
.headline { font-family: Georgia, serif; font-size: 1.18rem; margin: 10px 0 6px; }
.layersnote { margin: 4px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.pcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--field); display: flex; flex-direction: column; gap: 4px; }
.pcard.add { border-style: dashed; border-color: var(--brass); }
.pcard p { margin: 2px 0; }
.pcard .btn { align-self: flex-start; margin-top: 4px; }
.pchead { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pchead b { overflow-wrap: anywhere; }
.tchip { font-size: 0.74rem; border-radius: 999px; padding: 1px 8px; background: var(--info-bg); white-space: nowrap; }
.pclux { font-size: 0.88rem; font-weight: 600; }
.pclux.st-short { color: var(--warn); } .pclux.st-in { color: var(--ok-ink); } .pclux.st-over { color: var(--accent); }
.lvls { list-style: none; padding: 0; margin: 2px 0; display: flex; flex-direction: column; gap: 2px; }
.lvls li { position: relative; font-size: 0.8rem; padding: 1px 6px; border-radius: 4px; overflow: hidden; }
.lvls li.off { color: var(--muted); }
.lvbar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; }
.lvt { position: relative; z-index: 1; }
.checkfirst { border: 1px solid var(--line); border-left: 4px solid var(--plum); border-radius: 8px; padding: 8px 10px; margin: 12px 0 4px; font-size: 0.92rem; }
.recon { padding-left: 18px; font-size: 0.9rem; }
.recon li.bad { color: var(--warn); font-weight: 600; } .recon li.warn { color: var(--warn); } .recon li.none { color: var(--muted); list-style: none; margin-left: -18px; }
.saved { list-style: none; padding: 0; margin: 8px 0; }
.hrow { display: flex; gap: 10px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 0; }
.hrow.none { color: var(--muted); font-style: italic; }
.hinfo { display: flex; flex-direction: column; min-width: 0; } .hinfo b { overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; flex-shrink: 0; }
.about p { max-width: 840px; }
.foot { max-width: 1120px; margin: 0 auto; padding: 8px 16px 40px; font-size: 0.85rem; color: var(--muted); }
.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(380px, calc(100vw - 28px)); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); transition: opacity 0.5s; }
.toast.err { border-left-color: var(--warn); } .toast.gone { opacity: 0; }

@media (max-width: 860px) {
  .planwrap { grid-template-columns: 1fr; }
  h1 { font-size: 2.1rem; }
}
@media (max-width: 560px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 .wide { grid-column: span 2; }
  .rf.grow { flex-basis: calc(100% - 5em); }
  .rf select.inp { min-width: 0; }
  .lamprow .rf:not(.grow), .spotrow .rf:not(.grow) { flex: 1 1 40%; }
  .lamprow .rf.short { width: auto; }
}
@media (max-width: 420px) {
  .top { padding: 8px 12px; gap: 8px; }
  .back-t { display: none; }
  .brand { font-size: 1rem; }
  .btn { padding: 5px 10px; }
  .card { padding: 14px 12px; }
  .fader { grid-template-columns: minmax(0, 1fr) 6.5em 2.8em; }
}
@media print {
  .top, .samples, .actions, .exports, #runBtn, .toasts, .foot, .hero .lede, .faders, .scenes { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
