* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}

#space-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: rgba(0, 5, 15, 0.9);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(74, 158, 255, 0.3);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sort-btn {
    width: 100%;
    padding: 8px 12px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.sort-btn:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.5);
}

.sort-label {
    color: #88aaff;
}

#sort-mode {
    color: #4a9eff;
    font-weight: 600;
}

/* Old home button style removed */

#object-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#object-list::-webkit-scrollbar {
    width: 6px;
}

#object-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

#object-list::-webkit-scrollbar-thumb {
    background: rgba(74, 158, 255, 0.4);
    border-radius: 3px;
}

.object-category {
    margin-bottom: 15px;
}

.category-header {
    font-size: 0.75rem;
    color: #88aaff;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    gap: 8px;
}

.category-header:hover {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
}

.category-title {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-title::after {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.3s;
}

.category-header.collapsed .category-title::after {
    transform: rotate(-90deg);
}

.category-sort-btn {
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.25);
    border-radius: 4px;
    color: #4a9eff;
    font-size: 0.65rem;
    cursor: pointer;
    padding: 3px 8px;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.category-sort-btn:hover {
    background: rgba(74, 158, 255, 0.3);
    border-color: rgba(74, 158, 255, 0.5);
}

.category-items {
    padding: 5px 0;
}

.category-items.collapsed {
    display: none;
}

.object-item {
    padding: 8px 12px;
    margin: 3px 5px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(74, 158, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    color: #aaccff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.object-item:hover {
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.4);
    color: #fff;
}

.object-item.active {
    background: rgba(74, 158, 255, 0.3);
    border-color: rgba(74, 158, 255, 0.8);
    color: #fff;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.2);
}

.object-item::before {
    content: '•';
    font-size: 1.5rem;
    line-height: 0;
}

.object-info {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.object-distance {
    font-size: 0.7rem;
    color: #88aaff;
    opacity: 0.8;
}

.size-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #4a9eff, #9d4aff);
    transition: width 0.3s ease;
    opacity: 0.6;
}

.size-tag {
    font-size: 0.7rem;
    color: #4a9eff;
    font-weight: 600;
}

.object-item.star::before { color: #FFDD44; }
.object-item.planet::before { color: #4a9eff; }
.object-item.moon::before { color: #AAAAAA; }
.object-item.blackhole::before { content: '◉'; color: #FF4400; }
.object-item.galaxy::before { content: '◯'; color: #FFEEDD; }
.object-item.nebula::before { content: '○'; color: #FFAA88; }
.object-item.cluster::before { content: '✦'; color: #AAAADD; }

#header {
    position: absolute;
    top: 20px;
    left: 300px; /* Moved right to clear sidebar */
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 25; /* higher than sidebar if needed, but sidebar is left:0 */
}

.header-row {
    display: flex;
    align-items: center;
    gap: 30px;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 20px;
    color: #4a9eff;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

@keyframes pulseBrightBorder {
    0% {
        border-color: rgba(74, 158, 255, 0.4);
        box-shadow: 0 0 0 rgba(74, 158, 255, 0);
    }
    50% {
        border-color: rgba(74, 158, 255, 1);
        box-shadow: 0 0 15px rgba(74, 158, 255, 0.8), inset 0 0 10px rgba(74, 158, 255, 0.5);
    }
    100% {
        border-color: rgba(74, 158, 255, 0.4);
        box-shadow: 0 0 0 rgba(74, 158, 255, 0);
    }
}

.pulse-border {
    animation: pulseBrightBorder 1.5s ease-in-out infinite;
}

.header-btn:hover {
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.8);
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
}

.header-btn .icon {
    font-size: 1.1rem;
}

.header-btn .text {
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

#header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #4a9eff 0%, #9d4aff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(74, 158, 255, 0.5);
    margin: 0;
}

#zoom-level {
    font-size: 0.9rem;
    color: #88aaff;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#controls-info {
    position: absolute;
    bottom: 20px;
    left: 300px;
    pointer-events: auto;
    background: rgba(0, 10, 30, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.control-hint {
    font-size: 0.85rem;
    color: #aaccff;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#guide-line-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.key {
    background: rgba(74, 158, 255, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #fff;
    border: 1px solid rgba(74, 158, 255, 0.5);
    min-width: 50px;
    text-align: center;
}

#body-info {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 300px;
    background: rgba(0, 10, 30, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    border: 1px solid rgba(74, 158, 255, 0.4);
    padding: 25px;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#body-info.hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
    pointer-events: none;
}

#body-info h2 {
    font-size: 1.5rem;
    color: #4a9eff;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#body-details {
    font-size: 0.9rem;
    line-height: 1.6;
}

#body-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
}

#body-details .detail-label {
    color: #88aaff;
}

#body-details .detail-value {
    color: #fff;
    font-weight: 500;
}

#close-info {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #88aaff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

#close-info:hover {
    background: rgba(74, 158, 255, 0.3);
    color: #fff;
}

#hover-tooltip {
    position: fixed;
    pointer-events: none;
    background: rgba(0, 10, 30, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 10px;
    border: 1px solid rgba(74, 158, 255, 0.4);
    padding: 12px 16px;
    z-index: 100;
    transition: opacity 0.2s ease;
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#hover-tooltip.hidden {
    opacity: 0;
    visibility: hidden;
}

#tooltip-name {
    font-size: 1rem;
    color: #4a9eff;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tooltip-content {
    font-size: 0.8rem;
    color: #aaccff;
    line-height: 1.5;
}

#tooltip-content .tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin: 3px 0;
}

#tooltip-content .tooltip-label {
    color: #88aaff;
    font-size: 0.75rem;
}

#tooltip-content .tooltip-value {
    color: #fff;
    font-size: 0.75rem;
    text-align: right;
}

