/* ============================================================
   辰途 · 我们的共同记录
   夜空 · 共同记忆 · 来信 · 成长 · 时间 · 祝福 · 陪伴
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
    --bg: #05060f;
    --bg-2: #0a0d1f;
    --indigo: #0d1228;
    --star-warm: #f6ecd8;
    --star-silver: #d7e0f0;
    --star-gold: #e9d3a0;
    --blue: #8fb4e6;
    --lavender: #b3a6e4;
    --text: #e8ecf6;
    --text-dim: #9aa3b8;
    --text-faint: #6b738a;
    --paper: rgba(238, 236, 228, 0.94);
    --paper-glow: rgba(255, 246, 224, 0.55);

    --serif: 'Cormorant Garamond', 'Playfair Display', 'Georgia', serif;
    --sans: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 1px solid rgba(143, 180, 230, 0.6); outline-offset: 4px; }

::selection { background: rgba(143, 180, 230, 0.25); }

/* ---------- 底层：星云 ---------- */
/* 基色：深邃蓝紫渐变 */
#nebula {
    position: fixed;
    inset: -4%;
    z-index: 0;
    background:
        radial-gradient(120% 80% at 70% 20%, rgba(38, 52, 110, 0.30), transparent 55%),
        radial-gradient(90% 70% at 20% 80%, rgba(56, 40, 92, 0.26), transparent 60%),
        radial-gradient(80% 60% at 50% 50%, rgba(20, 28, 60, 0.40), transparent 70%),
        linear-gradient(180deg, #060812 0%, #0a0e22 55%, #060812 100%);
}

/* 深空星云（STScI），可替换 /assets/home/nebula.jpg */
#nebula-deep {
    position: fixed;
    inset: -6%;
    z-index: 0;
    background-image: url('../assets/home/nebula.jpg');
    background-size: cover;
    background-position: center;
    mix-blend-mode: screen;
    opacity: 0.5;                        /* ← 调整透明度：越大越明显 */
    filter: saturate(1);
    animation: nebula-drift 80s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes nebula-drift {
    from { transform: scale(1) translate3d(0, 0, 0); }
    to   { transform: scale(1.08) translate3d(1.8%, -1.8%, 0); }
}

/* ---------- 星空画布 ---------- */
#sky {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: block;
    pointer-events: none;
}

/* ---------- 转场闪光 ---------- */
#flash {
    position: fixed;
    inset: 0;
    z-index: 3;
    background: radial-gradient(circle at center, #eaf2ff 0%, #d6e0ff 40%, #0a0d1f 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}
#flash.on { opacity: 1; }

/* ---------- 场景容器 ---------- */
.scene {
    position: fixed;
    inset: 0;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.scene.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================================
   场景 1 · 首页
   ============================================================ */
.home-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 24px;
}

.home-title { position: relative; opacity: 0; transition: opacity 1.4s var(--ease); }
.home-title.show { opacity: 1; }

.home-title .zh {
    font-size: clamp(2.1rem, 6vw, 3.5rem);
    font-weight: 300;
    letter-spacing: 0.18em;
    color: var(--star-warm);
    text-shadow: 0 0 24px rgba(246, 236, 216, 0.30);
}
.home-title .en {
    margin-top: 0.9rem;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.05rem, 2.6vw, 1.5rem);
    letter-spacing: 0.3em;
    color: var(--text-dim);
}
.home-title .sub {
    margin-top: 0.7rem;
    font-size: clamp(0.78rem, 1.9vw, 0.9rem);
    letter-spacing: 0.18em;
    color: var(--text-faint);
    opacity: 0.85;
}

/* 标题左右两侧散落的大号 emoji（错落拉开距离，不在一条线上） */
.home-title .he {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    margin-top: var(--dy, 0px);
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(246, 236, 216, 0.28));
    animation: emoji-breathe var(--d, 2.6s) ease-in-out var(--dl, 0s) infinite;
}
.home-title .he.left  { right: 100%; margin-right: var(--mx, 2rem); }
.home-title .he.right { left: 100%;  margin-left: var(--mx, 2rem); }

@keyframes emoji-breathe {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50%      { transform: translateY(calc(-50% - 9px)) scale(1.13); }
}

/* 两个入口：漂浮在星空中的文字 */
.home-entries {
    position: absolute;
    left: 50%;
    bottom: 14vh;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s var(--ease) 0.4s;
}
.home-entries.show { opacity: 1; pointer-events: auto; }

.entry {
    position: relative;
    font-family: var(--serif);
    font-weight: 300;
    letter-spacing: 0.42em;
    color: var(--star-silver);
    font-size: clamp(1.25rem, 3.6vw, 1.85rem);
    padding: 0.4em 0.8em;
    text-indent: 0.42em; /* 抵消字距带来的偏移，让文字居中 */
    transition: color 0.5s var(--ease), transform 0.6s var(--ease), text-shadow 0.5s var(--ease);
}
.entry .spark {
    position: absolute;
    right: -0.2em;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6em;
    opacity: 0.5;
    transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}
