.video {
    height: 100vh;
    width: 100vw;
    object-fit: cover;
    display: block;
    inset: 0;
    position: fixed;
    z-index: -1;
}
.container {
    background: var(--color-2);
    width: 25%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
    margin-top: 2.5%;
    border-radius: 20px;
    border: 5px solid #e96e97;
    
}
.card {
    width: 100px;
    height: 100px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 5%;
    border: 4px dashed #e96e97;
    position: relative;
    border-radius: 20px;
    padding: 5px;

}
.icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    display: block;
}
#chu {
    text-align: center;
    color: var(--color-text);
    font-size: 30px;
    font-weight: bold;
    margin-bottom: -13px;
    
}
p {
    text-align: center;
    color: var(--color-text);
    font-size: 18px;
    margin-bottom: 15px;
}
#box {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}
.box {
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    border: 4.5px solid #e96e97;
    border-radius: 10px;
    background: var(--color-2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
}
#pass {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    gap: 12px 18px;
    justify-content: center;
    
}
#pass .button {
    width: 50px;
    height: 50px;
    background: white;
    border: 3px solid #e96e97;
    border-radius: 50%;
    text-align: center;
    line-height: 50px;
    font-size: 30px;
    color: var(--color-text);
    box-shadow: 0 6px 0 #f8bbd0, inset 0 0 0 1px;
    transition: transform .08s, box-shadow .08s;
}

    

    
#pass .button:active {
    transform: translateY(6px);
    box-shadow: none;
    
}
#unlock {
    background: #C2185B;
    color: white;
    width: 125px;
    height: 40px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    margin: 20px auto;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 6px 0 #8e0e45;
}
#unlock:active {
    transform: translateY(6px);
    box-shadow: none;
}
#tb {
    color: var(--color-text);
    text-align: center;
    font-size: 18px;
    margin-top: -10px;
    margin-bottom: 10px;


}
.shake {
    animation: shake 0.5s;
}
.hidden {
    display: none !important;
}

@media (width <= 768px) {
    .container
    {
        width: 89%;
        height: 97vh;
    }
    
}
/* MAIN */
.flame { 
    opacity: 0; animation: light 0.3s forwards; 
    filter: drop-shadow(0 0 4px #fff176) drop-shadow(0 0 8px #ffb830);
}
@keyframes light { to { opacity: 1; } }
#cake {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    width: var(--cake);
    filter: drop-shadow(0 8px 12px rgba(194, 24, 91, 0.35));
    position: relative;
}
.fox {
    position: absolute;
    bottom: 2vh;
    height: calc(var(--cake) * 0.7);
    right: calc(50% + var(--cake) / 2 - 10px);
    transform-origin: 50% 100%;
    animation: fox-sway 3s ease-in-out infinite;            
                
}
@keyframes fox-sway {
    0%, 100% {transform: rotate(-4deg);}
    50%      {transform: rotate(4deg);}
}
.whale {
    position: absolute;
    bottom: 2vh;
    height: calc(var(--cake) * 0.6);
    left: calc(50% + var(--cake) / 2 - 10px);
    transform-origin: 50% 100%;
    animation: whale-sway 3s ease-in-out infinite;
}
@keyframes whale-sway {
    0%, 100% {transform: rotate(-4deg);}
    50%      {transform: rotate(4deg);}
}


.say {
    position: absolute;
    max-width: 180px;
    padding: 10px 16px;
    background: #fff;
    color: #d9609a;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    border-radius: 18px;
    box-shadow: 0 6px 14px rgba(194, 24, 91, .2);
    animation: say-pop 3s ease-in-out infinite;
}
.say::after {
    content: "";
    position: absolute;
    bottom: -10px;
    border: 10px solid transparent;
    border-top-color: #fff;
    border-bottom: 0;
}
.say-fox {
    right: calc(50% + var(--cake) / 2 + 10px);
    bottom: calc(2vh + var(--cake) * 0.75);
}
.say-fox::after { right: 24px; }
.say-whale {
    left: calc(50% + var(--cake) / 2 + 30px);
    bottom: calc(2vh + var(--cake) * 0.6);
}
.say-whale::after { left: 24px; }
@keyframes say-pop {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}




