@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap');

/* Основные стили для body */
body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #000;
    overflow: hidden;
    font-family: "Pixelify Sans";
    font-weight: 400;
}

/* Контейнер игры */
.game-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100%;
    max-height: 600px;
    overflow: hidden;
    background-color: #111;
    border: 2px solid #fff;
    z-index: 0;
    outline: none;
}

/* Стили для счетчика космонавтов */
.counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 24px;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    pointer-events: none;
}

@keyframes counter-death-blink {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    25% {
        transform: translateX(-50%) scale(1.2);
        opacity: 0.7;
    }

    50% {
        transform: translateX(-50%) scale(1);
        opacity: 0.5;
    }

    75% {
        transform: translateX(-50%) scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

.counter.death-animation {
    animation: counter-death-blink 0.4s infinite;
}

/* Стили для экрана отсчета */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
}

.countdown-container {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
}

.countdown-number {
    width: 150px;
    height: 150px;
    animation: scale-in 0.3s ease-out;
}

@keyframes scale-in {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Стили для корабля игрока */
.space {
    position: absolute;
    width: 40px;
    height: 40px;
    background-image: url('../img/space.svg');
    /* путь обновлён */
    background-size: cover;
    bottom: 20px;
    /* Корабль фиксирован внизу экрана */
    left: 180px;
    /* Начальная позиция по горизонтали */
}

/* Стили для синих и красных объектов */
.cosmonavt,
.asteroid {
    position: absolute;
    width: 30px;
    height: 30px;
    background-size: cover;
}

.cosmonavt {
    background-image: url('../img/cosmonavt.svg');
}

.asteroid {
    background-image: url('../img/asteroid.svg');
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .game-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border: none;
    }

    .space {
        bottom: 10%;
        left: 45%;
    }
}

.gameover {
    width: 220px;
    height: 220px;
    background-image: url('../img/gov.svg');
    background-repeat: no-repeat;
    background-size: contain;
    margin-bottom: 10px;
}


.playagin {
    width: 180px;
    height: 180px;
    background-image: url('../img/play-again.svg');
    background-repeat: no-repeat;
    background-size: contain;
    background-color: transparent;
    background-color: #000;

}

.play-b {
    width: 180px;
    height: 180px;
    background-image: url('../img/play.svg');
    background-repeat: no-repeat;
    background-size: contain;
    background-color: transparent;
    background-color: #000;
}

.menu-container,
.game-over-screen,
.countdown-overlay {
    position: absolute;
    top: -2px;
    /* Компенсируем границу контейнера */
    left: -2px;
    right: -2px;
    bottom: -2px;
    width: calc(100% + 4px);
    /* Учитываем границу с обеих сторон */
    height: calc(100% + 4px);
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 2;
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    font-family: "Pixelify Sans";
    will-change: transform;
    border: none;
}

.menu-container button,
.game-over-screen button {
    border: none;
    cursor: pointer;
}

button {
    font-family: "Pixelify Sans";
}

.menu-container.hidden {
    transform: translateY(-100%);
}

.game-over-screen {
    transform: translateY(-100%);
    pointer-events: none;
}

.game-over-screen.visible {
    transform: translateY(0);
    pointer-events: all;
}

.game-over-screen.hiding {
    transform: translateY(100%);
}

.menu-container {
    transform: translateY(0);
    opacity: 1;
}

.menu-container.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.game-over-screen.visible {
    pointer-events: all;
    transition-duration: 1s;
    transform: translateY(0);
}

.game-container {
    transition: opacity 0.5s ease-in-out;
}

.asteroid {
    background-image: url('../img/asteroid.svg');
    width: 40px;
    height: 40px;
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    20% {
        transform: scale(1.2);
        opacity: 1;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }

    90% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.countdown-number {
    animation: countdownPulse 0.9s ease-out forwards;
}

#player {
    animation: pulse 1.5s infinite ease-in-out;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: "Pixelify Sans";
    font-size: 24px;
}