:root {
    --red-tet: #d32f2f;
    --gold-tet: #ffd700;
    --bg-color: #fff5e1;
}

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

body {
    background-color: var(--bg-color);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100%;
    max-width: 600px;
    text-align: center;
}

/* Trang trí hoa */
.decoration {
    position: absolute;
    width: 300px;
    height: 300px;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 1;
}
.blossom-left {
    top: -20px;
    left: -20px;
    background-image: url("cho.webp");
} /* Hình hoa mai/đào */
.blossom-right {
    top: -20px;
    right: -20px;
    background-image: url("meo.webp");
    transform: scaleX(1);
}

/* Bao lì xì */
.envelope-wrapper {
    position: relative;
    width: 200px;
    height: 350px;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.5s;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--red-tet);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: 0.5s;
}

.flap {
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-top: 100px solid #b71c1c;
    transform-origin: top;
    transition: transform 0.4s ease-in-out;
    z-index: 4;
}

.zodiac-icon {
    font-size: 5rem;
}
.txt-lixi {
    color: var(--gold-tet);
    font-weight: bold;
    font-size: 1.5rem;
    margin-top: 10px;
    border: 2px solid var(--gold-tet);
    padding: 5px 15px;
    border-radius: 5px;
}

h2 {
    color: var(--red-tet);
    font-size: 32px;
}
.zodiac-year {
    color: #5d4037;
    font-weight: bold;
    font-size: 24px;
}

/* Trạng thái mở */
.envelope-wrapper.open .flap {
    transform: rotateX(180deg);
}

.hint {
    margin-top: 20px;
    color: #8d6e63;
    font-style: italic;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .envelope-wrapper {
        width: 160px;
        height: 280px;
    }
    .flap {
        border-left: 80px solid transparent;
        border-right: 80px solid transparent;
        border-top: 80px solid #b71c1c;
    }
    .blossom-left,
    .blossom-right {
        width: 200px;
        height: 200px;
    }
}

/* Đảm bảo thiệp có thể hiển thị nội dung dài */
.card {
    position: fixed; /* Chuyển sang fixed để nổi lên trên toàn bộ màn hình */
    top: 50%;
    left: 50%;
    width: 90vw; /* Chiếm 90% chiều rộng màn hình */
    max-width: 800px; /* Giới hạn tối đa để đẹp trên desktop */
    max-height: 80vh; /* Giới hạn chiều cao */
    background: #fff;
    padding: 30px 20px;
    border-radius: 15px;
    z-index: 100; /* Nằm trên cùng */
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.5); /* Bắt đầu từ giữa và nhỏ */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    overflow-y: auto; /* Cho phép cuộn nếu lời chúc quá dài */

    /* Hiệu ứng chuyển cảnh */
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* QUAN TRỌNG: Mặc định delay là 0s để khi đóng thì đóng ngay */
    transition-delay: 0s;

    /* Ẩn thanh cuộn cho Firefox */
    scrollbar-width: none;

    /* Ẩn thanh cuộn cho IE và Edge */
    -ms-overflow-style: none;
}

/* Khi bao lì xì được mở */
.envelope-wrapper.open .card {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1); /* Phóng to ra giữa màn hình */
    transition-delay: 0.4s;
}

/* Làm đẹp nội dung thiệp */
.card-content {
    border: 2px dashed var(--red-tet);
    padding: 20px;
    background-image: radial-gradient(var(--bg-color) 1px, transparent 1px);
    background-size: 20px 20px;
}

.message {
    font-size: 24px; /* Chữ to hơn */
    line-height: 1.8;
    color: #444;
    text-align: justify;
    margin: 20px 0;
}

/* Lớp phủ mờ nền khi mở thiệp */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    display: none;
}

.envelope-wrapper.open ~ .overlay {
    display: block;
}

.card-content {
    font-family: "Dancing Script", cursive;
    font-optical-sizing: auto;
    font-weight: 40px;
    font-style: normal;
}

.signature {
    font-size: 24px;
}
