/* studio.css
   Styles for the whole app shell plus the studio dialect classes (so the
   canvas preview matches the exported SVG). No dependencies. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #1d1f23;
  --muted: #6b7280;
  --accent: #2f6feb;
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 8px;
  font-size: 13px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
}

button, input, select {
  font: inherit;
  color: inherit;
  line-height: 1.4;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 6px;
  padding: 8px 12px;
}
button:hover { background: #f0f2f5; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.btn-primary:hover { filter: brightness(1.05); }
button[aria-pressed="true"] { background: #e4ecff; border-color: var(--accent); }

/* ---------- start screen ---------- */
#start {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}
.start-header h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.intro { color: var(--muted); max-width: 56ch; line-height: 1.5; font-size: 14px; }
.start-actions { display: flex; gap: 24px; align-items: center; margin: 32px 0 48px; flex-wrap: wrap; }
.btn-big {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
}
.btn-secondary {
  background: none;
  border: none;
  color: var(--accent);
  padding: 8px 4px;
  font-size: 14px;
}
.btn-secondary:hover { background: none; text-decoration: underline; }

#projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  display: flex; flex-direction: column; gap: 8px;
}
.project-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-card .meta { color: var(--muted); font-size: 12px; line-height: 1.4; }
.project-card .row { display: flex; gap: 8px; margin-top: 8px; }
.project-card .row button { flex: 1; }

/* ---------- photo step ---------- */
#photo-step { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }
.photo-step-header h2 { margin: 0 0 4px; }
.photo-step-header p { color: var(--muted); margin-top: 0; }
#photo-step-body { min-height: 400px; }

/* ---------- studio layout ---------- */
#studio {
  height: 100vh;
  margin: 0;
  padding: 0;
  gap: 0;
  display: grid;
  grid-template-columns: 200px 1fr 300px;
  grid-template-rows: auto 1fr 26px;
  grid-template-areas:
    "topbar topbar topbar"
    "palette stage props"
    "hint hint hint";
}
#studio[hidden] { display: none; }

#topbar {
  grid-area: topbar;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 16px;
  min-height: 48px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
}
.topbar-group#step-strip { justify-content: center; overflow: hidden; }
.topbar-title { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; min-width: 0; }
.topbar-title strong { font-size: 14px; }
#project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.topbar-title span { color: var(--muted); font-size: 12px; }
.topbar-group { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.step-chip { border: 1px solid #d7dbe0; background: #f4f5f7; border-radius: 12px; padding: 4px 12px; font-size: 11px; line-height: 1.4; color: var(--muted); cursor: pointer; }
.step-chip.active { background: #2f6feb; border-color: #2f6feb; color: #fff; }
.step-sep { color: var(--muted); }
.onion-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.saved-chip { color: var(--muted); font-size: 12px; padding: 4px 8px; border-radius: 10px; background: #eef1f4; }
.saved-chip.unsaved { background: #fdf3ea; color: var(--warn); }

#palette {
  grid-area: palette;
  min-width: 160px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 8px;
}

#stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: #e9ebee;
  min-width: 300px;
}
#stage canvas { touch-action: none; display: block; }
#stage .canvas-container { position: absolute; inset: 0; }

#props {
  grid-area: props;
  min-width: 260px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
#properties { padding: 8px; border-bottom: 1px solid var(--border); }
#validation { padding: 8px; }

#hint {
  grid-area: hint;
  display: flex; align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
}

/* ---------- palette chips ---------- */
.palette-section { margin-bottom: 16px; }
.palette-section h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tool-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 12px; }
.tool-btn { font-size: 12px; padding: 8px 8px; text-align: center; line-height: 1.3; }
.chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 8px; margin-bottom: 8px;
  background: #fbfbfc; cursor: grab; user-select: none;
}
.chip:active { cursor: grabbing; }
.chip-preview { width: 30px; height: 22px; border-radius: 2px; flex: none; border: 1px solid #8f959c; display: inline-block; overflow: hidden; margin: 0 4px; }
.chip-preview svg { width: 100%; height: 100%; display: block; }
.chip-label { font-size: 12px; line-height: 1.3; }

/* ---------- properties form ---------- */
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 11px; color: var(--muted); line-height: 1.3; }
.form-row input[type="text"], .form-row input[type="number"], .form-row select {
  border: 1px solid var(--border); border-radius: 5px; padding: 8px 8px;
}
.form-row-inline { display: flex; align-items: center; gap: 8px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.3; border: 1px solid var(--border); border-radius: 5px; padding: 4px 8px; }
.align-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.align-grid button { font-size: 11px; padding: 4px 8px; }
.pin-row { display: flex; align-items: center; gap: 8px; }
.section-title { font-weight: 600; margin: 12px 0 4px; font-size: 12px; line-height: 1.3; }

