/* =========================================
   1. RESET & BASE STYLES
   ========================================= */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

/* Using 100% instead of vh/vw kills the mobile address bar bug */
html, body {
    width: 100%;
    height: 100%; 
    background-color: #020202;
    display: flex; 
    justify-content: center; 
    align-items: center;
    font-family: 'Segoe UI', Tahoma, sans-serif; 
    overflow: hidden;
    touch-action: none; /* Stops mobile swipe-to-refresh and zooming */
}

/* =========================================
   2. GAME CONTAINER & CANVAS
   ========================================= */
#game-wrapper {
    position: relative;
    aspect-ratio: 2 / 1; /* Mathematically locks the 800x400 ratio */
    width: 100%;
    max-height: 100%;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.15);
    border: 1px solid #222;
}

/* If the phone/monitor is ultra-wide, scale by height instead */
@media (min-aspect-ratio: 2/1) {
    #game-wrapper {
        width: auto;
        height: 100%;
    }
}

canvas {
    width: 100%;
    height: 100%;
    background-color: #08080a;
    display: block;
}

/* =========================================
   3. IN-GAME UI LAYER
   ========================================= */
#ui-layer {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
    pointer-events: none; /* Lets taps pass through to the game */
}

.title {
    color: #fff; 
    font-size: 48px; 
    font-weight: 900; 
    letter-spacing: 10px;
    text-transform: uppercase; 
    margin-bottom: 10px;
    text-shadow: 0 0 20px #00FFFF, 0 0 40px #FF10F0; /* Cyan & Pink glow */
    text-align: center;
}

#statusText {
    color: #fff; 
    font-size: 18px; 
    letter-spacing: 4px;
    animation: pulse 1s infinite alternate;
    text-align: center;
}

.hidden { 
    display: none !important; 
}

/* =========================================
   4. LANDSCAPE LOCK WARNING
   ========================================= */
#landscape-warning {
    display: none;
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: #020202;
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.error-title {
    color: #FF10F0; 
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 8px;
    text-shadow: 0 0 20px #FF10F0;
    margin-bottom: 20px;
}

.error-text {
    color: #fff;
    font-size: 18px;
    letter-spacing: 4px;
    animation: pulse 1s infinite alternate;
}

/* Triggers the warning when the phone is held vertically */
@media screen and (orientation: portrait) {
    #game-wrapper {
        display: none !important;
    }
    #landscape-warning {
        display: flex;
    }
}

/* =========================================
   5. ANIMATIONS
   ========================================= */
@keyframes pulse { 
    from { opacity: 0.3; } 
    to { opacity: 1; } 
}
