:root {
    --twilight-blue: #0a0e17;
    /* Deep Twilight Blue */
    --amber-glow: rgba(255, 191, 0, 0.6);
    /* Warmer, amber-tinted white with 90% opacity */
    --mist-white: rgba(255, 252, 245, 0.9);
    --text-shadow-mist: 0 0 10px rgba(255, 252, 245, 0.3);
}

/* ... unchanged ... */

.text-content p {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    font-weight: 200;
    /* ExtraLight */
    line-height: 1.8;
    letter-spacing: 0.2em;
    /* +20% spacing */
    color: var(--mist-white);
    text-shadow: var(--text-shadow-mist);
    margin-bottom: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #000;
    /* Dark background outside the app */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    color: var(--mist-white);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* App Container - Fixed 9:16 Aspect Ratio */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    aspect-ratio: 9 / 16;
    background-color: var(--bg-primary);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s ease;
}

/* Constrain width on desktop to maintain aspect ratio */
@media (min-aspect-ratio: 9/16) {
    .app-container {
        width: auto;
        height: 100vh;
    }
}

/* Video Background */
.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Smooth easing for zoom */
}

.video-background.zoom-in {
    transform: scale(1.3);
    /* Slight zoom in */
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.4);
    /* Slight tint to improve readability */
    /* Add subtle film grain overlay here in future if needed */
}

/* ===== Image Protection ===== */
img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: auto;
    /* Allow clicks but prevent drag */
}

.photo-surface,
.photo-frame,
.polaroid-frame {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* iOS Safari */
}

/* Canvas for Particles */
#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* Page Containers */
.page-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    z-index: 2;
    transition: opacity 1s ease;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Page 2 Specifics */
#page2 {
    justify-content: space-between;
    padding-bottom: 5rem;
    /* Match Page 1 bottom padding */
}

.page-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    /* Match Page 1 */
    color: var(--mist-white);
    margin-bottom: 4rem;
    margin-top: 15vh;
    /* Match Page 1 position */
    text-shadow: 0 0 8px rgba(255, 252, 245, 0.2);
    /* Match Page 1 */
    letter-spacing: 0.2em;
    /* Match Page 1 */
    line-height: 1.8;
    /* Match Page 1 */
    display: flex;
    flex-direction: column;
    width: 100%;
}

.title-line-1 {
    font-weight: 200;
    /* ExtraLight */
    align-self: flex-start;
    margin-bottom: 0.5rem;
    opacity: 0;
    /* Hidden until JS reveals it */
}

.title-line-2 {
    font-weight: 400;
    /* Light/Regular */
    align-self: flex-end;
    margin-right: 1rem;
    /* Slight adjustment from edge */
    opacity: 0;
    /* Hidden until JS reveals it */
}

/* Poem-style Inputs */
.form-container {
    width: 100%;
}

.input-group {
    position: relative;
    margin-bottom: 3rem;
    opacity: 0;
    /* JS will reveal these one by one */
    transform: translateY(20px);
    /* Start slightly lower */
}

input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--mist-white);
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    padding: 0.5rem 0;
    letter-spacing: 0.1em;
    text-align: center;
}

.input-field::placeholder {
    color: var(--text-muted);
    font-style: italic;
}


/* Textarea for Page 7 */
.message-textarea {
    width: 100%;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 252, 245, 0.2);
    border-radius: 8px;
    outline: none;
    color: var(--mist-white);
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    padding: 1rem;
    letter-spacing: 0.1em;
    resize: none;
    transition: all 0.3s ease;
}

.message-textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
    box-shadow: 0 0 20px rgba(255, 252, 245, 0.1);
}

.message-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.input-label {
    display: block;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.char-count {
    position: absolute;
    bottom: -1.5rem;
    right: 0;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 1px;
    background: rgba(255, 252, 245, 0.3);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

input:focus+.input-line,
.message-textarea:focus~.input-line {
    background: var(--mist-white);
    box-shadow: 0 0 8px var(--amber-glow);
}

/* Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.glass-panel {
    background: rgba(20, 25, 35, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    width: 80%;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.relation-option {
    padding: 1rem;
    text-align: center;
    color: var(--mist-white);
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
}

.relation-option:last-child {
    border-bottom: none;
}

.relation-option:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 1s ease-out forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Intro Text Container */
.intro-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    /* Fill the app container */
    width: 100%;
    padding: 3rem 2rem 5rem 2rem;
}

.text-content {
    text-align: center;
    position: relative;
    opacity: 0;
    margin-top: 15vh;
    margin-bottom: 2rem;
    /* Unified spacing between title and content */
}

.text-content p {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    font-weight: 200;
    /* ExtraLight */
    line-height: 1.8;
    letter-spacing: 0.2em;
    /* +20% spacing */
    color: var(--mist-white);
    text-shadow: 0 0 8px rgba(255, 252, 245, 0.2);
    margin-bottom: 0.5rem;
}

.char-span {
    opacity: 0;
    display: inline-block;
    filter: blur(2px);
    transition: opacity 1s ease, filter 1s ease;
}

.char-span.visible {
    opacity: 1;
    filter: blur(0);
}

/* Interaction Area */
.interaction-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 2s ease;
}

.interaction-area.visible {
    opacity: 1;
}

.glowing-line {
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    box-shadow: 0 0 8px var(--amber-glow);
    margin-top: 12px;
    animation: breathe 6s infinite ease-in-out;
}

.action-text {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 3px;
    opacity: 0.7;
    text-transform: uppercase;
}

@keyframes breathe {

    0%,
    100% {
        opacity: 0.5;
        box-shadow: 0 0 5px var(--amber-glow);
        transform: scaleX(0.9);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 15px var(--amber-glow), 0 0 5px rgba(255, 255, 255, 0.8);
        transform: scaleX(1.1);
    }
}

/* Page 3: Photo Upload */
#page3 {
    justify-content: space-between;
    padding-bottom: 5rem;
}

/* Page 4: Memory Moments */
#page4 {
    justify-content: space-between;
    padding-bottom: 5rem;
}

