* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    
    -webkit-tap-highlight-color: rgba(255, 105, 180, 0.3);
    tap-highlight-color: rgba(255, 105, 180, 0.3);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000;
    color: #fff;
    
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}


@media (pointer: coarse) {
    
    * {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }

    
    a:focus, button:focus, input:focus, textarea:focus, [role="button"]:focus,
    .gift-box:focus, .wax-seal:focus, .envelope-photo:focus, .inner-letter:focus {
        outline: none !important;
        box-shadow: none !important;
    }
}


.hb-touch a:focus, .hb-touch button:focus, .hb-touch input:focus, .hb-touch textarea:focus,
.hb-touch [role="button"]:focus, .hb-touch .gift-box:focus, .hb-touch .wax-seal:focus,
.hb-touch .envelope-photo:focus, .hb-touch .inner-letter:focus {
    outline: none !important;
    box-shadow: none !important;
}


h1,h2,h3,h4,h5,h6 {
    font-family: 'TheMix', 'Coolvetica4', 'Coolvetica1', serif;
}
.accent {
    font-family: 'Coolvetica2', 'Coolvetica5', 'Coolvetica4', cursive;
}

.screen,
.start-button,
.cake-container,
.gift-box,
.premium-envelope,
.flap-top,
.inner-letter {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}


.inner-letter.use-top {
     bottom: auto !important; 
}



#global-confetti {
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

.screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    transform: translateZ(0);
}

#cake-screen .screen-container {
    transform: none !important;
    width: 100%;
    height: 100%;
}

#initial-screen {
    background: 
        radial-gradient(circle at 50% 50%, rgba(255, 105, 180, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(139, 71, 137, 0.08) 0%, rgba(0, 0, 0, 1) 70%);
    position: relative;
    overflow: hidden;
}

.initial-note {
    position: absolute;
    bottom: clamp(18px, 4vh, 40px);
    left: 50%;
    transform: translate(-50%, 0);
    width: min(90vw, 460px);
    padding: 18px 28px 36px;
    border-radius: 20px;
    background: rgba(8, 0, 12, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45), 0 0 30px rgba(255, 105, 180, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    color: #fff;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-size: clamp(15px, 1.7vw, 19px);
    letter-spacing: 0.5px;
    line-height: 1.4;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 12;
    animation: noteFloat 4s ease-in-out infinite;
    pointer-events: none;
}

.initial-note p {
    margin: 0;
    font-weight: 400;
}

.initial-note__glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 30%, rgba(255, 182, 193, 0.5), transparent 55%),
                radial-gradient(circle at 85% 70%, rgba(255, 255, 255, 0.25), transparent 50%);
    opacity: 0.65;
    filter: blur(12px);
    pointer-events: none;
}

@media (max-width: 768px) {
    #initial-screen .screen-container {
        padding-bottom: 120px;
    }

    .initial-note {
        width: min(92vw, 400px);
        padding: 16px 22px 32px;
        font-size: clamp(14px, 2.6vw, 18px);
    }

    .initial-note__date {
        right: 18px;
        bottom: 10px;
        letter-spacing: 0.16em;
    }
}

@media (max-width: 520px) {
    .initial-note {
        width: min(94vw, 360px);
        border-radius: 18px;
        padding: 14px 18px 30px;
        font-size: clamp(13px, 3.8vw, 17px);
        text-align: center;
    }

    .initial-note p,
    .initial-note__text {
        text-align: center;
    }

    .initial-note__date {
        right: 16px;
        bottom: 8px;
        font-size: clamp(10px, 2.8vw, 12px);
        letter-spacing: 0.12em;
        text-align: right;
    }
}

@media (max-width: 380px) {
    .initial-note {
        padding: 12px 16px 28px;
        letter-spacing: 0.3px;
        line-height: 1.5;
    }

    .initial-note__date {
        right: 14px;
        bottom: 6px;
    }
}

@media (max-height: 560px) {
    #initial-screen .screen-container {
        padding-bottom: 140px;
    }

    .initial-note {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

.initial-note__text {
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.initial-note__date {
    position: absolute;
    bottom: 12px;
    right: 22px;
    font-size: clamp(11px, 1.5vw, 13px);
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    z-index: 1;
}

@keyframes noteFloat {
    0%, 100% {
        transform: translate(-50%, 0);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45), 0 0 30px rgba(255, 105, 180, 0.25);
    }
    50% {
        transform: translate(-50%, -6px);
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 36px rgba(255, 182, 193, 0.35);
    }
}

#initial-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle, rgba(255, 105, 180, 0.03) 1px, transparent 1px);
    background-size: 60px 60px, 100px 100px;
    background-position: 0 0, 40px 40px;
    animation: subtleMove 60s linear infinite;
    pointer-events: none;
    will-change: transform;
}

@keyframes subtleMove {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(50px, 50px, 0); }
}

.start-button {
    font-family: 'TheMix', 'Coolvetica4', 'Coolvetica1', serif;
    padding: 24px 70px;
    font-size: 28px;
    color: #000;
    background: linear-gradient(135deg, #ffffff 0%, #ffe6f0 100%);
    border: none;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 0 40px rgba(255, 255, 255, 0.4),
        0 10px 30px rgba(255, 105, 180, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
    animation: buttonPulse 2s ease-in-out infinite;
    
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}


.debug-skip-controls {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}
.debug-skip {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.debug-skip:hover { background: rgba(255,255,255,0.12); }
.debug-skip:active { transform: translateY(1px); }

.start-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.start-button:hover::before {
    width: 300px;
    height: 300px;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 
            0 0 40px rgba(255, 255, 255, 0.4),
            0 10px 30px rgba(255, 105, 180, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 
            0 0 60px rgba(255, 255, 255, 0.6),
            0 15px 40px rgba(255, 105, 180, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
}

.start-button:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 
        0 0 80px rgba(255, 255, 255, 0.7),
        0 20px 50px rgba(255, 105, 180, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.start-button:active {
    transform: scale(1.02) translateY(0);
}


@media (max-width: 768px) {
    .start-button {
        padding: 20px 60px;
        font-size: 24px;
        letter-spacing: 2px;
    }
}

@media (max-width: 480px) {
    .start-button {
        padding: 18px 50px;
        font-size: 20px;
        letter-spacing: 1.5px;
    }
}


#photo-screen {
    background: #000;
}

#photo-screen .screen-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.photo-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-43%, -48%);
    width: 400px;
    height: 400px;
}


@media (max-width: 1024px) {
    .photo-container {
        width: 360px;
        height: 360px;
        transform: translate(-50%, -48%);
    }
}

@media (max-width: 768px) {
    .photo-container {
        width: 320px;
        height: 320px;
        transform: translate(-50%, -50%);
    }
}

@media (max-width: 640px) {
    .photo-container {
        width: 85vw;
        max-width: 300px;
        height: 300px;
        transform: translate(-50%, -50%);
    }
}

@media (max-width: 480px) {
    .photo-container {
        width: 85vw;
        max-width: 280px;
        height: 280px;
        transform: translate(-50%, -50%);
    }
}

@media (max-width: 360px) {
    .photo-container {
        width: 90vw;
        max-width: 240px;
        height: 240px;
        transform: translate(-50%, -50%);
    }
}

.photo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    
    width: clamp(160px, 60%, 420px);
    aspect-ratio: 5 / 7;
    opacity: 0;
    transition: opacity 1s ease, transform 1s ease;
    background: #fff;
    
    padding: 12px 12px 46px 12px; 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    scale: 1.2;
}

.photo.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1) rotate(var(--rotation));
}


.photo.hide {
    opacity: 0 !important;
    visibility: visible !important; 
    transform: translate(-50%, -50%) scale(0.8) rotate(0deg) !important;
}

.photo[data-index="0"] {
    --rotation: -3deg;
}

.photo[data-index="1"] {
    --rotation: 2deg;
}

.photo[data-index="2"] {
    --rotation: -4deg;
}

.photo[data-index="3"] {
    --rotation: 3deg;
}

.photo[data-index="4"] {
    --rotation: -2deg;
}

.photo img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 6px;
    object-fit: cover;
}


