/* ============================================================
   鹊桥星河 · 七夕主题样式
   色板：苍穹墨 / 银河蓝 / 星光白 / 鹊金 / 织女红 / 月白
   ============================================================ */
:root {
  --ink: #060918;          /* 苍穹墨：深夜底色 */
  --ink-2: #0b1030;
  --nebula: #8b9df9;       /* 银河蓝辉 */
  --nebula-deep: #2e3a87;
  --starlight: #f5f3ff;    /* 星光白 */
  --gold: #f7c873;         /* 鹊金：喜鹊羽翼的暖光 */
  --rose: #ff8faf;         /* 织女红：红线与心动 */
  --mist: #c9cfef;         /* 月白：正文 */
  --font-display: "Kaiti SC", "STKaiti", "KaiTi", "DFKai-SB", "AR PL UKai CN", "cursive", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-num: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(120vmax 90vmax at 78% 18%, rgba(46, 58, 135, .35), transparent 55%),
    radial-gradient(90vmax 70vmax at 18% 85%, rgba(24, 20, 66, .55), transparent 60%),
    var(--ink);
  color: var(--starlight);
  font-family: var(--font-body);
  overflow: hidden;
  touch-action: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 银河辉光带（斜贯天空） ---------- */
.nebula {
  position: fixed; inset: -20%;
  z-index: 1; pointer-events: none;
  background:
    radial-gradient(42vmax 16vmax at 50% 46%, rgba(139, 157, 249, .20), transparent 70%),
    radial-gradient(30vmax 11vmax at 42% 40%, rgba(255, 143, 175, .10), transparent 70%),
    radial-gradient(26vmax 10vmax at 60% 52%, rgba(247, 200, 115, .08), transparent 70%);
  transform: rotate(-16deg);
  animation: nebula-drift 26s ease-in-out infinite alternate;
}
@keyframes nebula-drift {
  from { transform: rotate(-16deg) translateX(-2.5%); }
  to   { transform: rotate(-14deg) translateX(2.5%); }
}

#sky { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#fx  { position: fixed; inset: 0; z-index: 30; pointer-events: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; z-index: 20;
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 3vw, 28px);
}
.brand {
  font-family: var(--font-display);
  font-size: 15px; letter-spacing: .32em;
  color: rgba(201, 207, 239, .75);
}
.ghost-btn {
  font-family: var(--font-body); font-size: 13px; letter-spacing: .12em;
  color: var(--mist); background: transparent;
  border: 1px solid rgba(201, 207, 239, .28); border-radius: 999px;
  padding: 7px 18px; cursor: pointer;
  transition: border-color .3s, color .3s;
}
.ghost-btn:hover, .ghost-btn:focus-visible { border-color: var(--gold); color: var(--gold); }
.ghost-btn:focus-visible, .primary-btn:focus-visible, .chevron:focus-visible,
.knot:focus-visible, .text-link:focus-visible, .guide-close:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}

/* ---------- 幻灯片 ---------- */
.deck {
  position: relative; z-index: 10;
  display: flex; height: 100dvh;
  transition: transform .95s cubic-bezier(.22, .9, .28, 1);
  will-change: transform;
}
.slide {
  flex: 0 0 100vw; height: 100%;
  display: grid; place-items: center;
  padding: clamp(72px, 12vh, 120px) clamp(20px, 6vw, 72px) clamp(88px, 14vh, 132px);
  position: relative; overflow: hidden;
}

/* 入场编排：仅活动页的 reveal 元素浮现 */
.reveal { opacity: 0; transform: translateY(26px); }
.slide.is-active .reveal {
  opacity: 1; transform: translateY(0);
  transition: opacity .9s ease, transform .9s cubic-bezier(.22, .9, .28, 1);
}
.slide.is-active .reveal:nth-child(1) { transition-delay: .15s; }
.slide.is-active .reveal:nth-child(2) { transition-delay: .30s; }
.slide.is-active .reveal:nth-child(3) { transition-delay: .45s; }
.slide.is-active .reveal:nth-child(4) { transition-delay: .60s; }
.slide.is-active .reveal:nth-child(5) { transition-delay: .75s; }

