*{
    box-sizing:border-box;
}


body{

    margin:0;

    width:100%;

    height:100vh;

    display:flex;

    align-items:center;

    justify-content:center;

    overflow:hidden;

    font-family:Arial,sans-serif;

    color:#fff;

    background:radial-gradient(circle,#8b0000,#180000);

}





.game{

    text-align:center;

}







/* =====================
   GRID HỘP QUÀ
===================== */


.grid{

    display:grid;

    grid-template-columns:repeat(4,120px);

    gap:20px;

    justify-content:center;

    perspective:1200px;

}



.box{

    width:120px;

    height:120px;

    position:relative;

    cursor:pointer;

    transform-style:preserve-3d;

    transition:.7s;

}



.box.open{

    transform:rotateY(180deg);

}



.face{

    position:absolute;

    inset:0;

    display:flex;

    justify-content:center;

    align-items:center;

    border-radius:15px;

    backface-visibility:hidden;

}



.front img{

    width:100%;

    height:100%;

    object-fit:contain;

}




.back{

    transform:rotateY(180deg);

    background:#111;

    display:flex;

    flex-direction:column;

    justify-content:center;

    align-items:center;

    color:#ffd700;

    font-size:16px;

    font-weight:bold;

}



.back img{

    width:90%;

    height:90%;

    object-fit:contain;

    filter:drop-shadow(0 0 8px gold);

}







/* =====================
   POPUP THƯỞNG
===================== */


.reward-popup{

    position:fixed;

    inset:0;

    display:none;

    align-items:center;

    justify-content:center;

    background:rgba(0,0,0,.75);

    z-index:1000;

}



.popup-card{

    width:640px;

    height:360px;

    position:relative;

    overflow:hidden;

    animation:popupZoom .5s ease;

}



.popup-bg{

    position:absolute;

    inset:0;

    width:100%;

    height:100%;

    object-fit:contain;

    z-index:1;

}



.reward-content{

    position:absolute;

    inset:0;

    display:flex;

    flex-direction:column;

    justify-content:center;

    align-items:center;

    z-index:2;

}



.reward-title{

    font-size:34px;

    font-weight:900;

    color:#c90000;

    text-shadow:0 3px 8px #ffd700;

    margin-bottom:20px;

}



#rewardText{

    font-size:40px;

    font-weight:900;

    color:#ff9900;

    text-shadow:0 0 15px gold;

}




@keyframes popupZoom{

    from{

        transform:scale(.3);

        opacity:0;

    }


    to{

        transform:scale(1);

        opacity:1;

    }

}







/* =====================
   FIREWORK
===================== */


.firework{

    position:fixed;

    inset:0;

    display:none;

    background:url("../images/fireworks.gif") center/cover no-repeat;

    pointer-events:none;

    z-index:1100;

}







/* =====================
   BOOM
===================== */


.boom-effect{

    position:fixed;

    inset:0;

    display:none;

    justify-content:center;

    align-items:center;

    background:rgba(255,0,0,.35);

    z-index:2000;

    animation:flash .15s infinite;

}



.boom-effect img{

    width:500px;

    height:500px;

    object-fit:contain;

    animation:boomScale .8s ease-out;

}




@keyframes boomScale{

    0%{

        transform:scale(.1);

        opacity:0;

    }


    40%{

        transform:scale(1.3);

        opacity:1;

    }


    100%{

        transform:scale(1);

        opacity:0;

    }

}



@keyframes flash{

    0%{

        background:rgba(255,255,255,.8);

    }


    100%{

        background:rgba(255,0,0,.2);

    }

}



.screen-shake{

    animation:shakeScreen .4s;

}




@keyframes shakeScreen{

    0%{transform:translate(0)}

    20%{transform:translate(-15px,5px)}

    40%{transform:translate(15px,-5px)}

    60%{transform:translate(-10px,5px)}

    80%{transform:translate(10px,-5px)}

    100%{transform:translate(0)}

}







/* =====================
   BANNER
===================== */


.banner-slider{

    width:900px;

    height:90px;

    overflow:hidden;

    margin:5px auto 15px;

}



.banner-track{

    display:flex;

    gap:12px;

    width:max-content;

    animation:slideBanner 30s linear infinite;

}



.banner-item{

    width:170px;

    height:85px;

    flex:none;

}



.banner-item img{

    width:100%;

    height:100%;

    object-fit:contain;

    border-radius:10px;

}



@keyframes slideBanner{

    from{

        transform:translateX(0);

    }


    to{

        transform:translateX(-1820px);

    }

}







/* =====================
   TITLE
===================== */


.game-title{

    width:1200px;

    height:180px;

    margin:-40px auto -25px;

    display:flex;

    justify-content:center;

    align-items:center;

}



.game-title img{

    width:100%;

    height:100%;

    object-fit:contain;

}







/* =====================
   BUTTON
===================== */


.game-buttons{

    display:flex;

    justify-content:center;

    gap:20px;

    margin-top:25px;

}



button{

    padding:12px 30px;

    border:0;

    border-radius:10px;

    background:#ffd700;

    color:#700000;

    font-weight:bold;

    cursor:pointer;

}



button:hover{

    transform:scale(1.05);

}







/* =====================
   CÀI ĐẶT GAME
===================== */


.setting-panel{

    position:fixed;

    top:50%;

    left:50%;

    transform:translate(-50%,-50%);

    width:650px;

    max-height:90vh;

    overflow-y:auto;

    padding:25px;

    background:#250000;

    border:2px solid gold;

    border-radius:20px;

    display:none;

    z-index:9999;

}



.setting-panel h2{

    text-align:center;

    color:#ffd700;

}



.setting-panel label{

    display:block;

    margin-top:12px;

    color:#ffd700;

    font-weight:bold;

}



.setting-panel input,
.setting-panel select,
.setting-panel textarea{

    width:100%;

    padding:10px;

    margin-top:8px;

    border-radius:8px;

    border:none;

}



.setting-panel textarea{

    height:90px;

}







/* =====================
   DANH SÁCH Ô THƯỞNG
===================== */


#rewardSettingList{

    max-height:450px;

    overflow-y:auto;

    margin-top:15px;

}




.reward-setting-item{

    background:#300000;

    border:1px solid #ffd700;

    border-radius:10px;

    padding:12px;

    margin-bottom:10px;

}



.reward-setting-item h3{

    color:#ffd700;

    margin:0 0 8px;

}



.reward-row{

    display:flex;

    gap:10px;

}



.reward-row select{

    width:45%;

}



.reward-row input{

    width:55%;

}





.setting-buttons{

    display:flex;

    justify-content:center;

    gap:15px;

    margin-top:15px;

}







/* MOBILE */

@media(max-width:600px){


.grid{

    grid-template-columns:repeat(4,80px);

    gap:10px;

}


.box{

    width:80px;

    height:80px;

}



.popup-card{

    width:95%;

    height:auto;

    aspect-ratio:16/9;

}


.setting-panel{

    width:95%;

}


}