/* ==========================================================================
   治愈系 2D 动画书桌 - 正对书桌与居中大窗第一人称沉浸布局 (desk.css)
   16:9 响应式等比视口，正对平视对称构图，桌面物品严丝合缝贴合木桌台面
   ========================================================================== */

:root {
  --wood-warm-1: #C48B58;
  --wood-warm-2: #8C582B;
  --wood-dark:   #4A280E;
  --cream-paper: #FFFDF0;
  --accent-gold: #F1C40F;
  --accent-green:#27AE60;
  --accent-red:  #E74C3C;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  outline: none !important;
}

.desk-item, .desk-item *, .tool-btn, .btn-primary, button, a, img {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-focus-ring-color: transparent !important;
  outline: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none;
}

.desk-item:focus, .desk-item:active, .desk-item *:focus, .desk-item *:active {
  outline: none !important;
  background: transparent !important;
  -webkit-tap-highlight-color: transparent !important;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'SimSun', sans-serif;
  background-color: #0A0806;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 主舞台大容器 */
#app-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: #0F0D0B;
}

/* 核心 16:9 等比自适应场景视口 (保证在任何分辨率下物件位置与背景桌子完美贴合) */
#scene-viewport {
  position: relative;
  width: 100vw;
  height: 56.25vw; /* 16:9 */
  max-height: 100vh;
  max-width: 177.78vh; /* 16:9 */
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

/* 1. 正对书桌写实房间全景底图 (居中大窗、左右对称壁龛、正面水平木桌) */
#room-panoramic-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 1;
  transition: opacity 0.8s ease, filter 1.0s ease;
}

/* 2. 天气与粒子交互 Canvas (覆盖在居中窗户与房间视口上) */
#weather-particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

/* 3. 阳光漫射与居中窗格光斑叠加层 */
#sunlight-ray-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 25%, rgba(255, 245, 200, 0.22) 0%, rgba(255, 230, 150, 0.06) 50%, transparent 80%);
  pointer-events: none;
  z-index: 4;
  mix-blend-mode: screen;
  transition: opacity 1s ease;
}

/* 4. 台灯开灯时的全屋照明与明亮温润氛围 (直接照亮整个房间与背景) */
#desk-lamp-lightbeam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 8;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 246, 205, 0.45) 0%, rgba(255, 225, 155, 0.32) 40%, rgba(255, 200, 110, 0.20) 70%, rgba(230, 160, 60, 0.12) 100%);
  backdrop-filter: brightness(1.20) saturate(1.15) sepia(0.06);
  -webkit-backdrop-filter: brightness(1.20) saturate(1.15) sepia(0.06);
}

/* 全景背景直接变亮与色彩饱满增强 */
#scene-viewport.lamp-lit-room #room-panoramic-bg {
  filter: brightness(1.18) saturate(1.12);
}

/* ==========================================================================
   顶部治愈工具栏
   ========================================================================== */
#top-toolbar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.tool-badge {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  font-weight: bold;
  color: #382414;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.tool-btn {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(210, 190, 170, 0.8);
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  color: #4A2E18;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn:hover {
  background: #FFFDF0;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.tool-btn.active {
  background: #27AE60;
  color: #FFFFFF;
  border-color: #1E8449;
}

/* 天气下拉切换面板 */
#weather-dropdown-menu {
  position: absolute;
  top: 55px;
  left: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(220, 200, 180, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 290px;
  z-index: 101;
}

.dropdown-section-title {
  font-size: 12px;
  font-weight: bold;
  color: #8C582B;
  border-bottom: 1px dashed rgba(140, 88, 43, 0.25);
  padding-bottom: 4px;
}

.weather-grid-opts, .time-grid-opts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.weather-select-opt, .time-select-opt {
  padding: 7px 8px;
  background: #F8F4EE;
  border: 1px solid #E5DCCE;
  border-radius: 8px;
  font-size: 12px;
  color: #3D2B1F;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.weather-select-opt:hover, .time-select-opt:hover {
  background: #FFEAA7;
  border-color: #F1C40F;
  transform: scale(1.04);
}

/* ==========================================================================
   正对书桌摆件交互舞台 (Desk Interactive Layer)
   桌面实际平面位于 bottom: 7% 至 bottom: 28% 之间，水平居中跨度 5%~95%
   ========================================================================== */
#desk-interactive-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.desk-item {
  position: absolute;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  filter: drop-shadow(3px 8px 10px rgba(40, 20, 5, 0.45));
}

.desk-item:hover {
  transform: translateY(-6px) scale(1.03);
  filter: drop-shadow(5px 14px 18px rgba(40, 20, 5, 0.6));
}

/* 1. 💡 银行家护眼台灯 (高窗台大书桌后排，底座在 bottom: 24.5%) */
#desk-item-lamp {
  left: 15.5%;
  bottom: 24.5%;
  width: 8.0%;
  aspect-ratio: 235/327;
  z-index: 14;
}

/* 2. 📚 竖立故事书架 (放大醒目，底座稳稳贴合实木桌面 bottom: 25.0%) */
#desk-item-books {
  left: 24.5%;
  bottom: 25.0%;
  width: 11.2%;
  aspect-ratio: 320/285;
  z-index: 15;
}

