* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

/* 游乐园功能暂未完善, 先隐藏 */
#btnPark, #menuPark, #parkModal { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

/* 折叠态: 整个窗口透明，只显示宠物; 展开态: 圆角玻璃面板 */
body {
  -webkit-app-region: drag;
}

button, input, .action-btn, .ctrl-btn, .menu-item, .modal-btn, .toggle-btn {
  -webkit-app-region: no-drag;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transition: background 0.3s;
  display: flex;
  flex-direction: column;
}

/* 折叠态: 完全透明背景 (无 backdrop-filter, 避免模糊) */
.app.collapsed {
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* 展开态: 不透明背景 (透明窗口下避免渲染模糊) */
.app.expanded {
  background: linear-gradient(160deg, #ffffff 0%, #f5f0fa 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(200, 180, 220, 0.4);
  border-radius: 20px;
}

/* ============= 宠物舞台 ============= */
.pet-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center bottom, rgba(168, 230, 207, 0.25), transparent 70%);
  transition: height 0.3s ease, background 0.5s ease;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.app.expanded .pet-stage {
  flex: 0 0 320px;
  background: radial-gradient(ellipse at center bottom, rgba(168, 230, 207, 0.35), transparent 70%);
}

/* 自由模式: 显示渐变背景 */
.pet-stage.free-mode {
  background: linear-gradient(180deg, #87CEEB 0%, #98D8E8 40%, #B0E0E6 100%);
}

.pet-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition: transform 0.3s ease;
  perspective: 600px;
  perspective-origin: 50% 50%;
  -webkit-app-region: no-drag;
}

.app.expanded .pet-container {
  width: 100%;
  height: 100%;
}

.pet-container:active {
  cursor: pointer;
}

/* 3D 包装层 (SVG 降级用) */
.pet-3d-scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-3d-scene svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.18));
}

.app.expanded .pet-3d-scene {
  width: 100%;
  height: 100%;
}

/* 3D 模式下 canvas 占满容器, 不用 CSS float 动画 */
.pet-container canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  animation: none !important;
}

.pet-container.bouncing {
  animation: petBounce 0.5s ease !important;
}

@keyframes petBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  30% { transform: scale(1.1, 0.9) translateY(5px); }
  60% { transform: scale(0.95, 1.05) translateY(-8px); }
}

.pet-container.shaking {
  animation: petShake 0.4s ease !important;
}

@keyframes petShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.pet-container.eating {
  animation: petEat 0.3s ease infinite !important;
}

@keyframes petEat {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.05, 0.95); }
}

.pet-container.sleeping {
  animation: petSleep 4s ease-in-out infinite !important;
}

@keyframes petSleep {
  0%, 100% { transform: scale(1) translateY(0) rotate(0); }
  50% { transform: scale(0.98) translateY(2px) rotate(-2deg); }
}

.pet-container.hatching {
  animation: hatchShake 0.3s ease infinite !important;
}

@keyframes hatchShake {
  0%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-5deg) translateY(-2px); }
  75% { transform: rotate(5deg) translateY(-2px); }
}

/* ============= 动作动画 ============= */
.pet-container.action-love {
  animation: actionLove 0.6s ease-in-out infinite !important;
}
@keyframes actionLove {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.06, 0.94) translateY(-3px); }
}

.pet-container.action-star {
  animation: actionStar 0.8s ease-in-out infinite !important;
}
@keyframes actionStar {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.05) rotate(-3deg); }
}

.pet-container.action-cry {
  animation: actionCry 0.8s ease-in-out infinite !important;
}
@keyframes actionCry {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(0.98) translateY(2px); }
}

.pet-container.action-surprise {
  animation: actionSurprise 0.4s ease-out 3 !important;
}
@keyframes actionSurprise {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1.05); }
}

.pet-container.action-laugh {
  animation: actionLaugh 0.4s ease-in-out infinite !important;
}
@keyframes actionLaugh {
  0%, 100% { transform: scale(1) translateY(0) rotate(0); }
  25% { transform: scale(1.08, 0.92) translateY(2px) rotate(-3deg); }
  75% { transform: scale(0.95, 1.05) translateY(-3px) rotate(3deg); }
}

.pet-container.action-tongue {
  animation: actionTongue 0.6s ease-in-out infinite !important;
}
@keyframes actionTongue {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(0.97) translateY(1px); }
}

.pet-container.action-wink {
  animation: actionWink 0.4s ease !important;
}
@keyframes actionWink {
  0% { transform: scale(1); }
  50% { transform: scale(1.05, 0.95) translateY(2px); }
  100% { transform: scale(1); }
}