/* ---------- 封面 ---------- */
.cover { text-align: center; }
.eyebrow {
  font-size: clamp(12px, 1.6vw, 14px);
  letter-spacing: .42em; text-indent: .42em;
  color: rgba(201, 207, 239, .68); margin-bottom: 26px;
}
.title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5.6rem);
  font-weight: 400; letter-spacing: .12em; text-indent: .12em;
  text-shadow: 0 0 34px rgba(139, 157, 249, .5), 0 0 90px rgba(139, 157, 249, .25);
  margin-bottom: 18px;
}
.names {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  letter-spacing: .28em; color: var(--mist);
}
.heart-ico {
  font-style: normal; color: var(--rose); margin: 0 .55em;
  display: inline-block; animation: heartbeat 1.8s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(255, 143, 175, .65);
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.22); }
  24% { transform: scale(1); }
}
.counter { margin: 34px 0 40px; }
.counter b {
  font-family: var(--font-num); font-weight: 600;
  font-size: clamp(3.4rem, 8vw, 5rem); color: var(--gold);
  text-shadow: 0 0 26px rgba(247, 200, 115, .35);
}
.counter .unit { font-size: 1rem; color: var(--gold); margin-left: 8px; letter-spacing: .3em; }
.counter em {
  display: block; font-style: normal; margin-top: 10px;
  font-size: 13px; letter-spacing: .22em; color: rgba(201, 207, 239, .6);
}
.primary-btn {
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  letter-spacing: .18em; text-indent: .18em;
  color: #241505; background: linear-gradient(135deg, #ffe3ae, var(--gold) 55%, #e2a94f);
  border: none; border-radius: 999px;
  padding: 15px 40px; cursor: pointer;
  box-shadow: 0 8px 32px rgba(247, 200, 115, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .25s, box-shadow .25s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 42px rgba(247, 200, 115, .4); }
.text-link {
  display: block; margin: 18px auto 0;
  background: none; border: none; cursor: pointer;
  font-size: 13px; letter-spacing: .1em;
  color: rgba(201, 207, 239, .55);
  border-bottom: 1px dashed rgba(201, 207, 239, .3);
  padding-bottom: 3px;
  transition: color .3s;
}
.text-link:hover { color: var(--mist); }
.hint {
  margin-top: 30px; font-size: 12.5px;
  letter-spacing: .14em; color: rgba(201, 207, 239, .5);
}

/* 竖排诗句：右侧而立的《鹊桥仙》 */
.poem span { display: block; }
.poem {
  position: absolute; right: clamp(10px, 5.5vw, 76px); top: 50%;
  transform: translateY(-52%);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: clamp(15px, 2.2vw, 20px);
  letter-spacing: .5em; line-height: 2.4;
  color: rgba(201, 207, 239, .62);
  padding-left: 18px;
  border-left: 1px solid rgba(247, 200, 115, .3);
  user-select: none;
}
@media (max-width: 640px) { .poem { display: none; } }

/* ---------- 回忆卡片（星河上的灯） ---------- */
.lantern {
  position: relative;
  max-width: 620px; width: 100%;
  text-align: center;
  padding: clamp(34px, 6vw, 58px) clamp(26px, 5vw, 56px);
  background: linear-gradient(165deg, rgba(245, 243, 255, .065), rgba(139, 157, 249, .03) 60%, rgba(255, 143, 175, .04));
  border: 1px solid rgba(247, 200, 115, .22);
  border-radius: 16px;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(245, 243, 255, .07);
  animation: lantern-float 6.5s ease-in-out infinite;
}
@keyframes lantern-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.lantern::before {
  content: "✦";
  position: absolute; top: 14px; left: 18px;
  color: var(--gold); font-size: 12px; opacity: .7;
}
.lantern::after {
  content: "✦";
  position: absolute; bottom: 14px; right: 18px;
  color: var(--rose); font-size: 10px; opacity: .6;
}
.m-date {
  font-family: var(--font-num); font-style: italic;
  font-size: clamp(15px, 2.4vw, 19px);
  color: var(--gold); letter-spacing: .24em;
  margin-bottom: 18px;
}
.m-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 5.4vw, 3.1rem);
  letter-spacing: .14em; text-indent: .14em;
  text-shadow: 0 0 26px rgba(139, 157, 249, .4);
  margin-bottom: 24px;
}
.m-text {
  color: var(--mist); line-height: 2.15;
  font-size: clamp(14.5px, 2vw, 16.5px);
  letter-spacing: .04em;
  white-space: pre-line; /* data.js 里的 \n 直接换行 */
}

