/* 편집기 화면. 모바일 우선, 900px 이상에서는 오른쪽 사이드 패널. */

.app-body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.app {
  display: grid;
  height: 100vh;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "stage" "tools";
}

/* 상단 */
.topbar {
  grid-area: top;
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 8px 6px 12px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
}

.brand-name {
  display: none;
  white-space: nowrap;
}

.project-name {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 600;
  text-overflow: ellipsis;
}

.project-name:hover,
.project-name:focus {
  border-color: var(--line);
  background: var(--surface-2);
  outline: none;
}

.topbar-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

.icon-btn-sm {
  width: 34px;
  height: 34px;
}

.icon-btn-sm svg {
  width: 18px;
  height: 18px;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  z-index: 30;
  width: min(300px, calc(100vw - 16px));
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu button,
.menu a,
.menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu button:hover,
.menu a:hover,
.menu-toggle:hover {
  background: var(--surface-2);
}

.menu svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.menu-toggle input {
  width: 18px;
  height: 18px;
  margin: 0 1px;
  accent-color: var(--accent);
}

.menu hr {
  margin: 6px 4px;
  border: 0;
  border-top: 1px solid var(--line);
}

/* 캔버스 영역 */
.stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#canvas {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
}

.chip svg {
  width: 16px;
  height: 16px;
}

.chip-danger {
  border-color: #f6c6c7;
  background: var(--danger-weak);
  color: #b4232a;
}