@media (max-width: 1024px) {
    .photo { width: clamp(180px, 60%, 360px); 
    left: 55%}

}

@media (max-width: 640px) {
    .photo { width: 230px;
        top: 55%;
        left: 58%; }
}

@media (max-width: 480px) {
    .photo { width: 200px; }
}

@media (max-width: 360px) {
    .photo { width: 170px; }
}

.message-container {
    position: absolute;
    bottom: 100px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
    pointer-events: none;
    z-index: 50;
}

@media (max-width: 768px) {
    .message-container {
        bottom: 80px;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .message-container {
        bottom: 100px; 
        padding: 0 12px;
    }
}

@media (max-width: 360px) {
    .message-container {
        bottom: 90px; 
        padding: 0 10px;
    }
}

.message {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(255, 105, 180, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.8);
    padding: 0;
    line-height: 1.4;
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
}

.message.show {
    opacity: 1;
    visibility: visible;
}


.message.hide {
    opacity: 0 !important;
    visibility: visible !important;
}


@media (max-width: 1024px) {
    .message {
        font-size: 22px;
        letter-spacing: 1.8px;
    }
}

@media (max-width: 768px) {
    .message {
        font-size: 20px;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 640px) {
    .message {
        font-size: 18px;
        letter-spacing: 1.2px;
        
        padding: 0 20px;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
}

@media (max-width: 480px) {
    .message {
        font-size: 16px;
        letter-spacing: 1px;
        line-height: 1.5;
        
        padding: 0 18px;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
}

@media (max-width: 360px) {
    .message {
        font-size: 14px;
        letter-spacing: 0.8px;
        line-height: 1.6;
        
        padding: 0 16px;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
}


#cake-screen {
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 71, 137, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 105, 180, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(139, 71, 137, 0.15) 0%, rgba(0, 0, 0, 1) 70%);
}

.cake-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: none;
    width: 100%;
    max-width: 700px;
}

.cake-container * {
    will-change: auto;
}


#cake-svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    min-width: 600px;
    display: block;
    shape-rendering: geometricPrecision;
    filter: drop-shadow(0 20px 40px rgba(255, 105, 180, 0.35));
    animation: cakePulse 8s ease-in-out infinite;
    will-change: filter;
    transform: translateZ(0);
}

@keyframes scaleIn {
    0% {
        transform: scale(0.5) translateZ(0);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
}


@media (max-width: 1024px) {
    .screen-container {
        padding: 18px;
    }
    
    #cake-svg {
        min-width: 420px;
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .screen-container {
        padding: 15px;
    }
    
    #cake-svg {
        min-width: 380px;
        max-width: 380px;
    }
    .instruction {
        font-size: 20px !important;
    }
}
@media (max-width: 570px) {
    .instruction {
        font-size: 11px !important;
    }
}

@media (max-width: 640px) {
    .screen-container {
        padding: 12px;
    }
    
    #cake-svg {
        min-width: 340px;
        max-width: 340px;
    }
}

@media (max-width: 480px) {
    .screen-container {
        padding: 10px;
    }
    
    #cake-svg {
        min-width: 300px;
        max-width: 300px;
    }
}

@media (max-width: 360px) {
    .screen-container {
        padding: 8px;
    }
    
    #cake-svg {
        min-width: 260px;
        max-width: 260px;
    }
}

.cake {
    width: 250px;
    height: 180px;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 50%, #c71585 100%);
    border-radius: 20px 20px 5px 5px;
    position: relative;
    z-index: 0; 
    overflow: visible; 
    box-shadow: 
        0 15px 50px rgba(255, 105, 180, 0.6),
        inset 0 -5px 20px rgba(0, 0, 0, 0.2),
        inset 0 5px 20px rgba(255, 255, 255, 0.3);
}


.cake::before {
    content: '';
    position: absolute;
    top: -18px;
    left: -18px;
    right: -18px;
    height: 36px;
    background: linear-gradient(to bottom, #ffffff 0%, #ffe6f0 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 30px rgba(255, 255, 255, 0.8),
        inset 0 -3px 10px rgba(255, 105, 180, 0.3);
    animation: frostingGlow 2s ease-in-out infinite;
    z-index: 2; 
    pointer-events: none;
}

@keyframes frostingGlow {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(255, 255, 255, 0.8),
            inset 0 -3px 10px rgba(255, 105, 180, 0.3);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(255, 255, 255, 1),
            inset 0 -3px 10px rgba(255, 105, 180, 0.5);
    }
}