.entry.or { font-size: clamp(1.05rem, 3vw, 1.5rem); color: var(--text-dim); letter-spacing: 0.3em; }

.entry::before {
    content: '';
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 236, 216, 0.10) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.6s var(--ease);
    pointer-events: none;
}

.entry:hover { color: #fff; text-shadow: 0 0 18px rgba(246, 236, 216, 0.55); transform: scale(1.06); }
.entry:hover::before { opacity: 1; }
.entry:hover .spark { opacity: 1; transform: translateY(-50%) rotate(20deg) scale(1.15); }

/* 进度条加载 */
.loader {
    position: absolute;
    left: 50%;
    bottom: 18vh;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    transition: opacity 0.8s var(--ease);
}
.loader.done { opacity: 0; pointer-events: none; }

.loader-line {
    width: min(46vw, 280px);
    height: 1px;
    background: rgba(154, 163, 184, 0.18);
    overflow: hidden;
}
.loader-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, transparent, var(--star-silver), var(--star-gold));
    box-shadow: 0 0 12px rgba(233, 211, 160, 0.6);
}
.loader-text {
    font-size: 0.9rem;
    letter-spacing: 0.32em;
    text-indent: 0.32em;
    color: var(--text-faint);
}

/* ============================================================
   页头（场景 2 / 3 共用）
   ============================================================ */
.page-head {
    position: absolute;
    top: clamp(2.2rem, 7vh, 4rem);
    left: 0;
    right: 0;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}
.page-head .zh {
    font-size: clamp(1.5rem, 4.6vw, 2.4rem);
    font-weight: 300;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    color: var(--star-warm);
    text-shadow: 0 0 22px rgba(246, 236, 216, 0.22);
}
.page-head .zh.sub {
    margin-top: 0.7rem;
    font-size: clamp(0.78rem, 2vw, 0.95rem);
    letter-spacing: 0.14em;
    color: var(--text-dim);
    text-shadow: none;
}
.page-head .en {
    margin-top: 0.6rem;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(0.68rem, 1.8vw, 0.85rem);
    letter-spacing: 0.32em;
    color: var(--text-faint);
}
/* 十四星来信页：英文标题放大、纯白、加粗，保证可读 */
#scene-letters .page-head .en {
    font-style: normal;
    font-weight: 700;
    font-size: clamp(0.9rem, 2.4vw, 1.2rem);
    letter-spacing: 0.28em;
    color: #ffffff;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

