/* ============ 外层统一模板样式（所有人共用，固定不变） ============ */
:root {
  --ink: #fdf6ec;
  --ink-soft: rgba(253, 246, 236, 0.78);
  --ink-faint: rgba(253, 246, 236, 0.55);
  --gold: #f3c98b;
  --gold-deep: #d89a52;
  --night: #120f24;
  --glass: rgba(28, 22, 52, 0.42);
  --glass-line: rgba(255, 236, 210, 0.22);
  --radius: 22px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.intro-open { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- 固定背景 ---------- */
.bg {
  position: fixed; inset: 0; z-index: -2;
  background: url("../assets/bg.svg") center / cover no-repeat, var(--night);
}
.bg-veil {
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 30%, transparent 0%, rgba(10, 8, 22, 0.55) 75%);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: 0 20px 60px rgba(5, 3, 15, 0.45);
}

/* ---------- 背景音乐按钮 ---------- */
.music-btn {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--glass-line); background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center;
}
.music-btn .disc { font-size: 18px; color: var(--gold); }
.music-btn.playing .disc { animation: spin 4s linear infinite; }
.music-btn:not(.playing) { opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 开场特效 ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; text-align: center;
  background: radial-gradient(ellipse at center, #241a45 0%, #0b0817 70%);
  transition: opacity 0.9s ease 1s, visibility 0s linear 1.9s;
}
#introCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.curtain {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background: linear-gradient(90deg, #0b0817, #1a1333);
  transition: transform 1.3s cubic-bezier(.7, 0, .2, 1);
  opacity: 0;
}
.curtain.left { left: 0; }
.curtain.right { right: 0; transform: scaleX(-1); }
.intro-inner { position: relative; padding: 0 16px; }
.intro-kicker {
  margin: 0 0 8px; font-family: var(--serif); letter-spacing: 0.5em; font-size: 13px;
  color: var(--gold); text-transform: uppercase; opacity: 0; animation: rise 1.2s ease 0.3s forwards;
}
.intro-title {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: clamp(64px, 16vw, 140px); letter-spacing: 0.25em; line-height: 1.2;
  padding-left: 0.25em;
}
.intro-title span {
  display: inline-block; opacity: 0; filter: blur(12px);
  text-shadow: 0 0 30px rgba(243, 201, 139, 0.65);
  animation: glowIn 1.6s ease forwards;
}
.intro-title span:nth-child(1) { animation-delay: 0.7s; }
.intro-title span:nth-child(2) { animation-delay: 1.2s; }
.intro-sub {
  margin: 18px 0 40px; color: var(--ink-soft); letter-spacing: 0.2em; font-size: 15px;
  opacity: 0; animation: rise 1.2s ease 2s forwards;
}
.enter-btn {
  padding: 12px 38px; border-radius: 999px; letter-spacing: 0.4em;
  border: 1px solid rgba(243, 201, 139, 0.6); background: rgba(243, 201, 139, 0.08);
  color: var(--gold); opacity: 0; animation: rise 1.2s ease 2.6s forwards, pulse 2.4s ease-in-out 3.8s infinite;
  transition: background 0.3s;
}
.enter-btn:hover { background: rgba(243, 201, 139, 0.2); }
@keyframes glowIn { to { opacity: 1; filter: blur(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(243, 201, 139, 0.35); } 50% { box-shadow: 0 0 0 12px rgba(243, 201, 139, 0); } }

/* 开启：文字散开 + 帘幕向两侧拉开 */
body.entered .intro { opacity: 0; visibility: hidden; }
body.entered .intro-inner { transition: opacity 0.6s, transform 0.9s; opacity: 0; transform: scale(1.15); }
body.entered .curtain { opacity: 1; }
body.entered .curtain.left { transform: translateX(-100%); }
body.entered .curtain.right { transform: scaleX(-1) translateX(-100%); }

/* ---------- 密码门 ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(420px, 100%); padding: 40px 28px 30px; text-align: center; }
body.entered .gate-card { animation: rise 1s ease 1.2s both; }
.gate-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: 0.12em; }
.gate-hint { margin: 6px 0 26px; color: var(--ink-faint); font-size: 14px; letter-spacing: 0.1em; }
#gateForm { display: flex; gap: 10px; }
#pw {
  flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; font-size: 16px;
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.08); color: var(--ink);
  outline: none; transition: border-color 0.3s, background 0.3s; letter-spacing: 0.1em;
}
#pw::placeholder { color: var(--ink-faint); }
#pw:focus { border-color: var(--gold); background: rgba(255, 255, 255, 0.12); }
#unlockBtn {
  padding: 12px 22px; border-radius: 999px; border: 0; letter-spacing: 0.2em;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #2a1a08; font-weight: 500;
}
#unlockBtn:disabled { opacity: 0.6; cursor: wait; }
.gate-msg { min-height: 1.8em; margin: 14px 0 0; font-size: 14px; color: #ffb8a8; }
.gate-card.shake { animation: shake 0.45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- 专属页面 ---------- */
.personal { width: min(760px, 100%); margin: 0 auto; padding: 80px 16px 60px; }
.personal-head { text-align: center; margin-bottom: 48px; animation: rise 1.2s ease both; }
.personal-kicker { margin: 0; font-family: var(--serif); color: var(--gold); letter-spacing: 0.5em; font-size: 13px; text-transform: uppercase; }
.personal-name {
  margin: 4px 0 6px; font-family: var(--serif); font-weight: 700;
  font-size: clamp(36px, 9vw, 60px); letter-spacing: 0.12em;
  text-shadow: 0 0 28px rgba(243, 201, 139, 0.5);
}
.personal-title { margin: 0; color: var(--ink-soft); letter-spacing: 0.15em; }

.blocks { display: flex; flex-direction: column; gap: 28px; }
.block { opacity: 0; transform: translateY(28px); transition: opacity 0.9s ease, transform 0.9s ease; }
.block.in { opacity: 1; transform: none; }
.block-text { padding: 28px 26px; font-family: var(--serif); font-size: 17px; line-height: 2; white-space: pre-line; }
.block-media { padding: 12px; }
.block-media img, .block-media video { display: block; width: 100%; border-radius: calc(var(--radius) - 8px); background: rgba(0, 0, 0, 0.25); }
.block-media .caption { margin: 10px 8px 2px; text-align: center; color: var(--ink-soft); font-size: 14px; letter-spacing: 0.08em; }
.media-loading, .media-missing {
  display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: calc(var(--radius) - 8px);
  background: rgba(255, 255, 255, 0.05); color: var(--ink-faint); font-size: 14px; letter-spacing: 0.1em;
}

/* 彩蛋触发点：默认隐藏，无明显标识，只在悬停时有极轻微的变化 */
.egg-trigger { cursor: pointer; transition: text-shadow 0.4s, filter 0.4s; }
.egg-trigger:hover { text-shadow: 0 0 12px rgba(243, 201, 139, 0.55); }
img.egg-trigger:hover { filter: brightness(1.06); }

.personal-foot { text-align: center; margin-top: 56px; }
.ghost-btn {
  padding: 10px 26px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: transparent; color: var(--ink-faint); letter-spacing: 0.2em; font-size: 14px;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--gold); }