/* ---------- 终章 ---------- */
.finale { text-align: center; }
#constellation {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: -1;
}
#constellation polyline {
  fill: none; stroke: rgba(255, 143, 175, .75);
  stroke-width: 1.6; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(255, 143, 175, .55));
}
#constellation line {
  stroke: rgba(201, 207, 239, .22); stroke-width: 1;
}
#constellation circle { fill: var(--starlight); }
#constellation text {
  font-family: var(--font-display); font-size: 20px;
  fill: rgba(201, 207, 239, .7); letter-spacing: .3em;
}
.finale-copy h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: .16em; text-indent: .16em;
  text-shadow: 0 0 30px rgba(255, 143, 175, .4);
  margin: 14px 0 26px;
}
.finale-text { color: var(--mist); line-height: 2.1; font-size: clamp(14.5px, 2vw, 16.5px); }
.finale-sign {
  margin-top: 22px;
  font-family: var(--font-display);
  color: var(--gold); letter-spacing: .18em; font-size: 15.5px;
}

/* ---------- 底部红线进度（月老的红线） ---------- */
.thread {
  position: fixed; z-index: 20;
  left: 50%; bottom: clamp(26px, 5vh, 44px);
  transform: translateX(-50%);
  width: min(560px, 74vw);
}
.thread-line {
  position: relative; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 143, 175, .65) 18%, rgba(247, 200, 115, .65) 82%, transparent);
  display: flex; justify-content: space-between; align-items: center;
}
.knot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink);
  border: 1px solid rgba(247, 200, 115, .55);
  cursor: pointer; padding: 0;
  transition: transform .35s, background .35s, box-shadow .35s, border-color .35s;
}
.knot:hover { border-color: var(--gold); transform: scale(1.3); }
.knot.is-active {
  background: var(--gold); border-color: var(--gold);
  box-shadow: 0 0 14px rgba(247, 200, 115, .8);
  transform: scale(1.35);
}

/* ---------- 侧边翻页按钮 ---------- */
.chevron {
  position: fixed; z-index: 20; top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(6, 9, 24, .45);
  border: 1px solid rgba(201, 207, 239, .22);
  color: var(--mist); font-size: 22px; line-height: 1;
  cursor: pointer; opacity: .55;
  transition: opacity .3s, border-color .3s, color .3s;
  backdrop-filter: blur(4px);
}
.chevron:hover { opacity: 1; border-color: var(--gold); color: var(--gold); }
#prevBtn { left: clamp(10px, 2vw, 26px); }
#nextBtn { right: clamp(10px, 2vw, 26px); }
@media (max-width: 640px) { .chevron { display: none; } }

/* ---------- 手势 HUD ---------- */
.hud {
  position: fixed; z-index: 35;
  right: clamp(12px, 2.5vw, 26px); bottom: clamp(70px, 12vh, 96px);
  width: 172px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(247, 200, 115, .3);
  background: rgba(6, 9, 24, .72);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
}
.hud-view { position: relative; width: 100%; height: 124px; }
#cam {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); /* 镜像预览，符合照镜子直觉 */
}
#hudCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud-status {
  padding: 7px 10px; text-align: center;
  font-size: 12px; letter-spacing: .1em;
  color: var(--gold);
  border-top: 1px solid rgba(247, 200, 115, .18);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 提示 Toast ---------- */