/* 页脚导航 */
.page-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: clamp(1.4rem, 4vh, 2.6rem);
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 clamp(1.2rem, 4vw, 2.4rem);
    pointer-events: none;
}
.page-nav .nav { pointer-events: auto; }
.nav {
    font-family: var(--serif);
    font-weight: 300;
    letter-spacing: 0.22em;
    color: var(--text-dim);
    font-size: clamp(0.85rem, 2.4vw, 1.05rem);
    padding: 0.3em 0.5em;
    transition: color 0.5s var(--ease), text-shadow 0.5s var(--ease), transform 0.5s var(--ease);
}
.nav .spark { opacity: 0.45; }
.nav:hover { color: #fff; text-shadow: 0 0 16px rgba(246, 236, 216, 0.5); transform: translateY(-2px); }
.nav.back { font-size: 1.1rem; color: var(--text-faint); }
.nav.forward {
    padding: 0.55em 1.6em;
    border: 1px solid rgba(246, 236, 216, 0.5);
    border-radius: 999px;
    color: var(--star-warm);
    background: rgba(13, 18, 40, 0.35);
    backdrop-filter: blur(4px);
}
.nav.forward:hover {
    color: #fff;
    border-color: rgba(246, 236, 216, 0.85);
    box-shadow: 0 0 20px rgba(246, 236, 216, 0.3);
    transform: translateY(-2px);
}

/* ============================================================
   场景 2 · 十四星来信
   ============================================================ */
.letter-stars {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.letter-star {
    position: absolute;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s var(--ease);
}
.letter-star .glyph {
    width: 100%;
    height: 100%;
    fill: #ffe6a3;
    opacity: 0.96;
    filter: drop-shadow(0 0 7px rgba(255, 228, 160, 0.6));
    transition: opacity 0.6s var(--ease), filter 0.6s var(--ease);
    animation: star-twinkle var(--tw, 4s) ease-in-out var(--td, 0s) infinite;
}
.letter-star:hover { transform: scale(1.22); }
.letter-star:hover .glyph {
    opacity: 1;
    fill: #fff0c4;
    filter: drop-shadow(0 0 14px rgba(255, 236, 180, 0.9));
}
.letter-star.received .glyph {
    opacity: 0.45;
    fill: var(--star-gold);
    filter: drop-shadow(0 0 4px rgba(233, 211, 160, 0.4));
}

/* 悬浮时的星尘 */
.letter-star .dust {
    position: absolute;
    inset: -14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
    background:
        radial-gradient(circle at 20% 30%, rgba(246,236,216,0.9) 0 1px, transparent 1.5px),
        radial-gradient(circle at 70% 20%, rgba(143,180,230,0.8) 0 1px, transparent 1.5px),
        radial-gradient(circle at 60% 75%, rgba(246,236,216,0.7) 0 1px, transparent 1.5px);
    background-size: 14px 14px;
}
.letter-star:hover .dust { opacity: 0.8; }

@keyframes star-twinkle {
    0%, 100% { opacity: 0.96; }
    50% { opacity: 0.5; }
}

/* ---------- 留言墙（星畔留声 · 弹幕） ---------- */
.message-wall {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}
.message {
    position: absolute;
    font-size: clamp(0.8rem, 1.9vw, 1.05rem);
    letter-spacing: 0.1em;
    color: #ffffff;
    white-space: nowrap;
    opacity: 0;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.28);
    will-change: transform, opacity;
}
.message.m-pass { animation: msg-pass var(--dur, 40s) linear var(--delay, 0s) infinite; }

@keyframes msg-pass {
    0%   { transform: translate3d(105vw, 0, 0); opacity: 0; }
    6%   { opacity: var(--o, 0.6); }
    94%  { opacity: var(--o, 0.6); }
    100% { transform: translate3d(-100%, 0, 0); opacity: 0; }
}

/* ---------- 左下角玩偶 ---------- */
.character {
    position: fixed;
    left: clamp(1rem, 3vw, 2rem);
    bottom: clamp(4.6rem, 12vh, 6rem);
    z-index: 4;
    cursor: pointer;
}
.character-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(74px, 19vw, 130px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid rgba(246, 236, 216, 0.55);
    background: radial-gradient(circle, rgba(246, 236, 216, 0.08) 0%, rgba(143, 180, 230, 0.05) 55%, transparent 72%);
    box-shadow: 0 0 24px rgba(246, 236, 216, 0.18), inset 0 0 18px rgba(143, 180, 230, 0.15);
    z-index: 0;
    pointer-events: none;
}
.character-img {
    position: relative;
    z-index: 1;
    width: clamp(56px, 14vw, 100px);
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    color: var(--star-gold);
    overflow: visible;
    filter: drop-shadow(0 6px 20px rgba(4, 6, 16, 0.65)) drop-shadow(0 0 18px rgba(246, 236, 216, 0.22));
    transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}
.character-img img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.94;
    filter: brightness(0.96) saturate(1.05);
}
.character:hover .character-img {
    transform: rotate(-3deg) scale(1.05);
    filter: drop-shadow(0 8px 24px rgba(4, 6, 16, 0.7)) drop-shadow(0 0 26px rgba(246, 236, 216, 0.32));
}
.character .character-say {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 0;
    padding: 0.5em 0.9em;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--star-warm);
    background: rgba(13, 18, 40, 0.72);
    border: 1px solid rgba(143, 180, 230, 0.2);
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
    pointer-events: none;
    backdrop-filter: blur(4px);
}
.character .character-say.show { opacity: 1; transform: translateY(0); }

/* 玩偶点击后向上飘的小星星 */
.float-star {
    position: fixed;
    pointer-events: none;
    color: var(--star-gold);
    z-index: 6;
    font-size: 14px;
    animation: float-star-up 1.6s ease-out forwards;
}
@keyframes float-star-up {
    0% { opacity: 0; transform: translateY(0) scale(0.6); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-110px) scale(1.2); }
}

/* ============================================================
   信件弹窗 · 漂浮在夜空中的信纸
   ============================================================ */
.letter-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vh, 40px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.letter-modal.open { opacity: 1; visibility: visible; }

.letter-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 12, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}
.letter-modal.open .letter-backdrop { opacity: 1; }

.letter-paper {
    position: relative;
    width: min(560px, 92vw);
    max-height: min(78vh, 720px);
    background:
        repeating-linear-gradient(0deg, rgba(0,0,0,0.012) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, var(--paper), rgba(233, 230, 219, 0.9));
    color: #3b3f52;
    border-radius: 3px;
    padding: clamp(2rem, 5vw, 3.4rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 60px rgba(246, 236, 216, 0.08);
    transform: translateY(24px) scale(0.98);
    opacity: 0;
    transition: transform 0.6s var(--ease), opacity 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.letter-modal.open .letter-paper {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.letter-paper.glow {
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 70px var(--paper-glow);
}

.letter-close {
    position: absolute;
    top: 0.7rem;
    right: 1rem;
    font-size: 1.5rem;
    font-weight: 200;
    line-height: 1;
    color: rgba(59, 63, 82, 0.5);
    transition: color 0.3s;
}
.letter-close:hover { color: #2a2d3d; }

.letter-author {
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    color: #8a8f9f;
    margin-bottom: 0.5rem;
}
.letter-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.3rem, 4vw, 1.7rem);
    letter-spacing: 0.08em;
    color: #333749;
    margin-bottom: 1.2rem;
}
.letter-content {
    flex: 1 1 auto;
    overflow-y: auto;
    font-size: clamp(0.95rem, 2.6vw, 1.05rem);
    line-height: 2.1;
    letter-spacing: 0.03em;
    color: #474b5e;
    white-space: pre-wrap;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(90, 96, 120, 0.35) transparent;
}
.letter-content::-webkit-scrollbar { width: 5px; }
.letter-content::-webkit-scrollbar-thumb { background: rgba(90, 96, 120, 0.35); border-radius: 4px; }

.letter-from {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.92rem;
    letter-spacing: 0.12em;
    color: #4a4f63;
}
.letter-date {
    margin-top: 1.4rem;
    text-align: right;
    font-family: var(--serif);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: #8a8f9f;
}

.letter-receive {
    margin: 1.4rem auto 0;
    font-size: 0.9rem;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: #4a4f63;
    border: 1px solid rgba(74, 79, 99, 0.35);
    padding: 0.55em 1.4em;
    border-radius: 100px;
    transition: color 0.4s, border-color 0.4s, box-shadow 0.4s, transform 0.4s var(--ease);
}
.letter-receive:hover {
    color: #2a2d3d;
    border-color: rgba(74, 79, 99, 0.6);
    box-shadow: 0 0 20px rgba(233, 211, 160, 0.35);
    transform: translateY(-1px);
}
.letter-receive .spark { color: var(--star-gold); }
.letter-receive:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* 收下这封信：从信纸向外飘散的星 */
.receive-star {
    position: fixed;
    pointer-events: none;
    color: var(--star-gold);
    z-index: 70;
    animation: receive-star-out 1.4s ease-out forwards;
}
@keyframes receive-star-out {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.3); }
}

