/* ================================================================
   예쁜 소율이를 위한 치이카와 블록 블라스트 & 드림 하우스 스타일시트
   ================================================================ */

:root {
  --ink: #5a3b2c;
  --ink-soft: #856250;
  --cream: #fffcf7;
  --pink: #ff8fab;
  --yellow: #ffd43b;
  --blue: #74c0fc;
  --mint: #8ce99a;
  --shadow: 0 8px 22px rgba(90, 59, 44, 0.16);
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Jua', 'Gaegu', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  color: var(--ink);
  background: #fff5f8;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.text-center { text-align: center; }

/* 배경 레이어 */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image: url('../assets/images/bg_meadow.jpg');
  background-size: cover;
  background-position: center;
  transition: background-image 0.7s ease;
}

.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 250, 245, 0.42);
}

.fever-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 143, 171, 0.3), rgba(255, 212, 59, 0.3), rgba(116, 192, 252, 0.3), rgba(208, 191, 255, 0.3));
  background-size: 300% 300%;
  animation: rainbowMove 2.5s linear infinite;
}

@keyframes rainbowMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 드래그 플로팅 레이어 */
.drag-layer {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.06);
  filter: drop-shadow(0 12px 18px rgba(90, 59, 44, 0.32));
}

/* 젤리 버튼 공통 */
.jelly-btn {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.jelly-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--ink);
  filter: brightness(1.04);
}
.jelly-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}
.jelly-btn:disabled {
  opacity: 0.65;
  cursor: default;
  box-shadow: 0 2px 0 rgba(90, 59, 44, 0.45);
}

