html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

canvas {
    display: block;
    touch-action: none;
    height: 100%;
    width: 100%;
}

/* Splash Screen */
#splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: not-allowed;
    transition: opacity 1.8s ease, transform 1.8s ease, filter 1.8s ease;
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
}

#splash.ready {
    cursor: pointer;

}

#splash.ready>#splash-sub {
    font-size: 1.7em;
    text-align: center;
}

#splash.exit {
    opacity: 0;
    transform: scale(1.4);
    filter: blur(30px);
    pointer-events: none;
}

#splash-title {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: clamp(28px, 6vw, 72px);
    color: #fff;
    text-shadow:
        0 0 10px #ff0055,
        0 0 30px #ff0055,
        0 0 60px #00ccff,
        0 0 100px #00ccff;
    letter-spacing: 0.3em;
    animation: pulse 2.5s ease-in-out infinite;
    user-select: none;
}

#splash-sub {
    font-family: 'Courier New', monospace;
    font-size: clamp(11px, 2vw, 18px);
    color: rgba(255, 255, 255, 0.5);
    margin-top: 40px;
    letter-spacing: 0.5em;
    animation: breathe 3s ease-in-out infinite;
    user-select: none;
}

#splash-player-name {
    font-family: 'Courier New', monospace;
    font-size: clamp(13px, 2.5vw, 20px);
    color: rgba(0, 204, 255, 0.8);
    margin-top: 18px;
    letter-spacing: 0.2em;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: auto;
    z-index: 100005;
    position: relative;
    margin-bottom: 4em;
}

#splash-player-name.visible {
    opacity: 1;
}

#splash-edit-name-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 204, 255, 0.25);
    border-radius: 4px;
    padding: 3px 10px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    position: relative;
    z-index: 100005;
}

#splash-edit-name-btn:hover {
    background: rgba(0, 204, 255, 0.15);
    border-color: rgba(0, 204, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
}

/* Name Edit Modal */
#name-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#name-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#name-modal-title {
    font-family: 'Courier New', monospace;
    font-size: clamp(14px, 3vw, 24px);
    color: #fff;
    text-shadow: 0 0 10px #ff0055, 0 0 30px #00ccff;
    letter-spacing: 0.3em;
    margin-bottom: 36px;
}

#name-modal-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

#name-modal-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 204, 255, 0.3);
    border-radius: 6px;
    padding: 10px 16px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: center;
    outline: none;
    width: 240px;
}

#name-modal-color-label {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.2em;
}

#name-modal-color {
    width: 60px;
    height: 30px;
    border: 1px solid rgba(0, 204, 255, 0.3);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

#name-modal-save {
    margin-top: 8px;
    background: rgba(0, 204, 255, 0.15);
    border: 1px solid rgba(0, 204, 255, 0.4);
    border-radius: 6px;
    padding: 10px 32px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 0.2em;
    cursor: pointer;
}

#name-modal-close {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
}

#splash-progress-track {
    width: clamp(180px, 40vw, 320px);
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 30px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#splash-progress-track.visible {
    opacity: 1;
}

#splash-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff0055, #00ccff);
    border-radius: 2px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.5), 0 0 16px rgba(0, 204, 255, 0.3);
}

#splash-progress-text {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 10px;
    letter-spacing: 0.2em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#splash-progress-text.visible {
    opacity: 1;
}

#splash-ring {
    width: clamp(80px, 15vw, 160px);
    height: clamp(80px, 15vw, 160px);
    border: 2px solid rgba(255, 0, 85, 0.3);
    border-radius: 50%;
    margin-bottom: 50px;
    animation: spin 8s linear infinite, ringPulse 3s ease-in-out infinite;
    box-shadow:
        0 0 15px rgba(255, 0, 85, 0.2),
        inset 0 0 15px rgba(0, 204, 255, 0.1);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
        text-shadow: 0 0 10px #ff0055, 0 0 30px #ff0055, 0 0 60px #00ccff, 0 0 100px #00ccff;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 20px #ff0055, 0 0 50px #ff0055, 0 0 80px #00ccff, 0 0 130px #00ccff;
    }
}

