:root {
  --pink-50: #fff5f9;
  --pink-100: #ffe4ef;
  --pink-200: #ffc6df;
  --pink-300: #ff9ec7;
  --pink-400: #ff74b1;
  --pink-500: #ff4d97;
  --pink-600: #e62e7d;
  --peach-100: #ffe9dc;
  --cream-100: #fffdf7;
  --lavender-200: #e9d8fd;
  --sky-200: #cdeeff;
  --gold-300: #ffe066;
  --gold-400: #ffcc29;
  --gold-500: #f59f00;
  --text-brown: #6b3e52;
  --text-soft: #966379;
  --glass-bg: rgba(255, 250, 253, 0.86);
  --glass-border: rgba(255, 255, 255, 0.94);
  --shadow-soft: 0 10px 28px rgba(235, 90, 150, 0.22);
  --shadow-btn: 0 7px 0 rgba(219, 84, 140, 0.35), 0 12px 24px rgba(235, 90, 150, 0.28);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(160deg, #ffd6e8 0%, #ffeef6 50%, #e8dcff 100%);
  font-family: "Hiragino Maru Gothic ProN", "YouYuan", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text-brown);
  touch-action: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 场景层通用切换 */
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.45s ease;
  transform: scale(1.03);
  overflow: hidden;
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* 全屏粒子画布层 */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}

/* 开场爸爸礼物盒大幕布 */
#splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: radial-gradient(circle at 50% 42%, #fff8fc 0%, #ffd6eb 55%, #ffc0e0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

#splash-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.18);
}

.splash-sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.9) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 18%, rgba(255,255,255,0.85) 0 5px, transparent 6px),
    radial-gradient(circle at 25% 76%, rgba(255,240,150,0.85) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 74%, rgba(255,255,255,0.9) 0 4px, transparent 5px);
  pointer-events: none;
}

.splash-hero {
  position: relative;
  width: min(300px, 58vw);
  height: min(300px, 58vw);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatGentle 2.8s ease-in-out infinite;
}

.splash-pufu-peek {
  position: absolute;
  top: -16%;
  width: 58%;
  filter: drop-shadow(0 8px 16px rgba(255, 95, 162, 0.28));
  animation: peekBounce 2.2s ease-in-out infinite;
}

.splash-gift-img {
  position: relative;
  z-index: 2;
  width: 88%;
  filter: drop-shadow(0 16px 28px rgba(230, 60, 135, 0.32));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#splash-overlay:active .splash-gift-img {
  transform: scale(0.9) rotate(-3deg);
}

.splash-badge {
  background: rgba(255, 255, 255, 0.92);
  border: 4px solid #ffffff;
  border-radius: 999px;
  padding: 12px 30px;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.splash-title {
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--pink-600);
  letter-spacing: 1px;
}

.splash-sub {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: var(--text-soft);
  margin-top: 4px;
  font-weight: 700;
}

.splash-play-pill {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 40px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #ff7eb8 0%, #ff4793 100%);
  color: #fff;
  font-size: clamp(1.25rem, 3.6vw, 1.65rem);
  font-weight: 900;
  box-shadow: 0 8px 0 #d62b72, 0 16px 30px rgba(255, 71, 147, 0.42);
  animation: pulseGlow 1.8s ease-in-out infinite;
}

/* 顶部公共 HUD 控件 */
.top-hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

/* 超大Q弹图标圆按钮 - 5岁幼儿零文字友好 */
.round-btn {
  width: clamp(58px, 9vw, 72px);
  height: clamp(58px, 9vw, 72px);
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #ffe4f1 100%);
  box-shadow: var(--shadow-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.65rem, 3.2vw, 2.05rem);
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.16s ease;
  position: relative;
}

.round-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

.round-btn:active {
  transform: translateY(5px) scale(0.93);
  box-shadow: 0 2px 0 rgba(219, 84, 140, 0.35), 0 5px 12px rgba(235, 90, 150, 0.25);
}

