/* === GENERAL STYLES === */
body, html {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    background-color: #000;
    font-family: 'Arial', sans-serif;
    color: #00D1FF;
    position: relative; /* Establishes a stacking context */
}

/* === 3D CANVAS === */
#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1; /* Set canvas to the background layer */
    cursor: grab;
}

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

/* === UI OVERLAYS === */
/* Main Title Overlay */
.overlay {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10; /* Ensure it's above the canvas */
    text-align: center;
    pointer-events: none;
    text-shadow: 0 0 10px #00D1FF, 0 0 20px #00D1FF;
}

.overlay h1 {
    font-size: 2em;
    margin: 0;
    font-weight: bold;
}

.overlay p {
    font-size: 1.5em;
    margin: 0;
    letter-spacing: 3px;
}

.brand-title {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    margin: 0;
}

#main-page-logo {
    width: 50px;
    height: auto;
    margin: 0;

    pointer-events: auto;

    /* Неоновое свечение в стиле космоса */
    filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.7));
    
    /* Небольшая анимация при наведении */
    transition: filter 0.3s ease;
}

/* Применяем hover только на устройствах с поддержкой наведения */
@media (hover: hover) {
    #main-page-logo:hover {
        filter: drop-shadow(0 0 12px rgba(0, 200, 255, 0.9));
    }
}

/* Анимация при нажатии для мобильных */
@media (hover: none) {
    #main-page-logo:active {
        filter: drop-shadow(0 0 12px rgba(0, 200, 255, 0.9));
        transform: scale(0.95);
    }
}

#main-page-logo:hover {
    filter: drop-shadow(0 0 12px rgba(0, 200, 255, 0.9));
}


.controls-panel {
    position: fixed; /* Position relative to the viewport */
    top: 20px;
    left: 20px;
    width: 250px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(0, 209, 255, 0.3);
    z-index: 100; /* Set the highest z-index to be on top of everything */
    color: white;
    font-size: 14px;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

.controls-panel.visible {
    opacity: 1;
    visibility: visible;
}

.controls-panel h2 {
    margin-top: 0;
    font-size: 16px;
    text-align: center;
    color: #00D1FF;
    text-shadow: 0 0 5px #00D1FF;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.control-group input[type="range"] {
    width: 100%;
    cursor: pointer;
}


/* === OTHER UI ELEMENTS === */
.planet-label {
    position: absolute;
    color: white;
    font-family: sans-serif;
    font-size: 14px;
    pointer-events: none;
    transform: translate(-50%, -150%);
    white-space: normal;
    z-index: 5; /* Above canvas, but can be below controls if needed */
    width: max-content;
    max-width: 250px; 
    text-align: left; 
    transform-origin: bottom center; /* Базовая точка для свёрнутого состояния */
    transition: transform 0.2s ease-in-out, transform-origin 0.1s ease-in-out;
}

.comet-label {
    position: absolute;
    color: #00D1FF;
    font-family: sans-serif;
    font-size: 14px;
    pointer-events: none;
    transform: translate(-50%, -150%);
    white-space: normal;
    z-index: 5; /* Above canvas, but can be below controls if needed */
    width: max-content;
    max-width: 250px; 
    text-align: left; 
    transform-origin: bottom center; /* Базовая точка для свёрнутого состояния */
    transition: transform 0.2s ease-in-out, transform-origin 0.1s ease-in-out;
    
    background-color: rgba(0, 0, 0, 0.4); /* Полупрозрачный тёмный фон */
    padding: 8px 8px; /* Отступы внутри фона */
    border-radius: 6px; /* Скруглённые углы */
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.7); /* Внешнее свечение */
}

.comet-info {
    max-height: 0;
    max-width: 0;
    overflow: hidden;
    margin-top: 5px;
    transition: 
        max-height 0.3s ease-in-out, 
        max-width 0.3s ease-in-out;
}

.comet-label.expanded {
    transform: translate(-50%, -50%);
    transform-origin: center center; /* Меняем точку опоры на центр */
    transition: 
        transform 0.2s ease-in-out,
        transform-origin 0.1s ease-in-out;
}

.comet-label.expanded .comet-info {
    max-height: none;
    max-width: 250px;
    transition: 
        max-height 0.3s ease-in-out 0.2s, /* Задержка 0.2s - после смены позиции */
        max-width 0.3s ease-in-out 0.2s;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    transition: opacity 0.5s ease;
}

