/* ============ 鹊桥相会 · 七夕沉浸式叙事站 ============ */
:root {
  --gold: #f5d06f;
  --gold-soft: #f7e7b0;
  --ink: #e8e6f0;
  --bg: #05070f;
  --serif: "STZhongsong", "Songti SC", "SimSun", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ---------- 画布与氛围层 ---------- */
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }

#grade { position: fixed; inset: 0; pointer-events: none; }

#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
}

/* ---------- 顶部 UI ---------- */
#chapter {
  position: fixed; top: 28px; left: 34px; z-index: 55;
  display: flex; align-items: center; gap: 12px;
  pointer-events: none;
}
#chapter .no {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--gold); font-size: 14px; opacity: 0.85;
}
#chapter .line {
  width: 26px; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
#chapter .title {
  font-size: 14px; letter-spacing: 0.5em; color: var(--ink); opacity: 0.92;
}
#chapter.swap .title { animation: chFade 0.7s ease; }
@keyframes chFade {
  0% { opacity: 0; transform: translateY(7px); }
  100% { opacity: 0.92; transform: none; }
}

#soundBtn {
  position: fixed; top: 22px; right: 30px; z-index: 70;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(245, 208, 111, 0.4);
  background: rgba(10, 14, 30, 0.35);
  backdrop-filter: blur(6px);
  color: var(--gold); font-size: 18px; cursor: pointer;
  transition: all 0.3s;
}
#soundBtn:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(245, 208, 111, 0.3); }
#soundBtn.muted { opacity: 0.45; text-decoration: line-through; }

/* ---------- 底部进度 ---------- */
#progress-wrap {
  position: fixed; left: 34px; right: 34px; bottom: 26px; height: 1px;
  background: rgba(232, 230, 240, 0.16); z-index: 55;
}
#progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  box-shadow: 0 0 8px rgba(245, 208, 111, 0.7);
}
#progress-dot {
  position: absolute; top: -3.5px; width: 8px; height: 8px;
  background: var(--gold); border-radius: 50%;
  left: 0%; transform: translateX(-50%);
  box-shadow: 0 0 12px var(--gold);
}

/* ---------- 滚动提示 ---------- */
#hint {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%);
  font-size: 12px; letter-spacing: 0.5em; padding-left: 0.5em;
  color: rgba(232, 230, 240, 0.75);
  opacity: 0; transition: opacity 1s; pointer-events: none; z-index: 55;
  white-space: nowrap;
}
#hint.show { opacity: 1; }
#hint .arr { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- 开场标题 ---------- */
#title {
  position: fixed; inset: 0; z-index: 45;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity 1.2s;
}
#title h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(34px, 7vw, 66px);
  letter-spacing: 0.26em; padding-left: 0.26em; text-align: center;
  background: linear-gradient(180deg, #fff8e7 0%, #f5d06f 58%, #c99a3f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(245, 208, 111, 0.22));
}
#title .sub {
  margin-top: 20px; font-size: 13px; letter-spacing: 0.55em; padding-left: 0.55em;
  color: rgba(232, 230, 240, 0.8);
}
#title .deco { margin-top: 28px; color: var(--gold); font-size: 11px; letter-spacing: 0.35em; padding-left: 0.35em; }

/* ---------- 鹊桥蓄力 ---------- */
#hold {
  position: fixed; inset: 0; z-index: 48;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity 0.8s;
}
#hold.show { opacity: 1; }
#hold .ring { position: relative; width: 118px; height: 118px; }
#hold svg { transform: rotate(-90deg); }
#hold .track { stroke: rgba(245, 208, 111, 0.18); fill: none; stroke-width: 2; }
#hold .val {
  stroke: var(--gold); fill: none; stroke-width: 2.5; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(245, 208, 111, 0.9));
}
#hold p {
  margin-top: 24px; font-size: 13px; letter-spacing: 0.45em; padding-left: 0.45em;
  color: rgba(232, 230, 240, 0.92); text-align: center;
}
#hold p.done { color: var(--gold); }

