/* plan3d web: tokens in DESIGN.md (top six lines) */
:root {
  --bg: #ffffff; --surface: #f4f6f9; --line: #d8dee6; --ink: #18202b; --ink-2: #4a5563;
  --accent: #2450d8; --accent-ink: #ffffff; --error: #c62828;
  --r-1: 4px; --r-2: 8px;
  --shadow: 0 2px 8px rgba(16, 24, 40, .12);
  --bar-h: 56px; --side-w: 376px; --tap: 44px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
@media (min-width: 1024px) { :root { --tap: 36px; } }
@media (min-width: 1101px) { .tools { position: absolute; left: 50%; top: 0; bottom: 0; transform: translateX(-50%); } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  word-break: keep-all; overflow-wrap: break-word;
  font: 400 16px/24px var(--font); color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100svh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 16px; padding: 0 16px; min-height: var(--bar-h);
  border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 3; flex: none;
}
.actions { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; font-size: 18px; line-height: 26px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; flex: none; }
.file {
  margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); flex: 0 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.tools, .export { display: flex; gap: 4px; align-items: center; }
.tools { flex: 1 1 auto; justify-content: center; min-width: 0; }
.export { flex: none; }
.tool {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap); padding: 2px 12px; border: 0; border-radius: var(--r-1); background: none;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); white-space: nowrap;
}
.tool small { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-2); }
.tool:disabled { color: var(--ink-2); font-weight: 400; }
.tool[aria-pressed="true"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.tool[aria-pressed="true"]:disabled { color: var(--ink-2); box-shadow: none; }
body[data-state="model"] .tool[aria-pressed="true"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); cursor: default; }

/* ---------- main ---------- */
.main { flex: 1 1 auto; position: relative; display: flex; flex-direction: column; min-height: 0; }

.notice {
  position: absolute; z-index: 4; top: 16px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); display: flex; gap: 16px; align-items: flex-start;
  padding: 16px; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--error);
  border-radius: var(--r-2); box-shadow: var(--shadow);
}
.notice-text { flex: 1 1 auto; min-width: 0; }
.notice strong { display: block; font-weight: 600; color: var(--error); }
.notice p { margin: 4px 0 0; font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.notice-close { flex: none; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg); font-size: 14px; }
body[data-state="empty"] .notice { position: relative; top: auto; left: auto; transform: none; margin: 24px auto 0; box-shadow: none; }

