/* ===== Reset & Base ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: #000;
}

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

/* ===== Loading Screen ===== */
#loading {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a4e 40%, #2d1b69 70%, #0a0e27 100%);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: #fff;
}

.loader-content p {
    margin-top: 1.2rem;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    opacity: 0.85;
}

.spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #7c6aef;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== HUD Overlay ===== */
#hud {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 10;
    pointer-events: auto;
    /* Allow hovering anywhere in the container */
    display: flex;
    flex-direction: column-reverse;
    /* Button on bottom, panel pops up above it */
    align-items: flex-start;
    gap: 16px;
    /* create a transparent padded zone to keep hover active */
    padding: 20px;
    margin: -20px;
}

#hud-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 14, 39, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(124, 106, 239, 0.4);
    border-radius: 20px;
    padding: 10px 18px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

#hud-toggle-btn:hover {
    background: rgba(30, 35, 75, 0.85);
    border-color: rgba(150, 130, 255, 0.6);
}

#hud-toggle-btn svg {
    color: #c4bfff;
}

#hud-controls {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(124, 106, 239, 0.35);
    border-radius: 16px;
    padding: 20px 24px;
    color: #e0dff5;
    min-width: 260px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

    /* Initial state for GSAP */
    visibility: hidden;
    opacity: 0;
    /* We will animate position/scale with GSAP */
}

#hud-controls h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: #fff;
    letter-spacing: 0.02em;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 400;
    padding: 3px 0;
    color: rgba(224, 223, 245, 0.8);
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 3px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #c4bfff;
    background: rgba(124, 106, 239, 0.18);
    border: 1px solid rgba(124, 106, 239, 0.35);
    border-radius: 6px;
    letter-spacing: 0.04em;
}

/* ===== Speed Indicator ===== */
#speed-indicator {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10;
    background: rgba(10, 14, 39, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(124, 106, 239, 0.25);
    border-radius: 12px;
    padding: 12px 20px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}