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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c2461, #1e3799, #4a69bd);
    color: #dff9fb;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Заголовок игры */
.game-header {
    background: rgba(25, 42, 86, 0.9);
    border-radius: 12px 12px 0 0;
    padding: 15px 25px;
    border-bottom: 3px solid #35f0ff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
}

.game-header h1 {
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #35f0ff;
    text-shadow: 0 0 10px rgba(53, 240, 255, 0.7);
    letter-spacing: 1px;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: rgba(15, 25, 60, 0.8);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(53, 240, 255, 0.3);
}

.stat {
    text-align: center;
    padding: 0 15px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #a5b1c2;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid rgba(53, 240, 255, 0.2);
    min-width: 80px;
}

.control-info {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.control-info .stat {
    background: rgba(53, 240, 255, 0.1);
    border: 1px solid rgba(53, 240, 255, 0.3);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 10px 20px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background: linear-gradient(to bottom, #3cb0fd, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn i {
    font-size: 1.1rem;
}

/* Стили для активной кнопки управления */
.btn.active {
    background: linear-gradient(to bottom, #9b59b6, #8e44ad);
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.5);
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.btn.active:hover {
    background: linear-gradient(to bottom, #9b59b6, #8e44ad);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.7);
}

/* Основной игровой контейнер */
.game-container {
    position: relative;
    width: 100%;
    background: #0b0f23;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid #35f0ff;
}

/* CRT эффект */
.crt-effect {
    position: relative;
    overflow: hidden;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
            to bottom,
            transparent 50%,
            rgba(0, 0, 0, 0.1) 50%
    );
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.3;
}

.crt-screen {
    position: relative;
    padding: 20px;
    background: #050018;
}

/* Сцена */
.scene {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(to bottom, #0a0e2a 0%, #1a224d 40%, #0a0e2a 100%);
    box-shadow: inset 0 0 50px rgba(0, 10, 30, 0.7);
}

/* Небо с эффектом звезд */
.scene::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
            radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.8) 1px, transparent 2px),
            radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.7) 1px, transparent 2px),
            radial-gradient(1px 1px at 30% 40%, rgba(255, 255, 255, 0.6) 1px, transparent 2px),
            radial-gradient(1px 1px at 40% 50%, rgba(255, 255, 255, 0.5) 1px, transparent 2px),
            radial-gradient(1px 1px at 50% 60%, rgba(255, 255, 255, 0.4) 1px, transparent 2px),
            radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.3) 1px, transparent 2px),
            radial-gradient(1px 1px at 70% 80%, rgba(255, 255, 255, 0.2) 1px, transparent 2px),
            radial-gradient(1px 1px at 80% 90%, rgba(255, 255, 255, 0.1) 1px, transparent 2px);
    background-size: 200px 200px;
    z-index: 0;
    opacity: 0.5;
}

/* Земля/снег */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top,
    #b0c4de 0%,
    #d4e4f7 20%,
    #e6f0fa 40%,
    #f0f8ff 60%,
    #ffffff 100%);
    z-index: 1;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 -10px 30px rgba(176, 196, 222, 0.4);
}

/* Текстура снега */
.snow-texture {
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 15px;
    background:
            radial-gradient(circle at 10% 50%, rgba(255, 255, 255, 0.9) 2px, transparent 3px),
            radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8) 3px, transparent 4px),
            radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.9) 2px, transparent 3px),
            radial-gradient(circle at 70% 40%, rgba(255, 255, 255, 0.8) 3px, transparent 4px),
            radial-gradient(circle at 90% 60%, rgba(255, 255, 255, 0.9) 2px, transparent 3px);
    background-size: 100px 50px;
    opacity: 0.9;
}

/* Персонажи */
.kid {
    position: absolute;
    bottom: 100px;
    width: 42px;
    height: 42px;
    z-index: 5;
    transition: transform 0.2s ease-out;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.3));
}

.left-kid {
    left: 15%;
    animation: jitter 3s infinite ease-in-out;
}

.right-kid {
    right: 15%;
    animation: jitter 3s infinite ease-in-out reverse;
}

@keyframes jitter {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(0.5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-1px) rotate(-0.5deg); }
}

/* Стиль для управляемого персонажа левого игрока */
.kid.controlled-left {
    filter: drop-shadow(0 0 15px rgba(52, 152, 219, 0.9)) !important;
    z-index: 10;
}

.kid.controlled-left svg {
    animation: pulse-blue 1.5s infinite;
}

