/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #0f0f1e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #ffffff;
    touch-action: none; /* Prevent scrolling on touch devices */
}

#game-container {
    position: relative;
    max-width: 600px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    background-color: #1a1a2e;
    border: 3px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    touch-action: none;
    cursor: crosshair;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to canvas */
}

/* Note: Individual UI elements set their own pointer-events as needed */

/* Debug Info */
.debug-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    font-size: 12px;
    border-radius: 5px;
    font-family: monospace;
    color: #4ecdc4;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available; /* Fix for iOS Safari */
    }

    #game-container {
        width: 100vw;
        height: 100vh;
        height: -webkit-fill-available; /* Fix for iOS Safari */
        max-width: 100vw;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }

    #gameCanvas {
        border: none;
        /* Scale canvas to fit viewport while maintaining aspect ratio */
        max-width: min(100vw, 66.67vh); /* 600:900 = 2:3 ratio */
        max-height: min(100vh, 150vw);
        max-height: min(-webkit-fill-available, 150vw); /* Fix for iOS Safari */
        width: auto;
        height: auto;
    }
}

/* ── BANNER AD ───────────────────────────────────── */
.ad-banner-container {
    display: none; /* shown by AdManager.showBanner() */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 50px;
    max-height: 90px;
    background: #000;
    justify-content: center;
    align-items: center;
    z-index: 998; /* below debug console (99999), above game UI (1000) */
}

.ad-blocker-msg {
    display: none;
    margin: 0;
    color: #aaa;
    font-size: 13px;
    text-align: center;
    padding: 0 12px;
}

.ad-banner-container.ad-blocked .ad-blocker-msg {
    display: block;
}

/* Portrait orientation enforcement for mobile */
@media (orientation: landscape) and (max-width: 900px) {
    body::before {
        content: "Please rotate your device to portrait mode";
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.95);
        padding: 20px;
        border-radius: 10px;
        z-index: 10000;
        text-align: center;
    }

    #game-container {
        opacity: 0.2;
    }
}
