/* ============================================================
   生日快乐 · 彭冠乔
   整屏翻页版：五个 slide，底部箭头翻页
   纯 CSS / 无外部依赖
   ============================================================ */

:root {
  --bg: #070a14;
  --ink: #f5eee2;
  --ink-soft: rgba(245, 238, 226, 0.76);
  --ink-faint: rgba(245, 238, 226, 0.5);
  --gold: #e8c98f;
  --gold-deep: #c39a5b;
  --cream: #fff6e6;
  --rose: #e9a9a2;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    "SimSun", "Georgia", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --turn: cubic-bezier(0.76, 0, 0.24, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

::-webkit-scrollbar { width: 0; height: 0; }

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: pageIn 1s ease both;
  touch-action: none;
}

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

/* ---------------- 背景 ---------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #16213d 0%, #0c1122 42%, #070a14 78%, #05070f 100%);
}

#stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.3;
  will-change: transform;
}

.aurora--gold {
  width: 52vw;
  height: 52vw;
  min-width: 340px;
  min-height: 340px;
  left: -10vw;
  top: -6vh;
  opacity: 0.32;
  background: radial-gradient(circle, rgba(255, 186, 104, 0.6), rgba(255, 152, 72, 0.16) 44%, rgba(255, 152, 72, 0) 68%);
  animation: drift 26s ease-in-out infinite alternate;
}

.aurora--rose {
  width: 70vw;
  height: 70vw;
  min-width: 380px;
  min-height: 380px;
  right: -22vw;
  bottom: -18vh;
  background: radial-gradient(circle, rgba(233, 169, 162, 0.42), rgba(160, 110, 180, 0.18) 45%, rgba(233, 169, 162, 0) 70%);
  animation: drift 32s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(4vw, 5vh, 0); }
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(circle, rgba(232, 201, 143, 0.13), rgba(232, 201, 143, 0) 62%);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .cursor-glow { opacity: 1; }
}

/* ---------------- 翻页舞台 ---------------- */

.deck {
  position: fixed;
  inset: 0;
  z-index: 2;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: clamp(40px, 7vh, 80px) 22px clamp(88px, 13vh, 120px);
  text-align: center;
  opacity: 0;
  transform: translate3d(0, 100%, 0);
  transition: transform 0.85s var(--turn), opacity 0.45s ease;
  pointer-events: none;
  will-change: transform, opacity;
}

.slide.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.slide.is-prev {
  opacity: 0;
  transform: translate3d(0, -100%, 0);
}

.slide.is-active.is-animating {
  transform: translate3d(0, 0, 0);
}

/* 元素入场 */
.stagger {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}

.slide.is-active .stagger {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- 首屏 ---------------- */

.eyebrow {
  margin: 0 0 clamp(14px, 3vh, 26px);
  font-size: clamp(9px, 2.4vw, 11px);
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: var(--gold);
}

.name {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 0.02em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3.2rem, 15.5vw, 9.5rem);
  line-height: 1.04;
  letter-spacing: 0.04em;
  background: linear-gradient(104deg, #9d6c2c 0%, #d9ae6e 20%, #f2d8a9 40%, #e0bb7d 56%, #b07f39 76%, #e9c68a 100%);
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: shimmer 10s ease-in-out infinite;
  filter: drop-shadow(0 8px 34px rgba(232, 201, 143, 0.22));
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.42em) rotate(3deg);
  animation: nameIn 1.15s var(--ease) forwards;
}

@keyframes nameIn {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.tagline {
  margin: clamp(16px, 3vh, 26px) 0 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(220px, 54vw);
  margin: clamp(20px, 4vh, 34px) auto 0;
}

.rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(232, 201, 143, 0), rgba(232, 201, 143, 0.6), rgba(232, 201, 143, 0));
}

.whisper {
  margin: clamp(18px, 3.5vh, 30px) 0 0;
  font-size: clamp(11px, 2.9vw, 12.5px);
  letter-spacing: 0.3em;
  color: rgba(245, 238, 226, 0.5);
}