.cake::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: 
        linear-gradient(to bottom, #d4145a 0%, #a01346 100%),
        radial-gradient(circle at 15% 20%, #ffb6c1 3px, transparent 3px),
        radial-gradient(circle at 35% 50%, #ff69b4 2px, transparent 2px),
        radial-gradient(circle at 55% 30%, #ffc0cb 3px, transparent 3px),
        radial-gradient(circle at 75% 60%, #ff1493 2px, transparent 2px),
        radial-gradient(circle at 85% 25%, #ffb6c1 2px, transparent 2px),
        radial-gradient(circle at 25% 70%, #ff69b4 3px, transparent 3px),
        radial-gradient(circle at 65% 75%, #ffc0cb 2px, transparent 2px);
    background-size: 100% 100%, 50px 50px, 50px 50px, 50px 50px, 50px 50px, 50px 50px, 50px 50px, 50px 50px;
    border-radius: 0 0 5px 5px;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.3);
    z-index: 1;
    pointer-events: none;
}

.svg-candle { 
    pointer-events: all;
    transition: transform 0.3s ease;
    cursor: pointer;
    transform-origin: center center;
}

.svg-candle:hover {
    transform: scale(1.05);
}

.svg-candle:active {
    transform: scale(0.98);
}


@media (max-width: 1024px) {
    .instruction {
        font-size: 22px;
        letter-spacing: 2px;
    }
}

@media (max-width: 768px) {
    .instruction {
        font-size: 20px;
        letter-spacing: 1.8px;
    }
}

@media (max-width: 640px) {
    .instruction {
        font-size: 18px;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 480px) {
    .instruction {
        font-size: 16px;
        letter-spacing: 1px;
    }
}

@media (max-width: 360px) {
    .instruction {
        font-size: 14px;
        letter-spacing: 0.8px;
    }
}

@keyframes cakePulse {
    0%, 100% {
        filter: drop-shadow(0 20px 40px rgba(255, 105, 180, 0.35));
    }
    50% {
        filter: drop-shadow(0 25px 50px rgba(255, 105, 180, 0.45));
    }
}


#cake-screen {
    overflow: hidden;
}

.cake-container {
    overflow: visible !important;
}
#cake-svg #svg-candle { 
    pointer-events: all;
    cursor: pointer;
}


.svg-flame ellipse { 
    transform-origin: center;
    will-change: transform, opacity;
}

.svg-flame.flame-animate ellipse:nth-child(1) { 
    animation: flame-outer 0.8s infinite ease-in-out; 
}
.svg-flame.flame-animate ellipse:nth-child(2) { 
    animation: flame-mid 0.6s infinite ease-in-out; 
}
.svg-flame.flame-animate ellipse:nth-child(3) { 
    animation: flame-inner 0.5s infinite ease-in-out; 
}
.svg-flame.flame-animate ellipse:nth-child(4) { 
    animation: flame-core 0.4s infinite ease-in-out; 
}
.svg-flame.flame-animate ellipse:nth-child(5) { 
    animation: flame-glow 2s infinite ease-in-out; 
}

@keyframes flame-outer {
    0% { transform: translateY(0) scale(1); opacity: 0.95; }
    50% { transform: translateY(-3px) scaleY(1.1) scaleX(1.05); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 0.95; }
}
@keyframes flame-mid {
    0% { transform: translateY(0) scale(1); opacity: 0.85; }
    50% { transform: translateY(-4px) scaleY(1.12) scaleX(1.06); opacity: 0.9; }
    100% { transform: translateY(0) scale(1); opacity: 0.85; }
}
@keyframes flame-inner {
    0% { transform: translateY(0) scale(1); opacity: 0.9; }
    50% { transform: translateY(-2px) scaleY(1.08) scaleX(1.04); opacity: 0.95; }
    100% { transform: translateY(0) scale(1); opacity: 0.9; }
}
@keyframes flame-core {
    0% { transform: translateY(0) scale(1); opacity: 0.98; }
    50% { transform: translateY(-1px) scaleY(1.05) scaleX(1.02); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 0.98; }
}
@keyframes flame-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}


.svg-flame.flame-blown ellipse {
    animation: none !important;
    animation: blowOutSVG 0.8s cubic-bezier(0.4, 0, 0.6, 1) forwards !important;
}

@keyframes blowOutSVG {
    0% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    20% { 
        transform: translateY(-3px) scale(1.1) translateX(3px); 
        opacity: 0.9; 
    }
    40% { 
        transform: translateY(-8px) scale(1.25) translateX(10px); 
        opacity: 0.7; 
    }
    65% { 
        transform: translateY(-15px) scale(1.4) translateX(18px) rotate(15deg); 
        opacity: 0.3; 
    }
    100% { 
        transform: translateY(-30px) scale(0.1) translateX(25px) rotate(25deg); 
        opacity: 0; 
    }
}


.svg-candle rect { 
    pointer-events: none;
    shape-rendering: geometricPrecision;
}

.svg-flame { 
    pointer-events: all;
}

.svg-flame path { 
    vector-effect: non-scaling-stroke;
    will-change: transform, opacity;
}

@keyframes innerFlicker {
    0% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1) translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.05) translateY(-2px);
        opacity: 0.95;
    }
    100% {
        transform: translateX(-50%) scale(0.98) translateY(2px);
        opacity: 1;
    }
}


.flame.blown-out, .svg-flame.flame-blown { opacity: 0; }

@keyframes blowOut {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.2) translateY(-10px);
        opacity: 0.5;
    }
    100% {
        transform: translateX(-50%) scale(0) translateY(-30px);
        opacity: 0;
    }
}

.instruction {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    text-align: center;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(255, 105, 180, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.8);
    margin-top: 20px;
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
    z-index: 100;
    opacity: 1;
}

@keyframes pulseGlow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(255, 105, 180, 0.5),
            0 0 20px rgba(255, 105, 180, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.8);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(255, 105, 180, 0.8),
            0 0 30px rgba(255, 105, 180, 0.5),
            0 2px 4px rgba(0, 0, 0, 0.8);
    }
}

.instruction:hover {
    transform: scale(1.05);
}

.instruction.fade-out {
    opacity: 0;
}


.instruction.fade-in {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.instruction.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}


#gift-description {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.6s ease-out, margin-bottom 0.6s ease-out, opacity 0.5s ease;
}

#gift-description[style*="display: block"] {
    max-height: 100px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        max-height: 100px;
        opacity: 1;
        transform: translateY(0);
    }
}


#gift-instruction {
    transition: transform 0.6s ease-out, opacity 0.5s ease;
}


#gift-screen {
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 105, 180, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(139, 71, 137, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(255, 215, 0, 0.05) 0%, rgba(0, 0, 0, 1) 70%);
    overflow: visible;
}

.gift-container {
    position: relative;
    width: 100%;
    
    height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}


@media (max-width: 1024px) {
    .gift-container { height: 520px; }
}