/* ---------- start (empty state) ---------- */
.start {
  flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 32px;
  padding: 48px 24px; background-color: var(--bg);
  background-image: linear-gradient(#eef1f5 1px, transparent 1px), linear-gradient(90deg, #eef1f5 1px, transparent 1px);
  background-size: 24px 24px; background-position: center top;
}
.drop {
  width: min(640px, 100%); padding: 48px 32px; text-align: center; background: var(--bg);
  border: 2px dashed #9aa6b5; border-radius: var(--r-2);
}
.drop h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
.lead { margin: 12px auto 0; max-width: 520px; color: var(--ink-2); }
.pick { margin-top: 24px; }
.primary {
  min-height: 48px; padding: 0 24px; border: 0; border-radius: var(--r-1);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.primary:hover { background: #1c41b5; }
.formats { margin: 24px auto 0; max-width: 520px; font-size: 14px; line-height: 20px; color: var(--ink-2); }

.samples { width: min(640px, 100%); background: var(--bg); }
.samples h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.samples-note { margin: 4px 0 12px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.sample-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sample {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg); text-align: left;
}
.sample span { font-weight: 500; }
.sample small { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.sample:hover { border-color: var(--accent); }
.local { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); text-align: center; }
.start .local { background: var(--bg); padding: 0 8px; }

/* ---------- work (model) ---------- */
.work { flex: 1 1 auto; display: flex; min-height: 0; }
.stage { position: relative; flex: 1 1 auto; min-width: 0; background: #fafbfc; overflow: hidden; }
.gl { position: absolute; inset: 0; touch-action: none; }
.gl canvas { display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.room-label {
  pointer-events: none; text-align: center; white-space: nowrap; font-size: 13px; line-height: 17px;
}
.room-label b { display: block; font-weight: 600; color: var(--ink); }
.room-label span { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.stage-msg { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--ink-2); }
.hint { position: absolute; left: 16px; bottom: 12px; margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-2); pointer-events: none; }

.side {
  flex: none; width: var(--side-w); border-left: 1px solid var(--line); background: var(--surface);
  overflow-y: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px;
}
.block { display: flex; flex-direction: column; gap: 8px; }
.h { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.note { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.stepper { display: flex; align-items: center; gap: 8px; }
.step {
  width: var(--tap); height: var(--tap); flex: none; padding: 0; border: 1px solid #738093; border-radius: var(--r-1);
  background: var(--bg); font-size: 16px; line-height: 1;
}
.stepper input {
  width: 88px; height: var(--tap); padding: 0 8px; border: 1px solid #738093; border-radius: var(--r-1);
  background: var(--bg); text-align: right; font-weight: 500;
}
.stepper input { -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:invalid { border-color: var(--error); }
.unit { color: var(--ink-2); margin-left: -4px; }

.rooms-t { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; background: var(--bg); border-radius: var(--r-2); overflow: hidden; }
.rooms-t caption { text-align: left; font-weight: 600; padding: 8px 0 4px; caption-side: top; }
.rooms-t th, .rooms-t td { padding: 8px 12px; text-align: right; border-top: 1px solid #e8ecf1; font-weight: 400; }
.rooms-t th:first-child, .rooms-t td:first-child { text-align: left; }
.rooms-t thead th { color: var(--ink-2); font-size: 12px; line-height: 16px; border-top: 0; }
.rooms-t td.n { font-weight: 500; overflow-wrap: anywhere; }
.rooms-t tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.total { gap: 0; }
.total-n { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; }
.total-n.none { font-size: 18px; line-height: 26px; color: var(--ink-2); }
.counts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 14px; line-height: 20px; }
.counts dt { color: var(--ink-2); }
.counts dd { margin: 0; font-weight: 500; }
.ghost { min-height: var(--tap); padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg); font-weight: 500; align-self: flex-start; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.side .local { text-align: left; margin-top: auto; }

.dragover {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: rgba(36, 80, 216, .08); border: 3px dashed var(--accent); pointer-events: none;
}
.dragover p { margin: 0; padding: 12px 24px; background: var(--bg); border-radius: var(--r-2); font-size: 18px; line-height: 26px; font-weight: 600; color: var(--accent); box-shadow: var(--shadow); }

/* ---------- stage controls (anatomy views, view directions) ---------- */
.stage-top {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: space-between; align-items: flex-start; pointer-events: none;
}
.bar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; pointer-events: auto; min-width: 0; }
.bar-group:empty { display: none; }
.seg {
  display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-1); overflow: hidden; flex: none;
}
.seg button {
  min-height: var(--tap); min-width: 48px; padding: 0 12px; border: 0; border-right: 1px solid var(--line);
  background: none; font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chip {
  min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg);
  font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; flex: none;
}
.chip:hover { border-color: #9aa6b5; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip.strong { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.strong:hover { background: #1c41b5; }
.chip:disabled { color: #9aa3ae; border-color: var(--line); background: var(--bg); cursor: default; }
.chip kbd { font: inherit; font-size: 12px; color: var(--ink-2); margin-left: 4px; }
.stage-chip {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; margin: 0; padding: 8px 16px;
  background: rgba(24, 32, 43, .86); color: #fff; border-radius: var(--r-2); font-size: 14px; line-height: 20px; pointer-events: none;
}
body.walking .stage-chip { top: auto; bottom: 16px; transform: translateX(-50%); }
/* the plan view's measure: its one line at the bottom, clear of the plan (at the left on a narrow stage, clear of the scale bar) */
body.plan-measuring .stage-chip { top: auto; bottom: 16px; transform: translateX(-50%); white-space: nowrap; }
@media (max-width: 599px) { body.plan-measuring .stage-chip { left: 8px; bottom: 8px; transform: none; } }

/* section handle: a round grip on the cutting plane */
.sec-handle {
  pointer-events: auto; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 2px solid #fff;
  background: var(--accent); box-shadow: var(--shadow); cursor: grab; touch-action: none; display: grid; place-items: center;
}
.sec-handle span { width: 14px; height: 14px; background: no-repeat center / contain; }
.sec-handle[data-kind="h"] span { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 1l4 4H3zM7 13l4-4H3z' fill='%23fff'/%3E%3C/svg%3E"); }
.sec-handle[data-kind="v"] span { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M1 7l4-4v8zM13 7l-4-4v8z' fill='%23fff'/%3E%3C/svg%3E"); }
.sec-handle.dragging { cursor: grabbing; transform: scale(1.08); }
@media (max-width: 1023px) { .sec-handle { width: 44px; height: 44px; } }

/* room labels: the inner box takes the collision offset and the short form */
.room-label .rl {
  position: relative; padding: 1px 6px; transition: transform .15s ease-out; background: rgba(255, 255, 255, .88);
  border-radius: var(--r-1); box-shadow: 0 0 0 1px rgba(24, 32, 43, .08);
}
.room-label .rl.short { padding: 1px 5px; }
.room-label .rl.short span { display: none; }
.room-label .rl.tiny { padding: 0 4px; font-size: 11px; line-height: 15px; }
.room-label .rl .ld { display: none; }
.room-label .rl.lead .ld {
  display: block; position: absolute; left: 50%; top: 50%; height: 0; border-top: 1px solid var(--ink); transform-origin: 0 0;
}
.room-label .rl.lead .ld::after { content: ""; position: absolute; right: -2.5px; top: -3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
/* the scale bar sits on its own patch of paper, so a dimension run zoomed under it never crosses its numbers */
.plan-scale { position: absolute; right: 10px; bottom: 6px; z-index: 1; padding: 6px; background: rgba(255, 255, 255, .94); border-radius: var(--r-1); pointer-events: none; font-size: 11px; line-height: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan-scale svg { display: block; }
.plan-scale div { display: flex; justify-content: space-between; margin-top: 2px; }
.storey-tag, .gap-label, .dim-label { pointer-events: none; white-space: nowrap; font-size: 12px; line-height: 16px; }
.storey-tag { padding: 2px 8px; background: var(--ink); color: #fff; border-radius: var(--r-1); font-weight: 500; transform: translateX(-60%); }
.gap-label { color: var(--error); font-weight: 600; background: rgba(255, 255, 255, .9); padding: 0 4px; border-radius: 2px; margin-top: 24px; }
.dim-label { color: var(--ink); font-size: 11px; line-height: 14px; }
.dim-label span { display: block; padding: 0 2px; }
.dim-h span { transform: translateY(-62%); }
.dim-v span { transform: rotate(-90deg) translateY(-62%); }
.north { pointer-events: none; display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink); }
.north svg { display: block; }
.up-label { pointer-events: none; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink); background: #fff; padding: 0 2px; }

/* build-up callouts */
.callouts { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.callouts .leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.callouts .leaders path { fill: none; stroke: var(--ink); stroke-width: 1; }
.co {
  position: absolute; left: 0; top: 0; display: flex; gap: 8px; align-items: baseline; white-space: nowrap;
  padding: 2px 8px; background: rgba(255, 255, 255, .94); border-left: 2px solid var(--ink); font-size: 13px; line-height: 18px;
}
.co[data-side="left"] { border-left: 0; border-right: 2px solid var(--ink); }
.co b { font-weight: 500; }
.co span { color: var(--ink-2); font-size: 12px; }
.co i, .layer-list .lno {
  flex: none; font-style: normal; font-size: 11px; line-height: 16px; min-width: 16px; height: 16px; text-align: center;
  border: 1px solid var(--ink); border-radius: 50%; font-variant-numeric: tabular-nums; align-self: center;
}
.callouts.compact .co { padding: 0; border: 0; background: none; }
.callouts.compact .co b, .callouts.compact .co span { display: none; }
.callouts.compact .co i { min-width: 24px; height: 24px; line-height: 22px; font-size: 13px; font-weight: 600; background: #fff; }

/* construction steps */
.stepbar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2; width: min(640px, calc(100% - 24px));
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: 12px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow);
}
.step-head { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.step-n { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.step-t { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.step-x { grid-column: 1; margin: 0; font-size: 14px; line-height: 20px; color: var(--ink); }
.step-ctl { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
body[data-mode="steps"] .hint { display: none; }

/* walk */
.walk-ui { position: absolute; inset: auto 16px 16px 16px; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.walk-ui .chip { pointer-events: auto; background: rgba(255, 255, 255, .94); }
.walk-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; width: 100%; }
.walk-left, .walk-right { display: flex; gap: 8px; align-items: center; }
.walk-q { min-width: var(--tap); padding: 0; font-weight: 600; }
.walk-help { pointer-events: auto; display: flex; align-items: center; gap: 4px; max-width: min(560px, calc(100% - 196px)); padding: 6px 6px 6px 12px;
  background: rgba(24, 32, 43, .88); color: #fff; border-radius: var(--r-2); font-size: 14px; line-height: 20px; }
.walk-help p { margin: 0; }
.walk-help-x { flex: none; min-height: 32px; padding: 0 8px; border: 0; background: none; color: #c9d0d9; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.walk-help-x:hover { color: #fff; }
.walk-help[hidden] { display: none; }
.walk-pop { pointer-events: auto; width: min(360px, 100%); max-width: min(360px, 100%); max-height: min(52vh, 420px); overflow: auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow); }
.walk-pop[hidden] { display: none; }
.walk-set { display: grid; gap: 10px; width: min(300px, 100%); }
.ws-row { display: grid; grid-template-columns: 76px 1fr 56px; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; }
.ws-row output { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; }
.ws-row input { width: 100%; min-width: 0; accent-color: var(--ink); }
.ws-check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; }
.ws-check input { width: 16px; height: 16px; accent-color: var(--ink); }
.ws-note { margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-2); }
@media (pointer: coarse) { .ws-mouse { display: none; } }
/* the centre dot while the mouse turns the view, and a small quiet chip at the bottom centre (above the walk's
   button row) that says how to take the mouse again: a status line, not an alert */
.walk-cross { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; z-index: 2; pointer-events: none;
  background: #fff; box-shadow: 0 0 0 1.5px rgba(24, 32, 43, .7), 0 0 0 4px rgba(255, 255, 255, .35); }
.walk-lock { position: absolute; left: 50%; bottom: calc(16px + var(--tap) + 12px); transform: translateX(-50%); z-index: 2; margin: 0; padding: 3px 10px; pointer-events: none;
  max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
  background: rgba(255, 255, 255, .9); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-1); font-size: 12px; line-height: 18px; }
/* the measure: drawn like the drawings (ink lines, ticks, tabular figures on a white halo) */
.measure { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: visible; }
.measure .ml, .measure .mt { stroke: #18202b; stroke-width: 1.1; }
.measure .mx { stroke: #18202b; stroke-width: .7; opacity: .7; }
.measure .me { stroke: #18202b; stroke-width: .8; stroke-dasharray: 4 3; opacity: .6; }
.measure line { paint-order: stroke; filter: drop-shadow(0 0 1.2px #fff) drop-shadow(0 0 1.2px #fff); }
.measure .mn { font: 500 13px/1 var(--mono); font-variant-numeric: tabular-nums; fill: #18202b; text-anchor: middle; dominant-baseline: middle;
  stroke: #fff; stroke-width: 4px; stroke-linejoin: round; paint-order: stroke; }
/* the plan view's measure: the same ink as the plan's dimensions, a ring (a square on a corner) at the snapped point */
.plan-measure .mn { font: 400 11px/1 var(--font); font-variant-numeric: tabular-nums; }
.plan-measure .mk { fill: rgba(255, 255, 255, .9); stroke: var(--accent); stroke-width: 1.5; }
body.plan-measuring #gl canvas { cursor: crosshair; }
.measure-card { position: absolute; left: 16px; top: 120px; z-index: 2; pointer-events: none; min-width: 168px; max-width: calc(100% - 32px);
  padding: 8px 12px; background: rgba(255, 255, 255, .94); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow); }
.measure-card[hidden] { display: none; }
.mc-t { margin: 0 0 4px; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 20px; font-weight: 600; }
.mc-d { font: 400 12px/20px var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.measure-card dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 0 12px; font-size: 13px; line-height: 18px; }
.measure-card dt { color: var(--ink-2); }
.measure-card dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.measure-card dd::after { content: ' mm'; color: var(--ink-2); }
.measure-card dd.none::after { content: ''; }
.stick { pointer-events: auto; width: 112px; height: 112px; border-radius: 50%; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); display: grid; place-items: center; touch-action: none; }
.stick span { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); opacity: .8; }
body.walking .hint, body.walking .stage-top #modebar { display: none; }

/* side panel: mode blocks */
.mode-panel { gap: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ghost.sm { min-height: var(--tap); padding: 0 12px; font-size: 14px; }
.h3 { margin: 4px 0 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.sec-draw { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-2); padding: 8px; min-height: 160px; transition: opacity .15s; }
.sec-draw.stale { opacity: .55; }
.sec-svg { display: block; width: 100%; height: auto; max-height: var(--sec-max, 360px); }
.range-row { display: flex; justify-content: space-between; font-size: 14px; line-height: 20px; }
.range-row output { font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: var(--tap); margin: 0; }
.line-plan-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-2); padding: 8px; }
.line-plan { display: block; width: 100%; height: auto; max-height: var(--plan-max, 220px); touch-action: none; cursor: crosshair; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; line-height: 18px; }
.legend li, .layer-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.swatch { width: 28px; height: 16px; flex: none; }
.select-row { display: flex; align-items: center; gap: 8px; }
.select-row label { font-size: 14px; color: var(--ink-2); flex: none; }
.select-row select { flex: 1 1 auto; min-width: 0; min-height: var(--tap); padding: 0 8px; border: 1px solid #738093; border-radius: var(--r-1); background: var(--bg); font: inherit; font-size: 14px; }
.layer-list { list-style: none; margin: 0; padding: 0; background: var(--bg); border-radius: var(--r-2); font-size: 14px; line-height: 20px; }
.layer-list li { padding: 8px 12px; border-top: 1px solid #e8ecf1; }
.layer-list li:first-child { border-top: 0; }
.layer-list .ln { flex: 1 1 auto; min-width: 0; }
.layer-list .lmm { flex: none; color: var(--ink-2); }
.layer-total { display: flex; justify-content: space-between; margin: 0; padding: 0 12px; font-size: 14px; font-weight: 600; }
.soft { margin: 0; padding: 8px 12px; font-size: 14px; line-height: 20px; color: var(--ink); background: #eef2fb; border-radius: var(--r-1); }
.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step-list button { width: 100%; display: flex; gap: 12px; align-items: center; min-height: var(--tap); padding: 0 12px; border: 0; border-radius: var(--r-1); background: none; text-align: left; font-size: 14px; }
.step-list button:hover { background: var(--bg); }
.step-list .k { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1px solid #9aa6b5; color: var(--ink-2); flex: none; }
.step-list button.done .k { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.step-list button[aria-current="step"] { background: var(--bg); font-weight: 600; }
.step-list button[aria-current="step"] .k { background: var(--accent); border-color: var(--accent); color: #fff; }
.gap-note { padding: 12px; background: var(--bg); border-radius: var(--r-2); border: 1px solid var(--line); }
.gap-note .h { font-size: 16px; line-height: 24px; display: flex; align-items: center; gap: 8px; }
.gap-note .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--error); flex: none; }
.gap-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 20px; }
/* one side-strip width in every view (the model and the toolbar must not jump when the tab changes) */

.sec-dialog { width: min(1240px, calc(100vw - 32px)); max-height: calc(100svh - 32px); padding: 16px 24px 24px; border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow); }
.sec-dialog::backdrop { background: rgba(16, 24, 40, .4); }
.sec-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sec-dialog .sec-svg { max-height: calc(100svh - 140px); }

@media (prefers-reduced-motion: reduce) { .room-label .rl, .sec-draw { transition: none; } }

/* ---------- narrower ---------- */
@media (min-width: 1600px) { :root { --side-w: 440px; } }
@media (max-width: 1279px) { :root { --side-w: 320px; } .file { max-width: 180px; } }
@media (max-width: 1100px) {
  .bar { flex-wrap: wrap; padding: 0 12px; column-gap: 12px; row-gap: 0; min-height: 0; }
  .actions { order: 3; flex: 1 0 100%; margin: 0 -12px; padding: 0 8px; gap: 4px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .actions::-webkit-scrollbar { display: none; }
  .tools { flex: none; justify-content: flex-start; }
  .export { margin-left: auto; }
}
@media (max-width: 899px) {
  body[data-state="model"] { min-height: 0; }
  .work { flex-direction: column; }
  .stage { flex: none; height: 62svh; min-height: 320px; }
  .side { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .side .local { margin-top: 0; }
}
@media (max-width: 599px) {
  .bar { padding: 0 12px; }
  .file { flex: 1 1 0; max-width: none; }
  .tool { padding: 2px 8px; }
  .export .tool { padding: 2px 6px; min-width: 0; }
  .export { gap: 0; margin-right: -6px; }
  .actions { justify-content: space-between; }
  .tools { flex: 1 1 auto; justify-content: space-between; }
  #viewDirs { display: none; }
  #viewbar .view-sel { display: block; }
  .start { padding: 24px 16px; gap: 24px; }
  .drop { padding: 32px 16px; }
  .drop h1 { font-size: 20px; line-height: 28px; }
  .sample-list { grid-template-columns: 1fr 1fr; }
  .room-label { font-size: 12px; line-height: 16px; }
  .room-label .rl { padding: 1px 2px; }
  .room-label b { font-weight: 500; }
  .room-label span { display: none; }
  .hint { display: none; }
  .stage-top { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .bar-group { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; gap: 6px; }
  .bar-group::-webkit-scrollbar { display: none; }
  #viewbar { padding-right: 8px; }
  .seg button { min-width: 44px; padding: 0 10px; }
  .chip { padding: 0 10px; }
  .stepbar { grid-template-columns: 1fr; bottom: 8px; padding: 8px 12px; }
  .step-ctl { grid-column: 1; grid-row: auto; }
  .step-ctl .chip { flex: 1 1 0; }
  .step-x { font-size: 13px; line-height: 18px; }
  .stick { width: 96px; height: 96px; }
}
.chip small { display: block; font-size: 11px; line-height: 12px; font-weight: 400; color: var(--ink-2); }

/* export: PNG menu (fixed, so the scrolling tool row does not clip it) and the saved toast */
.tool[aria-busy="true"] { cursor: progress; }
.menu {
  position: fixed; z-index: 20; width: 248px; padding: 6px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-2); box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.menu-h { margin: 8px 10px 4px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-2); }
.menu button {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 10px;
  border: 0; border-radius: var(--r-1); background: none; text-align: left; font-size: 14px; line-height: 20px; font-weight: 500;
}
.menu button small { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.menu button > span { white-space: nowrap; }
.menu button:hover, .menu button:focus-visible { background: var(--surface); }
.menu-note { margin: 6px 10px 4px; padding-top: 8px; border-top: 1px solid #e8ecf1; font-size: 12px; line-height: 16px; color: var(--ink-2); }
.toast {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; margin: 0; padding: 8px 16px; max-width: calc(100% - 32px);
  background: rgba(24, 32, 43, .9); color: #fff; border-radius: var(--r-2); font-size: 14px; line-height: 20px; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-mode="steps"] .toast { bottom: auto; top: 72px; }

/* behind a vertical cut: one quiet drawing note at the foot of the stage with the way round */
.behind {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2; margin: 0; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 4px; padding: 0 2px 0 12px; white-space: nowrap;
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line); border-radius: var(--r-1);
}
.behind p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.behind button {
  min-height: var(--tap); padding: 0 10px; border: 0; background: none; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; flex: none;
}
.behind button:hover { color: var(--accent); }
body.behind-cut .hint { display: none; }
body.behind-cut .toast { bottom: 64px; }
/* the walk keeps its hint at the bottom: a saved-file note goes above it */
body.walking .toast { bottom: 72px; }
/* the on-screen stick is for touch screens; with a mouse the keys walk */
@media (pointer: fine) { .stick { display: none; } }
body.editing .behind, body.walking .behind, body.plan2d .behind { display: none; }

/* scrolling rows: fade the edge with more buttons past it, and a chevron on the row's parent at that edge */
.actions[data-more], .bar-group[data-more] { --fr: 56px; }
.actions[data-less], .bar-group[data-less] { --fl: 40px; }
.actions[data-more], .actions[data-less], .bar-group[data-more], .bar-group[data-less] {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent);
}
.bar[data-more-actions]::after, .bar[data-less-actions]::before,
.stage-top[data-more-modebar]::before, .stage-top[data-more-viewbar]::after {
  position: absolute; z-index: 1; width: 20px; height: var(--tap); display: grid; place-items: center; pointer-events: none;
  content: ""; background: no-repeat center / 8px 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M1.5 1.5L6 6l-4.5 4.5' fill='none' stroke='%234a5563' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.bar[data-more-actions]::after, .bar[data-less-actions]::before { background-color: var(--bg); }
.stage-top[data-more-modebar]::before, .stage-top[data-more-viewbar]::after { background-color: var(--bg); border: 1px solid var(--line); border-radius: var(--r-1); width: 22px; }
.bar[data-more-actions]::after { right: 0; bottom: 0; }
.bar[data-less-actions]::before { left: 0; bottom: 0; transform: scaleX(-1); }
.stage-top[data-more-modebar]::before { right: 0; top: 0; }
.stage-top[data-more-viewbar]::after { right: 0; bottom: 0; }

/* view controls: 3D / 평면도 is the switch (ink when on), the view presets are a quiet secondary row; on phones a select */
#dimSeg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg.quiet { background: rgba(255, 255, 255, .86); border-color: transparent; box-shadow: 0 0 0 1px rgba(24, 32, 43, .06); }
.seg.quiet button { border-right: 0; color: var(--ink-2); font-weight: 400; min-width: 40px; padding: 0 10px; }
.seg.quiet button:hover { color: var(--ink); background: var(--surface); }
.seg.quiet button[aria-pressed="true"] { background: none; color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
#viewbar #viewDirs { order: -1; }
.view-sel { display: none; flex: none; }
.view-sel select {
  min-height: var(--tap); padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: var(--r-1); font: inherit; font-size: 14px;
  color: var(--ink); appearance: none; -webkit-appearance: none;
  background: var(--bg) no-repeat right 10px center / 10px 6px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234a5563' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* anatomy views: the side panel explains the current view only */
.select-row select:disabled { color: var(--ink); opacity: 1; background-image: none; border-color: transparent; padding-left: 0; appearance: none; -webkit-appearance: none; }

/* one way to show "selected" everywhere: ink. The blue accent is kept for the cut (handle, cut line) and the one
   primary action (도면 파일 고르기, 다음 단계) */
.tool[aria-pressed="true"], body[data-state="model"] .tool[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); font-weight: 600; }
.seg button[aria-pressed="true"], .seg.quiet button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.step-list button[aria-current="step"] .k { background: var(--ink); border-color: var(--ink); }
.step-list button.done .k { background: #9aa3ae; border-color: #9aa3ae; }

/* ---------- a drawing-sheet character (DESIGN.md) ----------
   hairline frames with registration ticks, figures in tabular numerals, a title block at the head of the
   side panel, and the anatomy views as numbered sheet tabs hanging from the top bar */
:root {
  --mono: var(--font);   /* figures: the same face with tabular figures (CAD/BIM UIs), no monospaced face */
  --hair: #8f99a6; --rule: #e3e7ec; --stage: #fafbfc;
  --r-1: 2px; --r-2: 2px;
  --tick: linear-gradient(var(--ink), var(--ink));
}
.num, .total-n, .rooms-t td:not(.n), .rooms-t tfoot td, .counts dd, .stepper input, .range-row output, .layer-list .lmm,
.layer-total span:last-child, .co span, .dim-label, .plan-scale, .menu button small[data-size], .step-n, .room-label span, .storey-tag span,
.up-label, .north span, .unit { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* sheet tabs: numbered 01..05, hanging from the bar's bottom rule; the open sheet joins the stage below */
.tools { counter-reset: sheet; align-items: flex-end; align-self: stretch; gap: 2px; }
.bar .tools .tool {
  counter-increment: sheet; flex-direction: row; align-items: baseline; gap: 6px; align-self: flex-end;
  min-height: 40px; padding: 10px 14px 0; margin-bottom: -1px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 0; box-shadow: none; color: var(--ink-2); font-weight: 500; position: relative; background: none;
}
.bar .tools .tool::before { content: counter(sheet, decimal-leading-zero) / ""; font: 400 11px/20px var(--mono); font-variant-numeric: tabular-nums; color: #8a94a3; }
.bar .tools .tool:hover:not(:disabled) { color: var(--ink); background: var(--surface); }
.bar .tools .tool[aria-pressed="true"]:not(:disabled) {
  color: var(--ink); font-weight: 600; background: var(--stage); border-color: var(--hair); box-shadow: inset 0 2px 0 var(--ink); cursor: default;
}
.bar .tools .tool[aria-pressed="true"]:not(:disabled)::before { color: var(--ink); }
.bar .tools .tool:disabled { color: #9aa3ae; }
@media (max-width: 1100px) { .actions { align-items: flex-end; align-self: stretch; } .bar .tools .tool { min-height: 40px; } }
@media (max-width: 599px) { .bar .tools .tool { padding: 8px 8px 0; } .bar .tools .tool::before { display: none; } }

/* export: quiet text buttons behind a hairline rule (the model is the one thing to look at) */
.export { padding-left: 12px; border-left: 1px solid var(--rule); }
.export .tool { min-height: 32px; padding: 0 10px; color: var(--ink-2); font-weight: 500; }
.export .tool:hover:not(:disabled) { color: var(--ink); background: var(--surface); }
@media (max-width: 599px) { .export { padding-left: 0; border-left: 0; } }

/* stage controls: hairline frames, square corners */
.seg { border-color: var(--hair); border-radius: var(--r-1); }
.seg button { border-right-color: var(--rule); }
.chip { border-color: var(--hair); border-radius: var(--r-1); }
.seg.quiet { border-color: transparent; box-shadow: none; background: rgba(255, 255, 255, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.view-sel select { border-color: var(--hair); }
body.menu-open .stage-top { opacity: .28; pointer-events: none; transition: opacity .15s ease-out; }
body.menu-open .stage-top .bar-group { pointer-events: none; }

/* title block: the corner of a drawing sheet */
.title-block {
  display: grid; grid-template-columns: 1.15fr .5fr 1.35fr; margin: 0; border: 1px solid var(--ink); background: var(--bg);
}
.tb-cell { min-width: 0; padding: 5px 8px 6px; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.tb-cell:nth-child(1) { grid-column: span 2; border-left: 0; border-top: 0; }
.tb-cell:nth-child(2) { border-top: 0; }
.tb-cell:nth-child(3) { border-left: 0; }
.title-block dt { font-size: 11px; line-height: 14px; color: var(--ink-2); }
.title-block dd { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block dd.num { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.side { gap: 20px; }

/* figures */
.total-n { font-weight: 500; font-size: 28px; line-height: 36px; letter-spacing: -.02em; }
.total-n.none { font-family: var(--font); }

/* schedules: ruled like a drawing's table, not cards */
.rooms-t { background: none; border-radius: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.rooms-t caption { padding: 4px 0; font-size: 13px; line-height: 18px; }
.rooms-t th, .rooms-t td { padding: 6px 4px; border-top-color: var(--rule); }
.rooms-t td:not(.n) { font-size: 13px; }
.rooms-t thead th { font-weight: 500; }
.rooms-t tfoot td { border-top: 3px double var(--ink); font-weight: 500; }
.rooms-t tfoot td:first-child { font-family: var(--font); font-weight: 600; }
.layer-list { background: none; border-radius: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.layer-list li { padding: 7px 4px; border-top-color: var(--rule); }
.layer-total { padding: 0 4px; }

/* drawings in the side panel and the dialog: a hairline frame with registration ticks at the corners */
.sec-draw, .line-plan-wrap { position: relative; border: 1px solid var(--hair); border-radius: 0; }
.sec-draw::before, .line-plan-wrap::before {
  content: ""; position: absolute; inset: -5px; pointer-events: none; background-repeat: no-repeat;
  background-image: var(--tick), var(--tick), var(--tick), var(--tick), var(--tick), var(--tick), var(--tick), var(--tick);
  background-size: 10px 1px, 1px 10px, 10px 1px, 1px 10px, 10px 1px, 1px 10px, 10px 1px, 1px 10px;
  background-position: 0 4px, 4px 0, 100% 4px, calc(100% - 4px) 0, 0 calc(100% - 4px), 4px 100%, 100% calc(100% - 4px), calc(100% - 4px) 100%;
}
.stepper input, .step, .select-row select, .ghost { border-color: var(--hair); }
.menu, .stepbar, .notice, .sec-dialog { border-radius: var(--r-2); }
.menu { border-color: var(--hair); }
.stepbar { border-color: var(--hair); }
.step-n { font-size: 13px; }

/* room labels: pinned to the floor centre by a short leader with a dot (labels.js); a hairline box */
.room-label .rl { box-shadow: 0 0 0 1px rgba(24, 32, 43, .32); border-radius: 1px; background: rgba(255, 255, 255, .92); }
.room-label span { font-size: 11px; }
.room-label .rl .ld { display: block; position: absolute; left: 50%; top: 50%; height: 0; border-top: 1px solid var(--ink); transform-origin: 0 0; }
.room-label .rl .ld::after { content: ""; position: absolute; right: -2.5px; top: -3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }

/* explode: storey tags on leaders (view3d drawLeaders) */
.storey-tag {
  transform: none; display: flex; align-items: baseline; gap: 6px; padding: 2px 6px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 0; font-weight: 600;
}
.storey-tag span { font-size: 11px; font-weight: 400; color: var(--ink-2); }
.tag-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.labels { z-index: 1; }
.compact-tags .storey-tag span { display: none; }
/* the plates (지붕, 2층 바닥): one step quieter than the storey tags, same 1 px leader */
.storey-tag.plate-tag { border-color: var(--line-2, #8f99a6); color: var(--ink-2); font-weight: 500; }

/* one selected state across the app: ink fill, white text, in every row (the left choices, 3D | 평면도, the
   view presets, 둘러보기, chips). The sheet tabs are the one exception: a tab shape joined to the stage, with the same
   ink cue (ink rule along its top, ink number and name). */
#dimSeg button[aria-pressed="true"], .seg#dimSeg button[aria-pressed="true"],
.seg.quiet button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: none; }
#walkBtn { border-color: var(--rule); color: var(--ink-2); }
#walkBtn:hover { color: var(--ink); border-color: var(--hair); }
#walkBtn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.bar .tools .tool[aria-pressed="true"]:not(:disabled) { box-shadow: inset 0 3px 0 var(--ink); }
/* the A–A′ letters on the 3D plan view, as on the 2D plan drawing */
.cut-letter { pointer-events: none; font-family: var(--mono); font-size: 13px; line-height: 16px; font-weight: 600; color: var(--ink); }
.room-label .rl.nopin .ld { display: none; }

/* ---------- 편집: the plan as an editable sheet over the stage (DESIGN.md) ----------
   wide screens (1280+): the sheet on the left, the 3D on the right, rebuilt after every change.
   narrower: the sheet fills the stage, 평면 | 3D swaps them. Selected = ink, the grip = blue (as the section handle). */
.edit-btn {
  flex: none; min-height: 32px; padding: 0 14px; border: 1px solid var(--ink); border-radius: var(--r-1); background: var(--bg);
  font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.edit-btn:hover:not(:disabled) { background: var(--surface); }
.edit-btn:disabled { border-color: var(--line); color: #9aa3ae; font-weight: 500; }
.edit-btn[aria-pressed="true"], .edit-btn[aria-pressed="true"]:hover { background: var(--ink); color: #fff; }
.editor { position: absolute; inset: 0; z-index: 3; background: var(--bg); }
body.editing .stage-top, body.editing .hint, body.editing .stepbar { display: none; }
@media (min-width: 1280px) {
  body.editing .editor { right: 42%; border-right: 1px solid var(--hair); }
  body.editing .gl { left: 58%; }
  body.editing #ed3d { display: none; }
}
@media (max-width: 1279px) {
  body.editing.ed-3d-on .editor { background: none; pointer-events: none; }
  body.editing.ed-3d-on .editor .ed-top { pointer-events: none; }
  body.editing.ed-3d-on .editor .ed-top .bar-group:last-child { pointer-events: auto; }
  body.editing.ed-3d-on .ed-svg, body.editing.ed-3d-on .ed-hint, body.editing.ed-3d-on #edTool, body.editing.ed-3d-on #edStoreys { visibility: hidden; }
}
.ed-top {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: space-between; align-items: flex-start; pointer-events: none;
}
.ed-top .bar-group { pointer-events: auto; }
.ed-hist button { display: inline-flex; align-items: center; gap: 6px; }
.ed-hist button:disabled { color: #9aa3ae; background: none; cursor: default; }
.ed-hist svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ed-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.editor[data-tool="wall"] .ed-svg { cursor: crosshair; }
.ed-hint { position: absolute; left: 16px; right: 16px; bottom: 12px; margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-2); pointer-events: none; }
.ed-read {
  position: absolute; z-index: 3; margin: 0; padding: 4px 8px; border-radius: var(--r-1); pointer-events: none; white-space: nowrap;
  background: rgba(24, 32, 43, .9); color: #fff; font: 500 13px/18px var(--mono); font-variant-numeric: tabular-nums;
}
.ed-name {
  position: absolute; z-index: 4; transform: translate(-50%, -50%); width: 168px; height: 36px; padding: 0 8px;
  border: 1px solid var(--ink); border-radius: var(--r-1); background: var(--bg); text-align: center; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow);
}
/* the drawing: paper rooms, cut walls in poché, openings as on the plan sheet */
.e-rooms polygon { fill: #fff; stroke: none; }
.e-rooms polygon.on { fill: #f1f3f6; }
.e-stairs polygon, .e-stairs line { fill: none; stroke: #8f99a6; stroke-width: .75; }
/* furniture in the editor: thin plan symbols; the outline is the hit area (clear fill), chosen in ink */
.e-furn .f polygon { fill: rgba(255, 255, 255, 0); stroke: none; cursor: grab; }
.e-furn .f path { fill: none; stroke: #a3acb8; stroke-width: .8; pointer-events: none; }
.e-furn .f:hover path { stroke: #6b7584; }
.e-furn .f.on path { stroke: var(--ink); }
.e-fsel { fill: rgba(36, 80, 216, .06); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.e-fsel.bad, .e-furn .f.bad path { stroke: var(--error); }
.ed-btns { display: flex; gap: 8px; flex-wrap: wrap; }
/* 프로젝트 저장, 열기: beside 다른 도면 열기 and the start screen's file button */
.proj-row { display: flex; flex-wrap: wrap; gap: 8px; }
.proj-row .ghost { flex: 1 1 auto; padding: 0 8px; font-size: 13px; white-space: nowrap; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.pick .ghost { min-height: 48px; align-self: auto; }
/* 가구 목록: the catalogue (plan symbol, name, size) and the piece being placed on the plan */
.furn-panel { gap: 8px; }
.furn-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.furn-item {
  display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; align-content: center; text-align: left;
  min-height: var(--tap); padding: 2px 8px 2px 4px; border: 1px solid var(--hair); border-radius: var(--r-1); background: var(--bg); color: var(--ink);
}
.furn-item:hover { border-color: #9aa6b5; }
.furn-item[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #e8eef7; }
.furn-item svg { grid-row: 1 / 4; width: 36px; height: 36px; }
.furn-item svg path { fill: none; stroke: #4a5563; stroke-width: 1; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.furn-item .fn { font-size: 13px; line-height: 16px; font-weight: 500; }
.furn-item .fs { font-size: 11px; line-height: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.editor[data-tool="place"] .ed-svg { cursor: copy; }
.e-ghost { pointer-events: none; }
.e-ghost .ft { fill: rgba(36, 80, 216, .08); stroke: var(--accent); stroke-width: 1.5; }
.e-ghost path { fill: none; stroke: var(--accent); stroke-width: 1; }
.e-ghost .cl { fill: rgba(36, 80, 216, .04); stroke: var(--accent); stroke-width: .75; stroke-dasharray: 3 3; }
.e-ghost.bad .ft { fill: rgba(198, 40, 40, .08); stroke: var(--error); }
.e-ghost.bad path, .e-ghost.bad .cl { stroke: var(--error); }
.e-ghost.bad .cl { fill: rgba(198, 40, 40, .04); }
.e-walls polygon { fill: #4d5562; stroke: #2e3540; stroke-width: .5; cursor: pointer; }
.ed-svg:has(.e-walls .on, .e-open .on) .e-walls polygon:not(.on) { fill: #8a94a2; stroke: #6b7584; }
.e-walls polygon.on { fill: var(--ink); stroke: var(--ink); stroke-width: 1.5; }
.e-open g { cursor: pointer; }
.e-open .gap { fill: #fff; stroke: #4d5562; stroke-width: .75; }
.e-open .e-opening .gap { stroke-dasharray: 3 3; }
.e-open .glz { stroke: #4d5562; stroke-width: 1; }
.e-open .leaf { stroke: var(--ink); stroke-width: 1.25; }
.e-open .swing { fill: none; stroke: #6b7584; stroke-width: .75; }
.e-open g.on .gap { stroke: var(--ink); stroke-width: 2; }
.e-names text { text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; cursor: text; }
.e-names .n { font: 600 13px/1 var(--font); fill: var(--ink); }
.e-names .a { font: 400 11px/1 var(--font); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.e-dim line { stroke: var(--ink); stroke-width: 1; }
.e-dim rect { fill: #fff; }
.e-dim text { text-anchor: middle; font: 500 11px/1 var(--mono); font-variant-numeric: tabular-nums; fill: var(--ink); }
.e-dim.strong text { font-weight: 600; }
.e-dim.len line { stroke: #6b7584; }
.e-dim.len text { fill: var(--ink-2); }
.e-handle { cursor: grab; }
.e-handle circle { fill: var(--accent); stroke: #fff; stroke-width: 2; filter: drop-shadow(0 1px 3px rgba(16, 24, 40, .3)); }
.e-handle path { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.e-handle.end rect { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.e-guide { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 5 4; }
.e-rubber { stroke: var(--ink); stroke-opacity: .55; stroke-linecap: butt; }
.e-dot { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
/* side panel while editing: the edit block on top, the room table (live areas) and storey height stay */
body.editing .counts, body.editing #modePanel, body.editing .gap-note, body.editing .again { display: none; }
.edit-panel { gap: 12px; }
.ed-count { font-size: 12px; color: var(--ink-2); }
.ed-sel { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.ed-how { margin: 0; padding-left: 18px; font-size: 14px; line-height: 20px; color: var(--ink-2); display: grid; gap: 4px; }
.ed-row { display: flex; flex-direction: column; gap: 4px; }
.ed-row > label { font-size: 12px; line-height: 16px; color: var(--ink-2); }
.ed-text { height: var(--tap); padding: 0 8px; border: 1px solid var(--hair); border-radius: var(--r-1); background: var(--bg); font-weight: 500; width: 100%; }
.ed-sel .note b { font-weight: 500; color: var(--ink); }
.ed-foot { display: flex; flex-direction: column; gap: 8px; }
.ed-foot .ghost:disabled { color: #9aa3ae; border-color: var(--rule); }
@media (max-width: 599px) {
  .ed-hist button span { display: none; }
  .ed-hist button { min-width: 44px; padding: 0 10px; }
  .edit-btn { padding: 0 10px; }
  .ed-top { top: 8px; left: 8px; right: 8px; }
}
.ed-svg.dragging .e-names { opacity: .3; }
.ex-h { font-size: 12px; line-height: 16px; color: #8a94a3; margin-right: 2px; white-space: nowrap; }
@media (max-width: 599px) { .ex-h { display: none; } .export .tool { padding: 2px 8px; } }
.export .tool { flex-direction: row; gap: .28em; }
/* toast above the editor; names under the dimensions, smaller where rooms are narrow; what an
   undo changed lights up; a rename button on the chosen room; the saved line; a pencil on 편집 */
body.editing .toast { z-index: 6; bottom: 40px; }
@media (min-width: 1280px) { body.editing .toast { left: 29%; max-width: calc(58% - 32px); } }
.edit-btn { display: inline-flex; align-items: center; gap: 6px; }
.edit-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.ed-svg.has-sel .e-names { opacity: .45; }
.e-name.sm .n { font-size: 11px; }
.e-name.xs .n { font-size: 10px; font-weight: 500; }
.e-name.sm .a { font-size: 10px; }
.e-name.on .n { text-decoration: underline; text-underline-offset: 3px; }
@keyframes ed-flash { from { fill: var(--accent); } }
.ed-svg.flash .e-walls polygon.on, .ed-svg.flash .e-rooms polygon.on { animation: ed-flash .9s ease-out; }
.ed-svg.flash .e-open g.on .gap { animation: ed-flash .9s ease-out; }
@media (prefers-reduced-motion: reduce) { .ed-svg.flash * { animation: none !important; } }
.ed-rename {
  position: absolute; z-index: 3; min-height: 36px; padding: 0 12px; border: 1px solid var(--ink); border-radius: var(--r-1);
  background: var(--bg); font-size: 13px; line-height: 18px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}
@media (pointer: coarse) { .ed-rename { min-height: 44px; } }
.ed-saved { position: absolute; right: 16px; bottom: 12px; margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-2); pointer-events: none; }
.ed-hint { right: 160px; }
@media (max-width: 599px) { .ed-hint { right: 16px; bottom: 30px; } .ed-saved { right: auto; left: 16px; bottom: 10px; } }
@media (max-width: 599px) { body.editing .toast { bottom: 64px; } }

/* 지붕: type, pitch, overhang, ridge, cover; live rebuild */
.roof-types { display: grid; grid-template-columns: repeat(4, 1fr); }
.roof-types button { min-width: 0; padding: 0 4px; }
.roof-opts { display: flex; flex-direction: column; gap: 8px; }
.roof-opts[hidden] { display: none; }
.roof-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.roof-row > .stepper, .roof-row > .seg { grid-column: 2 / 4; }
.roof-row select { min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg); color: var(--ink); font: inherit; }
.roof-row output { color: var(--ink-2); font-size: 13px; }
.roof-row .seg { display: flex; }
.roof-row .seg button { flex: 1 1 0; min-width: 0; padding: 0 6px; }
@media (max-width: 1023px) { .roof-row select { min-height: 44px; } }
.menu[data-kind="pdf"] .png-only { display: none; }
.menu[data-kind="png"] .pdf-only { display: none; }
/* four export buttons; between the wrapped bar (≤1100) and 1440 they drop their second word so the sheet tabs keep
   their room */
@media (min-width: 1101px) and (max-width: 1439px) { .ex-h { display: none; } }

/* the 3D section's drawing marks (section-ann.js): one SVG over the canvas, under the room labels and the handle */
.sec-ann { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; font-variant-numeric: tabular-nums; }

/* room names in drawing style (the plan view, a plan cut): plain text as on the 2D drawings, the name semibold and
   the area under it in the number face, a white halo instead of a box; no pin or leader */
.room-label i.py { font-style: normal; }
.labels.drawing .room-label i.py { display: none; }
.labels.drawing .room-label .rl { background: none; box-shadow: none; border-radius: 0; padding: 0 2px; line-height: 16px;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; }
.labels.drawing .room-label b { font-size: 13px; line-height: 16px; font-weight: 600; }
.labels.drawing .room-label span { display: block; font: 400 11px/14px var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.labels.drawing .room-label .rl.short span { display: none; }
/* the clear width x depth of a rectangular room, under the area, on the plan view only (dropped first when the label does not fit) */
.labels:not(.plan) .room-label span.dm, .labels.drawing .room-label .rl.nodim span.dm { display: none; }
.labels.drawing .room-label .rl.tiny b { font-size: 11px; line-height: 14px; }
.labels.drawing .room-label .rl .ld { display: none; }
.hint { transition: opacity .2s ease-out; }
.hint.seen { opacity: 0; }
/* the narrowest header has room for the file name's first letter only: leave it out (the title block names the project) */
@media (max-width: 419px) { .bar .file { display: none; } }

/* 가구 보기 (the furniture switch beside 둘러보기): the short word on narrow stages */
#furnBtn .short { display: none; }
@media (max-width: 767px) { #furnBtn .long { display: none; } #furnBtn .short { display: inline; } }

/* 마감: whole house or one room; small colour chips in the buttons */
.finish-block .roof-row { grid-template-columns: 52px 1fr; }
.finish-block .roof-row > select, .finish-block .roof-row > .seg { grid-column: 2; min-width: 0; }
.fin-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; font-size: 14px; }
.fin-seg .sw { width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(24, 32, 43, .25); flex: none; }

/* the walk: the room just entered, named once at the top of the stage */
.walk-room { position: absolute; left: 50%; top: 72px; transform: translate(-50%, -4px); margin: 0; padding: 6px 14px; pointer-events: none;
  font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ink); background: rgba(255, 255, 255, .86); border: 1px solid var(--line); border-radius: var(--r-1);
  opacity: 0; transition: opacity .25s ease-out, transform .25s ease-out; }
.walk-room.on { opacity: 1; transform: translate(-50%, 0); }
.walk-room { z-index: 3; }
body:not(.walking) .walk-room { display: none; }
@media (prefers-reduced-motion: reduce) { .walk-room { transition: none; } }

/* the export menu's furniture switches for the drawings */
.menu-checks { display: flex; gap: 4px; margin: 2px 6px 4px; }
.menu .menu-checks button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; border: 1px solid var(--line); border-radius: var(--r-1); }
.menu .menu-checks button::before { content: ''; width: 12px; height: 12px; border: 1px solid var(--ink-2); border-radius: 2px; flex: none; }
.menu .menu-checks button[aria-checked="true"]::before { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--ink); }
/* narrow walk: the hint goes to the top, clear of the walk bar at the bottom */
@media (max-width: 599px) {
  body.walking .stage-chip { top: 124px; bottom: auto; }
  .walk-ui { inset: auto 8px 8px 8px; gap: 6px; }
  .walk-left, .walk-right { gap: 6px; }
  .walk-help { font-size: 13px; line-height: 18px; max-width: calc(100% - 136px); }
}
@media (max-width: 480px) { .walk-help { max-width: 100%; } }

/* ---------- 현장 스캔 (side block, the stage bar while picking two points, the picked marks) ---------- */
.side > .title-block { order: -4; }
.side > .side-tabs { order: -3; }
.side > .edit-panel, .side > .furn-panel, .side > .mode-panel { order: -2; }
.side > .scan-block.open { order: -1; }
.scan-block .scan-row { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-block .scan-row .ghost { align-self: auto; }
.scan-block .scan-local { color: var(--ink); }
.scan-block .scan-busy { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink); }
.scan-file { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scan-name { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-warn { color: var(--ink); background: #fff7e6; border: 1px solid #f0d9a8; border-radius: var(--r-1); padding: 8px 12px; }
.scan-todo { color: var(--ink); }
.scan-views { align-self: stretch; }
.scan-views button { flex: 1 1 0; min-width: 0; padding: 0 6px; }
.scan-strength { display: grid; grid-template-columns: auto 1fr 44px; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.scan-strength input { width: 100%; min-height: 36px; accent-color: var(--ink); }
.scan-strength output { text-align: right; color: var(--ink-2); font-size: 13px; }
.scan-pick-btn { align-self: stretch; }
.scan-nudge { display: flex; flex-direction: column; gap: 6px; }
.scan-nrow { display: grid; grid-template-columns: 84px repeat(4, minmax(0, 1fr)); align-items: center; gap: 6px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.scan-nrow .step { width: auto; height: 36px; font-size: 14px; font-variant-numeric: tabular-nums; }
@media (max-width: 1023px) { .scan-nrow .step { height: 44px; } }
.scan-pickbar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 32px); padding: 8px 8px 8px 16px; background: rgba(24, 32, 43, .9); color: #fff; border-radius: var(--r-2);
}
.scan-pickbar p { margin: 0; font-size: 14px; line-height: 20px; }
.scan-pickbar .chip { flex: none; color: var(--ink); }
.gl canvas.picking { cursor: crosshair; }
.scan-mark {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; line-height: 1; font-weight: 600;
  font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: 0 0 0 2px #fff;
}
.scan-mark.scan { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.scan-mark.plan { background: var(--ink); color: #fff; }
@media (max-width: 600px) { .scan-pickbar { left: 8px; right: 8px; transform: none; max-width: none; } }
/* the remodel legend: in the side block and on the stage (bottom left, over the hint) */
.scan-legend, .stage-legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.scan-legend li, .stage-legend-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; }
.scan-legend .sw svg, .stage-legend-list .sw svg { display: block; }
.scan-legend .num, .stage-legend-list .num { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.scan-legend li[data-k="kept"] .nm, .stage-legend-list li[data-k="kept"] .nm { color: var(--ink-2); }
.stage-legend {
  position: absolute; left: 12px; bottom: 36px; z-index: 2; min-width: 200px; padding: 8px 12px; background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow); pointer-events: none;
}
.stage-legend-list li { font-size: 13px; line-height: 18px; }
.stage-legend-list li.hd { display: block; font-size: 12px; line-height: 16px; color: var(--ink-2); margin-bottom: 2px; }
.stage-legend-note { margin: 6px 0 0; font-size: 12px; line-height: 16px; color: var(--ink-2); }
body.walking .stage-legend { display: none; }
@media (max-width: 600px) { .stage-legend { left: 8px; bottom: 32px; min-width: 0; padding: 6px 8px; } .stage-legend-list li { font-size: 12px; line-height: 16px; grid-template-columns: 24px auto auto; gap: 6px; } .stage-legend-list .sw svg { width: 24px; } }

/* 마감: photo finishes (a small picture in the button) and the add buttons */
.fin-photo-row { margin-top: -4px; }
.fin-photo-row > .chip { grid-column: 2; justify-self: start; }
.fin-seg .sw.ph { width: 14px; height: 14px; background-size: cover; }
.roof-row .fin-seg { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 1px; background: var(--line); }
.roof-row .fin-seg button { border-right: 0; background: var(--bg); padding: 0 8px; justify-content: flex-start; }
.roof-row .fin-seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fin-seg button[hidden] { display: none; }
/* the photo dialog */
.photo-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100svh - 32px); padding: 16px 24px; border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow); }
.photo-dialog::backdrop { background: rgba(24, 32, 43, .35); }
.pd-head .h { margin: 0 0 12px; }
.pd-body { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; }
.pd-prev canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r-1); }
.pd-opts { display: grid; gap: 12px; align-content: start; }
.pd-row { display: grid; gap: 6px; font-size: 14px; line-height: 20px; }
.pd-row > span:first-child { color: var(--ink-2); font-size: 13px; }
.pd-row[hidden] { display: none; }
.pd-num { display: inline-flex; align-items: center; gap: 6px; }
.pd-num input { width: 96px; min-height: var(--tap); padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-1); font: inherit; font-variant-numeric: tabular-nums; }
.pd-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 640px) { .pd-body { grid-template-columns: 1fr; gap: 12px; } .pd-prev canvas { max-width: 220px; } .photo-dialog { padding: 12px 16px; } }
/* 참고 사진으로 한번에 */
.inspo-block { display: grid; gap: 8px; }
.inspo-row { display: flex; gap: 8px; }
.inspo-out { display: grid; gap: 10px; }
.inspo-out[hidden] { display: none; }
.inspo-top { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: stretch; }
.inspo-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-1); border: 1px solid var(--line); }
.inspo-pal { display: flex; min-height: 24px; border-radius: var(--r-1); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(24, 32, 43, .15); align-self: center; height: 24px; }
.inspo-pal i { display: block; min-width: 6px; }
.inspo-dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; line-height: 18px; }
.inspo-dl dt { color: var(--ink-2); }
.inspo-dl dd { margin: 0; display: flex; align-items: center; gap: 6px; }
.inspo-dl .sw { width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(24, 32, 43, .25); flex: none; }
.inspo-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 렌더링: a panel over the top right of the stage with the still picture, its progress and its buttons; the live view
   stays usable around it. 크게 보기 lays it over the whole stage. */
.render-panel {
  position: absolute; right: 12px; top: 60px; z-index: 4; width: min(46%, 640px); max-height: calc(100% - 120px);
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; background: #18202b; color: #fff;
  border-radius: var(--r-2); box-shadow: 0 8px 24px rgba(16, 24, 40, .28);
}
body.walking .render-panel { top: 12px; }
.render-panel.big { left: 12px; right: 12px; width: auto; max-height: none; bottom: 12px; }
.rp-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rp-t { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; flex: none; }
.photo-msg { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 20px; color: #d5dbe3; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-x { flex: none; min-height: 32px; padding: 0 10px; border: 1px solid #5b6677; border-radius: var(--r-1); background: none; color: #fff; font-size: 14px; }
.rp-x:hover { border-color: #fff; }
.rp-pic { position: relative; min-height: 0; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; background: #0f151d; border-radius: var(--r-1); overflow: hidden; }
.rp-pic canvas { display: block; max-width: 100%; max-height: 100%; width: 100%; height: auto; object-fit: contain; }
.render-panel.big .rp-pic canvas { width: auto; height: 100%; }
.rp-pic.wait canvas { visibility: hidden; }
.rp-pic.wait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0f151d 0%, #1d2530 50%, #0f151d 100%); background-size: 200% 100%; animation: rp-wait 1.2s linear infinite; }
@keyframes rp-wait { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .rp-pic.wait::after { animation: none; } }
.photo-meter { height: 2px; background: #4b5565; border-radius: 1px; overflow: hidden; flex: none; }
.photo-meter span { display: block; height: 100%; width: 0; background: #fff; transition: width .2s linear; }
.rp-note { margin: 0; font-size: 13px; line-height: 18px; color: #b9c2cd; }
.rp-note:empty { display: none; }
.rp-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.render-panel .chip { background: #fff; color: var(--ink); border-color: #fff; min-height: 32px; }
.render-panel .chip:hover { background: var(--surface); border-color: var(--surface); }
.render-panel .chip:disabled { background: #fff; color: var(--ink-2); border-color: #fff; }
.render-panel .chip:focus-visible, .rp-x:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.render-panel .chip[aria-pressed="true"] { background: #e8eef7; }
#photoBig { margin-right: auto; }
@media (max-width: 600px) {
  .render-panel { left: 8px; right: 8px; top: 52px; width: auto; max-height: calc(100% - 64px); padding: 8px; }
  body.walking .render-panel { top: 8px; }
  #photoBig { display: none; }
}
body.walking #photoBtn, body:not([data-mode="model"]) #photoBtn, body.plan2d #photoBtn, body.editing #photoBtn { display: none; }
/* narrow screens: the model row keeps its buttons (사진처럼 is in the walk's bar there), the walk's bar wraps its right
   group onto a second line */
@media (max-width: 600px) { #photoBtn { display: none; } }
@media (max-width: 480px) { .walk-bar { flex-wrap: wrap; } .walk-right { margin-left: auto; } }
body.photo-on .walk-help, body.photo-on .walk-lock { display: none; }

/* Standalone on/off toggles (not segmented choices): light fill and a check mark, never the dark primary fill.
   Dark fill is kept for segmented choices (.seg) and for the one primary action per area (.chip.strong). */
.chip[aria-pressed="true"], #walkBtn[aria-pressed="true"], .walk-ui .chip[aria-pressed="true"],
.edit-btn[aria-pressed="true"], .edit-btn[aria-pressed="true"]:hover {
  background: #e8eef7; border-color: var(--ink); color: var(--ink); box-shadow: none;
}
.chip[aria-pressed="true"]::before, .edit-btn[aria-pressed="true"]::before {
  content: ""; display: inline-block; width: 10px; height: 6px; margin-right: 6px; vertical-align: 2px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}
.edit-btn[aria-pressed="true"] svg { display: none; }
@media (max-width: 480px) {
  /* narrow screens: keep the light fill and ink border, drop the check mark so the tool row still fits */
  .chip[aria-pressed="true"]::before, .edit-btn[aria-pressed="true"]::before { display: none; }
}

/* ---------- side panel tabs (side-tabs.js): one tab at a time, so the panel fits the window without scrolling ---------- */
.side { padding: 16px; gap: 14px; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); margin-top: -2px; }
.side-tabs button {
  flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 0 4px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  font-size: 14px; line-height: 20px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-tabs button:hover { color: var(--ink); }
.side-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
@media (max-width: 1279px) { .side-tabs button { font-size: 13px; } }
.side > .tab-off { display: none !important; }
.side .h { font-size: 16px; line-height: 24px; }
.total-n { font-size: 24px; line-height: 30px; }
.rooms-block { gap: 6px; }
.rooms-block .ghost.sm { min-height: 28px; padding: 0 10px; font-size: 13px; }
.rooms-t th, .rooms-t td { padding: 3px 4px; font-size: 13px; line-height: 20px; }
.rooms-t thead th { font-size: 12px; line-height: 16px; }
.counts { gap: 6px; }
.counts dl { grid-template-columns: auto 1fr auto 1fr; gap: 2px 12px; font-size: 13px; line-height: 20px; }
.side .local { font-size: 13px; line-height: 18px; }
.rooms-dialog { width: min(520px, calc(100vw - 32px)); }
.rooms-dialog .rooms-t { margin-bottom: 8px; }
.mode-panel { gap: 10px; }
.mode-panel .sec-draw { min-height: 120px; }
.mode-panel .legend { grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12px; line-height: 18px; }
.mode-panel .legend .swatch { width: 22px; height: 12px; }

@media (pointer: coarse) { .side-tabs button { min-height: 44px; } }

/* ---------- 물량표 (quantity-ui.js): a dialog from the 정보 tab, the tables scroll inside it ---------- */
.panel-acts { display: flex; align-items: center; gap: 6px; }
.qty-dialog { width: min(860px, calc(100vw - 32px)); }
.qty-dialog[open] { display: flex; flex-direction: column; gap: 8px; }
.qty-dialog .sec-dialog-head { margin-bottom: 0; gap: 8px; }
.qty-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; max-height: calc(100svh - 240px); border-top: 1px solid var(--rule); }
.qty-note { color: var(--ink); }
.qty-t { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.qty-t caption { text-align: left; font-weight: 600; font-size: 14px; padding: 10px 0 4px; caption-side: top; }
.qty-t th, .qty-t td { padding: 4px 8px; text-align: right; border-top: 1px solid var(--rule); font-weight: 400; vertical-align: top; }
.qty-t th:first-child, .qty-t td:first-child { text-align: left; }
.qty-t th:nth-child(2):not(:last-child), .qty-t td:nth-child(2):not(:last-child) { text-align: left; }
.qty-t thead th { color: var(--ink-2); font-size: 12px; line-height: 16px; border-top: 0; }
.qty-t tfoot td { font-weight: 600; }
@media (max-width: 599px) { .qty-dialog { padding: 12px; } .qty-t th, .qty-t td { padding: 4px 4px; } .qty-dialog .sec-dialog-head { flex-wrap: wrap; } }

/* ---------- 채광 (daylight-ui.js): the sun at a season and a time ---------- */
.sun-block { gap: 8px; }
.sun-opts { display: flex; flex-direction: column; gap: 8px; }
.sun-opts[hidden] { display: none; }
.sun-block .roof-row > select { grid-column: 2 / 4; }
.sun-time input { width: 100%; min-width: 0; accent-color: var(--ink); }
.sun-time output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.sun-block .note.ask { color: var(--ink); font-weight: 600; }
.sun-block .seg button:disabled { opacity: .45; cursor: default; }