.pet-container.action-cool {
  animation: actionCool 1.2s ease-in-out infinite !important;
}
@keyframes actionCool {
  0%, 100% { transform: scale(1) translateY(0) rotate(0); }
  50% { transform: scale(1.02) translateY(-4px) rotate(-2deg); }
}

.pet-container.action-angry {
  animation: actionAngry 0.3s ease-in-out infinite !important;
}
@keyframes actionAngry {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-2deg); }
  75% { transform: translateX(3px) rotate(2deg); }
}

.pet-container.action-dance {
  animation: actionDance 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
}
/* 1.5s 编排: 准备 → 踏步 → 起跳 → 360°转体 → 空中翻转 → 滑步 → 落定 */
@keyframes actionDance {
  0%   { transform: translateY(0) rotate(0) scale(1, 1); }
  8%   { transform: translateY(3px) scale(0.92, 1.08) rotate(-2deg); }   /* 蓄力下沉 */
  16%  { transform: translateY(2px) rotate(8deg) scale(1.06, 0.94); }   /* 起步左旋 */
  24%  { transform: translateY(2px) rotate(-8deg) scale(0.94, 1.06); }  /* 起步右旋 */
  32%  { transform: translateY(2px) rotate(6deg) scale(1.04, 0.96); }   /* 踏步 */
  40%  { transform: translateY(-30px) rotate(0) scale(1, 1); }          /* 起跳! */
  50%  { transform: translateY(-40px) rotate(180deg) scale(1.1, 0.9); }  /* 空中转体 180° */
  60%  { transform: translateY(-30px) rotate(360deg) scale(0.9, 1.1); }  /* 360° 翻转 */
  70%  { transform: translateY(0) rotate(360deg) scale(1.1, 0.9); }       /* 落地挤压 */
  78%  { transform: translateY(0) rotate(360deg) scale(1, 1); }           /* 落定 */
  86%  { transform: translateY(0) rotate(370deg) scale(1.08, 0.92); }    /* 滑步右倾 */
  92%  { transform: translateY(0) rotate(355deg) scale(0.92, 1.08); }    /* 滑步左倾 */
  100% { transform: translateY(0) rotate(360deg) scale(1, 1); }           /* 归位 */
}

/* 跳舞时的尾巴/装饰 */
.pet-container.action-dance .pet-body {
  animation: danceBodyStretch 0.75s ease-in-out infinite !important;
}
@keyframes danceBodyStretch {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50%      { transform: scaleY(0.92) scaleX(1.08); }
}

.pet-container.action-thinking {
  animation: actionThinking 1.5s ease-in-out infinite !important;
}
@keyframes actionThinking {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-2px) rotate(-3deg); }
}

/* 装饰元素动画 */
.love-floats { pointer-events: none; }
.love-float-1, .love-float-2, .love-float-3 {
  animation: loveFloat 1.5s ease-in-out infinite;
}
.love-float-1 { animation-delay: 0s; }
.love-float-2 { animation-delay: 0.3s; }
.love-float-3 { animation-delay: 0.6s; }

@keyframes loveFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { transform: translateY(-8px) scale(1.2); opacity: 1; }
}

/* ============= 跳舞装饰 ============= */
.dance-crown {
  animation: danceCrown 0.6s ease-in-out infinite;
  transform-origin: 100px 25px;
  transform-box: fill-box;
}
.dance-heart-1 { animation: danceHeartLeft 0.7s ease-in-out infinite; }
.dance-heart-2 { animation: danceHeartRight 0.7s ease-in-out infinite 0.2s; }
.dance-star {
  animation: danceStarTwinkle 0.5s ease-in-out infinite;
}

@keyframes danceCrown {
  0%, 100% { transform: translateY(0) rotate(-10deg) scale(1); }
  50% { transform: translateY(-4px) rotate(10deg) scale(1.15); }
}
@keyframes danceHeartLeft {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.9; }
  50% { transform: translate(-5px, -6px) scale(1.3); opacity: 1; }
}
@keyframes danceHeartRight {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.9; }
  50% { transform: translate(5px, -6px) scale(1.3); opacity: 1; }
}
@keyframes danceStarTwinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* ============= 思考装饰 ============= */
.thinking-spin {
  animation: thinkingSpin 1.5s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes thinkingSpin {
  0%, 100% { transform: rotate(0) scale(1); }
  50% { transform: rotate(15deg) scale(1.1); }
}

.star-spin { animation: starSpin 3s linear infinite; transform-origin: center; }
.star-spin > text:nth-child(2) { animation: starSpin 3s linear infinite reverse; }

@keyframes starSpin {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

.tear-drop {
  animation: tearDrop 1.2s ease-in infinite;
}
.tear-1 { animation-delay: 0s; }
.tear-2 { animation-delay: 0.5s; }

@keyframes tearDrop {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(20px); opacity: 0; }
}

.surprise-pop, .angry-pop {
  animation: decoBounce 0.5s ease-in-out infinite;
}
@keyframes decoBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.2) translateY(-3px); }
}

