body {
    background-color: #333;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden; 
}

#game-container {
    position: relative;
    transform-origin: center center;
    flex-shrink: 0;
    /* Added hidden overflow so scaled elements don't bleed out */
    overflow: hidden; 
}

canvas {
    background-color: #d1f1f9; /* Light blue snow */
    display: block;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 50; /* Ensure this is above HUD and Mobile Controls */
}

h1 {
    font-size: 3em;
    color: #ffcc00;
    text-shadow: 3px 3px 0 #e64a19;
    margin-bottom: 20px;
}

p {
    font-size: 1em;
    line-height: 1.5;
    max-width: 80%;
}

button {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2em;
    padding: 15px 30px;
    margin-top: 20px;
    background-color: #4CAF50;
    color: white;
    border: 3px solid #388E3C;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #45a049;
}

.menu-options { margin-top: 40px; }
.menu-options button {
    background-color: #0288d1;
    border-color: #01579b;
    font-size: 0.8em;
    padding: 10px 20px;
}
.menu-options button:hover { background-color: #0277bd; }

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 1em;
    color: #1a237e;
    text-shadow: 1px 1px 0 #fff;
    pointer-events: none;
    z-index: 5;
}

#left-hud, #right-hud { flex-basis: 33%; }
#right-hud { text-align: right; }
#mode-indicator {
    flex-basis: 33%;
    text-align: center;
    color: #ffcc00; 
    text-shadow: 2px 2px 0px #e64a19; 
    font-weight: bold;
}

/* Modal Styles */
.modal {
    position: absolute; /* Changed to absolute to scale properly with the game container */
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #424242;
    padding: 30px;
    border: 5px solid #757575;
    width: 50%;
    max-width: 600px;
    text-align: center;
    position: relative;
}

.close-button {
    color: #aaa; position: absolute;
    top: 10px; right: 20px;
    font-size: 28px; font-weight: bold;
}
.close-button:hover, .close-button:focus {
    color: white; text-decoration: none; cursor: pointer;
}

#leaderboard-list { list-style: none; padding: 0; text-align: left; }
#leaderboard-list li { padding: 8px; font-size: 1.2em; border-bottom: 1px dashed #757575; }
#leaderboard-list li:nth-child(1) { font-weight: bold; color: #ffd700; }
#leaderboard-list li:nth-child(2) { color: #c0c0c0; }
#leaderboard-list li:nth-child(3) { color: #cd7f32; }

#skier-options { display: flex; justify-content: center; gap: 20px; margin-top: 20px; }
.skier-option { font-size: 4em; cursor: pointer; padding: 10px; border-radius: 10px; border: 4px solid transparent; transition: transform 0.2s, border-color 0.2s; }
.skier-option:hover { transform: scale(1.1); }
.skier-option.selected { border-color: #4CAF50; background-color: rgba(255, 255, 255, 0.1); }


/* --- MOBILE & FULLSCREEN MODE STYLES --- */
body.mobile-mode {
    overflow: hidden; 
    touch-action: none; 
    position: fixed;
    width: 100%; height: 100%;
    top: 0; left: 0;
}

#mobile-btn {
    position: fixed;
    top: 10px; left: 10px;
    z-index: 2000;
    background: #333; color: white;
    border: 2px solid white;
    font-size: 10px; padding: 10px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    margin-top: 0; 
}
body.mobile-mode #mobile-btn { display: none; }

#mobile-controls {
    position: absolute; /* Changed to absolute to fit perfectly inside the container */
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; 
    z-index: 10; /* Lower than menus (50), higher than HUD (5) */
    display: none; 
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    box-sizing: border-box;
}

/* Show controls only when in mobile mode AND the game is actually running */
body.mobile-mode.game-playing #mobile-controls {
    display: flex;
}

.mobile-control-btn {
    pointer-events: auto; 
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.15);
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    color: white; font-size: 30px;
    display: flex; justify-content: center; align-items: center;
    user-select: none;
    backdrop-filter: blur(4px);
    margin-bottom: 20px; margin-top: 0;
    transition: transform 0.1s, background 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-control-btn:active { background: rgba(255,255,255,0.4); transform: scale(0.95); }

#mobile-dpad { display: flex; gap: 15px; margin-left: 20px; margin-bottom: 10px; }
#mobile-action { margin-right: 20px; margin-bottom: 10px; }
