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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background: #0a0a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

#game-container {
    border-radius: 8px;
    box-shadow:
        0 0 60px rgba(64, 224, 208, 0.3),
        0 0 120px rgba(64, 224, 208, 0.1);
    max-width: 100vw;
    max-height: 100vh;
}

canvas {
    display: block;
    border-radius: 8px;
    touch-action: none;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #game-container {
        border-radius: 0;
        box-shadow: none;
    }

    canvas {
        border-radius: 0;
    }
}

/* Prevent pull-to-refresh on mobile */
@media (pointer: coarse) {
    body {
        overscroll-behavior: none;
    }
}

/* Rotate device overlay - hidden by default */
#rotate-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1628 0%, #1a3a5c 100%);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.rotate-content {
    text-align: center;
    color: #40e0d0;
    font-family: 'Courier New', monospace;
}

.rotate-icon {
    font-size: 80px;
    animation: tilt 1.5s ease-in-out infinite;
}

.rotate-arrow {
    font-size: 60px;
    margin: 20px 0;
    animation: spin 2s linear infinite;
}

.rotate-content p {
    font-size: 24px;
    margin-top: 20px;
    text-shadow: 0 0 10px rgba(64, 224, 208, 0.5);
}

@keyframes tilt {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Show rotate overlay on mobile portrait */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #rotate-overlay {
        display: flex;
    }

    #game-container {
        display: none;
    }
}

/* Virtual joystick styles */
#joystick-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    z-index: 1000;
    pointer-events: none;
    display: none;
}

#joystick-base {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(64, 224, 208, 0.3) 0%, rgba(64, 224, 208, 0.1) 70%, transparent 100%);
    border: 3px solid rgba(64, 224, 208, 0.5);
    border-radius: 50%;
    pointer-events: auto;
}

#joystick-thumb {
    position: absolute;
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, rgba(64, 224, 208, 0.8) 0%, rgba(64, 224, 208, 0.4) 100%);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    left: 35px;
    top: 35px;
    box-shadow: 0 0 15px rgba(64, 224, 208, 0.6);
    transition: transform 0.05s ease-out;
}

#fire-button {
    position: fixed;
    bottom: 50px;
    right: 50px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(255, 100, 50, 0.8) 0%, rgba(255, 50, 0, 0.5) 100%);
    border: 3px solid rgba(255, 150, 100, 0.7);
    border-radius: 50%;
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: white;
    text-shadow: 0 0 10px rgba(255, 100, 0, 0.8);
    box-shadow: 0 0 20px rgba(255, 100, 0, 0.5);
    pointer-events: auto;
}

#fire-button:active {
    transform: scale(0.9);
    background: radial-gradient(circle, rgba(255, 150, 100, 1) 0%, rgba(255, 100, 50, 0.8) 100%);
}

#pause-button-mobile {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: white;
    pointer-events: auto;
}

/* Touch indicator */
#touch-indicator {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(64, 224, 208, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    display: none;
    transform: translate(-50%, -50%);
    animation: touch-pulse 0.5s ease-out;
}

@keyframes touch-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Show mobile controls on touch devices in landscape */
@media screen and (max-width: 1024px) and (orientation: landscape) and (pointer: coarse) {
    #joystick-container,
    #fire-button,
    #pause-button-mobile {
        display: flex;
    }
}