@keyframes pulse-blue {
    0% { filter: drop-shadow(0 0 5px rgba(52, 152, 219, 0.7)); }
    50% { filter: drop-shadow(0 0 20px rgba(52, 152, 219, 1)); }
    100% { filter: drop-shadow(0 0 5px rgba(52, 152, 219, 0.7)); }
}

/* Стиль для управляемого персонажа правого игрока */
.kid.controlled-right {
    filter: drop-shadow(0 0 15px rgba(46, 204, 113, 0.9)) !important;
    z-index: 10;
}

.kid.controlled-right svg {
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% { filter: drop-shadow(0 0 5px rgba(46, 204, 113, 0.7)); }
    50% { filter: drop-shadow(0 0 20px rgba(46, 204, 113, 1)); }
    100% { filter: drop-shadow(0 0 5px rgba(46, 204, 113, 0.7)); }
}

/* Снежинки */
.snowflake {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.8;
    filter: blur(0.5px);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
    animation: none !important;
    will-change: transform;
}

/* Снежки */
.snowball {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
    box-shadow:
            0 0 10px rgba(255, 255, 255, 0.9),
            0 0 20px rgba(173, 216, 230, 0.7),
            inset 0 -2px 5px rgba(135, 206, 235, 0.5);
    filter: blur(0.3px);
}

/* Следы на снегу */
.footprint {
    position: absolute;
    width: 14px;
    height: 7px;
    background: rgba(120, 150, 180, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    opacity: 0.7;
    filter: blur(1px);
    transition: opacity 2s ease-out;
}

/* Эффект попадания */
.hit-effect {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    z-index: 7;
    opacity: 0;
    box-shadow:
            0 0 15px rgba(255, 255, 255, 1),
            0 0 30px rgba(135, 206, 235, 0.8);
}

/* Стиль для подсказки управления */
.control-hint {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 15px 25px;
    border-radius: 15px;
    color: #2ecc71;
    z-index: 100;
    white-space: nowrap;
    border: 2px solid #2ecc71;
    opacity: 0;
    text-align: center;
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.4);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    line-height: 1.8;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.control-hint div {
    margin: 5px 0;
}

.control-hint div:first-child {
    color: #ff6b6b;
    font-size: 0.7rem;
    margin-bottom: 10px;
}

.control-hint div:last-child {
    color: #f39c12;
    font-size: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 5px;
    margin-top: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 0.9; transform: translateX(-50%) translateY(0); }
}

/* Информация об игре */
.game-info {
    padding: 15px;
    background: rgba(15, 25, 60, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(53, 240, 255, 0.2);
    margin-top: 20px;
}

.instructions h3 {
    color: #35f0ff;
    margin-bottom: 8px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #a5b1c2;
    margin-bottom: 5px;
}

#controlInstruction {
    color: #2ecc71 !important;
    font-weight: bold;
}

.controls-detail {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #35f0ff;
    font-size: 0.85rem !important;
    margin-top: 10px !important;
}

/* Всплывающий текст очков */
.score-popup {
    position: absolute;
    z-index: 100;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease-out;
}

/* Сообщение о победе */
.win-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: #3498db;
    padding: 30px;
    border-radius: 15px;
    z-index: 1000;
    text-align: center;
    border: 3px solid #3498db;
    box-shadow: 0 0 40px rgba(52, 152, 219, 0.7);
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
}

/* Подвал */
.game-footer {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(25, 42, 86, 0.7);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #a5b1c2;
    border-top: 1px solid rgba(53, 240, 255, 0.2);
}

.game-footer p {
    margin-bottom: 8px;
}

.hint {
    font-style: italic;
    color: #7fd8e6;
    font-size: 0.85rem;
}

.kid {
    will-change: transform, left;
    backface-visibility: hidden;
}

/* Улучшение для плавности уклонения */
.kid:not(.dodging) {
    transition: transform 0.15s ease-out, filter 0.15s ease-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.4rem;
    }

    .game-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }

    .stat {
        flex: 0 0 calc(50% - 10px);
        margin-bottom: 10px;
    }

    .controls {
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    .scene {
        height: 300px;
    }

    .game-info {
        flex-direction: column;
        gap: 15px;
    }

    .instructions {
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-header h1 {
        font-size: 1.1rem;
    }

    .btn {
        min-width: 100%;
        margin-bottom: 5px;
    }

    .scene {
        height: 250px;
    }

    .ground {
        height: 80px;
    }

    .kid {
        width: 36px;
        height: 36px;
        bottom: 80px;
    }

    .stat {
        flex: 0 0 100%;
    }
}