/**
 * Update HUD display with current game state
 */
export function updateHUD(state) {
    const canvasTime = document.getElementById("canvas-time");
    const canvasKey = document.getElementById("canvas-key");
    const canvasRounds = document.getElementById("canvas-rounds");
    
    if (canvasTime) {
        canvasTime.textContent = `${state.runtime.elapsedSeconds.toFixed(1)}s`;
    }
    if (canvasKey) {
        canvasKey.textContent = state.runtime.hasKey ? "yes" : "no";
    }
    if (canvasRounds) {
        canvasRounds.textContent = String(state.runtime.roundsCompleted);
    }
}

/**
 * Apply low-time warning styling
 */
export function setLowTimeWarning(isLowTime) {
    const canvasTime = document.getElementById("canvas-time");
    if (!canvasTime) return;
    
    if (isLowTime) {
        canvasTime.classList.add("low-time");
    } else {
        canvasTime.classList.remove("low-time");
    }
}

/**
 * Update animated sphere (visual indicator)
 */
export function updateSphereMesh(sphere, level) {
    if (!sphere) return;
    
    sphere.rotation.y += 0.01;
    sphere.scaling.x = 1 + (level - 1) * 0.05;
    sphere.scaling.z = 1 + (level - 1) * 0.05;
}
