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

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #faf8ff 0%, #f5f0ff 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Photo Gallery Background */
.photo-gallery {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
    overflow: hidden;
}

.photo-row {
    height: calc(33.333% - 0.667rem);
    display: flex;
    gap: 1rem;
    width: fit-content;
    animation: scroll-left 30s linear infinite;
}

/* Row 1: Left to Right */
.row-1 {
    flex-direction: row;
    animation: scroll-left 30s linear infinite;
}

/* Row 2: Right to Left */
.row-2 {
    flex-direction: row;
    animation: scroll-right 30s linear infinite;
}

/* Row 3: Left to Right */
.row-3 {
    flex-direction: row;
    animation: scroll-left 30s linear infinite;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

@keyframes scroll-right {
    0% {
        transform: translateX(-50%);
    }
    100% {
        transform: translateX(0);
    }
}

.photo-item {
    flex-shrink: 0;
    width: 300px;
    height: 100%;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}

/* Gradient overlay to ensure text is readable */
.photo-gallery::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(250, 248, 255, 0.3) 0%, rgba(200, 180, 220, 0.6) 100%);
    z-index: 1;
    pointer-events: none;
}

/* Main Content */
.content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    animation: fadeInUp 1s ease-out;
}

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

/* Title */
h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #8b5cb8 0%, #b88bd4 50%, #7a4a9e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: #6b4a85;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Timer Box */
.timer-box {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    padding: 4rem 3rem;
    box-shadow: 0 8px 32px 0 rgba(200, 150, 220, 0.2);
    max-width: 500px;
    animation: slideUp 0.8s ease-out 0.3s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timer-label {
    font-size: 0.95rem;
    color: #6b4a85;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timer-display {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.time-number {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #9b7bc4 0%, #c5a3e8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    animation: countUp 0.6s ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    padding-bottom: 0.2rem;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.time-label {
    font-size: 0.75rem;
    color: #7a5a9e;
    font-weight: 600;
    margin-top: 0.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Decorative elements */
.decoration {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    pointer-events: none;
}

.decoration-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #c9a6d9 0%, #e6d5f0 100%);
    top: -100px;
    right: -100px;
    z-index: -1;
}

.decoration-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #b8a3d4 0%, #d4b8e8 100%);
    bottom: -50px;
    left: -50px;
    z-index: -1;
}

/* Placeholder text for images */
.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8d0f5 0%, #f5e8fa 100%);
    color: #c9a6d9;
    font-size: 1rem;
    font-weight: 500;
}

/* Envelope Button */
.envelope-container {
    position: relative;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 10px;
    -webkit-tap-highlight-color: transparent;
}

.envelope-container:hover {
    transform: scale(1.1);
}

@media (hover: none) and (pointer: coarse) {
    .envelope-container:active {
        transform: scale(0.95);
    }
}

.envelope {
    position: relative;
    width: 80px;
    height: 60px;
    transition: all 0.5s ease;
}

.envelope-body {
    position: absolute;
    bottom: 0;
    width: 80px;
    height: 50px;
    background: linear-gradient(135deg, #e8d0f5 0%, #d4b8e8 100%);
    border-radius: 3px;
    box-shadow: 0 4px 15px rgba(139, 92, 184, 0.3);
}

.envelope-flap {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 30px solid #c9a6d9;
    transform-origin: top center;
    transition: all 0.6s ease;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0);
}

.letter {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 60px;
    height: 70px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: all 0.6s ease;
    opacity: 0;
    z-index: 1;
}

.letter-content {
    padding: 10px;
    font-size: 8px;
    color: #6b4a85;
    display: none;
}

.letter-content h2 {
    font-size: 10px;
    margin-bottom: 5px;
    color: #8b5cb8;
}

.letter-content p {
    margin-bottom: 5px;
    line-height: 1.3;
}

/* Opened state */
.envelope-container.opened {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    animation: none;
}

.envelope-container.opened .envelope {
    animation: envelopeGrow 0.6s ease-out forwards;
}

.envelope-container.opened .envelope-body {
    animation: envelopeBodyGrow 0.6s ease-out forwards;
}

