/* Solar Microgrid Management Game - Main Styles */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #2b5aa0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    /* Allow browser pinch-zoom on body, but canvas handles its own */
}

#gameContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    /* Use dvh (dynamic viewport height) with fallback */
    height: 100vh;
    height: 100dvh;
    /* Prevent overscroll */
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #87ceeb 0%, #98fb98 100%);
    /* iOS safe area padding */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#gameCanvas {
    border: 4px solid #4a4a4a;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    background-color: #90ee90;
    /* Canvas handles its own touch gestures - prevent browser handling */
    touch-action: none;
    /* Crisp pixel rendering for high-DPI */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    #gameCanvas {
        border-width: 2px;
        border-radius: 4px;
        max-width: 100vw;
        max-height: 100vh;
    }
    
    #gameContainer {
        padding: 0;
    }
}

@media (max-width: 480px) {
    #gameCanvas {
        border-width: 1px;
        border-radius: 0;
    }
}

/* Landscape orientation optimization */
@media (orientation: landscape) and (max-height: 500px) {
    #gameCanvas {
        max-height: 100vh;
        max-width: 100vw;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS only */
    body {
        /* Prevent pull-to-refresh */
        overscroll-behavior-y: none;
    }
    
    #gameContainer {
        /* Fix for iOS address bar */
        height: -webkit-fill-available;
    }
    
    #gameCanvas {
        /* Prevent image save dialog */
        -webkit-touch-callout: none;
    }
}

/* Safe area handling for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    #gameContainer {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Pokemon-style UI Elements (for potential HTML overlays) */
.pokemon-dialog {
    position: absolute;
    background-color: #f5f5dc;
    border: 3px solid #4a4a4a;
    border-radius: 8px;
    padding: 16px;
    font-family: monospace;
    font-size: 14px;
    color: #2b2b2b;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pokemon-button {
    background-color: #ff6b6b;
    border: 2px solid #d63031;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    padding: 8px 16px;
    cursor: pointer;
    font-family: monospace;
}

.pokemon-button:hover {
    background-color: #ee5a52;
}

.pokemon-button:active {
    background-color: #d63031;
}