/* ---------- 彩蛋弹窗 ---------- */
.egg {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 5, 20, 0.6); animation: fade 0.35s ease;
}
.egg-card { position: relative; width: min(460px, 100%); max-height: 90vh; overflow: auto; padding: 30px 24px 26px; text-align: center; animation: pop 0.5s cubic-bezier(.2, 1.4, .4, 1); }
.egg-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ink-faint); }
.egg-img { display: block; width: 100%; border-radius: 14px; margin-bottom: 16px; }
.egg-text { margin: 0; font-family: var(--serif); font-size: 17px; white-space: pre-line; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.7); } }

.spark { position: fixed; z-index: 90; pointer-events: none; font-size: 16px; color: var(--gold); animation: spark 0.9s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(0.4); opacity: 0; } }

/* ---------- 音频块、加载进度、预览条 ---------- */
.block-audio { padding: 18px 18px 14px; }
.block-audio audio { display: block; width: 100%; height: 44px; }
.block-audio .caption { margin: 10px 4px 0; text-align: center; color: var(--ink-soft); font-size: 14px; letter-spacing: 0.08em; }
.audio-loading { height: 44px; display: grid; place-items: center; }
.progress { width: min(240px, 70%); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); transition: width 0.2s; }
.media-loading { flex-direction: column; display: flex; align-items: center; justify-content: center; }

.preview-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120; padding: 6px 60px 6px 16px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: rgba(243, 201, 139, 0.92); color: #2a1a08; font-size: 13px; text-align: center; letter-spacing: 0.1em;
}

/* 手机安全区 */
.music-btn { top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
.preview-bar:not([hidden]) ~ .music-btn, body.previewing .music-btn { top: 44px; }
@media (max-width: 480px) {
  .personal { padding-top: 64px; }
  .block-text { padding: 22px 18px; font-size: 16px; }
  .gate-card { padding: 32px 20px 24px; }
  #gateForm { flex-direction: column; }
  #unlockBtn { padding: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}
