:root {
  --ink: #22211f;
  --muted: #6f6a62;
  --paper: #f7f3ec;
  --paper-deep: #ece5da;
  --line: #d8d1c5;
  --line-dark: #a89f92;
  --panel: #fffdf9;
  --terracotta: #b86145;
  --terracotta-dark: #884632;
  --sage: #75816d;
  --blue-gray: #71838b;
  --shadow: 0 6px 18px rgba(48, 42, 33, .08);
  --radius: 14px;
  font-family: "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: var(--paper); }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.topbar {
  height: 78px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand-block, .top-actions, .section-heading, .control-row, .selected-title, .canvas-toolbar, .canvas-footer, .file-actions, .quick-rotate { display: flex; align-items: center; }
.brand-block { gap: 12px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--terracotta); color: #fff; font: 800 13px/1 Georgia, serif; letter-spacing: -.06em; border-radius: 8px; }
.brand-kicker, .section-label, .canvas-eyebrow { margin: 0 0 3px; color: var(--terracotta-dark); font-size: 10px; line-height: 1.2; font-weight: 800; letter-spacing: .08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font: 700 21px/1.15 Georgia, "Noto Serif KR", serif; letter-spacing: -.04em; }
.top-actions { gap: 14px; }
.save-state { color: var(--muted); font-size: 11px; }

.button { min-height: 34px; border: 1px solid transparent; border-radius: 7px; padding: 0 12px; font-size: 12px; font-weight: 700; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.button:focus-visible, .tool-button:focus-visible, .furniture-button:focus-visible, .text-button:focus-visible, input:focus-visible, .upload-box:focus-within { outline: 3px solid rgba(184, 97, 69, .24); outline-offset: 2px; }
.button-dark { background: var(--ink); color: #fff; }
.button-dark:hover { background: #423d38; }
.button-quiet { background: transparent; color: var(--muted); border-color: transparent; }
.button-quiet:hover { color: var(--ink); background: var(--paper); }
.button-outline { background: var(--panel); border-color: var(--line-dark); color: var(--ink); }
.button-outline:hover { border-color: var(--terracotta); color: var(--terracotta-dark); }
.button-danger { background: #fff5f1; border-color: #e2b9aa; color: var(--terracotta-dark); }
.button-danger:hover { background: #f9e5de; }

.app-shell { display: grid; grid-template-columns: 274px minmax(520px, 1fr) 286px; min-height: calc(100vh - 78px); }
.panel { background: var(--panel); }
.left-panel { border-right: 1px solid var(--line); }
.right-panel { border-left: 1px solid var(--line); }
.panel-section { padding: 22px 20px; border-bottom: 1px solid var(--line); }
.intro-section { padding-top: 27px; }
.panel-section h2 { margin-bottom: 10px; font: 700 22px/1.2 Georgia, "Noto Serif KR", serif; letter-spacing: -.05em; }
.panel-section h3 { margin: 0; font-size: 14px; font-weight: 800; }
.muted { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.microcopy { margin: 8px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.section-heading { justify-content: space-between; margin-bottom: 14px; }
.step-no { color: var(--line-dark); font: 700 11px/1 Georgia, serif; }

.upload-box { min-height: 62px; display: flex; gap: 10px; align-items: center; padding: 11px; border: 1px dashed var(--line-dark); border-radius: 9px; background: #fbf9f5; cursor: pointer; }
.upload-box:hover { border-color: var(--terracotta); background: #fffaf6; }
.upload-plus { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line-dark); border-radius: 50%; color: var(--terracotta); font-size: 19px; font-weight: 300; }
.upload-box strong, .upload-box small { display: block; }
.upload-box strong { font-size: 12px; }
.upload-box small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.control-row { justify-content: space-between; gap: 12px; margin: 14px 0 8px; font-size: 11px; color: var(--muted); }
output { color: var(--ink); font-weight: 700; }
input[type="range"] { width: 100%; height: 4px; accent-color: var(--terracotta); cursor: pointer; }
.check-row { display: flex; gap: 7px; align-items: center; margin-top: 13px; color: var(--muted); font-size: 11px; cursor: pointer; }
.check-row input { accent-color: var(--terracotta); }

.furniture-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.furniture-button { min-height: 61px; display: flex; align-items: center; gap: 9px; padding: 8px 9px; text-align: left; color: var(--ink); background: #fbf9f5; border: 1px solid var(--line); border-radius: 8px; }
.furniture-button:hover { border-color: var(--terracotta); background: #fff8f3; }
.furniture-button:active { transform: translateY(1px); }
.furniture-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--terracotta-dark); border: 1px solid #dfc5b9; background: #fff3ed; font-size: 15px; font-weight: 800; border-radius: 6px; }
.furniture-button span:last-child { font-size: 11px; font-weight: 700; }
.file-actions { gap: 8px; }
.file-actions .button { flex: 1; padding: 0 8px; }
.file-label { display: grid; place-items: center; }

.canvas-panel { min-width: 0; background: #eee8df; }
.canvas-toolbar { min-height: 80px; justify-content: space-between; padding: 19px 28px 16px; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .7); }
.canvas-toolbar h2 { margin: 0; font: 700 19px/1.2 Georgia, "Noto Serif KR", serif; letter-spacing: -.05em; }
.canvas-toolbar h2 span { margin-left: 10px; color: var(--muted); font: 600 10px/1.2 "Noto Sans KR", sans-serif; letter-spacing: 0; vertical-align: middle; }
.canvas-tools { display: flex; align-items: center; gap: 10px; }
.tool-button { min-height: 31px; padding: 0 10px; border: 1px solid var(--line-dark); border-radius: 6px; color: var(--muted); background: var(--panel); font-size: 11px; }
.tool-button:hover { color: var(--ink); border-color: var(--ink); }
.zoom-readout { min-width: 35px; color: var(--muted); font-size: 11px; text-align: right; }
.canvas-stage { position: relative; min-height: 560px; height: calc(100vh - 173px); min-height: 480px; display: grid; place-items: center; padding: 36px; overflow: hidden; }
.canvas-stage::before { content: ""; position: absolute; inset: 0; background: rgba(119, 105, 91, .025); pointer-events: none; }
#scene { position: relative; z-index: 1; width: min(100%, 920px); max-height: 100%; height: auto; border: 1px solid #bfb5a8; border-radius: 9px; box-shadow: var(--shadow); background: #fffdf9; touch-action: none; }
.scene-paper { fill: #fbfaf7; }
.scene-grid { opacity: .58; }
.room-fill { stroke: none; }
.living-fill { fill: #f7f0e8; }
.bedroom-fill { fill: #f1eee6; }
.kitchen-fill { fill: #f0f4ef; }
.bath-fill { fill: #eaf1f2; }
.entry-fill { fill: #f5f1e8; }
.wall-line { fill: none; stroke: #746b60; stroke-width: 8; stroke-linejoin: round; }
.wall-line.thin { stroke: #aaa093; stroke-width: 4; }
.door-line { fill: none; stroke: #b6aa9b; stroke-width: 2; stroke-dasharray: 7 6; }
.room-label text:first-child { fill: #696158; font: 700 18px Georgia, "Noto Serif KR", serif; }
.room-label text:last-child { fill: #91877b; font: 11px "Noto Sans KR", sans-serif; }
.kitchen-line path, .bath-fixtures circle, .bath-fixtures path { fill: none; stroke: #a7b1aa; stroke-width: 3; }
.dimension-line path { fill: none; stroke: var(--terracotta); stroke-width: 1.5; }
.dimension-line text { fill: var(--terracotta-dark); font: 10px "Noto Sans KR", sans-serif; }
.scale-note { position: absolute; z-index: 2; top: 16px; right: 26px; color: #877d70; font-size: 10px; }
.stage-hint { position: absolute; z-index: 2; bottom: 18px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 7px 10px; color: #6f675e; border: 1px solid rgba(168, 159, 146, .65); border-radius: 5px; background: rgba(255, 253, 249, .9); font-size: 10px; white-space: nowrap; }
.canvas-footer { min-height: 40px; justify-content: space-between; padding: 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; background: var(--panel); }
.legend, .keyboard-help { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 7px; height: 7px; display: inline-block; margin-left: 8px; border-radius: 50%; }
.legend-dot:first-child { margin-left: 0; }.terracotta { background: var(--terracotta); }.gray { background: #9b948b; }
kbd { min-width: 19px; padding: 2px 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; color: var(--muted); background: #faf8f4; font-size: 9px; text-align: center; }

.furniture-item { cursor: grab; outline: none; }
.furniture-item:active { cursor: grabbing; }
.furniture-item .furniture-body { filter: url(#furnitureShadow); }
.furniture-item .furniture-top { fill: #f1cbb8; stroke: #8b503d; stroke-width: 2; }
.furniture-item .furniture-front { fill: #c8795c; stroke: #8b503d; stroke-width: 2; }
.furniture-item .furniture-side { fill: #a85840; stroke: #8b503d; stroke-width: 2; }
.furniture-item .detail { fill: none; stroke: #fff4eb; stroke-width: 2; opacity: .9; }
.furniture-item .item-label { fill: #5b2f24; font: 700 11px "Noto Sans KR", sans-serif; pointer-events: none; }
.furniture-item.selected .furniture-front, .furniture-item.selected .furniture-top { stroke: #9a3926; stroke-width: 3; }
.selection-box { fill: none; stroke: var(--terracotta); stroke-width: 2; stroke-dasharray: 6 5; }
.selection-handle { fill: #fffdf9; stroke: var(--terracotta); stroke-width: 2; }

.empty-inspector { padding: 18px 0 8px; color: var(--muted); text-align: center; }
.empty-inspector strong { display: block; margin: 13px 0 6px; color: var(--ink); font-size: 12px; }
.empty-inspector p { max-width: 180px; margin: 0 auto; font-size: 11px; line-height: 1.6; }
.empty-drawing { width: 88px; height: 64px; position: relative; margin: 0 auto; border: 1px solid var(--line-dark); background: #faf7f0; }
.empty-drawing::before, .empty-drawing::after { content: ""; position: absolute; border: 1px solid var(--line-dark); background: #fffdf9; }
.empty-drawing::before { width: 30px; height: 20px; left: 10px; top: 13px; }.empty-drawing::after { width: 25px; height: 14px; right: 9px; bottom: 11px; }
.empty-drawing span { position: absolute; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--terracotta); }.empty-drawing span:nth-child(1) { left: 18px; bottom: 9px; }.empty-drawing span:nth-child(2) { right: 20px; top: 12px; }.empty-drawing span:nth-child(3) { left: 45px; top: 32px; }
.selected-title { gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbf9f5; }
.selected-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--terracotta-dark); border-radius: 6px; background: #f8e8df; font-weight: 800; }
.selected-title strong, .selected-title small { display: block; }.selected-title strong { font-size: 13px; }.selected-title small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.inspector-control { margin-top: 20px; }.inspector-control .control-row { margin-top: 0; }
.quick-rotate { gap: 7px; }.quick-rotate .button { flex: 1; padding: 0 4px; font-size: 10px; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.coordinate-grid label, .dimension-grid label { color: var(--muted); font-size: 10px; }.coordinate-grid input, .dimension-grid input { width: 100%; height: 32px; margin-top: 5px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fffdf9; font-size: 11px; }.dimension-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }.field-help { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.selected-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }.selected-actions .button { width: 100%; }
.text-button { display: block; margin: 15px auto 0; padding: 0; border: 0; color: var(--terracotta-dark); background: transparent; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.note-section { margin-top: auto; }.note-section h3 { margin-bottom: 8px; font: 700 18px/1.25 Georgia, "Noto Serif KR", serif; }.guide-section { display: flex; gap: 10px; align-items: flex-start; border-bottom: 0; }.guide-number { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--terracotta); border-radius: 50%; color: var(--terracotta-dark); font: 700 12px Georgia, serif; }.guide-section p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }.guide-section strong { color: var(--ink); }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(340px, calc(100vw - 48px)); padding: 11px 14px; transform: translateY(20px); opacity: 0; pointer-events: none; border: 1px solid var(--line-dark); border-radius: 7px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); font-size: 11px; transition: opacity .2s ease, transform .2s ease; }.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 246px minmax(480px, 1fr) 250px; }
  .panel-section { padding-left: 16px; padding-right: 16px; }
  .canvas-toolbar, .canvas-footer { padding-left: 20px; padding-right: 20px; }
  .canvas-stage { padding: 28px 18px; }
  .keyboard-help { display: none; }
}
@media (max-width: 920px) {
  .topbar { padding: 0 17px; }.save-state { display: none; }
  .app-shell { display: flex; flex-direction: column; }
  .left-panel, .right-panel { border: 0; }.left-panel { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }.intro-section { grid-column: 1 / -1; }.panel-section { padding: 17px; }
  .furniture-section { border-left: 1px solid var(--line); }.file-section { grid-column: 1 / -1; }
  .canvas-panel { order: 2; }.right-panel { order: 3; display: grid; grid-template-columns: 1fr 1fr; }.inspector-section { grid-row: span 2; }.note-section { margin-top: 0; }.guide-section { grid-column: 2; }
  .canvas-stage { height: auto; min-height: 520px; }.canvas-footer { min-height: 42px; }
}
@media (max-width: 600px) {
  .topbar { height: 68px; }.brand-kicker { font-size: 9px; }h1 { font-size: 18px; }.top-actions { gap: 5px; }.top-actions .button { padding: 0 8px; font-size: 10px; }
  .left-panel, .right-panel { display: block; }.furniture-section { border-left: 0; }.panel-section { padding: 16px; }.canvas-toolbar { min-height: 72px; padding: 15px 16px; }.canvas-toolbar h2 { font-size: 16px; }.canvas-tools .tool-button { font-size: 10px; padding: 0 7px; }.canvas-stage { min-height: 440px; padding: 30px 8px; }.scale-note { right: 12px; font-size: 9px; }.stage-hint { font-size: 9px; }.canvas-footer { padding: 0 16px; }.legend { font-size: 9px; }.right-panel { border-top: 1px solid var(--line); }.note-section { border-top: 1px solid var(--line); }.guide-section { border-top: 1px solid var(--line); }
}
