:root {
    --rose: #d95d75;
    --rose-dark: #a93f57;
    --rose-light: #fde8ed;
    --gold: #d4a359;
    --ink: #4a2d34;
    --muted: #8d6871;
    --paper: rgba(255, 255, 255, 0.82);
    --paper-border: rgba(255, 218, 226, 0.9);
    --seal: #c84b63;
    --glow: rgba(233, 132, 154, 0.4);
    --card-bg: rgba(255, 255, 255, 0.78);
    --card-border: rgba(255, 222, 230, 0.9);
    --unit-bg-top: rgba(255, 255, 255, 0.95);
    --unit-bg-bottom: rgba(255, 240, 245, 0.9);
    --heading-title: #4a2831;
    --code-color: #5c303c;
    --control-bg: rgba(255, 255, 255, 0.78);
    --control-border: rgba(255, 218, 226, 0.92);
    --body-bg:
        radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.95) 0, rgba(255, 255, 255, 0) 30%),
        radial-gradient(circle at 86% 14%, rgba(255, 182, 198, 0.45) 0, rgba(255, 182, 198, 0) 28%),
        linear-gradient(145deg, #fff9f6 0%, #fff0f3 50%, #f9e5ec 100%);
    --blob-a: #ffd6dc;
    --blob-b: #e8c9d8;
    --ambient-a: rgba(255, 182, 198, 0.32);
    --ambient-b: rgba(255, 214, 232, 0.26);
    --petal-color: rgba(217, 93, 117, 0.62);
    --petal-dot: radial-gradient(circle, rgba(255, 214, 224, 0.95), rgba(233, 132, 154, 0.4));
    --type-cursor: #d95d75;
    --vignette: transparent;
}

body.theme-night {
    --rose: #f2a4b5;
    --rose-dark: #f5bdc9;
    --rose-light: #3d2638;
    --gold: #e2b46b;
    --ink: #f4e8eb;
    --muted: #cbaab4;
    --paper: rgba(30, 20, 36, 0.8);
    --paper-border: rgba(255, 205, 225, 0.22);
    --seal: #f2a4b5;
    --glow: rgba(240, 160, 178, 0.32);
    --card-bg: rgba(32, 22, 38, 0.78);
    --card-border: rgba(255, 205, 225, 0.2);
    --unit-bg-top: rgba(54, 34, 58, 0.95);
    --unit-bg-bottom: rgba(40, 26, 46, 0.92);
    --heading-title: #f9ecef;
    --code-color: #ebd5dd;
    --control-bg: rgba(32, 22, 38, 0.8);
    --control-border: rgba(255, 205, 225, 0.22);
    --body-bg:
        radial-gradient(circle at 18% 16%, rgba(135, 62, 108, 0.45) 0, rgba(135, 62, 108, 0) 32%),
        radial-gradient(circle at 84% 12%, rgba(255, 176, 198, 0.2) 0, rgba(255, 176, 198, 0) 30%),
        linear-gradient(160deg, #181020 0%, #24162e 48%, #16101c 100%);
    --blob-a: #5a2d48;
    --blob-b: #3a2448;
    --ambient-a: rgba(255, 150, 180, 0.16);
    --ambient-b: rgba(170, 120, 220, 0.14);
    --petal-color: rgba(255, 196, 210, 0.65);
    --petal-dot: radial-gradient(circle, rgba(255, 224, 234, 0.92), rgba(240, 160, 178, 0.35));
    --type-cursor: #f2a4b5;
    --vignette: radial-gradient(ellipse at center, transparent 42%, rgba(8, 4, 12, 0.45) 100%);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 34px 0 18px;
    overflow-x: hidden;
    color: var(--ink);
    background: var(--body-bg);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    transition: color 0.45s ease, background 0.45s ease;
}

body::before,
body::after {
    position: fixed;
    z-index: -1;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    content: "";
    filter: blur(14px);
    opacity: 0.38;
    transition: background 0.45s ease, opacity 0.45s ease;
}

body::before {
    top: 14%;
    left: -170px;
    background: var(--blob-a);
}

body::after {
    right: -190px;
    bottom: 4%;
    background: var(--blob-b);
}

body.theme-night::before,
body.theme-night::after {
    opacity: 0.5;
}

#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#ambient-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 28%, var(--ambient-a), transparent 34%),
        radial-gradient(circle at 72% 62%, var(--ambient-b), transparent 36%),
        var(--vignette);
    opacity: 0.85;
    transition: opacity 0.6s ease, background 0.45s ease;
}