@media (max-width: 768px) {
    .gift-container { height: 460px; }
}

@media (max-width: 640px) {
    .gift-container { height: 410px; }
}

@media (max-width: 480px) {
    .gift-container { height: 370px; }
}

@media (max-width: 360px) {
    .gift-container { height: 340px; }
}


.gift-box {
    scale: 1.5;
    cursor: pointer;
    transition: transform 0.28s ease, width 0.28s ease, height 0.28s ease;
    
    width: 420px;
    height: 420px;
    animation: giftFloat 4s ease-in-out infinite;
    will-change: transform;
    
    transform: translateZ(0) translateY(-6%);
    
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 1024px) {
    .gift-box {
        scale: 1.4;
        width: 380px;
        height: 380px;
    }
}

@media (max-width: 768px) {
    .gift-box {
        width: 340px;
        height: 340px;
        transform: translateZ(0) translateY(-4%);
    }
}

@media (max-width: 640px) {
    .gift-box {
        scale: 1.3;
        width: 300px;
        height: 300px;
        transform: translateZ(0) translateY(-3%);
    }
    .instruction {
        font-size: 15px !important;
    }
}

@media (max-width: 480px) {
    .gift-box {
        scale: 1.2;
        width: 260px;
        height: 260px;
        transform: translateZ(0) translateY(-2%);
    }
    .instruction {
        font-size: 12px !important;
    }
}

@media (max-width: 360px) {
    .gift-box {
        scale: 1.1;
        width: 220px;
        height: 220px;
        transform: translateZ(0) translateY(-2%);
    }
    .instruction {
        font-size: 11px !important;
    }
}

.gift-box:hover {
    transform: translateY(-6%) scale(1.06) translateZ(0);
}


.gift-box #box-lid-group {
    transform-box: fill-box;
    transform-origin: 50% 0%; 
}

.gift-box.opening #box-lid-group {
    animation: lidOpen 1000ms cubic-bezier(0.22, 0.9, 0.35, 1) forwards;
}


.gift-box.fading {
    opacity: 0;
    transition: opacity 0.7s ease;
    pointer-events: none;
}

@keyframes giftFloat {
    
    0%, 100% {
        transform: translateY(-6%) translateZ(0);
    }

    50% {
        transform: translateY(-22px) translateZ(0);
    }
}

@keyframes lidOpen {
    0% {
        transform: translateY(0) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        
        transform: translate(-38px, -25px) rotateZ(-42deg);
        opacity: 1;
    }
}


.gift-letter {
    position: absolute;
    background: transparent;
    animation: letterAppear 1s ease-out forwards;
}

.letter-content h2 {
    color: #ff69b4;
    font-size: 32px;
    margin-bottom: 20px;
    font-family: 'Brush Script MT', cursive;
}

.letter-content p {
    color: #333;
    font-size: 18px;
    line-height: 1.8;
    margin: 10px 0;
    font-family: 'Georgia', serif;
}

.letter-signature {
    margin-top: 30px !important;
    font-style: italic;
    color: #ff69b4;
    font-size: 20px !important;
}

@keyframes letterAppear {
    0% {
        transform: scale(0.3) translateY(100px) rotate(-10deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) translateY(-10px) rotate(2deg);
    }
    100% {
        transform: scale(1) translateY(0) rotate(0deg);
        opacity: 1;
    }
}


.snoopy-gift {
    position: absolute;
    text-align: center;
}

.snoopy-wrapper {
    position: relative;
    display: inline-block;
}


.snoopy-svg {
    display: block;
    width: 360px;
    height: 360px;
}

@media (max-width: 1024px) {
    .snoopy-svg {
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 768px) {
    .snoopy-svg {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 640px) {
    .snoopy-svg {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .snoopy-svg {
        width: 230px;
        height: 230px;
    }
}

@media (max-width: 360px) {
    .snoopy-svg {
        width: 200px;
        height: 200px;
    }
}

.snoopy-gift img,
.snoopy-svg image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(255,105,180,0.25));
}


.snoopy-dashed {
    stroke: #ff4444;
    stroke-width: 3;
    stroke-dasharray: 9 6;
    stroke-linecap: round;
    fill: none;
    vector-effect: non-scaling-stroke; 
    pointer-events: none;
    opacity: 0.6;
    transform: scale(1.01);
    transform-origin: center;
    animation: dashOffset 8s linear infinite;
}

@keyframes dashOffset {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -120; }
}

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


.miffy-gift {
    position: absolute;
    text-align: center;
}

.miffy-svg {
    display: block;
    width: 360px;
    height: 360px;
}

@media (max-width: 1024px) {
    .miffy-svg {
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 768px) {
    .miffy-svg {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 640px) {
    .miffy-svg {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .miffy-svg {
        width: 230px;
        height: 230px;
    }
}

@media (max-width: 360px) {
    .miffy-svg {
        width: 200px;
        height: 200px;
    }
}

.miffy-gift img,
.miffy-svg image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(255,105,180,0.25));
}


.miffy-dashed {
    stroke: #e5326b;
    stroke-width: 3;
    stroke-dasharray: 9 6;
    stroke-linecap: round;
    fill: none;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    opacity: 0.6;
    transform: scale(1.07) translateY(3%) translateX(9%);
    transform-origin: center center;
    animation: dashOffset 8s linear infinite;
}


.sharky-gift {
    position: absolute;
    text-align: center;
    scale: 1.4 !important;
}

.sharky-svg {
    display: block;
    width: 360px;
    height: 360px;
}

@media (max-width: 1024px) {
    .sharky-svg {
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 768px) {
    .sharky-svg {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 640px) {
    .sharky-svg {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .sharky-svg {
        width: 230px;
        height: 230px;
    }
    .sharky-dashed {
    stroke-width: 2px !important;
    }
}

@media (max-width: 360px) {
    .sharky-svg {
        width: 200px;
        height: 200px;
    }
}

.sharky-gift img,
.sharky-svg image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(255,105,180,0.25));
}
svg {
    overflow: visible;
}

.sharky-dashed {
    stroke: #e5326b;
    stroke-width: 3;
    stroke-dasharray: 9 6;
    stroke-linecap: round;
    fill: none;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    opacity: 0.6;
    transform: scale(0.93) translateY(-4.2%) translatex(-1.2%);
    transform-origin: center center;
    animation: dashOffset 8s linear infinite;
}


.bouquet-gift {
    position: absolute;
    text-align: center;
    scale: 1.2 !important;
}

.bouquet-svg {
    display: block;
    width: 360px;
    height: 360px;
}

@media (max-width: 1024px) {
    .bouquet-svg {
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 768px) {
    .bouquet-svg {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 640px) {
    .bouquet-svg {
        width: 260px;
        height: 260px;
    }
    .bouquet-dashed {
    stroke-width: 2px !important;
    }
}

@media (max-width: 480px) {
    .bouquet-svg {
        width: 230px;
        height: 230px;
    }
}

@media (max-width: 360px) {
    .bouquet-svg {
        width: 200px;
        height: 200px;
    }
}

.bouquet-gift img,
.bouquet-svg image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(255,105,180,0.25));
}


.bouquet-dashed {
    stroke: #f0f0f0;
    stroke-width: 3;
    stroke-dasharray: 9 6;
    stroke-linecap: round;
    fill: none;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    opacity: 0.6;
    transform: scale(1.02);
    transform-origin: center;
    animation: dashOffset 8s linear infinite;
}

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


#final-screen {
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 105, 180, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(139, 71, 137, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(255, 105, 180, 0.1) 0%, rgba(0, 0, 0, 1) 70%);
    position: relative;
    overflow: hidden;
}

#final-screen .screen-container {
    position: relative;
    z-index: 100;
}


