/* ============================================================
 * 生日祝福页 · 样式（手机优先 · PPT 翻页版）
 * 一般不用动这个文件；想换配色改 :root 里的变量即可
 * ============================================================ */

:root {
  --accent: #f43f5e;
  --accent-2: #fb923c;
  --ink: #3d2c3d;
  --ink-soft: rgba(61, 44, 61, 0.62);
  --card: rgba(255, 255, 255, 0.86);
  --rp: #e11d48;
  --rp-deep: #c01040;
  --gold: #ffd873;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fff7ed 0%, #ffe4e6 55%, #f3e8ff 100%);
  min-height: 100vh;
  overflow: hidden;
}

/* ---------------- 开屏 ---------------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #2b1a4e 0%, #7c3aed 45%, #ec4899 100%);
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.6s ease;
}
#splash.leaving { opacity: 0; }

.splash-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 24px;
}
.splash-cake {
  font-size: 64px;
  animation: bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.3));
}
.splash-title {
  margin: 0.15em 0;
  font-size: clamp(2.4rem, 10vw, 4rem);
  letter-spacing: 0.08em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}
.splash-sub { margin: 0; opacity: 0.85; }
.splash-hint {
  display: inline-block;
  margin-top: 52px;
  padding: 13px 30px;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  letter-spacing: 0.18em;
  animation: pulse 1.8s ease-in-out infinite;
}

.floaters { position: absolute; inset: 0; z-index: 1; }
.floaters span {
  position: absolute;
  bottom: -44px;
  animation: rise linear infinite;
  opacity: 0.9;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

@keyframes rise { to { transform: translateY(-118vh) rotate(24deg); } }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* ---------------- 幻灯片（PPT） ---------------- */
#deck { position: fixed; inset: 0; }

.slide {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px calc(84px + env(safe-area-inset-bottom));
}
.slide.active { display: flex; animation: slide-in 0.45s ease; }
/* 上下自动留白：内容少时居中，内容多时可滚动 */
.slide::before, .slide::after { content: ""; flex: 1 0 12px; }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 翻页导航 ---------------- */
#deck-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.nav-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.nav-btn:active { transform: scale(0.94); }
#nav-info {
  min-width: 64px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 首页祝福 ---------------- */