body.is-music-playing #ambient-glow {
    animation: ambientPulse 3.6s ease-in-out infinite;
}

.petal {
    position: absolute;
    top: -40px;
    color: var(--petal-color);
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    animation-name: petalFall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    will-change: transform, opacity;
    text-shadow: 0 2px 8px rgba(201, 88, 112, 0.22);
}

.petal.is-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--petal-dot);
    color: transparent;
    box-shadow: 0 0 10px var(--glow);
}

.envelope-sparkles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.sparkle-particle {
    position: fixed;
    font-size: 18px;
    color: #e05370;
    text-shadow: 0 0 10px rgba(230, 80, 110, 0.7);
    pointer-events: none;
    animation: sparkOut 1.1s cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

@keyframes sparkOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(var(--sc)) rotate(180deg);
    }
}

.top-controls {
    position: fixed;
    z-index: 20;
    top: 20px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#theme-toggle,
#music-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px 9px 11px;
    color: var(--rose-dark);
    border: 1px solid var(--control-border);
    border-radius: 999px;
    background: var(--control-bg);
    box-shadow: 0 10px 30px rgba(115, 55, 68, 0.12);
    backdrop-filter: blur(14px);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, background 0.2s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.theme-night #theme-toggle,
body.theme-night #music-toggle {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

#theme-toggle:hover,
#music-toggle:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
}

#theme-toggle:focus-visible,
#music-toggle:focus-visible {
    outline: 3px solid rgba(217, 93, 117, 0.28);
    outline-offset: 2px;
}

.theme-icon,
.music-icon {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #e7768b, #bc4962);
    font-size: 14px;
}

body.theme-night .theme-icon,
body.theme-night .music-icon {
    background: linear-gradient(135deg, #f0a0b2, #9b5fbf);
}

.theme-label,
.music-label {
    font-size: 12px;
    font-weight: 600;
}

.music-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.music-eq i {
    display: block;
    width: 2px;
    height: 40%;
    border-radius: 999px;
    background: var(--rose-dark);
    transform-origin: bottom center;
}

#music-toggle.is-playing .music-icon {
    display: none;
}

#music-toggle.is-playing .music-eq {
    display: flex;
}

#music-toggle.is-playing .music-eq i:nth-child(1) {
    animation: eqBar 0.9s ease-in-out infinite;
}

#music-toggle.is-playing .music-eq i:nth-child(2) {
    animation: eqBar 0.75s ease-in-out 0.12s infinite;
}

#music-toggle.is-playing .music-eq i:nth-child(3) {
    animation: eqBar 1s ease-in-out 0.05s infinite;
}

#music-toggle.is-playing .music-eq i:nth-child(4) {
    animation: eqBar 0.82s ease-in-out 0.18s infinite;
}

#page-heading {
    position: relative;
    z-index: 3;
    width: min(90vw, 680px);
    margin: 0 auto 6px;
    text-align: center;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#page-heading p {
    margin: 0 0 4px;
    color: var(--rose);
    font-family: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.36em;
    transition: color 0.35s ease;
}

#page-heading h1 {
    margin: 0;
    color: var(--heading-title);
    font-family: "Microsoft YaHei", "PingFang SC", "STKaiti", Georgia, serif;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 500;
    letter-spacing: 0.08em;
    transition: color 0.35s ease;
    animation: titleBreathe 5.5s ease-in-out infinite;
}

#page-heading > span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.12em;
    transition: opacity 0.5s ease, color 0.35s ease;
}

#page-heading.is-complete {
    opacity: 0.68;
    transform: translateY(-3px);
}

#page-heading.is-complete > span {
    opacity: 0;
}

#page-heading.is-complete h1 {
    animation: none;
}

#main {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 716px;
    overflow: hidden;
    transition: height 0.2s ease;
}

#wrap {
    position: relative;
    left: 50%;
    width: 1100px;
    height: 680px;
    margin-left: -550px;
    transform-origin: top center;
}

#canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 1100px;
    height: 680px;
    filter: drop-shadow(0 18px 26px rgba(139, 66, 82, 0.1));
    transition: filter 0.4s ease;
}

body.theme-night #canvas {
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.38)) brightness(0.98) saturate(1.08);
}