#hpbd {
    display: flex;
    justify-content: center;
    gap: 5px;
    position: relative;
    width: fit-content;
    margin: 0 auto 20px;
    padding: 0 40px 40px;

}

#hpbd::before {
    content: "";
    position: absolute;
    left: 40px; right: 40px; top: 0;
    height: 40px;
    border-bottom: 3px solid #cfcfcf;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;

}
#hpbd .flag {
    width: 70px;
    height: 100px;
    background: #f27f93;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    text-align: center;
    padding-top: 12px;
    box-sizing: border-box;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
    transform: translateY(calc(40px * sqrt(1 - var(--t) * var(--t))));
}


#banner {
    position: absolute !important;
    top: 0;
    left: 50%;
    transform: translate(-50%);
    width: 450px;
    max-width: 100%;
}


.deco {
    position: absolute;
    bottom: 3%;
    width: 260px;
    height: 520px;
}
.deco-left  { 
    left: 2%; 
}
.deco-right { 
    right: 2%; 
    transform: scaleX(-1); 
}

/* Dây */
.strings { position: absolute;
    inset: 0; 
    z-index: 0; 
}
.strings path { 
    stroke: rgba(255,255,255,.85); 
    stroke-width: 2; fill: white; 
}

/* Bóng bay */
.balloon {
    position: absolute;
    border-radius: 50% 50% 50% 50% / 58% 58% 42% 42%;
    top: 4%;
} 
.balloon::before { 
    content: "";
    position: absolute;
    top: 12%; left: 20%;
    width: 18%; height: 22%;
    border-radius: 50%;
    background: rgba(255,255,255,.45);
}
.balloon::after { 
    content: "";
    position: absolute;
    left: 50%; bottom: -7px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom: 9px solid currentColor;
}
.b-top   { left: 60px;  top: 0;   width: 130px; height: 160px; z-index: 1;color: #ffc2da; background: radial-gradient(circle at 35% 30%, #ffe0ec, #ffc2da); }
.b-left  { left: 0;     top: 75px; width: 110px; height: 135px; z-index: 2;color: #ff9fc2; background: radial-gradient(circle at 35% 30%, #ffc0d8, #ff9fc2); }
.b-right { left: 150px; top: 65px; width: 105px; height: 130px; z-index: 2;color: #ffb0cd; background: radial-gradient(circle at 35% 30%, #ffd0e2, #ffb0cd); }
.b-front { left: 80px;  top: 125px; width: 120px; height: 145px; z-index: 3;color: #ff7aa8; background: radial-gradient(circle at 35% 30%, #ffa3c3, #ff7aa8); }

/* Hộp quà */
.gift-big, .mini { position: absolute; }

.gift-big {
    bottom: 0; left: 45px;
    width: 170px; height: 130px;
    transform: rotate(-5deg);
    z-index: 5;
}
.mini {
    width: 54px; height: 54px;
    z-index: 4;
}
.mini-l { left: 5px;   top: 315px; transform: rotate(-20deg); }
.mini-r { left: 195px; top: 295px; transform: rotate(18deg); }

/* Hộp quà lớn  */
.g-lid {
    position: absolute;
    top: 0; left: -4%;
    width: 108%; height: 28%;
    background: #d9609a;
    border-radius: 4px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .15);
    z-index: 2;
}

/* Thân quà  */
.g-body {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 74%;
    background: #f8a5c2;
    border-radius: 0 0 4px 4px;
}

/* Ruy băng */
.g-lid::before, .g-body::before {
    content: "";
    position: absolute;
    left: 50%; top: 0;
    width: 16%; height: 100%;
    transform: translateX(-50%);
    background: #fff;
}

.gift-big { --k: 1; }
.mini     { --k: .5; }

.gift-big::before,
.mini::before {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(-48px * var(--k));
    width: calc(120px * var(--k));
    height: calc(72px * var(--k));
    transform: translateX(-50%);
    z-index: 3;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60'%3E%3Cpath d='M48 40 L34 58 L44 56 L52 44Z' fill='%23fff'/%3E%3Cpath d='M52 40 L66 58 L56 56 L48 44Z' fill='%23fff'/%3E%3Cpath d='M48 38 C34 56 4 52 4 30 C4 10 34 12 48 36Z' fill='%23fff'/%3E%3Cpath d='M52 38 C66 56 96 52 96 30 C96 10 66 12 52 36Z' fill='%23fff'/%3E%3Cpath d='M46 36 C34 46 14 44 14 31 C14 21 34 22 46 34Z' fill='%23f3c6d8'/%3E%3Cpath d='M54 36 C66 46 86 44 86 31 C86 21 66 22 54 34Z' fill='%23f3c6d8'/%3E%3Crect x='43' y='32' width='14' height='14' rx='4' fill='%23fff' stroke='%23000' stroke-opacity='.12'/%3E%3C/svg%3E")
                center / contain no-repeat;
}
.string {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
} 



#confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

h3 {
    font-family: "Mea Culpa", cursive;
    font-weight: 400;
    font-style: normal;
    font-size: 28px;
}
.letter p {
    font-family: "Mea Culpa", cursive;
    font-weight: 400;
    font-style: normal;
    font-size: 35px;
}



.letter {
    position: absolute;
    left: 50%;
    bottom: 18vh;
    width: min(340px, 80vw);
    padding: 24px;
    background: #fffdf8;
    color: #d9609a;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(194, 24, 91, .25);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 40px) scale(.6);
    transition: transform .7s cubic-bezier(.34, 1.56, .64, 1), opacity .4s;
    z-index: 20;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 24px,
        #1f161a 24px,
        #1b1517 24px,
        transparent 25px,
        transparent 32px
    );
    background-repeat: no-repeat;
    background-position: 0 24px;
    background-size: 100% calc(100% - 24px);   
    line-height: 32px;
}
.letter h3, .letter p {
    margin: 0;
}
.letter.show {
    opacity: 3;
    pointer-events: auto;
    transform: translate(-50%, -120px) scale(1);
    box-shadow:0 10px 24px rgba(194, 24, 91, .25),
                0 0 0 100vmax rgba(0, 0, 0, .5);
    background-color: rgba(255, 253, 248, .70);
    backdrop-filter: blur(2px);
    

}

.thiep {
    position: absolute;
    left: 50%;
    bottom: 1.5vh;
    width: 110px;
    height: 74px;
    background: #ffe3ef;
    border: 2px solid #f4a0b9;
    border-radius: 8px;
    box-shadow: 0 6px 14px rgba(194, 24, 91, .3);
    cursor: pointer;
    z-index: 10;
    animation: thiep-bounce 1.8s ease-in-out infinite;
}
.thiep:hover { filter: brightness(1.05); }


.thiep::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #ffd0e2;
    clip-path: polygon(0 100%, 0 25%, 50% 65%, 100% 25%, 100% 100%);
    z-index: 1;
}

.thiep::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 62%;
    background: #ffb3d1;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 2;
}

