/* ============ 基础 ============ */
:root {
    --bg-1: #fdf6f1;
    --bg-2: #f7e6ea;
    --bg-3: #f3d9e4;
    --ink: #2b2030;
    --ink-soft: #6b5d6e;
    --accent: #c94f5b;
    --accent-deep: #8e2a34;
    --paper: #fffaf4;
    --paper-edge: #efe3d3;
    --envelope: #f2d7c1;
    --envelope-shadow: #d4b197;
    --envelope-flap: #e7c8ae;
    --gold: #c9a96a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "PingFang SC", "Helvetica Neue", Helvetica, "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 800px at 15% 10%, #ffe9ec 0%, transparent 60%),
        radial-gradient(1000px 700px at 85% 90%, #ffd9e1 0%, transparent 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============ 顶部栏 ============ */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px;
    font-size: 0.85rem; letter-spacing: 0.08em;
    color: var(--ink-soft);
    z-index: 10;
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    background: rgba(255, 250, 247, 0.45);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.brand .heart { color: var(--accent); font-size: 0.95rem; }
.auth-wrap a {
    color: var(--ink); text-decoration: none;
    font: inherit; background: none; border: 0; padding: 0;
    cursor: pointer;
}
.auth-wrap a:hover { color: var(--accent); }

/* ============ 舞台 ============ */
.stage {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 110px 24px 80px;
    position: relative;
}
.title {
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
    font-weight: 500;
    letter-spacing: 0.12em;
    margin: 0 0 8px;
    color: var(--ink);
}
.subtitle {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin: 0 0 48px;
    letter-spacing: 0.04em;
}
.hint {
    margin-top: 28px;
    font-size: 0.85rem;
    color: var(--ink-soft);
    opacity: 0.85;
    animation: floatHint 2.8s ease-in-out infinite;
    overflow: hidden;
    transition: opacity .35s ease, margin-top .45s ease .15s, max-height .45s ease .15s;
    max-height: 60px;
}
.hint.gone {
    opacity: 0;
    margin-top: 0;
    max-height: 0;
    animation: none;
}
@keyframes floatHint {
    0%, 100% { transform: translateY(0); opacity: 0.75; }
    50%      { transform: translateY(-4px); opacity: 1; }
}

/* ============ 信封 ============ */
.envelope-wrap {
    position: relative;
    width: min(560px, 92vw);
    aspect-ratio: 5 / 3.2;
    perspective: 1400px;
    cursor: pointer;
    user-select: none;
}
.envelope {
    position: absolute; inset: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, #f6dfc9 0%, var(--envelope) 55%, #e9c6a7 100%);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.7) inset,
        0 -2px 0 rgba(0,0,0,0.04) inset,
        0 18px 40px -12px rgba(90, 40, 30, 0.22),
        0 4px 12px rgba(90, 40, 30, 0.12);
    overflow: hidden;
}
.envelope::before,
.envelope::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 50%; height: 100%;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.03) 100%);
}
.envelope::before {
    left: 0;
    clip-path: polygon(0 100%, 100% 100%, 0 45%);
    background: linear-gradient(120deg, #eccba9 0%, #dbb18a 100%);
}
.envelope::after {
    right: 0;
    clip-path: polygon(0 100%, 100% 100%, 100% 45%);
    background: linear-gradient(240deg, #eccba9 0%, #dbb18a 100%);
}

.letter {
    position: absolute;
    left: 5%; right: 5%;
    top: 8%;
    min-height: 84%;
    background: linear-gradient(180deg, var(--paper) 0%, #fff6ea 100%);
    border: 1px solid var(--paper-edge);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(80, 40, 20, 0.12);
    padding: 20px 26px 22px;
    transform: translateY(0);
    transition: transform 1.2s cubic-bezier(.2,.8,.2,1);
    z-index: 2;
    opacity: 0;
}
.letter-inner {
    opacity: 0;
    transition: opacity .6s ease .8s;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--ink);
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
        "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}
.letter-inner .for {
    font-size: 0.7rem;
    color: var(--ink-soft);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.letter-inner h3 {
    margin: 0 0 10px;
    font-weight: 500;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}
.letter-inner p { margin: 0 0 6px; }
.letter-inner .emph {
    color: var(--accent-deep);
    font-weight: 500;
}
.letter-inner .wishes {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(201, 79, 91, 0.25);
    color: var(--accent-deep);
    font-style: italic;
    line-height: 1.7;
}
.letter-inner .sign {
    margin-top: 8px;
    text-align: right;
    color: var(--accent-deep);
    font-style: italic;
}

.flap {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 62%;
    background: linear-gradient(180deg, var(--envelope-flap) 0%, #d9b593 100%);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 1s cubic-bezier(.6,.05,.2,1);
    z-index: 3;
    box-shadow: 0 2px 0 rgba(0,0,0,0.04) inset;
}
.flap::after {
    content: "";
    position: absolute; inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent 40%);
    pointer-events: none;
}

.front {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 62%;
    background: linear-gradient(180deg, #eec8a6 0%, #dfb084 100%);
    clip-path: polygon(0 38%, 100% 38%, 100% 100%, 0 100%);
    z-index: 4;
    box-shadow: 0 -1px 0 rgba(0,0,0,0.06) inset;
}

.seal {
    position: absolute;
    left: 50%; top: 62%;
    width: 92px; height: 92px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #e46b73 0%, var(--accent) 35%, var(--accent-deep) 75%, #66121a 100%);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.05),
        0 6px 16px rgba(138, 30, 40, 0.45),
        inset 0 -3px 8px rgba(0,0,0,0.25),
        inset 0 3px 6px rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
    transition: transform .25s ease;
}
.seal::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201,79,91,0.0) 48%, rgba(201,79,91,0.35) 52%, rgba(142,42,52,0.0) 66%);
    filter: blur(2px);
    z-index: -1;
    clip-path: polygon(
        50% 0%, 60% 6%, 72% 3%, 82% 12%, 94% 16%, 98% 28%, 96% 42%,
        100% 54%, 94% 66%, 98% 78%, 86% 86%, 78% 96%, 66% 94%, 54% 100%,
        42% 96%, 30% 100%, 18% 92%, 10% 84%, 4% 72%, 8% 58%, 0% 46%,
        6% 34%, 2% 22%, 14% 14%, 22% 4%, 36% 8%
    );
}
.seal-mark {
    font-family: "Didot", "Bodoni 72", "Times New Roman", serif;
    font-size: 1.5rem;
    font-style: italic;
    color: #ffe3c2;
    text-shadow:
        0 1px 0 rgba(0,0,0,0.35),
        0 0 10px rgba(255, 220, 180, 0.35);
    letter-spacing: 0.02em;
}
.seal-ring {
    position: absolute; inset: 10px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 220, 190, 0.55);
    pointer-events: none;
}

.envelope-wrap:hover .seal { transform: translate(-50%, -50%) scale(1.04); }

.envelope-wrap.opened { cursor: default; }
.envelope-wrap.opened .flap {
    transform: rotateX(-180deg);
}
.envelope-wrap.opened .seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
    transition: opacity .35s ease, transform .35s ease;
}
.envelope-wrap.opened .letter {
    opacity: 1;
    transform: translateY(-22%);
    z-index: 10;
}
.envelope-wrap.opened .letter-inner { opacity: 1; }