/* Orbit line hover effect */
.orbit-highlight {
    filter: drop-shadow(0 0 5px rgba(74, 158, 255, 0.8));
}

#scale-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    pointer-events: auto;
    text-align: right;
}

.scale-bar {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #4a9eff, transparent);
    margin-bottom: 8px;
    margin-left: auto;
}

#scale-label {
    font-size: 0.8rem;
    color: #88aaff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#scale-toggle-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.toggle-btn {
    background: rgba(0, 10, 30, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 20px;
    padding: 10px 20px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none; /* For when used as anchor tag */
}

.toggle-btn:hover {
    background: rgba(74, 158, 255, 0.3);
    border-color: rgba(74, 158, 255, 0.6);
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}

.toggle-label {
    color: #88aaff;
}

#scale-mode,
#camera-lock-mode {
    color: #4a9eff;
    font-weight: 600;
}

#view-mode {
    color: #4a9eff;
    font-weight: 600;
}

/* Size comparison list item styles */
.object-details .size-bar {
    display: inline-block;
    height: 4px;
    background: linear-gradient(90deg, #4a9eff, #88aaff);
    border-radius: 2px;
    margin-left: 8px;
    vertical-align: middle;
    min-width: 5px;
}

.loading-overlay {
    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: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    font-size: 1.2rem;
    color: #4a9eff;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#home-indicator {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#home-indicator.hidden {
    opacity: 0;
    visibility: hidden;
}

#home-arrow {
    font-size: 2.5rem;
    color: #4a9eff;
    text-shadow: 0 0 15px rgba(74, 158, 255, 1), 0 0 30px rgba(74, 158, 255, 0.5);
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(74, 158, 255, 0.8));
}

#home-label {
    font-size: 0.7rem;
    color: #4a9eff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
    background: rgba(0, 10, 30, 0.9);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(74, 158, 255, 0.5);
    white-space: nowrap;
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
}

#info-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    animation: slideInRight 0.4s ease-out;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: auto;
}

#info-popup.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#info-popup-content {
    background: rgba(0, 20, 40, 0.95);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 8px;
    padding: 20px 24px;
    min-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 158, 255, 0.2);
    position: relative;
}

#info-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #88aaff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

#info-popup-close:hover {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

#info-popup h3 {
    margin: 0 0 12px 0;
    color: #4a9eff;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#info-popup p {
    margin: 0 0 10px 0;
    color: #aaccff;
    font-size: 0.9rem;
    line-height: 1.5;
}

#info-popup p:last-child {
    margin-bottom: 0;
}

.info-contact {
    font-size: 0.85rem !important;
    color: #88aaff !important;
}

.info-contact a {
    color: #4a9eff;
    text-decoration: none;
    transition: color 0.2s;
}

.info-contact a:hover {
    color: #6bbfff;
    text-decoration: underline;
}

#info-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 20, 40, 0.9);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 50%;
    color: #4a9eff;
    font-size: 1.2rem;
    font-weight: bold;
    font-style: italic;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

#info-button:hover {
    background: rgba(74, 158, 255, 0.3);
    border-color: rgba(74, 158, 255, 0.6);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.4);
}

#info-button.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Timeline Panel ─────────────────────────────────────────────────── */

#timeline-panel {
    position: absolute;
    bottom: 70px; /* above the toggle-buttons row at bottom: 20px */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 10, 30, 0.88);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 16px;
    padding: 12px 18px 14px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 480px;
    z-index: 30;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

#timeline-panel.hidden {
    display: none;
}

#tl-date-display {
    font-size: 0.9rem;
    color: #cce0ff;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

#timeline-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tl-btn {
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.35);
    border-radius: 8px;
    color: #cce0ff;
    font-size: 0.95rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 34px;
    text-align: center;
    line-height: 1.2;
}

.tl-btn:hover {
    background: rgba(74, 158, 255, 0.35);
    border-color: rgba(74, 158, 255, 0.7);
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.tl-play {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.6);
    font-size: 1.05rem;
    padding: 5px 14px;
}

.tl-now-btn {
    font-size: 0.8rem;
    padding: 5px 12px;
}

#tl-speed-label {
    color: #88aaff;
    font-size: 0.8rem;
    min-width: 80px;
    text-align: left;
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
}

#tl-scrubber-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.tl-scrubber-label {
    font-size: 0.75rem;
    color: #88aaff;
    user-select: none;
    white-space: nowrap;
}

#tl-scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(74, 158, 255, 0.25);
    outline: none;
    cursor: pointer;
}

#tl-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(74, 158, 255, 0.6);
}

#tl-scrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(74, 158, 255, 0.6);
}

#tl-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#tl-date-picker {
    background: rgba(0, 10, 30, 0.7);
    border: 1px solid rgba(74, 158, 255, 0.35);
    border-radius: 8px;
    color: #cce0ff;
    font-size: 0.82rem;
    padding: 5px 8px;
    cursor: pointer;
    outline: none;
    color-scheme: dark;
}

#tl-date-picker:focus {
    border-color: rgba(74, 158, 255, 0.7);
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #header h1 {
        font-size: 1.8rem;
    }
    
    #body-info {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
    
    #controls-info {
        bottom: 80px;
    }
    
    #scale-indicator {
        bottom: 80px;
    }
}