.tongue-wag {
  animation: tongueWag 0.5s ease-in-out infinite;
  transform-origin: center;
}
@keyframes tongueWag {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(1.3); }
}

.cool-shine {
  animation: coolShine 2s ease-in-out infinite;
}
@keyframes coolShine {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6)); }
}

.sparkle {
  animation: sparkle 1s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

.heart-eyes {
  animation: heartBeat 0.8s ease-in-out infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.15); }
  60% { transform: scale(0.95); }
}

.floating-deco {
  animation: floatingDeco 1.5s ease-in-out infinite;
}
@keyframes floatingDeco {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { transform: translateY(-5px) scale(1.1); opacity: 1; }
}

/* 眨眼动画 (通过 CSS 覆盖整个 g.blinkable) */
.pet-container .blinkable {
  animation: blink 0.15s ease;
  transform-origin: center;
}
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.1); }
}

/* 腮红脉冲 */
.cheek {
  animation: cheekPulse 2.5s ease-in-out infinite;
}
@keyframes cheekPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.7; }
}

/* 头冠闪光 */
.head-glow {
  animation: headGlow 2s ease-in-out infinite;
}
@keyframes headGlow {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ============= 等级徽章 ============= */
.level-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
  padding: 3px 9px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 8px rgba(255, 165, 0, 0.5);
  -webkit-app-region: drag;
  cursor: move;
}

/* 拍照按钮 (等级模块右侧, 仅自由模式可见) */
.photo-btn {
  position: absolute;
  top: 8px;
  left: 60px;
  z-index: 10;
  width: 28px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff, #f0f0ff);
  color: #6E50C9;
  border: 1.5px solid rgba(110, 80, 201, 0.25);
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(110, 80, 201, 0.25);
  -webkit-app-region: no-drag;
  transition: transform 0.15s, box-shadow 0.15s;
}
.photo-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(110, 80, 201, 0.4);
}
.photo-btn:active {
  transform: scale(0.92);
  background: linear-gradient(135deg, #f5e6ff, #e6e0ff);
}
.photo-btn.show {
  display: flex;
}

/* 视频录像按钮 (拍照按钮右侧, 仅自由模式可见) */
.video-btn {
  position: absolute;
  top: 8px;
  left: 92px;
  z-index: 10;
  width: 28px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff, #f0f0ff);
  color: #E63E73;
  border: 1.5px solid rgba(230, 62, 115, 0.25);
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(230, 62, 115, 0.25);
  -webkit-app-region: no-drag;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.video-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(230, 62, 115, 0.4);
}
.video-btn:active {
  transform: scale(0.92);
}
.video-btn.show {
  display: flex;
}
.video-btn.recording {
  background: linear-gradient(135deg, #E63E73, #b22a55);
  color: white;
  border-color: #b22a55;
  animation: videoPulse 1.4s ease-in-out infinite;
}
@keyframes videoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 62, 115, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(230, 62, 115, 0); }
}

/* 录制中指示器 */
.recording-indicator {
  position: absolute;
  top: 8px;
  left: 124px;
  z-index: 10;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(20, 10, 15, 0.7);
  color: #fff;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  -webkit-app-region: no-drag;
  pointer-events: none;
}
.recording-indicator.show {
  display: flex;
}
.rec-dot {
  width: 7px;
  height: 7px;
  background: #ff3b5c;
  border-radius: 50%;
  animation: recBlink 1s infinite;
}
@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 视频详情中的 video 元素 */
.photo-detail-wrap video {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  background: #000;
}

/* 视频网格项 (复用 .album-item, 加 .video-item 标识) */
.album-item.video-item::after {
  content: '🎬';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  background: rgba(0,0,0,0.5);
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============= 3D 场景切换器 ============= */
.scene-selector {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 3px 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 6;
  -webkit-app-region: no-drag;
}

.scene-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.55;
  -webkit-app-region: no-drag;
}

.scene-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  opacity: 0.9;
  transform: scale(1.1);
}

.scene-btn.active {
  background: linear-gradient(135deg, #fff, #f0e6ff);
  opacity: 1;
  box-shadow: 0 2px 6px rgba(155, 127, 224, 0.4);
}

.lv-icon {
  font-size: 9px;
  opacity: 0.9;
}

/* ============= 展开按钮 ============= */
.toggle-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a4a6a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  z-index: 5;
}

