body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    user-select: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through except on interactive elements */
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 2px black;
}

#hud-height {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
}

#interaction-prompt {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid white;
}

#message-overlay {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    text-shadow: 0 0 10px black, 0 0 20px black;
    color: #f1c40f;
    text-align: center;
    transition: opacity 0.3s;
}

#troll-choice-ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 20, 0.95);
    padding: 40px;
    border-radius: 15px;
    border: 2px solid #3498db;
    text-align: center;
    pointer-events: auto; /* Allow clicking */
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

#troll-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 28px;
}

.troll-btn {
    display: block;
    width: 250px;
    margin: 10px auto;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background: #2c3e50;
    color: white;
    border: 2px solid #2980b9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.troll-btn:hover {
    background: #3498db;
    transform: scale(1.05);
}

#start-screen, #end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 100;
}

#start-screen h1, #end-screen h1 {
    font-size: 60px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

#btn-start {
    margin-top: 40px;
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
    transition: all 0.2s;
}

#btn-start:hover {
    background: #2ecc71;
    transform: scale(1.05);
}

#end-stats {
    font-size: 24px;
    line-height: 1.8;
    text-align: left;
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#touch-look-zone {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    pointer-events: auto;
}

#joystick-base {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
}

#joystick-stick {
    position: absolute;
    top: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
}

#btn-jump-mobile {
    position: absolute;
    bottom: 50px;
    right: 50px;
    width: 80px;
    height: 80px;
    background: rgba(46, 204, 113, 0.5);
    border: 2px solid rgba(46, 204, 113, 0.8);
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 16px;
    pointer-events: auto;
    touch-action: none;
}

@media (max-width: 768px), (pointer: coarse) {
    #mobile-controls {
        display: block !important;
    }
    #crosshair {
        display: none !important;
    }
    #btn-start {
        font-size: 18px;
        padding: 10px 20px;
    }
}