.round-btn.home-btn {
  background: linear-gradient(180deg, #ff8ec2 0%, #ff549a 100%);
  color: #fff;
}

.round-btn.hidden-btn {
  display: none;
}

.round-btn.muted::after {
  content: "";
  position: absolute;
  width: 72%;
  height: 5px;
  background: #ff3b6b;
  border-radius: 99px;
  transform: rotate(-40deg);
  box-shadow: 0 0 0 2px #fff;
}

/* 星星收集胶囊 */
.star-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 12px;
  border-radius: 999px;
  border: 4px solid #ffffff;
  background: linear-gradient(180deg, #fffbe8 0%, #ffe89e 100%);
  box-shadow: 0 6px 0 rgba(230, 162, 30, 0.34), 0 10px 22px rgba(245, 159, 0, 0.24);
  font-size: clamp(1.25rem, 2.8vw, 1.65rem);
  font-weight: 900;
  color: #b86200;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-pill.pop {
  transform: scale(1.22);
}

.star-pill .star-icon {
  font-size: clamp(1.55rem, 3.2vw, 1.95rem);
  filter: drop-shadow(0 2px 4px rgba(245, 159, 0, 0.45));
  animation: spinWobble 3.4s ease-in-out infinite;
}

/* 宝贝名字小皇冠铭牌 */
.princess-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: rgba(255, 245, 250, 0.92);
  box-shadow: var(--shadow-soft);
  font-weight: 900;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--pink-600);
}

/* 爸爸家长设置低调按钮 */
.papa-gear-btn {
  width: clamp(46px, 7vw, 56px);
  height: clamp(46px, 7vw, 56px);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  opacity: 0.85;
  background: linear-gradient(180deg, #f8f3ff 0%, #e7dcff 100%);
}

/* 噗噗语音可视化温柔气泡（停靠右上角喇叭下方，绝不遮挡画面中央主角与标签页） */
#voice-toast {
  position: fixed;
  top: max(84px, calc(env(safe-area-inset-top) + 74px));
  right: max(16px, env(safe-area-inset-right));
  transform: translateY(-12px) scale(0.94);
  z-index: 550;
  max-width: min(380px, 84vw);
  padding: 9px 18px;
  border-radius: 24px;
  border: 3px solid #fff;
  background: rgba(255, 248, 252, 0.94);
  box-shadow: 0 10px 26px rgba(230, 75, 145, 0.22);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#voice-toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.voice-wave span {
  width: 4px;
  height: 10px;
  border-radius: 99px;
  background: var(--pink-500);
  animation: waveBar 0.7s ease-in-out infinite alternate;
}

.voice-wave span:nth-child(2) { animation-delay: 0.15s; height: 16px; }
.voice-wave span:nth-child(3) { animation-delay: 0.3s; height: 12px; }

#voice-toast-text {
  font-size: clamp(0.9rem, 2.1vw, 1.08rem);
  font-weight: 800;
  color: var(--text-brown);
  line-height: 1.35;
}

/* 6秒不操作魔法小手引导 */
#guide-hand {
  position: fixed;
  z-index: 750;
  font-size: clamp(2.8rem, 6vw, 3.8rem);
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 8px 16px rgba(255, 65, 145, 0.45));
  transition: opacity 0.3s ease, left 0.45s ease, top 0.45s ease;
}

#guide-hand.visible {
  opacity: 1;
  animation: handTapGuide 1.15s ease-in-out infinite;
}

#guide-hand::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -6px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(255, 92, 168, 0.75);
  animation: rippleRing 1.15s ease-out infinite;
}

/* 关键帧动画库 */
@keyframes floatGentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

@keyframes peekBounce {
  0%, 100% { transform: translateY(4px) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 0 #d62b72, 0 14px 28px rgba(255, 71, 147, 0.42); }
  50% { transform: scale(1.06); box-shadow: 0 8px 0 #d62b72, 0 18px 38px rgba(255, 71, 147, 0.65); }
}

@keyframes jellySquish {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.18, 0.84); }
  50% { transform: scale(0.9, 1.12); }
  75% { transform: scale(1.06, 0.96); }
  100% { transform: scale(1, 1); }
}

@keyframes spinWobble {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.1); }
}

@keyframes waveBar {
  0% { transform: scaleY(0.45); }
  100% { transform: scaleY(1.25); }
}

@keyframes handTapGuide {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(-12deg); }
  45% { transform: translate(-6px, -8px) scale(0.86) rotate(-4deg); }
}

@keyframes rippleRing {
  0% { transform: scale(0.5); opacity: 0.95; }
  100% { transform: scale(1.9); opacity: 0; }
}

@media (max-width: 680px) {
  .princess-tag {
    display: none;
  }
  #voice-toast {
    top: 224px;
    left: 50%;
    right: auto;
    width: 88vw;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
    padding: 7px 14px;
  }
  #voice-toast.visible {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}