.toggle-btn:hover {
  background: white;
  transform: scale(1.1);
}

.app.expanded .toggle-btn svg {
  transform: rotate(180deg);
}

.toggle-btn svg {
  transition: transform 0.3s;
}

/* ============= 状态气泡 ============= */
.speech-bubble {
  position: absolute;
  top: 12px;
  right: 45px;
  background: white;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: #5a4a6a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.3s;
  max-width: 120px;
  pointer-events: none;
}

.speech-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.speech-bubble::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 5px solid white;
}

/* ============= 粒子层 ============= */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  font-size: 18px;
  animation: particleFloat 1.5s ease-out forwards;
}

@keyframes particleFloat {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(360deg); }
}

/* ============= 控制面板 ============= */
.panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 14px 12px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  pointer-events: none;
}

.app.expanded .panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* 面板头部 */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pet-name {
  font-size: 13px;
  font-weight: 700;
  color: #5a4a6a;
  letter-spacing: 0.5px;
}

.header-controls {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a4a6a;
  transition: all 0.2s;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: scale(1.1);
}

.ctrl-btn.ctrl-close:hover {
  background: #FF5F57;
  color: white;
}

/* ============= 成长进度 ============= */
.growth-section {
  margin-bottom: 6px;
}

.growth-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.stage-name {
  font-size: 11px;
  font-weight: 600;
  color: #5a4a6a;
}

.growth-percent {
  font-size: 10px;
  color: #9b7fe0;
  font-weight: 700;
}

.xp-bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #C8B6FF, #9B7FE0);
  border-radius: 6px;
  transition: width 0.5s ease;
  position: relative;
  width: 0%;
}

.xp-glow {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: glowSlide 2s linear infinite;
}

@keyframes glowSlide {
  0% { transform: translateX(-30px); }
  100% { transform: translateX(280px); }
}

.growth-info {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 9px;
  color: #8a7a9a;
}

/* ============= 状态条 ============= */
.stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a4a6a;
}

.stat-bar-wrap {
  flex: 1;
  height: 7px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.stat-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease, background 0.3s;
  width: 80%;
}

