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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #e0e0e0;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

canvas#globe-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    z-index: 0;
}

canvas#globe-canvas:active {
    cursor: grabbing;
}

canvas#globe-canvas.has-hover {
    cursor: pointer;
}

/* Title */
.globe-title {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.globe-title h1 {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: rgba(0, 255, 136, 0.7);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    margin: 0;
}

.globe-title .subtitle {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(0, 221, 255, 0.4);
    margin-top: 4px;
}

/* Layer panel */
.layer-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 12px;
    padding: 12px 14px;
    min-width: 180px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.04), inset 0 0 20px rgba(0, 221, 255, 0.02);
    animation: panel-glow 8s ease-in-out infinite;
}

@keyframes panel-glow {
    0%, 100% { border-color: rgba(0, 255, 136, 0.15); }
    50% { border-color: rgba(0, 221, 255, 0.25); }
}

.layer-panel h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(160, 200, 240, 0.7);
    margin-bottom: 12px;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.layer-toggle:hover {
    opacity: 0.8;
}

.layer-toggle input[type="checkbox"] {
    accent-color: #00ff88;
    width: 16px;
    height: 16px;
}

.layer-toggle label {
    font-size: 11px;
    cursor: pointer;
    user-select: none;
}

/* Scrollbar styling for layer panel */
.layer-panel::-webkit-scrollbar {
    width: 4px;
}
.layer-panel::-webkit-scrollbar-track {
    background: transparent;
}
.layer-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.2);
    border-radius: 2px;
}

.layer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.04);
    animation: panel-glow 8s ease-in-out infinite;
}

.legend h4 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(160, 200, 240, 0.5);
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Tooltip */
.tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 15, 30, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(100, 160, 220, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    z-index: 20;
    max-width: 280px;
    transform: translate(12px, -50%);
    transition: opacity 0.15s;
}

.tooltip-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.tooltip-detail {
    color: rgba(180, 200, 220, 0.8);
    font-size: 12px;
}

/* Info panel */
.info-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 320px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: rgba(20, 20, 30, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 12px;
    padding: 20px;
    z-index: 10;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.05), inset 0 0 20px rgba(0, 221, 255, 0.02);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.info-panel.hidden {
    transform: translateX(340px);
    opacity: 0;
    pointer-events: none;
}

.info-panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-panel .subtitle {
    font-size: 12px;
    color: rgba(160, 200, 240, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.info-panel .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(100, 160, 220, 0.1);
    font-size: 13px;
}

.info-panel .stat-label {
    color: rgba(180, 200, 220, 0.6);
}

.info-panel .stat-value {
    color: #fff;
    font-weight: 500;
}

.info-panel .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(180, 200, 220, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.info-panel .close-btn:hover {
    color: #fff;
}

/* Search bar */
.search-bar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.search-bar input {
    width: 300px;
    padding: 10px 16px;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 160, 220, 0.2);
    border-radius: 24px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: rgba(100, 160, 220, 0.5);
}

.search-bar input::placeholder {
    color: rgba(160, 200, 240, 0.4);
}

/* HUD overlay */
.hud {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    z-index: 10;
    pointer-events: none;
}

.hud-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-value {
    font-size: 18px;
    font-weight: 300;
    color: rgba(0, 255, 136, 0.8);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.hud-value.psi-value {
    font-size: 22px;
    font-weight: 400;
    color: rgba(255, 215, 0, 0.9);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.hud-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(0, 221, 255, 0.4);
}

/* Timeline slider */
.timeline {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.04);
    animation: panel-glow 8s ease-in-out infinite;
}

.timeline-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.timeline-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(0, 221, 255, 0.4);
}

.timeline-year {
    font-size: 20px;
    font-weight: 300;
    color: rgba(255, 215, 0, 0.9);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    min-width: 40px;
}

.timeline-epoch {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(0, 255, 136, 0.6);
    margin-left: auto;
}

.timeline-slider {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 255, 136, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    cursor: pointer;
}

.timeline-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    border: none;
    cursor: pointer;
}

.timeline-detail {
    font-size: 11px;
    color: rgba(180, 200, 220, 0.5);
    margin-top: 6px;
    line-height: 1.4;
}

/* Planet navigation bar */
.planet-nav {
    position: absolute;
    bottom: 80px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.planet-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 136, 0.1);
    border-radius: 8px;
    color: rgba(180, 200, 220, 0.6);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.planet-btn:hover {
    background: rgba(20, 20, 30, 0.8);
    border-color: rgba(0, 255, 136, 0.3);
    color: rgba(0, 255, 136, 0.8);
}

.planet-btn.active {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.5);
    color: rgba(0, 255, 136, 0.9);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
}

.planet-icon {
    font-size: 16px;
}

.planet-label {
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 9px;
}

/* ─── Mobile responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .globe-title h1 {
        font-size: 18px;
    }
    .globe-title .subtitle {
        font-size: 10px;
    }

    .layer-panel {
        max-width: 160px;
        font-size: 11px;
        padding: 8px;
        max-height: 50vh;
        overflow-y: auto;
    }
    .layer-panel h3 {
        font-size: 12px;
    }

    .timeline {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 8px;
    }
    .timeline-slider {
        height: 20px;
    }

    .info-panel {
        max-width: 260px;
        font-size: 12px;
    }

    .hud {
        font-size: 10px;
        padding: 4px 8px;
    }

    .tooltip {
        font-size: 11px;
        max-width: 200px;
    }

    .planet-nav {
        gap: 4px;
    }
    .planet-icon {
        font-size: 12px;
    }
    .planet-label {
        display: none;
    }

    .legend {
        font-size: 10px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .globe-title {
        display: none;
    }

    .layer-panel {
        max-width: 130px;
        font-size: 10px;
    }

    .info-panel {
        max-width: 200px;
        font-size: 11px;
    }

    .legend {
        display: none;
    }
}