.envelope-wrap.no-anim,
.envelope-wrap.no-anim .flap,
.envelope-wrap.no-anim .seal,
.envelope-wrap.no-anim .letter,
.envelope-wrap.no-anim .letter-inner { transition: none !important; }
.reveal.no-anim { transition: none !important; }

/* ============ 展开后的入口区 ============ */
.reveal {
    margin-top: 12px;
    display: flex; flex-direction: column; align-items: center;
    gap: 18px;
    opacity: 0; transform: translateY(14px);
    pointer-events: none;
    transition: opacity .7s ease 1.6s, transform .7s ease 1.6s;
}
.reveal.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

.greet {
    font-size: 1rem; color: var(--ink-soft); letter-spacing: 0.06em;
    margin: 0;
}
.rooms {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.room-btn {
    display: inline-block;
    padding: 10px 22px;
    background: rgba(255,255,255,0.72);
    color: var(--ink);
    text-decoration: none;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 999px;
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    font-family: inherit;
    line-height: 1.4;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
    cursor: pointer;
}
.room-btn:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 10px 24px -10px rgba(201, 79, 91, 0.35);
}

/* ============ 伪二级界面 ============ */
.room-panel {
    position: fixed; inset: 0;
    z-index: 80;
    background:
        radial-gradient(1200px 800px at 15% 10%, #ffe9ec 0%, transparent 60%),
        radial-gradient(1000px 700px at 85% 90%, #ffd9e1 0%, transparent 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
    opacity: 0; visibility: hidden;
    transform: translateY(20px);
    transition: opacity .45s ease, transform .5s cubic-bezier(.2,.8,.2,1), visibility 0s linear .5s;
    overflow-y: auto;
}
.room-panel.show {
    opacity: 1; visibility: visible; transform: translateY(0);
    transition: opacity .45s ease, transform .5s cubic-bezier(.2,.8,.2,1);
}
.room-bar {
    position: sticky; top: 0;
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
    padding: 0 22px;
    background: rgba(255, 250, 247, 0.75);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    z-index: 2;
}
.room-bar .room-title {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.95rem; font-weight: 500; letter-spacing: 0.08em;
    color: var(--ink);
}
.room-bar .room-title .heart { color: var(--accent); }
.room-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.85);
    color: var(--ink);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform .15s ease, color .2s ease, background .2s ease;
    font-family: inherit;
}
.room-close:hover { color: var(--accent); background: #fff; transform: rotate(90deg); }

.room-body {
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    position: relative;
    z-index: 1;
}
.room-eyebrow {
    text-align: center;
    font-size: 0.74rem; letter-spacing: 0.24em;
    color: var(--ink-soft);
    text-transform: uppercase;
    margin: 0 0 10px;
}
.room-head {
    text-align: center;
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
    font-weight: 500; letter-spacing: 0.1em;
    margin: 0 0 10px;
}
.room-desc {
    text-align: center;
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin: 0 0 36px;
}

.photos {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 22px;
}
.photo-card {
    flex: 0 1 240px;
    width: 240px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 18px;
    padding: 12px 12px 14px;
    box-shadow:
        0 20px 40px -20px rgba(138, 30, 40, 0.16),
        0 8px 20px -12px rgba(40, 20, 30, 0.1),
        0 1px 0 rgba(255,255,255,0.9) inset;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .25s ease, box-shadow .25s ease;
}
.photo-card:hover { transform: translateY(-3px); box-shadow: 0 26px 50px -22px rgba(138, 30, 40, 0.22); }
.photo-card img {
    width: 100%; height: 280px; object-fit: cover;
    border-radius: 12px; display: block;
}
.photo-card .cap {
    margin: 12px 4px 2px;
    font-size: 0.9rem; line-height: 1.6; color: var(--ink);
}
.photo-card .cap .date {
    display: block;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    color: var(--ink);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.coming-soon {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 32px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px -20px rgba(138, 30, 40, 0.18);
}
.coming-soon .big-heart {
    font-size: 2.2rem; color: var(--accent);
    display: block; margin-bottom: 14px;
    animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat {
    0%, 100% { transform: scale(1); }
    25%      { transform: scale(1.12); }
    50%      { transform: scale(0.96); }
    75%      { transform: scale(1.08); }
}
.coming-soon h4 {
    margin: 0 0 10px;
    font-size: 1.15rem; font-weight: 500; letter-spacing: 0.06em;
}
.coming-soon p { margin: 0; color: var(--ink-soft); line-height: 1.7; font-size: 0.92rem; }

/* ============ 爱心粒子 ============ */
.hearts {
    position: fixed; inset: 0; pointer-events: none; z-index: 1;
    overflow: hidden;
}
.hearts span {
    position: absolute; bottom: -24px;
    color: rgba(201,79,91,0.5);
    font-size: 14px;
    animation: rise linear infinite;
    opacity: 0;
}
@keyframes rise {
    0%   { transform: translateY(0) scale(0.9); opacity: 0; }
    10%  { opacity: 0.75; }
    100% { transform: translateY(-110vh) scale(1.1); opacity: 0; }
}

/* ============ 全局 BGM 按钮 ============ */
.olo-audio-ctrl {
    position: fixed;
    right: 22px; bottom: 22px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.05);
    color: #c94f5b;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 8px 20px -8px rgba(201,79,91,0.35);
    opacity: 0; pointer-events: none;
    transition: opacity .4s ease, color .2s ease;
    font-family: inherit;
}
.olo-audio-ctrl.show { opacity: 1; pointer-events: auto; }
.olo-audio-ctrl svg { width: 18px; height: 18px; }
.olo-audio-ctrl.error { color: #999; }

@media (max-width: 520px) {
    .letter { padding: 14px 16px; }
    .letter-inner { font-size: 0.78rem; line-height: 1.55; }
    .letter-inner h3 { font-size: 0.98rem; margin-bottom: 6px; }
    .letter-inner p { margin-bottom: 4px; }
    .seal { width: 78px; height: 78px; }
    .seal-mark { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