@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(100vh) rotate(360deg); }
}

.final-message {
    position: relative !important;
    z-index: 1001 !important;
    text-align: center !important;
    padding: 30px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


#final-svg {
    width: 100%;
    max-width: 1200px;
    height: auto;
    display: block;
    margin: 0 auto;
}



.final-message.handwriting .handwriting-text {
    font-family: 'Brush Script MT', 'Segoe Script', 'Lucida Handwriting', cursive;
    font-size: 80px;
    font-weight: normal;
    color: #ffd700;
    letter-spacing: 2px;
    text-transform: none;
    display: inline-block;
    position: relative;
    background: linear-gradient(
        90deg,
        #ff69b4 0%,
        #ffd700 25%,
        #87ceeb 50%,
        #ffd700 75%,
        #ff69b4 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.4));
    
    
    position: relative;
    overflow: hidden;
}

.final-message.handwriting .handwriting-text::before {
    content: 'Happy Birthday Lina';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: inherit;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid rgba(255, 215, 0, 0.8);
    
}

.final-message.handwriting.writing .handwriting-text::before {
    animation: typewriter 4s steps(20) forwards, blink 0.75s step-end infinite;
}

@keyframes typewriter {
    0% {
        width: 0;
    }
    90% {
        width: 100%;
        border-right: 3px solid rgba(255, 215, 0, 0.8);
    }
    100% {
        width: 100%;
        border-right: 3px solid transparent;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: rgba(255, 215, 0, 0.8);
    }
    51%, 100% {
        border-color: transparent;
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}


@media (max-width: 768px) {
    .final-message.handwriting .handwriting-text {
        font-size: 60px;
    }
}

@media (max-width: 480px) {
    .final-message.handwriting .handwriting-text {
        font-size: 48px;
        letter-spacing: 1px;
    }
}

.final-svg-text {
    font-family: 'Dancing Script', 'Brush Script MT', 'Segoe Script', cursive;
    
    font-size: 500px;
    font-weight: 500;
}

@media (max-width: 1280px) {
    .final-svg-text { 
        font-size: 420px; 
    }
    .final-message { padding: 24px !important; }
}

@media (max-width: 1024px) {
    .final-svg-text { 
        font-size: 320px; 
    }
    .final-message { padding: 20px !important; }
}

@media (max-width: 768px) {
    .final-svg-text { 
        font-size: 270px; 
    }
    .final-message { padding: 16px !important; }
}

@media (max-width: 640px) {
    .final-svg-text { 
        font-size: 230px; 
    }
    .final-message { padding: 14px !important; }
}

@media (max-width: 480px) {
    .final-svg-text { 
        font-size: 170px; 
    }
    .final-message { padding: 12px !important; }
}

@media (max-width: 360px) {
    .final-svg-text { 
        font-size: 120px; 
    }
    .final-message { padding: 10px !important; }
}

.final-svg-text.stroke-text {
    fill: none;
    stroke: url(#handGrad);
    
    stroke-width: 8px;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1200; 
    stroke-dashoffset: 1200;
    
}

.final-svg-text.fill-text {
    fill: url(#handGrad);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.final-message.writing .final-svg-text.fill-text {
    opacity: 1;
    transition: opacity 0.6s ease; 
}

@keyframes scaleEntry {
    0% {
        transform: scale(0.3) translateY(50px);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) translateY(-10px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes float-text {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.02);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        filter: 
            drop-shadow(0 0 30px rgba(255, 215, 0, 0.6))
            drop-shadow(0 0 50px rgba(255, 105, 180, 0.4))
            drop-shadow(0 0 70px rgba(139, 71, 137, 0.3));
        text-shadow: 
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 105, 180, 0.6),
            0 0 60px rgba(139, 71, 137, 0.4);
    }
    50% {
        filter: 
            drop-shadow(0 0 50px rgba(255, 215, 0, 0.9))
            drop-shadow(0 0 80px rgba(255, 105, 180, 0.7))
            drop-shadow(0 0 100px rgba(139, 71, 137, 0.5));
        text-shadow: 
            0 0 30px rgba(255, 215, 0, 1),
            0 0 60px rgba(255, 105, 180, 0.8),
            0 0 90px rgba(139, 71, 137, 0.6);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

@media (max-width: 768px) {
    .start-button {
        padding: 15px 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .start-button {
        padding: 12px 30px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .start-button {
        padding: 10px 25px;
        font-size: 16px;
    }
}

.premium-envelope-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 700px;
    perspective: 1500px;
    position: relative;
    overflow: visible;
    padding-top: 50px;
}

@media (max-width: 1024px) {
    .premium-envelope-container {
        min-height: 600px;
        padding-top: 40px;
    }
}

@media (max-width: 768px) {
    .premium-envelope-container {
        min-height: 500px;
        padding-top: 30px;
    }
}

@media (max-width: 640px) {
    .premium-envelope-container {
        min-height: 450px;
        padding-top: 20px;
    }
}

@media (max-width: 480px) {
    .premium-envelope-container {
        min-height: 400px;
        padding-top: 15px;
    }
}

@media (max-width: 360px) {
    .premium-envelope-container {
        min-height: 350px;
        padding-top: 10px;
    }
}

.premium-envelope {
    position: relative;
    width: 400px;
    height: 260px;
    cursor: pointer;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    overflow: hidden; 
    z-index: 5;
}

@media (max-width: 1024px) {
    .premium-envelope {
        width: 380px;
        height: 247px;
    }
}

@media (max-width: 768px) {
    .premium-envelope {
        width: 340px;
        height: 221px;
    }
}

@media (max-width: 640px) {
    .premium-envelope {
        width: 300px;
        height: 195px;
    }
}

@media (max-width: 480px) {
    .premium-envelope {
        width: 280px;
        height: 182px;
    }
}

@media (max-width: 360px) {
    .premium-envelope {
        width: 240px;
        height: 156px;
    }
}

.premium-envelope::before {
    content: '';
    position: absolute;
    top: 50%; 
    left: 0;
    width: 100%;
    height: 50%; 
    background: transparent;
    z-index: 0; 
    pointer-events: none;
    border-radius: 0 0 8px 8px;
}

.envelope-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8e5d8 0%, #f0d5c4 100%);
    border-radius: 3px 3px 8px 8px;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.25),
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 2px 3px rgba(255, 255, 255, 0.4);
    transform-style: preserve-3d;
    perspective: 1000px;
    overflow: hidden; 
}

.flap-back {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%; 
    background: linear-gradient(180deg, #d9c4ac 0%, #e6d3ba 100%);
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
    z-index: 50; 
    border-radius: 0px 0px 8px 8px;
}

.flap-left {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #e6d3ba 0%, #d4bfa8 100%);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    z-index: 50; 
    border-radius: 3px 0px 0px 8px;
}

.flap-right {
    position: absolute;
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(225deg, #e6d3ba 0%, #d4bfa8 100%);
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
    z-index: 50; 
    border-radius: 0px 3px 8px 0px;
}

.flap-top {
    position: absolute;
    top: 2px;
    border-radius: 1px;
    left: 0;
    width: 100%;
    height: 51%; 
    background: linear-gradient(180deg, #f0dcc8 0%, #e6d3ba 50%, #d9c4ac 100%);
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    transform-origin: 50% 0%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    z-index: 100; 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    
    isolation: isolate;
}

.flap-left,
.flap-right,
.flap-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.envelope-body,
.inner-letter,
.envelope-photo {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}


.hb-layer-promote {
    will-change: transform;
    -webkit-will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}


.flap-top {
    
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
}

.flap-back,
.flap-left,
.flap-right {
    
    transform: translateZ(1px);
    -webkit-transform: translateZ(1px);
}

.inner-letter {
    position: absolute;
    width: 340px; 
    height: auto;
    max-height: none;
    bottom: 20px; 
    left: 50%;
    transform: translateY(27%) translateX(-50%) rotateZ(90deg) scale(0.65); 
    background: linear-gradient(to bottom, #fefdfb 0%, #f9f8f6 100%);
    border: 1px solid #e0d5c7;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 4px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 10; 
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 25px 22px;
    box-sizing: border-box;
    transform-origin: center center;
    transition: none;
    overflow: visible; 
    border-radius: 3px;
    cursor: pointer;
    pointer-events: auto;
}


.premium-envelope.opened .envelope-body {
    overflow: visible; 
}

.premium-envelope.opened {
    overflow: visible;
}

.premium-envelope.opened .inner-letter,
.premium-envelope.opened .envelope-photo {
    z-index: 200; 
}

@media (max-width: 1024px) {
    .inner-letter {
        
        left: calc(50% - 8px);
        scale: 0.95 !important;
    }
}

@media (max-width: 768px) {
    .inner-letter {
        scale: 0.87 !important;
        left: calc(50% - 22px);
    }
}

@media (max-width: 640px) {
    .inner-letter {
        scale: 0.76 !important;
        left: calc(50% - 42px);
    }
}

@media (max-width: 480px) {
    .inner-letter {
        scale: 0.73 !important;
        left: calc(50% - 46px);
    }
}

@media (max-width: 360px) {
    .inner-letter {
        scale: 0.62 !important;
        left: calc(50% - 65px);
    }
}

.inner-letter::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(181, 136, 99, 0.15);
    pointer-events: none;
    z-index: 0;
    border-radius: 2px;
}

.inner-letter::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(255,255,255,0.6) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
    z-index: 0;
}

.inner-letter::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 28px,
            rgba(0, 0, 0, 0.02) 28px,
            rgba(0, 0, 0, 0.02) 29px
        );
    pointer-events: none;
}

.letter-content {
    text-align: left;
    color: #2d2d2d;
    font-family: 'Libre Baskerville', 'Crimson Text', 'Merriweather', Georgia, serif;
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    overflow: visible; 
    box-sizing: border-box;
    font-size: 10px; 
    line-height: 1.35;
    padding: 0;
    pointer-events: none; 
}

@media (max-width: 1024px) {
    .letter-content {
        font-size: 10px;
        line-height: 1.33;
    }
}

@media (max-width: 768px) {
    .letter-content {
        font-size: 9px;
        line-height: 1.32;
    }
}

@media (max-width: 640px) {
    .letter-content {
        font-size: 8.5px;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .letter-content {
        font-size: 8px;
        line-height: 1.28;
    }
}

@media (max-width: 360px) {
    .letter-content {
        font-size: 7px;
        line-height: 1.25;
    }
}

.letter-content h3 {
    font-size: 15px;
    margin: 0 0 8px 0;
    color: #2d2d2d;
    font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: left;
    line-height: 1.2;
}

@media (max-width: 640px) {
    .letter-content h3 {
        font-size: 13px;
        margin: 0 0 6px 0;
    }
}

@media (max-width: 480px) {
    .letter-content h3 {
        font-size: 12px;
        margin: 0 0 5px 0;
    }
}

@media (max-width: 360px) {
    .letter-content h3 {
        font-size: 11px;
        margin: 0 0 4px 0;
    }
}

.letter-content p {
    font-size: 10px;
    line-height: 1.38;
    margin: 0 0 10px 0;
    color: #2d2d2d;
    font-family: 'Libre Baskerville', 'Crimson Text', 'Merriweather', Georgia, serif;
    text-align: justify;
    position: relative;
    z-index: 2;
}

.signature {
    text-align: right !important;
    font-family: 'Dancing Script', 'Parisienne', 'Brush Script MT', cursive !important;
    font-size: 16px !important;
    color: #2d2d2d !important;
    margin-top: 10px !important;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0px !important;
    line-height: 1.2 !important;
}

.envelope-photo {
    position: absolute;
    width: 320px; 
    height: auto; 
    bottom: 20px; 
    left: 50%;
    transform: translateY(27%) translateX(-50%) rotateZ(90deg) scale(0.6);
    transform-origin: center center;
    z-index: 2;
    opacity: 1; 
    visibility: visible; 
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    padding: 15px 15px 75px 15px; 
    box-sizing: border-box;
    cursor: pointer;
    transition: none;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .envelope-photo {
        left: calc(50% - 12px);
        scale: 0.95 !important;
    }
}

@media (max-width: 768px) {
    .envelope-photo {
        left: calc(50% - 12px);
        scale: 0.9 !important;
    }
}

@media (max-width: 640px) {
    .envelope-photo {
        left: calc(50% - 12px);
        scale: 0.85 !important;
    }
}

@media (max-width: 480px) {
    .envelope-photo {
        left: calc(50% - 12px);
        scale: 0.80 !important;
    }
}

@media (max-width: 360px) {
    .envelope-photo {
        left: calc(50% - 12px);
        scale: 0.72 !important;
    }
}

#envelope-photo-1 {
    z-index: 1; 
}

#envelope-photo-2 {
    z-index: 0; 
}

.envelope-photo img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
}

.envelope-photo .photo-caption {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    text-align: center;
    font-family: 'Dancing Script', 'Parisienne', 'Brush Script MT', cursive;
    font-size: 18px;
    color: #2d2d2d;
    font-weight: 500;
    letter-spacing: 0.5px;
    pointer-events: none;
}


.letter-content::-webkit-scrollbar {
    width: 6px;
}

.letter-content::-webkit-scrollbar-track {
    background: rgba(212, 197, 160, 0.2);
    border-radius: 3px;
}

.letter-content::-webkit-scrollbar-thumb {
    background: rgba(109, 76, 145, 0.3);
    border-radius: 3px;
}

.letter-content::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 76, 145, 0.5);
}