/* 3. 🖼️ 实木相框与相片 (大书桌后排，底座在 bottom: 25.5%) */
#desk-item-photoframe {
  left: 37.0%;
  bottom: 25.5%;
  width: 8.8%;
  aspect-ratio: 280/240;
  z-index: 16;
}

.frame-photo-container {
  position: absolute;
  top: 16%;
  left: 17%;
  width: 66%;
  height: 64%;
  overflow: hidden;
  border-radius: 2px;
}

#desk-frame-active-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease;
}

/* 4. ⏰ 复古双铃机械闹钟 (大书桌后排，底座在 bottom: 25.5%) */
#desk-item-clock {
  left: 47.0%;
  bottom: 25.5%;
  width: 6.0%;
  aspect-ratio: 185/240;
  z-index: 17;
}

/* 5. 🪴 桌面互动绿植 (大书桌后排，底座严格贴木桌 bottom: 25.5%) */
#desk-item-plant {
  left: 54.0%;
  bottom: 25.5%;
  width: 8.0%;
  aspect-ratio: 750/880;
  z-index: 16;
}

.plant-foliage-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

#desk-plant-foliage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  transition: transform 0.3s ease;
}

/* 6. 📅 实时桌面立式台历 (大书桌后排，底座在 bottom: 25.0%) */
#desk-item-calendar {
  left: 63.8%;
  bottom: 25.0%;
  width: 8.8%;
  aspect-ratio: 260/220;
  z-index: 15;
}

.calendar-live-overlay {
  position: absolute;
  top: 22%;
  left: 17%;
  width: 66%;
  height: 52%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  text-align: center;
  padding: 2px 0;
}

.cal-live-month {
  font-family: 'Ma Shan Zheng', 'KaiTi', serif;
  font-size: 0.95vw;
  font-weight: bold;
  color: #784218;
  line-height: 1.1;
  letter-spacing: 0.5px;
}

.cal-live-day-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-live-day {
  font-family: 'Georgia', serif;
  font-size: 2.3vw;
  font-weight: bold;
  color: #2C3E50;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.cal-today-stamp {
  position: absolute;
  right: -12px;
  top: -2px;
  font-size: 0.9vw;
  color: #E74C3C;
  filter: drop-shadow(0 1px 2px rgba(231, 76, 60, 0.4));
}

.cal-live-weekday {
  font-size: 0.72vw;
  color: #8C6D53;
  font-weight: 600;
  line-height: 1.1;
}

/* 7. ✏️ 笔筒与彩色铅笔 (大书桌后排，底座在 bottom: 25.5%) */
#desk-item-pencils {
  left: 74.5%;
  bottom: 25.5%;
  width: 4.8%;
  aspect-ratio: 519/905;
  z-index: 14;
}

/* 8. ☕ 治愈小熊咖啡杯与杯垫 (左移置于木桌前排，底座在 bottom: 15.0%) */
#desk-item-mug {
  left: 21.0%;
  bottom: 15.0%;
  width: 7.2%;
  aspect-ratio: 647/852;
  z-index: 20;
}

.steam-particle {
  display: none;
}

/* 9. 📝 桌面平铺摊开手账本与钢笔 (后移平铺于桌面正中受光区，底座在 bottom: 13.0%) */
#desk-item-journal {
  left: 40.5%;
  bottom: 13.0%;
  width: 11.8%;
  aspect-ratio: 1225/737;
  z-index: 19;
}

/* 10. 🐱 沉睡治愈书桌小猫咪 (后移落座于右侧阳光区，底座在 bottom: 13.5%) */
#desk-item-cat {
  left: 78.0%;
  bottom: 13.5%;
  width: 12.5%;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

#desk-cat-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: catBreathe 4.5s ease-in-out infinite;
}

#desk-cat-img.cat-action-fade {
  opacity: 0.15;
  transform: scale(0.96);
}

/* 🐱 桌面小猫即时呼唤气泡对话 */
.cat-speech-bubble {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  background: #FFFFFF;
  color: #382414;
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  border: 2px solid #F5CBA7;
  pointer-events: auto;
  cursor: pointer;
  z-index: 25;
  animation: catBubbleFloat 3.5s ease-in-out infinite;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-speech-bubble .bubble-arrow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #F5CBA7;
}

.cat-speech-bubble.bubble-urgent {
  background: #FFF5F5;
  border-color: #E74C3C;
  color: #C0392B;
  box-shadow: 0 4px 18px rgba(231, 76, 60, 0.35);
  animation: catBubbleAlert 2s ease-in-out infinite;
}

.cat-speech-bubble.bubble-urgent .bubble-arrow {
  border-top-color: #E74C3C;
}

@keyframes catBubbleFloat {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-5px);
  }
}

@keyframes catBubbleAlert {
  0%, 100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-6px) scale(1.04);
  }
}

/* 11. 🎐 窗边玻璃风铃 (横向全景宽窗右上窗檐绿植处) */
#desk-item-windchime {
  position: absolute;
  top: 6%;
  right: 20%;
  width: 3.8%;
  aspect-ratio: 155/375;
  z-index: 12;
  cursor: pointer;
  pointer-events: auto;
  transform-origin: top center;
  filter: drop-shadow(2px 6px 12px rgba(0, 0, 0, 0.35));
}

/* 悬停气泡提示 (Tooltip) */
.item-tooltip {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(45, 30, 15, 0.94);
  color: #FFFDF0;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.desk-item:hover .item-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