.page4-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.skip-btn {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

.skip-btn:hover {
    color: var(--mist-white);
}

/* Back Button */
.back-btn {
    position: absolute;
    top: max(1.5rem, env(safe-area-inset-top) + 0.5rem);
    right: max(1.5rem, env(safe-area-inset-right) + 0.5rem);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 20;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: var(--mist-white);
}

.back-btn img {
    object-fit: contain;
}

@keyframes rotate-counter-slow {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* Generic Settings Button */
.settings-btn {
    position: absolute;
    top: max(1.5rem, env(safe-area-inset-top) + 0.5rem);
    left: max(1.5rem, env(safe-area-inset-left) + 0.5rem);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 20;
    transition: color 0.3s ease;
    perspective: 1000px;
}

.settings-btn:hover {
    color: var(--mist-white);
}

.settings-btn img {
    /* Ensure image is contained and transitions smoothly */
    object-fit: contain;
}

@keyframes swanRotateY {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

@keyframes rotate-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.page-subtitle {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    /* Match Page 1 */
    font-weight: 200;
    color: var(--mist-white);
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 15vh;
    /* Match Page 1 position */
    opacity: 0;
    line-height: 1.8;
    letter-spacing: 0.2em;
    /* Match Page 1 */
    text-shadow: 0 0 8px rgba(255, 252, 245, 0.2);
    /* Match Page 1 */
}

.photo-section {
    width: 100%;
}

.section-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: rgba(255, 191, 0, 0.8);
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: 0.2em;
}

.memory-label {
    margin-top: 2rem;
}

.section-hint {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    font-weight: 200;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1rem;
    font-style: italic;
}

/* Core Photos */
.core-photos {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.additional-photos {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    /* Match gap for consistent spacing */
}

/* Memory Photos Grid */
.memory-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    padding: 0 1rem;
}

/* Photo Frames */
.photo-frame {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.photo-frame:hover {
    transform: scale(1.05);
}

.photo-frame.circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid rgba(255, 191, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 191, 0, 0.2);
}

.photo-frame.portrait-rect {
    width: 140px;
    height: 200px;
    border-radius: 8px;
    border: 2px solid rgba(255, 191, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 191, 0, 0.2);
    margin: 0 1rem;
}

.photo-frame.square {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 252, 245, 0.1);
    /* filter: blur(1px); Removed to keep text sharp */
    transition: filter 0.6s ease, border 0.6s ease;
}

.photo-frame.square .nebula-bg {
    filter: blur(2px);
}

.photo-frame.square.has-image {
    filter: blur(0);
    border: 1px solid rgba(255, 252, 245, 0.4);
}

/* Nebula Background */
.nebula-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 40%,
            rgba(59, 130, 246, 0.3) 0%,
            rgba(147, 51, 234, 0.2) 40%,
            rgba(255, 191, 0, 0.1) 70%,
            transparent 100%);
    animation: nebulaFlow 8s ease-in-out infinite;
    z-index: 0;
}

@keyframes nebulaFlow {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.8;
    }
}

/* Frame Labels */
.frame-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--mist-white);
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: center;
    line-height: 1.5;
}

.photo-frame.square .frame-label {
    color: #FFFFFF;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.frame-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Noto Serif SC', serif;
    font-size: 0.65rem;
    font-weight: 200;
    color: var(--text-secondary);
    z-index: 1;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Hide labels when image is uploaded */
.photo-frame.has-image .frame-label,
.photo-frame.has-image .frame-hint,
.photo-frame.has-image .nebula-bg {
    opacity: 0;
}

/* File Input (Hidden) */
.file-input {
    display: none;
}

/* --- Page 5 Styles --- */
#page5 {
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    padding-bottom: 5rem;
}

/* Transition Overlay */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.light-burst {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 50px 20px rgba(255, 255, 255, 0.8),
        0 0 100px 50px rgba(255, 191, 0, 0.5);
    opacity: 0;
    transform: scale(1);
}

.light-burst.active {
    animation: burstAnimation 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes burstAnimation {
    0% {
        opacity: 0;
        transform: scale(0.1);
    }

    10% {
        opacity: 1;
        transform: scale(2);
    }

    50% {
        opacity: 1;
        transform: scale(20);
        background: radial-gradient(circle, white 0%, rgba(255, 252, 245, 1) 30%, transparent 70%);
    }

    100% {
        opacity: 0;
        transform: scale(50);
    }
}

/* Star Path */
.star-path-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transition: opacity 1s ease;
}

.star-node {
    fill: #FFD700;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
}

.star-node.active {
    animation: nodePulse 1.5s infinite ease-in-out;
}

.star-path-line {
    fill: none;
    stroke: rgba(255, 215, 0, 0.3);
    stroke-width: 2;
    stroke-dasharray: 10 5;
}

@keyframes nodePulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
    }

    50% {
        transform: scale(1.5);
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
    }
}

/* Intro Text */
.intro-text-container {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    text-align: center;
    z-index: 5;
}

.intro-text-line {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: var(--mist-white);
    letter-spacing: 0.1em;
    line-height: 1.8;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: opacity 1s ease;
}

/* Gift Button */
.gift-button-container {
    position: absolute;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    z-index: 10;
    transition: opacity 1s ease;
}

.ribbon-button {
    background: linear-gradient(135deg, #d4af37 0%, #f9d976 50%, #d4af37 100%);
    padding: 0.8rem 2.5rem;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    position: relative;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ribbon-button:hover {
    transform: scale(1) translateX(-50%);
    /* Need to handle transform carefully since parent centers it */
    transform: scale(1);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

.ribbon-text {
    font-family: 'Noto Serif SC', serif;
    color: #4a3b10;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.1em;
    display: block;
}

.shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
    transform: skewX(-25deg);
    animation: shimmerMove 3s infinite;
}

@keyframes shimmerMove {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* --- Page 6 Styles --- */
#page6 {
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    padding-bottom: 5rem;
}

.polaroid-wrapper {
    perspective: 1000px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s ease, transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.polaroid-frame {
    width: 300px;
    padding: 15px 15px 60px 15px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    transform: rotate(-2deg);
    position: relative;
    overflow: hidden;
}

.photo-surface {
    width: 100%;
    aspect-ratio: 1;
    background-color: #1a1a1a;
    /* Background image will be set dynamically via JavaScript */
    background-size: cover;
    background-position: center;
    position: relative;
    filter: blur(20px) grayscale(100%) brightness(0.2);
    transition: filter 4s ease-in-out;
}

.photo-surface.developing {
    animation: developPolaroid 4s ease-in-out forwards;
}

.developing-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 191, 0, 0.2) 0%, transparent 50%, rgba(255, 191, 0, 0.1) 100%);
    mix-blend-mode: overlay;
    opacity: 0;
    animation: liquidLight 4s ease-in-out forwards;
}

