/* 둥지 짓기 시안 화면. 크기와 간격은 토큰, 색은 theme.css 역할만 써요.
   휴대폰: 위에 방 그림, 아래에 단계 패널. 넓은 화면(900px 이상): 왼쪽 방 그림, 오른쪽 패널. */

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

.app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: var(--line) solid var(--rule);
  background: var(--surface);
}

.top h1 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-heavy);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.seg {
  display: inline-flex;
  padding: var(--sp-1);
  gap: var(--sp-1);
  border-radius: var(--r-control);
  background: var(--control-bg);
}

.seg button {
  min-height: var(--h-sm);
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 var(--line) var(--rule);
}

.main {
  display: grid;
  grid-template-rows: minmax(0, 56fr) minmax(0, 44fr);
  min-height: 0;
}

@media (min-width: 900px) {
  .main {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr) clamp(340px, 30vw, 420px);
  }
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: var(--scene-bg);
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-top {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  right: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  pointer-events: none;
  z-index: 2;
}

.stage-top > * {
  pointer-events: auto;
}

.stage-reset {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-2);
  z-index: 2;
  background: var(--surface);
}

.stage-alert {
  padding: var(--sp-4);
}

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--scene-label-bg);
  color: var(--ink);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.tag.is-selected {
  color: var(--primary-bg);
  font-weight: var(--fw-bold);
}

.tag.is-bad {
  color: var(--danger);
  font-weight: var(--fw-bold);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  border: var(--line) solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--on-primary);
  font-weight: var(--fw-bold);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

#rough.is-rough {
  background: var(--danger-soft);
  color: var(--danger);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  border-top: var(--line) solid var(--rule);
}

@media (min-width: 900px) {
  .panel {
    border-top: 0;
    border-left: var(--line) solid var(--rule);
  }
}

.steps {
  flex: none;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-4);
  overflow-x: auto;
  background: var(--surface);
  border-bottom: var(--line) solid var(--rule);
}

.step {
  flex: none;
  min-height: var(--h-sm);
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.step[aria-current="step"] {
  background: var(--control-bg);
  color: var(--ink);
  font-weight: var(--fw-bold);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  padding-bottom: var(--sp-8);
}

.panel-body h2 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-heavy);
  line-height: var(--lh-tight);
}

.panel-body h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}

.panel-body p {
  margin: 0;
  line-height: var(--lh-body);
}

.panel-body .choices {
  flex-direction: column;
  gap: var(--sp-2);
}

.choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  padding: var(--sp-3);
  border: var(--line-strong) solid var(--rule);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.choice span:not(.badge) {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
}

.choice[aria-pressed="true"] {
  border-color: var(--primary-bg);
  box-shadow: 0 0 0 var(--line) var(--primary-bg);
}

.row2,
.row3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
  align-items: end;
}

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

.field--num {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

.field--num .unit {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--ink-soft);
}

.field--num .input {
  width: 100%;
  min-width: 0;
}

.measure {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: var(--line) solid var(--rule);
  border-radius: var(--r-card);
}

.measure.is-done {
  border-color: var(--primary-bg);
}

.measure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-control);
  border-left: var(--sp-1) solid var(--rule);
  background: var(--control-bg);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.check--bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.check--warn {
  border-left-color: var(--accent);
}

.check--ok {
  border-left-color: var(--primary-bg);
}

.plan-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.plan-row .input {
  flex: 1;
  min-width: 0;
}

.is-gone {
  display: none;
}

.tag--room {
  background: transparent;
  color: var(--ink-soft);
  font-weight: var(--fw-bold);
}