#text {
    position: absolute;
    z-index: 2;
    top: 36px;
    left: 36px;
    width: 440px;
    height: 485px;
    padding: 20px 24px 16px 28px;
    overflow: hidden;
    opacity: 0;
    border: 1px solid var(--paper-border);
    border-radius: 24px;
    background:
        linear-gradient(90deg, rgba(217, 93, 117, 0.12) 0 3px, transparent 3px),
        var(--paper);
    box-shadow: 0 20px 50px rgba(115, 55, 68, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    pointer-events: none;
    transform: translateY(18px) scale(0.985);
    filter: blur(2px);
    transition: opacity 0.9s ease, transform 0.9s ease, filter 0.9s ease, background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

body.theme-night #text {
    background:
        linear-gradient(90deg, rgba(240, 160, 178, 0.2) 0 3px, transparent 3px),
        var(--paper);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#text.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.letter-seal {
    position: absolute;
    top: 14px;
    right: 18px;
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 2px dashed rgba(200, 75, 99, 0.45);
    border-radius: 50%;
    color: var(--seal);
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.65), transparent 55%),
        rgba(255, 236, 241, 0.8);
    box-shadow: 0 6px 14px rgba(169, 63, 87, 0.12);
    transform: rotate(12deg);
    transition: color 0.35s ease, background 0.35s ease, border-color 0.35s ease;
}

body.theme-night .letter-seal {
    border-color: rgba(240, 160, 178, 0.45);
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 214, 230, 0.18), transparent 55%),
        rgba(58, 34, 56, 0.85);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26);
}

.letter-seal span {
    font-size: 16px;
    line-height: 1;
}

.letter-seal em {
    position: absolute;
    bottom: 8px;
    font-style: normal;
    font-family: Arial, sans-serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.letter-seal img {
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    filter: drop-shadow(0 1px 2px rgba(120, 60, 75, 0.25));
}

.letter-heading {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(190, 116, 133, 0.22);
}

body.theme-night .letter-heading {
    border-bottom-color: rgba(240, 160, 178, 0.18);
}

.letter-heading span {
    display: block;
    color: var(--rose);
    font-family: Arial, "PingFang SC", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
}

.letter-heading strong {
    display: block;
    margin-top: 2px;
    color: var(--heading-title);
    font-family: "Microsoft YaHei", "PingFang SC", serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: color 0.35s ease;
}

#code {
    display: none;
    color: var(--code-color);
    font-size: 13.5px;
    line-height: 20.5px;
    transition: color 0.35s ease;
}

.type-cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--type-cursor);
    font-weight: 700;
    text-shadow: 0 0 6px var(--glow);
    animation: cursorBlink 0.9s steps(1, end) infinite;
}

.say {
    margin-left: 3px;
    font-family: "Microsoft YaHei", "PingFang SC", "Kaiti SC", "STKaiti", serif;
}

.space {
    margin-right: 90px;
}

.say.signature {
    color: var(--rose-dark);
    font-family: Georgia, "Microsoft YaHei", serif;
    font-size: 15px;
    font-style: italic;
    letter-spacing: 0.04em;
}

#clock-box {
    position: absolute;
    z-index: 3;
    top: 540px;
    left: 36px;
    width: 440px;
    padding: 12px 18px 14px;
    display: none;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: 0 14px 32px rgba(115, 55, 68, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(14px);
    text-align: center;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

body.theme-night #clock-box {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#clock-box.is-shown {
    animation: clockPop 0.55s cubic-bezier(0.17, 0.88, 0.32, 1.25);
}

.clock-label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    transition: color 0.35s ease;
}

.clock-label strong {
    color: var(--rose-dark);
    font-weight: 600;
}

#clock,
.clock-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    white-space: normal;
}

.clock-unit {
    min-width: 0;
    padding: 8px 4px 7px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background:
        linear-gradient(180deg, var(--unit-bg-top), var(--unit-bg-bottom));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px rgba(169, 63, 87, 0.08);
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

body.theme-night .clock-unit {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 14px rgba(0, 0, 0, 0.22);
}

.clock-unit .digit {
    display: block;
    min-width: 0;
    color: var(--rose-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.02em;
    transition: color 0.35s ease;
}

.clock-unit .unit-label {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.12em;
}

#start-guide {
    position: absolute;
    left: 0;
    right: 0;
    top: 40%;
    z-index: 5;
    display: grid;
    justify-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.45s ease, transform 0.45s ease;
    transform: translateY(8px);
}

#start-guide.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#start-guide.is-visible .start-guide-card {
    cursor: pointer;
}