@keyframes developPolaroid {
    0% {
        filter: blur(20px) grayscale(100%) brightness(0.2);
    }

    30% {
        filter: blur(15px) grayscale(80%) brightness(0.4);
    }

    60% {
        filter: blur(8px) grayscale(40%) brightness(0.7);
    }

    100% {
        filter: blur(0px) grayscale(0%) brightness(1);
    }
}

@keyframes liquidLight {
    0% {
        opacity: 0;
        transform: translateY(20%);
    }

    20% {
        opacity: 0.6;
    }

    80% {
        opacity: 0.4;
    }

    100% {
        opacity: 0;
        transform: translateY(0);
    }
}

.polaroid-caption {
    font-family: 'Shadows Into Light', cursive, sans-serif;
    color: #333;
    font-size: 1.2rem;
    text-align: center;
    margin-top: 20px;
    /* Adjust since bottom padding is large */
    position: absolute;
    bottom: 15px;
    width: 100%;
    left: 0;
    opacity: 0;
    transition: opacity 2s ease 3s;
}

.message-container {
    margin-top: 40px;
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease;
    transform: translateY(20px);
}

.message-container p {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    color: var(--text-primary);
    line-height: 2;
    letter-spacing: 0.15em;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.message-container.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1.5s ease, transform 1.5s ease-out;
}

/* Fullscreen Overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Watermark for fullscreen image only */
.fullscreen-overlay::before {
    content: '© MissU 仅供纪念';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 2rem;
    font-family: 'Noto Serif SC', serif;
    color: rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 2001;
    white-space: nowrap;
    letter-spacing: 0.3em;
}

.fullscreen-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#fullscreenImage {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fullscreen-overlay.visible #fullscreenImage {
    transform: scale(1);
}

.upsell-text {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: #FFD700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    background: transparent;
    padding: 0.5rem 1rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2001;
    letter-spacing: 0.05em;
}

.upsell-text.visible {
    opacity: 1;
}

.upsell-text .char-span {
    opacity: 0;
    display: inline-block;
    transition: opacity 0.3s ease;
}

.upsell-text .char-span.visible {
    opacity: 1;
}

/* Upsell Play Button */
.upsell-play-btn {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #FFD700;
    color: #FFD700;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upsell-play-btn svg {
    transform: translateX(2px);
}

.upsell-play-btn.visible {
    opacity: 1;
}

.upsell-play-btn.flash {
    animation: flashButton 0.5s ease-in-out 2;
}

.upsell-play-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

@keyframes flashButton {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }

    50% {
        opacity: 0.3;
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

/* Preview Image */
.preview-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
}

.preview-image.developing {
    animation: developPhoto 1.5s ease-out forwards;
}

@keyframes developPhoto {
    0% {
        opacity: 0;
        filter: blur(10px) brightness(0.5);
        transform: scale(0.9);
    }

    50% {
        opacity: 0.7;
        filter: blur(5px) brightness(1.2);
    }

    80% {
        opacity: 1;
        filter: blur(0) brightness(1.3);
    }

    100% {
        opacity: 1;
        filter: blur(0) brightness(1);
        transform: scale(1);
    }
}

/* Photo particle */
.photo-particle {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 191, 0, 0.9), rgba(255, 252, 245, 0.6));
    box-shadow: 0 0 20px rgba(255, 191, 0, 0.8);
    z-index: 100;
    pointer-events: none;
}

/* --- Page 7: Letter Writing --- */
#page7 {
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    padding-bottom: 5rem;
}

.blur-background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(25px) brightness(0.3);
    transform: scale(1.1);
    z-index: 1;
}

.letter-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 500px;
    height: 65vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.letter-paper {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.paper-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 8px;
    z-index: 1;
}

.handwritten-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    font-family: 'Shadows Into Light', cursive, 'Noto Serif SC', serif;
    font-size: 1.6rem;
    color: var(--text-primary);
    line-height: 2;
    outline: none;
    z-index: 2;
    position: relative;
}

.handwritten-input::placeholder {
    color: rgba(255, 252, 245, 0.25);
}

.corner-star {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 18px;
    height: 18px;
    background: #FFD700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 0 12px #FFD700, 0 0 25px rgba(255, 215, 0, 0.5);
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 5;
    animation: twinkle 2s infinite ease-in-out;
}

.corner-star.visible {
    opacity: 1;
}

@keyframes twinkle {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.4);
    }
}

.wax-seal-btn {
    position: absolute;
    bottom: -30px;
    right: -30px;
    width: 90px;
    height: 90px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0) rotate(0deg);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 15;
}

.wax-seal-btn.visible {
    opacity: 1;
    transform: scale(1) rotate(15deg);
}

.wax-seal-btn:hover {
    transform: scale(1.1) rotate(15deg) !important;
}

.wax-seal-btn:active {
    transform: scale(0.95) rotate(0deg) !important;
}