.thiep span {
    position: absolute;
    left: 50%; top: 46%;
    transform: translate(-50%, -50%);
    width: 26px; height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e0457b;
    color: #fff;
    font-size: 14px;
    z-index: 3;
}
@keyframes thiep-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-5px); }
} 
#volBtn {
    position: absolute;
    top: 15px; right: 15px;
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: rgba(255, 255, 255, .8);
    border: 3px solid #e96e97;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
} 

@media (max-width: 480px) {

    /* Dùng dvh để không bị thanh địa chỉ Safari che */
    .video { height: 100dvh; }
    #main  { min-height: 100dvh; --cake: min(72vw, 55dvh); }

    /* Màn hình khóa: căn giữa, nút to dễ bấm */
    .container {
        width: 89%;
        height: 92dvh;
        margin-top: 4dvh;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .box { width: 48px; height: 48px; }
    #pass { grid-template-columns: repeat(3, 64px); }
    #pass .button {
        width: 64px;
        height: 64px;
        line-height: 64px;
    }


    .fox   { left: 2%;  right: auto; height: calc(var(--cake) * 0.5); }
    .whale { right: 2%; left: auto;  height: calc(var(--cake) * 0.45); }

    .say { max-width: 130px; font-size: 12px; padding: 8px 12px; }
    .say-fox   { left: 2%;  right: auto; bottom: calc(2dvh + var(--cake) * 0.75); }
    .say-whale { right: 2%; left: auto;  bottom: calc(2dvh + var(--cake) * 0.75); }
    .say-fox::after   { left: 24px;  right: auto; }
    .say-whale::after { right: 24px; left: auto; }

    
    .deco { zoom: 0.35; }

    #volBtn { top: calc(15px + env(safe-area-inset-top)); }
    #banner { top: env(safe-area-inset-top); }
}


