.boxMail {
    position: fixed;
    background: rgb(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    width: 100%;
    height: 100%;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s;
    z-index: 100000000;
}

.boxMail .crossAll {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 30px;
    padding: 10px 25px;
    cursor: pointer;
    color: white;
    z-index: 999;
}

.boxMail .boxMail-container {
    position: absolute;
    width: 750px;
    height: 500px;
    display: flex;
    margin: 0;
    transform: scale(0.9);
    -webkit-perspective: 2000px;
    perspective: 2000px;
}

.boxMail .boxMail-container:hover {
    transform: rotate(-5deg);
    filter: drop-shadow(0 0 10px #FFC531);
}

.boxMail .boxMail-container:hover .card1 {
    transform: translate(-187px, -250px) rotateY(-140deg);
}

.boxMail .boxMail-container .card1,
.boxMail .boxMail-container .card2 {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid black;
}

/* --- Card 1 Container Styles --- */

/* --- Card 1 Container Styles (Hello Kitty Theme) --- */

.boxMail .boxMail-container .card1 {
    position: absolute;
    width: 50%;
    height: 100%;
    /* Softened gradient: Light Pink to Alice Blue */
    background: linear-gradient(135deg, #2f2346 0%, #14101d 100%);
    color: #f3e6c4;
    /* Darker text for contrast on light background */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
    border-right: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    /* Lighter shadow */
}

.boxMail-container .card1 {
    z-index: 1;
    transform-style: preserve-3d;
    transform-origin: left;
    /* Maintained transition for a high-quality flip */
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Profile Image (UserImg) - Border changed to a soft pink --- */

.boxMail .boxMail-container .card1 .userImg {
    position: relative;
    width: 100px;
    /* Slightly larger */
    height: 100px;
    background-color: white;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid #FFC531;
    /* Hello Kitty Pink border */
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(255, 197, 49, 0.6);
    /* Pink outer glow */
    animation: floatImage 4s ease-in-out infinite;
    z-index: 3;
}

.boxMail .boxMail-container .card1 .userImg img {
    position: absolute;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* --- Text Styling (h4, h3, new subtitle) - Colors adjusted --- */

.boxMail .boxMail-container .card1 .cover-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    transform: rotate(-2deg);
    /* Less rotation */
    z-index: 3;
    color: #f3e6c4;
    /* Light text on dark card */
}

.boxMail .boxMail-container .card1 .username {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}

.boxMail .boxMail-container .card1 .cover-title {
    font-family: 'Dancing Script', cursive;
    font-size: 60px;
    /* Bigger and more festive */
    text-transform: capitalize;
    width: 100%;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 4px;
    margin: 0;
    /* Hello Kitty style text glow: Hot Pink with White highlight */
    color: #FFC531;
    text-shadow: 0 0 8px rgba(255, 197, 49, 0.8),
        0 0 15px rgba(255, 255, 255, 0.7);
    animation: pulseGlowHelloKitty 3s infinite alternate;
    /* Using NEW keyframe name */
}

.boxMail .boxMail-container .card1 .cover-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    margin-top: 12px;
    opacity: 0.9;
    color: #cbbf9f;
}

/* --- New Decoration Sparkle Background (Adjusted Opacity and Angle) --- */

.boxMail .boxMail-container .card1 .card1-decoration-sparkle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    /* More subtle */
    z-index: 0;
    background: repeating-linear-gradient(45deg,
            /* Changed angle */
            rgba(255, 255, 255, 0.15),
            rgba(255, 255, 255, 0.15) 8px,
            transparent 8px,
            transparent 16px);
    animation: shimmer 15s linear infinite;
}

/* --- SVG Decoration Styles (Colors adjusted) --- */

.boxMail .boxMail-container .card1 .deco-shape {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 1;
    opacity: 0.8;
    transition: all 0.5s;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.2));
}

.boxMail .boxMail-container .card1 .deco-shape.top-right-star {
    top: 20px;
    right: 20px;
    animation: slowSpin 15s linear infinite;
}

.boxMail .boxMail-container .card1 .deco-shape.top-right-star polygon {
    fill: rgba(255, 255, 255, 0.7);
    /* Whiter star */
}

.boxMail .boxMail-container .card1 .deco-shape.bottom-left-ring {
    bottom: 30px;
    left: 20px;
    animation: rotateOscillate 10s ease-in-out infinite alternate;
}

.boxMail .boxMail-container .card1 .deco-shape.bottom-left-ring circle:first-child {
    stroke: rgba(255, 255, 255, 0.8);
    /* Whiter ring outline */
}

.boxMail .boxMail-container .card1 .deco-shape.bottom-left-ring circle:last-child {
    fill: rgba(255, 197, 49, 0.25);
    /* Light pink inner circle */
}

/* Hover effect: make the decorations slightly fade when the book is open/hovered */
.boxMail .boxMail-container:hover .card1 .deco-shape {
    opacity: 0.5;
}

