/* ===== 40-game.css — игровые слои, старт, HUD, game over ===== */

/* Слои */
.layer {
    position: absolute;
    inset: 0;
}

.layer.main {
    background: url("img/par.png") no-repeat center bottom;
    background-size: 100% auto;
    transition: opacity 1s linear;
    z-index: 1;
}

.layer.sky {
    background: url("img/parallax-sky.png") repeat-y center top;
    background-size: cover;
    z-index: 0;
}

/* Игрок / лава / платформы */
#player {
    width: 40px;
    height: 40px;
    background: cyan;
    position: absolute;
    z-index: 10;
}

@keyframes lavaFlow {
    from {
        background-position-x: 0
    }

    to {
        background-position-x: 256px
    }
}

#lava {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 20px;
    background: url("img/lava.png") repeat-x center top;
    background-size: auto 100%;
    animation: lavaFlow 3s linear infinite;
    z-index: 9;
}

.platform {
    height: 23px;
    background: url("img/platform.png") no-repeat center/100% 100%;
    position: absolute;
    z-index: 8;
}

/* HUD */
#score {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    color: #fff;
    font: 18px Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* START кнопка */
#startButton {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    z-index: 50;
    width: 260px;
    height: 88px;
    opacity: 0;
    pointer-events: none;
    background: url("img/start-btn.png") no-repeat center/contain;
    border: 0;
    outline: 0;
    padding: 0;
    cursor: pointer;
    image-rendering: pixelated;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .35)) drop-shadow(0 0 8px rgba(255, 200, 50, .25));
    transition: transform .12s, filter .12s, opacity .8s;
}

#startButton.show {
    opacity: 1;
    pointer-events: auto;
}

#startButton .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

#startButton:hover {
    transform: translateX(-50%) scale(1.04);
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .38)) drop-shadow(0 0 12px rgba(255, 220, 80, .32));
}

#startButton:active {
    transform: translateX(-50%) translateY(2px) scale(.99);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)) drop-shadow(0 0 6px rgba(255, 180, 40, .22));
}

/* Game Over */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.gameover-box {
    background: #1a1a1a;
    border: 6px solid red;
    padding: 30px 45px;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    box-shadow: var(--shadow-2);
    min-width: 320px;
}

.gameover-title {
    font-size: 22px;
    color: red;
    margin-bottom: 20px;
}

#finalTotal {
    color: yellow;
    font-weight: 700;
    margin-top: 12px;
}

.gameover-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}