/* ===== ĐIỆN THOẠI XOAY NGANG ===== */
@media (orientation: landscape) and (max-height: 500px) {

    .video { height: 100dvh; }
    #main  { min-height: 100dvh; --cake: 40vh; }

    /* (a) Màn mật mã: chia 2 cột, bên trái là tiêu đề + ô nhập, bên phải là bàn phím */
    .container {
        width: 70%;
        max-width: 640px;
        height: 90dvh;
        margin-top: 3dvh;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "card pass"
            "chu  pass"
            "tip  pass"
            "box  pass"
            "tb   unlock";
        align-content: center;
        align-items: center;
        column-gap: 10px;
    }
    .card        { grid-area: card;   width: 70px; height: 70px; margin: 0 auto; }
    #chu         { grid-area: chu;    font-size: 22px; margin: 4px 0; }
    .container p { grid-area: tip;    font-size: 14px; margin: 4px 0; }
    #box         { grid-area: box;    margin: 6px 0; }
    #pass        { grid-area: pass;   grid-template-columns: repeat(3, 44px); gap: 8px 14px; }
    #unlock      { grid-area: unlock; margin: 8px auto; height: 36px; }
    #tb          { grid-area: tb;     font-size: 14px; margin: 0; }
    .box         { width: 36px; height: 36px; }
    #pass .button { width: 44px; height: 44px; line-height: 44px; font-size: 24px; }

    /* (b) Cờ nhỏ lại để không đè lên bánh */
    #banner { width: 220px; }

    /* (c) Bóng bay + hộp quà */
    .deco { zoom: 0.45; }

    /* (d) Lời chúc + bức thư không bị tràn khỏi màn hình thấp */
    .say { font-size: 12px; padding: 8px 12px; max-width: 150px; }
    .letter { bottom: 28vh; }
    .letter.show { transform: translate(-50%, 0) scale(1); }

    /* (e) Tránh tai thỏ khi xoay ngang */
    #volBtn { right: calc(15px + env(safe-area-inset-right)); }
    .thiep {
        bottom: auto;
        top: 68vh;
        width: 12vh;
        height: 8vh;
    }
    .thiep span {
        width: 16px;
        height: 16px;
        font-size: 9px;
        
    }
    .video {
        object-fit: contain;
        background: #ff8fa8;
        object-fit: fill;
    }
    .letter   { width: min(480px, 80vw); }
.letter p { font-size: 26px; }


.fox   { height: calc(var(--cake) * 1.0); right: calc(50% + var(--cake) / 2 + 40px); }
.whale { height: calc(var(--cake) * 0.9); left:  calc(50% + var(--cake) / 2 + 40px); }


.say-fox   { right: calc(50% + var(--cake) / 2 + 40px); bottom: calc(2vh + var(--cake) * 1.05); }
.say-whale { left:  calc(50% + var(--cake) / 2 + 60px); bottom: calc(2vh + var(--cake) * 0.95); }
}
