/* Patriotic Flag Planting Game Styles */

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

body {
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.pixel-font {
    font-family: 'Press Start 2P', monospace;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.pixelated-button {
    border: 2px solid #000;
    box-shadow: 
        2px 2px 0px #000,
        inset -1px -1px 0px rgba(0,0,0,0.3),
        inset 1px 1px 0px rgba(255,255,255,0.3);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transition: all 0.1s;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
}

.pixelated-button:hover {
    transform: translate(1px, 1px);
    box-shadow: 
        1px 1px 0px #000,
        inset -1px -1px 0px rgba(0,0,0,0.3),
        inset 1px 1px 0px rgba(255,255,255,0.3);
}

.pixelated-button:active {
    transform: translate(2px, 2px);
    box-shadow: 
        0px 0px 0px #000,
        inset -1px -1px 0px rgba(0,0,0,0.3),
        inset 1px 1px 0px rgba(255,255,255,0.3);
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(45deg, #1e40af 0%, #dc2626 50%, #1e40af 100%);
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: calc(100vh - 100px);
    cursor: grab;
    touch-action: none;
}

#game-canvas:active {
    cursor: grabbing;
}

#hud {
    height: 50px;
    backdrop-filter: blur(5px);
    background: linear-gradient(90deg, 
        rgba(220, 38, 38, 0.9) 0%, 
        rgba(255, 255, 255, 0.9) 50%, 
        rgba(30, 64, 175, 0.9) 100%);
    border-bottom: 3px solid #facc15;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#bottom-controls {
    height: 50px;
    backdrop-filter: blur(5px);
    background: linear-gradient(90deg, 
        rgba(30, 64, 175, 0.9) 0%, 
        rgba(220, 38, 38, 0.9) 100%);
    border-top: 3px solid #facc15;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

/* Modal Styles */
.fixed {
    position: fixed;
}

.z-100 {
    z-index: 100;
}

#plant-modal .bg-gradient-to-b,
#achievements-modal .bg-gradient-to-b {
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

/* Rhythm Game Styles */
#rhythm-bar {
    position: relative;
    background: linear-gradient(90deg, #ef4444 0%, #22c55e 45%, #22c55e 55%, #ef4444 100%);
}

#rhythm-indicator {
    position: absolute;
    top: 0;
    left: 0;
    background: #1e40af;
    border: 2px solid #ffffff;
    border-radius: 2px;
}

/* Precision Game Styles */
#precision-canvas {
    background: radial-gradient(circle, #065f46 0%, #1f2937 100%);
    border-radius: 8px;
}

/* Achievement Styles */
.bg-green-800 {
    background-color: #166534;
}

.bg-gray-700 {
    background-color: #374151;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .pixel-font {
        font-size: 0.6rem;
    }
    
    .pixelated-button {
        padding: 0.5rem 1rem;
        font-size: 0.6rem;
        min-height: 44px; /* Touch target size */
        min-width: 44px;
    }
    
    #hud .flex {
        gap: 1rem;
    }
    
    #bottom-controls .flex {
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    #plant-modal .max-w-sm,
    #achievements-modal .max-w-md {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    /* Larger touch targets for mobile */
    .trivia-option {
        min-height: 48px;
        margin: 0.25rem 0;
    }
}

/* Portrait vs Landscape optimizations */
@media (orientation: portrait) {
    #game-canvas {
        height: calc(100vh - 120px);
    }
    
    #hud {
        height: 60px;
    }
    
    #bottom-controls {
        height: 60px;
    }
}

@media (orientation: landscape) {
    #game-canvas {
        height: calc(100vh - 80px);
    }
    
    #hud {
        height: 40px;
    }
    
    #bottom-controls {
        height: 40px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .pixelated-button {
        border: 3px solid #000;
        box-shadow: 3px 3px 0px #000;
    }
    
    #game-container {
        background: linear-gradient(45deg, #000080 0%, #8B0000 50%, #000080 100%);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pixelated-button:hover {
        transform: none;
    }
    
    .transition-all {
        transition: none;
    }
    
    #rhythm-indicator {
        transition: none;
    }
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Success/fail animations */
@keyframes successPulse {
    0%, 100% { background-color: #22c55e; }
    50% { background-color: #16a34a; }
}

@keyframes failShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-animation {
    animation: successPulse 0.5s ease-in-out;
}

.fail-animation {
    animation: failShake 0.5s ease-in-out;
}

/* Eagle vision effect */
.eagle-vision-active {
    filter: sepia(30%) saturate(150%) hue-rotate(20deg) brightness(120%);
}

/* Fireworks canvas */
#fireworks-canvas {
    pointer-events: none;
    z-index: 40;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states for keyboard navigation */
.pixelated-button:focus {
    outline: 3px solid #facc15;
    outline-offset: 2px;
}

/* Print styles (hidden in print) */
@media print {
    #game-container {
        display: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme, no changes needed */
}