/* ============================================================
   场景 3 · 时光存档
   ============================================================ */
#scene-archive { overflow-y: auto; overflow-x: hidden; }
#scene-archive .page-head { position: fixed; }

/* 3D 相册画布容器（fixed 背景，滚动时保持在原地） */
#album-wrap {
    position: fixed;
    inset: 0;
    z-index: 1;
}
#album-wrap canvas { display: block; }

/* 交互提示（底部，短暂浮现） */
.album-hint {
    position: fixed;
    bottom: 2.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: rgba(180, 190, 220, 0.65);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s var(--ease);
    white-space: nowrap;
}
.album-hint.show { opacity: 1; }

/* 滚动空间：爱心占据首屏，下方预留一整屏页面，下滑后礼物盒居中浮现 */
.archive-scroll {
    position: relative;
    height: 200vh;
    z-index: 2;
    pointer-events: none;
}

/* Three.js 加载失败兜底 */
.album-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* file:// 打开时的引导提示（照片会黑，引导用本地服务器） */
.album-filewarn {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 24px;
    background: rgba(3, 4, 12, 0.82);
    backdrop-filter: blur(4px);
    color: #e8e2d6;
}
.album-filewarn .w-title {
    font-size: 1.15rem;
    letter-spacing: 0.16em;
    color: var(--star-gold, #e9d3a0);
    margin-bottom: 0.9rem;
}
.album-filewarn .w-sub {
    font-size: 0.85rem;
    line-height: 1.9;
    color: rgba(232, 226, 214, 0.8);
    margin-bottom: 1.1rem;
}
.album-filewarn .w-act {
    font-size: 0.85rem;
    line-height: 2;
    color: rgba(232, 226, 214, 0.9);
}
.album-filewarn b { color: var(--star-gold, #e9d3a0); }
.album-filewarn code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #ffd9a0;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1em 0.4em;
    border-radius: 4px;
}

/* ---------- 时间轴尽头 · 礼物盒（独立第二屏，下滑翻页后居中） ---------- */
.archive-end {
    position: absolute;
    top: 150vh;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;
    pointer-events: auto;
}

.giftbox {
    position: relative;
    width: 120px;
    height: 120px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}
.giftbox.reveal { opacity: 1; transform: translateY(0); animation: gift-glow 2.4s ease-in-out infinite alternate; }
.giftbox.open { animation: gift-bob 0.6s var(--ease); }
@keyframes gift-glow {
    from { filter: drop-shadow(0 0 8px rgba(233, 211, 160, 0.4)) drop-shadow(0 0 18px rgba(233, 211, 160, 0.2)); }
    to   { filter: drop-shadow(0 0 18px rgba(233, 211, 160, 0.8)) drop-shadow(0 0 44px rgba(233, 211, 160, 0.42)); }
}

.gift {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
}
.gift.g-box {
    bottom: 12px;
    width: 78px;
    height: 62px;
    background: linear-gradient(180deg, #2a3370, #1a2348);
    box-shadow: 0 0 18px rgba(233, 211, 160, 0.5), 0 0 40px rgba(233, 211, 160, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(233, 211, 160, 0.35);
}
.gift.g-lid {
    bottom: 72px;
    width: 92px;
    height: 22px;
    background: linear-gradient(180deg, #303a7c, #20294e);
    box-shadow: 0 0 16px rgba(233, 211, 160, 0.5), 0 0 34px rgba(233, 211, 160, 0.22),
        0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(233, 211, 160, 0.4);
    transition: transform 0.7s var(--ease), opacity 0.7s var(--ease);
}
.giftbox.open .g-lid { transform: translate(-50%, -40px) rotate(-8deg); opacity: 0; }
.gift.g-ribbon {
    bottom: 44px;
    width: 14px;
    height: 76px;
    background: linear-gradient(180deg, #f3e0b0, #d4b87e);
    opacity: 0.9;
    box-shadow: 0 0 16px rgba(233, 211, 160, 0.8), 0 0 30px rgba(233, 211, 160, 0.4);
}

.gift-hint {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: rgba(233, 211, 160, 0.85);
    text-shadow: 0 0 12px rgba(233, 211, 160, 0.5);
    white-space: nowrap;
}

/* 礼物盒打开时的光与纸片 */
.gift-burst {
    position: absolute;
    inset: -60px;
    pointer-events: none;
    opacity: 0;
}
.giftbox.open .gift-burst { opacity: 1; }
.gift-burst .star-burst {
    position: absolute;
    left: 50%;
    top: 50%;
    color: var(--star-gold);
    animation: star-burst-out 1.5s ease-out forwards;
}
@keyframes star-burst-out {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.4); }
}
.gift-burst .age {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--serif);
    font-size: 3rem;
    font-weight: 300;
    color: var(--star-gold);
    text-shadow: 0 0 30px rgba(233, 211, 160, 0.7);
    animation: age-rise 2.4s ease-out forwards;
}
@keyframes age-rise {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
    30% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(1.05); }
}

/* 结尾文字 */
.ending {
    position: fixed;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(3, 4, 12, 0.78);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s var(--ease), visibility 1.2s;
    pointer-events: none;
}
.ending.show { opacity: 1; visibility: visible; pointer-events: auto; }
.ending-line {
    font-size: clamp(1.2rem, 3.6vw, 1.8rem);
    font-weight: 300;
    letter-spacing: 0.26em;
    text-indent: 0.26em;
    color: var(--star-warm);
    text-shadow: 0 0 24px rgba(246, 236, 216, 0.28);
}
.ending .back-home { margin-top: 2.2rem; }

/* ---------- 生日卡片（拆开礼物盒 → 生日卡片 → 轻轻拆开 → 收下） ---------- */
.birthday-card {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 5vh, 40px);
    perspective: 1200px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.birthday-card.open { opacity: 1; visibility: visible; }

.bc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 12, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.6s var(--ease);
}
.birthday-card.open .bc-backdrop { opacity: 1; }

.bc-card {
    position: relative;
    width: min(360px, 86vw);
    aspect-ratio: 3 / 4;
    transform-style: preserve-3d;
    transition: transform 1.15s var(--ease);
    transform: translateY(26px) scale(0.92);
}
.birthday-card.open .bc-card { transform: translateY(0) scale(1); }
.birthday-card.open .bc-card.opened { transform: rotateY(180deg); }

.bc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.55), 0 0 70px rgba(191, 230, 228, 0.16);
}
.bc-front {
    cursor: pointer;
    background: #bfe6e4;
    transition: box-shadow 0.5s var(--ease);
}
.bc-front:hover {
    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.6), 0 0 90px rgba(191, 230, 228, 0.34);
}
.bc-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}
.bc-back {
    background:
        radial-gradient(120% 80% at 50% 100%, rgba(255, 255, 255, 0.5), transparent 60%),
        linear-gradient(170deg, #d8f1ee 0%, #c0e7e4 55%, #a5d9d6 100%);
    color: #205451;
    border: 1px solid rgba(255, 255, 255, 0.65);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(1.6rem, 5vw, 2.4rem);
    gap: 0.85rem;
}

.bc-msg {
    font-family: var(--serif);
    font-size: clamp(1rem, 3.4vw, 1.15rem);
    line-height: 1.9;
    letter-spacing: 0.04em;
    color: #205451;
    max-width: 24ch;
}
.bc-msg.bc-last { font-weight: 600; margin-top: 0.3rem; }
.bc-sign {
    margin-top: 1.1rem;
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    color: #3f8c87;
}

/* ============================================================
   场景 4 · Or? 烟花祝福
   ============================================================ */
.fireworks-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    /* 视频缺失时回退到星空：用轻微暗角保证文字可读，中心留白看星空 */
    background: radial-gradient(ellipse at center, rgba(5, 6, 15, 0.05) 0%, rgba(5, 6, 15, 0.62) 100%);
}
/* 烟花画布：纯烟花粒子 */
#fw-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    pointer-events: none;
}
/* 打字机文字：苹方清晰字体，逐字出现，叠加在烟花之上 */
.fw-text {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    padding: 0 clamp(1rem, 4vw, 3rem);
    text-align: center;
    color: #fff;
    font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', cursive;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.5;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 42px rgba(255, 255, 255, 0.3);
    opacity: 0;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
    pointer-events: none;
}
/* 中文句子：智芒星手写 */
.fw-text .fw-zh {
    font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', cursive;
}
/* 英文句子：Great Vibes 手写花体 */
.fw-text .fw-en {
    font-family: 'Great Vibes', 'ZCOOL KuaiLe', cursive;
}
/* 文字下方一圈柔和暗晕，保证在明亮烟花上依然清晰（不压暗烟花本身） */
.fw-text::before {
    content: '';
    position: absolute;
    inset: -2em -3em;
    background: radial-gradient(ellipse at center, rgba(4, 8, 20, 0.6) 0%, rgba(4, 8, 20, 0) 70%);
    z-index: -1;
    border-radius: 50%;
}
.fw-text.visible { opacity: 1; }
.fw-text.leaving { opacity: 0; transform: translateY(-50%) scale(1.03); }
.fw-cursor {
    display: inline-block;
    margin-left: 0.08em;
    color: #fff;
    font-weight: 300;
    animation: fw-blink 0.9s steps(2, start) infinite;
}
@keyframes fw-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* 数字蜡烛 14：Happy Birthday 出现后亮起，吹麦克风才熄灭 */
.fw-candles {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: clamp(0.5rem, 2vw, 1.4rem);
    opacity: 0;
    transition: opacity 0.9s var(--ease);
    pointer-events: none;
}
.fw-candles.show { opacity: 1; }
/* 蜡烛身后一圈暖光，让它融进星空 */
.fw-candles::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(ellipse at center, rgba(255, 190, 100, 0.30) 0%, rgba(255, 190, 100, 0) 66%);
    z-index: -1;
    pointer-events: none;
}
.fw-candle {
    position: relative;
    height: clamp(150px, 26vh, 210px);
}
/* 按每张蜡烛真实宽高比给足宽度，避免 flex 里宽度塌缩导致 "1"/"4" 重叠 */
.fw-candle:nth-child(1) { aspect-ratio: 562 / 640; }
.fw-candle:nth-child(2) { aspect-ratio: 587 / 640; }
.fw-candle .candle-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.5s var(--ease);
}
.fw-candle .candle-lit {
    opacity: 1;
    filter: drop-shadow(0 0 16px rgba(255, 185, 85, 0.5));
}
.fw-candle .candle-unlit { opacity: 0; }
.fw-candles.out .candle-lit { opacity: 0; }
.fw-candles.out .candle-unlit { opacity: 1; }
/* 蜡烛可点击（麦克风不可用时的兜底吹灭） */
.fw-candles.clickable { pointer-events: auto; cursor: pointer; }

