@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=JetBrains+Mono:wght@300;400;500&display=swap');

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

body {
    overflow: hidden;
    background: #000011;
    font-family: 'JetBrains Mono', monospace;
    color: #c0e8ff;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

#scene-container canvas {
    display: block;
    touch-action: none;
}

/* Crosshair */
#crosshair {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    transition: all 0.3s ease;
}

#crosshair.highlight svg circle:first-child {
    stroke: #00e5ff;
    stroke-width: 2;
    filter: drop-shadow(0 0 6px #00e5ff);
}

/* HUD Panels */
.hud-panel {
    position: fixed;
    z-index: 20;
    background: rgba(4, 10, 25, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    min-width: 0;
    max-width: 45vw;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.05), inset 0 0 30px rgba(0, 10, 30, 0.3);
}

.panel-header {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 2px;
    color: #00e5ff;
    margin-bottom: 6px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 229, 255, 0.15);
    padding-bottom: 4px;
}

.panel-header.large {
    font-size: 13px;
    letter-spacing: 3px;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#hud-top-left {
    top: 12px; left: 12px;
    animation: fadeSlideRight 0.8s ease;
}

#hud-top-right {
    top: 12px; right: 12px;
    text-align: right;
    animation: fadeSlideLeft 0.8s ease;
}

#hud-bottom-left {
    bottom: 70px; left: 12px;
    animation: fadeSlideUp 0.6s ease;
}

#hud-bottom-right {
    bottom: 70px; right: 12px;
    text-align: right;
    animation: fadeSlideUp 0.6s ease;
}

#hud-bottom-center {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(4, 10, 25, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 4px;
    padding: 8px 16px;
    animation: fadeSlideUp 0.8s ease;
    max-width: 90vw;
}

.speed-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    letter-spacing: 2px;
    color: #00e5ff;
    white-space: nowrap;
}

#speed-readout {
    font-size: 10px;
    color: #00e5ff;
    min-width: 70px;
    text-align: right;
    white-space: nowrap;
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 160px;
    height: 4px;
    background: linear-gradient(90deg, #001a33, #00e5ff);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 8px #00e5ff, 0 0 20px rgba(0, 229, 255, 0.3);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 8px #00e5ff;
    border: none;
    cursor: pointer;
}

/* Controls help */
.control-line {
    font-size: 10px;
    color: rgba(192, 232, 255, 0.7);
}

.key {
    display: inline-block;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 9px;
    color: #00e5ff;
    margin-right: 4px;
    min-width: 44px;
    text-align: center;
}

/* Icon Buttons */
.hud-icons {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-btn {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: #00e5ff;
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover, .icon-btn:active {
    background: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* Side Panel */
.side-panel {
    position: fixed;
    z-index: 30;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: min(300px, 85vw);
    max-height: 75vh;
    overflow-y: auto;
    background: rgba(4, 10, 25, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 6px;
    padding: 18px;
    animation: slideInRight 0.4s ease;
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.08);
}

.center-panel {
    right: 50%;
    transform: translate(50%, -50%);
    animation: fadeIn 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 10px; right: 10px;
    background: none;
    border: 1px solid rgba(0, 229, 255, 0.2);
    color: #00e5ff;
    font-size: 14px;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:hover, .close-btn:active {
    background: rgba(0, 229, 255, 0.15);
}

/* Object Panel */
.obj-type {
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(0, 229, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.obj-stats {
    margin: 10px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(0, 229, 255, 0.06);
    font-size: 11px;
}

.stat-label {
    color: rgba(192, 232, 255, 0.5);
}

.obj-desc {
    font-size: 11px;
    color: rgba(192, 232, 255, 0.6);
    line-height: 1.5;
    margin: 10px 0;
    font-style: italic;
}

.travel-btn {
    width: 100%;
    padding: 12px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: #00e5ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.travel-btn:hover, .travel-btn:active {
    background: rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}

/* Search Panel */
#search-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 4px;
    color: #c0e8ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    margin-bottom: 14px;
    transition: all 0.3s ease;
    min-height: 44px;
}

#search-input:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

#search-input::placeholder {
    color: rgba(0, 229, 255, 0.3);
}

.quick-jumps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jump-btn {
    padding: 10px 12px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.12);
    color: #c0e8ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.jump-btn:hover, .jump-btn:active {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.4);
    padding-left: 18px;
}

#search-results {
    max-height: 200px;
    overflow-y: auto;
}

.search-result {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 11px;
    border-radius: 3px;
    transition: all 0.2s;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.search-result:hover, .search-result:active {
    background: rgba(0, 229, 255, 0.1);
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 229, 255, 0.06);
    font-size: 12px;
    gap: 10px;
}

.setting-row label {
    color: rgba(192, 232, 255, 0.7);
    white-space: nowrap;
}

.setting-row select {
    background: rgba(0, 20, 40, 0.8);
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: #c0e8ff;
    padding: 6px 8px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    min-height: 36px;
}

.setting-row input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 24px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
}

.setting-row input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.4);
    transition: all 0.3s;
}