.seal-circle {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 35%, #e63946, #9e2a2b);
    border-radius: 50%;
    box-shadow: 3px 5px 15px rgba(0, 0, 0, 0.5),
        inset -3px -3px 10px rgba(0, 0, 0, 0.3),
        inset 2px 2px 8px rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.seal-circle::before {
    content: '';
    position: absolute;
    width: 75%;
    height: 75%;
    border: 2px dashed rgba(255, 215, 0, 0.35);
    border-radius: 50%;
}

.seal-text {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffd700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
    text-align: center;
    z-index: 1;
}

/* Flying Particle */
.flying-particle {
    position: fixed;
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, #FFD700, #FFA500);
    border-radius: 50%;
    box-shadow: 0 0 25px 8px rgba(255, 215, 0, 0.8),
        0 0 50px 15px rgba(255, 165, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.flying-particle.flying {
    animation: particleFly 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes particleFly {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    85% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50vw + 20vw), calc(-50vh + 15vh)) scale(0.3);
        top: 0;
        left: 0;
    }
}

/* ===== PAGE 8: MAIN HALL ===== */
#page8 {
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Memorial Timer (Top Right) */
.memorial-timer-container {
    position: absolute;
    top: max(1.5rem, env(safe-area-inset-top) + 0.5rem);
    right: max(1.5rem, env(safe-area-inset-right) + 0.5rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 20;
}

.timer-icon {
    font-size: 1rem;
    opacity: 0.7;
    color: var(--text-secondary);
}



.memorial-timer {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* Calendar Wrapper */
.calendar-wrapper {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 380px;
    margin: 0 auto;
    /* Centered horizontally, vertical positioning from .page-content-center */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
}

.calendar-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.calendar-month-ye.page-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    font-weight: 300;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    letter-spacing: 0.3em;
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.day-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-muted);
    text-align: center;
    padding: 0.3rem 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
}

.calendar-date-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.calendar-date-cell.empty {
    opacity: 0.3;
}

/* Calendar cells with photos */
.calendar-date-cell .photo-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-date-cell .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.calendar-date-cell .date-number {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.7rem;
    color: var(--text-primary);
    z-index: 2;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

/* Make cells with content position relative */
.calendar-date-cell:has(.photo-frame) {
    position: relative;
    overflow: hidden;
}

.calendar-date-cell.today {
    position: relative;
    background: rgba(255, 191, 0, 0.1);
    border: 1px solid rgba(255, 191, 0, 0.3);
    overflow: hidden;
}

.calendar-date-cell.today .date-number {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.7rem;
    color: var(--text-primary);
    z-index: 2;
}

.calendar-date-cell.today .photo-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: breathe 8s infinite ease-in-out;
}

.calendar-date-cell.today .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.calendar-date-cell.today .candlelight-glow {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(255, 191, 0, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(4px);
    animation: flicker 2s infinite ease-in-out;
}

/* Locked past dates */
.calendar-date-cell.locked {
    position: relative;
    cursor: pointer;
}

.calendar-date-cell.locked .photo-frame img {
    filter: grayscale(100%);
    opacity: 0.5;
}

.calendar-date-cell.locked .lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 3;
    pointer-events: none;
}

.calendar-date-cell.locked .lock-icon {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
}

/* Slideshow Styles */
.slideshow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
}

.slideshow-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.slideshow-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform-origin: center center;
    transition: opacity 1.5s ease-in-out;
}

.slideshow-image.active {
    opacity: 1;
    animation: ken-burns 8s ease-out forwards;
}

/* Ken Burns Animation */
@keyframes ken-burns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.1) translate(var(--move-x, 10px), var(--move-y, -10px));
    }
}

.slideshow-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 2001;
    opacity: 0;
    transition: opacity 0.5s;
}

.slideshow-container:hover .slideshow-controls {
    opacity: 1;
}

.slideshow-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.slideshow-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.slideshow-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    width: 0%;
    transition: width 0.3s linear;
}

#dailyPhoto {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Candlelight Glow (Night Mode) */
.candlelight-glow {
    position: absolute;
    top: -20%;
    left: -20%;
    right: -20%;
    bottom: -20%;
    background: radial-gradient(circle, rgba(255, 193, 7, 0.3) 0%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
}

.night .candlelight-glow {
    opacity: 1;
}

/* Play Button */
.play-button {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
}

.play-button:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.play-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.9);
    letter-spacing: 0.05em;
}

/* Function Row */
.function-row {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5rem;
    z-index: 100;
}

.func-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    padding: 0.5rem;
}

.func-btn:hover {
    color: var(--text-primary);
}

.func-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}



/* Glassmorphism utility class */
.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== CSS VARIABLES FOR THEME SUPPORT ===== */
:root {
    /* Dark Mode (Default) */
    --bg-primary: #000000;
    --bg-secondary: rgba(18, 18, 18, 0.9);
    --bg-modal: rgba(24, 24, 24, 0.9);
    --text-primary: rgba(255, 252, 245, 0.9);
    --text-secondary: rgba(255, 252, 245, 0.7);
    --text-muted: rgba(255, 252, 245, 0.5);
    --accent-gold: #FFD700;
    --accent-gold-dim: rgba(255, 215, 0, 0.7);
    --border-color: rgba(255, 215, 0, 0.15);
    --border-color-strong: rgba(255, 215, 0, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

/* Light Mode Theme */
body.light-mode {
    --bg-primary: #181818;
    --bg-secondary: rgba(31, 31, 31, 0.9);
    --bg-modal: rgba(24, 24, 24, 0.95);
    --text-primary: rgba(240, 240, 240, 0.95);
    --text-secondary: rgba(220, 220, 220, 0.8);
    --text-muted: rgba(180, 180, 180, 0.6);
    --accent-gold: #ffd700;
    --accent-gold-dim: rgba(255, 215, 0, 0.7);
    --border-color: rgba(80, 80, 80, 0.3);
    --border-color-strong: rgba(120, 120, 120, 0.6);
    --shadow-color: rgba(0, 0, 0, 0.6);
}

/* ===== GLOBAL STYLES ===== */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.settings-modal:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.settings-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    /* 透明背景，不变黑 */
    backdrop-filter: blur(5px);
    /* 降低模糊程度 */
    -webkit-backdrop-filter: blur(5px);
}

.settings-panel {
    position: relative;
    width: 85%;
    max-width: 400px;
    max-height: 85vh;
    background: var(--bg-secondary);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.settings-modal:not(.hidden) .settings-panel {
    transform: scale(1);
}

/* Header */
.settings-header {
    position: relative;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.settings-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
    letter-spacing: 0.15em;
}

.settings-close {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Content */
.settings-content {
    padding: 1rem 0;
    max-height: calc(85vh - 80px);
    overflow-y: auto;
}

.settings-content::-webkit-scrollbar {
    width: 4px;
}

.settings-content::-webkit-scrollbar-track {
    background: rgba(255, 215, 0, 0.05);
}

.settings-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 2px;
}

/* Section */
.settings-section {
    padding: 0 1.5rem;
}

/* Settings Item */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    gap: 1rem;
}

.settings-item.clickable {
    cursor: pointer;
    transition: background 0.3s ease;
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem;
}

.settings-item.clickable:hover {
    background: rgba(255, 215, 0, 0.05);
}

.settings-item-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
}