/* 蜡烛亮起后的下方提示：「许个愿望 / 试试朝麦克风吹口气吧」 */
.fw-wish {
    position: absolute;
    left: 50%;
    bottom: clamp(3.4rem, 9vh, 6rem);
    transform: translateX(-50%);
    z-index: 2;
    text-align: center;
    color: rgba(240, 243, 255, 0.88);
    font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', cursive;
    font-weight: 400;
    font-size: clamp(1.05rem, 2.6vw, 1.5rem);
    letter-spacing: 0.08em;
    line-height: 1.7;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.45);
    opacity: 0;
    transition: opacity 0.9s var(--ease);
    pointer-events: none;
}
.fw-wish.show { opacity: 1; }

/* 吹灭时升起的烟 */
.fw-smoke {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(205, 210, 226, 0.40) 0%, rgba(205, 210, 226, 0) 68%);
    filter: blur(3px);
    pointer-events: none;
    z-index: 5;
    animation: smoke-rise 1.5s ease-out forwards;
}
@keyframes smoke-rise {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.35); }
    25% { opacity: 0.9; }
    100% { opacity: 0; transform: translate(-50%, -90px) scale(1.7); }
}
@media (prefers-reduced-motion: reduce) {
    .fw-smoke { animation: none; }
}

/* ============================================================
   场景 2.5 · 记忆线索
   ============================================================ */