.start-guide-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    min-width: 340px;
    padding: 28px 36px 24px;
    color: inherit;
    border: 1px solid var(--card-border);
    border-radius: 28px;
    background: var(--card-bg);
    box-shadow: 0 20px 48px rgba(115, 55, 68, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    text-align: center;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    animation: guideFloat 2.8s ease-in-out infinite;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.25s ease;
}

.start-guide-card:hover {
    transform: translateY(-4px) scale(1.015);
    box-shadow: 0 26px 54px rgba(115, 55, 68, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.start-guide-card:focus-visible {
    outline: 3px solid rgba(217, 93, 117, 0.28);
    outline-offset: 3px;
}

body.theme-night .start-guide-card {
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.envelope {
    position: relative;
    width: 280px;
    height: 178px;
    margin: 2px auto 8px;
    perspective: 900px;
}

.envelope-paper {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 22px;
    bottom: 14px;
    z-index: 1;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 10px;
    border: 1px solid #e7bccb;
    border-radius: 8px;
    background: linear-gradient(160deg, #ffffff, #fdf2f5);
    box-shadow: 0 6px 16px rgba(150, 70, 90, 0.14);
    opacity: 0;
    transform: translateY(22px);
    transition: transform 0.85s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.5s ease;
}

.envelope-paper i {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: #f2c8d2;
}

.envelope-paper i:nth-child(1) { width: 120px; }
.envelope-paper i:nth-child(2) { width: 156px; }
.envelope-paper i:nth-child(3) { width: 92px; }

.envelope-paper em {
    margin-top: 4px;
    font-style: normal;
    font-family: Georgia, "Microsoft YaHei", serif;
    color: #c85f77;
    letter-spacing: 0.22em;
    font-size: 13px;
}

/* 信封主体：莫兰迪优雅烟粉色与复古纸感 */
.envelope-body {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 12px;
    background: linear-gradient(155deg, #f0cad4, #dfa3b2);
    box-shadow: inset 0 0 0 1px rgba(220, 150, 168, 0.4),
                inset 0 -12px 24px rgba(180, 100, 120, 0.2);
}

/* 前袋（信封下半部分）：莫兰迪柔粉纸质，自然融合 */
.envelope-pocket {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(160deg, #e8b8c5, #d694a5);
    clip-path: polygon(0 100%, 50% 58%, 100% 100%);
    filter:
        drop-shadow(1px 0 0.5px rgba(185, 110, 128, 0.6))
        drop-shadow(-1px 0 0.5px rgba(185, 110, 128, 0.6))
        drop-shadow(0 -1px 2px rgba(160, 80, 100, 0.18));
}

/* 盖子下方的接缝阴影：柔和自然的折叠阴影 */
.envelope-flap-shadow {
    position: absolute;
    inset: 0;
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 100% 30%, 50% 58%, 0 30%);
    background: #6a3542;
    transform: translateY(3px);
    filter: blur(3px);
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

/* 上盖：温润樱粉与珍珠奶白自然过渡 */
.envelope-flap {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: 12px 12px 0 0;
    background: radial-gradient(130% 92% at 50% 10%, #fff7f9 0%, #fae6ec 55%, #eed0da 100%);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 50% 58%, 0 30%);
    transform-origin: top center;
    transform: rotateX(0deg);
    transition: transform 0.7s ease;
    filter:
        drop-shadow(1px 0 0.5px rgba(200, 130, 148, 0.5))
        drop-shadow(-1px 0 0.5px rgba(200, 130, 148, 0.5))
        drop-shadow(0 1px 2px rgba(180, 90, 110, 0.25));
}

.envelope-seal {
    position: absolute;
    top: 103px;
    left: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 28%, #fffaf0 0%, #f4e6cb 68%, #e7cd97 100%);
    box-shadow: 0 6px 16px rgba(120, 50, 70, 0.35),
                inset 0 0 0 2px rgba(203, 155, 62, 0.6);
    z-index: 5;
    animation: heartPulse 1.8s ease-in-out infinite;
    transition: transform 0.5s ease, opacity 0.45s ease;
}

.envelope-seal img {
    display: block;
    width: 38px;
    height: 38px;
    pointer-events: none;
    filter: drop-shadow(0 1px 1px rgba(120, 70, 30, 0.25));
}

#start-guide.is-opening .start-guide-card {
    animation: none;
}

#start-guide.is-opening .envelope-flap {
    transform: rotateX(178deg);
    z-index: 0;
}

#start-guide.is-opening .envelope-flap-shadow {
    opacity: 0;
}

#start-guide.is-opening .envelope-paper {
    opacity: 1;
    transform: translateY(-32px);
}

#start-guide.is-opening .envelope-seal {
    transform: scale(0.2) rotate(35deg);
    opacity: 0;
    animation: none;
}

body.theme-night .envelope-body {
    background: linear-gradient(155deg, #6d4f5d, #48333e);
}

body.theme-night .envelope-pocket {
    background: linear-gradient(160deg, #5f4553, #3f2c38);
    filter:
        drop-shadow(1px 0 0 #82586e)
        drop-shadow(-1px 0 0 #82586e)
        drop-shadow(0 -1px 0 #82586e);
}

body.theme-night .envelope-flap {
    background: radial-gradient(130% 92% at 50% 10%, #6e4676 0%, #573461 60%, #472a49 100%);
    filter:
        drop-shadow(1px 0 0 #c79ad0)
        drop-shadow(-1px 0 0 #c79ad0)
        drop-shadow(0 -1px 0 #c79ad0)
        drop-shadow(0 1px 0 rgba(240, 214, 245, 0.4));
}

body.theme-night .envelope-flap-shadow {
    background: #000000;
    opacity: 0.6;
}

body.theme-night .envelope-paper {
    border-color: #4a3d64;
    background: linear-gradient(160deg, #2b2440, #241d38);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

body.theme-night .envelope-paper i {
    background: #5a4a72;
}

body.theme-night .envelope-paper em {
    color: #f0a0b2;
}

body.theme-night .envelope-seal {
    background: radial-gradient(circle at 36% 28%, #f6ecd6 0%, #ddc48f 68%, #cba76c 100%);
}

.start-guide-card strong {
    color: var(--heading-title);
    font-family: "Microsoft YaHei", "PingFang SC", serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.start-guide-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.16em;
}

#error {
    width: min(90vw, 720px);
    margin: 60px auto 0;
    padding: 18px;
    display: none;
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--ink);
    text-align: center;
}

#error a {
    color: var(--rose-dark);
}

.hand {
    cursor: pointer;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes eqBar {
    0%, 100% { height: 35%; }
    50% { height: 100%; }
}

@keyframes heartPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(231, 118, 139, 0.14);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 16px rgba(231, 118, 139, 0.08);
    }
}

@keyframes guideFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes petalFall {
    0% {
        opacity: 0;
        transform: translate3d(0, -20px, 0) rotate(0deg);
    }
    8% {
        opacity: 0.88;
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--drift, 40px), 110vh, 0) rotate(360deg);
    }
}

@keyframes titleBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.012); }
}

@keyframes ambientPulse {
    0%, 100% { opacity: 0.78; }
    50% { opacity: 1; }
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes clockPop {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    70% {
        opacity: 1;
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#memories {
    position: absolute;
    z-index: 3;
    top: 86px;
    right: 48px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 148px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#memories.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.memory-frame {
    position: relative;
    width: 100%;
    padding: 10px 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: 0 16px 34px rgba(115, 55, 68, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.35s ease, box-shadow 0.35s ease, background 0.35s ease, border-color 0.35s ease;
}

#memories.is-visible .memory-frame {
    animation: memoryIn 0.7s ease both;
}

#memories.is-visible .memory-frame:nth-child(1) {
    animation-delay: 0.05s;
}

#memories.is-visible .memory-frame:nth-child(2) {
    animation-delay: 0.18s;
}

#memories.is-visible .memory-frame:nth-child(3) {
    animation-delay: 0.32s;
}

.memory-frame:hover,
.memory-frame:focus-within {
    z-index: 2;
    transform: rotate(0deg) translateY(-4px) scale(1.04);
    box-shadow: 0 22px 42px rgba(115, 55, 68, 0.22);
}

body.theme-night .memory-frame {
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
}

body.theme-night .memory-frame:hover,
body.theme-night .memory-frame:focus-within {
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.38);
}

.memory-photo {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 92px;
    overflow: hidden;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.08em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.memory-photo span {
    position: relative;
    z-index: 1;
    font-family: "Microsoft YaHei", "PingFang SC", Georgia, serif;
    font-size: 18px;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.memory-photo-a {
    background:
        radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.42), transparent 36%),
        linear-gradient(145deg, #f2a0b2 0%, #d86b84 48%, #b94f6d 100%);
}

.memory-photo-a span:first-child {
    margin-right: 8px;
}

.memory-photo-b {
    background:
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.35), transparent 34%),
        linear-gradient(160deg, #efc2cf 0%, #e0899d 42%, #c45f7d 100%);
}

.memory-photo-b span {
    font-size: 28px;
}

.memory-photo-b img {
    position: relative;
    z-index: 1;
    width: 46px;
    height: 46px;
    filter: drop-shadow(0 2px 8px rgba(80, 20, 40, 0.28));
}

.memory-photo-c {
    background:
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.28), transparent 38%),
        linear-gradient(150deg, #d7b3e5 0%, #c07db0 45%, #8f5b9d 100%);
}

.memory-photo-c span {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    letter-spacing: 0.16em;
}

body.theme-night .memory-photo-a {
    background:
        radial-gradient(circle at 28% 24%, rgba(255, 214, 230, 0.24), transparent 36%),
        linear-gradient(145deg, #8a3f5c 0%, #6a2f4d 48%, #4a2440 100%);
}

body.theme-night .memory-photo-b {
    background:
        radial-gradient(circle at 70% 30%, rgba(255, 214, 230, 0.2), transparent 34%),
        linear-gradient(160deg, #7a3f5c 0%, #5a2d48 42%, #3d2238 100%);
}

body.theme-night .memory-photo-c {
    background:
        radial-gradient(circle at 40% 20%, rgba(230, 210, 255, 0.18), transparent 38%),
        linear-gradient(150deg, #5a3a72 0%, #46305e 45%, #2f2344 100%);
}

.memory-meta {
    margin-top: 8px;
    text-align: center;
}

.memory-meta strong {
    display: block;
    color: var(--heading-title);
    font-family: "Microsoft YaHei", "PingFang SC", Georgia, serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.memory-meta p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
}

@keyframes memoryIn {
    0% {
        opacity: 0;
        transform: translateY(16px) rotate(var(--tilt, 0deg)) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1);
    }
}

@media (max-width: 700px) {
    body {
        padding-top: 72px;
    }

    .top-controls {
        top: 14px;
        right: 14px;
        gap: 8px;
    }

    #theme-toggle .theme-label,
    #music-toggle .music-label {
        display: none;
    }

    #theme-toggle,
    #music-toggle {
        padding: 8px;
    }

    #page-heading h1 {
        font-size: 25px;
    }

    #page-heading > span {
        font-size: 11px;
    }

    .start-guide-card {
        min-width: 250px;
        padding: 18px 20px 16px;
    }

    .envelope {
        height: 148px;
        transform: scale(0.82);
        transform-origin: top center;
    }

    .start-guide-card strong {
        font-size: 17px;
    }

    #memories {
        top: 72px;
        right: 28px;
        width: 118px;
        gap: 12px;
    }

    .memory-photo {
        height: 72px;
    }

    .memory-photo span {
        font-size: 14px;
    }

    .memory-photo-b span {
        font-size: 22px;
    }

    .memory-photo-c span {
        font-size: 12px;
    }

    .memory-meta strong {
        font-size: 11px;
    }

    .memory-meta p {
        font-size: 10px;
    }
}

