:root { --bg: #fff; --fg: #1d1d1f; --muted: #666; --line: #d8d8dc; --accent: #0b57d0; --panel: #f5f5f7; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #17171a; --fg: #ececf0; --muted: #a0a0a8; --line: #3a3a40; --accent: #8ab4f8; --panel: #222226; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; }
a { color: var(--accent); }
.note { margin: 4px 0; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 8px; }
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--fg); font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn[disabled], .disabled { opacity: .5; pointer-events: none; }
.btn.small { padding: 2px 10px; font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; }
#status { min-height: 1.5em; margin: 8px 0; }
#status.error { color: #c5221f; }
@media (prefers-color-scheme: dark) { #status.error { color: #ff8a80; } }
body.dragging main { outline: 3px dashed var(--accent); outline-offset: -3px; }
.summary { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-bottom: 10px; }
.check { cursor: pointer; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
#stage { position: relative; line-height: 0; border: 1px solid var(--line); }
#shot { width: 100%; height: auto; display: block; }
#overlay { position: absolute; inset: 0; pointer-events: none; }
#overlay.off { display: none; }
#overlay .box { position: absolute; border: 2px solid; pointer-events: auto; }
#overlay .box:hover { background: rgba(255, 255, 255, .25); }
#tip { margin-top: 6px; padding: 4px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  font: 13px/1.4 ui-monospace, monospace; min-height: 1.6em; }
#legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; }
#legend li { display: flex; align-items: center; gap: 5px; }
#legend .sw { width: 12px; height: 12px; border: 2px solid; display: inline-block; }
.treehead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
#tree { margin: 0; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  font: 12px/1.45 ui-monospace, monospace; max-height: 75vh; overflow: auto; white-space: pre; }
.limits { margin-top: 28px; }
.links, footer { color: var(--muted); font-size: .9rem; }
footer { margin-top: 8px; padding-bottom: 24px; }
@media (max-width: 800px) { .cols { grid-template-columns: minmax(0, 1fr); } #tree { max-height: 50vh; } }
