:root {
    --bg-dark: #070715;
    --bg-darker: #0d0d26;
    --bg-glow: #1a153b;
    
    --primary-color: #ffd700;
    --primary-glow: #fff4af;
    --secondary-color: #d4af37;
    
    --envelope-bg: #1c2754;
    --envelope-bg-dark: #121936;
    --envelope-bg-light: #2d3b75;
    --seal-color: #ffd700;
    --seal-color-dark: #bfa000;
    
    --paper-bg: #fffdf5;
    --paper-line: #e3dec9;
    --paper-margin: #d4af37;
    
    --text-dark: #221d15;
    --text-light: #e6e6fa;
    --text-muted: #9ba4c0;
    
    --font-heading: 'Cinzel Decorative', serif;
    --font-handwriting: 'Caveat', cursive;
    --font-clean: 'Montserrat', sans-serif;
    --font-signature: 'Dancing Script', cursive;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-clean);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

#star-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, var(--bg-glow) 0%, var(--bg-dark) 90%);
}

#heart-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

body::before {
    content: '';
    position: fixed;
    bottom: -150px;
    left: -150px;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
    filter: blur(25px);
}

body::after {
    content: '';
    position: fixed;
    top: -150px;
    right: -150px;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(197, 140, 255, 0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
    filter: blur(25px);
}

.fairy-lights {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 10;
    pointer-events: none;
    display: flex;
    justify-content: space-around;
}

.light-string {
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 28px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.15);
    border-radius: 50%;
    transform: scaleY(0.4);
    z-index: 1;
}

.light-bulb {
    width: 11px;
    height: 16px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background-color: #ffd8c0;
    position: relative;
    top: 2px;
    box-shadow: 0px 2px 10px rgba(255, 216, 192, 0.8), 0px 4px 20px rgba(255, 158, 190, 0.3);
    animation: lightGlow 1.8s ease-in-out infinite alternate;
}

