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

body {
    background: #000;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    position: relative;
    width: 1000px;
    height: 700px;
    border: 2px solid #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#gameCanvas {
    display: block;
    background: #000;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-size: 32px;
    letter-spacing: 2px;
}

#lives-display {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.life-icon {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 25px solid #fff;
}

#level-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 18px;
    letter-spacing: 2px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.screen h1 {
    color: #fff;
    font-size: 72px;
    letter-spacing: 15px;
    margin-bottom: 40px;
    text-shadow: 0 0 10px #fff;
}

.controls-info {
    margin-bottom: 40px;
    text-align: left;
}

.controls-info p {
    color: #aaa;
    font-size: 16px;
    margin: 10px 0;
}

.controls-info strong {
    color: #fff;
}

.screen button {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    padding: 15px 50px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    letter-spacing: 3px;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.screen button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.high-score {
    margin-top: 30px;
    color: #888;
    font-size: 18px;
    letter-spacing: 2px;
}

#game-over-screen p {
    color: #fff;
    font-size: 24px;
    margin: 10px 0;
    letter-spacing: 2px;
}

#pause-screen p {
    color: #888;
    font-size: 18px;
}

/* ===== TOUCH CONTROLS ===== */
#touch-controls {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.touch-device #touch-controls {
    display: block;
}

.touch-btn {
    position: absolute;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 24px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 0.1s, border-color 0.1s, transform 0.1s;
}

.touch-btn.pressed {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(0.95);
}

/* Movement cluster - bottom left */
#btn-left {
    width: 70px;
    height: 70px;
    bottom: 30px;
    left: 20px;
}

#btn-thrust {
    width: 70px;
    height: 70px;
    bottom: 110px;
    left: 75px;
}

#btn-right {
    width: 70px;
    height: 70px;
    bottom: 30px;
    left: 130px;
}

/* Fire button - bottom right */
#btn-fire {
    width: 90px;
    height: 90px;
    bottom: 30px;
    right: 20px;
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.5);
    font-size: 18px;
}

#btn-fire.pressed {
    background: rgba(255, 100, 100, 0.5);
    border-color: rgba(255, 100, 100, 0.9);
}

/* Hyperspace - top center */
#btn-hyperspace {
    width: 90px;
    height: 50px;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 25px;
    font-size: 14px;
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.4);
}

#btn-hyperspace.pressed {
    background: rgba(0, 255, 255, 0.4);
    border-color: rgba(0, 255, 255, 0.8);
    transform: translateX(-50%) scale(0.95);
}

/* Pause button - top right */
#btn-pause {
    width: 50px;
    height: 50px;
    top: 20px;
    right: 140px;
    font-size: 20px;
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        max-height: 100%;
        border: none;
    }

    #gameCanvas {
        width: 100%;
        height: 100%;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    /* Landscape phone - compact layout */
    #btn-left {
        bottom: 20px;
        left: 15px;
        width: 60px;
        height: 60px;
    }

    #btn-thrust {
        bottom: 90px;
        left: 60px;
        width: 60px;
        height: 60px;
    }

    #btn-right {
        bottom: 20px;
        left: 105px;
        width: 60px;
        height: 60px;
    }

    #btn-fire {
        bottom: 20px;
        right: 15px;
        width: 80px;
        height: 80px;
    }

    #btn-hyperspace {
        top: 15px;
        width: 80px;
        height: 40px;
        font-size: 12px;
    }

    #btn-pause {
        top: 15px;
        right: 100px;
        width: 40px;
        height: 40px;
    }
}