#scene-clues { overflow: hidden; }

/* 星空上的氛围光：两侧柔和的暖金光晕（替代原来的全屏参考图） */
#scene-clues::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(56% 56% at 30% 52%, rgba(233, 211, 160, 0.12), transparent 66%),
        radial-gradient(42% 42% at 73% 48%, rgba(233, 211, 160, 0.08), transparent 70%);
}

/* 记忆线索页标题：白字 + 深色投影，保证在星空上可读 */
#scene-clues .page-head .zh {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.55), 0 2px 18px rgba(0, 0, 0, 0.5);
}
#scene-clues .page-head .en {
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* 左侧坐标线索（正方形，垂直居中，整体放大） */
.clue-wheel {
    position: absolute;
    left: clamp(0.5rem, 2.5vw, 2rem);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(340px, 46vw, 680px);
    height: clamp(340px, 46vw, 680px);
    z-index: 2;
}
.clue-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* 圆形光轨：柔和模糊的暖金光带 */
.ring-track {
    fill: none;
    stroke: rgba(233, 211, 160, 0.26);
    stroke-width: 7;
    filter: blur(4px);
}
.ring-progress {
    fill: none;
    stroke: #e9d3a0;
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.7s var(--ease);
    filter: blur(0.6px) drop-shadow(0 0 8px rgba(233, 211, 160, 0.7));
}