/* ---------- 弹层通用 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 14, 0.8);
  backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: opacity 0.9s;
}
.modal.show { opacity: 1; pointer-events: auto; }

.card {
  width: min(440px, calc(100vw - 48px)); max-height: 88vh; overflow: auto;
  background: linear-gradient(160deg, rgba(22, 28, 56, 0.92), rgba(10, 14, 30, 0.95));
  border: 1px solid rgba(245, 208, 111, 0.28);
  border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.6);
}
.card h1 {
  font-family: var(--serif); font-weight: 600; font-size: 27px;
  letter-spacing: 0.3em; padding-left: 0.3em; text-align: center;
  background: linear-gradient(180deg, #fff8e7, #f5d06f 60%, #c99a3f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card .sub { margin-top: 12px; text-align: center; font-size: 12.5px; letter-spacing: 0.4em; padding-left: 0.4em; color: rgba(232, 230, 240, 0.65); }
.card label {
  display: block; margin: 20px 0 8px; font-size: 12px; letter-spacing: 0.3em;
  color: rgba(232, 230, 240, 0.7);
}
.card input, .card textarea {
  width: 100%; background: rgba(5, 8, 18, 0.6);
  border: 1px solid rgba(232, 230, 240, 0.18); border-radius: 8px;
  color: var(--ink); padding: 12px 14px; font-size: 15px;
  outline: none; transition: border-color 0.3s; font-family: inherit;
}
.card input:focus, .card textarea:focus { border-color: rgba(245, 208, 111, 0.6); }
.card textarea { resize: none; line-height: 1.9; height: 116px; }

.btn {
  display: block; width: 100%; margin-top: 28px; padding: 14px 0;
  border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #f7e7b0, #e8b64f);
  color: #2a1e08; font-size: 15px; letter-spacing: 0.4em; padding-left: 0.4em;
  font-family: inherit; transition: all 0.3s;
}
.btn:hover { box-shadow: 0 0 28px rgba(245, 208, 111, 0.45); transform: translateY(-1px); }
.btn.ghost {
  background: transparent; color: rgba(232, 230, 240, 0.85);
  border: 1px solid rgba(232, 230, 240, 0.3); margin-top: 14px;
}
.link {
  display: block; margin-top: 20px; text-align: center; cursor: pointer;
  font-size: 12px; letter-spacing: 0.25em; padding-left: 0.25em;
  color: rgba(232, 230, 240, 0.5); transition: color 0.3s;
}
.link:hover { color: var(--gold); }

/* ---------- 情书 ---------- */
#letter .paper {
  position: relative; width: min(560px, calc(100vw - 48px)); max-height: 82vh; overflow: auto;
  background: linear-gradient(175deg, #fdf7e8, #f5ebd4);
  color: #3a2c1a; border-radius: 6px; padding: 46px 42px 40px 54px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), inset 0 0 70px rgba(180, 150, 90, 0.12);
  transform: rotate(0.6deg);
}
#letter .paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 34px; width: 1px;
  background: rgba(200, 80, 80, 0.25);
}
#letter .paper::after {
  content: "七夕"; position: absolute; top: 18px; right: 22px;
  width: 42px; height: 42px; line-height: 42px; text-align: center;
  font-family: var(--kai); font-size: 15px; color: #fff;
  background: rgba(196, 70, 62, 0.82); border-radius: 4px;
  transform: rotate(8deg); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
#letterDear { font-family: var(--kai); font-size: 21px; color: #7a3b2e; margin-bottom: 22px; }
#letterBody { font-family: var(--kai); font-size: 18px; line-height: 2.15; white-space: pre-wrap; min-height: 130px; }
#letterSign {
  margin-top: 28px; text-align: right; font-family: var(--kai);
  font-size: 16px; color: #7a3b2e; opacity: 0; transition: opacity 1.4s;
}
#letterBtn { width: auto; margin: 34px auto 0; padding: 12px 36px; display: none; }
#letterBtn.show { display: block; }

/* ---------- 纪念卡 ---------- */
#poster .card { text-align: center; }
#poster h2 {
  font-family: var(--serif); font-weight: 600; font-size: 24px;
  letter-spacing: 0.28em; padding-left: 0.28em;
  background: linear-gradient(180deg, #fff8e7, #f5d06f 60%, #c99a3f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#posterNames { margin-top: 22px; font-family: var(--kai); font-size: 21px; letter-spacing: 0.2em; padding-left: 0.2em; }
#posterDate { margin-top: 12px; font-size: 13px; letter-spacing: 0.3em; padding-left: 0.3em; color: rgba(232, 230, 240, 0.7); }
#poster .deco { margin-top: 20px; color: var(--gold); font-size: 12px; letter-spacing: 0.4em; padding-left: 0.4em; }

/* ---------- 兜底 ---------- */
#fallback {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px; font-size: 15px; line-height: 2.2; letter-spacing: 0.1em;
  color: rgba(232, 230, 240, 0.85); background: var(--bg); z-index: 200;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  #chapter { top: 20px; left: 20px; }
  #soundBtn { top: 16px; right: 18px; width: 38px; height: 38px; }
  #progress-wrap { left: 20px; right: 20px; bottom: 22px; }
  #hint { bottom: 40px; }
  #letter .paper { padding: 40px 28px 34px 44px; }
  #letter .paper::before { left: 28px; }
}
