#scene-gift {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.85) 0%, transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(255, 232, 178, 0.55) 0%, transparent 45%),
    linear-gradient(165deg, #ffd8ec 0%, #ffeef7 48%, #eadbff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(82px, calc(env(safe-area-inset-top) + 74px)) 16px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* 顶部双大标签切换 */
.gift-tabs {
  display: flex;
  gap: 14px;
  padding: 6px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.gift-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 26px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 900;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gift-tab-btn.active {
  background: linear-gradient(180deg, #ff85be 0%, #ff4793 100%);
  color: #fff;
  box-shadow: 0 5px 14px rgba(255, 71, 147, 0.38);
  transform: scale(1.04);
}

.gift-panel {
  display: none;
  width: 100%;
  max-width: 880px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.gift-panel.active {
  display: flex;
}

/* 爸爸信箱面板 */
.papa-hero-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: rgba(255, 252, 254, 0.92);
  border: 5px solid #ffffff;
  border-radius: 36px;
  padding: clamp(14px, 2.5vw, 24px);
  box-shadow: 0 14px 36px rgba(220, 80, 140, 0.2);
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
}

.papa-hug-illust {
  width: clamp(130px, 24vw, 210px);
  height: clamp(130px, 24vw, 210px);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: floatGentle 3.2s ease-in-out infinite;
}

.papa-hug-illust:active {
  transform: scale(1.1) rotate(-4deg);
}

.papa-hug-illust img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(235, 110, 155, 0.28));
}

.letter-stage-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.letter-speaker-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.letter-play-big {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #ff87bf 0%, #ff4590 100%);
  color: #fff;
  font-size: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #cb286c, 0 10px 20px rgba(255, 69, 144, 0.35);
  flex-shrink: 0;
}

.letter-play-big.playing {
  animation: pulseGlow 1.1s ease-in-out infinite;
}

.letter-title-badge {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 900;
  color: var(--pink-600);
}

.letter-text-card {
  background: #fff6fa;
  border: 2px dashed #ffb5d6;
  border-radius: 22px;
  padding: 12px 16px;
  font-size: clamp(0.95rem, 2vw, 1.14rem);
  line-height: 1.6;
  color: var(--text-brown);
  font-weight: 700;
  min-height: 78px;
}

/* 5封可爱马卡龙信封按钮排 */
.envelopes-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(10px, 2.2vw, 18px);
  margin-top: 4px;
}