.stat-bar.hunger { background: linear-gradient(90deg, #FFB87A, #FF8C42); }
.stat-bar.mood { background: linear-gradient(90deg, #FFB8E0, #FF7FB8); }
.stat-bar.clean { background: linear-gradient(90deg, #87CEEB, #4FB8E0); }
.stat-bar.energy { background: linear-gradient(90deg, #FFE066, #FFD700); }
.stat-bar.low { background: linear-gradient(90deg, #FF8A8A, #FF5F57) !important; }

.stat-val {
  width: 22px;
  text-align: right;
  font-size: 10px;
  color: #5a4a6a;
  font-weight: 600;
}

/* ============= 操作按钮 ============= */
.actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 2px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.action-btn:active {
  transform: translateY(0);
}

.action-emoji {
  font-size: 16px;
}

.action-label {
  font-size: 9px;
  color: #5a4a6a;
  font-weight: 500;
}

/* ============= 金币 ============= */
.coins-display {
  position: absolute;
  bottom: 6px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 215, 0, 0.25);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #8B6914;
  font-weight: 700;
}

.coin-icon {
  font-size: 12px;
}

/* ============= 对话栏 ============= */
.chat-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 0 2px;
}

.send-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
}

.send-btn:hover {
  transform: scale(1.1) rotate(-10deg);
  box-shadow: 0 4px 12px rgba(155, 127, 224, 0.5);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#chatInput {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(155, 127, 224, 0.3);
  border-radius: 15px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: #5a4a6a;
  outline: none;
  transition: border 0.2s;
}

#chatInput:focus {
  border-color: #9B7FE0;
  background: white;
}

#chatInput::placeholder {
  color: #aaa;
  font-size: 11px;
}

/* ============= 聊天历史 ============= */
.chat-history {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  top: 40px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(200, 180, 220, 0.3);
  display: none;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

.chat-history.show {
  display: flex;
  animation: chatSlideUp 0.25s ease;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-history-header {
  padding: 8px 12px;
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(155, 127, 224, 0.3);
  border-radius: 4px;
}

.chat-msg {
  max-width: 80%;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: msgFade 0.2s ease;
}

@keyframes msgFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-msg.pet {
  align-self: flex-start;
  background: #f5f0fa;
  color: #5a4a6a;
  border-bottom-left-radius: 4px;
}

.chat-msg.system {
  align-self: center;
  background: transparent;
  color: #aaa;
  font-size: 10px;
  font-style: italic;
}

.chat-msg.thinking {
  align-self: flex-start;
  background: #f5f0fa;
  color: #9b7fe0;
  font-style: italic;
}

.chat-msg.thinking::after {
  content: '...';
  animation: dots 1.2s infinite;
}

@keyframes dots {
  0%, 33% { content: '.'; }
  34%, 66% { content: '..'; }
  67%, 100% { content: '...'; }
}


/* ============= 菜单 ============= */
.menu {
  position: absolute;
  top: 36px;
  right: 10px;
  background: #ffffff;
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(200, 180, 220, 0.3);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
  min-width: 120px;
}

.menu.show {
  display: flex;
  animation: menuSlide 0.2s ease;
}

@keyframes menuSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-item {
  padding: 7px 12px;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #5a4a6a;
  transition: background 0.15s;
}

.menu-item:hover {
  background: rgba(155, 127, 224, 0.15);
}

/* ============= 弹窗 ============= */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.show {
  display: flex;
  animation: modalFade 0.2s ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============= 跳舞舞台效果 ============= */
/* 旋转光环 - 脚下 */
.dance-stage {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 130px;
  height: 20px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
}
.app.dancing .dance-stage {
  opacity: 1;
}
.dance-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 220, 100, 0.7) 0%, rgba(255, 150, 200, 0.4) 50%, transparent 80%);
  animation: danceRingPulse 0.75s ease-in-out infinite;
}
.dance-stage::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  animation: danceRingSpin 1.5s linear infinite;
}
@keyframes danceRingPulse {
  0%, 100% { transform: scaleX(0.9) scaleY(1); opacity: 0.7; }
  50%      { transform: scaleX(1.1) scaleY(0.7); opacity: 1; }
}
@keyframes danceRingSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* 彩带粒子 */
.dance-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}
.app.dancing .dance-confetti { opacity: 1; }
.dance-confetti i {
  position: absolute;
  top: 0;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 1.5s linear infinite;
}
.dance-confetti i:nth-child(1)  { left: 10%;  background: #FF6B9D; animation-delay: 0s;    }
.dance-confetti i:nth-child(2)  { left: 25%;  background: #FFC857; animation-delay: 0.2s;  }
.dance-confetti i:nth-child(3)  { left: 40%;  background: #6BCF7F; animation-delay: 0.4s;  }
.dance-confetti i:nth-child(4)  { left: 55%;  background: #4D9DE0; animation-delay: 0.6s;  }
.dance-confetti i:nth-child(5)  { left: 70%;  background: #E15554; animation-delay: 0.8s;  }
.dance-confetti i:nth-child(6)  { left: 85%;  background: #9B7FE0; animation-delay: 1.0s;  }
.dance-confetti i:nth-child(7)  { left: 50%;  background: #FFC857; animation-delay: 1.2s;  }
.dance-confetti i:nth-child(8)  { left: 18%;  background: #FF6B9D; animation-delay: 1.4s;  }
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0);    opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(140px) rotate(720deg); opacity: 0; }
}

/* 背景渐变切换 */
.app.dancing .panel {
  background: linear-gradient(135deg,
    rgba(255, 192, 203, 0.15) 0%,
    rgba(186, 225, 255, 0.15) 33%,
    rgba(255, 240, 180, 0.15) 66%,
    rgba(255, 192, 203, 0.15) 100%);
  background-size: 300% 300%;
  animation: danceBgShift 1.5s ease infinite;
}
@keyframes danceBgShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* 阴影跳动 (起跳时阴影变小) - 与主体 keyframes 复合 */
.pet-container.action-dance {
  animation: actionDance 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite,
             danceShadow 1.5s ease-in-out infinite !important;
}
@keyframes danceShadow {
  0%, 30%   { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2)); }
  40%, 60%  { filter: drop-shadow(0 16px 12px rgba(0,0,0,0.1)); }   /* 跳到最高处阴影变大但变浅 */
  100%      { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2)); }
}

.modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  width: 240px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(200, 180, 220, 0.3);
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #5a4a6a;
  margin-bottom: 10px;
  text-align: center;
}

/* 弹窗右上角关闭按钮 */
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(200, 180, 220, 0.25);
  border-radius: 50%;
  color: #7a6a8a;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-app-region: no-drag;
}
.modal-close:hover {
  background: rgba(200, 180, 220, 0.55);
  color: #5a4a6a;
  transform: scale(1.1) rotate(90deg);
}

.modal-text {
  font-size: 11px;
  color: #7a6a8a;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 12px;
}

#renameInput {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(155, 127, 224, 0.3);
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: #5a4a6a;
  outline: none;
  transition: border 0.2s;
}

#renameInput:focus {
  border-color: #9B7FE0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.modal-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.modal-btn.cancel {
  background: rgba(0, 0, 0, 0.08);
  color: #5a4a6a;
}

