* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: black;
}

/* blur background when alert (winner / try again) is shown */
.blur-active .background img,
.blur-active .slot-frame-around-tiger,
.blur-active .spin,
.blur-active .playButton,
.blur-active .text,
.blur-active .logo,
.blur-active .modelphone,
.blur-active .najamodel {
    filter: blur(4px) brightness(0.7);
    transition: filter 0.2s ease-out;
}

.background {
    position: relative;
    width: 550px;
    height: 100vh;
    overflow: hidden;
}

.background img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.main-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.logo {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 100%;
    max-width: 150px;
    height: 100%;
    object-fit: cover;
}

.effect {
    position: absolute;
    top: 43%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.effect img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.text {
    position: absolute;
    top: 17%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text img {
    width: 100%;
    max-width: 450px;
    height: 100%;
    object-fit: cover;
}

.slot-frame-around-tiger {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

/* Base Grid Layout: 3x3 for 9 items */
.slot-items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 8px;
    max-width: 320px;
    width: 100%;
    z-index: 10;
}

.slot-item {
    width: 100%;
    display: block;
}

.slot-empty {
    visibility: hidden;
}

/* highlight for the active spinning item */
.active-slot {
    position: relative;
    outline: 4px solid #ffffff;
    border-radius: 14px;
    box-shadow:
        0 0 32px rgba(255, 255, 255, 0.9),
        0 0 62px rgba(255, 255, 255, 0.7),
        0 0 84px rgba(255, 255, 255, 0.5),
        0 0 100px rgba(255, 255, 255, 0.35);
    transition: box-shadow 0.15s ease-out, outline-width 0.15s ease-out;
}

.frame {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;

}

.frame-spin-run {
    position: absolute;
    top: 10%;
    left: 42%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
    overflow: hidden;
}

.frame-spin-run img {
    width: 100%;
    max-width: 220px;
    height: 100%;
    object-fit: cover;
}

.frame img {
    width: 100%;
    max-width: 450px;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.spin {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.spin img {
    width: 100%;
    max-width: 200px;
    height: auto;
    object-fit: contain;
}

.playButton {
    position: absolute;
    top: 85%;
    left: 50%;
    transform: translate(-50%, -50%);


}

.playButton img {
    width: 100%;
    max-width: 250px;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* Ensure spin wheel rotates around center and shows pointer */
.spin img {
    transform-origin: 50% 50%;
    cursor: pointer;
    pointer-events: auto;
}

.modelphone {
    position: absolute;
    top: 84%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modelphone img {
    width: 100%;
    max-width: 550px;
    height: 100%;
    object-fit: cover;
}

.najamodel {
    position: absolute;
    top: 85%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;

}

.najamodel img {
    width: 100%;
    max-width: 300px;
    height: 100%;
    object-fit: cover;
}

.popout {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}



.popout-content {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.popout-text {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popout-text img {
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: contain;
}
.popout-button {
    position: absolute;
    margin-top: 5%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 30px;
    z-index: 99999;
}
.popout-button img {
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: cover;
}

.popout-tryagain {
    /* Centering the popout screen reliably */
    position: absolute;
    top: 50%; /* Changed from 40% for better centering */
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 100%; /* Changed from 70% to full width for overlay */
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
}


.popout-content-tryagain {
    /* Position relative to the popout-tryagain container */
    position: absolute;
    top: 50%; /* Centered vertically */
    left: 50%; /* Centered horizontally */
    transform: translate(-50%, -50%);
    width: 70%;
}

.popout-content-tryagain img {
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: cover;
}

.texttry {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Responsive Breakpoints --- */

@media (max-width: 768px) {

    .logo img {
        max-width: 160px;
    }

    .text img {
        max-width: 380px;
    }

    .frame {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }


    .spin {
        top: 50%;
    }

    .spin img {
        max-width: 340px;
    }

    .effect {
        top: 48%;
    }

    .effect img {
        max-width: 40px;
    }

    .modelphone {
        top: 79%;
    }

    .modelphone img {
        max-width: 500px;
    }

    .popout-text img {
        max-width: 400px;
    }

    .popout-button {
        margin-top: 20%;
    }

    .popout-button img {
        width: 100%;
        max-width: 200px;
        height: auto;
        object-fit: cover;
        border-radius: 35px;
    }
}


@media(max-width:440px) {
    .text {
        top: 15%;
        width: 70%;
    }

    .frame {
        position: absolute;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    .spin {
        top: 45%;
    }

    .spin img {
        max-width: 300px;
    }

    .effect {
        top: 43%;
    }

    .effect img {
        max-width: 40px;
    }
    
    
    .popout-text img {
        width: 100%;
        max-width:350px;
        height: auto;
        object-fit: contain;
    }
    
    .popout-tryagain {
        position: absolute;
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%; /* Ensure it covers the screen */
        height: 100vh;
        display: none;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        overflow: hidden;
        cursor: pointer;
    }

    .popout-content-tryagain {
        position: absolute;
        top: 50%; /* Centered content within the popout */
        left: 50%;
        transform: translate(-50%, -50%);
        width: 70%;
    }

    .popout-button {
        margin-top: 10%;
    }

}


@media (max-width: 428px) {
    .text {
        width: 60%;
    }

    .modelphone {
        top: 82%;
    }

    .najamodel {
        top: 88%;
    }

    .najamodel img {
        max-width: 250px;
    }

    .frame {
        position: absolute;
        top: 46%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }
    
    /* FIX: Corrected grid layout to 3x3 */
    .slot-items-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr); 
        grid-template-rows: repeat(3, auto);
        gap: 8px;
        max-width: 270px;
        width: 100%;
        z-index: 10;
    }

    .spin {
        top: 45%;
    }

    .spin img {
        max-width: 280px;
    }

    .effect {
        top: 43%;
    }

    .effect img {
        max-width: 40px;
    }
    .popout-content{
        top: 40%; 
    }
    
    .popout-text img {
        width: 100%;
        max-width:350px;
        height: auto;
        object-fit: contain;
    }
    .popout-button {
        margin-top: 15%;
        width: 100%;
    }
    .popout-button img{
        width: 100%;
        max-width: 300px;
    }
    .popout-tryagain {
        position: absolute;
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%; /* Ensure it covers the screen */
        height: 100vh;
        display: none;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        overflow: hidden;
        cursor: pointer;
    }

    .popout-content-tryagain {
        position: absolute;
        top: 50%; /* Centered content within the popout */
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85%;
    }

    
}

@media (max-width: 414px) {
    .text {
        width: 60%;
    }

    .modelphone {
        top: 82%;
    }

    
    .popout-content{
        top: 40%; 
    }
    
    .popout-text img {
        width: 100%;
        max-width:350px;
        height: auto;
        object-fit: contain;
    }
    .popout-button {
        margin-top: 15%;
        width: 100%;
    }
    .popout-button img{
        width: 100%;
        max-width: 320px;
    }
    
}

@media (max-width: 390px) {
    .text {
        width: 73%;
    }

    .frame {
        position: absolute;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
    }

    .spin {
        top: 45%;
    }

    .spin img {
        max-width: 250px;
    }
    
    /* FIX: Corrected grid layout to 3x3 */
    .slot-items-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr); 
        grid-template-rows: repeat(3, auto);
        gap: 8px;
        max-width: 250px;
        width: 100%;
        z-index: 10;
    }

    .modelphone {
        top: 81.5%;
    }

    .najamodel {
        width: 73%;
    }

    .popout-content {
        top: 40%;
    }
    .popout-button{
        margin-top: 20%;
    }
    .popout-button img{
        width: 100%;
        max-width: 240px;
    }
}

@media (max-width: 360px) {
    .logo{
        width: 30%;
    }
    .text{
        width: 60%;
    }
    .modelphone {
        top: 81.5%;
    }
    
    /* FIX: Corrected grid layout to 3x3 */
    .slot-items-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, auto);
        gap: 8px;
        max-width: 220px;
        width: 100%;
        z-index: 10;
    }

    .najamodel {
        top: 90%;
        width: 100%;
    }

    .najamodel img {
        max-width: 250px;
    }

    .popout-content {
        top: 40%;
    }
    .popout-text{
        width: 100%;
    }
    .popout-text img{
        width: 100%;
        max-width: 300px;
    }

    .popout-button {
        margin-top: 20%;
        width: 80%;
    }
}