.envelope-container.opened .envelope-flap {
    animation: flapOpen 1.1s ease-out forwards;
}

.envelope-container.opened .letter {
    animation: letterSlideOut 0.6s ease-out 1.1s forwards;
}

.envelope-container.opened .letter-content {
    display: block;
    padding: 40px;
    font-size: 16px;
    opacity: 0;
    animation: contentFadeIn 0.4s ease-out 1.5s forwards;
}

.envelope-container.opened .letter-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
}

.envelope-container.opened .letter-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Envelope opening animations */
@keyframes envelopeGrow {
    from {
        width: 80px;
        height: 60px;
    }
    to {
        width: 400px;
        height: 500px;
    }
}

@keyframes envelopeBodyGrow {
    from {
        width: 80px;
        height: 50px;
        z-index: 3;
    }
    to {
        width: 400px;
        height: 300px;
        z-index: 3;
    }
}

@keyframes flapOpen {
    0% {
        border-left: 40px solid transparent;
        border-right: 40px solid transparent;
        border-top: 30px solid #c9a6d9;
        transform: translateX(-50%) rotateX(0deg);
        top: 10px;
        left: 50%;
        z-index: 4;
    }
    15% {
        border-left: 100px solid transparent;
        border-right: 100px solid transparent;
        border-top: 75px solid #c9a6d9;
        transform: translateX(-50%) rotateX(0deg);
        top: 80px;
        left: 50%;
        z-index: 4;
    }
    30% {
        border-left: 160px solid transparent;
        border-right: 160px solid transparent;
        border-top: 120px solid #c9a6d9;
        transform: translateX(-50%) rotateX(0deg);
        top: 150px;
        left: 50%;
        z-index: 4;
    }
    50% {
        border-left: 200px solid transparent;
        border-right: 200px solid transparent;
        border-top: 150px solid #c9a6d9;
        transform: translateX(-50%) rotateX(0deg);
        top: 200px;
        left: 50%;
        z-index: 4;
    }
    60% {
        border-left: 200px solid transparent;
        border-right: 200px solid transparent;
        border-top: 150px solid #c9a6d9;
        transform: translateX(-50%) rotateX(0deg);
        top: 200px;
        left: 50%;
        z-index: 1;
    }
    80% {
        border-left: 200px solid transparent;
        border-right: 200px solid transparent;
        border-top: 150px solid #c9a6d9;
        transform: translateX(-50%) rotateX(90deg);
        top: 200px;
        left: 50%;
        z-index: 0;
    }
    100% {
        border-left: 200px solid transparent;
        border-right: 200px solid transparent;
        border-top: 150px solid #c9a6d9;
        transform: translateX(-50%) rotateX(180deg);
        top: 200px;
        left: 50%;
        z-index: 0;
    }
}

@keyframes letterSlideOut {
    0% {
        width: 350px;
        height: 450px;
        top: 250px;
        left: 25px;
        opacity: 1;
        z-index: 2;
    }
    60% {
        width: 350px;
        height: 450px;
        top: -100px;
        left: 25px;
        opacity: 1;
        z-index: 2;
    }
    100% {
        width: 350px;
        height: 450px;
        top: 10px;
        left: 25px;
        opacity: 1;
        z-index: 4;
    }
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Close button for opened envelope */
.close-letter {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #8b5cb8;
    cursor: pointer;
    display: none;
    z-index: 10;
}

.envelope-container.opened .close-letter {
    display: block;
}

/* Click me text */
.click-me-text {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: #8b5cb8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 1;
    animation: pulse 2s ease-in-out infinite;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 0.6;
        transform: translateX(-50%) translateY(-3px);
    }
}