/* ---------- validation ---------- */
.validation-header { font-weight: 600; margin-bottom: 8px; }
.validation-blocked { color: var(--danger); font-size: 12px; margin-bottom: 8px; }
.validation-list { list-style: none; margin: 0; padding: 0; }
.validation-list li {
  padding: 4px 8px; border-radius: 5px; margin-bottom: 4px; cursor: pointer; font-size: 12px; line-height: 1.3;
}
.validation-list li:hover { background: #f0f2f5; }
.validation-list li.error { color: var(--danger); }
.validation-list li.warning { color: var(--warn); }

/* ---------- dialogs / modals ---------- */
#dialogs { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,22,26,.35);
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.modal {
  background: var(--panel); border-radius: var(--radius);
  padding: 16px 20px; min-width: 280px; max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal h3 { margin: 0 0 12px; font-size: 15px; line-height: 1.3; }
.modal .form-row { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.prompt-example { color: var(--muted); font-size: 11px; margin-top: 4px; }
.modal-actions .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: #1d1f23; color: #fff; padding: 8px 16px; border-radius: 20px;
  font-size: 12px; pointer-events: none; z-index: 100; opacity: 0.95;
}

.suggest-bar {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 16px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); pointer-events: auto; z-index: 60; font-size: 12px; line-height: 1.3;
  transition: opacity .15s;
}
body.dragging .suggest-bar { opacity: 0; pointer-events: none; }

/* export dialog */
.export-snippet { background: #f4f5f7; border-radius: 6px; padding: 8px; font-family: monospace; font-size: 11px; line-height: 1.4; white-space: pre-wrap; max-height: 140px; overflow: auto; margin: 8px 0; }
.export-cmd { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.export-cmd code { background: #f4f5f7; padding: 4px 8px; border-radius: 4px; font-size: 11px; }

/* ---------- dialect classes (studio preview, matches exported SVG) ---------- */
.floor { fill: #ffffff; stroke: #3a3d42; stroke-width: 6; stroke-linejoin: round; }
/* Room / core / void looks are NOT here: they live in js/model/look.js, used
   by the export's own style block, the legend, the palette chips and Trace. */
.stair line { stroke: #8f959c; stroke-width: 2; }
.door  { stroke: #ffffff; stroke-width: 10; }
.lbl   { fill: #2b2e33; font-size: 24px; text-anchor: middle; dominant-baseline: middle; }
.lblS  { fill: #2b2e33; font-size: 19px; text-anchor: middle; dominant-baseline: middle; }
.name  { fill: #1d1f23; font-size: 30px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.exit  { fill: #1a7f37; font-size: 20px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.compass-letter { font-size: 22px; font-weight: 600; fill: #8a8690; text-anchor: middle; }
.compass-north  { fill: #8C0B42; }

/* ---------- studio-only overlay classes ---------- */
.guide { stroke: #00bcd4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ghost { fill: rgba(47,111,235,0.12); stroke: #2f6feb; stroke-width: 1.5; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.sel-outline { fill: none; stroke: #2f6feb; stroke-width: 1.5; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.handle { fill: #ffffff; stroke: #2f6feb; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.repeat-handle { fill: #2f6feb; stroke: #ffffff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.route { stroke: #ff8a00; stroke-width: 3; fill: none; vector-effect: non-scaling-stroke; }
.layer-grid { opacity: 0.5; }
.layer-photo { pointer-events: none; }
.pinned { fill: #b7791f; }

/* ---------- responsive: keep panels usable on narrow screens ---------- */
@media (max-width: 900px) {
  #studio {
    grid-template-columns: 150px 1fr 240px;
  }
  #palette { min-width: 130px; }
  #props { min-width: 200px; }
}

/* --- Simplified properties panel + checklist (appended) --- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border, #444);
  background: transparent; cursor: pointer; font-size: 0.85em; line-height: 1.3;
}
.chip.active { border-color: var(--accent, #4a90d9); background: rgba(74, 144, 217, 0.15); }
/* the palette's pieces are dragged onto the plan: show the grab hand, and let a finger drag them instead of scrolling the panel */
#chip-row .chip { cursor: grab; touch-action: none; }
#chip-row .chip:active { cursor: grabbing; }
.chip-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chip-room .chip-swatch { background: #7ec4ff; }
.chip-big .chip-swatch { background: #ffb454; }
.chip-ours .chip-swatch { background: #7ee787; }
.chip-core .chip-swatch { background: #c792ea; }
.chip-void .chip-swatch { background: #888; }
.field-hint { color: #e05555; font-size: 0.8em; margin-top: 4px; line-height: 1.3; }
.field-hint.hidden { display: none; }
.btn-delete {
  margin-top: 12px; background: #c0392b; color: #fff; border: none;
  padding: 8px 12px; border-radius: 4px; cursor: pointer;
}
.btn-delete:hover { background: #a93226; }
.align-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0; }
.align-grid button { padding: 4px 8px; }

.checklist { list-style: none; padding: 0; margin: 0 0 8px; }
.checklist li { padding: 4px 0; font-size: 0.9em; line-height: 1.3; }
.check-mark { display: inline-block; width: 1.2em; text-align: center; }
.checklist .check-ok .check-mark { color: #2ecc71; }
.checklist .check-pending .check-mark { color: #888; }
.checklist-ready { color: #2ecc71; font-weight: 600; margin: 8px 0; }
.fix-list, .notes-list { list-style: none; padding: 0; margin: 0 0 8px; }
.fix-list li {
  color: #e05555; cursor: pointer; padding: 4px 0; line-height: 1.3; border-bottom: 1px dashed rgba(224, 85, 85, 0.3);
}
.fix-list li:hover { text-decoration: underline; }
.notes-list li {
  color: #d9a441; cursor: pointer; padding: 4px 0; line-height: 1.3; border-bottom: 1px dashed rgba(217, 164, 65, 0.3);
}
.notes-list li:hover { text-decoration: underline; }

/* --- Guided palette / condensed topbar / overlay (added) --- */
.topbar-left { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; margin-left: auto; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 4px 8px; font-size: 12px; }
.btn-quiet { background: none; border: 1px solid var(--border); color: var(--muted); }
.saved-chip { opacity: 0; transition: opacity 0.3s ease; }
.saved-chip.flash { opacity: 1; transition: opacity 0.15s ease; }
.view-popover-wrap { position: relative; }
.popover {
  position: absolute; top: 100%; right: 0; margin-top: 8px; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 200px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.popover[hidden] { display: none; }

.start-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 22, 26, 0.35); z-index: 40;
  pointer-events: none;
}
.start-overlay[hidden] { display: none; }
.start-overlay-card {
  background: var(--panel); border-radius: var(--radius); padding: 24px 32px; text-align: center;
  max-width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  pointer-events: none;
}
.start-overlay-card button { pointer-events: auto; }
.start-overlay-btns [hidden] { display: none; }
.start-overlay-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* The outline was taken away but the plan is still there: a light banner at the top, the plan stays visible. */
.start-overlay.has-plan { align-items: flex-start; background: none; }
.start-overlay.has-plan .start-overlay-card { margin-top: 8px; max-width: 520px; padding: 8px 16px 10px; }
.start-overlay.has-plan .start-overlay-card h3 { margin-bottom: 2px; font-size: 14px; }
.start-overlay.has-plan .start-overlay-card p { margin-bottom: 8px; }
.start-overlay-card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; }
.start-overlay-card p { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.hand-toggle {
  position: absolute; left: 12px; bottom: 12px; z-index: 30;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); font-size: 18px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
}
.hand-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.zoom-controls {
  position: absolute; right: 12px; bottom: 12px; z-index: 30;
  display: flex; gap: 4px;
}
.zoom-controls button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); font-size: 15px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15); padding: 0; display: flex; align-items: center; justify-content: center;
}
#btn-zoom-fit { width: auto; border-radius: 16px; padding: 0 10px; font-size: 11px; }

.palette-step { margin-bottom: 16px; }
.palette-step h4 { margin: 0 0 4px; font-size: 13px; line-height: 1.3; }
.palette-step .step-desc { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.btn-big-tool {
  display: block; width: 100%; height: 36px; box-sizing: border-box; padding: 0 8px; margin-bottom: 8px;
  font-size: 13px; line-height: 1.3;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); cursor: pointer;
}
.btn-big-tool[hidden] { display: none; }
.btn-big-tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-big-tool.btn-detect { color: var(--muted); background: var(--panel-muted, #f5f6f8); }
.btn-big-tool.btn-detect:disabled { cursor: not-allowed; }
.hotkey-hint { color: var(--muted); font-size: 10px; margin-left: 4px; }

/* Connect hallways (step 1, when a floor is outlined building by building) */
.connect-section { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.connect-section[hidden] { display: none; }
.connect-section h5 { margin: 0 0 4px; font-size: 12px; line-height: 1.3; }
.connect-section .btn-big-tool:disabled { opacity: 0.5; cursor: not-allowed; }
.link-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.link-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.link-pt {
  width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--c); background: #fff; color: var(--c);
  font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; flex: none;
}
.link-pt[aria-pressed="true"] { background: var(--c); color: #fff; }
.link-status { flex: 1; min-width: 0; font-size: 11px; line-height: 1.3; color: var(--muted); }
.link-status .chk.ok { color: #1a7f37; font-weight: 600; }
.outline-row { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--border, #d2d2d7); border-radius: 8px; font-size: 12px; }
.outline-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.outline-row button:not(.link-x) { border: 1px solid var(--border, #d2d2d7); background: #fff; border-radius: 999px; font: inherit; font-size: 11px; padding: 2px 9px; cursor: pointer; }
.link-x { border: none; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; flex: none; }

.floor-ghost-dot { fill: var(--accent); stroke: #fff; stroke-width: 1; pointer-events: none; }
.floor-ghost-line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; pointer-events: none; }
.door-ghost-preview { stroke-width: 4; pointer-events: none; }
.door-ghost-preview.ready { stroke: #2fa84f; }
.door-ghost-preview.far { stroke: #9aa0a8; }
.room-ghost-rect { fill: rgba(47, 111, 235, 0.12); stroke: var(--accent); stroke-dasharray: 4 3; pointer-events: none; }

/* guided palette: steps locked until the outline exists */
.palette-step.locked { opacity: 0.45; }
.palette-step.locked .btn-big-tool { cursor: not-allowed; }

/* --- Legend (shared by the palette's collapsible section and Preview) --- */
.legend-list { list-style: none; padding: 0; margin: 8px 0; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; line-height: 1.3; }
.legend-swatch { flex: none; }
.legend-note { color: var(--muted); font-size: 11px; margin: 4px 0 12px; }
.legend-caption { color: var(--muted); font-weight: 400; }
.palette-legend { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.palette-legend summary { cursor: pointer; font-size: 13px; font-weight: 600; }

/* --- Preview step (full-screen panel shown before Export downloads) --- */
.preview-screen {
  position: fixed; inset: 0; z-index: 500; background: var(--panel, #fff);
  display: flex; flex-direction: column; padding: 16px 24px;
  pointer-events: auto;
}
#preview-back-top { align-self: flex-start; background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0 0 8px; }
.preview-header h2 { margin: 0 0 4px; line-height: 1.3; }
.preview-header p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.preview-body { flex: 1; display: flex; gap: 20px; min-height: 0; }
.preview-svg-wrap {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius, 8px);
  background: #ffffff; display: flex; align-items: center; justify-content: center; overflow: auto;
}
.preview-svg-wrap svg { max-width: 100%; max-height: 100%; }
/* The SVG is shown as a white sheet on a grey desk: its edges are exactly the
   downloaded file's edges (Fit to SVG) or the printed page's (Letter/A4). */
#preview-svg-wrap { background: #e8eaed; overflow: hidden; }
#preview-svg-wrap svg.preview-sheet {
  flex: none; background: #ffffff; outline: 1px solid #c7cad0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.10);
}
#preview-svg-wrap.is-paper svg.preview-sheet { outline-color: #9aa0a8; }
.page-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 6px; }
.page-controls-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg[hidden] { display: none; }
.seg button { border: none; border-radius: 0; background: #fff; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.page-note { margin: 0 0 10px !important; font-size: 12px !important; }
.size-controls[hidden] { display: none; }
.size-controls input[type="range"] { width: 180px; accent-color: var(--accent); }
.size-controls output { min-width: 40px; font-size: 13px; font-variant-numeric: tabular-nums; }
.size-step { width: 28px; height: 28px; padding: 0; border-radius: 6px; font-size: 16px; line-height: 1; }
/* The "invisible square" around the drawing on a paper page (preview only). */
.layout-box-rect { fill: rgba(0,0,0,0); pointer-events: all; cursor: move; stroke: #1a73e8; }
.layout-box-handle { fill: #ffffff; stroke: #1a73e8; pointer-events: all; }
.layout-box-nw, .layout-box-se { cursor: nwse-resize; }
.layout-box-ne, .layout-box-sw { cursor: nesw-resize; }
.layout-box-hint { fill: #1a73e8; font-family: sans-serif; pointer-events: none; }
.layout-box.is-dragging .layout-box-rect { fill: rgba(26,115,232,0.04); }
.layout-box.is-dragging .layout-box-hint { display: none; }
.export-page { margin: 0 0 6px; font-size: 13px; }
.export-page-hint { color: var(--muted); font-size: 12px; }
.preview-side { width: 260px; flex: none; overflow-y: auto; }
.preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }
#preview-export:disabled { opacity: 0.5; cursor: not-allowed; }
.chip.disabled { opacity: 0.45; pointer-events: none; }

/* --- Export step (full-screen panel with the format dropdown + Download) --- */
.export-screen {
  position: fixed; inset: 0; z-index: 500; background: var(--panel, #fff);
  display: flex; flex-direction: column; padding: 16px 24px;
  pointer-events: auto;
}
#export-back-top { align-self: flex-start; background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0 0 8px; }
.export-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 480px; }
.export-format-label { font-size: 12px; font-weight: 600; color: var(--muted); }
#export-format { font-size: 13px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); }
#export-download { margin-top: 4px; }
#export-download:disabled { opacity: 0.5; cursor: not-allowed; }
.export-note { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 8px 0 0; }
.export-status { font-size: 12px; line-height: 1.4; margin: 4px 0 0; color: #1a7f37; font-weight: 600; }
.export-status.is-error { color: #b3261e; }
.export-folder { margin-top: 18px; width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 14px; }
.export-folder legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.export-folder-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.export-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0 2px; cursor: pointer; }
.export-toggle input { width: 15px; height: 15px; }
#export-maintainer { margin-top: 16px; width: 100%; }
#export-maintainer summary { cursor: pointer; font-size: 12px; color: var(--muted); }

/* --- Folder line (start screen) --- */
.folder-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.folder-line .btn-link { padding: 2px 6px; }
.folder-modal p { color: var(--muted); font-size: 13px; margin: 0 0 4px; }

/* the View popover must not be clipped by the top bar */
#topbar { overflow: visible; position: relative; z-index: 30; }

/* Block phones: the tracing tools need a mouse and a wide canvas. */
#mobile-block { display: none; }
@media (max-width: 767px) {
  #mobile-block {
    display: flex; position: fixed; inset: 0; z-index: 9999;
    align-items: center; justify-content: center; padding: 24px;
    background: #ffffff; text-align: center;
  }
  #mobile-block .mb-card { max-width: 320px; }
  #mobile-block h1 { font-size: 20px; margin: 0 0 12px; color: #1d1f23; }
  #mobile-block p { font-size: 15px; line-height: 1.4; color: #6b7280; margin: 0; }
  #start, #photo-step, #studio, #dialogs { display: none !important; }
}

#preview-svg-wrap { position: relative; }

/* Compass properties: a live dial + where north points. */
.compass-readout { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.compass-dial { flex: none; }
.compass-readout-label { font-size: 12px; color: var(--muted); }
.compass-readout-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.compass-deg { display: inline-flex; align-items: center; gap: 2px; }
.compass-deg input { width: 58px; }
