/* ====== 小橘的别墅 · 多房间场景样式 ====== */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  color: #fff;
  background: #2a2018;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.glass {
  background: rgba(20, 14, 8, 0.42);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* ====== 视差背景 ====== */
.villa-bg {
  position: fixed; inset: -8% -8%;
  background: url('villa-bg.png') center/cover no-repeat;
  will-change: transform, opacity;
  z-index: 0;
  transition: opacity 0.4s ease;
  opacity: 1;
}
.villa-bg.fading { opacity: 0; }
.villa-bg-overlay {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 50%, rgba(0,0,0,0.35) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.25) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ====== 顶部导航 ====== */
.villa-top {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 11px; border-radius: 10px;
  background: rgba(255,255,255,0.12);
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
  transition: background 0.15s, transform 0.12s;
  white-space: nowrap; flex: 0 0 auto;
}
.back-btn:hover { background: rgba(255,255,255,0.22); transform: translateX(-2px); }

.room-nav { display: flex; gap: 6px; }
.room-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.room-btn span { font-size: 16px; line-height: 1; }
.room-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.room-btn.active {
  background: linear-gradient(135deg, #ff7a3d, #ffb066);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(255,122,61,0.6);
}

@media (max-width: 720px) {
  .villa-top { top: 10px; gap: 8px; padding: 6px 8px; }
  .back-btn span { display: none; }
  .back-btn { padding: 7px 9px; }
  .room-btn { padding: 6px 9px; font-size: 12px; }
  .room-btn span { font-size: 15px; }
}

/* ====== 房间标签 ====== */
.room-label {
  position: fixed; left: 20px; bottom: 22px;
  z-index: 20;
  font-size: 15px; font-weight: 700;
  padding: 8px 14px; border-radius: 12px;
  background: rgba(20, 14, 8, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.14);
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* ====== 场景 ====== */
.scene {
  position: fixed; inset: 0;
  z-index: 5;
  cursor: crosshair;
}

/* ====== 小橘 ====== */
.cat {
  position: absolute;
  width: 96px; height: 96px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow:
    0 12px 28px rgba(0,0,0,0.45),
    0 0 0 6px rgba(255,255,255,0.08);
  object-fit: cover;
  z-index: 10;
  cursor: grab;
  transition: left 0.7s cubic-bezier(0.34, 1.2, 0.64, 1), top 0.7s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s ease;
  will-change: left, top, opacity;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.3));
}
.cat:active { cursor: grabbing; }
.cat::after {
  content: ''; position: absolute; left: 50%; bottom: -14px;
  transform: translateX(-50%);
  width: 70px; height: 14px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.45), transparent 70%);
  border-radius: 50%;
  z-index: -1;
  transition: width 0.3s, opacity 0.3s;
}
.cat:hover::after { width: 82px; opacity: 0.9; }
.cat.moving::after { width: 56px; opacity: 0.5; }
.cat.hidden { opacity: 0; }
.cat.eating {
  animation: eat-bounce 0.55s ease-in-out infinite;
}
@keyframes eat-bounce {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  20% { transform: translate(-50%, -50%) scale(1.06) rotate(-3deg); }
  40% { transform: translate(-50%, -50%) scale(0.97) rotate(2deg); }
  60% { transform: translate(-50%, -50%) scale(1.06) rotate(-3deg); }
  80% { transform: translate(-50%, -50%) scale(0.97) rotate(2deg); }
}
.cat.petted {
  animation: petted-wiggle 0.65s ease-in-out;
}
@keyframes petted-wiggle {
  0%   { transform: translate(-50%, -50%) scale(1); }
  25%  { transform: translate(-50%, -50%) scale(1.14) rotate(-5deg); }
  50%  { transform: translate(-50%, -50%) scale(1.18) rotate(4deg); }
  75%  { transform: translate(-50%, -50%) scale(1.14) rotate(-4deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
}
.cat.petted::after { width: 88px; opacity: 1; }

/* ====== 心理活动气泡 ====== */
.bubble {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -100%);
  z-index: 15;
  max-width: 240px;
  padding: 9px 14px;
  background: #fff;
  color: #4a2c14;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.25s ease, left 0.7s cubic-bezier(0.34, 1.2, 0.64, 1), top 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
  will-change: left, top, opacity;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -7px;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}
.bubble.show { opacity: 1; }
.bubble-text {
  display: inline-block;
  animation: bubble-pop 0.3s cubic-bezier(0.34, 1.5, 0.64, 1);
}
@keyframes bubble-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ====== 食物碗 ====== */
.bowl {
  position: absolute;
  left: 50%; top: 58%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 130px; height: 90px;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.bowl.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.bowl-shadow {
  position: absolute; left: 50%; bottom: -6px;
  transform: translateX(-50%);
  width: 110px; height: 14px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.5), transparent 70%);
  border-radius: 50%;
}
.bowl-body {
  position: absolute; left: 0; bottom: 0;
  width: 130px; height: 60px;
  background: linear-gradient(180deg, #ffb073 0%, #ff8a3d 50%, #d4661a 100%);
  border-radius: 0 0 65px 65px / 0 0 100% 100%;
  box-shadow:
    inset 0 -6px 0 rgba(0,0,0,0.18),
    inset 8px 0 14px rgba(255,255,255,0.3),
    0 8px 18px rgba(0,0,0,0.4);
}
.bowl-body::before {
  content: '🐾'; position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px; opacity: 0.55;
}
.bowl-rim {
  position: absolute; left: 50%; bottom: 50px;
  transform: translateX(-50%);
  width: 122px; height: 16px;
  background: linear-gradient(180deg, #ffc89a, #ff9a55);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.bowl-food {
  position: absolute; left: 50%; top: 42px;
  transform: translateX(-50%);
  width: 90px; height: 22px;
}
.bowl-food span {
  position: absolute;
  width: 14px; height: 12px;
  background: radial-gradient(ellipse at 30% 30%, #b86a2a, #5a2e0a);
  border-radius: 60% 50% 55% 50%;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.3);
}
.bowl-food span:nth-child(1) { left: 10px; top: 4px; transform: rotate(-15deg); }
.bowl-food span:nth-child(2) { left: 28px; top: 0; }
.bowl-food span:nth-child(3) { left: 44px; top: 3px; transform: rotate(12deg); }
.bowl-food span:nth-child(4) { left: 60px; top: 1px; transform: rotate(-8deg); }
.bowl-food span:nth-child(5) { left: 74px; top: 5px; transform: rotate(18deg); }
.bowl.eaten .bowl-food span { animation: food-eat 0.6s ease-in forwards; }
@keyframes food-eat {
  to { transform: scale(0.2) translateY(8px); opacity: 0; }
}

/* ====== 可交互物品 ====== */
.items { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.item {
  position: absolute;
  width: 64px; height: 74px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 2px;
  pointer-events: auto;
  cursor: grab;
  transition: transform 0.2s ease, filter 0.2s ease;
  will-change: left, top;
  touch-action: none;
}
.item .item-emoji {
  font-size: 44px; line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.4));
  transition: transform 0.2s ease;
}
.item .item-label {
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(20, 14, 8, 0.55);
  padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
.item:hover { transform: translateY(-4px) scale(1.08); }
.item:hover .item-emoji { transform: rotate(-8deg) scale(1.1); }
.item.dragging {
  cursor: grabbing;
  z-index: 30;
  transform: scale(1.25);
  filter: drop-shadow(0 14px 20px rgba(0,0,0,0.5));
  transition: none;
}
.item.taken { opacity: 0; pointer-events: none; }
.item.bounce-in { animation: item-in 0.4s cubic-bezier(0.34, 1.4, 0.64, 1); }
@keyframes item-in {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 小猫看书 / 玩耍反应 */
.cat.reading { animation: read-nod 1.5s ease-in-out infinite; }
@keyframes read-nod {
  0%, 100% { transform: translate(-50%, -50%) rotate(0); }
  30% { transform: translate(-50%, -50%) rotate(-4deg) translateY(2px); }
  70% { transform: translate(-50%, -50%) rotate(4deg) translateY(2px); }
}
.cat.playing { animation: play-frenzy 0.5s ease-in-out infinite; }
@keyframes play-frenzy {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  25% { transform: translate(-50%, -50%) scale(1.12) rotate(-6deg); }
  50% { transform: translate(-50%, -50%) scale(0.94) rotate(5deg); }
  75% { transform: translate(-50%, -50%) scale(1.08) rotate(-5deg); }
}

/* ====== 进食粒子 ====== */
.particles {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 12;
}
.particle {
  position: absolute;
  font-size: 20px;
  animation: float-up 1.6s ease-out forwards;
  opacity: 0;
}
@keyframes float-up {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.5); }
  20%  { opacity: 1; transform: translate(var(--dx, 0px), var(--dy, -20px)) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -110px)) scale(0.7); }
}

/* ====== 底部提示 ====== */
.hint-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 20;
  font-size: 12.5px; color: rgba(255,255,255,0.72);
  padding: 7px 14px; border-radius: 999px;
  background: rgba(20, 14, 8, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s;
}
@media (max-width: 720px) {
  .hint-bar { font-size: 11px; bottom: 12px; }
  .room-label { left: 12px; bottom: 12px; font-size: 13px; }
}