.modal-btn.cancel:hover {
  background: rgba(0, 0, 0, 0.15);
}

.modal-btn.confirm {
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
  color: white;
  box-shadow: 0 2px 8px rgba(155, 127, 224, 0.4);
}

.modal-btn.confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 127, 224, 0.5);
}

/* ============= 录制方向选择 ============= */
.aspect-options {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  justify-content: center;
  -webkit-app-region: no-drag;
}
.aspect-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 6px;
  border: 1.5px solid rgba(155, 127, 224, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  color: #9B7FE0;
  transition: all 0.2s;
  -webkit-app-region: no-drag;
}
.aspect-option:hover {
  border-color: #9B7FE0;
  background: #f5f0ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(155, 127, 224, 0.25);
}
.aspect-option:active {
  transform: scale(0.95);
}
.aspect-box svg {
  display: block;
}
.aspect-label {
  font-size: 12px;
  font-weight: 600;
  color: #5a4a6a;
}

/* ============= 形态切换列表 ============= */
.species-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 260px;
  overflow-y: auto;
  -webkit-app-region: no-drag;
}

.species-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(155, 127, 224, 0.25);
  background: rgba(245, 240, 250, 0.6);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-app-region: no-drag;
}

.species-item:hover {
  background: rgba(232, 220, 245, 0.9);
  transform: translateY(-1px);
  border-color: rgba(155, 127, 224, 0.55);
}

.species-item.active {
  background: linear-gradient(135deg, rgba(200, 182, 255, 0.4), rgba(155, 127, 224, 0.25));
  border-color: #9B7FE0;
}

.species-name {
  font-size: 13px;
  font-weight: 700;
  color: #5a4a6a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.species-tag {
  font-size: 9px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
  padding: 1px 6px;
  border-radius: 6px;
}

.species-desc {
  font-size: 10px;
  color: #8a7a9a;
  margin-top: 3px;
  line-height: 1.4;
}

/* ============= AI 设计宠物弹窗 ============= */
.modal-wide {
  max-width: 320px;
  width: 92%;
}

/* ============= 相册 ============= */
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px;
  margin-bottom: 10px;
}

.album-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid rgba(200, 180, 220, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  background: #f5f0fa;
}
.album-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
  border-color: rgba(168, 85, 247, 0.5);
}
.album-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-item-time {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: #fff;
  font-size: 8px;
  text-align: center;
  padding: 8px 2px 3px;
  line-height: 1.2;
}

.album-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #9a8aaa;
  font-size: 12px;
  padding: 40px 10px;
  line-height: 1.6;
}

/* 照片详情 */
.photo-detail-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 340px;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #f5f0fa;
}
.photo-detail-wrap img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  display: block;
}

/* 拍照闪光特效 */
.photo-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 99999;
  pointer-events: none;
  animation: photoFlash 0.5s ease-out forwards;
}
@keyframes photoFlash {
  0%   { opacity: 0; }
  15%  { opacity: 0.85; }
  100% { opacity: 0; }
}

.ai-section {
  margin-bottom: 12px;
}

.ai-label {
  font-size: 11px;
  font-weight: 600;
  color: #5a4a6a;
  margin-bottom: 5px;
}

.ai-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid rgba(155, 127, 224, 0.35);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  -webkit-app-region: no-drag;
  transition: border-color 0.2s;
}

.ai-textarea:focus {
  outline: none;
  border-color: #9B7FE0;
  box-shadow: 0 0 0 2px rgba(155, 127, 224, 0.15);
}

.ai-textarea::placeholder {
  color: #b0a0c0;
}

.userpet-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid rgba(155, 127, 224, 0.2);
  border-radius: 8px;
  background: rgba(245, 240, 250, 0.5);
  -webkit-app-region: no-drag;
}

.userpet-empty {
  padding: 16px 10px;
  text-align: center;
  color: #8a7a9a;
  font-size: 11px;
  line-height: 1.5;
}