/* 移动端专属渲染优化：彻底解决 Canvas 重绘滤镜卡顿，PC 端 100% 不受影响 */
body.is-mobile #canvas,
@media (max-width: 768px) {
    #canvas {
        filter: none !important;
    }
    
    body.is-music-playing #ambient-glow {
        animation: none !important;
    }

    #text,
    #clock-box,
    .start-guide-card,
    .memory-frame,
    #theme-toggle,
    #music-toggle {
        backdrop-filter: blur(6px) !important;
    }

    .petal {
        text-shadow: none !important;
    }

    body::before,
    body::after {
        filter: blur(30px);
        opacity: 0.25;
    }
}

@media (prefers-reduced-motion: reduce) {
    #page-heading,
    #text,
    #theme-toggle,
    #music-toggle,
    #start-guide,
    #ambient-glow,
    #memories,
    .memory-frame {
        transition: none;
    }

    #page-heading h1,
    #music-toggle.is-playing .music-eq i,
    .envelope-seal,
    .envelope-flap,
    .envelope-paper,
    .start-guide-card,
    .petal,
    body.is-music-playing #ambient-glow,
    .type-cursor,
    #clock-box.is-shown,
    #memories.is-visible .memory-frame {
        animation: none !important;
    }

    .envelope-flap,
    .envelope-paper,
    .envelope-seal {
        transition: none;
    }

    #start-guide.is-opening .envelope-paper {
        opacity: 1;
        transform: none;
    }

    .petal {
        display: none;
    }

    #text {
        filter: none;
        transform: none;
    }

    #start-guide.is-visible .start-guide-card {
        transform: none;
    }
}
