:root {
  --paper: #eef2f3;
  --panel: #ffffff;
  --ink: #16242c;
  --muted: #5a6b74;
  --line: #ccd6db;
  --gt: #0a8f9c;        /* footprints: cyan-teal */
  --roof: #c0238a;      /* rooftops: magenta */
  --focus: #1f6fd1;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a252c; --panel: #22303a; --ink: #e4ecef; --muted: #9aaab3;
    --line: #34454f; --gt: #2fc4d1; --roof: #ef5fbd; --focus: #6aa7ff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--font); font-variation-settings: "wdth" 100;
}
a { color: inherit; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.masthead { padding: 28px clamp(16px, 4vw, 40px) 12px; max-width: 1500px; margin: 0 auto; }
.masthead h1 {
  margin: 0; font-size: clamp(30px, 4.6vw, 54px); line-height: 1; letter-spacing: -0.01em;
  font-weight: 800; font-variation-settings: "wdth" 125;
}
.lede { max-width: 68ch; margin: 12px 0 4px; color: var(--muted); }
.paper { margin: 0; font-size: 13px; color: var(--muted); }

.workbench {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px;
  padding: 12px clamp(16px, 4vw, 40px) 24px; max-width: 1500px; margin: 0 auto; align-items: start;
}
@media (max-width: 860px) { .workbench { grid-template-columns: 1fr; } .viewer { order: -1; } }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px;
}
.step[data-locked] { opacity: .45; pointer-events: none; }
.step h2 {
  margin: 0 0 2px; font-size: 16px; font-weight: 700; font-variation-settings: "wdth" 112;
  display: flex; align-items: center; gap: 8px;
}
.step .n {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink);
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
}
.step label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.or { font-size: 12.5px; color: var(--muted); }
.status { margin: 0; font-size: 13px; min-height: 1em; }
.status.err { color: #c62828; }
.metric { margin: 0; font-size: 22px; font-weight: 700; font-variation-settings: "wdth" 110; }
.metric small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); font-variation-settings: "wdth" 100; }

button, select, input[type=number] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); font-weight: 600; }
input[type=text] { font: inherit; font-size: 13px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%; }
details#geoOpts { display: flex; flex-direction: column; gap: 6px; }
details#geoOpts[open] > label { margin-top: 6px; }
input[type=file] { font-size: 12.5px; color: var(--ink); max-width: 100%; }
.file.subtle { margin-top: 2px; }
input[type=range] { width: 100%; accent-color: var(--ink); }

.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; }
.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.seg button[aria-pressed=true] { background: var(--roof); border-color: var(--roof); color: #fff; }
#toolErase[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--panel); }

.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .15s; }

details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
#log {
  max-height: 180px; overflow: auto; font-size: 11.5px; line-height: 1.4; margin: 6px 0 0;
  white-space: pre-wrap; color: var(--muted);
}

.viewer {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  display: flex; flex-direction: column; min-width: 0; position: sticky; top: 12px;
}
@media (max-width: 860px) { .viewer { position: static; } }
.views { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); }
.views button { border: 0; background: none; padding: 6px 10px; border-radius: 4px; color: var(--muted); }
.views button[aria-current=true] { background: var(--paper); color: var(--ink); font-weight: 600; }
.stage {
  position: relative; overflow: auto; height: min(78vh, 900px); min-height: 320px;
  background:
    repeating-conic-gradient(var(--paper) 0 25%, transparent 0 50%) 0 0 / 20px 20px;
  display: grid; place-items: center;
}
.stage canvas { display: block; touch-action: none; image-rendering: auto; }
.stage.zoomed { place-items: start; }
.stage.zoomed canvas { image-rendering: pixelated; }
.stage canvas.paint { cursor: crosshair; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
#swipe {
  position: absolute; left: 16px; right: 16px; bottom: 12px; width: auto;
  accent-color: var(--roof);
}
.viewbar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend span::before {
  content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 6px;
  vertical-align: middle; background: var(--c);
}
.zoom { display: flex; gap: 4px; }
.zoom button { min-width: 36px; }

footer {
  max-width: 1500px; margin: 0 auto; padding: 4px clamp(16px, 4vw, 40px) 32px;
  font-size: 12.5px; color: var(--muted);
}
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