.userpet-item {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(155, 127, 224, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.userpet-item:last-child {
  border-bottom: none;
}

.userpet-item:hover {
  background: rgba(232, 220, 245, 0.7);
}

.userpet-info {
  flex: 1;
  min-width: 0;
}

.userpet-name {
  font-size: 12px;
  font-weight: 600;
  color: #5a4a6a;
}

.userpet-id {
  font-size: 10px;
  color: #8a7a9a;
  font-weight: 400;
}

.userpet-file {
  font-size: 9px;
  color: #a090b0;
  margin-top: 1px;
}

.userpet-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.userpet-btn {
  padding: 3px 7px;
  font-size: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.userpet-btn.refine {
  background: linear-gradient(135deg, #C8B6FF, #9B7FE0);
  color: white;
}

.userpet-btn.refine:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(155, 127, 224, 0.4);
}

.userpet-btn.switch {
  background: linear-gradient(135deg, #A8E6CF, #7FD1B9);
  color: #2a5a4a;
}

.userpet-btn.switch:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(127, 209, 185, 0.4);
}

.userpet-btn.delete {
  background: rgba(231, 76, 60, 0.15);
  color: #c0392b;
}

.userpet-btn.delete:hover {
  background: rgba(231, 76, 60, 0.3);
}

.ai-status {
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  min-height: 16px;
  line-height: 1.4;
}

.ai-status:empty {
  display: none;
}

.ai-status.info {
  background: rgba(91, 192, 222, 0.15);
  color: #2a7a8a;
  border-left: 3px solid #5bc0de;
}

.ai-status.success {
  background: rgba(92, 184, 92, 0.15);
  color: #2d7a2d;
  border-left: 3px solid #5cb85c;
}

.ai-status.error {
  background: rgba(231, 76, 60, 0.15);
  color: #c0392b;
  border-left: 3px solid #e74c3c;
}

/* ============= 进化特效 ============= */
.evolution-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
}

.evolution-overlay.active {
  opacity: 1;
  animation: evolveFlash 2s ease;
}

@keyframes evolveFlash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.evolution-ring {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 3px solid #FFD700;
  border-radius: 50%;
  animation: ringExpand 1.5s ease-out;
}

@keyframes ringExpand {
  0% { width: 20px; height: 20px; opacity: 1; }
  100% { width: 250px; height: 250px; opacity: 0; }
}

.evolution-text {
  position: absolute;
  top: 30%;
  color: #FFD700;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  animation: textRise 1.5s ease;
}

@keyframes textRise {
  0% { opacity: 0; transform: translateY(20px); }
  30% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* ============= Zzz ============= */
.sleep-zzz {
  position: absolute;
  top: 30px;
  right: 50px;
  font-size: 16px;
  color: #9B7FE0;
  opacity: 0;
  pointer-events: none;
}

.sleep-zzz.show {
  opacity: 1;
  animation: zzzFloat 2s ease-in-out infinite;
}

@keyframes zzzFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
  50% { transform: translateY(-10px) scale(1.2); opacity: 1; }
}

/* ============= 游乐园 ============= */
.park-modal {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
}
.park-modal .modal-content { display: none; }

.park-scene {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(170deg, #4FC3F7 0%, #81D4FA 20%, #B3E5FC 38%, #E8F5E9 50%, #C8E6C9 60%, #81C784 72%, #66BB6A 85%, #4CAF50 100%);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-app-region: no-drag;
  animation: parkSky 8s ease-in-out infinite alternate;
}
@keyframes parkSky {
  0% { background: linear-gradient(170deg, #4FC3F7, #81D4FA, #B3E5FC, #E8F5E9, #C8E6C9, #81C784, #66BB6A, #4CAF50); }
  50% { background: linear-gradient(170deg, #7E57C2, #AB47BC, #E1BEE7, #E8F5E9, #C8E6C9, #81C784, #66BB6A, #4CAF50); }
  100% { background: linear-gradient(170deg, #FF8A65, #FFAB91, #FFCCBC, #E8F5E9, #C8E6C9, #81C784, #66BB6A, #4CAF50); }
}

/* 场景装饰层 */
.park-deco-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.park-cloud {
  position: absolute; background: rgba(255,255,255,0.7); border-radius: 50%;
  box-shadow: 0 0 30px rgba(255,255,255,0.3);
}
.park-cloud::before, .park-cloud::after {
  content: ''; position: absolute; background: inherit; border-radius: 50%;
}
.park-cloud-1 { width: 60px; height: 24px; top: 8%; left: -60px; animation: cloudDrift 18s linear infinite; }
.park-cloud-1::before { width: 36px; height: 20px; top: -10px; left: 8px; }
.park-cloud-1::after  { width: 28px; height: 16px; top: -6px; left: 24px; }
.park-cloud-2 { width: 50px; height: 20px; top: 15%; left: -50px; animation: cloudDrift 25s linear infinite 5s; }
.park-cloud-2::before { width: 30px; height: 16px; top: -8px; left: 6px; }
.park-cloud-2::after  { width: 22px; height: 14px; top: -5px; left: 20px; }
.park-cloud-3 { width: 70px; height: 28px; top: 5%; left: -70px; animation: cloudDrift 22s linear infinite 10s; }
.park-cloud-3::before { width: 40px; height: 22px; top: -12px; left: 10px; }
.park-cloud-3::after  { width: 32px; height: 18px; top: -8px; left: 28px; }
@keyframes cloudDrift {
  0%   { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 200px)); }
}
.park-balloon { position: absolute; font-size: 22px; animation: balloonFloat 4s ease-in-out infinite; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)); }
.park-balloon-1 { top: 6%; right: 18%; animation-delay: 0s; }
.park-balloon-2 { top: 10%; right: 8%; animation-delay: 1.5s; font-size: 18px; }
@keyframes balloonFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(5deg); }
}
.park-star { position: absolute; font-size: 10px; color: #FFD700; opacity: 0; animation: starTwinkle 2.5s ease-in-out infinite; text-shadow: 0 0 6px rgba(255,215,0,0.6); }
.park-star-1 { top: 12%; left: 25%; animation-delay: 0s; }
.park-star-2 { top: 20%; left: 55%; animation-delay: 0.6s; }
.park-star-3 { top: 8%; left: 70%; animation-delay: 1.2s; }
.park-star-4 { top: 18%; left: 10%; animation-delay: 0.3s; }
.park-star-5 { top: 14%; left: 40%; animation-delay: 0.9s; }
@keyframes starTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.5) rotate(0); }
  50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

/* 顶部 */
.park-header {
  position: relative; z-index: 2; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,182,193,0.92), rgba(255,105,180,0.85));
  border-bottom: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  backdrop-filter: blur(4px);
}
.park-title { font-size: 15px; font-weight: 700; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.2); flex: 1; }
.park-coins { font-size: 13px; font-weight: 600; color: #FFD700; background: rgba(0,0,0,0.2); padding: 3px 10px; border-radius: 12px; }
.park-close { width: 28px; height: 28px; border: none; background: rgba(255,255,255,0.25); border-radius: 50%; color: white; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.park-close:hover { background: rgba(255,255,255,0.5); transform: scale(1.1) rotate(90deg); }

/* ============= 视觉场景区 ============= */
.park-visual {
  flex: 1; position: relative; overflow: hidden; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
}

.park-visual svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 3D 宠物容器 (游乐园设施) */
.park-visual-pet {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.5s ease, top 0.5s ease;
}
.park-visual-pet canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 设施标签 (仅默认显示, 场景内自带标签) */
.ride-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 3;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.9;
}

/* ============= 底部选择器 ============= */
.park-selector {
  position: relative; z-index: 2; flex-shrink: 0;
  display: flex; gap: 2px; overflow-x: auto;
  padding: 6px 8px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.5);
  -webkit-app-region: no-drag;
}
.park-selector::-webkit-scrollbar { display: none; }

