body {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;     /* IE 10+ и Edge */
  user-select: none;         /* Стандартный синтаксис (Chrome, Firefox, Opera) */
}

body { margin: 0; background: #111; color: #fff; font-family: serif; overflow: hidden; }
.timeline-viewport { width: 100vw; height: 100vh; position: relative; overflow: hidden; cursor: grab; }
.timeline-canvas { position: absolute; height: 100%; top: 0; left: 0; width: 100%; will-change: transform; }
.timeline-line { position: absolute; top: 50%; width: 100%; height: 2px; background: #444; z-index: 1; }



#timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50; /* Между фоном и точками */
    overflow: visible;

    shape-rendering: optimizeSpeed;
    will-change: contents;
}
path {
    pointer-events: none;
    /* Ускоряет рендер сложных кривых */
    vector-effect: non-scaling-stroke; 
}


/* Шкала */
.tick { position: absolute; top: 0; height: 100vh; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 5px; font-size: 12px; color: #666; pointer-events: none; }
.tick.major { border-left-color: #d4af37; color: #d4af37; z-index: 2; font-weight: bold; padding-top: 10px;}
.tick.mini { height: 30px; top: 50%; transform: translateY(-50%); border-left-color: #333; }

/* Точки */
.point { 
    position: absolute; top: 50%; width: 16px; height: 16px; background: #00ffcc; 
    border: 2px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); 
    z-index: 100; cursor: pointer; opacity: 0; transition: opacity 0.4s; 
}
.point.visible { opacity: 1; }

.point.search-hidden {
    opacity: 0.1 !important; /* Делаем почти прозрачными */
    pointer-events: none;
}
/* Анимация для найденных точек */
.point:not(.search-hidden) {
    transition: box-shadow 0.3s ease, opacity 0.3s ease;
}



.zoom-controls,
#filters { 
    top: 10px;
}


#search-container{
    margin-bottom: 15px;
    text-align: center;
}
#timeline-search{
    width: 80%; 
    margin: 0 auto;
    padding: 8px; 
    background: #222; 
    border: 1px solid gold; 
    color: white; 
    border-radius: 5px;
}


/* Зоны и Контролы */
.zone { position: absolute; top: 0; height: 100%; opacity: 0.1; pointer-events: none; }
.zone.peace { background: green; } .zone.war { background: red; }


.zoom-controls { 
    position: fixed;
    right: 20px;
    z-index: 10000;
    display: flex;
    gap: 5px;
    bottom:auto;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: flex-end;
    justify-content: center;
    align-items: stretch;
}

#btn-play{
    margin-top: 20px;
    margin-left: 20px;
    margin-right: 20px;
}

button, select { background: #222; color: gold; border: 1px solid #444; padding: 5px 10px; cursor: pointer; border-radius: 5px; font-size: 12px; }
button.active { background: gold; color: #000; }

.loading-bar { position: fixed; top: 20px; right: 20px; display: none; background: rgba(0,0,0,0.8); padding: 10px; border: 1px solid gold; border-radius: 8px; z-index: 10002; }
.loading-bar.visible { display: flex; align-items: center; gap: 10px; }
.bar-progress { width: 16px; height: 16px; border: 2px solid #333; border-top-color: gold; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.timeline-popup {
    position: fixed;
    z-index: 10005;
    display: none;
    background: #222;
    padding: 15px;
    border: 1px solid #00ffcc;
    width: 250px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    pointer-events: auto; /* Разрешаем клики внутри самого попапа */
    transition: opacity 0.2s; /* Мягкое появление */
}


.group-block {
    position: absolute;
    opacity: 0.3;
    border-left: 2px solid rgba(255,255,255,0.5);
    border-right: 2px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 5; /* Под точками, но над шкалой */
    /* КРИТИЧНО: Убираем все переходы для координат */
    transition: none !important; 
    will-change: left, width;
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
}



.popup-content h3 { margin: 0 0 8px 0; color: #00ffcc; font-size: 16px; }
.popup-content p { margin: 0 0 12px 0; font-size: 14px; color: #ccc; line-height: 1.4; }
.popup-content button { 
    background: #333; border: 1px solid #444; color: #fff; 
    padding: 5px 10px; cursor: pointer; border-radius: 4px; 
}



#filters {
    position: fixed;
    left: 20px;
    width: 150px;
    gap: 20px; /* Расстояние между столбцами */
    z-index: 10005;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: flex-start;
    justify-content: center;
    align-items: flex-start;
}
#filters .hero-filters, 
#filters .group-filters {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5); /* Полупрозрачный фон для читаемости */
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.3); /* Золотистая рамка */
}
/* Общий стиль для заголовков столбцов (если захочешь добавить) */
#filters h4 {
    margin: 0 0 5px 0;
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
}
/* Твои кнопки теперь будут аккуратно выстроены */
#filters .hero-filters button, 
#filters .group-filters button {
    white-space: nowrap;
    text-align: left;
    min-width: 120px;
}
/* Цвета героев */
#filters .hero-filters button[data-hero="pierre"].active { border-left-color: #3498db; }
#filters .hero-filters button[data-hero="andrey"].active { border-left-color: #e74c3c; }
#filters .hero-filters button[data-hero="natasha"].active { border-left-color: #e84393; }

/* Скрытие неактивных точек */
.point.filtered {
    display: none !important;
}



#timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* Попробуй 100% вместо миллиона пикселей для начала */
    height: 100%;
    min-height: 400px; /* Принудительная высота */
    pointer-events: none;
    z-index: 99;
    overflow: visible !important;
    display: block !important;
}


.zone { z-index: 0; }
.timeline-line { z-index: 1; }
.point { z-index: 100; }