/* 引导光点（沿光轨滑动，呼吸发光） */
.clue-dot {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: #fffdf5;
    box-shadow: 0 0 10px #e9d3a0, 0 0 24px rgba(233, 211, 160, 0.85), 0 0 46px rgba(233, 211, 160, 0.5);
    z-index: 3;
    pointer-events: none;
    animation: dot-glow 1.6s ease-in-out infinite;
}
@keyframes dot-glow {
    0%, 100% { box-shadow: 0 0 10px #e9d3a0, 0 0 24px rgba(233, 211, 160, 0.85), 0 0 46px rgba(233, 211, 160, 0.5); }
    50%      { box-shadow: 0 0 16px #f6ecd8, 0 0 36px rgba(233, 211, 160, 1), 0 0 64px rgba(233, 211, 160, 0.7); }
}

/* 坐标点：📍 图钉，漂浮 + 前沿点呼吸发光 */
.clue-point {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1;
    cursor: not-allowed;
    opacity: 0.55;
    filter: none;
    transition: opacity 0.5s var(--ease), filter 0.5s var(--ease);
    animation: cp-float 3.6s ease-in-out var(--fdl, 0s) infinite;
}
.clue-point .cp-pin { display: block; }
.clue-point.unlocked {
    cursor: pointer;
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(233, 211, 160, 0.6));
}
.clue-point.frontier {
    animation: cp-float 3.6s ease-in-out var(--fdl, 0s) infinite, cp-breathe 1.8s ease-in-out infinite;
}
@keyframes cp-float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50%      { transform: translate(-50%, -50%) translateY(-8px); }
}
@keyframes cp-breathe {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(233, 211, 160, 0.45)); }
    50%      { filter: drop-shadow(0 0 16px rgba(233, 211, 160, 0.95)); }
}

/* 最后：圆圈中心的收尾文案 */
.clue-end {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s var(--ease);
}
.clue-end.show { opacity: 1; }
.clue-end-en {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--star-warm);
    text-shadow: 0 0 18px rgba(233, 211, 160, 0.45);
    line-height: 1.1;
}
.clue-end-zh {
    font-family: var(--serif);
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    color: var(--text-dim);
    margin-top: 0.45rem;
}

