/* 편집기 화면. 모바일 우선, 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);
}

.field-note {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
}

.finish-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.finish-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: 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;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.start-scenes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
}

.product-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.product-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}

.product-list a span {
  font-size: 13px;
  color: var(--muted);
}

.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,
.tips ol {
  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-intro {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

.empty-intro h2 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--text);
}

.empty-intro p {
  margin: 0 0 8px;
  line-height: 1.55;
}

.empty-faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.empty-faq h3 {
  margin: 10px 0 2px;
  font-size: 13px;
  color: var(--text);
}

.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-quality {
  gap: 6px;
  cursor: pointer;
}

.view3d-quality select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0;
  min-height: 0;
}

.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;
}

/* ---- 보관함 ---- */
.lib-toolbar {
  display: flex;
  gap: 8px;
}

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 2px;
}

.lib-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.lib-card.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.lib-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 10 / 7;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lib-empty {
  color: var(--faint);
  font-size: 13px;
}

.lib-meta {
  display: grid;
  gap: 2px;
}

.lib-name {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-weight: 700;
}

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

.lib-sub {
  padding: 0 6px;
  color: var(--faint);
  font-size: 12px;
}

.lib-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ---- 비교 ---- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compare-col {
  display: grid;
  gap: 8px;
  min-width: 0;
}

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

.compare-stats {
  display: flex;
  gap: 14px;
  margin: 0;
  font-size: 13px;
}

.compare-stats div {
  display: flex;
  gap: 4px;
}

.compare-stats dt {
  color: var(--faint);
}

.compare-stats dd {
  margin: 0;
  font-weight: 700;
}

.compare-stats .is-bad {
  color: var(--danger);
}

@media (max-width: 700px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-canvas {
    height: 200px;
  }
}

/* 3D: 가구 모델 받는 중 표시(작은 칩, 아래 안내문 위) */
.chip-models {
  position: absolute;
  left: 50%;
  bottom: 52px;
  z-index: 2;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12.5px;
  min-height: 28px;
  box-shadow: var(--shadow);
}
.chip-models .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .chip-models .spinner { animation: none; }
}

/* ================= 7차: 쉽게 쓰기 ================= */

/* 처음 화면: 집 종류 카드 3개 + 다른 시작 방법 */
.start-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

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

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

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

.start-card canvas {
  width: 100%;
  height: 72px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: var(--surface-2);
}

.start-name {
  font-size: 14px;
  font-weight: 700;
  word-break: keep-all;
}

.start-desc {
  font-size: 11.5px;
  color: var(--muted);
}

.start-or {
  margin: 16px 0 8px;
  color: var(--faint);
  font-size: 12.5px;
}

.start-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.start-links .btn svg,
.start-foot .btn svg {
  width: 16px;
  height: 16px;
}

.start-foot {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
}

/* 메뉴 묶음 제목·더 보기 */
.menu-label {
  margin: 8px 10px 2px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.menu-label:first-child {
  margin-top: 4px;
}

.menu-more {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.menu-more summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
}

.menu-more summary::-webkit-details-marker {
  display: none;
}

.menu-more summary svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.menu-more[open] summary {
  color: var(--text);
}

/* 템플릿 창: 묶음 탭, 카드 + '크기 먼저 정하기' */
.tpl-tabs {
  margin: 0 0 8px;
  padding: 0;
}

.template-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-item .template-card {
  flex: 1;
}

.tpl-size {
  min-height: 34px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* 방 크기 칸(모바일 접힌 패널에서도 보임) */
.room-size {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.room-size .field + .field {
  margin-top: 0;
}

/* 빠른 메뉴의 글자 버튼(문 통과?) */
.quick-text {
  min-height: 34px;
  padding: 0 10px;
  gap: 4px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--accent);
  border-color: var(--accent-weak);
  background: var(--accent-weak);
}

.quick-text svg {
  width: 16px;
  height: 16px;
}

.btn-passage {
  margin: 4px 0 10px;
  color: var(--accent);
  border-color: var(--accent-weak);
  background: var(--accent-weak);
  font-weight: 700;
}

@media (min-width: 900px) {
  .panel-head .quick-text {
    display: none; /* 데스크톱은 패널 안의 큰 버튼을 쓴다 */
  }
}

/* 가구 검색: 치수 붙여넣기 */
.search-tip {
  margin: -2px 0 8px;
  color: var(--faint);
  font-size: 12.5px;
}

.dims-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 14px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-weak);
  text-align: left;
}