/* ---------------- 蛋糕 ---------------- */

.cake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 60%;
}

.cake {
  position: relative;
  width: 320px;
  height: 340px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.cake:focus-visible .plate { box-shadow: 0 0 0 2px rgba(232, 201, 143, 0.7); }

.halo {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 400px;
  height: 400px;
  margin-left: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 120, 0.28), rgba(255, 170, 90, 0.1) 38%, rgba(255, 170, 90, 0) 66%);
  transition: opacity 1.1s ease;
  animation: haloPulse 4.4s ease-in-out infinite;
}

@keyframes haloPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

.cake.blown .halo {
  opacity: 0.18;
  animation: none;
}

.candles {
  position: absolute;
  left: 50%;
  bottom: 196px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 30px;
}

.candle {
  position: relative;
  display: block;
  width: 10px;
  height: 54px;
  border-radius: 5px;
  background: repeating-linear-gradient(158deg, var(--cream) 0 5px, #efb9b2 5px 10px);
  box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.candle.c1 { height: 48px; }
.candle.c2 { height: 58px; }
.candle.c3 { height: 50px; }

.candle .wick {
  position: absolute;
  left: 50%;
  top: -12px;
  width: 2px;
  height: 13px;
  margin-left: -1px;
  border-radius: 1px;
  background: #2a2118;
}

.candle .flame {
  position: absolute;
  left: 50%;
  top: -34px;
  width: 15px;
  height: 24px;
  margin-left: -7.5px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 74%, #ffffff 0%, #fff2c9 26%, #ffcb73 52%, #ff8b33 72%, rgba(255, 120, 30, 0) 78%);
  box-shadow:
    0 0 18px 6px rgba(255, 186, 96, 0.55),
    0 0 48px 16px rgba(255, 150, 60, 0.26),
    0 0 90px 34px rgba(255, 140, 50, 0.12);
  transform-origin: 50% 100%;
  animation: flicker 1.7s ease-in-out infinite;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.candle:nth-child(2) .flame { animation-duration: 2.1s; animation-delay: -0.6s; }
.candle:nth-child(3) .flame { animation-duration: 1.45s; animation-delay: -1.1s; }

@keyframes flicker {
  0%, 100% { transform: translateY(0) scale(1) skewX(0deg); opacity: 1; }
  22% { transform: translateY(-1.5px) scale(1.05, 0.96) skewX(2deg); opacity: 0.94; }
  48% { transform: translateY(1px) scale(0.96, 1.05) skewX(-2.5deg); opacity: 1; }
  74% { transform: translateY(-1px) scale(1.03, 0.98) skewX(1.5deg); opacity: 0.9; }
}

.smoke {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 220, 230, 0.5), rgba(220, 220, 230, 0) 70%);
  opacity: 0;
}

/* 熄灭时必须先停掉 flicker 动画：CSS 动画会覆盖这里的 opacity 声明 */
.cake.blown .flame {
  animation: none;
  opacity: 0;
  transform: translateY(-14px) scale(0.35);
  box-shadow: none;
}

.cake.blown .smoke {
  animation: smokeUp 2.6s ease-out forwards;
}

.candle:nth-child(2) .smoke { animation-delay: 0.12s; }
.candle:nth-child(3) .smoke { animation-delay: 0.22s; }

@keyframes smokeUp {
  0% { opacity: 0.55; transform: translateY(0) scale(0.6); }
  60% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-62px) scale(2.6); }
}

.tier {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  border-radius: 8px 8px 12px 12px;
}