/* --- Keyframes (Updated for Hello Kitty) --- */

/* 1. Subtle Floating Image (No Change) */
@keyframes floatImage {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0);
    }
}

/* 2. Text Glow Pulse (NEW HELLO KITTY GLOW) */
@keyframes pulseGlowHelloKitty {
    0% {
        text-shadow: 0 0 5px #FFC531, 0 0 10px #FFC531, 0 0 15px #FFC531;
    }

    100% {
        text-shadow: 0 0 10px #FFC531, 0 0 20px #FFC531, 0 0 30px #FFC531;
    }
}

/* 3. Background Shimmer (No Change) */
@keyframes shimmer {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 100% 100%;
    }
}

/* 4. Slow Spin (for the Star) (No Change) */
@keyframes slowSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 5. Rotate Oscillate (for the Ring) (No Change) */
@keyframes rotateOscillate {
    0% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }

    100% {
        transform: rotate(-5deg);
    }
}

/* Adding the new Keyframes needed for Hello Kitty images/patterns if you use them */
@keyframes bounceKitty {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-10px) scale(1.02);
    }
}

@keyframes patternShift {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 100px 100px;
    }
}

/* --- Card 2: The Outer Page Wrapper (Clean background/page texture) --- */
.boxMail .boxMail-container .card2 {
    position: relative;
    width: 50%;
    height: 100%;
    /* Switched to a soft off-white for a premium paper look */
    background-color: #1d1829;
    transform-style: preserve-3d;
    transform-origin: left;
    transition: all 1s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smoother transition */
    box-shadow: inset 5px 0 15px rgba(0, 0, 0, 0.08);
    /* Subtle shadow near the spine */
}

/* --- The Inner Pink Box (The lifted note/content) --- */
.boxMail .boxMail-container .card2 .card2-content {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(160deg, #35294a 0%, #1c1629 100%);
    border: 1px solid rgba(255, 197, 49, 0.35);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    /* High-quality ease-out */
    overflow: hidden;
    font-family: "Inter", sans-serif;
    color: #fff;
    border-radius: 10px;
    /* Rounded corners for the "floating" element */
    padding: 25px;
    /* Generous internal padding */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Hover effect on the inner Pink Box to float it */
.boxMail .boxMail-container:hover .card2-content {
    /* Slightly less movement but higher shadow lift */
    transform: translate(12px, 12px);
    /* Deep, soft shadow for a clear floating effect */
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.4),
        -2px -2px 8px rgba(255, 255, 255, 0.1);
}

/* --- H3: The small heading (e.g., "To You!") --- */
.boxMail .boxMail-container .card2 h3 {
    font-family: 'Dancing Script', cursive;
    /* Cleaned up the confusing padding: centered and top/bottom space */
    padding: 0 0 10px 0;
    text-align: center;
    font-size: 34px;
    /* Big, friendly heading */
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    /* Added a dotted line for separation */
    border-bottom: 3px dashed rgba(255, 255, 255, 0.5);
}

/* --- H2: The main message content --- */
.boxMail .boxMail-container .card2 .card2-message-text {
    font-family: "Sriracha", "cursive";
    padding: 10px 0;
    font-size: 20px;
    line-height: 1.6;
    flex-grow: 1;
    overflow-y: auto;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}

.boxMail .boxMail-container .card2 .signature {
    font-family: 'Dancing Script', cursive;
    font-size: 26px;
    font-weight: bold;
    color: #fff;
    margin-top: 15px;
    text-align: right;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* New: Scrollbar for the message (for when it overflows) */
.boxMail .boxMail-container .card2 .card2-message-text::-webkit-scrollbar {
    width: 6px;
}

.boxMail .boxMail-container .card2 .card2-message-text::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

/* New: Decoration Element (optional subtle texture) */
.boxMail .boxMail-container .card2 .card2-content .card2-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.1) 1%, transparent 5%),
        radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.1) 1%, transparent 5%);
    pointer-events: none;
    opacity: 0.8;
}

/* --- New Decoration Styles --- */

/* Corner Ribbon Effect */
.boxMail .boxMail-container .card2 .card2-content .corner-ribbon {
    position: absolute;
    width: 0;
    height: 0;
    border: 20px solid transparent;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
}

.boxMail .boxMail-container .card2 .card2-content .corner-ribbon.top-left {
    top: 0;
    left: 0;
    border-top-color: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(255, 255, 255, 0.7);
    border-bottom-color: transparent;
    border-right-color: transparent;
}

.boxMail .boxMail-container .card2 .card2-content .corner-ribbon.bottom-right {
    bottom: 0;
    right: 0;
    /* Creates a pink triangle ribbon in the opposite corner */
    border-bottom-color: rgba(10, 10, 10, 0.2);
    border-right-color: rgba(10, 10, 10, 0.2);
    border-top-color: transparent;
    border-left-color: transparent;
}

