    html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
    #root { display: flex; flex-direction: column; height: 100vh; }
    #header {
        flex-shrink: 0;
        background: linear-gradient(135deg, #1a3a5c 0%, #2c5684 100%);
        color: #fff;
        padding: 12px 24px;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 1.2px;
        text-transform: uppercase;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        z-index: 1000;
        border-bottom: 3px solid #c99a3f;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
    #header .header-text { flex: 1; min-width: 0; text-align: center; }
    #header .header-title { display: block; }
    #header small { display: block; font-size: 11px; font-weight: 400; letter-spacing: 0.5px; text-transform: none; opacity: 0.8; margin-top: 2px; }
    /* Переключатель языка */
    .lang-switch {
        display: inline-flex;
        align-items: stretch;
        flex-shrink: 0;
        border: 1px solid rgba(255, 255, 255, 0.25);
        border-radius: 6px;
        overflow: hidden;
        background: rgba(0, 0, 0, 0.18);
    }
    .lang-switch .lang-btn {
        background: transparent;
        color: #fff;
        border: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.18);
        padding: 6px 10px;
        min-width: 44px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.6px;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, box-shadow 0.15s;
        text-transform: uppercase;
        line-height: 1.2;
        font-family: inherit;
    }
    .lang-switch .lang-btn:last-child { border-right: 0; }
    .lang-switch .lang-btn:hover { background: rgba(255, 255, 255, 0.10); }
    .lang-switch .lang-btn.active {
        background: #11243a;
        color: #ffd784;
        box-shadow: inset 0 0 0 1px #c99a3f;
    }
    #app { display: flex; flex: 1; min-height: 0; }
    #sidebar {
        width: 340px; background: #f7f7f8; border-right: 1px solid #e0e0e0;
        overflow-y: auto; padding: 16px; box-sizing: border-box;
    }
    #sidebar h1 { font-size: 13px; margin: 0 0 10px 0; color: #888; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; }
    /* Вкладки */
    .tabs { display: flex; gap: 2px; margin: -16px -16px 14px; border-bottom: 1px solid #e0e0e0; background: #ecece8; }
    .tab {
        flex: 1; padding: 12px 10px; background: transparent; border: 0; cursor: pointer;
        font-size: 12px; font-weight: 600; color: #666; letter-spacing: 0.3px;
        text-transform: uppercase; border-bottom: 3px solid transparent;
        transition: all 0.15s;
    }
    .tab:hover { color: #1a3a5c; background: rgba(26, 58, 92, 0.04); }
    .tab.active { color: #1a3a5c; background: #f7f7f8; border-bottom-color: #c99a3f; }
    .tab-content { display: none; }
    .tab-content.active { display: block; }
    /* Карточки событий */
    .ev-card {
        background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
        padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
        transition: all 0.15s; display: flex; gap: 10px; align-items: flex-start;
    }
    .ev-card { position: relative; }
    .ev-card:hover { border-color: #c99a3f; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
    .ev-card-flag {
        position: absolute; top: 6px; right: 6px;
        width: 18px; height: 18px; border-radius: 50%;
        background: linear-gradient(135deg, #3a7bc8 0%, #2b5a8e 100%);
        color: #fff; font-size: 11px; line-height: 18px; text-align: center;
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
        cursor: help;
    }
    .ev-card-flag::before { content: "🏛"; }
    .ev-card.active {
        border-color: #c99a3f;
        background: linear-gradient(135deg, #fffbe8 0%, #fdeec3 100%);
        box-shadow: 0 2px 10px rgba(201, 154, 63, 0.35);
        border-left-width: 4px;
    }
    .ev-card.active .ev-title { color: #8a6d1d; }
    .ev-card .ev-year {
        flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 11px; font-weight: 700; color: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    }
    .ev-card .ev-body { flex: 1; min-width: 0; }
    .ev-card .ev-title { font-weight: 600; font-size: 13px; color: #222; margin-bottom: 3px; }
    .ev-card .ev-loc { font-size: 11px; color: #888; }
    /* Маркеры событий на карте */
    .event-marker { background: transparent !important; border: 0 !important; }
    .event-marker .em-pin {
        width: 36px; height: 36px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 10px; font-weight: 700; color: #fff;
        box-shadow: 0 2px 5px rgba(0,0,0,0.4);
        border: 2px solid #fff;
        transition: transform 0.15s, box-shadow 0.15s;
    }
    .event-marker .em-pin.em-pin-active {
        transform: scale(1.25);
        border-color: #ffd84a;
        box-shadow: 0 0 0 3px rgba(255, 216, 74, 0.45), 0 2px 8px rgba(0,0,0,0.5);
        z-index: 1000;
    }
    /* Цвета по типу события */
    .ev-type-battle  { background: #a4453b; }  /* красный — битвы */
    .ev-type-found   { background: #c9a227; }  /* золотой — основания/ключевые */
    .ev-type-sack    { background: #2f2f2f; }  /* чёрный — разрушения */
    .ev-type-treaty  { background: #2b5a8e; }  /* синий — договоры/союзы */
    .ev-type-politic { background: #5e4676; }  /* фиолетовый — политические события */
    .ev-type-cultur  { background: #3f7a3f; }  /* зелёный — культура/религия */
    #search {
        width: 100%; padding: 8px 10px; box-sizing: border-box;
        border: 1px solid #ccc; border-radius: 6px; font-size: 14px; margin-bottom: 12px;
    }
    .obj-card {
        background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
        padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
    }
    .obj-card:hover { border-color: #4a90e2; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
    .obj-card .title { font-weight: 600; font-size: 14px; color: #222; margin-bottom: 4px; }
    .obj-card .period { font-size: 12px; color: #666; }
    #map { flex: 1; }
    .popup-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; color: #222; }
    .popup-period { font-size: 12px; color: #777; margin-bottom: 4px; font-style: italic; }
    .popup-type { font-size: 12px; color: #4a90e2; margin-bottom: 4px; font-weight: 500; text-transform: lowercase; }
    .popup-status { font-size: 11px; color: #8a6d3b; margin-bottom: 8px; padding: 2px 6px; background: #fdf4db; border-radius: 3px; display: inline-block; }
    .popup-3d { margin-bottom: 10px; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; background: #000; }
    .popup-3d-label { font-size: 11px; color: #666; margin-bottom: 4px; font-weight: 500; }
    .popup-3d iframe { display: block; width: 100%; height: 220px; border: 0; }
    .popup-3d-wrap { margin-bottom: 10px; }
    .card-3d-badge { display: inline-block; font-size: 10px; background: #4a90e2; color: #fff; padding: 1px 6px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
    .popup-key-fact {
        margin-bottom: 10px; padding: 8px 11px;
        background: linear-gradient(135deg, #fffbe8 0%, #fef3c7 100%);
        border-left: 3px solid #d4a017; border-radius: 3px;
        font-size: 12.5px; line-height: 1.45; color: #3e2e0e;
    }
    .popup-key-fact-label {
        font-weight: 700; color: #a37400; font-size: 10.5px;
        letter-spacing: 0.5px; text-transform: uppercase;
        display: block; margin-bottom: 3px;
    }
    .popup-links { margin-top: 10px; padding-top: 8px; border-top: 1px solid #eee; font-size: 12px; }
    .popup-links a { color: #4a90e2; text-decoration: none; margin-right: 10px; }
    .popup-links a:hover { text-decoration: underline; }
    .popup-links .wiki-icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
    /* Временной фильтр */
    .time-filter { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 12px 14px 32px; margin-bottom: 12px; }
    .time-filter-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 10px; }
    .time-filter-header .tf-title { font-weight: 600; color: #444; text-transform: uppercase; letter-spacing: 0.3px; font-size: 11px; }
    .time-filter-header .tf-range { color: #4a90e2; font-weight: 600; }
    .time-filter-header .tf-reset { font-size: 10px; color: #888; background: none; border: 0; cursor: pointer; padding: 2px 4px; text-decoration: underline; }
    .time-filter-header .tf-reset:hover { color: #4a90e2; }
    #time-slider { margin: 0 8px; height: 6px; }
    .noUi-connect { background: #4a90e2 !important; }
    .noUi-handle { border: 1px solid #4a90e2 !important; background: #fff !important; box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important; border-radius: 50% !important; width: 18px !important; height: 18px !important; right: -9px !important; top: -7px !important; }
    .noUi-handle:before, .noUi-handle:after { display: none !important; }
    .noUi-target { background: #e8e8ec !important; border: 0 !important; box-shadow: none !important; }
    .noUi-tooltip { font-size: 11px !important; padding: 2px 6px !important; border: 1px solid #d0d0d4 !important; color: #333 !important; }
    /* Тултипы показываем НИЖЕ ручек, чтобы не перекрывать заголовок */
    #time-slider .noUi-tooltip { bottom: auto !important; top: 165% !important; }
    /* Тип-фильтр */
    .type-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
    .type-btn {
        border: 1px solid #d8d8dc; background: #fff; color: #444;
        padding: 7px 8px; border-radius: 5px; cursor: pointer;
        font-size: 12px; font-weight: 500;
        display: flex; align-items: center; gap: 6px; justify-content: center;
        transition: all 0.12s;
    }
    .type-btn:hover { border-color: #4a90e2; color: #2b5a8e; }
    .type-btn.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
    .type-btn .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
    .type-btn[data-cat="all"] .dot { background: linear-gradient(135deg, #2b5a8e 33%, #c28c2a 33% 66%, #4d7a3e 66%); }
    .type-btn[data-cat="fort"] .dot { background: #2b5a8e; }
    .type-btn[data-cat="mausoleum"] .dot { background: #c28c2a; }
    .type-btn[data-cat="kurgan"] .dot { background: #4d7a3e; }
    /* Исторические границы — плашка-лейбл государства */
    .state-label {
        background: rgba(255, 252, 240, 0.92);
        border: 1px solid rgba(100, 80, 40, 0.45);
        border-radius: 4px;
        padding: 4px 10px;
        font-size: 13px;
        line-height: 1.18;
        font-weight: 700;
        color: #3a2f18;
        text-align: center;
        white-space: normal;
        max-width: 180px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.18);
        pointer-events: none;
        /* iconAnchor задаётся в JS под фактический размер плашки —
           так что Leaflet корректно позиционирует её относительно
           geo-точки. Никаких CSS-transform тут НЕ применяем. */
    }
    .state-label .sl-sub {
        display: block;
        font-weight: 400;
        font-size: 11px;
        opacity: 0.78;
        margin-top: 1px;
    }
    .state-label::before { display: none !important; }
    .state-overlay-box {
        background: #fdfbf3; border: 1px solid #e5d9b8;
        border-radius: 5px; padding: 8px 12px 18px;
        margin-bottom: 12px;
        display: none; /* панель управления годом границ скрыта; границы отображаются на borderYear=1300 по умолчанию */
    }
    .state-overlay-head {
        display: flex; align-items: center; gap: 8px;
        cursor: pointer; font-size: 12px; color: #5b4628;
        user-select: none; margin-bottom: 2px;
    }
    .state-overlay-head input { margin: 0; accent-color: #c9a227; }
    .state-overlay-head .border-year {
        margin-left: auto; font-weight: 700; color: #8a6d3b; font-size: 12.5px;
    }
    #border-slider { margin: 18px 8px 2px; height: 5px; }
    .state-overlay-box.disabled #border-slider { opacity: 0.35; pointer-events: none; }
    .state-overlay-box.disabled .border-year { opacity: 0.35; }
    /* noUiSlider для границ — отличный от основного */
    #border-slider .noUi-connect { background: #c9a227 !important; }
    #border-slider .noUi-handle { border-color: #c9a227 !important; }
    .popup-desc { font-size: 13px; line-height: 1.5; color: #333; max-height: 260px; overflow-y: auto; }
    .leaflet-popup-content { margin: 12px 14px; width: 340px !important; }
    .counter { font-size: 12px; color: #888; margin-bottom: 10px; }
    .popup-photos { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
    .popup-photos img {
        width: 100px; height: 70px; object-fit: cover; border-radius: 4px;
        cursor: zoom-in; border: 1px solid #ddd; transition: transform 0.15s;
    }
    .popup-photos img:hover { transform: scale(1.04); border-color: #4a90e2; }
    #lightbox {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.88);
        z-index: 10000; align-items: center; justify-content: center; cursor: zoom-out;
    }
    #lightbox.on { display: flex; }
    #lightbox img { max-width: 92vw; max-height: 92vh; box-shadow: 0 4px 40px rgba(0,0,0,0.5); }
    #lightbox .close { position: absolute; top: 16px; right: 22px; color: #fff; font-size: 32px; font-weight: 300; }
    /* Кнопка «Анимация границ» */
    #video-play-btn {
        position: fixed; bottom: 22px; right: 22px;
        z-index: 1500;
        background: linear-gradient(135deg, #a4453b 0%, #c56251 100%);
        color: #fff; border: 0; border-radius: 26px;
        padding: 10px 18px 10px 14px; cursor: pointer;
        font-size: 13px; font-weight: 600; letter-spacing: 0.2px;
        box-shadow: 0 3px 12px rgba(0,0,0,0.3);
        display: flex; align-items: center; gap: 8px;
        transition: transform 0.15s, box-shadow 0.15s;
    }
    #video-play-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
    #video-play-btn .play-icon {
        width: 22px; height: 22px; background: #fff; border-radius: 50%;
        display: inline-flex; align-items: center; justify-content: center;
        color: #a4453b; flex-shrink: 0;
    }
    /* Модалка видео */
    #video-modal {
        display: none; position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.92);
        z-index: 20000; align-items: center; justify-content: center;
        cursor: zoom-out;
    }
    #video-modal.on { display: flex; }
    .video-modal-content { position: relative; max-width: 92vw; max-height: 92vh; cursor: default; }
    .video-close {
        position: absolute; top: -46px; right: -6px;
        background: transparent; border: 0; color: #fff;
        font-size: 40px; cursor: pointer; width: 46px; height: 46px;
        line-height: 1; padding: 0; font-weight: 300;
    }
    .video-close:hover { color: #ffd84a; }
    #video-player {
        max-width: 92vw; max-height: 85vh; display: block;
        border-radius: 8px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.6);
        background: #000;
    }
    .video-caption {
        position: absolute; bottom: -36px; left: 0; right: 0;
        text-align: center; color: #ddd; font-size: 13px;
    }
    /* Кастомные маркеры (условные знаки) */
    .altyn-marker { background: transparent !important; border: 0 !important; }
    .altyn-marker svg { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35)); }
    /* Легенда на карте */
    .map-legend {
        background: rgba(255,255,255,0.96); border: 1px solid #c9b98a; border-radius: 8px;
        padding: 10px 12px; font-size: 12px; line-height: 1.3; box-shadow: 0 2px 10px rgba(0,0,0,0.12);
        color: #333; max-width: 220px;
    }
    .map-legend .lg-title { font-weight: 700; font-size: 12px; color: #5b4628; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
    .map-legend .lg-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .map-legend .lg-row:last-child { margin-bottom: 0; }
    .map-legend .lg-row svg { flex-shrink: 0; }
    .map-legend .lg-label { font-size: 12px; color: #333; }
    .map-legend .lg-sub { font-size: 10px; color: #888; }