.bulb-1 { animation-delay: 0s; background-color: #ffd700; box-shadow: 0px 2px 10px rgba(255, 215, 0, 0.8); }
.bulb-2 { animation-delay: 0.4s; background-color: #d8b4fe; box-shadow: 0px 2px 10px rgba(216, 180, 254, 0.8); }
.bulb-3 { animation-delay: 0.8s; background-color: #fffbf0; box-shadow: 0px 2px 10px rgba(255, 251, 240, 0.8); }
.bulb-4 { animation-delay: 0.2s; background-color: #ffd700; box-shadow: 0px 2px 10px rgba(255, 215, 0, 0.6); }
.bulb-5 { animation-delay: 0.6s; background-color: #d8b4fe; box-shadow: 0px 2px 10px rgba(216, 180, 254, 0.6); }
.bulb-6 { animation-delay: 1.0s; background-color: #fffbf0; box-shadow: 0px 2px 10px rgba(255, 251, 240, 0.6); }
.bulb-7 { animation-delay: 0.3s; background-color: #ffd700; box-shadow: 0px 2px 10px rgba(255, 215, 0, 0.6); }
.bulb-8 { animation-delay: 0.7s; background-color: #d8b4fe; box-shadow: 0px 2px 10px rgba(216, 180, 254, 0.6); }
.bulb-9 { animation-delay: 0.1s; background-color: #fffbf0; box-shadow: 0px 2px 10px rgba(255, 251, 240, 0.6); }
.bulb-10 { animation-delay: 0.5s; background-color: #ffd700; box-shadow: 0px 2px 10px rgba(255, 215, 0, 0.8); }

@keyframes lightGlow {
    0% { opacity: 0.45; filter: brightness(0.85); }
    100% { opacity: 1; filter: brightness(1.35); }
}

.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    background: rgba(13, 13, 38, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.15);
    color: var(--text-light);
    padding: 10px 16px;
    border-radius: 30px;
    font-family: var(--font-clean);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.music-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.35);
    transform: translateY(-2px);
}

.music-toggle:active { transform: translateY(0); }

.music-icon-wrapper {
    position: relative;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-icon {
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.music-toggle.playing .music-icon {
    animation: spin 3s linear infinite;
}

.music-slash {
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: rotate(-45deg);
    transition: opacity 0.3s ease;
}

.music-toggle.playing .music-slash { opacity: 0; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 20px;
    min-height: 100vh;
    transition: opacity 0.5s ease;
}

.intro-header {
    text-align: center;
    margin-bottom: 50px;
}

.intro-header h1 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--primary-glow);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    margin-bottom: 12px;
}

.fade-in-text {
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeInUp 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.pulsing-heart-intro {
    font-size: 1.25rem;
    color: var(--primary-color);
    display: inline-block;
    animation: heartPulse 1.6s ease-in-out infinite;
}

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

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

.envelope-wrapper {
    position: relative;
    width: 380px;
    height: 260px;
    perspective: 1000px;
    cursor: pointer;
    margin-bottom: 40px;
    transition: transform 0.3s ease;
}

@media (max-width: 480px) {
    .envelope-wrapper {
        transform: scale(0.85);
        margin-bottom: 20px;
    }
    .intro-header h1 { font-size: 1.25rem; }
}

@media (max-width: 360px) {
    .envelope-wrapper {
        transform: scale(0.7);
        margin-bottom: 10px;
    }
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--envelope-bg-dark);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.envelope-flap {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 3;
}

.top-flap {
    top: 0;
    left: 0;
    border-width: 130px 190px 0 190px;
    border-color: var(--envelope-bg) transparent transparent transparent;
    transform-origin: top;
    z-index: 5;
    transition: transform 0.6s ease-in-out, z-index 0.2s ease-in-out;
}

.left-flap {
    top: 0;
    left: 0;
    border-width: 130px 0 130px 190px;
    border-color: transparent transparent transparent var(--envelope-bg-dark);
}

.right-flap {
    top: 0;
    right: 0;
    border-width: 130px 190px 130px 0;
    border-color: transparent var(--envelope-bg-dark) transparent transparent;
}

.bottom-flap {
    bottom: 0;
    left: 0;
    border-width: 0 190px 130px 190px;
    border-color: transparent transparent var(--envelope-bg-light) transparent;
    z-index: 4;
}

.teaser-card {
    position: absolute;
    top: 15px;
    left: 20px;
    width: 340px;
    height: 230px;
    background-color: var(--paper-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 2;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.15), z-index 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px dashed rgba(212, 175, 55, 0.2);
}

.card-greeting {
    font-family: var(--font-handwriting);
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.card-text {
    font-family: var(--font-clean);
    font-size: 0.82rem;
    line-height: 1.6;
    color: #4c433e;
    font-weight: 400;
}

.open-letter-btn {
    align-self: center;
    background: linear-gradient(135deg, var(--seal-color), var(--seal-color-dark));
    color: #221d15;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    font-family: var(--font-clean);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.35);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.open-letter-btn:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.45);
}

.polaroid-card {
    position: absolute;
    top: 15px;
    left: 20px;
    width: 210px;
    height: 185px;
    background-color: #fff;
    border-radius: 4px;
    padding: 10px 10px 28px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1.5;
    transform-origin: center bottom;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.polaroid-image {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    overflow: hidden;
    background-color: #140822;
}

.polaroid-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.polaroid-caption {
    margin-top: 8px;
    text-align: center;
    font-family: var(--font-handwriting);
    font-size: 1.1rem;
    font-weight: 700;
    color: #443c3a;
}

.wax-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 62px;
    height: 62px;
    z-index: 6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.wax-seal:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.seal-half {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--seal-color) 0%, var(--seal-color-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.22), 0 4px 15px rgba(0,0,0,0.35);
    transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease;
}

.left-half {
    clip-path: inset(0 50% 0 0);
}

.right-half {
    clip-path: inset(0 0 0 50%);
}

.seal-heart {
    width: 24px;
    height: 24px;
    fill: #a31d3d;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.4));
    animation: sealHeartbeat 1.4s infinite alternate;
}

.wax-seal:hover .seal-heart {
    animation-duration: 0.6s;
}

@keyframes sealHeartbeat {
    0% { transform: scale(0.98); }
    100% { transform: scale(1.16); }
}

.seal-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary-glow);
    opacity: 0.4;
    pointer-events: none;
    animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
    0% { transform: scale(1); opacity: 0.25; }
    100% { transform: scale(1.15); opacity: 0.55; }
}

.envelope.open .top-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope.open .left-half {
    transform: translateX(-45px) translateY(-5px) rotate(-25deg) scale(0.85);
    opacity: 0;
}

.envelope.open .right-half {
    transform: translateX(45px) translateY(5px) rotate(25deg) scale(0.85);
    opacity: 0;
}

.envelope.open .seal-glow {
    opacity: 0;
    transform: scale(1.3);
    transition: all 0.5s ease;
}

.envelope.open .teaser-card {
    transform: translateY(-110px) translateX(45px) rotate(4deg);
    z-index: 4;
}

.envelope.open .polaroid-card {
    transform: translateY(-135px) translateX(-55px) rotate(-8deg);
    z-index: 3;
}

.envelope.open .teaser-card .open-letter-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.4s ease 0.5s, transform 0.4s ease 0.5s;
}

.tap-instruction {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: fadePulse 2s infinite alternate;
    pointer-events: none;
}

.arrow-up {
    font-size: 1.2rem;
    animation: arrowBounce 1s infinite alternate;
    color: var(--text-muted);
}

.tap-text {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 500;
}

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

@keyframes fadePulse {
    0% { opacity: 0.45; }
    100% { opacity: 0.85; }
}

.letter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 40;
    background: rgba(7, 7, 21, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    padding: 40px 15px;
}

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

.letter-container {
    position: relative;
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto 0;
}

.back-to-envelope {
    position: absolute;
    top: -20px;
    right: 0px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

.back-to-envelope:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}

.back-to-envelope svg {
    width: 20px;
    height: 20px;
}

.parchment-paper {
    background-color: var(--paper-bg);
    background-image: 
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.4) 0%, rgba(240, 220, 205, 0.1) 100%),
        linear-gradient(rgba(0,0,0,0) 93%, var(--paper-line) 93%, var(--paper-line) 100%);
    background-size: 100% 32px;
    border-radius: 8px;
    padding: 60px 50px 80px 70px;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.55), inset 0 0 40px rgba(184, 125, 108, 0.15);
    width: 100%;
    color: var(--text-dark);
    position: relative;
    border-left: 3px solid var(--paper-margin);
    margin-top: 20px;
    transform: translateY(30px);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.parchment-paper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 45px;
    width: 1px;
    height: 100%;
    background-color: rgba(212, 175, 55, 0.25);
}

.letter-overlay.visible .parchment-paper {
    transform: translateY(0);
}

.parchment-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.stamp-heart {
    font-size: 2.2rem;
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.15));
    animation: floatHeart 3s ease-in-out infinite alternate;
}

@keyframes floatHeart {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-5px) rotate(6deg); }
}