.tier--bottom {
  bottom: 30px;
  width: 258px;
  height: 104px;
  background: linear-gradient(180deg, #f7e2c0 0%, #e6c092 46%, #cfa270 78%, #bb8c5a 100%);
  box-shadow:
    inset 0 -14px 24px rgba(120, 70, 30, 0.22),
    inset 0 6px 10px rgba(255, 255, 255, 0.35),
    0 16px 34px rgba(0, 0, 0, 0.45);
}

.tier--top {
  bottom: 128px;
  width: 176px;
  height: 80px;
  background: linear-gradient(180deg, #fdf0d8 0%, #f3d7ad 48%, #e2b988 80%, #d1a471 100%);
  box-shadow:
    inset 0 -10px 18px rgba(120, 70, 30, 0.18),
    inset 0 5px 9px rgba(255, 255, 255, 0.45),
    0 12px 26px rgba(0, 0, 0, 0.4);
}

.frosting {
  position: absolute;
  left: 0;
  right: 0;
  top: -9px;
  display: block;
  height: 22px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, #fffdf8, #fdf1da);
  box-shadow: inset 0 -5px 9px rgba(190, 150, 100, 0.25), 0 4px 12px rgba(0, 0, 0, 0.18);
}

.frosting::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 21px;
  background-image: radial-gradient(circle at 11px 0, #fdf1da 10.6px, rgba(253, 241, 218, 0) 11.2px);
  background-size: 22px 21px;
  background-repeat: repeat-x;
}

.speck {
  position: absolute;
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd9d1, #d0615a);
  opacity: 0.95;
}

.speck--1 { left: 24px; top: 30px; }
.speck--2 { right: 30px; top: 46px; width: 5px; height: 5px; }
.speck--3 { left: 50%; top: 60px; width: 5px; height: 5px; }
.speck--4 { left: 40px; top: 34px; }
.speck--5 { right: 56px; top: 62px; width: 5px; height: 5px; }

.plate {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 312px;
  height: 34px;
  margin-left: -156px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(232, 201, 143, 0.3), rgba(232, 201, 143, 0.09) 46%, rgba(232, 201, 143, 0) 72%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
  transition: box-shadow 0.3s ease;
}

.cake-hint {
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: 0.34em;
  color: rgba(245, 238, 226, 0.56);
  transition: opacity 0.6s ease;
}

.cake-wrap.blown .cake-hint {
  opacity: 0;
}

/* 愿望揭晓 */
.wish {
  margin-top: clamp(6px, 2vh, 18px);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(16px);
  transition: opacity 1s var(--ease) 0.3s, transform 1s var(--ease) 0.3s, max-height 1s ease 0.3s;
}

.wish.show {
  opacity: 1;
  max-height: 420px;
  transform: translateY(0);
}

.wish-label {
  margin: 0 0 12px;
  font-size: 9.5px;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  color: var(--gold);
  opacity: 0.8;
}

.wish-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 4.8vw, 1.85rem);
  line-height: 1.8;
  letter-spacing: 0.1em;
  background: linear-gradient(102deg, #f4e4c6, #fffaf0 45%, #e8c98f 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ---------------- 引子 ---------------- */

.quote {
  position: relative;
  max-width: 660px;
  padding: clamp(26px, 5vh, 48px) clamp(20px, 5vw, 48px);
  border-top: 1px solid rgba(232, 201, 143, 0.15);
  border-bottom: 1px solid rgba(232, 201, 143, 0.15);
}

.quote::before,
.quote::after {
  content: "\201C";
  position: absolute;
  font-family: var(--serif);
  font-size: 60px;
  line-height: 1;
  color: rgba(232, 201, 143, 0.24);
}

.quote::before { left: 4px; top: 2px; }
.quote::after { content: "\201D"; right: 4px; bottom: -18px; }

.quote p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4.6vw, 2rem);
  line-height: 1.95;
  letter-spacing: 0.13em;
  color: rgba(245, 238, 226, 0.92);
  text-wrap: pretty;
}

.quote-sub {
  margin-top: clamp(16px, 3vh, 26px) !important;
  font-size: clamp(0.86rem, 3vw, 1rem) !important;
  letter-spacing: 0.18em !important;
  line-height: 2 !important;
  color: rgba(245, 238, 226, 0.52) !important;
}

/* ---------------- 卡片 ---------------- */

.has-cards { justify-content: center; }