.setting-row input[type="checkbox"]:checked {
    background: rgba(0, 229, 255, 0.2);
    border-color: #00e5ff;
}

.setting-row input[type="checkbox"]:checked::after {
    left: 23px;
    background: #00e5ff;
    box-shadow: 0 0 6px #00e5ff;
}

.setting-row input[type="range"] {
    width: 80px;
}

#fov-val {
    font-size: 11px;
    color: #00e5ff;
    min-width: 30px;
    text-align: right;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    background: #000011;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 20px;
    width: 100%;
    max-width: 400px;
}

.loading-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(24px, 8vw, 42px);
    letter-spacing: clamp(6px, 2vw, 12px);
    color: #00e5ff;
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
    margin-bottom: 4px;
}

.loading-sub {
    font-family: 'Orbitron', sans-serif;
    font-weight: 400;
    font-size: clamp(10px, 3vw, 14px);
    letter-spacing: clamp(4px, 1.5vw, 8px);
    color: rgba(0, 229, 255, 0.5);
    margin-bottom: 40px;
}

.loading-bar-container {
    width: min(300px, 80vw);
    height: 3px;
    background: rgba(0, 229, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, transparent, #00e5ff);
    border-radius: 2px;
    transition: width 0.3s ease;
}

#loading-text {
    font-size: 11px;
    color: rgba(0, 229, 255, 0.4);
    letter-spacing: 2px;
}

/* Footer */
#footer {
    position: fixed;
    bottom: 4px;
    right: 12px;
    z-index: 20;
}

#footer a {
    font-size: 9px;
    color: rgba(0, 229, 255, 0.15);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.3s;
}

#footer a:hover {
    color: rgba(0, 229, 255, 0.6);
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 15;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 16px;
    pointer-events: none;
}

#joystick-zone {
    pointer-events: auto;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-base {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.06);
    border: 2px solid rgba(0, 229, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#joystick-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.5);
    transition: transform 0.05s linear;
}

#mobile-buttons {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.06);
    border: 2px solid rgba(0, 229, 255, 0.2);
    color: #00e5ff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
    background: rgba(0, 229, 255, 0.2);
    border-color: #00e5ff;
}

/* Animations */
@keyframes fadeSlideRight {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideLeft {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateY(-50%) translateX(30px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 10, 30, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 2px;
}

/* ---- Mobile-specific adjustments ---- */
@media (max-width: 768px) {
    .hud-panel {
        font-size: 9px;
        padding: 6px 8px;
        max-width: 40vw;
    }

    .panel-header {
        font-size: 7px;
        letter-spacing: 1.5px;
        margin-bottom: 4px;
        padding-bottom: 3px;
    }

    .panel-header.large {
        font-size: 11px;
        letter-spacing: 2px;
    }

    #hud-top-left {
        top: 8px; left: 8px;
    }

    #hud-top-right {
        top: 8px; right: 8px;
    }

    #hud-bottom-left {
        bottom: 170px; left: 8px;
        max-width: 50vw;
    }

    #hud-bottom-right {
        bottom: 170px; right: 8px;
    }

    #hud-bottom-center {
        bottom: 8px;
        padding: 6px 10px;
        gap: 6px;
    }

    input[type="range"] {
        width: 80px;
    }

    #speed-readout {
        font-size: 9px;
        min-width: 55px;
    }

    .side-panel {
        width: min(280px, 90vw);
        max-height: 65vh;
        padding: 14px;
    }

    .center-panel {
        right: 50%;
        transform: translate(50%, -50%);
    }

    #crosshair {
        display: none;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    #footer {
        bottom: 2px;
        right: 50%;
        transform: translateX(50%);
    }

    .setting-row input[type="range"] {
        width: 60px;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .hud-panel {
        font-size: 8px;
        padding: 4px 6px;
        max-width: 42vw;
    }

    .side-panel {
        width: 95vw;
        right: 2.5vw;
    }

    .center-panel {
        right: 50%;
        transform: translate(50%, -50%);
    }

    #hud-bottom-center {
        padding: 4px 8px;
    }

    input[type="range"] {
        width: 60px;
    }

    .speed-label {
        display: none;
    }
}