.dims-card svg {
  grid-row: span 3;
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.dims-main {
  font-weight: 800;
  color: var(--accent);
  font-size: 15px;
}

.dims-size {
  font-weight: 600;
  font-size: 14px;
}

.dims-note {
  color: var(--muted);
  font-size: 12.5px;
}

/* 처음 안내 말풍선: 작게, 오른쪽 확대 버튼을 피해서(도면을 가리지 않게) */
.coach {
  position: absolute;
  left: 12px;
  right: 64px;
  top: 52px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 440px;
  padding: 6px 6px 6px 12px;
  border-radius: 12px;
  background: rgba(31, 36, 48, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
}

.coach-step {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11.5px;
  font-weight: 700;
  vertical-align: 1px;
}

.coach-text {
  flex: 1;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: keep-all;
}

.coach-next {
  flex: none;
  min-height: 32px;
}

.coach-off {
  flex: none;
  color: rgba(255, 255, 255, 0.7);
}

.coach-target {
  position: relative;
  z-index: 31;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(37, 99, 235, 0.25);
  animation: coach-pulse 1.6s ease-in-out infinite;
}

@keyframes coach-pulse {
  50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 11px rgba(37, 99, 235, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
  .coach-target { animation: none; }
}

/* 3D에서는 위쪽 보기 버튼 줄 아래로 */
.app.is-3d .coach {
  top: 118px;
}

@media (min-width: 900px) {
  .app.is-3d .coach {
    top: 62px;
  }

  .coach {
    left: 50%;
    right: auto;
    width: min(440px, calc(100% - 140px));
    transform: translateX(-50%);
  }
}

/* 사용법: 기본 4단계 + 더 많은 기능 */
.help-steps li strong {
  color: var(--accent);
}

.help-more summary {
  margin: 4px 0 8px;
  font-weight: 700;
  cursor: pointer;
}

/* ================= 8차: 템플릿 ================= */
.tpl-notice {
  margin: -4px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 12.5px;
  line-height: 1.5;
}

.tpl-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 8px;
}

.hint-inline {
  color: var(--faint);
  font-size: 12.5px;
}

/* ================= 9차: 가구 카탈로그 ================= */
.catalog-fav {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--line);
  font-size: 16px;
  line-height: 26px;
  cursor: pointer;
}

.catalog-fav:hover {
  color: var(--faint);
  background: var(--surface-2);
}

.catalog-fav.is-on {
  color: #f0b429;
}

.catalog-size i {
  font-style: normal;
  color: var(--faint);
}

.size-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.tv-row {
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tv-row .hint {
  flex-basis: 100%;
  margin: 2px 0 0;
}

/* ================= 14차: 홈과 같은 결 — 글래스 알약 바, 떠 있는 패널, 옅은 격자, 선택 툴바 ================= */
.app {
  background: #f3f4f7; /* 캔버스 바탕과 같은 색이라 막대·패널 사이가 이어져 보인다 */
}

/* 위: 떠 있는 알약 */
.topbar {
  width: min(100% - 16px, 1040px);
  min-height: 54px;
  margin: 8px auto 0;
  padding: 6px 8px 6px 10px;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-bottom: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(20, 30, 50, 0.1);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.project-name {
  font-size: 16px;
  font-weight: 700;
  background: transparent;
  border-color: transparent;
}

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

.btn-3d {
  border-radius: 999px;
  font-weight: 700;
}

.topbar .icon-btn {
  border-radius: 999px;
}

/* 아래: 떠 있는 알약 도구 막대 */
.toolbar {
  width: max-content;
  max-width: calc(100% - 16px);
  margin: 0 auto 10px;
  padding: 5px;
  gap: 2px;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-top: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(20, 30, 50, 0.14);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.toolbar button {
  min-width: 58px;
  min-height: 56px;
  border-radius: 999px;
  font-size: 12.5px;
}

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

.toolbar .tool-accent {
  color: var(--accent);
}

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

/* 캔버스 위 칩·확대 버튼: 유리 느낌 */
.hud {
  top: 12px;
  left: 12px;
}

.chip {
  min-height: 34px;
  border-color: rgba(20, 30, 50, 0.08);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13.5px;
}

.zoom-ctrl {
  top: 12px;
  right: 12px;
  border-radius: 999px;
  border-color: rgba(20, 30, 50, 0.08);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.zoom-ctrl .icon-btn {
  border-radius: 0;
}

/* 떠 있는 선택 툴바(어두운 유리) */
.selbar {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(20, 24, 34, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  will-change: transform;
}

.selbar button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.selbar button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.selbar button.danger {
  color: #ff8b8b;
}

.selbar svg {
  width: 20px;
  height: 20px;
}

.selbar .flip-x {
  transform: scaleX(-1);
}

/* 처음 안내: 어두운 유리 알약 */
.coach {
  top: 56px;
  border-radius: 999px;
  background: rgba(20, 24, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.coach-text {
  font-size: 14px;
}

.coach-next {
  border-radius: 999px;
}

/* 패널 글씨·칸 조금 크게, 카드는 테두리 대신 면으로 */
.panel-title {
  font-size: 18px;
}

.field {
  font-size: 14px;
}

.catalog-card {
  border-color: transparent;
  border-radius: 16px;
  background: var(--surface-2);
}

.catalog-card:hover {
  border-color: transparent;
  background: var(--accent-weak);
  transform: translateY(-2px);
}

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

/* 도면 정보: 큰 숫자 + 할 일 카드 */
.stat-value {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.how-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 10px;
}

.how {
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 12px 12px 11px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.how:hover {
  background: var(--accent-weak);
  transform: translateY(-1px);
}

.how svg {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  color: var(--accent);
}

.how b {
  font-size: 14.5px;
}

.how span {
  font-size: 12.5px;
  color: var(--muted);
}

/* 모바일 시트 */
.panel {
  border-radius: 22px 22px 0 0;
  border-top: 0;
  box-shadow: 0 -10px 34px rgba(20, 30, 50, 0.14);
}

/* 3D 보기 막대·안내도 유리 알약 */
.view3d-bar .btn {
  border-radius: 999px;
  border-color: rgba(20, 30, 50, 0.08);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 데스크톱: 패널을 떠 있는 카드로 */
@media (min-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 372px;
  }

  .panel {
    margin: 8px 8px 10px 0;
    padding: 14px 16px 16px;
    border: 1px solid rgba(20, 30, 50, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 44px rgba(20, 30, 50, 0.12);
  }

  .topbar {
    width: calc(100% - 16px);
    margin-left: 8px;
    margin-right: 8px;
    max-width: none;
  }

  .toolbar button {
    min-width: 64px;
  }
}

/* ================= 15차: 템플릿 창 '완성 예시' 탭 ================= */
.tpl-scene-note {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.start-or .link-btn {
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 시작 화면 카드가 화면보다 길면(예시 12개) 카드 안에서 스크롤 */
.empty-state {
  max-height: calc(100% - 176px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ================= 16차: 방 크기 넣기(ㄱ자)·시작 화면·비켜 놓기 ================= */
.start-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 6px 0 2px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}

.start-primary:hover,
.start-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.34);
}

.start-primary svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.start-primary span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.start-primary b {
  font-size: 17px;
}

.start-primary small {
  font-size: 12.5px;
  color: #eef2ff; /* 파란 바탕 대비 5:1 이상 */
}

.seg label[role="tab"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.seg label[role="tab"]:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.seg label[role="tab"] input {
  accent-color: var(--accent);
}

.rect-l {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.rect-l select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
}

.rect-more {
  margin-top: 10px;
}

.rect-more summary {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.rect-more .field-grid {
  margin-top: 8px;
}

.selbar button.nudge {
  width: auto;
  padding: 0 12px 0 8px;
  gap: 4px;
  grid-auto-flow: column;
  background: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.btn-nudge {
  margin: 0 0 10px;
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
  font-weight: 700;
}

.room-size-lead {
  margin: 0 0 8px;
}

.room-size-lead b {
  color: var(--text);
}


/* ================= 17차: 사진처럼 저장 진행 표시 ================= */
.photo-progress {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(11, 13, 18, 0.35);
  z-index: 6;
}

.photo-card {
  display: grid;
  gap: 10px;
  min-width: 240px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.photo-card p {
  margin: 0;
  font-weight: 700;
}

.photo-card progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

/* ================= 25차: 시작 화면을 홈 첫 화면과 같은 어두운 글래스 톤으로 ================= */
.app.is-start .stage {
  background: #0b0d12;
}

.app.is-start .stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 42%, rgba(37, 99, 235, 0.26) 0%, rgba(124, 58, 237, 0.12) 45%, rgba(0, 0, 0, 0) 72%),
    radial-gradient(ellipse 50% 18% at 50% 96%, rgba(99, 140, 255, 0.22) 0%, rgba(99, 140, 255, 0) 70%),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
}

.app.is-start #canvas {
  opacity: 0;
}

.app.is-start .empty-state {
  background: rgba(18, 21, 28, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: #f3f5f9;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.app.is-start .empty-title {
  color: #fff;
}

.app.is-start .empty-desc,
.app.is-start .start-desc,
.app.is-start .start-or,
.app.is-start .empty-intro,
.app.is-start .empty-intro p {
  color: rgba(243, 245, 249, 0.68);
}

.app.is-start .empty-foot {
  color: rgba(243, 245, 249, 0.5);
}

.app.is-start .start-card,
.app.is-start .start-links .btn,
.app.is-start .start-foot .btn {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f5f9;
}

.app.is-start .start-card:hover,
.app.is-start .start-links .btn:hover,
.app.is-start .start-foot .btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.app.is-start .start-card canvas {
  background: rgba(255, 255, 255, 0.9);
}

.app.is-start .start-name,
.app.is-start .empty-intro h2,
.app.is-start .empty-intro h3,
.app.is-start .empty-faq summary {
  color: #f3f5f9;
}

.app.is-start .start-or .link-btn,
.app.is-start .empty-intro a {
  color: #a9c0ff;
}

.app.is-start .empty-intro {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.app.is-start .start-scenes .btn,
.app.is-start .start-scenes button {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f5f9;
}

/* ================= 26차: 시작 화면 위에 뜨는 대화상자도 어두운 톤(토큰만 바꿔서 부품은 그대로) ================= */
body.is-start .dialog {
  --bg: #0b0d12;
  --surface: #161922;
  --surface-2: #1f2330;
  --text: #f3f5f9;
  --muted: rgba(243, 245, 249, 0.68);
  --faint: rgba(243, 245, 249, 0.52);
  --line: rgba(255, 255, 255, 0.13);
  --accent-weak: rgba(37, 99, 235, 0.24);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.is-start .dialog::backdrop {
  background: rgba(5, 7, 12, 0.6);
}

body.is-start .dialog .btn:not(.btn-primary):not(.btn-danger) {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3f5f9;
}

body.is-start .dialog .btn:not(.btn-primary):not(.btn-danger):hover {
  background: rgba(255, 255, 255, 0.12);
}

body.is-start .dialog a {
  color: #a9c0ff;
}

body.is-start .dialog .seg label[role="tab"]:has(input:checked) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.is-start .dialog canvas {
  background: rgba(255, 255, 255, 0.92);
}

body.is-start .dialog .seg button[aria-selected="true"] {
  background: #f3f5f9;
  color: #0b0d12;
  border-color: #f3f5f9;
}

body.is-start .dialog .tabs button[aria-selected="true"] {
  background: #f3f5f9;
  color: #0b0d12;
}
