/* ═══════════════════════════════════════════════════════════════════════
 * builder.css — 건물 조립 놀이 「내 손으로 짓기」   (2026-08-24)
 *
 *   사장님: 「착착착 타격감있고 손맛있게」
 *     ① 얹히면 눌렸다 편다   ② 놓을 자리가 미리 빛난다
 *     ③ 잘못 놓으면 튕긴다   ④ 되돌리기
 *
 * ⚠️ rpg.css 에 이어 붙이려다 **셸에서 깨졌다**(2026-08-24). 파일을 나눈다 —
 *    조립 놀이는 덩치가 커서 따로 두는 편이 읽기에도 낫다.
 * ═══════════════════════════════════════════════════════════════════ */
.bl-wrap {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(18, 20, 26, 0.74);
  backdrop-filter: blur(3px);
  animation: bl-in 0.18s ease-out;
}
@keyframes bl-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.bl-box {
  width: min(1060px, 100%);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #f6f1e6;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.bl-head {
  position: relative;
  padding: 12px 46px 11px 16px;
  background: linear-gradient(135deg, #ffd24a, #ff9a3c);
  color: #3a2600;
}
.bl-head b {
  font-size: 16px;
  display: block;
}
.bl-head span {
  font-size: 12px;
  opacity: 0.88;
  display: block;
  margin-top: 2px;
}
.bl-x {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  cursor: pointer;
}
.bl-main {
  display: grid;
  grid-template-columns: 190px 1fr 200px;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  flex: 1;
}
.bl-inv,
.bl-tools {
  overflow-y: auto;
}
.bl-drawer {
  background: #fff;
  border-radius: 12px;
  padding: 9px 10px;
  margin-bottom: 8px;
}
.bl-drawer h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #6b5a3e;
}
.bl-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.bl-item {
  aspect-ratio: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 9px;
  background: #faf7f0;
  font-size: 19px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  transition: transform 0.1s;
}
.bl-item:hover {
  background: #fff2d6;
  transform: scale(1.12);
}
.bl-item:active {
  transform: scale(0.9);
  cursor: grabbing;
}

/* ── 가운데 : 건물 ── */
.bl-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}
.bl-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}
.bl-roof {
  width: 208px;
  height: 26px;
  background: #6b5a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 5px 5px 0 0;
  position: relative;
  transition: transform 0.12s;
}
.bl-roof.r-박공 {
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  height: 40px;
}
.bl-roof.r-뾰족 {
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  height: 56px;
}
.bl-roof.r-둥근 {
  border-radius: 104px 104px 0 0;
  height: 40px;
}
.bl-body {
  width: 200px;
  background: var(--wall, #f2e8d5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.bl-floor {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
  transition: transform 0.12s;
}
.bl-floor.ground {
  padding-bottom: 10px;
  background: rgba(0, 0, 0, 0.05);
}
.bl-num {
  position: absolute;
  left: -22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9.5px;
  color: #a09480;
}
.bl-win {
  height: 30px;
  border-radius: 4px;
  background: linear-gradient(160deg, #cfe6f5, #9dc6e0);
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.bl-floor.ground .bl-win {
  height: 38px;
  background: linear-gradient(160deg, #e8f3fa, #c3ddec);
}
.bl-sign {
  width: 200px;
  background: #2b2b2b;
  color: #ffd24a;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 4px;
}
.bl-yard {
  width: 232px;
  min-height: 46px;
  margin-top: 2px;
  background: linear-gradient(180deg, #cfe3c4, #b7d3a8);
  border-radius: 0 0 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px;
  transition: transform 0.12s;
}
.bl-on {
  font-size: 20px;
  cursor: pointer;
}
.bl-on:hover {
  transform: scale(1.2);
}
.bl-count {
  font-size: 11.5px;
  color: #8a7a5e;
  padding: 4px 0 10px;
}

/* ① 얹히면 눌렸다 편다 — 이것이 손맛이다 */
.bl-pop {
  animation: bl-pop 0.34s cubic-bezier(0.2, 1.8, 0.35, 1);
}
@keyframes bl-pop {
  0% {
    transform: scaleY(0.7) scaleX(1.08);
  }
  60% {
    transform: scaleY(1.06) scaleX(0.98);
  }
  100% {
    transform: none;
  }
}

/* ② 놓을 수 있는 자리가 미리 빛난다 */
body.bl-dragging [data-drop] {
  outline: 2px dashed transparent;
}
body.bl-dragging[data-drag="세입자"] [data-drop="세입자"],
body.bl-dragging[data-drag="마스코트"] [data-drop="마스코트"],
body.bl-dragging[data-drag="마당"] [data-drop="마당"],
body.bl-dragging[data-drag="옥상"] [data-drop="옥상"] {
  outline: 2px dashed #f36f21;
  outline-offset: 2px;
  animation: bl-glow 1s ease-in-out infinite;
}
@keyframes bl-glow {
  0%,
  100% {
    outline-color: #f36f21;
  }
  50% {
    outline-color: #ffd24a;
  }
}
.bl-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.35);
  font-size: 24px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* ── 오른쪽 : 도구 ── */
.bl-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.bl-colors button {
  aspect-ratio: 1;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  cursor: pointer;
}
.bl-colors button:hover {
  transform: scale(1.15);
}
.bl-roofs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.bl-roofs button,
.bl-acts button {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #faf7f0;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px;
  cursor: pointer;
}
.bl-roofs button:hover,
.bl-acts button:hover {
  background: #fff2d6;
}
#blSign {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
}
.bl-acts {
  display: grid;
  gap: 5px;
}
.bl-fine {
  font-size: 10.5px;
  color: #a09480;
  line-height: 1.6;
  padding: 0 2px;
}

@media (max-width: 860px) {
  .bl-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .bl-inv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 172px;
  }
  .bl-tools {
    max-height: 150px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bl-pop {
    animation: none;
  }
  body.bl-dragging [data-drop] {
    animation: none;
  }
}

/* 말풍선의 값 근거 딱지 — 「실거래 155건」과 「공시지가」는 믿을 무게가 다르다 */
.mg-src {
  display: inline-block;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
}
.mg-src.real { background: #2f9e44; color: #fff; }

/* 값 근거 딱지 — 「실거래 155건」과 「공시지가 어림」은 믿을 무게가 다르다 */
.rp-src {
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
  color: #6b5a3e;
}
.rp-src.real { background: #2f9e44; color: #fff; }
.rp-src-why { margin: 6px 0 0 !important; line-height: 1.6; }