.settings-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-gold-dim);
    flex-shrink: 0;
    margin-top: 2px;
}

.settings-item-text {
    flex: 1;
}

.settings-item-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.settings-item-desc {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Compact Mode Overrides */
.settings-section-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: rgba(255, 215, 0, 0.5);
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
}

.settings-item.compact {
    padding: 0.5rem 0;
    margin: 0;
}

.settings-item.compact .settings-item-text {
    font-size: 0.95rem;
}

.settings-toggle.compact {
    transform: scale(0.85);
    transform-origin: right center;
}

.settings-divider.compact {
    margin: 0.5rem 1.5rem;
}

.settings-version.compact {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    opacity: 0.5;
}

/* Specific to compact clickable items */
.settings-item.compact.clickable {
    padding: 0.6rem 1.5rem;
    margin: 0 -1.5rem;
}

/* Main Settings Toggle base styles (ensure these exist) */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 252, 245, 0.15);
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: 0.4s;
    border-radius: 50%;
}

.settings-toggle input:checked+.toggle-slider {
    background-color: var(--accent-gold-dim);
}

.settings-toggle input:checked+.toggle-slider:before {
    transform: translateX(22px);
    background-color: var(--accent-gold);
}

/* Arrow Icon */
.settings-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Divider */
.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1.5rem;
}

.settings-divider.danger {
    background: rgba(220, 80, 80, 0.2);
    margin: 1.5rem 1.5rem 0.5rem;
}

/* Version Info */
.settings-version {
    text-align: center;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.7rem;
    color: rgba(255, 252, 245, 0.3);
    padding: 1.5rem 1.5rem 0.5rem;
    letter-spacing: 0.05em;
}

/* Danger Zone */
.danger-zone {
    padding-bottom: 1rem;
}

.settings-item.danger {
    opacity: 0.8;
}

.settings-item.danger:hover {
    background: rgba(220, 80, 80, 0.08);
    opacity: 1;
}

.danger-text {
    color: rgba(220, 80, 80, 0.85) !important;
}

/* ===== ACCOUNT MANAGEMENT MODAL ===== */

/* Account Management Modal Tab Navigation */
.account-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 0 1.5rem;
    margin: 0 1rem 1rem;
    position: relative;
}

.account-tabs::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: rgba(255, 215, 0, 0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Noto Serif SC', serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.account-tab {
    position: relative;
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.account-tab.active {
    color: var(--text-primary);
}

.account-tab:not(:first-child)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 1.2rem;
    background: rgba(255, 215, 0, 0.3);
}

.account-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    box-shadow: 0 0 8px var(--accent-gold-dim);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.account-tab.active::after {
    transform: scaleX(1);
}

/* Tab Content */
.account-tab-content {
    padding: 1.5rem;
    display: none;
    animation: fadeIn 0.4s ease;
    min-height: 180px;
    max-height: 180px;
}

.account-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Personal Account Page */
.account-email-container {
    text-align: center;
    padding: 2rem 0;
}

.account-email-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: var(--accent-gold-dim);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.account-email-display {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0.5rem 0;
    background: transparent;
    border: none;
    letter-spacing: 0.05em;
}

/* Password Reset Page */
.password-reset-container {
    padding: 0.5rem 0;
}

.password-reset-hint {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-align: center;
}

.password-reset-btn {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.password-reset-btn:hover {
    opacity: 0.9;
}

.password-reset-btn .glowing-line {
    display: block;
    width: 80px;
    margin-bottom: 8px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    box-shadow: 0 0 8px var(--accent-gold-dim);
    transition: all 0.3s ease;
}

.password-reset-btn .action-text {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 3px;
    opacity: 0.7;
    text-transform: uppercase;
    color: var(--text-primary);
}

/* ===== TERMS AND PRIVACY CONTENT STYLES ===== */
.terms-content {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
    padding: 0 0.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.terms-content::-webkit-scrollbar {
    width: 3px;
}

.terms-content::-webkit-scrollbar-track {
    background: transparent;
}

.terms-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 2px;
}

.terms-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.4);
}

.terms-content h3 {
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 400;
}

.terms-content h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 400;
}

.terms-content p {
    margin-bottom: 0.75rem;
    text-align: justify;
}

.terms-content ul {
    margin: 0.5rem 0 0.75rem 1.5rem;
    padding: 0;
}

.terms-content li {
    margin-bottom: 0.4rem;
    list-style-type: disc;
}

.terms-content .upda.text-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.terms-content .signature {
    text-align: center;
    font-style: italic;
    color: rgba(255, 215, 0, 0.7);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* ===== PAGE 9: REMEMBRANCE SQUARE ===== */
#page9 {
    overflow: hidden;
    background: #0a0e27;
}

/* Deep Space Background */
.space-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1f3a 0%, #0a0e27 100%);
    z-index: 1;
}

/* Film Grain for Space */
.space-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='spacegrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23spacegrain)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 2;
    animation: grainFlicker 0.3s steps(3) infinite;
}

@keyframes grainFlicker {

    0%,
    100% {
        opacity: 0.08;
    }

    50% {
        opacity: 0.12;
    }
}

