body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #87CEEB; /* Sky blue */
    touch-action: none; /* Prevent browser handling of gestures like pinch-zoom */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 100%);
}

#score-display, #speed-display {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#roost-btn {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 0 12px;
    height: 32px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

#roost-btn:active {
    transform: scale(0.9);
}

#help-btn {
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

#help-btn:active {
    transform: scale(0.9);
}

#help-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

#close-help-btn {
    margin-top: 10px;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background-color: #555;
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

#close-help-btn:active {
    transform: scale(0.95);
}

#joystick-zone {
    width: 100%;
    height: 50%;
    pointer-events: auto;
}

#throttle-container {
    position: absolute;
    left: 20px;
    bottom: 10%;
    height: 40%;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

#throttle-label {
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    margin-bottom: 10px;
    font-size: 14px;
}

#throttle-slider {
    width: 30px;
    height: 100%;
    background: transparent;
    cursor: pointer;
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.instructions-panel {
    background: rgba(20, 25, 30, 0.95);
    padding: 30px;
    border-radius: 20px;
    color: white;
    max-width: 85%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions-panel h2 {
    margin-top: 0;
    color: #ffaa00;
    font-size: 28px;
    margin-bottom: 20px;
}

.control-group {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.control-group h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #87CEEB;
}

.control-group p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #ddd;
}

.control-group ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    color: #ddd;
}

.control-group li {
    margin-bottom: 5px;
}

#start-btn {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background-color: #d32f2f;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

#start-btn:active {
    transform: scale(0.95);
}