.toast {
  position: fixed; z-index: 40;
  top: 64px; left: 50%; transform: translateX(-50%);
  padding: 10px 26px; border-radius: 999px;
  background: rgba(6, 9, 24, .8);
  border: 1px solid rgba(247, 200, 115, .4);
  color: var(--starlight); font-size: 14px; letter-spacing: .12em;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  transition: opacity .35s, transform .35s;
}
.toast.hide { opacity: 0; transform: translateX(-50%) translateY(-8px); }

/* ---------- 手势指南面板 ---------- */
.guide {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(4, 6, 16, .62);
  backdrop-filter: blur(4px);
}
.guide[hidden] { display: none; } /* hidden 属性优先于 display:grid */
.guide-card {
  position: relative;
  width: min(430px, calc(100vw - 40px));
  padding: 38px 36px 30px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(245, 243, 255, .07), rgba(139, 157, 249, .04));
  border: 1px solid rgba(247, 200, 115, .28);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.guide-card h3 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 22px; letter-spacing: .2em; text-indent: .2em;
  text-align: center; margin-bottom: 26px;
  text-shadow: 0 0 20px rgba(139, 157, 249, .4);
}
.guide-card ul { list-style: none; }
.guide-card li {
  display: flex; align-items: center; gap: 18px;
  padding: 13px 4px;
  border-bottom: 1px dashed rgba(201, 207, 239, .16);
}
.guide-card li:last-child { border-bottom: none; }
.g-ico { font-size: 26px; width: 40px; text-align: center; }
.guide-card b { display: block; font-size: 15px; letter-spacing: .1em; color: var(--starlight); }
.guide-card i { display: block; font-style: normal; font-size: 12.5px; color: rgba(201, 207, 239, .62); margin-top: 3px; }
.guide-note {
  margin-top: 20px; text-align: center;
  font-size: 12px; color: rgba(201, 207, 239, .5); letter-spacing: .05em;
}
.guide-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: none; border: none;
  color: var(--mist); font-size: 20px; cursor: pointer;
}
.guide-close:hover { color: var(--gold); }

/* ---------- 喜鹊飞过 ---------- */
.magpie {
  position: fixed; z-index: 32;
  top: 24%; left: -120px;
  width: 76px; pointer-events: none;
  animation: magpie-fly 2.4s cubic-bezier(.45, .05, .55, .95) forwards;
}
.magpie.backward { animation-name: magpie-fly-back; }
@keyframes magpie-fly {
  0%   { transform: translate(0, 0) rotate(6deg); }
  25%  { transform: translate(28vw, -3vh) rotate(2deg); }
  50%  { transform: translate(55vw, 2vh) rotate(-2deg); }
  75%  { transform: translate(82vw, -2vh) rotate(2deg); }
  100% { transform: translate(115vw, 0) rotate(-4deg); }
}
@keyframes magpie-fly-back {
  0%   { transform: translate(115vw, 0) scaleX(-1) rotate(6deg); }
  50%  { transform: translate(55vw, 2vh) scaleX(-1) rotate(-2deg); }
  100% { transform: translate(-15vw, 0) scaleX(-1) rotate(4deg); }
}
.magpie .wing-l { animation: flap-l .34s ease-in-out infinite alternate; transform-origin: 38px 30px; }
.magpie .wing-r { animation: flap-r .34s ease-in-out infinite alternate; transform-origin: 38px 30px; }
@keyframes flap-l { from { transform: rotate(14deg); } to { transform: rotate(-26deg); } }
@keyframes flap-r { from { transform: rotate(-14deg); } to { transform: rotate(26deg); } }

/* ---------- 降级与可访问性 ---------- */
@media (prefers-reduced-motion: reduce) {
  .nebula, .heart-ico, .lantern, .magpie, .magpie .wing-l, .magpie .wing-r { animation: none !important; }
  .deck { transition-duration: .3s; }
  .slide.is-active .reveal { transition-duration: .2s; }
}
@media (max-height: 560px) {
  .counter { margin: 18px 0 22px; }
  .hint { margin-top: 16px; }
}
