body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
canvas {
    display: block;
    width: 100%;
    height: 100%;
}
#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    backdrop-filter: blur(5px);
    transition: opacity 180ms ease, transform 180ms ease;
}
.control-group {
    margin: 12px 0;
}
input[type="range"] {
    width: 160px;
    vertical-align: middle;
    cursor: pointer;
}
label {
    display: inline-block;
    width: 100px;
    font-weight: 500;
}
.value {
    display: inline-block;
    width: 40px;
    text-align: right;
    margin-left: 10px;
    color: #4CAF50;
}
h3 {
    margin: 0 0 10px 0;
    color: #4CAF50;
}
small {
    display: block;
    color: #aaa;
    margin-top: 15px;
    font-size: 12px;
}

.controls-close, #controls .controls-close {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
}
.controls-close:hover {
    background: rgba(255,255,255,0.12);
}

.controls-open, #controlsOpen {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    z-index: 40;
}
.controls-open:hover {
    background: rgba(0,0,0,0.85);
}

#controls.closed {
    opacity: 0;
    transform: translateX(-8px) scale(0.98);
    pointer-events: none;
}

#controls:not(.closed) + #controlsOpen {
    display: none !important;
}

.pause-overlay, #pauseOverlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 18px 28px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 20px;
    z-index: 60;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.06);
}

/* HUD legend for controls (small overlay) */
.hud-legend, #hudLegend {
    position: absolute;
    right: 30px;
    bottom: 30px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1.3;
    z-index: 60;
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.hud-legend .hud-row { margin: 3px 0; color: #ddd; }
.hud-legend strong { color: #fff; font-weight: 700; }

/* Hide HUD on mobile devices */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .hud-legend, #hudLegend {
        display: none !important;
    }
}