.letter-content {
    font-family: var(--font-handwriting);
    font-size: 1.75rem;
    line-height: 32px;
    letter-spacing: 0.5px;
    position: relative;
}

.letter-paragraph {
    margin-bottom: 32px;
    text-indent: 20px;
    word-wrap: break-word;
    color: #2b2520;
    font-weight: 500;
}

.letter-paragraph.greet {
    text-indent: 0;
    font-size: 2rem;
    margin-bottom: 32px;
    font-weight: 700;
    color: #54152b;
}

.font-bold {
    font-weight: 700;
    color: #74193d;
}

.letter-paragraph.highlight {
    background-color: rgba(255, 215, 0, 0.12);
    border-radius: 4px;
    padding: 0px 8px;
    border-bottom: 1px dashed rgba(255, 215, 0, 0.3);
}

.letter-media {
    margin: 35px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.letter-polaroid {
    background: #fff;
    padding: 12px 12px 28px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
    transform: rotate(-1.5deg);
    max-width: 340px;
    width: 100%;
    margin: 10px auto 25px auto;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.letter-polaroid:hover {
    transform: rotate(0.5deg) scale(1.03);
}

.letter-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.letter-polaroid-caption {
    margin-top: 12px;
    text-align: center;
    font-family: var(--font-handwriting);
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.highlighted-message {
    background: linear-gradient(120deg, rgba(255, 215, 0, 0.18) 0%, rgba(255, 215, 0, 0.35) 100%);
    border-left: 5px solid var(--secondary-color);
    padding: 16px 24px;
    margin: 10px auto;
    border-radius: 4px;
    font-family: var(--font-handwriting);
    font-size: 1.95rem;
    font-weight: 700;
    color: #4a3605;
    line-height: 1.4;
    text-align: center;
    max-width: 480px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.15);
    animation: highlightGlow 2.5s infinite alternate;
}

@keyframes highlightGlow {
    0% { box-shadow: 0 4px 15px rgba(212, 175, 55, 0.15); filter: brightness(1); }
    100% { box-shadow: 0 6px 22px rgba(212, 175, 55, 0.32); filter: brightness(1.05); }
}

.letter-signature {
    margin-top: 48px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 10px;
}

.sig-valediction {
    font-size: 1.4rem;
    line-height: 24px;
    margin-bottom: 15px;
    text-align: right;
    max-width: 320px;
    font-style: italic;
    color: #4b3e39;
}

.sig-signature-text {
    font-family: var(--font-signature);
    font-size: 2.3rem;
    color: #54152b;
    font-weight: 700;
}

.feather-decor {
    position: absolute;
    bottom: -60px;
    left: -20px;
    width: 90px;
    height: 90px;
    transform: rotate(25deg);
    opacity: 0.65;
}

.feather-svg {
    width: 100%;
    height: 100%;
}

.ending-section {
    margin-top: 50px;
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    background: rgba(13, 13, 38, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.letter-overlay.visible .ending-section {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

.ending-divider {
    width: 50px;
    height: 2px;
    background: var(--primary-color);
    margin: 0 auto 30px auto;
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-glow);
}

.ending-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 15px;
}

.ending-glow-text {
    font-family: var(--font-handwriting);
    font-size: 2.6rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4);
    margin-bottom: 20px;
    font-weight: 700;
}

.pulse-decor-heart {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    animation: heartPulse 1.4s infinite alternate;
}

.smile-btn {
    background: linear-gradient(135deg, #ffd700 0%, #aa841c 100%);
    color: #1a1503;
    border: none;
    padding: 16px 36px;
    border-radius: 50px;
    font-family: var(--font-clean);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: buttonPulse 2s infinite;
}

.smile-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.55);
}

.smile-btn:active { transform: translateY(0) scale(1); }

.smile-heart-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.smile-btn:hover .smile-heart-icon {
    transform: scale(1.2) rotate(10deg);
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35), 0 0 0 0px rgba(255, 215, 0, 0.35);
    }
    70% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35), 0 0 0 12px rgba(255, 215, 0, 0);
    }
    100% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35), 0 0 0 0px rgba(255, 215, 0, 0);
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 110;
    background: rgba(6, 6, 18, 0.75);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

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