@keyframes breathe {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes ringPulse {

    0%,
    100% {
        border-color: rgba(255, 0, 85, 0.3);
    }

    50% {
        border-color: rgba(0, 204, 255, 0.5);
    }
}

/* UI Overlay Styling */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(circle, transparent 40%, #000 120%);
    z-index: 10;
}

#text {
    position: fixed;
    bottom: 30px;
    left: 30px;
    color: #fff;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px #fff;
    pointer-events: none;
    z-index: 11;
    opacity: 0.8;
    line-height: 1.4;
}

/* lil-gui container styling to make it transparent/darker */
.lil-gui {
    --background-color: rgba(10, 10, 20, 0.8);
    --text-color: #ddd;
    --title-background-color: #222;
    --widget-color: #444;
    --hover-color: #555;
    --focus-color: #666;
    --number-color: #2cfa98;
    --string-color: #a29bfe;
    font-size: 13px;
}

/* ─── Drone Control Overlays ─── */
#controls-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 0;
    padding: 0 20px 24px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
    pointer-events: none;
    z-index: 100000;
}

#controls-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

#splash.exit~#controls-panel,
#splash.exit+#controls-panel {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: rgba(5, 0, 20, 0.75);
    border: 1px solid rgba(0, 204, 255, 0.15);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 0 20px rgba(0, 204, 255, 0.08),
        inset 0 0 20px rgba(0, 204, 255, 0.03);
}

.control-group.right-stick {
    border-color: rgba(255, 0, 85, 0.15);
    box-shadow:
        0 0 20px rgba(255, 0, 85, 0.08),
        inset 0 0 20px rgba(255, 0, 85, 0.03);
}

.control-label {
    font-family: 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 2px;
}

.control-keys {
    display: grid;
    gap: 4px;
}

.control-keys.keyboard-grid {
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(3, 36px);
}

.key-cap {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 204, 255, 0.25);
    border-radius: 6px;
    text-shadow: 0 0 6px rgba(0, 204, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 204, 255, 0.06);
    transition: all 0.15s ease;
}

.key-cap.accent {
    border-color: rgba(255, 0, 85, 0.3);
    text-shadow: 0 0 6px rgba(255, 0, 85, 0.4);
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.06);
}

.key-cap.empty {
    border: none;
    background: none;
    box-shadow: none;
}

.key-cap.arrow-label {
    font-size: 10px;
    letter-spacing: 0;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.3);
}

/* Joystick visual for touch */
.joystick-hint {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 1.5px dashed rgba(0, 204, 255, 0.25);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-hint.right-style {
    border-color: rgba(255, 0, 85, 0.25);
}

.joystick-hint-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 204, 255, 0.35), rgba(0, 204, 255, 0.1));
    box-shadow: 0 0 12px rgba(0, 204, 255, 0.25);
}

.joystick-hint-inner.right-style {
    background: radial-gradient(circle, rgba(255, 0, 85, 0.35), rgba(255, 0, 85, 0.1));
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.25);
}

.joystick-arrows {
    position: absolute;
    width: 100%;
    height: 100%;
}

.joystick-arrows span {
    position: absolute;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    font-family: 'Courier New', monospace;
}

.joystick-arrows .j-up {
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.joystick-arrows .j-down {
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.joystick-arrows .j-left {
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.joystick-arrows .j-right {
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.joystick-sub-label {
    font-family: 'Courier New', monospace;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.15em;
    margin-top: 4px;
    text-align: center;
    line-height: 1.5;
}

/* Drone HUD badge */
.drone-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.drone-icon {
    width: 16px;
    height: 16px;
    opacity: 0.5;
}

.drone-icon svg {
    width: 100%;
    height: 100%;
}

/* Divider line between groups */
.control-divider {
    width: 1px;
    height: 100%;
    min-height: 80px;
    background: linear-gradient(to bottom, transparent, rgba(0, 204, 255, 0.12), transparent);
    align-self: center;
}

/* Mouse hint */
.mouse-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mouse-icon {
    width: 20px;
    height: 32px;
    border: 1.5px solid rgba(0, 204, 255, 0.25);
    border-radius: 10px;
    position: relative;
}

.mouse-icon::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: rgba(0, 204, 255, 0.3);
    border-radius: 1px;
}

.mouse-icon::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: rgba(0, 204, 255, 0.15);
    border-radius: 1px;
}

.version {
    color: white;
    font-size: small;
}