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

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #e9ecef;
    font-family: 'Montserrat', sans-serif;
    user-select: none;
}

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

h1 {
    color: #343a40;
    margin-bottom: 5px;
}

.instructions {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 14px;
}

.game {
    width: 600px;
    height: 200px;
    border: 3px solid #ced4da;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.game::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #adb5bd;
    z-index: 1;
}

#girl {
    width: 40px;
    height: 40px;
    font-size: 40px;
    position: absolute;
    bottom: 10px;
    left: 40px;
    line-height: 40px;
    z-index: 2;
    transform-origin: bottom center;
    transform: scaleX(-1); /* Розвертаємо дівчинку по горизонталі */
}

/* Анімація бігу */
.run {
    animation: run-anim 0.4s infinite linear;
}

@keyframes run-anim {
    0% { transform: scaleX(-1) rotate(0deg); bottom: 10px; }
    25% { transform: scaleX(-1) rotate(5deg); bottom: 16px; }
    50% { transform: scaleX(-1) rotate(0deg); bottom: 10px; }
    75% { transform: scaleX(-1) rotate(-5deg); bottom: 16px; }
    100% { transform: scaleX(-1) rotate(0deg); bottom: 10px; }
}

/* Анімація стрибка */
.jump {
    animation: jump-anim 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes jump-anim {
    0% { bottom: 10px; transform: scaleX(-1) rotate(0deg); }
    10% { transform: scaleX(-1) rotate(15deg); }
    40% { bottom: 120px; transform: scaleX(-1) rotate(15deg); }
    50% { bottom: 120px; transform: scaleX(-1) rotate(0deg); }
    60% { bottom: 120px; transform: scaleX(-1) rotate(-15deg); }
    100% { bottom: 10px; transform: scaleX(-1) rotate(0deg); }
}

#obstacle {
    width: 40px;
    height: 40px;
    font-size: 40px;
    position: absolute;
    bottom: 10px;
    left: 600px;
    line-height: 40px;
    z-index: 2;
}

.move-obstacle {
    animation: obstacle-anim 1.5s infinite linear;
}

@keyframes obstacle-anim {
    0% { left: 600px; }
    100% { left: -50px; }
}

#score {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #495057;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 8px;
    z-index: 5;
}

#game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.game-over-title {
    font-size: 32px;
    font-weight: bold;
    color: #dc3545;
    margin-bottom: 10px;
}

.game-over-subtitle {
    font-size: 16px;
    color: #495057;
}

.hidden {
    display: none !important;
}