.modal-card {
    background: rgba(13, 13, 38, 0.9);
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 40px 30px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.visible .modal-card {
    transform: scale(1);
}

.modal-heart-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: floatHeart 2.5s ease-in-out infinite alternate;
}

.modal-heading {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.modal-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-family: var(--font-clean);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.whatsapp-btn {
    background-color: #25d366;
    color: white;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
}

.whatsapp-btn:hover {
    background-color: #20ba5a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.close-btn {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.touch-sparkle {
    position: fixed;
    width: 8px;
    height: 8px;
    background-color: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 6px #ffd700, 0 0 12px #ff758f;
    animation: sparkleFade 0.8s ease-out forwards;
}

@keyframes sparkleFade {
    0% { transform: scale(1) translate(0, 0); opacity: 1; }
    100% { transform: scale(0) translate(var(--dx), var(--dy)); opacity: 0; }
}

@media (max-width: 600px) {
    .letter-overlay { padding: 20px 10px; }
    
    .parchment-paper {
        padding: 40px 24px 60px 44px;
        background-size: 100% 30px;
    }
    
    .parchment-paper::after { left: 28px; }
    
    .letter-content {
        font-size: 1.35rem;
        line-height: 30px;
    }
    
    .letter-paragraph {
        margin-bottom: 30px;
        text-indent: 10px;
    }
    
    .letter-paragraph.greet {
        font-size: 1.6rem;
        margin-bottom: 30px;
    }
    
    .sig-signature-text { font-size: 1.8rem; }
    .sig-valediction { font-size: 1.15rem; line-height: 18px; }
    
    .ending-glow-text { font-size: 2.1rem; }
    
    .envelope.open .teaser-card {
        transform: translateY(-90px) translateX(30px) rotate(4deg) scale(0.9);
    }
    .envelope.open .polaroid-card {
        transform: translateY(-110px) translateX(-45px) rotate(-8deg) scale(0.85);
    }
}
