/* Route 66 Game Styles */
#route66-game-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #000020;
    border: 10px solid #FFFFFF;
    padding: 15px;
    width: 100%;
    /* Flexible width */
    max-width: 776px;
    /* Max width for desktop */
    aspect-ratio: 1 / 1;
    /* Maintain square aspect ratio */
    height: auto;
    /* Let aspect-ratio control height */
    margin: 20px auto;
    box-sizing: border-box;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    align-items: center;
    justify-content: center;
}

#title-screen,
#game-screen {
    width: 100%;
}

#title-screen {
    text-align: center;
    border: 10px dotted #FF00FF;
    padding: 30px 20px;
}

#title-screen h1 {
    font-size: 3.5em;
    color: #FF0000;
    text-shadow: 3px 3px #000000;
}

#title-screen .subtitle {
    font-size: 1.6em;
    color: #00FF00;
    margin-top: 20px;
    margin-bottom: 40px;
}

#begin-journey-button {
    font-family: inherit;
    font-size: 1.2em;
    padding: 15px 35px;
    background-color: #D00000;
    color: #FFFFFF;
    border: 4px outset #FFFFFF;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s ease;
}

#begin-journey-button:hover {
    background-color: #00FF00;
    color: #000000;
}

#game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

#odometer {
    min-width: 280px;
    margin-bottom: 15px;
    background-color: #000;
    border: 2px solid #fff;
    padding: 8px 12px;
    text-align: center;
}

#odometer p {
    display: inline-block;
    margin: 0 10px;
    color: #fff;
    font-size: 0.9em;
}

#map-container {
    position: relative;
    width: 100%;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

#route-map {
    display: block;
    width: 100%;
    height: auto;
}

#car {
    width: 40px;
    height: 40px;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: top 1s linear, left 1s linear;
    z-index: 2;
    background-image: url('../images/car.png');
    /* Adjusted path for CSS file location */
    background-size: contain;
}

#fun-fact-popup {
    display: none;
    position: relative;
    width: 95%;
    max-width: 500px;
    margin: 10px auto;
    background-color: #000020;
    border: 2px solid #00FFFF;
    border-radius: 8px;
    padding: 15px;
    z-index: 10;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#fun-fact-popup h2,
#fun-fact-popup p,
#fun-fact-popup button {
    font-family: 'Press Start 2P', cursive;
    text-align: center;
}

#fun-fact-popup h2 {
    font-size: 1.2em;
    color: #FFFF00;
}

#fun-fact-popup p {
    font-size: 0.9em;
    color: #FFFFFF;
    flex-grow: 1;
}

#fun-fact-popup button {
    font-size: 1em;
    padding: 8px 15px;
    background-color: #00FF00;
    color: #000000;
}

#restart-journey-button {
    display: none;
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 11;
    padding: 8px 15px;
    background-color: #AA0000;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 0.9em;
    border: 2px outset #FFCCCC;
    cursor: pointer;
}

#restart-journey-button:hover {
    background-color: #FF0000;
}

#end-game-popup,
#thank-you-screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);

}

.game-finish-image {
    max-width: 90%;
    max-height: 50%;
}

#end-game-content {
    visibility: hidden;
    margin-top: 20px;
    padding: 20px;
    background-color: #000020;
    color: #fff;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #FFFF00;
}



#end-game-popup #end-game-content button#restart-button:hover {
    background-color: #00FF00;
    /* Green on hover */
}

#end-game-popup #end-game-content h2,
#end-game-popup #end-game-content p {
    font-family: 'Press Start 2P', cursive;
    background: none;
    border: none;
    padding: 5px;
    margin-bottom: 15px;
}

#end-game-popup #end-game-content h2 {
    font-size: 1.8em;
    color: #FFFF00;
}

#end-game-popup #end-game-content p {
    font-size: 1em;
    color: #FFFFFF;
}

#end-game-popup #end-game-content #final-distance {
    color: #00FF00;
    font-weight: bold;
}

#end-game-popup #end-game-content button#restart-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.1em;
    padding: 12px 25px;
    background-color: #FFFF00;
    /* Yellow background */
    color: #000000;
    /* Black text */
    border: 3px outset #FFFFFF;
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

#end-game-popup #end-game-content button#restart-button:hover {
    background-color: #00FF00;
    /* Green on hover */
}

/* --- MOBILE & RESPONSIVE STYLES --- */
/* Apply these styles on screens 768px wide or smaller (tablets & phones) */
@media (max-width: 768px) {

    /* --- General Site Adjustments --- */
    /* Note: Some general site adjustments might be better placed in style.css if they affect more than just the game */

    /* --- Route 66 Game Adjustments --- */
    #route66-game-wrapper {
        /* Override desktop fixed dimensions for mobile */
        width: auto;
        /* Let it fit the screen width */
        height: auto;
        /* Let content determine the height */
        min-height: 85vh;
        /* *** THE CRITICAL FIX *** */

        /* Adjustments for smaller screens */
        padding: 10px;
        border-width: 5px;
        margin: 10px;
        /* Add some space from screen edges */
    }

    #title-screen h1 {
        font-size: 2.5em;
        /* Smaller game title */
    }

    #title-screen .subtitle {
        font-size: 1.2em;
        /* Smaller subtitle */
    }

    #begin-journey-button {
        font-size: 1.1em;
        padding: 12px 25px;
    }

    #odometer {
        min-width: 95%;
        /* Take up more width */
        padding: 5px;
    }

    #odometer p {
        font-size: 0.8em;
        /* Smaller odometer text */
        margin: 0 5px;
    }

    #fun-fact-popup {
        padding: 10px;
        min-height: 160px;
        /* Adjust min height for mobile */
    }

    #fun-fact-popup h2 {
        font-size: 1.1em;
    }

    #fun-fact-popup p {
        font-size: 0.8em;
        line-height: 1.3;
    }

    #fun-fact-popup button {
        font-size: 0.9em;
    }

    #restart-journey-button {
        font-size: 0.8em;
        padding: 4px 8px;
        bottom: 5px;
        right: 5px;
    }

    /* --- Game Instructional Prompt --- */
    .game-prompt {
        font-family: 'Arial', sans-serif;
        /* Use a clean, readable font */
        color: #cccccc;
        /* A light grey color */
        font-size: 0.9em;
        font-style: italic;
        margin-top: 15px;
        text-align: center;
        opacity: 1;
        /* Start visible */
        transition: opacity 0.5s ease;
        /* Add a fade transition */
    }

    .game-finish-image {
        max-height: 40%;
        /* Adjust finish image size */
    }

    #end-game-popup #end-game-content {
        width: 95%;
        padding: 15px;
        margin-top: 10%;
        /* Adjust content position */
    }

    /* --- NEW RULE FOR FINAL SCREEN TEXT --- */
    #end-game-popup #end-game-content h2 {
        font-size: 1.4em !important;
        /* Reduce font size for "Congratulations!" */
    }

    #end-game-popup #end-game-content p {
        font-size: 0.8em !important;
        /* Reduce font size for other text */
    }

    #end-game-popup #end-game-content button#restart-button {
        font-size: 1em !important;
        /* Reduce button font size */
        padding: 10px 20px;
    }

    /* --- Fix for "Pesky" Image --- */
    .intro-section img {
        width: 100%;
        /* Make the image responsive */
        height: auto;
    }
}