@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Pacifico&display=swap');

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

body{
    background-color: #0d0015;
    color: white;
    overflow: hidden;
    font-family: 'Dancing Script', cursive;
}

#particles-js{
    position: absolute;
    width:100%;
    height:100%;
    z-index:0;
}

.container{
    position: relative;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    perspective: 3000px;
}

#start-btn{
    padding: 15px 30px;
    font-size: 24px;
    font-family: 'Dancing Script', cursive;
    background: linear-gradient(45deg,#ff4e50,#f9d423);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255,78,80,0.5);
    transition: 0.3s;
    z-index: 10;
}

#start-btn:hover{
    transform:scale(1.1);
    box-shadow:0 0 30px rgba(255,78,80,0.8);
}

.text-step{
    position:absolute;
    font-size:5rem;
    opacity:0;
    text-shadow:0 0 20px #ff69b4,0 0 30px #ff1493;
    transition:opacity 1.5s ease-in-out, transform 1.5s ease-in-out;
    transform:scale(0.5);
    display:none;
}

.text-step.active{
    opacity:1;
    transform:scale(1);
    display:block;
}

.gallery{
    position:absolute;
    width:80%;
    height:80%;
    display:none;
    flex-wrap:wrap;
    justify-content:center;
    align-items:center;
    gap:15px;
    opacity:0;
    pointer-events:none;
    transition:2s;
}

.gallery.active{
    opacity:1;
    display:flex;
    pointer-events: auto;
}

.gallery img{
    width:150px;
    height:150px;
    object-fit:cover;
    border-radius:15px;
    box-shadow:0 0 15px rgba(255,255,255,0.5);
    animation:float 3s infinite ease-in-out alternate;
}

.gallery img:nth-child(even){
    animation-delay:1s;
}

.card-container{
    position:absolute;
    width:600px;
    max-width:90%;
    background:rgba(255,240,245,0.9);
    padding:40px;
    border-radius:20px;
    box-shadow:0 0 30px rgba(255,105,180,0.6);
    color:#ff1493;
    opacity:0;
    transform:translateY(50px);
    transition:2s;
    display:none;
}

.card-container.active{
    opacity:1;
    transform:translateY(0);
    display:block;
    z-index:20;
}

.card-container h1{
    font-size:3rem;
    margin-bottom:20px;
    font-family:'Pacifico', cursive;
}

.card-container p{
    font-size:1.8rem;
    line-height:1.5;
    font-family:'Dancing Script', cursive;
}

.card-container .card-img{
    width:100%;
    border-radius:10px;
    margin-top:20px;
}

@keyframes float{
    0%{transform:translateY(0) rotate(0deg);}
    100%{transform:translateY(-20px) rotate(5deg);}
}

/* ✅ SPHERE CONTAINER - CANH GIỮ GIỮA MÀN HÌNH */
.sphere-container{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:700px;
    height:700px;
    border-radius:50%;
    overflow:hidden; /* QUAN TRỌNG */
    display:none;
    perspective:1500px;
    z-index:15;
    box-shadow:
        0 0 80px rgba(255,105,180,0.6),
        inset 0 0 60px rgba(255,255,255,0.2);
}

.sphere{
    position:relative;
    width:100%;
    height:100%;
    transform-style:preserve-3d;
    transform: translateZ(-400px);
    cursor:pointer;
}

.sphere img{
    position: absolute;
    width: 150px; /* Độ rộng ảnh */
    height: 110px; /* Chiều cao ảnh */
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    top: 50%;
    left: 50%;
    margin-top: -55px; 
    margin-left: -75px;
    /* Hiệu ứng chuyển cảnh mượt mà */
    transition: all 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    backface-visibility: visible;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.sphere::before, .sphere::after{
    content:"";
    position:absolute;
    width:100%;
    height:120px;
    left:0;
    pointer-events:none;
}
.sphere::before{
    top:-60px;
    background:radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.8) 100%);
}
.sphere::after{
    bottom:-60px;
    background:radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.8) 100%);
}

/* ✅ SPHERE AUTO ROTATION - XOAY VÔ TẬN */
.sphere.auto-rotate{
    animation: spin 25s linear infinite;
}

@keyframes spin{
    from{transform: translateZ(-500px) rotateX(-10deg) rotateY(0deg);}
    to{transform: translateZ(-500px) rotateX(-10deg) rotateY(360deg);}
}