/* Star Map */
.star-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Individual Star */
.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #FFD700, rgba(255, 215, 0, 0.3));
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: starTwinkle 3s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.star.bright {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

.star.very-bright {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 16px rgba(255, 215, 0, 1);
}

@keyframes starTwinkle {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.star:hover {
    transform: scale(1.5);
    box-shadow: 0 0 20px rgba(255, 215, 0, 1);
}

/* Star Light Burst (when clicked) */
@keyframes starBurst {
    0% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    }

    50% {
        transform: scale(3);
        box-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 80px rgba(255, 215, 0, 0.5);
    }

    100% {
        transform: scale(1.2);
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.8);
    }
}

/* Memory Card (Polaroid Style) */
.memory-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 85%;
    max-width: 340px;
    background: rgba(255, 252, 245, 0.95);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.memory-card:not(.hidden) {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.card-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    font-size: 1.8rem;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.card-close:hover {
    color: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.card-tag {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: rgba(255, 165, 0, 0.8);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.card-message {
    font-family: 'Shadows Into Light', cursive, 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: rgba(0, 0, 0, 0.85);
    line-height: 1.8;
    min-height: 120px;
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

.card-date {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.5);
}

.card-light {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.card-light:hover {
    background: rgba(255, 215, 0, 0.1);
}

.card-light.lit {
    animation: lightPulse 0.6s ease-out;
}

@keyframes lightPulse {
    0% {
        transform: scale(1);
        background: rgba(255, 215, 0, 0.1);
    }

    50% {
        transform: scale(1.2);
        background: rgba(255, 215, 0, 0.4);
    }

    100% {
        transform: scale(1);
        background: rgba(255, 215, 0, 0.1);
    }
}

.light-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 165, 0, 0.6);
    transition: all 0.3s ease;
}

.card-light.lit .light-icon {
    color: #FFD700;
    fill: #FFD700;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

.light-count {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.6);
}

/* Back Button */
.square-back-btn {
    position: fixed;
    top: 2rem;
    left: 1.5rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 252, 245, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 252, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 200;
}

.square-back-btn:hover {
    background: rgba(255, 252, 245, 0.2);
    color: var(--text-primary);
    transform: translateX(-3px);
}

/* ===== PAGE 10: TIME GALLERY (时光长廊) ===== */
#page10 {
    background: #0d0d0d;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

/* Film Strip Container */
.film-strip-container {
    position: relative;
    width: 100%;
    min-height: 100%;
    padding: 3rem 0;
}

/* Film Strip Borders (齿孔边框) */
.film-strip-border {
    position: fixed;
    width: 20px;
    height: 100%;
    background-color: #1a1a1a;
    top: 0;
    z-index: 100;
}

.film-strip-border.left {
    left: 0;
    background-image: repeating-linear-gradient(to bottom,
            transparent 0px,
            transparent 8px,
            #0d0d0d 8px,
            #0d0d0d 16px);
    box-shadow: inset -3px 0 10px rgba(0, 0, 0, 0.8);
}

.film-strip-border.right {
    right: 0;
    background-image: repeating-linear-gradient(to bottom,
            transparent 0px,
            transparent 8px,
            #0d0d0d 8px,
            #0d0d0d 16px);
    box-shadow: inset 3px 0 10px rgba(0, 0, 0, 0.8);
}

/* Gallery Scroll */
.gallery-scroll {
    position: relative;
    width: 100%;
    padding: 0 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

/* Memory Film Card */
.memory-film-card {
    perspective: 1000px;
    width: 85%;
    max-width: 360px;
    cursor: pointer;
}

.film-card-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.memory-film-card.flipped .film-card-inner {
    transform: rotateY(180deg);
}

/* Front and Back faces */
.film-card-front,
.film-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
}

/* Front Side (Photo) */
.film-card-front {
    background: #1a1a1a;
    border: 2px solid #333;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

.film-perforations {
    height: 16px;
    background-color: #1a1a1a;
    background-image: repeating-linear-gradient(to right,
            #0d0d0d 0px,
            #0d0d0d 10px,
            transparent 10px,
            transparent 20px);
}

.memory-photo {
    flex: 1;
    width: 100%;
    object-fit: cover;
    filter: sepia(0.1) contrast(1.1);
}

.film-date-label {
    position: absolute;
    top: 30px;
    right: 15px;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    color: rgba(255, 215, 0, 0.8);
    background: rgba(0, 0, 0, 0.6);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.auth-input:focus {
    outline: none;
    border-bottom-color: var(--accent-gold);
    background: rgba(255, 252, 245, 0.08);
}

/* Override browser autofill styles */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 100px var(--bg-secondary) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
    border-bottom: 1px solid var(--border-color) !important;
    caret-color: var(--text-primary);
}

/* Additional autofill overrides for other input types */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 100px var(--bg-secondary) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text-primary);
}

/* Password Toggle Button */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 2.5rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.password-toggle-btn:hover {
    color: var(--accent-gold-dim);
}

.password-toggle-btn .eye-icon,
.password-toggle-btn .eye-off-icon {
    width: 20px;
    height: 20px;
}

.password-toggle-btn .hidden {
    display: none;
}

/* Back Side (Handwritten Reflection) */
.film-card-back {
    background: #f5f1e8;
    transform: rotateY(180deg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.paper-texture-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='0.15'/%3E%3C/svg%3E");
    opacity: 0.6;
    pointer-events: none;
}

.handwritten-date {
    font-family: 'Shadows Into Light', cursive;
    font-size: 1.1rem;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 2rem;
    text-align: center;
}

.handwritten-reflection {
    font-family: 'Shadows Into Light', cursive, 'Noto Serif SC', serif;
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.85);
    line-height: 2;
    text-align: left;
    position: relative;
    z-index: 1;
}

/* Bottom Actions */
.gallery-bottom-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(13, 13, 13, 0.98) 70%, transparent);
    padding: 2rem 1.5rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    z-index: 150;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    pointer-events: none;
}

.gallery-bottom-actions:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.gallery-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
}

.gallery-action-btn svg {
    width: 24px;
    height: 24px;
}

.gallery-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-3px);
}

