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

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

body {
    background-color: #050510;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin: auto;
    position: relative;
    gap: 15px;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    max-height: 75vh;
    aspect-ratio: 4/3;
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.3), inset 0 0 50px rgba(0, 0, 0, 0.8);
    background: #050510;
    border-radius: 12px;
    border: 3px solid #00ffcc;
    overflow: hidden;
    touch-action: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

#score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 700;
    color: #00ffcc;
    text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
    z-index: 10;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 16, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    backdrop-filter: blur(6px);
    z-index: 20;
    padding: 20px;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    cursor: pointer;
}

.overlay h1 {
    font-size: clamp(32px, 8vw, 64px);
    font-weight: 900;
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc, 0 0 40px #00ffcc;
    letter-spacing: 4px;
    text-transform: uppercase;
}

#game-over-screen h1 {
    color: #ff0055;
    text-shadow: 0 0 10px #ff0055, 0 0 20px #ff0055, 0 0 40px #ff0055;
}

.overlay p {
    font-size: clamp(14px, 3.5vw, 22px);
    margin-bottom: 15px;
    color: #eee;
    max-width: 80%;
    line-height: 1.6;
}

.blink {
    animation: blinker 1.5s linear infinite;
    color: #ffea00 !important;
    text-shadow: 0 0 10px #ffea00, 0 0 20px #ffea00;
    margin-top: 30px;
    font-weight: 700;
    font-size: clamp(16px, 4.5vw, 26px) !important;
}

@keyframes blinker {
    50% {
        opacity: 0.3;
    }
}

/* Mobile Controls Styling */
#mobile-controls {
    display: none;
    justify-content: center;
    gap: 30px;
    width: 100%;
    padding: 5px 10px;
    box-sizing: border-box;
}

body.touch-device #mobile-controls {
    display: flex;
}

.ctrl-btn {
    width: 65px;
    height: 65px;
    background: rgba(0, 255, 204, 0.1);
    border: 2px solid rgba(0, 255, 204, 0.4);
    border-radius: 50%;
    color: #00ffcc;
    font-size: 24px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

.ctrl-btn:active {
    background: rgba(0, 255, 204, 0.35);
    border-color: #00ffcc;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.8);
    transform: scale(0.92);
}

/* Mobile Visibility Utilities */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

body.touch-device .mobile-only {
    display: flex !important;
}

body.touch-device .desktop-only {
    display: none !important;
}

span.desktop-only {
    display: inline !important;
}
body.touch-device span.desktop-only {
    display: none !important;
}
body.touch-device span.mobile-only {
    display: inline !important;
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 5px;
    }
    
    .game-wrapper {
        flex-direction: row;
        gap: 20px;
        align-items: center;
        max-width: 95vw;
    }
    
    #game-container {
        max-height: 85vh;
        width: auto;
        flex-grow: 1;
    }
    
    #mobile-controls {
        flex-direction: column;
        width: auto;
        gap: 15px;
        padding: 0;
    }
    
    .ctrl-btn {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }
}
