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

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
}

.container {
    perspective: 1000px;
    cursor: pointer;
}

.envelope-wrapper {
    position: relative;
    width: 400px;
    height: 280px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.envelope-wrapper:hover:not(.opening) {
    transform: scale(1.05);
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
}

.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #f4f4f4;
    border: 2px solid #d4d4d4;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.envelope-front {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-top: 140px solid #e8e8e8;
    top: 0;
    left: 0;
    z-index: 3;
}

.envelope-flap {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-top: 140px solid #fff;
    top: 0;
    left: 0;
    transform-origin: top center;
    transition: transform 1s ease;
    z-index: 4;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.2));
}

.envelope-wrapper.opening .envelope-flap {
    transform: rotateX(-180deg);
    transition: transform 1s ease 0.3s;
}

.recipient-label {
    width: 100%;
    position: absolute;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #333;
    z-index: 2;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.envelope-wrapper.opening .recipient-label {
    opacity: 0;
}

.recipient-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #667eea;
}

.recipient-greeting {
    font-size: 22px;
    font-style: italic;
    color: #224119;
    /* color: #667eea; */
    font-weight: bold;
}

.carousel-container {
    position: absolute;
    width: 340px;
    height: 512px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(0);
    z-index: 1;
    opacity: 0;
    transition: transform 1.2s ease, opacity 1s ease;
    overflow: visible;
    z-index: 10;
}

.envelope-wrapper.opening .carousel-container {
    transform: translate(-50%, -50%);
    opacity: 1;
    transition: transform 1.2s ease 1s, opacity 1s ease 1s;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
    cursor: grab;
}

.carousel-wrapper:active {
    cursor: grabbing;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.card {
    min-width: 340px;
    /* height: 450px; */
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #667eea;
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    /* padding: 40px; */
    flex-shrink: 0;
}

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

/* Embla carousel styles */
.embla {
    width: 340px;
    height: 512px;
    overflow: hidden;
}

.embla__viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.embla__container {
    display: flex;
    height: 100%;
}

.embla__slide {
    min-width: 340px;
    height: 512px;
    flex: 0 0 auto;
    display: block;
    padding: 0 0;
}

.card-content {
    text-align: center;
    color: #333;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.card-details {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.card-event {
    font-size: 24px;
    font-weight: bold;
    color: #764ba2;
    margin: 25px 0;
}

.card-divider {
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    margin: 20px auto;
}

.card-footer {
    margin-top: 30px;
    font-size: 16px;
    font-style: italic;
    color: #888;
}

.carousel-nav {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.5s ease 2s;
}

.envelope-wrapper.opening .carousel-nav {
    opacity: 1;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.3);
}

.carousel-arrow {
    position: absolute;
    bottom: -50px;
    transform: translateY(14px);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #667eea;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.envelope-wrapper.opening .carousel-arrow {
    opacity: 0.8;
    transition: opacity 0.3s ease 2s;
}

.carousel-arrow:hover {
    opacity: 1 !important;
    transform: translateY(14px) scale(1.1);
}

.carousel-arrow.left {
    left: calc(50% - 100px);
}

.carousel-arrow.right {
    right: calc(50% - 100px);
}

.click-hint {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    opacity: 0.8;
    animation: pulse 2s infinite;
    pointer-events: none;
}

.envelope-wrapper.opening .click-hint {
    display: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px);
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0;
    z-index: 10;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.card-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

/* Responsive styles for small screens */
@media (max-width: 480px) {
    .envelope-wrapper {
        width: min(400px, 85vw);
        height: min(280px, 59.5vw);
    }

    .envelope-front {
        border-left: min(200px, 42.5vw) solid transparent;
        border-right: min(200px, 42.5vw) solid transparent;
        border-top: min(140px, 29.75vw) solid #e8e8e8;
    }

    .envelope-flap {
        border-left: min(200px, 42.5vw) solid transparent;
        border-right: min(200px, 42.5vw) solid transparent;
        border-top: min(140px, 29.75vw) solid #fff;
    }

    .carousel-container {
        width: min(340px, 72.25vw);
        height: min(512px, 108.8vw);
    }

    .embla {
        width: min(340px, 72.25vw);
        height: min(512px, 108.8vw);
    }

    .embla__slide {
        min-width: min(340px, 72.25vw);
        height: min(512px, 108.8vw);
    }

    .card {
        min-width: min(340px, 72.25vw);
    }

    .recipient-greeting {
        font-size: min(22px, 4.5vw);
    }

    .recipient-name {
        font-size: min(24px, 5vw);
    }

    .card-title {
        font-size: min(32px, 6.5vw);
    }

    .card-details {
        font-size: min(18px, 3.8vw);
    }

    .card-event {
        font-size: min(24px, 5vw);
    }

    .card-footer {
        font-size: min(16px, 3.3vw);
    }

    .carousel-arrow {
        width: min(40px, 8.5vw);
        height: min(40px, 8.5vw);
        font-size: min(20px, 4.25vw);
    }

    .carousel-arrow.left {
        left: calc(50% - min(100px, 21.25vw));
    }

    .carousel-arrow.right {
        right: calc(50% - min(100px, 21.25vw));
    }

    .carousel-nav {
        bottom: min(-50px, -10.6vw);
    }

    .carousel-arrow {
        bottom: min(-50px, -10.6vw);
    }
}

@media (max-width: 360px) {
    .envelope-wrapper {
        width: min(400px, 88vw);
        height: min(280px, 61.6vw);
    }

    .carousel-container {
        width: min(340px, 75vw);
        height: min(512px, 113vw);
    }

    .embla {
        width: min(340px, 75vw);
        height: min(512px, 113vw);
    }

    .embla__slide {
        min-width: min(340px, 75vw);
        height: min(512px, 113vw);
    }

    .card {
        min-width: min(340px, 75vw);
    }
}

@media (max-width: 320px) {
    .envelope-wrapper {
        width: 280px;
        height: 196px;
    }

    .envelope-front {
        border-left: 140px solid transparent;
        border-right: 140px solid transparent;
        border-top: 98px solid #e8e8e8;
    }

    .envelope-flap {
        border-left: 140px solid transparent;
        border-right: 140px solid transparent;
        border-top: 98px solid #fff;
    }

    .carousel-container {
        width: 238px;
        height: 358px;
    }

    .embla {
        width: 238px;
        height: 358px;
    }

    .embla__slide {
        min-width: 238px;
        height: 358px;
    }

    .card {
        min-width: 238px;
    }

    .recipient-greeting {
        font-size: 16px;
    }

    .recipient-name {
        font-size: 18px;
    }

    .card-title {
        font-size: 24px;
    }

    .card-details {
        font-size: 14px;
    }

    .card-event {
        font-size: 18px;
    }

    .card-footer {
        font-size: 13px;
    }

    .carousel-arrow {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .carousel-arrow.left {
        left: calc(50% - 85px);
    }

    .carousel-arrow.right {
        right: calc(50% - 85px);
    }

    .carousel-nav {
        bottom: -40px;
    }

    .carousel-arrow {
        bottom: -40px;
    }