.envelope-container.opened .click-me-text {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .content {
        gap: 2rem;
        padding: 1rem;
    }

    .timer-box {
        padding: 2.5rem 2rem;
        margin: 0 1rem;
        max-width: 90vw;
    }

    .timer-label {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .timer-display {
        gap: 1rem;
    }

    .time-unit {
        min-width: 60px;
    }

    .time-number {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    .time-label {
        font-size: 0.65rem;
    }

    .envelope-container {
        margin-top: 1.5rem;
    }

    .envelope {
        width: 70px;
        height: 55px;
    }

    .envelope-body {
        width: 70px;
        height: 45px;
    }

    .envelope-flap {
        border-left: 35px solid transparent;
        border-right: 35px solid transparent;
        border-top: 25px solid #c9a6d9;
        left: 50%;
        transform: translateX(-50%);
    }

    .envelope-container.opened {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    @keyframes envelopeGrow {
        from {
            width: 70px;
            height: 55px;
        }
        to {
            width: 90vw;
            max-width: 400px;
            height: auto;
            min-height: 500px;
        }
    }

    @keyframes envelopeBodyGrow {
        from {
            width: 70px;
            height: 45px;
            z-index: 3;
        }
        to {
            width: 90vw;
            max-width: 400px;
            height: 250px;
            z-index: 3;
        }
    }

    @keyframes flapOpen {
        0% {
            border-left: 35px solid transparent;
            border-right: 35px solid transparent;
            border-top: 25px solid #c9a6d9;
            transform: translateX(-50%) rotateX(0deg);
            top: 5px;
            left: 50%;
            z-index: 4;
        }
        15% {
            border-left: 25vw solid transparent;
            border-right: 25vw solid transparent;
            border-top: 60px solid #c9a6d9;
            transform: translateX(-50%) rotateX(0deg);
            top: 30px;
            left: 50%;
            z-index: 4;
        }
        30% {
            border-left: 35vw solid transparent;
            border-right: 35vw solid transparent;
            border-top: 90px solid #c9a6d9;
            transform: translateX(-50%) rotateX(0deg);
            top: 45px;
            left: 50%;
            z-index: 4;
        }
        50% {
            border-left: 45vw solid transparent;
            border-right: 45vw solid transparent;
            border-top: 120px solid #c9a6d9;
            transform: translateX(-50%) rotateX(0deg);
            top: 60px;
            left: 50%;
            z-index: 4;
        }
        60% {
            border-left: 45vw solid transparent;
            border-right: 45vw solid transparent;
            border-top: 120px solid #c9a6d9;
            transform: translateX(-50%) rotateX(0deg);
            top: 60px;
            left: 50%;
            z-index: 1;
        }
        80% {
            border-left: 45vw solid transparent;
            border-right: 45vw solid transparent;
            border-top: 120px solid #c9a6d9;
            transform: translateX(-50%) rotateX(90deg);
            top: 105px;
            left: 50%;
            z-index: 0;
        }
        100% {
            border-left: 45vw solid transparent;
            border-right: 45vw solid transparent;
            border-top: 120px solid #c9a6d9;
            transform: translateX(-50%) rotateX(180deg);
            top: 150px;
            left: 50%;
            z-index: 0;
        }
    }

    @keyframes letterSlideOut {
        0% {
            width: 60px;
            height: 70px;
            top: 10px;
            left: 10px;
            opacity: 0;
            z-index: 2;
        }
        60% {
            width: calc(90vw - 40px);
            max-width: 360px;
            height: auto;
            min-height: 400px;
            top: -80px;
            left: 50%;
            transform: translateX(-50%);
            opacity: 1;
            z-index: 2;
        }
        100% {
            width: calc(90vw - 40px);
            max-width: 360px;
            height: auto;
            min-height: 400px;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            opacity: 1;
            z-index: 4;
        }
    }

    .envelope-container.opened .letter-content {
        padding: 30px 20px;
        font-size: 15px;
    }

    .envelope-container.opened .letter-content h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .envelope-container.opened .letter-content p {
        margin-bottom: 12px;
        line-height: 1.5;
    }

    .close-letter {
        font-size: 28px;
        top: 15px;
        right: 20px;
        padding: 5px;
    }

    .photo-item {
        width: 250px;
    }

    .decoration-1,
    .decoration-2 {
        opacity: 0.05;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .timer-box {
        padding: 2rem 1.5rem;
    }

    .timer-display {
        gap: 0.75rem;
    }

    .time-unit {
        min-width: 50px;
    }

    .envelope-container.opened .letter-content {
        padding: 25px 15px;
        font-size: 14px;
    }

    .envelope-container.opened .letter-content h2 {
        font-size: 20px;
    }
}