.envelope-btn {
  position: relative;
  width: clamp(92px, 15vw, 124px);
  height: clamp(78px, 12.5vw, 102px);
  border-radius: 22px;
  border: 4px solid #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(210, 95, 145, 0.28), 0 12px 24px rgba(220, 80, 140, 0.22);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 信封折角视觉装饰 */
.envelope-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 44%;
  background: rgba(255, 255, 255, 0.48);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

.envelope-btn .env-sticker {
  position: relative;
  z-index: 2;
  font-size: clamp(2rem, 3.8vw, 2.6rem);
  filter: drop-shadow(0 3px 5px rgba(180, 60, 110, 0.24));
}

.envelope-btn.env-1 { background: linear-gradient(180deg, #fff1a8 0%, #ffd460 100%); }
.envelope-btn.env-2 { background: linear-gradient(180deg, #ffc2d9 0%, #ff8cb8 100%); }
.envelope-btn.env-3 { background: linear-gradient(180deg, #ffe2b8 0%, #ffb26b 100%); }
.envelope-btn.env-4 { background: linear-gradient(180deg, #e2d1ff 0%, #bfa2ff 100%); }
.envelope-btn.env-5 { background: linear-gradient(180deg, #c7ecff 0%, #8cd6ff 100%); }

.envelope-btn.selected {
  transform: translateY(-9px) scale(1.1);
  border-color: var(--pink-500);
  box-shadow: 0 12px 0 rgba(230, 55, 130, 0.36), 0 18px 30px rgba(255, 70, 145, 0.38);
}

.envelope-btn .custom-mic-dot {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4785;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 900;
}

/* ============================
   魔法扭蛋机面板
   ============================ */
.gacha-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(18px, 4vw, 36px);
  width: 100%;
}

.gacha-machine-box {
  position: relative;
  width: clamp(220px, 34vw, 270px);
  background: linear-gradient(180deg, #ff8ac2 0%, #ff4d99 100%);
  border: 6px solid #fff;
  border-radius: 130px 130px 38px 38px;
  padding: 18px 18px 22px;
  box-shadow: 0 12px 0 #d12e76, 0 20px 38px rgba(225, 55, 130, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gacha-machine-box.shaking {
  animation: gachaShake 0.65s ease-in-out;
}

@keyframes gachaShake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-6deg) scale(1.04); }
  40% { transform: rotate(6deg) scale(1.05); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(4deg); }
}

.gacha-globe {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 5px solid #fff;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,0.95) 0%, rgba(255,235,248,0.72) 45%, rgba(235,205,255,0.68) 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  gap: 6px;
}

.capsule-ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: inset -4px -4px 8px rgba(0,0,0,0.12);
  animation: floatGentle 2.4s ease-in-out infinite;
}

.gacha-spin-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #ffe875 0%, #ffa826 100%);
  color: #7a3900;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 0 #c97800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gacha-spin-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #c97800;
}

.free-star-gift-btn {
  margin-top: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #8ef5b1 0%, #34c769 100%);
  color: #fff;
  font-weight: 900;
  font-size: 0.96rem;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(52, 199, 105, 0.4);
  animation: pulseGlow 1.5s infinite;
}

/* 宝物收集柜 */
.collection-shelf {
  flex: 1;
  min-width: min(320px, 90vw);
  max-width: 480px;
  background: rgba(255, 250, 253, 0.92);
  border: 5px solid #fff;
  border-radius: 32px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.shelf-title {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--pink-600);
  margin-bottom: 12px;
}

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

.prize-slot {
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  border: 3px solid #ffd6ea;
  background: #fff5fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.prize-slot.unlocked {
  background: linear-gradient(180deg, #ffffff 0%, #ffe3f1 100%);
  border-color: var(--pink-400);
  box-shadow: 0 4px 10px rgba(235, 90, 150, 0.18);
}

.prize-slot.unlocked:hover {
  transform: scale(1.08);
}

.prize-slot.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.prize-slot .prize-name {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-soft);
  margin-top: 2px;
}

/* 扭蛋开奖大弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(85, 30, 62, 0.52);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fffafd;
  border: 5px solid #ffffff;
  border-radius: 34px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(120, 25, 75, 0.38);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #ffd4e7;
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

/* 家长设置与爸爸真声录音室样式 */
.parent-section {
  margin-top: 14px;
  padding: 14px;
  border-radius: 20px;
  background: #fff2f8;
  border: 2px solid #ffd6ea;
}

.parent-section h4 {
  color: var(--pink-600);
  margin-bottom: 8px;
  font-size: 1rem;
}

.parent-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid #ffb8d9;
  font-size: 1rem;
  color: var(--text-brown);
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}

.rec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #ffd0e5;
  flex-wrap: wrap;
}

.rec-row:last-child {
  border-bottom: none;
}

.mini-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--pink-500);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.mini-btn.recording {
  background: #ff2b2b;
  animation: pulseGlow 0.9s infinite;
}

.mini-btn.secondary {
  background: #9c7ae0;
}

.mini-btn.ghost {
  background: #f1e4ec;
  color: var(--text-brown);
}

.math-options {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.math-opt-btn {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  border: 3px solid #ffb8d9;
  background: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--pink-600);
  cursor: pointer;
}

@media (max-width: 640px) {
  .papa-hero-card {
    flex-direction: column;
    text-align: center;
  }
  .letter-speaker-header {
    justify-content: center;
  }
}
