body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
    /* Dark background for desktop margins */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    position: fixed;
    /* Prevent scrolling on mobile */
    inset: 0;
}

#gameContainer {
    position: relative;
    width: 100%;
    /* max-width removed to fill screen */
    height: 100%;
    overflow: hidden;
}

canvas {
    /* Top, right, bottom, left = 0 */
    touch-action: none;
    /* Prevent default touch actions like scrolling */
    display: block;
    background-color: #70c5ce;
    /* Sky color fallback */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* UI Elements */
.hidden {
    display: none !important;
}

#leaderboardOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.leaderboard-container {
    background: #fdf6e3;
    /* Parchment color */
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    font-family: 'Luckiest Guy', cursive;
    border: 4px solid #e86101;
    /* Orange border */
    outline: 3px solid #000;
    /* Black outline */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.leaderboard-container h2 {
    margin-top: 0;
    color: #e86101;
    font-size: 1.5rem;
    /* Reduced from 2rem */
    text-shadow: 2px 2px 0 #000;
    -webkit-text-stroke: 1px black;
    margin-bottom: 15px;
}

#leaderboardList {
    margin: 10px 0;
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    border: 2px solid #000;
    border-radius: 10px;
    background: #fff;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 1.1rem;
    color: #333;
}

.leaderboard-item:nth-child(odd) {
    background-color: #f9f9f9;
}

.leaderboard-item:nth-child(1) {
    background-color: #ffd700;
    /* Gold */
    color: #000;
    font-weight: bold;
    border-bottom: 1px solid #daa520;
}

.leaderboard-item:nth-child(2) {
    background-color: #c0c0c0;
    /* Silver */
    color: #000;
    font-weight: bold;
    border-bottom: 1px solid #a9a9a9;
}

.leaderboard-item:nth-child(3) {
    background-color: #cd7f32;
    /* Bronze */
    color: #000;
    font-weight: bold;
    border-bottom: 1px solid #8b4513;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item a {
    color: inherit;
    /* Inherit color from item (important for top 3) */
    text-decoration: none;
    transition: opacity 0.2s;
}

.leaderboard-item a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

#gameOverInput {
    position: absolute;
    top: 70%;
    /* Moved down from 60% */
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
    width: 80%;
    max-width: 300px;
}

#startScreenLeaderboardBtn {
    position: absolute;
    top: 75%;
    /* Positioned below "Tap to Fly" */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    padding: 10px 20px;
    font-size: 1.2rem;
    background: #e86101;
    color: white;
    border: 3px solid #000;
    border-radius: 10px;
    font-family: 'Luckiest Guy', cursive;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: transform 0.1s;
}

#startScreenLeaderboardBtn:active {
    transform: translate(-50%, -50%) scale(0.95);
}



input {
    padding: 10px;
    font-size: 1.2rem;
    border: 3px solid #000;
    border-radius: 10px;
    font-family: 'Luckiest Guy', cursive;
    text-align: center;
}

button {
    padding: 10px;
    font-size: 1.2rem;
    background: #e86101;
    color: white;
    border: 3px solid #000;
    border-radius: 10px;
    font-family: 'Luckiest Guy', cursive;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: transform 0.1s;
}

button:active {
    transform: scale(0.95);
}

button#closeLeaderboard {
    background: #ff4444;
}

#settingsBtn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 50;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 3px solid #000;
}

#settingsMenu {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 50;
    background: #fdf6e3;
    padding: 15px;
    border-radius: 15px;
    border: 3px solid #e86101;
    outline: 2px solid #000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    font-family: 'Luckiest Guy', cursive;
    text-align: center;
    min-width: 250px;
    /* Increased from 200px */
}

#settingsMenu h3 {
    margin: 0 0 15px 0;
    color: #e86101;
    text-shadow: 1px 1px 0 #000;
    -webkit-text-stroke: 1px black;
    font-size: 1.5rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

#volumeSlider {
    width: 100%;
    /* Fill container */
    cursor: pointer;
    accent-color: #e86101;
    height: 20px;
    /* Taller touch target */
}

#closeSettings {
    background: #ff4444;
    padding: 5px 15px;
    font-size: 1rem;
}

.mute-btn {
    background: #e67e22;
    color: white;
    border: 2px solid #d35400;
    padding: 8px 16px;
    font-family: 'Luckiest Guy', cursive;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 5px;
    text-shadow: 1px 1px 0 #d35400;
    transition: transform 0.1s, background 0.1s;
}

.mute-btn:active {
    transform: scale(0.95);
    background: #d35400;
}

.mute-btn.muted {
    background: #95a5a6;
    border-color: #7f8c8d;
    text-shadow: 1px 1px 0 #7f8c8d;
}