.btn-pink { background: linear-gradient(180deg, #ffd6e0, #ff9eb5); }
.btn-yellow { background: linear-gradient(180deg, #fff3b8, #ffd43b); }
.btn-blue { background: linear-gradient(180deg, #d0ebff, #74c0fc); }
.btn-mint { background: linear-gradient(180deg, #d3f9d8, #8ce99a); }
.btn-start {
  font-size: 1.25rem;
  padding: 12px 28px;
  background: linear-gradient(180deg, #fff3b8, #ffbe0b);
  animation: softPulse 2.2s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.pill {
  background: rgba(255, 252, 247, 0.95);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.98rem;
  box-shadow: 0 3px 0 rgba(90, 59, 44, 0.15);
  white-space: nowrap;
}
.pill-coin strong { color: #e8590c; }
.pill-star strong { color: #d97706; }
.pill-cozy strong { color: #e64980; }
.mini-pill { padding: 4px 12px; font-size: 0.92rem; }

/* ================= 1. 홈 / 100레벨 월드맵 ================= */
.home-screen {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 18px 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-pills, .topbar-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hero-card {
  background: rgba(255, 252, 247, 0.94);
  border: 4px solid var(--ink);
  border-radius: 28px;
  padding: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero-banner {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid #f0d7c3;
  aspect-ratio: 16 / 5.4;
  min-height: 210px;
}

.hero-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.15), rgba(255, 245, 248, 0.82));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 16px;
  text-align: center;
}

.hero-for {
  background: #ffdeeb;
  color: #c2255c;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 16px;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.hero-overlay h1 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3.2vw, 2.35rem);
  color: var(--ink);
  text-shadow: 3px 3px 0 #ffffff, -2px -2px 0 #ffffff, 2px -2px 0 #ffffff, -2px 2px 0 #ffffff;
}

.hero-quick-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 100레벨 월드맵 카드 */
.world-card {
  background: rgba(255, 252, 247, 0.94);
  border: 4px solid var(--ink);
  border-radius: 26px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.world-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.world-header h2 { margin: 0; font-size: 1.35rem; }
.world-tip { font-size: 0.9rem; color: #c2255c; }

.world-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.world-tab {
  font-family: inherit;
  background: #fff;
  border: 3px solid #e6d4c4;
  border-radius: 16px;
  padding: 9px 8px;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
  transition: transform 0.12s, border-color 0.15s;
}

.world-tab:hover { transform: translateY(-2px); border-color: var(--pink); }
.world-tab.active {
  border: 3.5px solid var(--ink);
  background: linear-gradient(180deg, #fff9db, #ffe066);
  box-shadow: 0 4px 0 var(--ink);
}
.world-tab .wt-icon { font-size: 1.45rem; display: block; }
.world-tab .wt-name { font-size: 0.92rem; display: block; }
.world-tab .wt-range { font-size: 0.74rem; color: var(--ink-soft); }

.world-desc-banner {
  background: #fff7eb;
  border: 2.5px dashed #f0b889;
  border-radius: 14px;
  padding: 9px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
}

.level-btn {
  position: relative;
  font-family: inherit;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 4px 8px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.level-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  background: #fff5f8;
}

.level-btn.cleared {
  background: linear-gradient(180deg, #fffdf0, #d3f9d8);
}

.level-btn.current {
  background: linear-gradient(180deg, #ffdeeb, #ff9eb5);
  animation: softPulse 1.6s infinite;
}

.level-btn.locked {
  background: #f1ece6;
  border-color: #c5b4a7;
  color: #a69588;
  box-shadow: 0 2px 0 #c5b4a7;
  cursor: not-allowed;
}

.level-btn .lv-num { font-size: 1.15rem; }
.level-btn .lv-stars { font-size: 0.72rem; letter-spacing: -1px; color: #f59f00; }
.level-btn .lv-gift {
  position: absolute;
  top: -7px;
  right: -5px;
  background: #ffd43b;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.74rem;
  padding: 0 4px;
}

/* ================= 2. 8x8 블록 블라스트 플레이 화면 (100vh 꽉 참!) ================= */
.play-screen, .housing-screen {
  width: 100%;
  max-width: 1640px;
  height: 100vh;
  margin: 0 auto;
  padding: 8px 18px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.play-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.play-title-pill {
  background: rgba(255, 252, 247, 0.95);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  box-shadow: 0 3px 0 rgba(90, 59, 44, 0.16);
  white-space: nowrap;
}

.rank-mini-badge {
  background: #fff3bf;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.8rem;
  color: #b45309;
}

.play-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-btn {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: rgba(255, 252, 247, 0.96);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap;
}
.mini-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-soft-pink { background: #ffdeeb; }
.btn-soft-blue { background: #d0ebff; }

.play-layout {
  display: grid;
  grid-template-columns: clamp(235px, 21vw, 310px) 1fr clamp(235px, 21vw, 310px);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.play-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.card-box {
  background: rgba(255, 252, 247, 0.94);
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.box-head {
  font-size: 0.98rem;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auto-badge {
  background: #ffdeeb;
  color: #c2255c;
  border: 1.5px solid #f783ac;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.72rem;
}

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

.cheer-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3.5px solid var(--ink);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}

.cheer-bubble {
  flex: 1;
  background: #fff9db;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.goals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-item {
  background: #fff7ee;
  border: 2.5px solid #ecd9c6;
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.goal-item.done {
  background: #ebfbee;
  border-color: #69db7c;
}

.goal-ico { font-size: 1.65rem; }
.goal-info { flex: 1; }
.goal-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.bar-track {
  height: 12px;
  background: #f0e4d8;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.goal-fill { background: linear-gradient(90deg, #ff8fab, #ffd43b); }
.star-fill { background: linear-gradient(90deg, #ffd43b, #ff922b); }
.fever-fill {
  background: linear-gradient(90deg, #ff8fab, #ffd43b, #69db7c, #74c0fc, #da77f2);
  background-size: 200% 100%;
  animation: rainbowMove 2s linear infinite;
}

.sub-hint {
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

/* 가운데 초대형 8x8 보드 + 하단 트레이 */
.play-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  height: 100%;
}

.board-wrap {
  position: relative;
  height: min(calc(100vh - 198px), 620px);
  aspect-ratio: 1 / 1;
  max-width: 100%;
  background: rgba(255, 252, 247, 0.96);
  border: 6px solid var(--ink);
  border-radius: 26px;
  padding: 8px;
  box-shadow: 0 12px 32px rgba(90, 59, 44, 0.24);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.board-wrap.fever-active {
  border-color: #ff6b9d;
  box-shadow: 0 0 32px rgba(255, 107, 157, 0.78), 0 12px 30px rgba(90, 59, 44, 0.22);
}

.board-wrap.booster-aim {
  border-color: #ff922b;
  cursor: crosshair;
  box-shadow: 0 0 28px rgba(255, 146, 43, 0.75);
}

#bb_boardCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 16px;
}

.play-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  background: rgba(255, 252, 247, 0.97);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 9px 14px;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

/* 하단 3개 블록 트레이 */
.tray-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(calc(100vh - 198px), 620px);
  max-width: 100%;
  height: 122px;
  flex-shrink: 0;
}

.tray-slot {
  background: rgba(255, 252, 247, 0.94);
  border: 4px solid var(--ink);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 0 rgba(90, 59, 44, 0.18);
  cursor: grab;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.tray-slot:hover {
  transform: translateY(-3px);
  background: #fff9f2;
}

.tray-slot.selected {
  border-color: #ff4d8d;
  background: #fff0f6;
  box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.3), 0 6px 0 rgba(90, 59, 44, 0.2);
}

.tray-slot canvas {
  width: 100%;
  height: 100%;
  max-width: 144px;
  max-height: 112px;
  touch-action: none;
}

/* 오른쪽 점수 & 도우미 박스 */
.score-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.score-main strong {
  font-size: 1.9rem;
  color: #e64980;
}

.star-progress-wrap {
  margin-bottom: 10px;
}

.star-icons {
  display: flex;
  justify-content: space-around;
  font-size: 1.3rem;
  margin-bottom: 4px;
  color: #ced4da;
}
.star-icons span.lit { color: #fab005; transform: scale(1.15); }

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

.mini-stat {
  background: #fff7ee;
  border: 2px solid #ecd9c6;
  border-radius: 12px;
  padding: 6px;
  text-align: center;
}
.mini-stat span { display: block; font-size: 0.78rem; color: var(--ink-soft); }
.mini-stat strong { font-size: 1.2rem; }

.classic-best-row {
  margin-top: 8px;
  text-align: center;
  background: #fff9db;
  border: 2px solid #ffd43b;
  border-radius: 10px;
  padding: 5px;
  font-size: 0.9rem;
}

.booster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.booster-btn {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.1s, background 0.15s;
}
.booster-btn:hover { background: #fff9db; transform: translateY(-2px); }
.booster-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.booster-btn.active { background: #ffe3ec; border-color: #e64980; }

.b-ico { font-size: 1.55rem; }
.b-txt { flex: 1; }
.b-txt strong { display: block; font-size: 0.94rem; }
.b-txt small { font-size: 0.76rem; color: var(--ink-soft); }
.b-cnt {
  background: #ffd43b;
  border: 2px solid var(--ink);
  border-radius: 999px;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}

.easy-guide p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* ================= 3. 예쁜 소율이의 치이카와 드림 하우스 ================= */
.housing-layout {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.housing-layout.photo-mode {
  grid-template-columns: 1fr;
}
.housing-layout.photo-mode .catalog-section {
  display: none;
}

.room-section {
  min-height: 0;
  display: flex;
}

.room-stage {
  position: relative;
  flex: 1;
  border: 6px solid var(--ink);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 14px 32px rgba(90, 59, 44, 0.25);
  display: flex;
  flex-direction: column;
  background: #fffcf7;
}

/* 벽지 영역 (상단 62%) */
.room-wall {
  position: relative;
  flex: 62;
  transition: background 0.4s ease;
}

.room-molding {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  background: #fffcf7;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}

/* 귀여운 방 창문 */
.room-window {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 120px;
  background: linear-gradient(180deg, #a5d8ff, #e7f5ff);
  border: 6px solid #fffcf7;
  outline: 4px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(90, 59, 44, 0.16);
  pointer-events: none;
}

.win-sky {
  font-size: 2rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.win-cross-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 6px;
  transform: translateX(-50%);
  background: #fffcf7;
  border-left: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}
.win-cross-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 6px;
  transform: translateY(-50%);
  background: #fffcf7;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

/* 6종 벽지 스타일 */
.wp-meadow {
  background: repeating-linear-gradient(90deg, #fff9ec 0 36px, #f6f0d8 36px 72px);
}
.wp-pink {
  background-color: #ffe3ec;
  background-image: radial-gradient(#ff9eb5 3px, transparent 3px), radial-gradient(#fff 4px, transparent 4px);
  background-size: 36px 36px;
  background-position: 0 0, 18px 18px;
}
.wp-sky {
  background: linear-gradient(180deg, #bce3ff, #e7f5ff);
}
.wp-ramen {
  background: repeating-linear-gradient(90deg, #fff3bf 0 42px, #ffe8cc 42px 84px);
}
.wp-night {
  background: radial-gradient(circle at 20% 30%, #fff3bf 2px, transparent 3px),
              radial-gradient(circle at 75% 25%, #fff3bf 2.5px, transparent 3.5px),
              radial-gradient(circle at 82% 65%, #ffdeeb 2px, transparent 3px),
              linear-gradient(180deg, #5f3dc4, #9775fa);
  background-size: 160px 160px, 190px 190px, 140px 140px, 100% 100%;
}
.wp-pudding {
  background: repeating-linear-gradient(45deg, #fff0f6 0 24px, #fff9db 24px 48px);
}

/* 바닥 영역 (하단 38%) */
.room-floor {
  flex: 38;
  transition: background 0.4s ease;
}

/* 5종 바닥 스타일 */
.fl-wood {
  background: repeating-linear-gradient(0deg, #e8c39e 0 26px, #dfb58c 26px 28px);
}
.fl-pink {
  background: radial-gradient(#ffc9d9 15%, transparent 16%), #ffdce6;
  background-size: 28px 28px;
}
.fl-picnic {
  background-color: #fff5f5;
  background-image: linear-gradient(90deg, rgba(255, 143, 171, 0.35) 50%, transparent 50%),
                    linear-gradient(rgba(255, 143, 171, 0.35) 50%, transparent 50%);
  background-size: 40px 40px;
}
.fl-cloud {
  background: radial-gradient(circle at 50% 0, #ffffff, #d0ebff 75%);
}
.fl-star {
  background-color: #ede9fe;
  background-image: radial-gradient(#ffd43b 2.5px, transparent 3px), radial-gradient(#ff9eb5 2px, transparent 2.5px);
  background-size: 44px 44px;
  background-position: 0 0, 22px 22px;
}

/* 배치된 가구/친구 레이어 */
.room-items-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.placed-item {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: filter 0.15s;
}
.placed-item:active { cursor: grabbing; }

.placed-item.selected {
  outline: 3.5px dashed #ff4d8d;
  outline-offset: 4px;
  border-radius: 18px;
  filter: drop-shadow(0 6px 14px rgba(255, 77, 141, 0.35));
}

.placed-item-inner svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 5px 6px rgba(90, 59, 44, 0.16));
}

/* 방에 초대된 치이카와 친구들 살아 움직이는 애니메이션! */
.placed-item.is-friend .placed-item-inner {
  animation: friendBreathe 2.6s ease-in-out infinite;
}
@keyframes friendBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.house-friend-sticker {
  position: relative;
  text-align: center;
}
.house-friend-sticker img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 4px solid var(--ink);
  object-fit: cover;
  background: #fff;
  box-shadow: 0 6px 12px rgba(90, 59, 44, 0.24);
  display: block;
}
.house-friend-sticker span {
  display: inline-block;
  margin-top: -10px;
  background: #ffd43b;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.78rem;
  position: relative;
}

/* 친구 클릭 말풍선 & 하트 */
.friend-pop-bubble {
  position: absolute;
  bottom: 104%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff9db;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16);
  z-index: 90;
  animation: popBubble 0.25s ease;
}

.friend-pop-heart {
  position: absolute;
  top: -10px;
  right: -6px;
  font-size: 1.5rem;
  animation: heartFloat 1.4s ease forwards;
  pointer-events: none;
}

@keyframes popBubble {
  from { transform: translate(-50%, 8px) scale(0.8); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}
@keyframes heartFloat {
  0% { transform: translateY(0) scale(0.7); opacity: 1; }
  100% { transform: translateY(-42px) scale(1.3); opacity: 0; }
}

.room-guide-chip {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(255, 252, 247, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  pointer-events: none;
}

.room-edit-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 252, 247, 0.97);
  border: 3.5px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  z-index: 120;
  white-space: nowrap;
}

.edit-name {
  font-size: 0.9rem;
  color: #c2255c;
  margin-right: 4px;
}

.edit-btn {
  font-family: inherit;
  font-size: 0.82rem;
  background: #fff3bf;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink);
}
.edit-btn:hover { background: #ffd43b; }
.edit-btn.btn-del { background: #ffe3e3; color: #c92a2a; }

/* 오른쪽 꾸미기 상점 & 보관함 */
.catalog-section {
  background: rgba(255, 252, 247, 0.95);
  border: 4px solid var(--ink);
  border-radius: 24px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.house-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.house-tab {
  font-family: inherit;
  font-size: 0.84rem;
  padding: 7px 4px;
  background: #fff;
  border: 2.5px solid #e6d4c4;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink);
}
.house-tab.active {
  background: #ffdeeb;
  border-color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 2px 4px 8px;
  flex: 1;
}

.catalog-card {
  background: #fff;
  border: 3px solid #e8d8c8;
  border-radius: 18px;
  padding: 10px 8px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.catalog-card.owned { border-color: #ff9eb5; background: #fffdf9; }
.catalog-card.equipped { border-color: #40c057; background: #ebfbee; }

.cat-thumb {
  width: 78px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-thumb svg { max-width: 76px; max-height: 66px; }
.cat-thumb .house-friend-sticker { width: 58px; }
.cat-thumb .house-friend-sticker span { display: none; }

.swatch-preview {
  width: 68px;
  height: 54px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.cat-name { font-size: 0.86rem; line-height: 1.2; }
.cat-cozy { font-size: 0.74rem; color: #e64980; }
.cat-btn {
  width: 100%;
  font-size: 0.8rem;
  padding: 6px 6px;
  box-shadow: 0 3px 0 var(--ink);
  margin-top: auto;
}

/* ================= 모달 공통 ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(74, 46, 31, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--cream);
  border: 5px solid var(--ink);
  border-radius: 28px;
  padding: 22px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.win-ribbon {
  display: inline-block;
  background: #ffd43b;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.win-stars {
  font-size: 2.6rem;
  letter-spacing: 6px;
  margin: 4px 0 12px;
}

.win-reward-box {
  background: #fff7ee;
  border: 3px solid #ecd9c6;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 1.05rem;
}

.win-bonus-note {
  font-size: 0.84rem;
  color: #e64980;
}

.win-gift-box {
  background: linear-gradient(180deg, #fff0f6, #fff9db);
  border: 3.5px dashed #ff6b9d;
  border-radius: 20px;
  padding: 12px;
  margin-bottom: 14px;
}

.gift-badge {
  display: inline-block;
  background: #ff6b9d;
  color: #fff;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.gift-visual {
  width: 96px;
  margin: 0 auto 6px;
}
.gift-visual svg { width: 100%; height: auto; }

.win-gift-box p { margin: 4px 0 0; font-size: 0.84rem; color: var(--ink-soft); }

.modal-desc { color: var(--ink-soft); margin: 6px 0 16px; }
.modal-btns { display: flex; flex-direction: column; gap: 9px; }

/* 반응형 */
@media (max-width: 960px) {
  .world-tabs { grid-template-columns: repeat(3, 1fr); }
  .level-grid { grid-template-columns: repeat(5, 1fr); }
  .play-screen, .housing-screen { height: auto; min-height: 100vh; overflow: visible; }
  .play-layout, .housing-layout { grid-template-columns: 1fr; }
  .board-wrap { height: auto; width: min(92vw, 480px); }
  .tray-bar { width: min(92vw, 480px); }
  .room-stage { min-height: 400px; }
}
