:root {
    --primary: #ff3c3c;
    --secondary: #ffffff;
    --accent: #8b0000;
    --bg-dark: #050510;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    color: var(--text);
}

.board {
    height: 100vh;
    width: 50%;
    background: radial-gradient(circle at center, #1a0505 0%, #050510 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}


.board::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image:
        radial-gradient(1px 1px at 20px 30px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 40px 70px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(1.5px 1.5px at 50px 160px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 80px 120px, rgba(255, 255, 255, 0.5), rgba(0, 0, 0, 0)),
        radial-gradient(1.5px 1.5px at 110px 210px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 150px 150px, #fff, rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 250px 250px;
    opacity: 0.3;
    animation: starScroll 60s linear infinite;
}

@keyframes starScroll {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(250px);
    }
}

.ship {
    height: 80px;
    width: 80px;
    position: absolute;
    background-image: url('image/ship-1.png');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 10px var(--primary));
    transform: rotateY(0deg);
    transition: transform 0.1s ease;
    z-index: 2;
}

.ship::before,
.ship::after {
    content: '';
    position: absolute;
    bottom: -25px;
    width: 12px;
    height: 25px;
    background: radial-gradient(ellipse at top, #fff 0%, #ffeb3b 20%, var(--primary) 50%, transparent 100%);
    filter: blur(1px);
    border-radius: 0 0 15px 15px;
    animation: engineFlicker 0.1s infinite alternate;
    z-index: -1;
    box-shadow: 0 5px 15px rgba(255, 60, 60, 0.4);
}

.ship::before {
    left: 22px;
}

.ship::after {
    right: 22px;
    left: auto;
    transform: none;
}

#r-side {
    height: 100vh;
    width: 25%;
    background-color: #030308;
    background-image:
        linear-gradient(to right, rgba(255, 60, 60, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 60, 60, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    border-left: 1px solid var(--glass-border);
}

#l-side {
    height: 100vh;
    width: 25%;
    background-color: #030308;
    background-image:
        linear-gradient(to right, rgba(255, 60, 60, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 60, 60, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    border-right: 1px solid var(--glass-border);
}

.bullet {
    height: 25px;
    width: 4px;
    position: absolute;
    background: linear-gradient(to top, var(--primary), #fff);
    border-radius: 2px;
    box-shadow: 0 0 15px var(--primary);
    z-index: 1;
}

.enemyOne {
    height: 100px;
    width: 100px;
    position: absolute;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    filter: drop-shadow(0 0 20px var(--primary));
    transition: transform 0.2s ease;
    z-index: 2;
}

.enemyOne::after {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    width: 15px;
    height: 30px;
    background: radial-gradient(ellipse at top, #fff 0%, #ffeb3b 20%, var(--primary) 50%, transparent 100%);
    filter: blur(1px);
    border-radius: 0 0 15px 15px;
    animation: engineFlicker 0.15s infinite alternate;
    z-index: -1;
    box-shadow: 0 5px 20px rgba(255, 60, 60, 0.5);
}

.exp {
    width: 100px;
    height: 100px;
    position: absolute;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    mix-blend-mode: screen;
    z-index: 3;
}


.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 5, 16, 0.85);
    backdrop-filter: blur(12px);
    text-align: center;
}

.ui-content {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#game-over {
    display: none;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(to bottom, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 60, 60, 0.5);
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.game-button {
    background: transparent;
    color: #fff;
    border: 1px solid var(--primary);
    padding: 16px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
}

.game-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.game-button:hover {
    background-color: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 0 30px var(--primary);
    transform: translateY(-2px);
}

.game-button:hover::before {
    left: 100%;
}

.game-button:active {
    transform: translateY(0);
}

.score-display {
    position: absolute;
    top: 30px;
    left: 30px;
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 2px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-display #score {
    color: #fff;
    text-shadow: 0 0 10px var(--primary);
}

.final-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin: 20px 0;
    text-shadow: 0 0 20px rgba(255, 60, 60, 0.5);
}

.instructions {
    color: rgba(255, 255, 255, 0.7);
    margin: 20px 0;
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

.start-screen-ship {
    position: relative;
    filter: drop-shadow(0 0 20px var(--primary));
    margin: 30px 0 !important;
}


.touch-controls {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 200;
}

.joystick {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-handle {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary);
}

.shoot-button {
    width: 90px;
    height: 90px;
    background: rgba(255, 60, 60, 0.1);
    border: 1px solid var(--primary);
    border-radius: 50%;
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(255, 60, 60, 0.2);
    backdrop-filter: blur(5px);
}


@media (max-width: 1024px) {
    .board {
        width: 100%;
    }

    #l-side,
    #r-side {
        display: none;
    }

    .ship {
        height: 60px;
        width: 60px;
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .touch-controls {
        display: flex;
        bottom: 100px;
    }

    .ui-content {
        padding: 30px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .ui-content {
        padding: 20px;
        width: 95%;
    }

    .game-button {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .touch-controls {
        padding: 0 20px;
    }

    .joystick {
        width: 100px;
        height: 100px;
    }

    .joystick-handle {
        width: 40px;
        height: 40px;
    }

    .shoot-button {
        width: 70px;
        height: 70px;
    }

    .score-display {
        top: 20px;
        left: 20px;
        font-size: 1.2rem;
    }

    .ship {
        height: 45px;
        width: 45px;
    }
}


@keyframes titlePulse {
    from {
        transform: scale(1);
        opacity: 0.8;
    }

    to {
        transform: scale(1.02);
        opacity: 1;
    }
}

@keyframes engineFlicker {
    0% {
        height: 25px;
        opacity: 0.8;
        filter: blur(1px) brightness(1);
    }

    100% {
        height: 45px;
        opacity: 1;
        filter: blur(1.5px) brightness(1.2);
    }
}

.game-title {
    animation: titlePulse 2s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}