/* ✅ CLICK 1: CIRCLE FORMATION */
.sphere.circle img {
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ✅ CLICK 2: INWARD ANIMATION */
.sphere.inward img {
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Music Button */
.music-btn{
    position:fixed;
    top:20px;
    right:20px;
    width:50px;
    height:50px;
    border-radius:50%;
    background:rgba(255,255,255,0.1);
    border:2px solid #ff69b4;
    color:#ff69b4;
    cursor:pointer;
    z-index:100;
    font-size:1.2rem;
    transition:0.3s;
}

.music-btn:hover{
    background:#ff69b4;
    color:white;
    box-shadow:0 0 20px #ff69b4;
}

/* Fireworks & Hearts */
@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes floatUp {
    to {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sphere-container{
        overflow:visible;
        position:absolute;
        top:50%;
        left:50%;
        width:0;
        height:0;
        display:none;
        perspective:1500px;
        z-index:15;
    }
    
    .sphere-mask{
        position:absolute;
        top:50%;
        left:50%;
        transform:translate(-50%,-50%);
        width:700px;
        height:700px;
        border-radius:50%;
        overflow:hidden;
    }

    .sphere img{
        position: absolute;
        width: 100px;
        height: 120px;
        object-fit: cover;
        border-radius: 5px;
        top: -60px;
        left: -50px;
        /* Hiệu ứng đổ bóng và làm mềm cạnh */
        box-shadow: 0 0 10px rgba(255, 105, 180, 0.3);
        backface-visibility: hidden;
            /*width:80px;
            height:80px;
            top: -40px;
            left: -40px;*/
    }
    
    .card-container{
        width:90%;
        padding:20px;
    }
    
    .card-container h1{font-size:2rem;}
    
    .card-container p{font-size:1.2rem;}
    
    .text-step{font-size:3rem;}
    
    #start-btn{
        padding:10px 20px;
        font-size:18px;
    }
}
/* ================= CSS MỚI CHO HIỆU ỨNG VIDEO ================= */

/* Ẩn phần tử */
.hidden { display: none !important; }

/* 1. Phong thư bay từ dưới lên */
.envelope-wrapper {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
}
.envelope-wrapper.fly-in {
    animation: flyEnvelope 2.5s ease-out forwards;
}
@keyframes flyEnvelope {
    0% { transform: translate(-50%, 100vh) scale(0.2); opacity: 0; }
    40% { transform: translate(-50%, -60%) scale(1.2); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; filter: brightness(1.2); }
    100% { transform: translate(-50%, -50%) scale(0); opacity: 0; } /* Tự thu nhỏ biến mất */
}

/* 2. Giấy cuộn mở ra */
.scroll-paper {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    max-width: 90%;
    background: linear-gradient(135deg, #fff0f5, #ffe4e1);
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(255,105,180,0.8);
    color: #ff1493;
    z-index: 60;
    /* Bắt đầu với chiều cao 0 để tạo hiệu ứng cuộn */
    height: 0; 
    overflow-y: auto;
    overflow: hidden;
    transition: height 1.5s ease-in-out, padding 1.5s ease-in-out;
    padding: 0 30px; 
    display: flex;
    flex-direction: column;
    overflow-y: auto;       /* Nếu chữ quá dài thì hiện thanh cuộn */
    height: auto;           /* Cho phép khung nở theo nội dung */
    min-height: 200px;
    padding: 30px;
}
.scroll-paper.open {
    height: auto; 
    max-height: 90vh;
}
.paper-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-family: 'Pacifico', cursive;
    text-align: center;
}
.typed-text {
    font-size: 1.6rem;
    line-height: 1.6;
    font-family: 'Dancing Script', cursive;
    min-height: 100px;
}
.final-img {
    display: block;
    width: 100%;       /* Chiều rộng bằng khung thiệp */
    max-height: 300px; /* Giới hạn chiều cao để không đẩy thiệp quá dài */
    object-fit: contain; /* Giữ cho ảnh không bị móp méo */
    margin-top: 20px;    /* Khoảng cách giữa chữ và ảnh */
    border-radius: 10px;
    border: 5px solid white; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 1s ease-in;
}
.final-img.show {
    opacity: 1;
}