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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Game Container */
#game-container {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas Styling */
#gameCanvas {
    border: 2px solid #fff;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
}

/* HUD Styling */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 10;
    pointer-events: none;
}

#score-display, #best-display {
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 5px;
    border: 2px solid #fff;
}

/* Screen Overlays */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 20;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

.screen h1 {
    font-size: 3em;
    margin-bottom: 0.5em;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
}

.screen h2 {
    font-size: 2.5em;
    margin-bottom: 0.5em;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
}

.screen p {
    font-size: 1.2em;
    margin: 0.5em 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.instructions {
    margin-top: 2em;
    opacity: 0.8;
}

.instructions p {
    font-size: 1em;
    margin: 0.3em 0;
}

/* Power-ups Legend */
.powerups-legend {
    margin-top: 1.5em;
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(255,215,0,0.5);
}

.powerups-legend h3 {
    font-size: 1.1em;
    color: #FFD700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.powerup-item {
    font-size: 0.9em;
    margin: 5px 0;
    text-align: left;
    opacity: 0.9;
}

/* Audio Toggle Button */
#audio-toggle {
    background: rgba(255,255,255,0.2);
    border: 2px solid #fff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    margin: 1em 0;
    transition: all 0.3s ease;
}

#audio-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* Countdown */
#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
    z-index: 30;
    animation: pulse 1s ease-in-out;
}

#countdown.hidden {
    display: none;
}

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

/* Debug Overlay */
#debug-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: #0f0;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    z-index: 15;
    border: 1px solid #0f0;
}

#debug-overlay.hidden {
    display: none;
}

#debug-overlay div {
    margin: 2px 0;
}

/* Mobile Warning */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
        background: rgba(255,0,0,0.8);
        padding: 10px;
        border-radius: 5px;
        margin-top: 20px;
    }
    
    #gameCanvas {
        width: 100vw !important;
        height: auto !important;
    }
}

/* Responsive Canvas Scaling */
@media (max-aspect-ratio: 8/3) {
    #gameCanvas {
        width: 100vw;
        height: 37.5vw; /* 100vw * (3/8) to maintain 8:3 aspect ratio */
    }
}

@media (min-aspect-ratio: 8/3) {
    #gameCanvas {
        width: 266.67vh; /* 100vh * (8/3) to maintain 8:3 aspect ratio */
        height: 100vh;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    body {
        background: #000;
        color: #fff;
    }
    
    #gameCanvas {
        border: 3px solid #fff;
    }
    
    .screen {
        background: rgba(0,0,0,0.95);
    }
}
