/* Base Reset and PWA specific */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a24;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none; /* Prevent browser handling of touch gestures like scroll/zoom */
}

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

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: optimizeSpeed;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas when UI is not active */
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(26, 26, 36, 0.95);
    pointer-events: auto; /* Catch clicks for active screens */
    z-index: 10;
}

.screen.active {
    display: flex;
}

.logo {
    font-size: 3rem;
    font-weight: bold;
    color: #fca311;
    margin-bottom: 2rem;
    text-shadow: 0 4px 10px rgba(252, 163, 17, 0.4);
    letter-spacing: 2px;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 0.5rem;
    min-width: 200px;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background-color: #fca311;
    color: #14213d;
    box-shadow: 0 4px 15px rgba(252, 163, 17, 0.3);
}

.btn.secondary {
    background-color: #e5e5e5;
    color: #14213d;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #fca311;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (orientation: portrait) {
    /* Handle portrait mode gracefully */
    .screen::before {
        content: "Rotate device to landscape for best experience";
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.8);
        padding: 10px 20px;
        border-radius: 20px;
        font-size: 0.9rem;
        text-align: center;
        width: 80%;
    }
}
