/* ============ 生日模块（我们的故事） ============ */

/* ---------- 气球 ---------- */
.bd-balloons {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.balloon {
  position: absolute;
  width: var(--w, 54px);
  height: auto;
  filter: drop-shadow(0 8px 12px rgba(160, 110, 90, .12));
  animation: bdFloat var(--t, 7s) ease-in-out infinite alternate;
}
.bl-body, .bl-knot { fill: var(--c, #efb1a4); }
.bl-shine { fill: rgba(255, 255, 255, .55); }
.bl-string { fill: none; stroke: rgba(160, 120, 110, .40); stroke-width: 1.6; }
.b1 { --w: 54px; --c: #eaa093; left: 7%;  top: 23%; --t: 7.2s; }
.b2 { --w: 44px; --c: #efc9a3; left: 17%; top: 63%; --t: 8.6s; animation-delay: -1.4s; }
.b3 { --w: 50px; --c: #d98a8e; right: 7%;  top: 31%; --t: 7.8s; animation-delay: -2.2s; }
.b4 { --w: 42px; --c: #e8d0a8; right: 16%; top: 67%; --t: 9s;   animation-delay: -.8s; }
@keyframes bdFloat {
  from { transform: translateY(0) rotate(-2.5deg); }
  to   { transform: translateY(-18px) rotate(2.5deg); }
}
body.dark .balloon { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .35)) brightness(.72) saturate(.95); }

/* ---------- 三角旗 ---------- */
.bd-bunting {
  width: min(560px, 80vw);
  margin: 0 auto 10px;
  transform-origin: 50% 0;
  animation: bdSway 6.5s ease-in-out infinite alternate;
  pointer-events: none;
}
.bd-bunting svg { width: 100%; height: auto; display: block; }
.bu-rope { fill: none; stroke: rgba(176, 130, 110, .50); stroke-width: 2; }
.bu-flag { opacity: .93; }
.f1, .f5 { fill: #eaa093; }
.f2, .f6 { fill: #efc9a3; }
.f3, .f7 { fill: #d98a8e; }
.f4, .f8 { fill: #f2ddc2; }
@keyframes bdSway {
  from { transform: rotate(-1.2deg); }
  to   { transform: rotate(1.2deg); }
}
body.dark .bu-flag { opacity: .8; }

/* ---------- 封面上的生日蛋糕 ---------- */
.home-bd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 26px 0 0;
}
.home-bd .bd-cake { width: clamp(176px, 21vw, 244px); }
.home-bd-line {
  margin: 2px 0 0;
  font-size: 12px;
  letter-spacing: .1em;
  color: #b2958a;
  text-align: center;
  transition: color .3s;
}
body.dark .home-bd-line { color: #8d7f88; }

/* ---------- 封面上的生日入口 ---------- */
.entry--bd .entry-icon { color: #c07a6e; background: rgba(232, 143, 128, .13); }

.entry--bd-on {
  background: linear-gradient(155deg, #fff8f4 0%, #fdebe5 100%);
  box-shadow: 0 2px 4px rgba(150, 100, 80, .07),
              0 14px 32px rgba(196, 110, 98, .16),
              inset 0 0 0 1px rgba(196, 110, 98, .26);
  animation: bdEntryPulse 3.4s ease-in-out infinite;
}
@keyframes bdEntryPulse {
  0%, 100% { box-shadow: 0 2px 4px rgba(150, 100, 80, .07), 0 14px 32px rgba(196, 110, 98, .16), inset 0 0 0 1px rgba(196, 110, 98, .26); }
  50%      { box-shadow: 0 2px 4px rgba(150, 100, 80, .07), 0 18px 40px rgba(196, 110, 98, .26), inset 0 0 0 1px rgba(196, 110, 98, .40); }
}

/* ---------- 页签上的生日项 ---------- */
.pn--bd { position: relative; }
.pn--bd::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  display: inline-block;
  vertical-align: 1px;
  background: var(--rose);
  opacity: .55;
  transition: opacity .25s, background .25s;
}
.pn--bd.on::before { background: #fff; opacity: .9; }
.pn--bd:hover::before { opacity: .9; }

/* ---------- 生日横幅（生日当天出现在所有页面） ---------- */
.bd-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 57;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 88vw;
  padding: 9px 16px 9px 13px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: .06em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(135deg, #d6887a 0%, var(--rose) 55%, #b3645a 100%);
  box-shadow: 0 10px 26px rgba(176, 96, 86, .30), inset 0 0 0 1px rgba(255, 255, 255, .22);
  animation: bdBannerIn .9s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes bdBannerIn {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.bd-banner-cake { font-size: 15px; line-height: 1; }
.bd-banner-go {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  transition: background .25s;
}
.bd-banner-go:hover { background: rgba(255, 255, 255, .30); }

/* ---------- 有横幅时，内容页页头让位 ---------- */
body.bd-on .page-head { padding-top: 152px; }
body.bd-on .hero--home { padding-top: 132px; }

/* ---------- 礼物盒 ---------- */
.bd-gift-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2px auto 0;
}
.bd-gift {
  width: clamp(84px, 11vw, 104px);
  height: auto;
  cursor: pointer;
  outline: none;
  filter: drop-shadow(0 14px 18px rgba(160, 108, 90, .14));
  transition: transform .45s cubic-bezier(.2, .8, .3, 1);
  -webkit-tap-highlight-color: transparent;
}
.bd-gift:hover { transform: translateY(-4px); }
.bd-gift:active { transform: translateY(0) scale(.97); }
.bd-gift:focus-visible { filter: drop-shadow(0 0 0 3px rgba(196, 110, 98, .40)); }
.gift-shadow { fill: rgba(160, 108, 90, .14); }
.gift-body { fill: #eaa093; }
.gift-lid-body { fill: #f0b3a6; }
.gift-ribbon-v, .gift-ribbon-h, .gift-bow { fill: #f6dfb3; }
.gift-knot { fill: #eed089; }
.gift-glow { fill: rgba(255, 214, 150, .55); opacity: 0; transition: opacity .5s ease; }
.gift-spark path { fill: #f4c96a; }
.gift-spark { opacity: 0; transition: opacity .5s ease .25s; }
.gift-lid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .55s cubic-bezier(.3, .9, .3, 1.2), opacity .45s ease;
}
.bd-gift.open .gift-lid { transform: translate(10px, -52px) rotate(24deg); opacity: 0; }
.bd-gift.open .gift-glow { opacity: 1; }
.bd-gift.open .gift-spark { opacity: .9; }

.bd-gift-hint {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  color: #b2958a;
  transition: opacity .3s;
}

/* 礼物卡浮层 */
.gift-card {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(74, 54, 46, .24);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.gift-card.show { opacity: 1; pointer-events: auto; }
.gift-card-inner {
  width: min(420px, 88vw);
  padding: 30px 28px 24px;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(165deg, #fffaf5 0%, #fdf0e8 100%);
  box-shadow: 0 18px 44px rgba(120, 70, 60, .18),
              inset 0 0 0 1px rgba(196, 110, 98, .18);
  transform: translateY(14px) scale(.97);
  transition: transform .42s cubic-bezier(.2, .8, .3, 1);
}
.gift-card.show .gift-card-inner { transform: none; }
.gift-card-kicker {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .34em;
  color: var(--gold);
}
.gift-card-rule {
  width: 36px;
  height: 1px;
  margin: 14px auto;
  background: linear-gradient(90deg, rgba(196, 110, 98, 0), rgba(196, 110, 98, .72), rgba(196, 110, 98, 0));
}
.gift-card-text {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 15.5px;
  line-height: 2.05;
  letter-spacing: .08em;
  color: var(--ink);
}
.gift-card-close {
  margin-top: 20px;
  padding: 9px 22px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: .12em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #d6887a 0%, var(--rose) 60%, #b3645a 100%);
  box-shadow: 0 8px 18px rgba(176, 96, 86, .28);
}
.gift-card-close:hover { filter: brightness(1.06); }

body.dark .bd-gift-hint { color: #8d7f88; }
body.dark .gift-body { fill: #c47467; }
body.dark .gift-lid-body { fill: #cf8478; }
body.dark .gift-ribbon-v,
body.dark .gift-ribbon-h,
body.dark .gift-bow { fill: #e7cd9f; }
body.dark .gift-knot { fill: #d8b878; }
body.dark .gift-card-inner {
  background: linear-gradient(165deg, #3a2f3a 0%, #2a232d 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(229, 146, 138, .20);
}
body.dark .gift-card-text { color: #f3ece7; }

/* ---------- 彩纸层 ---------- */
.bd-confetti {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  overflow: hidden;
}
.bd-confetti i {
  position: absolute;
  display: block;
  top: -14vh;
  border-radius: 1px;
  will-change: transform;
  animation: bdFall linear forwards;
  animation-iteration-count: 1;
}
.bd-confetti i.is-round { border-radius: 50%; }
@keyframes bdFall {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  8%   { opacity: 1; }
  100% { transform: translate3d(var(--dx, 40px), 118vh, 0) rotate(var(--rot, 540deg)); opacity: .0; }
}

/* ---------- 生日页：蛋糕 ---------- */
.bd-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 12px;
}

.bd-cake {
  width: clamp(250px, 48vw, 376px);
  height: auto;
  cursor: pointer;
  outline: none;
  filter: drop-shadow(0 22px 26px rgba(160, 108, 90, .16));
  transition: transform .5s cubic-bezier(.2, .8, .3, 1);
  -webkit-tap-highlight-color: transparent;
}
.bd-cake:hover { transform: translateY(-3px); }
.bd-cake:active { transform: translateY(0) scale(.985); }
.bd-cake:focus-visible { filter: drop-shadow(0 0 0 3px rgba(196, 110, 98, .45)) drop-shadow(0 22px 26px rgba(160, 108, 90, .16)); }

.bd-plate { fill: #f6e9e2; }
.bd-shadow { fill: rgba(160, 108, 90, .14); }
.bd-layer--low { fill: #f2c9bd; }
.bd-layer--up { fill: #f7d8cf; }
.bd-cream { fill: #fffaf5; }
.bd-cream--up { fill: #fffaf5; }
.bd-drips circle { fill: #fffaf5; }
.bd-drips--up circle { fill: #fffdf9; }

.bd-wax--1 { fill: #e88f80; }
.bd-wax--2 { fill: #f4d9a8; }
.bd-wax--3 { fill: #c9868f; }
.bd-wax--4 { fill: #9fb7c9; }
.bd-wax--5 { fill: #e8b96e; }

.bd-flame {
  fill: #ffcb62;
  transform-origin: 50% 100%;
  transition: opacity .35s ease, transform .35s ease;
  animation: bdFlicker .86s ease-in-out infinite alternate;
}
.bd-candle[data-i="0"] .bd-flame { animation-duration: .86s; animation-delay: 0s; }
.bd-candle[data-i="1"] .bd-flame { animation-duration: 1.02s; animation-delay: -.3s; }
.bd-candle[data-i="2"] .bd-flame { animation-duration: .74s; animation-delay: -.55s; }
.bd-candle[data-i="3"] .bd-flame { animation-duration: .94s; animation-delay: -.15s; }
.bd-candle[data-i="4"] .bd-flame { animation-duration: 1.1s; animation-delay: -.7s; }
@keyframes bdFlicker {
  0%   { transform: scale(1, 1) translateY(0); opacity: .92; }
  50%  { transform: scale(.92, 1.08) translateY(-1px); opacity: 1; }
  100% { transform: scale(1.06, .94) translateY(1px); opacity: .86; }
}

.bd-glow {
  fill: radial-gradient(rgba(255, 205, 120, .55), rgba(255, 205, 120, 0));
  fill: rgba(255, 202, 112, .28);
  filter: blur(3px);
  transition: opacity .4s;
}

/* 熄灭：火苗的 flicker 动画会盖掉这里的 opacity，得先把动画停掉才真的灭 */
.bd-candle.is-out .bd-flame { animation: none; opacity: 0; transform: scale(.35, .2) translateY(6px); }
.bd-candle.is-out .bd-glow { opacity: 0; }

/* 烟 */
.bd-smoke circle { fill: rgba(180, 170, 168, .55); opacity: 0; }
.bd-candle.is-out .bd-smoke circle { animation: bdSmoke 2.2s ease-out forwards; }
.bd-candle.is-out .bd-smoke circle:nth-child(2) { animation-delay: .18s; }
.bd-candle.is-out .bd-smoke circle:nth-child(3) { animation-delay: .36s; }
@keyframes bdSmoke {
  0%   { opacity: 0; transform: translateY(6px) scale(.5); }
  18%  { opacity: .55; }
  100% { opacity: 0; transform: translateY(-34px) scale(1.5); }
}

/* 吹灭瞬间的粒子消散：火苗位置散出一小簇火星和灰屑，往上飘散、缩没 */
.bd-parts { pointer-events: none; }
.bd-spark {
  opacity: .95;
  transform-box: fill-box;
  animation-duration: .7s;
  animation-name: bdSpark;
  animation-timing-function: cubic-bezier(.18, .62, .35, 1);
  animation-fill-mode: forwards;
}
@keyframes bdSpark {
  0%   { transform: translate(0, 0) scale(1); opacity: .96; }
  40%  { opacity: .8; }
  100% { transform: translate(var(--dx, 8px), var(--dy, -26px)) scale(.28); opacity: 0; }
}

/* 熄灭瞬间还有一圈很淡的暖光扩散 */
.bd-burst {
  fill: rgba(255, 200, 128, .26);
  transform-box: fill-box;
  animation: bdBurst .62s cubic-bezier(.2, .7, .35, 1) forwards;
}
@keyframes bdBurst {
  0%   { transform: scale(.35); opacity: .8; }
  100% { transform: scale(3.0); opacity: 0; }
}
.bd-spark--dust {
  animation-name: bdSparkDust;
  animation-timing-function: cubic-bezier(.3, .1, .7, .6);
}
@keyframes bdSparkDust {
  0%   { transform: translate(0, 0) scale(.9); opacity: .8; }
  30%  { opacity: .55; }
  100% { transform: translate(var(--dx, 4px), var(--dy, -34px)) scale(.5); opacity: 0; }
}

.bd-hint {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  color: #b2958a;
  transition: color .3s, opacity .3s;
}
.bd-cake.is-blown ~ .bd-hint { color: var(--rose-d); }

.bd-wishline {
  margin: 14px auto 0;
  max-width: 460px;
  text-align: center;
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 15px;
  letter-spacing: .12em;
  line-height: 2.1;
  color: #8b7368;
}

/* 吹完后的祝福浮层 */
.bd-toast {
  position: fixed;
  left: 50%;
  bottom: 12vh;
  transform: translate(-50%, 18px);
  z-index: 72;
  pointer-events: none;
  opacity: 0;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 15px;
  letter-spacing: .14em;
  color: #fff;
  background: linear-gradient(135deg, #d6887a, var(--rose) 60%, #b3645a);
  box-shadow: 0 16px 40px rgba(150, 90, 80, .34);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .3, 1);
}
.bd-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 生日倒计时 ---------- */
.bd-counts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 340px;
  margin: 26px auto 0;
  padding: 0 2px;
}

.bd-count {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 20px 14px 18px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 253, 251, .92);
  box-shadow: 0 1px 2px rgba(150, 100, 80, .06),
              0 10px 26px rgba(150, 100, 80, .09),
              inset 0 0 0 1px rgba(185, 142, 122, .14);
}

.bd-count.is-today {
  background: linear-gradient(160deg, #fff6f1, #fde7e1);
  box-shadow: 0 2px 4px rgba(150, 100, 80, .08),
              0 16px 34px rgba(196, 110, 98, .18),
              inset 0 0 0 1px rgba(196, 110, 98, .30);
}

.bd-count-name {
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 15.5px;
  letter-spacing: .12em;
  color: var(--ink);
}

.bd-count-date {
  font-size: 10.5px;
  letter-spacing: .22em;
  color: #bb9f93;
}

.bd-count-num {
  margin-top: 6px;
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: .02em;
  color: var(--rose);
  font-variant-numeric: tabular-nums;
}
.bd-count-num--today {
  font-size: 26px;
  letter-spacing: .16em;
  color: var(--rose-d);
  margin-top: 10px;
}
.bd-count-num--none { color: #cfbcb2; }

.bd-count-note {
  font-size: 11px;
  letter-spacing: .16em;
  color: #a08a7e;
}

.bd-tip {
  margin: 26px auto 0;
  max-width: 560px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.9;
  color: #a4968e;
}

/* ---------- 夜间 ---------- */
body.dark .entry--bd-on {
  background: linear-gradient(155deg, rgba(66, 44, 46, .95), rgba(48, 34, 42, .95));
  box-shadow: inset 0 0 0 1px rgba(229, 146, 138, .30), 0 16px 36px rgba(0, 0, 0, .40);
}
body.dark .bd-banner {
  background: linear-gradient(135deg, #8d4e47, #a5534a 60%, #6f3c37);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
body.dark .bd-count {
  background: rgba(38, 32, 42, .92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), 0 12px 30px rgba(0, 0, 0, .35);
}
body.dark .bd-count.is-today {
  background: linear-gradient(160deg, rgba(66, 42, 46, .95), rgba(48, 34, 42, .95));
  box-shadow: inset 0 0 0 1px rgba(229, 146, 138, .32), 0 16px 34px rgba(0, 0, 0, .40);
}
body.dark .bd-count-name { color: #f3ece7; }
body.dark .bd-count-date { color: #8d7f88; }
body.dark .bd-count-num { color: #ef9a92; }
body.dark .bd-count-num--today { color: #f7b3a9; }
body.dark .bd-count-num--none { color: #6a5d66; }
body.dark .bd-count-note { color: #9c8c94; }
body.dark .bd-hint { color: #8d7f88; }
body.dark .bd-cake.is-blown ~ .bd-hint { color: #ef9a92; }
body.dark .bd-wishline { color: #b6a8ad; }
body.dark .bd-tip { color: #8d7f88; }
body.dark .bd-plate { fill: #5a4b52; }
body.dark .bd-layer--low { fill: #8f6559; }
body.dark .bd-layer--up { fill: #a3766a; }
body.dark .bd-cream, body.dark .bd-cream--up,
body.dark .bd-drips circle, body.dark .bd-drips--up circle { fill: #f2e6dc; }
body.dark .bd-flame { fill: #ffd27a; }

/* ---------- 手机 ---------- */
@media (max-width: 760px) {
  body.bd-on .page-head { padding-top: 132px; }
  .b1, .b3 { --w: 40px; }
  .b2, .b4 { --w: 32px; }
  .bd-bunting { width: 90vw; margin-bottom: 6px; }
  .bd-banner {
    top: 64px;
    padding: 7px 12px;
    font-size: 12px;
    gap: 8px;
  }
  .bd-banner-go { font-size: 11px; padding: 2px 8px; }
  .bd-counts { gap: 10px; margin-top: 20px; padding: 0; }
  .bd-count { padding: 16px 10px 14px; border-radius: 15px; }
  .bd-count-num { font-size: 30px; }
  .bd-count-num--today { font-size: 21px; }
  .bd-stage { padding-top: 0; }
  .bd-wishline { font-size: 13.5px; }
}

@media (max-width: 420px) {
  .bd-banner {
    top: 60px;
    font-size: 11.5px;
    max-width: 92vw;
  }
  .bd-counts { grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 300px; }
  .bd-count-num { font-size: 26px; }
}

/* 页签多了一个，窄屏收一收，别把右上角的开关挤掉 */
@media (max-width: 520px) {
  .pagenav { gap: 0; padding: 4px; }
  .pn { padding: 6px 9px; font-size: 11.5px; letter-spacing: .04em; }
  .b2, .b4 { display: none; }
  .bd-gift { width: 78px; }
}
