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

body{
    min-height:100vh;

    font-family:'Poppins',sans-serif;

    background:
    linear-gradient(
        135deg,
        #2563eb,
        #7c3aed
    );

    padding:30px;
}

.container{
    max-width:1400px;
    margin:auto;

    background:white;

    border-radius:24px;

    padding:30px;
    min-height:calc(100vh - 60px);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.header{
    text-align:center;
    margin-bottom:25px;
}

.header h1{
    font-size:42px;
    margin-bottom:8px;
}

.header p{
    color:#666;
}

.room-panel{
    display:flex;
    justify-content:center;
    gap:10px;
    margin-bottom:20px;
}

.room-panel input{
    width:250px;
    padding:12px;

    border:1px solid #ddd;
    border-radius:12px;
}

.room-panel button{
    border:none;

    padding:12px 20px;

    border-radius:12px;

    background:#2563eb;
    color:white;

    cursor:pointer;
}

.room-info{
    text-align:center;
    font-weight:600;
    margin-bottom:20px;
}

.game-wrapper{
    display:flex;

    justify-content:center;
    align-items:flex-start;

    gap:30px;

    width:100%;
}

#board{
    width:600px;
    height:600px;

    display:grid;

    grid-template-columns:
    repeat(10,1fr);

    border:4px solid #333;

    border-radius:12px;

    overflow:hidden;
}

.cell{
    border:1px solid #ddd;

    display:flex;

    justify-content:center;
    align-items:center;

    position:relative;

    font-size:12px;
}

.cell:nth-child(odd){
    background:#f8fafc;
}

.cell:nth-child(even){
    background:#e2e8f0;
}

.side-panel{

    width:260px;

    display:flex;
    flex-direction:column;

    gap:16px;

    position:sticky;
    top:20px;
}

.player-card{
    background:#f8fafc;

    border-radius:16px;

    padding:15px;

    display:flex;
    align-items:center;
    gap:15px;
}

.player-card img{
    width:50px;
    height:50px;
}

#rollBtn{
    border:none;

    background:#f59e0b;
    color:white;

    padding:18px;

    border-radius:16px;

    font-size:22px;
    font-weight:600;

    cursor:pointer;
}

.player1,
.player2{
    width:34px;
    height:34px;

    background-size:contain;
    background-repeat:no-repeat;
    background-position:center;

    position:absolute;
}

.player1{
    background-image:url('assets/player1.png');
}

.player2{
    background-image:url('assets/player2.png');
    left:30px;
}

#popup{
    position:fixed;
    inset:0;
    z-index:5000;

    background:rgba(0,0,0,.7);

    display:flex;
    justify-content:center;
    align-items:center;
    pointer-events:auto;
}

.hidden{
    display:none !important;
}

.popup-content{
    background:white;

    width:400px;

    border-radius:20px;

    padding:20px;

    text-align:center;
    position:relative;
    z-index:5001;
}

.popup-content img{
    width:100%;
    border-radius:12px;
    margin:15px 0;
}

.popup-content button{
    padding:10px 20px;

    border:none;

    background:#2563eb;
    color:white;

    border-radius:12px;
}

@media(max-width:1100px){

    .game-wrapper{
        flex-direction:column;
        align-items:center;
    }

    #board{
        width:90vw;
        height:90vw;
    }

    .side-panel{
        width:100%;
        max-width:500px;
    }
}

#board-wrapper{
    position:relative;

    width:600px;
    height:600px;
}

#connections{
    position:absolute;
    inset:0;

    width:100%;
    height:100%;

    pointer-events:none;

    z-index:999;
}

#board{
    position:relative;
    z-index:1;
}

.dice-box{

    background:#f8fafc;

    border-radius:16px;

    padding:20px;

    text-align:center;
}

#diceResult{

    width:90px;
    height:90px;

    margin:auto;

    background:white;

    border-radius:16px;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:50px;

    box-shadow:
        0 4px 12px rgba(0,0,0,.1);
}

#diceText{

    margin-top:12px;

    font-weight:600;

    font-size:18px;
}

.jump{
    animation:jump .25s;
}

@keyframes jump{

    0%{
        transform:
        translateY(0);
    }

    50%{
        transform:
        translateY(-12px);
    }

    100%{
        transform:
        translateY(0);
    }
}

.climb-animation{
    animation:climbAnim 1s ease-in-out;
}

.snake-animation{
    animation:snakeAnim 1s ease-in-out;
}

@keyframes climbAnim{

    0%{
        transform:
        translateY(0)
        scale(1);
    }

    50%{
        transform:
        translateY(-25px)
        scale(1.3);
    }

    100%{
        transform:
        translateY(-50px)
        scale(1);
    }
}

@keyframes snakeAnim{

    0%{
        transform:
        translateX(0)
        rotate(0deg);
    }

    25%{
        transform:
        translateX(-10px)
        rotate(-10deg);
    }

    50%{
        transform:
        translateX(10px)
        rotate(10deg);
    }

    75%{
        transform:
        translateX(-10px)
        rotate(-10deg);
    }

    100%{
        transform:
        translateX(0)
        rotate(0deg);
    }
}

#objects{
    position:absolute;
    inset:0;

    z-index:500;

    pointer-events:none;
}

.board-object{
    position:absolute;
    background-size:contain;
    background-repeat:no-repeat;
    background-position:center;
}

@media(max-width:768px){

    body{
        padding:12px;
    }

    .container{
        padding:16px;
        border-radius:20px;
    }

    .header h1{
        font-size:28px;
    }

    .header p{
        font-size:14px;
    }

    .room-panel{
        flex-wrap:wrap;
    }

    .room-panel input{
        width:100%;
    }

    .room-panel button{
        flex:1;
    }

    .game-wrapper{
        flex-direction:column;
        align-items:center;
        gap:20px;
    }

    #board-wrapper{
        width:92vw;
        height:92vw;
        max-width:420px;
        max-height:420px;
    }

    #board{
        width:100%;
        height:100%;
    }

    .cell{
        font-size:10px;
    }

    .side-panel{
        width:100%;
        max-width:420px;

        position:static;
    }
}

@media(max-width:768px){

    .player-card{
        padding:10px;
    }

    .player-card img{
        width:40px;
        height:40px;
    }

    #rollBtn{
        font-size:18px;
        padding:14px;
    }

    .dice-box{
        padding:14px;
    }

    #diceResult{
        width:70px;
        height:70px;
        font-size:40px;
    }

    #diceText{
        font-size:14px;
    }
}

@media(max-width:768px){

    .player1,
    .player2{
        width:18px;
        height:18px;
    }

    .player2{
        left:14px;
    }

}

@media(max-width:768px){

    .board-object{
        transform:scale(.55);
        transform-origin:center center;
    }

}

.snake-object,
.ladder-object{
    position:absolute;
    transform-origin:center center;
    background-repeat:no-repeat;
    background-position:center;
    background-size:contain;
    pointer-events:none;
    z-index:2;
    will-change:transform,width,height,left,top;
}

.snake-object::before{
    content:none;
}

.ladder-object::before{
    content:none;
}

.start-marker{
    position:absolute;
    width:12px;
    height:12px;
    background:#22c55e;
    border-radius:50%;
}

.end-marker{
    position:absolute;
    width:12px;
    height:12px;
    background:#ef4444;
    border-radius:50%;
}