.gallery-action-btn.primary {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
}

.gallery-action-btn.primary:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.6);
}

/* Back Button */
.gallery-back-btn {
    position: fixed;
    top: 2rem;
    left: 1.5rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 252, 245, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 252, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 200;
}

.gallery-back-btn:hover {
    background: rgba(255, 252, 245, 0.2);
    color: var(--text-primary);
    transform: translateX(-3px);
}



/* ===== DAILY SIGN-IN LIGHT RITUAL ===== */
.signin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.signin-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

/* Fog Layer */
.fog-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(20, 20, 30, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
    opacity: 1;
    transition: opacity 2s ease;
}

.fog-layer.dispersing {
    opacity: 0;
}

/* Light Point */
.light-point {
    position: relative;
    width: 80px;
    height: 80px;
    cursor: pointer;
    z-index: 10;
    animation: firefly 3s ease-in-out infinite;
}

@keyframes firefly {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.light-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
}

.light-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    background: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 20px #FFD700, 0 0 40px rgba(255, 215, 0, 0.8);
}

/* Heartbeat when pressing */
.light-point.pressing {
    animation: heartbeatStrong 0.6s ease-in-out infinite;
}

@keyframes heartbeatStrong {

    0%,
    100% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.3);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.3);
    }

    56% {
        transform: scale(1);
    }
}

.light-point.pressing .light-core {
    box-shadow: 0 0 30px #FFD700, 0 0 60px rgba(255, 215, 0, 1);
}

/* Ripple Effect */
.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.ripple {
    position: absolute;
    border: 2px solid rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    animation: rippleWave 2s ease-out;
}