#loading-screen p {
    color: #ccc;
    font-size: 1.2em; /* Увеличим основной текст */
    text-transform: uppercase; /* Все буквы заглавные */
    letter-spacing: 2px; /* Расстояние между буквами */
    margin: 0 0 15px 0; /* Обновим отступы */
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none; /* Отключаем взаимодействие с невидимым элементом */
}

#loading-bar-container {
    width: 250px;
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#loading-bar {
    width: 0%;
    height: 100%;
    background-color: #00bcd4;
    transition: width 0.2s ease-out;
}

#loading-percentage {
    position: absolute; /* Позиционируем относительно #loading-bar-container */
    top: 0;
    left: 0;
    width: 100%; /* Занимает всю ширину контейнера */
    height: 100%; /* И всю высоту */

    /* Используем Flexbox для центрирования самого текста внутри этого элемента */
    display: flex;
    align-items: center;
    justify-content: center;

    color: #fff;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    user-select: none; /* Чтобы текст нельзя было выделить */
}

/* Стили для новых элементов экрана загрузки */

#loading-image {
    width: 150px; /* Размер логотипа */
    height: auto;
    margin-bottom: 20px; /* Отступ снизу */

    /* Неоновое свечение в стиле космоса */
    filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.7));
    
    /* Плавная анимация пульсации для "живости" */
    animation: pulse 2.5s infinite ease-in-out;
}

#loading-screen #loading-status-text {
    font-size: 0.9em; /* Текст статуса сделаем поменьше */
    color: #10e0e2ff; /* Цвет в тон прогресс-бару */
    text-transform: none; /* Обычный регистр букв */
    letter-spacing: normal;
    margin-top: 15px; /* Отступ сверху от прогресс-бара */
    height: 1.2em; /* Резервируем высоту, чтобы макет не "прыгал" */

    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
}

/* Анимация пульсации для логотипа */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}


/* 1. Скрываем старую панель управления */
.hidden-panel {
    display: none;
}

.bottom-hud {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    
    display: flex;
    flex-direction: column; /* Элементы идут друг под другом */
    align-items: center;   /* Центрируем по горизонтали */
    gap: 10px;             /* Расстояние между датой и блоком слайдера */
    
    padding: 15px 25px;
    border-radius: 10px;
    z-index: 1000;
    width: 300px;
}

.time-controls-container {
    display: flex;
    flex-direction: column; /* Слайдер и его описание идут друг под другом */
    align-items: center;
    width: 100%;
    gap: 8px; /* Расстояние между слайдером и его описанием */
}

/* Стили для самого слайдера */
#timeSlider {
    width: 250px;
}

/* Стили для описания слайдера */
.time-controls-container label {
    font-size: 0.9em;
    color: #ccc;
}

#date-display {
    color: #00D1FF;
    font-size: 1.1em;
    font-weight: bold;
    text-shadow: 0 0 10px #00D1FF, 0 0 20px #00D1FF;
}

/* Контейнер для даты и кнопки Live */
.date-live-container {
    display: flex;
    align-items: center; /* Выравниваем по центру по вертикали */
    gap: 15px;         /* Расстояние между датой и кнопкой */
}

/* Стили для самой кнопки */
#live-time-btn {
    padding: 4px 12px;
    font-size: 0.9em;
    font-weight: bold;
    color: #00bcd4;
    background-color: transparent;
    border: 1px solid #00bcd4;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Стиль для активного состояния кнопки */
#live-time-btn.active {
    background-color: #00bcd4;
    color: #000;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.7);
}

/* Эффект при наведении */
#live-time-btn:not(.active):hover {
    background-color: rgba(0, 188, 212, 0.2);
    border-color: #5efbff;
    color: #5efbff;
}


#comet-tooltip {
    position: absolute; /* Обязательно для позиционирования через JS */
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;  
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    
    /* Важно, чтобы подсказка не перехватывала клики мыши */
    pointer-events: none; 
    
    /* Начальное положение, чтобы не было видно */
    top: -100px; 
    left: -100px;
    
    /* Плавное появление */
    transition: opacity 0.2s;
    opacity: 0;
}