.zoom-ctrl {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.zoom-ctrl .icon-btn {
  width: 42px;
  height: 40px;
}

/* 첫 화면 */
.empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100% - 32px));
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.empty-desc {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.empty-actions {
  display: grid;
  gap: 8px;
}

/* 벽 그리기 막대 */
.drawbar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  display: grid;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.drawbar-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.drawbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.field-inline input {
  width: 76px;
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.field-inline .unit {
  color: var(--muted);
  font-weight: 500;
}

.dir-btns {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.dir-btns .icon-btn {
  width: 40px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.spacer {
  flex: 1;
}

/* 아래 도구 막대 */
.toolbar {
  grid-area: tools;
  position: relative;
  z-index: 15;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 4px 4px max(4px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.toolbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 96px;
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.toolbar svg {
  width: 24px;
  height: 24px;
}

.toolbar button[aria-pressed="true"] {
  background: var(--accent-weak);
  color: var(--accent);
}

/* 패널: 모바일은 아래에서 올라오는 시트 */
.panel {
  grid-area: stage;
  align-self: end;
  position: relative;
  z-index: 10;
  max-height: 48%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 14px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -6px 24px rgba(20, 30, 50, 0.12);
  user-select: text;
  -webkit-user-select: text;
}

.panel:not(.open) {
  display: none;
}

.panel::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 2px auto 6px;
  border-radius: 2px;
  background: var(--line);
}

.panel-section + .panel-section {
  margin-top: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 8px;
}

.panel-title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.title-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 16px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field + .field,
.field-grid + .field,
.field + .field-grid,
.field-grid + .field-row,
.field-row + .field {
  margin-top: 10px;
}

.field select,
.field > input,
.input-unit {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* iOS 확대 방지 */
  font-weight: 500;
}

.field select,
.field > input {
  padding: 0 10px;
}

.input-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.input-unit:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.input-unit input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 0 0 10px;
  border: 0;
  background: transparent;
  outline: none;
}

.input-unit span {
  padding: 0 10px 0 4px;
  color: var(--faint);
  font-size: 13px;
}

.field-grid > .field {
  margin-top: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-row {
  display: flex;
  align-items: end;
  gap: 8px;
}

.field-row .field {
  flex: 1;
}

.field-row .btn {
  min-height: 40px;
  padding: 0 10px;
}

.field-row .btn svg {
  width: 16px;
  height: 16px;
}

[data-action="rot-left"] svg {
  transform: scaleX(-1);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel .swatches {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 3px;
  margin: -3px;
  scrollbar-width: none;
}

.panel .swatches::-webkit-scrollbar {
  display: none;
}

.swatch {
  flex: none;
}

.swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--line);
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--accent);
}

.more {
  margin-top: 12px;
  font-size: 14px;
}

.more summary {
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.more[open] summary {
  margin-bottom: 8px;
}

.hint {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.5;
}

.warn {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-weak);
  color: #b4232a;
  font-size: 13px;
  font-weight: 600;
}

.warn svg {
  width: 18px;
  height: 18px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.panel-actions .btn {
  flex: 1;
}

.affiliate {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
}

/* 가구 목록 */
.tabs {
  display: flex;
  gap: 6px;
  margin: 0 -14px 10px;
  padding: 0 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.tabs button[aria-selected="true"] {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.catalog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 108px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.catalog-card:hover {
  border-color: #c7d2e4;
  background: var(--surface-2);
}

.catalog-card:active {
  transform: scale(0.98);
}

.catalog-preview {
  width: 72px;
  height: 52px;
  pointer-events: none;
}

.catalog-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  word-break: keep-all;
}

.catalog-size {
  color: var(--faint);
  font-size: 12px;
}

.catalog-add {
  justify-content: center;
  border-style: dashed;
  color: var(--accent);
}

.catalog-add svg {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
}

.catalog-del {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
}

.catalog-del:hover {
  background: var(--danger-weak);
  color: var(--danger);
}

.catalog-del svg {
  width: 14px;
  height: 14px;
}

/* 도면 정보 */
.stat {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-weak);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-value {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.room-list,
.count-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.room-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
}

.count-list {
  display: flex;
  gap: 14px;
  color: var(--muted);
}

.tips {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.tips h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.tips ul {
  margin: 0 0 8px;
  padding-left: 1.2em;
  color: var(--muted);
}

/* 대화상자 */
.dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog-wide {
  width: min(560px, calc(100vw - 24px));
}

.dialog::backdrop {
  background: rgba(15, 20, 30, 0.45);
}

.dialog-form {
  display: grid;
  gap: 12px;
  padding: 20px;
  user-select: text;
  -webkit-user-select: text;
}

.dialog h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.dialog-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.dialog-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
}

.dialog .field + .field,
.dialog .field-grid + .field,
.dialog .field + .field-grid {
  margin-top: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.help-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 14px;
  color: #3a4150;
}

.help-list li + li {
  margin-top: 8px;
}

.help-keys {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

/* 알림 */
.toast {
  position: fixed;
  left: 50%;
  top: calc(104px + env(safe-area-inset-top));
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
  text-align: center;
}

@media (min-width: 560px) {
  .brand-name {
    display: inline;
  }

  .project-name {
    max-width: 320px;
    margin-left: 8px;
  }

  .topbar-actions {
    margin-left: auto;
  }
}

/* 데스크톱: 오른쪽 사이드 패널 */
@media (min-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "top top" "stage panel" "tools panel";
  }

  .panel {
    grid-area: panel;
    align-self: stretch;
    max-height: none;
    padding: 12px 16px 16px;
    border-top: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .panel::before {
    display: none;
  }

  .panel:not(.open) {
    display: block;
  }

  .toolbar {
    justify-content: center;
    gap: 6px;
  }

  .toolbar button {
    flex: 0 1 96px;
  }

  .tabs {
    flex-wrap: wrap;
    margin: 0 0 10px;
    padding: 0;
    overflow: visible;
  }
}

/* ---- 빠른 메뉴(모바일 접힌 패널) ---- */
.quick-danger {
  color: var(--danger);
}

.panel.compact .props-more {
  display: none;
}

.panel.compact .panel-head {
  margin-bottom: 0;
}

.panel.compact .warn {
  margin-top: 6px;
}

.panel-head > .warn {
  margin: 0;
}

.expand-btn svg {
  transition: transform 0.2s;
}

.panel:not(.compact) .expand-btn svg {
  transform: rotate(180deg);
}

.desktop-only {
  display: none !important;
}

.panel-head .title-input {
  min-width: 80px;
}

/* ---- 가구 검색 ---- */
.search-input {
  width: 100%;
  height: 40px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 16px;
}

.search-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.catalog-empty {
  grid-column: 1 / -1;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* ---- 첫 화면 ---- */
.empty-actions .btn svg {
  width: 20px;
  height: 20px;
}

.empty-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.empty-foot {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 12.5px;
}

/* ---- 템플릿 ---- */
.dialog-xl {
  width: min(760px, calc(100vw - 24px));
}

.dialog-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.template-card:hover,
.template-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.template-preview {
  width: 100%;
  height: 150px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: #fff;
}

.template-name {
  font-weight: 700;
}

.template-desc {
  color: var(--faint);
  font-size: 13px;
}

@media (max-width: 899px) {
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-preview {
    height: 110px;
  }
}

@media (min-width: 900px) {
  .quick {
    display: none;
  }

  .desktop-only {
    display: flex !important;
  }
}

/* ---- 3D 보기 ---- */
.btn-3d {
  min-height: 36px;
  padding: 0 10px;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.btn-3d[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.view3d {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: #e8ecf1;
}

.view3d canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.view3d-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.view3d-bar .btn {
  box-shadow: var(--shadow-sm);
}

.view3d-bar .btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

.view3d-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.view3d-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
}

.app.is-3d .hud,
.app.is-3d .zoom-ctrl,
.app.is-3d .empty-state,
.app.is-3d .drawbar {
  display: none !important;
}

@media (max-width: 899px) {
  .app.is-3d .panel {
    display: none;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 4px;
    padding-left: 8px;
  }

  .topbar .icon-btn {
    width: 38px;
  }
}

/* ---- 걸어보기 ---- */
.btn-walk {
  border-color: var(--accent);
  color: var(--accent);
}

.view3d.walking .view3d-bar .btn:not(.btn-walk):not([data-view3d="shot"]) {
  display: none;
}

.joystick {
  position: absolute;
  left: 24px;
  bottom: 56px;
  z-index: 3;
  width: 120px;
  height: 120px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(31, 36, 48, 0.25);
  touch-action: none;
  backdrop-filter: blur(2px);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.view3d.walking .view3d-hint {
  bottom: auto;
  top: 56px;
}

.view3d.walking canvas {
  cursor: grab;
}

/* ---- 2차: 면적 안내, PC 벽 그리기 막대 ---- */
.chip-note {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 500;
}

.area-note b {
  color: var(--muted);
}

.panel > .drawbar {
  position: static;
  max-width: none;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--accent-weak);
  border-radius: var(--radius);
  background: #f5f8ff;
  box-shadow: none;
}

.panel > .drawbar .dir-btns .icon-btn {
  background: var(--surface);
}

/* ---- 통과 확인 ---- */
.btn-block {
  width: 100%;
  margin-top: 12px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-2);
}

.seg button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.pass-fields {
  display: grid;
  gap: 10px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}

.verdict {
  display: inline-block;
  min-width: 64px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.verdict-ok {
  background: #e3f6e8;
  color: #1c7a3a;
}

.verdict-tight {
  background: #fff1d6;
  color: #9a5b00;
}

.verdict-no {
  background: var(--danger-weak);
  color: #b4232a;
}

.pass-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.pass-summary strong {
  flex: 1;
}

.pass-summary span:last-child {
  color: var(--muted);
  font-size: 14px;
}

.pass-ok {
  background: #f1fbf3;
}

.pass-tight {
  background: #fff8ea;
}

.pass-no {
  background: #fdf1f1;
}

.pass-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 4px;
  font-size: 14px;
}

.pass-methods {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.pass-methods li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.pass-name {
  flex: 1;
}

.pass-margin {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.pass-disclaimer {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
  font-weight: 600;
}

/* ---- 배경 도면 ---- */
.calibbar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid #f3c2da;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13.5px;
}

.calibbar p {
  flex: 1;
  margin: 0;
  color: var(--muted);
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #eef7f1;
  color: #1c6b37;
  font-size: 12.5px;
  font-weight: 600;
}

.privacy-note svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-row input {
  flex: 1;
  accent-color: var(--accent);
}

.range-row output {
  min-width: 42px;
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.quick.is-on {
  background: var(--accent-weak);
  color: var(--accent);
}

.quick.is-off {
  color: var(--faint);
}

.app.is-3d .calibbar {
  display: none !important;
}

/* ---- 템플릿 크기 바꾸기 ---- */
.tpl-detail {
  display: grid;
  gap: 10px;
}

.tpl-back {
  justify-self: start;
  padding-left: 0;
}

.tpl-big {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.tpl-name {
  margin: 0;
  font-size: 16px;
}

@media (max-width: 899px) {
  .tpl-big {
    height: 200px;
  }
}

/* ---- 인쇄 ---- */
@media screen {
  #printArea {
    display: none;
  }
}

@media print {
  html,
  body,
  .app-body {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  body > :not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block;
    color: #111;
    font-family: var(--font);
    font-size: 10pt;
    user-select: text;
  }

  .pr-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8mm;
    margin-bottom: 3mm;
    border-bottom: 0.3mm solid #333;
  }

  .pr-head h1 {
    margin: 0 0 1.5mm;
    font-size: 14pt;
  }

  .pr-head p {
    margin: 0;
    color: #555;
    font-size: 9pt;
  }

  .pr-plan {
    display: block;
    margin: 0 auto;
    break-inside: avoid;
  }

  .pr-scale {
    margin: 2mm 0 0;
    color: #333;
    font-size: 9pt;
    text-align: center;
  }

  #printArea h2 {
    margin: 6mm 0 2mm;
    font-size: 11pt;
    break-after: avoid;
  }

  .pr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
  }

  .pr-table th,
  .pr-table td {
    padding: 1.5mm 2mm;
    border: 0.2mm solid #999;
    text-align: left;
  }

  .pr-table th {
    background: #f0f0f0;
  }

  .pr-table tr {
    break-inside: avoid;
  }

  .pr-note {
    margin-top: 4mm;
    color: #555;
    font-size: 8.5pt;
  }
}

.panel > .drawbar .drawbar-row {
  flex-wrap: wrap;
}

.panel > .drawbar .dir-btns {
  margin-left: 0;
}

.panel > .drawbar .spacer {
  display: none;
}

/* ---- 방 바닥 재질 ---- */
.floor-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.floor-swatch {
  display: grid;
  gap: 4px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.floor-swatch img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  box-shadow: 0 0 0 1px var(--line);
}

.floor-swatch[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.panel .floor-swatches + .swatches {
  margin-top: 4px;
}