#s-hero { text-align: center; }
.hero-eyebrow {
  margin: 0;
  letter-spacing: 0.34em;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.hero-title {
  margin: 0.12em 0 0.5em;
  font-size: clamp(2.6rem, 12vw, 4.2rem);
  background: linear-gradient(90deg, #f43f5e, #fb923c, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lines {
  max-width: 30em;
  font-size: 1.12rem;
  line-height: 2.05;
}
.type-line { margin: 0.22em 0; }
.typing::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-next-hint {
  margin-top: 5vh;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  animation: pulse 1.8s ease-in-out infinite;
}

/* ---------------- 通用卡片 ---------------- */
.card {
  width: min(92vw, 420px);
  background: var(--card);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 10px 34px rgba(190, 24, 93, 0.10);
}
.card-title { margin: 0.1em 0 0.4em; font-size: 1.35rem; }
.section-sub {
  margin: 0 0 1.2em;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------------- 倒计时 ---------------- */
.countdown {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}
.cd-num {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, #f43f5e, #fb923c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cd-unit { font-size: 1.1rem; color: var(--ink-soft); }
.cd-big {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, #f43f5e, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.countdown-sub {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------------- 时间线 ---------------- */
.timeline {
  position: relative;
  max-width: 380px;
  margin: 6px auto 0;
  text-align: left;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 16px;
  width: 2px;
  background: linear-gradient(180deg, #f43f5e, #fb923c);
  opacity: 0.35;
}
.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 0 22px;
}
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.18);
  position: relative;
  z-index: 1;
}
.tl-body { min-width: 0; }
.tl-title { font-weight: 700; }
.tl-date { margin-top: 2px; font-size: 0.82rem; color: var(--ink-soft); }
.tl-note { margin-top: 2px; font-size: 0.82rem; color: var(--ink-soft); }
.tl-badge {
  flex: none;
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(90deg, #f43f5e, #fb923c);
  white-space: nowrap;
}

/* ---------------- 照片页 ---------------- */
.photo-slide { text-align: center; }
.ps-chip {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}
.ps-img {
  max-width: min(92vw, 560px);
  max-height: 58vh;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  background: #fff;
  cursor: pointer;
}
.ps-cap { margin: 16px 0 0; font-size: 0.98rem; }
.photo-slide.ps-missing .ps-img { display: none; }

/* ---------------- 盲盒 ---------------- */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  padding: 13px 32px;
  border-radius: 999px;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(244, 63, 94, 0.35);
  transition: transform 0.15s ease;
}
.btn:active { transform: scale(0.96); }

.blind-output {
  min-height: 5em;
  margin-top: 20px;
  padding: 18px 16px;
  border-radius: 14px;
  background: #fff1f2;
  color: #9f1239;
  font-size: 1.05rem;
  line-height: 1.85;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.blind-output.show { opacity: 1; }
.blind-count {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------------- 红包（一串逐个拆） ---------------- */
.rp-progress {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}
.redpacket { max-width: 320px; margin: 0 auto; }

.rp-cover {
  position: relative;
  padding: 46px 0 34px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(150deg, var(--rp), var(--rp-deep));
  box-shadow: 0 14px 34px rgba(225, 29, 72, 0.35);
}
.rp-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.05) 0 14px,
    transparent 14px 28px
  );
}
.rp-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 88px;
  background: linear-gradient(180deg, #d31a49, #b30f3c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.rp-cover-theme {
  position: relative;
  margin: 20px 0 0;
  text-align: center;
  color: #ffe4e6;
  font-size: 0.95rem;
  letter-spacing: 0.3em;
}
.rp-seal {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 22px auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, var(--gold), #f59e0b 72%);
  box-shadow: 0 0 0 6px rgba(255, 216, 115, 0.25), 0 6px 18px rgba(0, 0, 0, 0.28);
  animation: seal-glow 2s ease-in-out infinite;
}
.rp-seal span {
  font-size: 2rem;
  font-weight: 800;
  color: #8a2b0f;
}
.rp-tip {
  position: relative;
  margin: 6px 0 0;
  text-align: center;
  color: #ffe4e6;
  font-size: 0.88rem;
  letter-spacing: 0.2em;
}
.rp-cover.shaking { animation: shake 0.6s ease; }

/* 压轴红包（最后一个）换成金色 */
.rp-cover.is-last {
  background: linear-gradient(150deg, #f59e0b, #b45309);
  box-shadow: 0 14px 34px rgba(245, 158, 11, 0.4);
}
.rp-cover.is-last::before {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.08) 0 14px,
    transparent 14px 28px
  );
}
.rp-cover.is-last .rp-flap { background: linear-gradient(180deg, #ea8a0c, #b45309); }
.rp-cover.is-last .rp-seal {
  background: radial-gradient(circle at 30% 30%, #fff7ed, #fb923c 72%);
}
.rp-cover.is-last .rp-seal span { color: #7c2d12; }
.rp-cover.is-last .rp-tip,
.rp-cover.is-last .rp-cover-theme { color: #fff7ed; }

@keyframes seal-glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-5deg) scale(1.02); }
  40% { transform: rotate(5deg) scale(1.04); }
  60% { transform: rotate(-4deg) scale(1.05); }
  80% { transform: rotate(3deg) scale(1.03); }
}

.rp-result {
  padding: 36px 20px;
  border-radius: 16px;
  text-align: center;
  color: #fff;
  background: linear-gradient(150deg, var(--rp), var(--rp-deep));
  box-shadow: 0 14px 34px rgba(225, 29, 72, 0.35);
  animation: pop 0.5s ease;
}
.rp-amount {
  font-size: 3rem;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.rp-result .rp-theme {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffe4e6;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
}
.rp-text {
  margin: 16px 0 0;
  text-align: left;
  line-height: 1.9;
  font-size: 0.98rem;
  color: #fff;
}
.rp-status { margin: 14px 0 0; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); }
.rp-note { margin: 8px 0 0; font-size: 0.8rem; color: rgba(255, 255, 255, 0.66); }
.rp-next {
  margin-top: 20px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #78350f;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------- 结尾页 ---------------- */
#s-end { text-align: center; }
.end-cake {
  font-size: 64px;
  animation: bob 2.4s ease-in-out infinite;
}
.end-title {
  margin: 0.15em 0;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  background: linear-gradient(90deg, #f43f5e, #fb923c, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.end-love { font-size: 1.05rem; }
.end-year { margin-top: 16px; font-size: 0.8rem; color: var(--ink-soft); }

/* ---------------- 音乐 / 彩带 ---------------- */
#music-toggle {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 700;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  font-size: 20px;
  cursor: pointer;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}

/* ---------------- 动效偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
