body {
    margin: 0;
    padding: 0;
    background: #000;
    color: #fff;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    /* Fill screen but respect original aspect ratio */
    width: 100%;
    max-width: 1000px; /* base width */
    aspect-ratio: 1000 / 700; /* base height */
    margin: auto;
}

#gameCanvas {
    display: block;
    /* The JS draws the scene; this is a harmless fallback */
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8E8 30%, #B0E0E6 100%);
    border: 3px solid #333;
    border-radius: 10px;
    width: 100%;
    height: 100%;
}

#ui, #instructions {
    position: absolute;
    z-index: 10;
    color: #000;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    font-weight: bold;
}

#ui {
    top: 10px;
    left: 10px;
    font-size: 32px;
}

#instructions {
    top: 10px;
    right: 10px;
    font-size: 14px;
    text-align: right;
}

/* --- Start Screen & Intro Styles --- */
#pre-start-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000;
    z-index: 200; display: flex; flex-direction: column; justify-content: center;
    align-items: center; text-align: center;
}
#pre-start-screen h1 { font-size: 60px; margin-bottom: 5px; }
#enter-btn {
    padding: 20px 40px; font-size: 24px; font-weight: bold; color: white;
    background-color: #8B0000; border: 2px solid #FF4500; border-radius: 10px;
    cursor: pointer; transition: background-color 0.2s; margin-top: 20px;
}
#enter-btn:hover { background-color: #B22222; }

#start-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); z-index: 100; display: flex;
    flex-direction: column; justify-content: center; align-items: center;
    color: #fff; text-align: center;
}
#intro-video {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 1; border-radius: 10px;
}
#start-screen .content-overlay {
    position: relative; z-index: 2; display: flex; flex-direction: column;
    justify-content: center; align-items: center; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); text-align: center;
}
#start-screen .instructions-box {
    background: rgba(0, 0, 0, 0.6); padding: 20px 25px; border-radius: 10px;
    margin-top: 20px; margin-bottom: 30px; max-width: 90%; width: 600px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
#start-screen h1, .subtitle, #start-screen .instructions-box p, #start-screen .start-prompt {
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
}
#start-screen h1 { font-size: clamp(32px, 5vw, 60px); } /* Responsive font size */
.subtitle {
    font-size: clamp(18px, 3vw, 28px); font-weight: bold; color: #e20a17;
    font-family: 'Arial Black', sans-serif;
}
#start-screen .instructions-box p { font-size: clamp(14px, 2vw, 18px); line-height: 1.5; }
#start-screen .start-prompt { font-size: clamp(20px, 3vw, 28px); font-weight: bold; }

/* --- On-Screen Controls --- */
#controls-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}
.control-group { display: flex; gap: 15px; pointer-events: auto; }
.control-btn {
    width: 80px; height: 80px; background: rgba(50, 50, 50, 0.7);
    border: 2px solid #fff; border-radius: 15px; color: #fff;
    font-size: 18px; font-weight: bold; display: flex;
    justify-content: center; align-items: center; user-select: none;
    cursor: pointer; transition: background-color 0.1s linear;
}
.control-btn.active { background: rgba(255, 255, 255, 0.5); }
#movement-controls, #action-controls { display: flex; flex-direction: column; align-items: center; gap: 15px; }
#action-controls { flex-direction: column-reverse; }
.lr-group { display: flex; gap: 15px; }
#shoot-btn {
    width: 100px; height: 100px; font-size: 24px; border-radius: 20px;
    background-color: rgba(220, 20, 60, 0.7);
}
#aim-up-btn, #aim-down-btn {
    background-color: rgba(60, 179, 113, 0.7); font-size: 16px; width: 100px;
}
#jump-btn { background-color: rgba(60, 113, 179, 0.7); }

/* --- Modal Styles --- */
#quiz-modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); z-index: 100; display: none;
    flex-direction: column; justify-content: center; align-items: center;
    color: #fff; text-align: center;
}
#quiz-box {
    background: #333; padding: 30px; border-radius: 15px;
    border: 3px solid #FFD700; width: 90%; max-width: 600px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}
#quiz-question { font-size: 24px; margin-bottom: 25px; }
#quiz-answers { display: flex; flex-direction: column; gap: 15px; }
.answer-btn {
    padding: 15px; font-size: 18px; background: #555; color: #fff;
    border: 2px solid #888; border-radius: 10px; cursor: pointer; transition: background-color 0.2s;
}
.answer-btn:hover { background-color: #777; }
#quiz-result { margin-top: 20px; font-size: 22px; font-weight: bold; height: 30px; }

/* =============================================== */
/* --- Mobile Responsive Styles --- */
/* =============================================== */
@media (max-width: 768px) {
    #ui { font-size: 24px; }
    #instructions { display: none; } /* Hide desktop instructions on mobile */

    #controls-container {
        flex-direction: row; /* Keep side-by-side layout */
        bottom: 10px;
        left: 10px;
        right: 10px;
        align-items: flex-end; /* Align to the bottom */
    }

    .control-btn {
        width: 65px;
        height: 65px;
        font-size: 14px;
        border-radius: 12px;
    }
    #shoot-btn {
        width: 80px;
        height: 80px;
        font-size: 18px;
    }
    #aim-up-btn, #aim-down-btn {
        width: 80px;
        height: 50px;
    }

    #quiz-question { font-size: 18px; }
    .answer-btn { font-size: 16px; padding: 12px; }
    #quiz-result { font-size: 18px; }
}

@media (max-width: 480px) {
    #ui { font-size: 18px; }
    .control-btn { width: 50px; height: 50px; font-size: 12px; }
    #shoot-btn { width: 70px; height: 70px; font-size: 16px; }
    #aim-up-btn, #aim-down-btn { width: 60px; height: 45px; }
    .lr-group { gap: 8px; }
    .control-group { gap: 8px; }
}
