/* Color Snake — viewport-adaptive 740×440 board */

@media screen and (max-height: 640px) {
    #csnPlayShell .container.container-single {
        padding-top: 3px !important;
    }
}

#csnPlayShell.game-worlds-play-shell {
    min-height: 0;
    box-sizing: border-box;
}

#csnPlayShell.game-worlds-play-shell:not([data-casual-sized]) {
    height: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
}

#csnPlayShell .casual-outer-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.game-worlds-body #csnPlayShell #gamebox.csn-gamebox,
#csnPlayShell #gamebox.csn-gamebox {
    --csn-scale-x: 1;
    --csn-scale-y: 1;
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #000;
}

#csnPlayShell .header {
    flex: 0 0 auto;
    position: relative;
    top: auto;
    width: 100%;
    padding: 8px 16px;
    box-sizing: border-box;
    text-align: center;
    z-index: 2;
}

#csnPlayShell .header .current {
    font-size: clamp(22px, 3vw, 30px);
    color: #fff;
}

#csnPlayShell .header .record {
    font-size: 16px;
    color: grey;
}

#csnPlayShell .csn-playfield {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

#csnPlayShell #gameArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 740px;
    height: 440px;
    background-color: #161c1c;
    transform: scale(var(--csn-scale-x, 1), var(--csn-scale-y, 1));
    transform-origin: top left;
}

#csnPlayShell .snake-segment {
    width: 20px;
    height: 20px;
    position: absolute;
}

#csnPlayShell .item {
    width: 20px;
    height: 20px;
    position: absolute;
    border-radius: 50%;
}

#csnPlayShell #gameover,
#csnPlayShell .gameover {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    text-align: center;
    background-color: rgba(22, 28, 28, 0.95);
    z-index: 3;
}

#csnPlayShell .gameover p.msg {
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: grey;
    margin: min(150px, 22vh) auto 0;
}

#csnPlayShell .gameover span {
    font-family: Arial, sans-serif;
    font-size: 40px;
    color: white;
    margin: 20px auto;
}

#csnPlayShell #restartgamebutton {
    display: block;
    margin: 16px auto;
    width: 120px;
    padding: 6px;
    background-color: #00BB00;
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: red;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
}

#csnPlayShell #restartgamebutton:hover {
    background-color: #9f8b77;
}