.section-title {
  margin: 0 0 clamp(20px, 4.5vh, 42px);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(245, 238, 226, 0.84);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2.4vw, 22px);
  width: min(1020px, 100%);
}

.card {
  position: relative;
  padding: clamp(20px, 3.4vw, 32px) clamp(18px, 2.8vw, 28px);
  border-radius: 16px;
  border: 1px solid rgba(232, 201, 143, 0.16);
  background: linear-gradient(160deg, rgba(24, 31, 52, 0.66), rgba(11, 16, 30, 0.6));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  transition: transform 0.55s var(--ease), border-color 0.55s ease, box-shadow 0.55s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(232, 201, 143, 0.36);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
}

.card-no {
  display: block;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--gold);
  opacity: 0.9;
}

.card h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.05rem, 3.5vw, 1.22rem);
  letter-spacing: 0.1em;
  color: var(--ink);
}

.card p {
  margin: 0;
  font-size: clamp(0.86rem, 3.2vw, 0.94rem);
  line-height: 1.9;
  color: rgba(245, 238, 226, 0.78);
  text-wrap: balance;
}

/* ---------------- 结尾 ---------------- */

.finale { justify-content: center; }

.finale-eyebrow {
  margin: 0 0 clamp(16px, 3vh, 26px);
  font-size: clamp(9px, 2.3vw, 10.5px);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--gold);
  opacity: 0.85;
}

.finale-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 7.4vw, 3.4rem);
  line-height: 1.5;
  letter-spacing: 0.16em;
  background: linear-gradient(100deg, #e6c78f, #fffaf0 46%, #e8c98f 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 26px rgba(232, 201, 143, 0.2));
}

.finale-sub {
  margin: clamp(14px, 2.6vh, 22px) 0 0;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: rgba(245, 238, 226, 0.52);
}

.restart {
  margin-top: clamp(30px, 6vh, 56px);
  padding: 11px 26px;
  border-radius: 999px;
  border: 1px solid rgba(232, 201, 143, 0.5);
  background: linear-gradient(180deg, rgba(232, 201, 143, 0.18), rgba(232, 201, 143, 0.07));
  color: #f8e8c8;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.4s ease, background 0.4s ease, transform 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}

.restart:hover {
  border-color: rgba(232, 201, 143, 0.7);
  background: linear-gradient(180deg, rgba(232, 201, 143, 0.28), rgba(232, 201, 143, 0.12));
  transform: translateY(-2px);
}

.restart:focus-visible { outline: 2px solid rgba(232, 201, 143, 0.6); outline-offset: 3px; }

/* ---------------- 翻页控件 ---------------- */

.nav {
  position: fixed;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(232, 201, 143, 0.3);
  background: rgba(12, 17, 34, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.5s ease, transform 0.5s var(--ease), border-color 0.4s ease, visibility 0.5s;
}

.nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav:hover { border-color: rgba(232, 201, 143, 0.68); }
.nav:focus-visible { outline: 2px solid rgba(232, 201, 143, 0.6); outline-offset: 3px; }

.nav--next {
  left: 50%;
  bottom: calc(clamp(22px, 4vh, 34px) + env(safe-area-inset-bottom, 0px));
  margin-left: -23px;
  animation: nudge 2.6s ease-in-out infinite;
}

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

.nav--prev {
  left: clamp(14px, 3vw, 26px);
  bottom: calc(clamp(22px, 4vh, 34px) + env(safe-area-inset-bottom, 0px));
  width: 38px;
  height: 38px;
  border-color: rgba(232, 201, 143, 0.16);
  color: rgba(232, 201, 143, 0.62);
  animation: none;
}

.nav--prev svg { width: 17px; height: 17px; }

.nav.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nav--next.is-hidden { animation: none; }

/* 页码点 */
.dots {
  position: fixed;
  right: clamp(12px, 2vw, 22px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dots button {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(245, 238, 226, 0.24);
  cursor: pointer;
  transition: height 0.45s var(--ease), background 0.45s ease;
  -webkit-tap-highlight-color: transparent;
}

.dots button.is-on {
  height: 20px;
  background: rgba(232, 201, 143, 0.85);
}

.dots button:focus-visible { outline: 2px solid rgba(232, 201, 143, 0.6); outline-offset: 4px; }

/* ---------------- 音乐开关 ---------------- */

.music {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(232, 201, 143, 0.3);
  background: rgba(12, 17, 34, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  cursor: pointer;
  transition: border-color 0.35s ease, background 0.35s ease, transform 0.35s ease;
  -webkit-tap-highlight-color: transparent;
}

.music:hover { border-color: rgba(232, 201, 143, 0.7); transform: translateY(-2px); }
.music:focus-visible { outline: 2px solid rgba(232, 201, 143, 0.6); outline-offset: 3px; }

.music svg { width: 17px; height: 17px; fill: currentColor; opacity: 0.9; }

.music-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.music-bars i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  animation: bar 1s ease-in-out infinite;
}

.music-bars i:nth-child(2) { animation-delay: 0.18s; }
.music-bars i:nth-child(3) { animation-delay: 0.36s; }

@keyframes bar {
  0%, 100% { height: 4px; opacity: 0.6; }
  50% { height: 12px; opacity: 1; }
}

.music[aria-pressed="true"] .music-bars { display: flex; }
.music[aria-pressed="true"] svg { display: none; }

/* ---------------- 彩带 ---------------- */

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1; /* 压在内容之下：彩带只做气氛，不挡文字和按钮 */
  pointer-events: none;
}

/* ---------------- 适配 ---------------- */

@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr; width: min(420px, 100%); gap: 12px; }
  .card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 19px 22px;
    background: linear-gradient(160deg, rgba(23, 30, 50, 0.97), rgba(11, 16, 30, 0.97));
  }
  .card-no { margin-bottom: 9px; }
  .card h3 { margin-bottom: 7px; }
  .card p { line-height: 1.8; }
  .aurora { filter: blur(46px); opacity: 0.24; }
  .grain { opacity: 0.03; }
  .section-title { margin-bottom: 22px; }
}