.selector-item {
  flex: 0 0 60px;
  display: flex; flex-direction: column; align-items: center;
  padding: 5px 4px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 1px solid transparent;
  gap: 1px;
}
.selector-item:hover {
  background: rgba(255,182,193,0.2);
  transform: translateY(-2px);
}
.selector-item.active {
  background: linear-gradient(135deg, rgba(255,182,193,0.35), rgba(255,105,180,0.2));
  border-color: rgba(255,105,180,0.4);
  box-shadow: 0 2px 8px rgba(255,105,180,0.2);
}
.selector-item.playing {
  animation: selectorPlay 0.4s ease-in-out;
}
@keyframes selectorPlay {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.sel-icon { font-size: 20px; line-height: 1; }
.sel-name { font-size: 8px; color: #5a4a6a; font-weight: 600; line-height: 1.1; }

/* 底部日志 */
.park-log {
  position: relative; z-index: 2; flex-shrink: 0;
  padding: 6px 14px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.3);
  min-height: 30px;
  display: flex; align-items: center;
}
.park-log-msg {
  font-size: 11px; color: #555; line-height: 1.3;
  transition: all 0.3s;
}
.park-log-msg.success { color: #2e7d32; animation: parkMsgPop 0.4s ease; }
.park-log-msg.error { color: #c62828; animation: parkMsgShake 0.4s ease; }
.park-log-msg.info { color: #1565C0; animation: parkMsgFade 0.3s ease; }
@keyframes parkMsgPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes parkMsgShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes parkMsgFade {
  0% { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 粒子特效 */
.park-particle {
  position: absolute; pointer-events: none; font-size: 14px; z-index: 10;
  animation: parkParticleFly 1.2s ease-out forwards;
}
@keyframes parkParticleFly {
  0% { transform: translate(0,0) scale(0.5) rotate(0); opacity: 1; }
  100% { transform: translate(var(--px), var(--py)) scale(1.5) rotate(360deg); opacity: 0; }
}