/* Subtle Confetti Dots Background Layer */
.boxMail .boxMail-container .card2 .card2-content .confetti-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.2;
    background:
        radial-gradient(circle at 10% 20%, #fff 2px, transparent 0),
        radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.8) 2px, transparent 0),
        radial-gradient(circle at 50% 90%, #FFC531 1px, transparent 0),
        radial-gradient(circle at 30% 60%, #fff 1px, transparent 0),
        radial-gradient(circle at 70% 10%, #FFC531 2px, transparent 0);
    background-size: 50px 50px;
    transform: rotate(1deg);
}





@media screen and (max-width: 658px) {
    .boxMail .boxMail-container {
        position: absolute;
        width: 650px;
        height: 500px;
        display: flex;
        margin: 0;
        transform: scale(0.9);
        -webkit-perspective: 2000px;
        perspective: 2000px;
    }

    .boxMail .boxMail-container:hover {
        transform: rotate(-5deg);
        filter: drop-shadow(0 0 10px #FFC531);
    }

    .boxMail .boxMail-container:hover .card1 {
        transform: translate(-160px, -250px) rotateY(-140deg);
    }

    .boxMail .boxMail-container .card2 h3 {
        font-family: 'Dancing Script', cursive;
        font-size: 28px;
        margin-bottom: 15px;
    }

    .boxMail .boxMail-container .card2 .card2-message-text {
        font-family: "Sriracha", "cursive";
        padding: 10px 0;
        font-size: 16px;
        line-height: 1.6;
        flex-grow: 1;
        overflow-y: auto;
        text-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
    }

    .boxMail .boxMail-container .card2 .signature {
        font-size: 20px;
    }

}

/* ===== Tema gelap: teks kartu & sunflower ===== */
.boxMail .boxMail-container .card2 h3 {
    color: #FFC531;
    border-bottom-color: rgba(255, 197, 49, 0.5);
}

.boxMail .boxMail-container .card2 .card2-message-text {
    color: #fbf3dc;
}

.boxMail .boxMail-container .card2 .signature {
    color: #FFD866;
}

.boxMail .boxMail-container .card1 .card-sf {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 66px;
    height: 66px;
    z-index: 1;
}

.boxMail .boxMail-container .card2 .card-sf--msg {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 46px;
    height: 46px;
    z-index: 1;
    pointer-events: none;
}

/* ===== Pesan lebih panjang: kecilkan sedikit supaya muat tanpa scroll ===== */
.boxMail .boxMail-container .card2 .card2-content {
    padding: 20px 22px;
}

.boxMail .boxMail-container .card2 .card2-message-text {
    font-size: 14px;
    line-height: 1.45;
    padding: 6px 0;
}

.boxMail .boxMail-container .card2 .card2-message-text article {
    margin-bottom: 7px !important;
}

.boxMail .boxMail-container .card2 .signature {
    font-size: 24px;
    margin-top: 8px;
}

@media screen and (max-width: 658px) {
    .boxMail .boxMail-container .card2 .card2-message-text {
        font-size: 12.5px;
        line-height: 1.4;
    }

    .boxMail .boxMail-container .card2 .card2-message-text article {
        margin-bottom: 5px !important;
    }

    .boxMail .boxMail-container .card2 h3 {
        font-size: 26px;
        margin-bottom: 8px;
    }

    .boxMail .boxMail-container .card2 .signature {
        font-size: 20px;
    }
}


/* ===== Petunjuk "Tap untuk buka" di cover + buka lewat tap (layar sentuh) ===== */
.boxMail .boxMail-container .card1 .tap-hint {
    position: absolute;
    bottom: 22px;
    left: 50%;
    z-index: 5;
    padding: 6px 18px;
    border-radius: 999px;
    background: #FFC531;
    color: #2b1a05;
    font-family: "Sriracha", cursive;
    font-size: 15px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 0 16px rgba(255, 197, 49, 0.55);
    transform: translateX(-50%);
    animation: tapPulse 1.6s ease-in-out infinite;
    transition: opacity 0.3s;
}

@keyframes tapPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.08); }
}

.boxMail .boxMail-container:hover .card1 .tap-hint,
.boxMail .boxMail-container.is-open .card1 .tap-hint {
    opacity: 0;
}

.boxMail .boxMail-container.is-open {
    transform: rotate(-5deg);
    filter: drop-shadow(0 0 10px #FFC531);
}

.boxMail .boxMail-container.is-open .card1 {
    transform: translate(-187px, -250px) rotateY(-140deg);
}

.boxMail .boxMail-container.is-open .card1 .deco-shape {
    opacity: 0.5;
}

.boxMail .boxMail-container.is-open .card2-content {
    transform: translate(12px, 12px);
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.4), -2px -2px 8px rgba(255, 255, 255, 0.1);
}

@media screen and (max-width: 658px) {
    .boxMail .boxMail-container.is-open .card1 {
        transform: translate(-160px, -250px) rotateY(-140deg);
    }
}