@media (max-width: 420px) {
  .cake-wrap { transform: scale(0.8); }
  .candles { gap: 26px; }
  .music { right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .nav--prev { left: 12px; }
  .whisper { letter-spacing: 0.22em; }
}

/* 窄屏：页码点改横排，放到箭头正上方，避免贴住卡片 */
@media (max-width: 560px) {
  .section-title { letter-spacing: 0.3em; text-indent: 0.3em; }
  .dots {
    right: auto;
    left: 50%;
    top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    flex-direction: row;
    gap: 8px;
  }
  .dots button { width: 5px; height: 5px; }
  .dots button.is-on { width: 16px; height: 5px; }
}

@media (max-height: 700px) {
  .slide { padding-top: 26px; padding-bottom: 78px; }
  .cake-wrap { transform: scale(0.72); }
  .name { font-size: clamp(2.6rem, 12vw, 5.2rem); }
  .quote p { font-size: clamp(1.05rem, 4vw, 1.5rem); }
  .quote-sub { font-size: 0.82rem !important; }
  .card p { font-size: 0.84rem; line-height: 1.7; }
  .finale-name { font-size: clamp(1.6rem, 6vw, 2.4rem); }
  .restart { margin-top: 22px; }
}

@media (max-height: 620px) and (min-width: 700px) {
  .cards { gap: 10px; }
  .card { padding: 14px 18px; }
  .card p { font-size: 0.8rem; }
  .section-title { margin-bottom: 12px; }
}

/* ---------------- 无障碍 / 降级 ---------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .stagger { opacity: 1; transform: none; }
  .name span { opacity: 1; transform: none; }
}

@media print {
  .bg, .music, .confetti, .cursor-glow, .nav, .dots { display: none !important; }
  body { background: #fff; color: #111; overflow: visible; height: auto; }
  .slide { position: static; opacity: 1; transform: none; page-break-after: always; height: 100vh; }
}
