*{margin:0;padding:0;box-sizing:border-box;}
html, body {
    height: auto;
    min-height: 100%;
}
body{
    font-family:'Segoe UI',sans-serif;
    background:url('bg.png') no-repeat center center;
    background-size:cover;
    background-attachment: scroll; /* QUAN TRỌNG */
    min-height:100vh;
    overflow-x:hidden;
    color:#fff;
}


canvas{
    position:fixed;
    inset:0;
    width:100%;
    height:100%;
    pointer-events:none;
    z-index:0;
}


#maiCanvas{
    pointer-events:none;
    z-index:1;
}

.container{
    position:relative;
    z-index:2;
    text-align:center;
    padding: 80px 15px 120px 15px;
}

.logo img{
    max-width:160px;
    margin-bottom:20px;
}

h1{
    font-size:40px;
    margin-bottom:30px;
    text-shadow:0 0 15px gold;
}

button{
    padding:15px 35px;
    font-size:20px;
    background:linear-gradient(45deg,gold,orange);
    border:none;
    border-radius:40px;
    cursor:pointer;
    font-weight:bold;
}

#fortuneBox{
    margin-top:30px;
}

.hidden{display:none;}

.tube3d{
    font-size:60px;
    animation:rotate3d 1s linear infinite;
}

@keyframes rotate3d{
    from{transform:rotateY(0deg);}
    to{transform:rotateY(360deg);}
}

.fade{
    animation:fadeIn 1s ease forwards;
}

@keyframes fadeIn{
    from{opacity:0;transform:translateY(20px);}
    to{opacity:1;transform:translateY(0);}
}

.fortune-number{
    font-size:28px;
    margin-bottom:10px;
    color:gold;
}

.interpret{
    font-style:italic;
    margin-top:10px;
    color:#ffd700;
}
#tubeWrapper {
    perspective: 1000px;
    margin: 20px auto;
    width: 120px;
    height: 200px;
    position: relative;
}

#fortuneTube {
    width: 100%;
    height: 100%;
    background: linear-gradient(#8b0000, #b22222);
    border-radius: 60px;
    transform-style: preserve-3d;
    transition: transform 0.3s;
}

.shaking {
    animation: shakeTube 0.1s infinite;
}

@keyframes shakeTube {
    0% { transform: rotateZ(-5deg) rotateY(10deg); }
    50% { transform: rotateZ(5deg) rotateY(-10deg); }
    100% { transform: rotateZ(-5deg) rotateY(10deg); }
}

.fortune-stick {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    opacity: 0;
}

.fortune-stick.drop {
    animation: dropStick 1s forwards;
}

@keyframes dropStick {
    0% { top: 0; opacity: 1; }
    100% { top: 180px; opacity: 1; }
}

.fade-in {
    animation: fadeIn 1s forwards;
}
#resultBox {
    margin-top: 20px;
    padding: 15px;
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
    body {
        background-attachment: scroll;  /* Tránh lỗi lag mobile */
        background-size: cover;
        background-position: center;
		height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    }
	h1 {
        font-size: 22px;
        padding: 0 10px;
    }

    button {
        width: 90%;
        font-size: 16px;
    }

    #fortuneBox {
        width: 95%;
    }

}