.wax-seal {
    position: absolute;
    top: 30%; 
    left: 50%;
    transform: translateX(-50%);
    width: 25%; 
    max-width: 100px; 
    min-width: 60px; 
    height: auto;
    aspect-ratio: 5 / 6; 
    background-image: url('images/stamp.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    z-index: 5;
    cursor: pointer;
}

.wax-seal::before {
    display: none;
}

.wax-seal span {
    display: none;
}

.wax-seal::after {
    display: none;
}

.premium-envelope:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.premium-envelope.opened:hover {
    transform: none;
    transition: none;
}

 .music-player {
     position: fixed;
     top: 30px;
     right: 30px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
     transform: translateY(-20px);
    transition: all 0.4s ease;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
}

.music-player.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.player-container {
    display: flex;
    gap: 16px;
    align-items: center;
}


.album-art-wrapper {
    filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.1));
    pointer-events: none; 
    cursor: default;      
}
.album-art-wrapper:focus {
    outline: none; 
}

.album-art {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 220px;
}

.song-title {
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.control-btn {
    background: #f5f5f5;
    border: none;
    color: #333;
    font-size: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
}

.control-btn:hover {
    background: #e8e8e8;
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.play-pause {
    width: 44px;
    height: 44px;
    font-size: 18px;
    background: #1a1a1a;
    color: #fff;
    padding-left: 1px;
    padding-bottom: 1px;
    transition: background 200ms ease;
}

.control-btn.play-pause:hover {
    background: #333;
}


.control-btn .icon-playpause {
    display: block;
    width: 20px;
    height: 20px;
    margin: 0 auto;
}
.control-btn .icon-playpause .icon-pause {
    display: none;
}
.control-btn.is-playing .icon-playpause .icon-play {
    display: none;
}
.control-btn.is-playing .icon-playpause .icon-pause {
    display: block;
}
.control-btn .icon-playpause path,
.control-btn .icon-playpause rect {
    color: #fff;
    fill: currentColor;
}

.progress-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.time {
    color: #666;
    font-size: 11px;
    min-width: 35px;
    text-align: center;
    font-weight: 500;
}

.progress-bar {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a1a1a;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a1a1a;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.progress-bar::-moz-range-thumb:hover {
    transform: scale(1.2);
}

@media (max-width: 1024px) {
    .music-player {
        top: 25px;
        right: 10px;
        padding: 18px;
        max-width: calc(100vw - 50px);
        scale: 0.85;
    }
    
    .album-art {
        width: 65px;
        height: 65px;
    }
    
    .player-info {

    
    :root {
        -webkit-tap-highlight-color: transparent;
    }

    a, button, input, textarea, [role="button"], .gift-box, .wax-seal, .envelope-photo, .inner-letter, .start-btn, [id^="skip-"], .flap-top {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        user-select: none;
        -webkit-user-select: none;
    }

    
    a:focus:not(:focus-visible),
    button:focus:not(:focus-visible),
    input:focus:not(:focus-visible),
    textarea:focus:not(:focus-visible),
    [role="button"]:focus:not(:focus-visible),
    .gift-box:focus:not(:focus-visible),
    .wax-seal:focus:not(:focus-visible),
    .envelope-photo:focus:not(:focus-visible),
    .inner-letter:focus:not(:focus-visible) {
        outline: none !important;
        box-shadow: none !important;
    }
        min-width: 200px;
    }
    
    .song-title {
        font-size: 14px;
    }
    
    .control-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }
    
    .control-btn.play-pause {
        width: 42px;
        height: 42px;
        font-size: 17px;
    }
}

@media (max-width: 768px) {
    .music-player {
        top: 20px;
        right: 5px;
        padding: 16px;
        max-width: calc(100vw - 40px);
    }
    
    .album-art {
        width: 60px;
        height: 60px;
    }
    
    .player-info {
        min-width: 180px;
    }
    
    .song-title {
        font-size: 14px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .control-btn.play-pause {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .music-player {
        top: 15px;
        right: 15px;
        left: 15px;
        padding: 14px;
        border-radius: 25px;
        max-width: none;
        scale: 0.9;
    }
    
    .player-container {
        gap: 12px;
    }
    
    .album-art {
        width: 55px;
        height: 55px;
    }
    
    .player-info {
        min-width: 150px;
        gap: 8px;
    }
    
    .song-title {
        font-size: 13px;
    }
    
    .control-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    
    .control-btn.play-pause {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    
    .control-btn .icon-playpause {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 640px) {
    .music-player {
        top: 12px !important;
        right: 12px !important;
        left: auto !important;
        bottom: auto !important;
        width: 56px !important;
        height: 56px !important;
        padding: 0 !important;
        border-radius: 12px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        
        background: transparent !important;
        
        position: fixed;
        transition: width 480ms cubic-bezier(0.16, 1, 0.3, 1);
        will-change: width, transform;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    }

    
    .music-player::before {
        
        --card-clip-delay: 0ms;
        --card-opacity-delay: 0ms;
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(255,255,255,0.98);
        border-radius: 12px;
        transform-origin: 100% 0%; 
        
        transform: scale(0.96);
        opacity: 0;
        will-change: transform, opacity;
        transition: transform 420ms cubic-bezier(0.22,0.9,0.3,1) var(--card-clip-delay),
                    opacity 260ms ease var(--card-opacity-delay),
                    box-shadow 360ms ease var(--card-clip-delay);
        z-index: 1;
        pointer-events: none;
    }

    
    .music-player:not(.expanded) {
        background: transparent !important;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06) !important;
        color: inherit;
    }
    
    .player-container {
        gap: 0 !important;
        display: flex;
        align-items: center;
        width: 100%;
        height: 100%;
        position: relative;
    }

    
    .album-art-wrapper {
        width: 56px;
        height: 56px;
        border-radius: 12px;
        overflow: hidden;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 30; 
        transition: transform 520ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
        background: transparent !important;
        pointer-events: auto !important; 
    }

    .album-art-wrapper:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }

    .album-art-wrapper:active {
        transform: scale(0.98);
    }

    .album-art-wrapper:focus {
        outline: 2px solid rgba(26,26,26,0.3);
        outline-offset: 2px;
    }

    .album-art {
        width: 60px !important;
        height: 60px !important;
        border-radius: 12px !important;
        object-fit: cover;
        background: transparent; 
        transition: transform 440ms cubic-bezier(0.22,0.9,0.3,1), opacity 360ms ease;
        display: block;
    }

    
    .player-info {
        background: transparent;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        transform: translateX(8px);
        transition: opacity 320ms ease, transform 380ms cubic-bezier(0.22,0.9,0.3,1);
    }

    .song-title { 
        font-size: 12px; 
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis;
        transition: all 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .control-btn { 
        width: 28px; 
        height: 28px;
        transition: all 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .control-btn.play-pause { 
        width: 34px; 
        height: 34px;
    }

    .control-btn .icon-playpause { width: 14px; height: 14px; }

    
    .control-btn.close-btn svg { width: 18px; height: 18px; display: block; color: #333; }
    .control-btn.close-btn { 
        width: 32px; 
        height: 32px; 
        display: none !important; 
        background: transparent;
    }

    .time { font-size: 10px; min-width: 28px; }

    .progress-container {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateX(8px);
        transition: opacity 360ms ease, transform 420ms cubic-bezier(0.22,0.9,0.3,1);
        overflow: hidden;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    
    .music-player.expanded {
        width: calc(100vw - 24px) !important;
        height: auto !important;
        padding: 14px 16px !important;
        border-radius: 16px !important;
        transform: translateY(0);
        box-shadow: 0 14px 40px rgba(0,0,0,0.18) !important;
        transition: width 520ms cubic-bezier(0.16,1,0.3,1), box-shadow 420ms ease, padding 420ms ease;
    }

    
    .music-player.expanded::before {
        
        --card-clip-delay: 0ms;      
        --card-opacity-delay: 40ms;  
        transform: scale(1);
        opacity: 1;
        border-radius: 16px;
    }

    .music-player.expanded .album-art-wrapper {
        position: static;
        width: 75px;
        height: 75px;
        cursor: default;
        pointer-events: none;
    }

    .music-player.expanded .album-art-wrapper:hover {
        transform: scale(1);
    }

    .music-player.expanded .album-art {
        width: 75px !important;
        height: 75px !important;
        border-radius: 10px !important;
    }

    .music-player.expanded .player-container {
        gap: 12px !important;
    }

    .music-player.expanded .player-info {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateX(0);
        height: auto !important;
        flex: 1;
        display: flex !important;
        flex-direction: column;
        gap: 10px;
        z-index: 10; 
        transition-delay: 120ms;
    }

    
    .music-player.expanded .player-controls {
        gap: 10px;
        margin-left: 40px; 
        align-items: center;
        transform: translateX(0);
        opacity: 1;
        transition: transform 360ms cubic-bezier(0.2,1,0.3,1) 120ms, opacity 320ms ease 120ms;
    }

    
    .music-player:not(.expanded) .player-controls {
        opacity: 0;
        transform: translateX(6px);
        transition: transform 260ms cubic-bezier(0.2,1,0.3,1), opacity 220ms ease;
    }

    
    .music-player:not(.expanded) .player-info {
        transition-delay: 0ms;
    }

    
    
    .music-player:not(.expanded)::before {
        --card-clip-delay: 160ms;    
        --card-opacity-delay: 60ms;  
        transform: scale(0.96);
        opacity: 0;
    }


    .music-player.expanded .control-btn.close-btn {
        display: inline-flex !important;
    }

    .music-player.expanded .progress-container {
        opacity: 1 !important;
        pointer-events: auto !important;
        transition-delay: 180ms;
        transform: translateX(0);
        transition: opacity 320ms ease 150ms, transform 360ms cubic-bezier(0.2,1,0.3,1) 150ms;
    }

    .music-player.expanded .progress-container .progress-bar { 
        flex: 1;
        min-width: 100px;
    }

    .music-player.expanded .song-title {
        transition-delay: 100ms;
    }

    .music-player.expanded .player-controls {
        transition-delay: 120ms;
    }
}


.control-btn.close-btn {
    background: transparent;
    box-shadow: none;
    width: 30px;
    height: 30px;
    display: none !important; 
    align-items: center;
    justify-content: center;
    color: #333;
    padding: 0;
    line-height: 0;
}

.control-btn.close-btn:focus { 
    outline: 2px solid rgba(26,26,26,0.12); 
    outline-offset: 2px; 
    box-shadow: 0 0 0 4px rgba(26,26,26,0.06); 
}


@media (max-width: 360px) {
    .music-player {
        width: 52px;
        height: 52px;
    }

    .album-art-wrapper {
        width: 52px;
        height: 52px;
    }

    .album-art {
        width: 52px;
        height: 52px;
    }

    .music-player.expanded .album-art-wrapper {
        width: 44px;
        height: 44px;
    }

    .music-player.expanded .album-art {
        width: 44px;
        height: 44px;
    }

    .control-btn { width: 26px; height: 26px; }
    .control-btn.play-pause { width: 32px; height: 32px; }
}