/* 右侧 memory file 档案卡：档案纸质感，加宽拉长、向中间贴近 */
.clue-file {
    position: absolute;
    right: clamp(2rem, 4vw, 3.5rem);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(340px, 38vw, 600px);
    z-index: 2;
    padding: 1.3rem 1.5rem 1.6rem;
    border-radius: 16px;
    background: rgba(250, 248, 243, 0.94);
    box-shadow: 0 16px 60px rgba(8, 10, 26, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    color: #3a3150;
}
/* 档案头：序号 + memory file */
.mf-head {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(58, 49, 92, 0.18);
}
.mf-index {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: 0.02em;
    color: #b58a2e;
    line-height: 1;
}
.mf-label {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    color: #8a83a0;
}
/* 照片框：contain 显示全、多张可横滑 */
.mf-photo {
    position: relative;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    background: #151226;
    box-shadow: inset 0 0 0 1px rgba(58, 49, 92, 0.15);
}
.mf-photo::-webkit-scrollbar { height: 7px; }
.mf-photo::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.06); }
.mf-photo::-webkit-scrollbar-thumb { background: rgba(233, 211, 160, 0.85); border-radius: 4px; }
.mf-media {
    flex: 0 0 100%;
    scroll-snap-align: start;
    width: 100%;
    height: clamp(250px, 40vh, 390px);
    object-fit: contain;
    background: #151226;
    display: block;
}
/* 多图提示：图片下方 */
.mf-more {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: #9a8b6a;
    text-align: center;
    margin-top: 0.55rem;
}
.mf-more[hidden] { display: none; }
/* 文案：照片下方 */
.mf-caption {
    margin-top: 1.1rem;
}
.mf-date {
    font-size: clamp(1.15rem, 2.3vw, 1.4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4a3f2f;
    margin-bottom: 0.55rem;
    line-height: 1.45;
}
.mf-line {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.65;
    color: #5f5548;
    margin-top: 0.3rem;
}

/* 返回按钮加边框，与右下「继续向前」对称 */
.nav.back.pill {
    font-size: clamp(0.85rem, 2.4vw, 1.05rem);
    color: var(--star-warm);
    padding: 0.55em 1.6em;
    border: 1px solid rgba(246, 236, 216, 0.5);
    border-radius: 999px;
    background: rgba(13, 18, 40, 0.35);
    backdrop-filter: blur(4px);
}
.nav.back.pill:hover {
    color: #fff;
    border-color: rgba(246, 236, 216, 0.85);
    box-shadow: 0 0 20px rgba(246, 236, 216, 0.3);
    transform: translateY(-2px);
}

/* 移动端：线索在上、档案卡在下 */
@media (max-width: 720px) {
    .clue-wheel {
        left: 50%;
        top: 43%;
        transform: translate(-50%, -50%);
        width: min(82vw, 360px);
        height: min(82vw, 360px);
    }
    .clue-file {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 4.8rem;
        transform: translateX(-50%);
        width: min(92vw, 420px);
        padding: 1rem 1.1rem 1.1rem;
    }
    .mf-media { height: clamp(170px, 26vh, 240px); }
}

/* ============================================================
   时光存档 · 星空 → 日出天光
   ============================================================ */
#archive-dawn {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 5s var(--ease);
    background:
        radial-gradient(circle at 50% 80%, rgba(255, 206, 130, 0.92) 0%, rgba(255, 170, 100, 0.45) 26%, transparent 58%),
        linear-gradient(180deg, #232b4e 0%, #4c3f74 36%, #c07a58 72%, #e8b878 100%);
}
#archive-dawn.dawn { opacity: 1; }
/* 日出变亮后，底部提示/导航改用深色文字保证可读 */
#scene-archive .album-hint { color: rgba(58, 52, 84, 0.78); text-shadow: 0 0 10px rgba(255, 255, 255, 0.35); }
#scene-archive .page-nav .nav { color: rgba(52, 46, 78, 0.9); text-shadow: 0 0 10px rgba(255, 255, 255, 0.4); }
#scene-archive .page-nav .nav:hover { color: #1a1630; }

/* ============================================================
   全局覆盖层 · 音乐
   ============================================================ */
.music-toggle {
    position: fixed;
    top: clamp(1.2rem, 4vh, 2rem);
    right: clamp(1.2rem, 4vw, 2.2rem);
    z-index: 40;
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
    line-height: 1;
    color: #ffffff;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: opacity 0.4s, color 0.4s, border-color 0.4s, box-shadow 0.4s, transform 0.4s var(--ease);
    backdrop-filter: blur(4px);
}
.music-toggle:hover { opacity: 1; color: #fff; border-color: #ffffff; box-shadow: 0 0 18px rgba(255, 255, 255, 0.3); }
.music-toggle.playing { color: #ffffff; }
.music-toggle.playing::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(233, 211, 160, 0.4);
    animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.music-panel {
    position: fixed;
    top: clamp(1.2rem, 4vh, 2rem);
    right: clamp(4.4rem, 12vw, 5.4rem);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.6rem 1rem 0.6rem 0.7rem;
    background: rgba(10, 13, 31, 0.78);
    border: 1px solid rgba(143, 180, 230, 0.18);
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), visibility 0.4s;
    backdrop-filter: blur(8px);
}
.music-panel.open { opacity: 1; visibility: visible; transform: translateX(0); }
/* 悬停展开音量面板（♪ 已改为直接播放/暂停） */
#music-toggle:hover + #music-panel,
#music-panel:hover { opacity: 1; visibility: visible; transform: translateX(0); }
.music-play {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(143, 180, 230, 0.25);
    color: var(--star-silver);
    font-size: 0.8rem;
    flex: 0 0 auto;
    transition: color 0.3s, border-color 0.3s;
}
.music-play:hover { color: #fff; border-color: rgba(143, 180, 230, 0.5); }
.music-name {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 4px;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.music-volume {
    width: 90px;
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: rgba(143, 180, 230, 0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.music-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--star-silver);
}

/* ============================================================
   照片查看器
   ============================================================ */
.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease), visibility 0.4s;
}
.photo-viewer.open { opacity: 1; visibility: visible; }
.pv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 12, 0.82);
    backdrop-filter: blur(5px);
}
.pv-figure {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 900px);
    max-height: 84vh;
    background: rgba(246, 244, 238, 0.96);
    padding: 12px 12px 16px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
    transform: scale(0.96);
    transition: transform 0.4s var(--ease);
}
.photo-viewer.open .pv-figure { transform: scale(1); }
.pv-img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}
.pv-caption {
    margin-top: 10px;
    text-align: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.85rem;
    color: #6b6f80;
}
.pv-close {
    position: absolute;
    top: 1rem;
    right: 1.6rem;
    z-index: 2;
    font-size: 2rem;
    font-weight: 200;
    line-height: 1;
    color: rgba(255, 255, 255, 0.75);
}
.pv-close:hover { color: #fff; }

/* ============================================================
   响应式 · 移动端
   ============================================================ */
@media (max-width: 720px) {
    .letter-star { width: 52px; height: 52px; margin: -26px 0 0 -26px; }

    .home-entries { bottom: 20vh; }

    .home-title .he { font-size: clamp(1.3rem, 7vw, 1.8rem); margin-top: calc(var(--dy, 0px) * 0.6); }
    .home-title .he.left  { margin-right: calc(var(--mx, 2rem) * 0.6); }
    .home-title .he.right { margin-left: calc(var(--mx, 2rem) * 0.6); }

    .page-head { top: clamp(1.8rem, 6vh, 3rem); }
    .page-head .zh.sub { max-width: 86vw; margin-left: auto; margin-right: auto; }

    .character { bottom: 4.4rem; }

    .letter-paper { max-height: 82vh; padding: 1.8rem 1.5rem; }

    .music-panel { right: 0.5rem; top: 4.6rem; }
    .music-name { max-width: 100px; }
}

/* ============================================================
   降低动态（prefers-reduced-motion）
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
    .message { opacity: 0.4; animation: none !important; }
    .letter-star .glyph { animation: none; opacity: 0.8; }
}