@keyframes rippleWave {
    0% {
        width: 40px;
        height: 40px;
        opacity: 1;
    }

    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* Instruction Text */
.signin-instruction {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Noto Serif SC', serif;
    font-size: 0.95rem;
    color: rgba(255, 215, 0, 0.7);
    text-align: center;
    letter-spacing: 0.15em;
    animation: instructionFade 2s ease-in-out infinite;
}

@keyframes instructionFade {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Greeting Message */
.signin-greeting {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: rgba(255, 215, 0, 0.9);
    text-align: center;
    letter-spacing: 0.2em;
    opacity: 0;
    transition: opacity 1s ease;
}

.signin-greeting:not(.hidden) {
    opacity: 1;
}

/* ===== PAGE 7: DAILY CHECK-IN (REDESIGNED) ===== */
.checkin-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 3rem 1.5rem;
    position: relative;
    z-index: 10;
}

.message-box {
    width: 90%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.message-label {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.8rem;
}

.message-input {
    width: 100%;
    min-height: 120px;
    background: transparent;
    border: none;
    font-family: 'Shadows Into Light', cursive, 'Noto Serif SC', serif;
    font-size: 3rem;
    color: var(--text-primary);
    resize: vertical;
    outline: none;
}

.message-input::placeholder {
    color: rgba(255, 252, 245, 0.3);
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.checkin-btn {
    width: 180px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.15));
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 25px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.checkin-btn:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.25));
    border-color: rgba(255, 215, 0, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.completion-msg {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: rgba(255, 215, 0, 0.9);
    text-align: center;
    letter-spacing: 0.2em;
    opacity: 0;
    transition: opacity 1s ease;
    margin-top: 3rem;
    width: 100%;
}

.completion-msg:not(.hidden) {
    opacity: 1;
}

/* Quick Settings Button (Pages 1-7) */
.quick-settings-btn {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 252, 245, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 252, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 200;
}

.quick-settings-btn:hover {
    background: rgba(255, 252, 245, 0.2);
    transform: rotate(90deg);
}

.quick-settings-btn svg {
    width: 20px;
    height: 20px;
    stroke: rgba(255, 252, 245, 0.7);
}

/* Handwriting Input Style */
.handwriting-input {
    width: 100%;
    height: 400px;
    /* Repeating gradient for perfect lines */
    background-image: repeating-linear-gradient(to bottom,
            transparent,
            transparent 2.9rem,
            rgba(255, 252, 245, 0.2) 2.9rem,
            rgba(255, 252, 245, 0.2) 3rem);
    background-color: rgba(255, 255, 255, 0.05);
    background-attachment: local;
    /* Inset lines from border */
    background-size: calc(100% - 3rem) auto;
    background-position: center top;
    background-repeat: no-repeat;

    border: 1px solid rgba(255, 252, 245, 0.2);
    border-radius: 12px;
    padding: 0 1.5rem;
    font-family: 'Ma Shan Zheng', 'Zhi Mang Xing', cursive;
    font-size: 1.4rem;
    color: var(--text-primary);
    line-height: 3rem;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

.handwriting-input::placeholder {
    color: rgba(255, 252, 245, 0.3);
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    line-height: normal;

    padding-top: 0.8rem;
}

/* Days Since Parted - Matching Page 1 Title */
.days-counter {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    color: var(--mist-white);
    margin-bottom: 4rem;
    margin-top: 15vh;
    /* Match Page 1 position */
    text-shadow: 0 0 8px rgba(255, 252, 245, 0.2);
    letter-spacing: 0.2em;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: center;
    opacity: 0;
    /* Hidden initially for animation */
}

.days-counter p {
    margin: 0;
}

/* Auth Modal Styles */
.auth-panel {
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 252, 245, 0.1);
}

.auth-tab {
    padding-bottom: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-family: 'Noto Serif SC', serif;
}

.auth-tab.active {
    color: var(--mist-white);
    border-bottom-color: var(--amber-glow);
}

.auth-tab:hover {
    color: var(--mist-white);
}

.auth-content {
    padding-top: 0;
}

.input-group.compact {
    margin-bottom: 1.5rem;
}

.input-group.compact input {
    font-size: 1rem;
    padding: 0.3rem 0;
}

.auth-footer-text .link:hover {
    color: var(--mist-white);
}

.auth-content {
    padding: 0.5rem 1.5rem 2rem !important;
    /* Aligned with header padding */
}

/* --- Enhanced Auth Styling (Gold Theme) --- */
.auth-panel {
    background: var(--bg-modal);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

.auth-tabs {
    border-bottom: none;
    /* Removed based on user feedback */
    margin-bottom: 0.5rem;
    margin-top: 2.5rem;
    gap: 3rem;
}

.auth-tab {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    padding-bottom: 0.8rem;
    position: relative;
    border-bottom: none;
    /* Reset default border */
}

.auth-tab.active {
    color: var(--accent-gold);
    border-bottom: 2px solid var(--accent-gold);
}

.input-group.compact {
    margin-bottom: 1.2rem;
    opacity: 1 !important;
    /* Override Page 2 animation styles */
    transform: none !important;
}

/* Underline-style Inputs */
.input-group.compact input {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 10px 0;
    text-align: left;
    width: 100%;
    color: var(--text-primary);
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s ease;
}

.input-group.compact input:focus {
    outline: none;
    box-shadow: none;
}

.input-group.compact .input-line {
    /* Complete reset for clean slate */
    all: unset;
    display: block !important;
    width: 100%;
    height: 1px;
    background: rgba(255, 215, 0, 0.3);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Ensure active input line is high contrast gold */
.input-group.compact input:focus+.input-line,
.input-group.compact input:focus~.input-line {
    background: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Action Button (Match Page 2 Interaction Area) */
.action-btn {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: normal;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto !important;
    /* Override inline styles if any */
}

/* OAuth Button (Google Login) */
.oauth-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-family: 'Noto Sans SC', sans-serif;
}

.oauth-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.oauth-btn:active {
    transform: translateY(0);
}

/* Auth Modal Transitions & Views */
.auth-view {
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateX(0);
}

.auth-view.hidden {
    display: none;
    opacity: 0;
    transform: translateX(20px);
}

.auth-form {
    transition: all 0.3s ease;
}

.auth-form.hidden {
    display: none;
}

.forgot-password-link:hover {
    color: var(--mist-white) !important;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.auth-links {
    transition: opacity 0.3s ease;
}

.action-btn:hover {
    background: transparent;
    transform: translateY(-2px);
    box-shadow: none;
}

.action-btn .glowing-line {
    display: block;
    /* Show the line */
    width: 80px;
    /* Slightly smaller for modal */
    margin-bottom: 8px;
}

.action-btn .action-text {
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: var(--accent-gold);
}

.auth-footer-text {
    margin-top: 1.5rem;
    opacity: 0.5;
}

/* ===== PAYMENT MODAL ===== */
.payment-panel {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2501;
}

.modal-overlay:not(.hidden) .payment-panel {
    transform: scale(1);
}

.payment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.payment-icon {
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.payment-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.1em;
}

.payment-desc {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: rgba(255, 215, 0, 0.8);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.payment-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    width: 100%;
}

.payment-features li {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

.payment-features li:last-child {
    border-bottom: none;
}

.payment-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 2rem;
}

.price-symbol {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    color: #FFD700;
    font-weight: 500;
}

.price-amount {
    font-family: 'Noto Serif SC', serif;
    font-size: 3rem;
    color: #FFD700;
    font-weight: 600;
    line-height: 1;
}

.price-period {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: rgba(255, 215, 0, 0.6);
}

.payment-btn {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    font-size: 1.1rem;
    font-weight: normal;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.payment-btn:hover {
    background: transparent;
    transform: translateY(-2px);
}

.payment-btn .glowing-line {
    display: block;
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
    margin-bottom: 0.75rem;
    animation: glowing-line 3s ease-in-out infinite;
}

.payment-btn .action-text {
    color: var(--text-primary);
    font-family: 'Noto Serif SC', serif;
    letter-spacing: 0.2em;
}

.payment-notice {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ===== DANMAKU (Page 8) ===== */
.danmaku-container {
    position: absolute;
    top: 5vh;
    left: 0;
    width: 100%;
    height: 60vh;
    /* Occupy upper 60% of screen */
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}

.danmaku-item {
    position: absolute;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: 'Noto Serif SC', serif;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0.8;
    will-change: transform;
    animation: floatAcross linear forwards;
}

@keyframes floatAcross {
    from {
        transform: translateX(100vw);
    }

    to {
        transform: translateX(-100%);
    }
}







/* ===== Unified Bottom Action Button ===== */
.bottom-action-btn {
    position: absolute;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    /* Ensure it sits above standard content but below modals */
}

/* Override hidden class for bottom action buttons to ensure visibility control works */
.bottom-action-btn:not(.hidden) {
    visibility: visible;
}

/* ===== Unified Content Centering for Pages with Absolute Bottom Buttons ===== */
.page-content-center {
    margin-top: 0;
    margin-bottom: auto;
    /* Unified spacing: no top margin, auto bottom for vertical centering */
}

/* ===== Candle Animation for Sign-In Result ===== */
.candle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.candle-body {
    width: 8px;
    height: 30px;
    background: linear-gradient(to bottom, #f4f4f4 0%, #e8e8e8 50%, #d4d4d4 100%);
    border-radius: 4px 4px 2px 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
}

.candle-wick {
    width: 1px;
    height: 4px;
    background: #2c2c2c;
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
}

.candle-flame {
    position: relative;
    margin-bottom: -2px;
    z-index: 2;
}

.flame {
    width: 16px;
    height: 20px;
    background: radial-gradient(ellipse at center,
            #ffeb3b 0%,
            #ffc107 30%,
            #ff9800 60%,
            rgba(255, 152, 0, 0.5) 80%,
            transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 183, 77, 0.6);
}

.flame-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle,
            rgba(255, 215, 0, 0.3) 0%,
            transparent 70%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite;
}

@keyframes flicker {

    0%,
    100% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }

    25% {
        transform: scaleY(1.05) scaleX(0.95);
        opacity: 0.95;
    }

    50% {
        transform: scaleY(0.95) scaleX(1.05);
        opacity: 0.9;
    }

    75% {
        transform: scaleY(1.02) scaleX(0.98);
        opacity: 0.98;
    }
}

@keyframes glow {

    0%,
    100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}