/* «Созвездия: атлас русской поэзии» — оформление прототипа.
   Светлая тема — под подложку CARTO Positron, тёмная — под CARTO Dark Matter.
   Все цвета — через переменные; тёмная тема переопределяет их на :root[data-theme="dark"]. */

:root {
    --bg:          #f4f2ec;
    --panel-bg:    #fbfaf7;
    --card-bg:     #ffffff;
    --overlay-bg:  rgba(255,255,255,.95);
    --map-bg:      #e8e6df;
    --ink:         #23201b;
    --ink-soft:    #6b6459;
    --line:        #e0dbd0;
    --hover:       #efece3;
    --hover-2:     #f0ebe0;
    --badge-bg:    #ece7dc;
    --accent:      #7a1f1f;    /* сдержанный тёмно-красный — «насильственная география» */
    --accent-hover:#921f1f;
    --accent-2:    #2b3a52;
    --on-accent:   #ffffff;
    --draft-bg:    #fff6e0;
    --draft-line:  #ecdaa8;
    --draft-ink:   #6a5410;
    --draft-close: #9a7d2a;
    --label-ink:   #3a352c;
    --label-halo:  #ffffff;
    --hint-bg:     #fbf3c4;   /* светло-жёлтая подсказка */
    --hint-border: #e8d98f;
    --hint-ink:    #3d3720;
    --shadow:      0 1px 3px rgba(30,25,15,.12), 0 8px 24px rgba(30,25,15,.08);
    /* Глобус (3D-вид) — в тон подложке CARTO Positron: бледный океан, светло-серая суша */
    --globe-ocean:      #eef1f5;
    --globe-ocean-edge: #dde2e9;
    --globe-land:       #cfd5dd;
    --globe-land-line:  #bcc3cc;
    --globe-grat:       rgba(70,80,95,.14);
    --globe-rim:        rgba(50,60,75,.28);
    --header-h:    70px;
    --panel-w:     372px;
    --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --serif:       Georgia, "Times New Roman", "PT Serif", serif;
}

:root[data-theme="dark"] {                 /* тёмно-синие тона основного сайта */
    --bg:          #0f1923;
    --panel-bg:    #14222e;
    --card-bg:     #1e2d3d;
    --overlay-bg:  rgba(20,33,45,.94);
    --map-bg:      #16293d;
    --ink:         #e8e0d4;
    --ink-soft:    #9aabb8;
    --line:        #2a3b49;
    --hover:       #253847;
    --hover-2:     #2c4356;
    --badge-bg:    #26394b;
    --accent:      #c0504a;
    --accent-hover:#d0605a;
    --accent-2:    #6db3d0;
    --on-accent:   #ffffff;
    --draft-bg:    #24303a;
    --draft-line:  #3a5060;
    --draft-ink:   #e0c877;
    --draft-close: #b89a4a;
    --label-ink:   #e8eef4;
    --label-halo:  #0b1626;
    --hint-bg:     #c5e2f5;   /* голубая подсказка */
    --hint-border: #9cc7e6;
    --hint-ink:    #16324a;
    --shadow:      0 1px 3px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.45);
    /* Глобус — в тон CARTO Dark Matter: почти чёрный океан, тёмно-синяя суша */
    --globe-ocean:      #0e1a26;
    --globe-ocean-edge: #08111a;
    --globe-land:       #1e3346;
    --globe-land-line:  #2c4560;
    --globe-grat:       rgba(140,175,205,.12);
    --globe-rim:        rgba(120,160,195,.34);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; height: 100%;
    background: var(--bg); color: var(--ink);
    font-family: var(--font); font-size: 15px; line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}
/* App-shell: header + плашка-черновик + main в колонку; main занимает остаток
   (иначе плашка-черновик добавляла высоту и низ таймлайна уходил за экран). */
body { display: flex; flex-direction: column; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

a { color: var(--accent-2); }

/* ---------- Шапка ---------- */
.atlas-header {
    height: var(--header-h);
    flex-shrink: 0;                 /* в колоночном flex body шапку нельзя сжимать ниже height */
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; gap: 12px;
    background: var(--card-bg); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 500;
}
.atlas-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.atlas-brand-mark { color: var(--accent); font-size: 22px; line-height: 1; }
.atlas-brand-text { display: flex; flex-direction: column; font-family: var(--serif); font-weight: 700; font-size: 18px; line-height: 1.05; }
.atlas-brand-text small { font-family: var(--font); font-weight: 400; font-size: 11px; color: var(--ink-soft); letter-spacing: .02em; }

.atlas-header-controls { display: flex; align-items: center; gap: 12px; }
.atlas-person-picker select {
    font-family: var(--font); font-size: 14px; color: var(--ink);
    padding: 7px 30px 7px 12px; border: 1px solid var(--line); border-radius: 8px;
    background-color: var(--card-bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b6459' stroke-width='1.5'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
    -webkit-appearance: none; appearance: none; max-width: 60vw;
}
:root[data-theme="dark"] .atlas-person-picker select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%239aa1a9' stroke-width='1.5'/></svg>");
}
.atlas-header-link { font-size: 13px; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.atlas-header-link:hover { color: var(--accent); }
.atlas-header-logo { display: inline-flex; align-items: center; line-height: 0; opacity: .95; transition: opacity .15s ease; }
.atlas-header-logo:hover { opacity: 1; }
.atlas-header-logo img { height: 40px; width: auto; display: block; }
/* Логотип нарисован под тёмный фон; на светлой теме инвертируем, как на основном сайте */
:root[data-theme="light"] .atlas-header-logo img { filter: invert(1) hue-rotate(180deg); }
.atlas-cmp-btn, .atlas-theme-btn {
    font-size: 13.5px; cursor: pointer; white-space: nowrap;
    padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--card-bg); color: var(--ink);
}
.atlas-cmp-btn:hover, .atlas-theme-btn:hover { border-color: var(--ink-soft); }
.atlas-cmp-btn.active { background: var(--accent-2); color: var(--on-accent); border-color: var(--accent-2); }
/* Кнопка выхода из режима города — в шапке, акцентная, всегда видна */
.atlas-exit-city { display: inline-flex; align-items: center; gap: 7px; background: var(--accent-2); color: var(--on-accent); border-color: var(--accent-2); }
.atlas-exit-city:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.atlas-theme-btn { padding: 7px 10px; line-height: 1; }
/* Иконки переключателя темы — как на основном сайте: в тёмной луна, в светлой солнце */
.atlas-theme-btn i { font-size: 15px; color: var(--ink); }
:root[data-theme="dark"]  .theme-icon-light { display: none; }
:root[data-theme="dark"]  .theme-icon-dark  { display: inline; }
:root[data-theme="light"] .theme-icon-dark  { display: none; }
:root[data-theme="light"] .theme-icon-light { display: inline; }

/* ---------- Черновик-плашка ---------- */
.atlas-draft-note {
    background: var(--draft-bg); border-bottom: 1px solid var(--draft-line); color: var(--draft-ink);
    font-size: 13px; padding: 8px 44px 8px 16px; position: relative;
}
.atlas-draft-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; color: var(--draft-close); font-size: 15px; }

/* ---------- Основной макет ---------- */
.atlas-main { display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.atlas-panel {
    width: var(--panel-w); flex: none; height: 100%; overflow-y: auto;
    background: var(--panel-bg); border-right: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
}
.atlas-map-wrap { position: relative; flex: 1 1 auto; height: 100%; }
.atlas-map { position: absolute; inset: 0; background: var(--map-bg); }

/* ---------- Переключатель вида Карта / Глобус (в шапке сайта) ---------- */
.atlas-view-toggle {
    display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
    background: var(--badge-bg); border: 1px solid var(--line);
}
.atlas-view-toggle button {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border: 0;
    border-radius: 999px; background: none; color: var(--ink-soft); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.atlas-view-toggle button i { font-size: 13px; }
.atlas-view-toggle button:hover { color: var(--ink); }
.atlas-view-toggle button.on { background: var(--accent-2); color: var(--on-accent); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
/* режим города — глобус недоступен (шапка вне .atlas-main, поэтому через :has на body) */
body:has(.atlas-main.city-mode) .atlas-view-toggle { display: none; }
/* узкий экран — только иконки, чтобы шапка не переполнялась */
@media (max-width: 560px) { .atlas-view-toggle button span { display: none; } .atlas-view-toggle button { padding: 6px 10px; } }

/* ---------- Слой глобуса (3D, globe.gl / three.js) ---------- */
.atlas-globe { position: absolute; inset: 0; z-index: 425; display: none; touch-action: none; background: var(--bg); }
.atlas-main.globe-active .atlas-globe { display: block; }
.globe-mount { position: absolute; inset: 0; }
.globe-mount canvas { display: block; cursor: grab; }         /* размер задаёт globe.gl через width()/height() */
.globe-mount:active canvas { cursor: grabbing; }
/* нумерованный пин эпизода — HTML-элемент; globe.gl центрирует его сам (свой transform), поэтому здесь БЕЗ transform */
.globe-pin {
    width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 12px; line-height: 1;
    border: 2px solid rgba(255,255,255,.9); box-shadow: 0 1px 5px rgba(0,0,0,.5);
    cursor: pointer; user-select: none; transition: opacity .15s;
}
.globe-pin:hover { box-shadow: 0 0 0 3px var(--accent-2), 0 2px 9px rgba(0,0,0,.6); z-index: 6; }
.globe-pin.dot { width: 13px; height: 13px; border-width: 1.5px; }
/* подпись города — HTML (кириллица через системный шрифт); globe.gl центрирует ВНЕШНИЙ div,
   поэтому точка-якорь = сам div, а имя вынесено вправо абсолютом (не влияет на центрирование) */
.globe-city {
    width: 6px; height: 6px; border-radius: 50%; background: var(--label-ink); opacity: .8;
    pointer-events: none; user-select: none; transition: opacity .15s;
}
.globe-city.major { width: 7px; height: 7px; opacity: .95; }
.globe-city .gc-name {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%); white-space: nowrap;
    color: var(--label-ink); font-size: 11px; font-weight: 600; line-height: 1; pointer-events: none;
    text-shadow: -1px -1px 2px var(--label-halo), 1px -1px 2px var(--label-halo), -1px 1px 2px var(--label-halo), 1px 1px 2px var(--label-halo);
}
.globe-city.major .gc-name { font-size: 13px; font-weight: 700; }
/* в режиме глобуса прячем содержимое leaflet-карты и её контролы/подсказки */
.atlas-main.globe-active .leaflet-map-pane,
.atlas-main.globe-active .leaflet-control-container,
.atlas-main.globe-active .atlas-cities-menu,
.atlas-main.globe-active .city-flash { display: none !important; }
.atlas-main.globe-active .atlas-timeline { display: none; }
.globe-loading {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2;
    display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 999px;
    background: var(--overlay-bg); border: 1px solid var(--line); box-shadow: var(--shadow);
    color: var(--ink-soft); font-size: 13px;
}
.globe-loading i { color: var(--accent-2); animation: globe-spin 1.1s linear infinite; }
.globe-loading.hidden { display: none; }
@keyframes globe-spin { to { transform: rotate(360deg); } }
/* подсказка по точке на глобусе (тот же язык, что .atlas-hint) */
.globe-tip {
    position: absolute; z-index: 475; pointer-events: none; max-width: 240px;
    padding: 7px 11px; border-radius: 9px; background: var(--hint-bg); border: 1px solid var(--hint-border);
    color: var(--hint-ink); box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 12px));
    font-size: 12.5px; line-height: 1.35;
}
.globe-tip.hidden { display: none; }
.globe-tip-name { font-weight: 700; }
.globe-tip-meta { color: var(--hint-ink); opacity: .8; font-size: 11.5px; margin-top: 1px; }
.globe-tip-title { margin-top: 3px; }

/* ---------- Панель: карточка личности ---------- */
.p-person { padding: 18px 18px 8px; border-bottom: 1px solid var(--line); }
.p-person-top { display: flex; gap: 14px; align-items: flex-start; }
.p-portrait { width: 66px; height: 66px; flex: none; border-radius: 50%; object-fit: cover; border: 2px solid var(--card-bg); box-shadow: var(--shadow); background: var(--hover); }
.p-portrait.is-empty { display: flex; align-items: center; justify-content: center; font-family: var(--serif); color: var(--on-accent); background: var(--accent-2); font-size: 26px; }
.p-name-row { display: flex; align-items: flex-start; gap: 10px; }
.p-name { flex: 1 1 auto; font-family: var(--serif); font-size: 21px; font-weight: 700; margin: 0 0 2px; }
.p-article-icon { flex: none; margin-top: 3px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--card-bg); text-decoration: none; font-size: 15px; }
.p-article-icon:hover { border-color: var(--accent); background: var(--hover); }
.p-years { color: var(--ink-soft); font-size: 14px; margin: 0 0 8px; }
.p-summary { font-size: 13.5px; color: var(--ink-soft); margin: 12px 0 2px; }

/* ---------- Панель: список эпизодов ---------- */
.p-list-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.ep-list { list-style: none; margin: 0; padding: 0 8px 24px; }
.ep-item { display: grid; grid-template-columns: 22px 60px 1fr; gap: 9px; align-items: start; padding: 9px 10px; border-radius: 8px; cursor: pointer; position: relative; }
.ep-item:hover, .ep-item.is-active { background: var(--hover); }
.ep-num { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; margin-top: 1px; }
.ep-num.approx { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }
.ep-num.off { color: var(--ink-soft); font-weight: 400; }
.ep-year { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-soft); white-space: nowrap; margin-top: 2px; }
.ep-body { min-width: 0; }
.ep-place { font-weight: 600; font-size: 14px; }
.ep-place .ep-hist { color: var(--ink-soft); font-weight: 400; }
.ep-title { font-size: 13px; color: var(--ink-soft); }
.ep-badges { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 5px; }
.ep-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 20px; background: var(--badge-bg); color: var(--ink-soft); }
.ep-badge.type { color: var(--on-accent); }
.ep-badge.approx { background: #fbeccb; color: #7a5a12; }
.ep-badge.unknown-place { background: var(--badge-bg); color: var(--ink-soft); }
:root[data-theme="dark"] .ep-badge.approx { background: #4a3f18; color: #e6cd84; }

/* ---------- Карточка эпизода ---------- */
.atlas-card {
    position: absolute; left: 12px; right: 12px; bottom: 66px; z-index: 450;
    background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow);
    padding: 12px 18px 14px; max-width: 460px;
    /* высота ЗАФИКСИРОВАНА (не «дышит» от длины текста): шапка/место/бейджи/навигация — flex:none,
       а .card-body (flex:1) занимает остаток ≈ 5–6 строк и скроллит остальное. На низких экранах
       max-height подстрахует, чтобы плашка не вылезла за карту. */
    display: flex; flex-direction: column; height: 302px; max-height: calc(100% - 80px);
}
.atlas-card.hidden { display: none; }
/* Верхний ряд: «имя · № · год» слева + кнопки действий справа (в одну строку — экономия высоты) */
.card-head { flex: none; display: flex; align-items: center; gap: 10px; margin: -2px 0 4px; }
.card-tools { flex: none; display: flex; gap: 6px; }
.card-tool { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink); border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 13px; }
.card-tool:hover { border-color: var(--ink-soft); background: var(--hover); }
.card-tool.music { color: var(--accent); }
.card-tool.card-close { color: var(--ink-soft); }
.card-kicker { flex: 1 1 auto; min-width: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); line-height: 1.35; }
.card-place { flex: none; font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 2px 0 2px; }
.card-place .card-hist { color: var(--ink-soft); font-weight: 400; font-size: 15px; }
.card-meta { flex: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
/* тело фиксированной высоты со скроллом ТОЛЬКО по вертикали (без крошечной горизонтальной прокрутки) */
.card-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-height: 0; overflow-wrap: break-word; }
.card-desc { font-size: 14px; margin: 0 0 10px; }
.card-source { font-size: 11.5px; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 8px; }
.card-nav { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.card-navbtn { width: 44px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink); border-radius: 8px; cursor: pointer; font-size: 14px; }
.card-navbtn:hover:not([disabled]) { border-color: var(--ink-soft); background: var(--hover); }
.card-navbtn[disabled] { opacity: .35; cursor: default; }
.card-navpos { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- Плашка города: последовательный переход по домам одного поэта + фото ----------
   Реюз .atlas-card/.card-* макро-карточки; ниже — только добавки. */
.card-nav-right { display: flex; align-items: center; gap: 8px; }
.card-navbtn.wide { width: auto; padding: 0 11px; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.card-navbtn.card-citywalk, .card-navbtn.card-return { color: var(--accent-2); border-color: var(--accent-2); }
.card-navbtn.card-citywalk:hover:not([disabled]), .card-navbtn.card-return:hover:not([disabled]) { background: var(--accent-2); color: var(--on-accent); }
.bld-card-addr { flex: none; font-size: 13.5px; color: var(--ink-soft); margin: 0 0 6px; }
/* ряд «фото | тело»: фото — узкой колонкой слева во всю высоту тела, тело скроллится */
.card-mid { flex: 1 1 auto; display: flex; min-height: 0; gap: 12px; }
.card-mid > .card-body { flex: 1 1 auto; }
.bld-card-photo { flex: none; width: 94px; align-self: stretch; position: relative; display: block; border-radius: 8px; overflow: hidden; text-decoration: none; box-shadow: 0 1px 4px rgba(0,0,0,.28); }
.bld-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bld-card-cred { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 5px 3px; font-size: 9.5px; line-height: 1.25; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.78)); }
.bld-card-note { font-size: 13.5px; color: var(--ink-soft); font-style: italic; line-height: 1.5; margin: 0 0 10px; }
/* нумерованный пин дома — когда в городе выбран ровно один поэт */
.bld-pin.num { font-weight: 700; }
/* левая панель: нумерованная прогулка одного поэта (краткие подписи) */
.bld-solo-row { display: flex; gap: 11px; padding: 8px 10px; border-radius: 9px; cursor: pointer; align-items: flex-start; }
.bld-solo-row:hover, .bld-solo-row.is-active { background: var(--hover); }
.bld-solo-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; border: 2px solid var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.bld-solo-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.bld-solo-snip { font-size: 12.5px; color: var(--ink); margin-top: 2px; line-height: 1.4; }

/* ---------- Общий Markdown в описаниях эпизода (полный текст прямо в плашке) ---------- */
.card-desc.md p { margin: 0 0 8px; }
.card-desc.md p:last-child { margin-bottom: 0; }
.card-desc.md a { color: var(--accent-2); }
.card-desc.md strong { font-weight: 700; }
.card-desc.md em { font-style: italic; }
.card-desc.md ul, .card-desc.md ol { margin: 0 0 10px; padding-left: 20px; }
.card-desc.md .verse-block { margin: 12px 0; padding: 6px 0 6px 14px; border-left: 3px solid var(--accent-2); }
.verse-text { font-style: italic; line-height: 1.55; }
.verse-more { display: inline-block; margin-top: 5px; font-size: 12.5px; color: var(--accent-2); text-decoration: none; }
.verse-more:hover { text-decoration: underline; }

/* ---------- Пересечения ---------- */
.p-cross-head { padding: 16px 18px 6px; border-bottom: 1px solid var(--line); }
.p-cross-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.p-cross-place { font-family: var(--serif); font-size: 22px; font-weight: 700; margin: 3px 0; }
.p-cross-sub { color: var(--ink-soft); font-size: 13.5px; }
.p-window { display: flex; gap: 6px; margin: 12px 0 2px; }
.p-window button { font-size: 12.5px; padding: 5px 10px; border-radius: 20px; cursor: pointer; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink-soft); }
.p-window button.active { background: var(--accent-2); color: var(--on-accent); border-color: var(--accent-2); }
.cross-person { display: flex; gap: 11px; align-items: center; padding: 10px 18px; cursor: pointer; border-bottom: 1px solid var(--hover); }
.cross-person:hover { background: var(--hover); }
.cross-person.dim { opacity: .55; }
.cross-person.dim:hover { opacity: 1; }
.cross-swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cross-mini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: var(--hover); }
.cross-info { min-width: 0; }
.cross-name { font-weight: 600; font-size: 14.5px; }
.cross-when { font-size: 12.5px; color: var(--ink-soft); }
.p-back { margin: 12px 18px; display: inline-block; font-size: 13px; color: var(--accent-2); text-decoration: none; cursor: pointer; }

/* ---------- Сравнение ---------- */
.cmp-list { padding: 4px 10px 10px; }
.cmp-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.cmp-row:hover { background: var(--hover); }
.cmp-row.on { background: var(--hover-2); }
.cmp-row input { width: auto; margin: 0; accent-color: var(--accent-2); }
.cmp-swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.cmp-name { min-width: 0; }
.cmp-years { color: var(--ink-soft); font-size: 12px; }
.cmp-empty { padding: 4px 18px 10px; color: var(--ink-soft); font-size: 13px; }
.conv-row { display: flex; gap: 10px; align-items: baseline; padding: 8px 18px; cursor: pointer; border-bottom: 1px solid var(--hover); }
.conv-row:hover { background: var(--hover); }
.conv-star { color: #b8860b; font-size: 14px; }
.conv-info { min-width: 0; }
.conv-place { font-weight: 600; font-size: 14px; }
.conv-years { color: var(--ink-soft); font-weight: 400; font-variant-numeric: tabular-nums; }
.conv-who { font-size: 12.5px; color: var(--ink-soft); }
.conv-flash { animation: convflash 1.4s ease; }
@keyframes convflash { 0%,100% { stroke-width: 2.5px; } 50% { stroke-width: 7px; } }

/* ---------- Ползунок времени ---------- */
.atlas-timeline { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 430; display: flex; align-items: center; gap: 14px; background: var(--overlay-bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 7px 16px 5px; backdrop-filter: blur(3px); }
.tl-year { flex: none; min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; color: var(--ink); }

/* Двуручьевой слайдер выбора диапазона [from, to] + линейка годов */
.tl-slider { position: relative; flex: 1 1 auto; height: 48px; }
.tl-track { position: absolute; left: 0; right: 0; top: 18px; height: 4px; border-radius: 3px; background: var(--line); }
.tl-fill  { position: absolute; top: 18px; height: 4px; border-radius: 3px; background: var(--accent); }
.tl-slider .tl-range {
    position: absolute; left: 0; top: 10px; width: 100%; height: 20px; margin: 0;
    -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none;
}
.tl-slider .tl-range:focus { outline: none; }
.tl-slider .tl-range::-webkit-slider-runnable-track { height: 20px; background: transparent; border: 0; }
.tl-slider .tl-range::-moz-range-track { height: 20px; background: transparent; border: 0; }
.tl-slider .tl-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: grab;
    margin-top: 3px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.tl-slider .tl-range::-moz-range-thumb {
    pointer-events: auto; cursor: grab; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.tl-slider .tl-range:active::-webkit-slider-thumb { cursor: grabbing; }
.tl-slider .tl-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-2); }
.tl-slider .tl-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent-2); }
.tl-ticks { position: absolute; left: 0; right: 0; top: 32px; height: 16px; pointer-events: none; }
.tl-tick { position: absolute; transform: translateX(-50%); text-align: center; }
.tl-tick-mark { display: block; width: 1px; height: 4px; margin: 0 auto 1px; background: var(--ink-soft); opacity: .5; }
.tl-tick-label { font-size: 9.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Метки годов написания стихов на ползунке + плашка со ссылками (P10) */
.tl-poems { position: absolute; left: 0; right: 0; top: 0; height: 12px; z-index: 2; }
.tl-poem { position: absolute; top: 1px; transform: translateX(-50%); width: 9px; height: 9px; padding: 0; border: 1.5px solid var(--card-bg); border-radius: 50%; background: var(--pc, var(--accent-2)); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tl-poem.multi { width: 11px; height: 11px; }
.tl-poem:hover, .tl-poem:focus-visible { transform: translateX(-50%) scale(1.3); outline: none; z-index: 6; }
.tl-poem-tip {
    display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    margin-bottom: 8px; min-width: 150px; max-width: 260px; z-index: 7;
    background: var(--card-bg); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
    padding: 8px 11px; text-align: left; white-space: normal; cursor: default;
}
.tl-poem-tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--card-bg); }
.tl-poem:hover .tl-poem-tip, .tl-poem:focus-within .tl-poem-tip { display: block; }
.tl-poem-year { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.tl-poem-link { display: block; font-family: var(--serif); font-size: 13px; color: var(--accent-2); text-decoration: none; padding: 2px 0; line-height: 1.3; }
.tl-poem-link:hover { text-decoration: underline; color: var(--accent); }

/* ---------- Сравнение: заголовок поэта в левом столбце ---------- */
.cmp-poet-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px 4px; font-weight: 600; font-size: 14px; border-top: 1px solid var(--line); margin-top: 6px; }
.cmp-poet-head .cmp-years { color: var(--ink-soft); font-weight: 400; font-size: 12px; }
.cmp-article { margin-left: auto; flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); text-decoration: none; font-size: 12px; }
.cmp-article:hover { border-color: var(--accent); background: var(--hover); }
.p-empty { padding: 26px 20px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }

/* ---------- Постоянная панель поэтов (справа над картой) ---------- */
.atlas-poets {
    position: absolute; right: 10px; top: 10px; z-index: 460; width: 234px;
    max-height: calc(100% - 96px); display: flex; flex-direction: column;
    background: var(--overlay-bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); backdrop-filter: blur(4px); overflow: hidden;
}
.poets-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 8px 6px 12px; }
.poets-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }
.poets-collapse { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink-soft); cursor: pointer; border-radius: 6px; font-size: 12px; }
.poets-collapse:hover { background: var(--hover); color: var(--ink); }
/* Свёрнутая панель — компактная кнопка-иконка (иконка + счётчик выбранных) */
.poets-launch { display: none; }
.atlas-poets.collapsed { width: auto; }
.atlas-poets.collapsed .poets-head,
.atlas-poets.collapsed .poets-filter,
.atlas-poets.collapsed .poets-actions,
.atlas-poets.collapsed .poets-list { display: none; }
.atlas-poets.collapsed .poets-launch {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 12px; border: 0; background: none; color: var(--ink); cursor: pointer;
    font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.atlas-poets.collapsed .poets-launch i { color: var(--accent-2); font-size: 15px; }
.poets-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-2); color: var(--on-accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
/* Приглушение, пока юзер тянет/зумит карту (чтобы панель не заслоняла) */
.atlas-poets.map-busy { opacity: .22 !important; }
.poets-filter { margin: 0 10px 6px; padding: 6px 9px; font: 13px inherit; border: 1px solid var(--line); border-radius: 7px; background: var(--card-bg); color: var(--ink); }
.poets-actions { display: flex; gap: 6px; margin: 0 10px 8px; }
.poets-act { flex: 1 1 0; font-size: 12px; padding: 5px 6px; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink-soft); border-radius: 7px; cursor: pointer; }
.poets-act:hover { border-color: var(--ink-soft); color: var(--ink); }
.poets-list { overflow-y: auto; padding: 0 6px 8px; }
.poet-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.poet-row:hover { background: var(--hover); }
.poet-row.on { background: var(--hover-2); }
.poet-row input { width: auto; margin: 0; accent-color: var(--accent-2); flex: none; }
.poet-swatch { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.poet-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poet-years { color: var(--ink-soft); font-size: 11px; }

/* ---------- Ресайзер левого столбца ---------- */
.atlas-resizer { flex: none; width: 6px; cursor: col-resize; background: var(--line); }
.atlas-resizer:hover { background: var(--accent-2); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .atlas-resizer { background: var(--accent-2); }

/* ---------- Сворачивание левой панели (ручка на границе панель↔карта) ---------- */
.panel-toggle {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    z-index: 465; width: 20px; height: 48px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0;
    background: var(--card-bg); color: var(--ink-soft); cursor: pointer;
    box-shadow: 2px 0 6px rgba(0,0,0,.15); font-size: 12px;
}
.panel-toggle:hover { color: var(--ink); background: var(--hover); }
.atlas-panel { transition: width .2s ease; }
body.resizing .atlas-panel { transition: none; }        /* без анимации во время ресайза */
.atlas-main.panel-collapsed .atlas-panel { width: 0 !important; min-width: 0; border-right: 0; overflow: hidden; }
.atlas-main.panel-collapsed .atlas-resizer { display: none; }

/* ---------- Нумерованные точки на карте ---------- */
.leaflet-div-icon.num-wrap { background: transparent; border: 0; }
.num-pin { position: relative; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; transition: transform .1s ease; }
:root[data-theme="dark"] .num-pin { border-color: #dbe6f0; }
.num-pin.approx { border-style: dashed; }
.num-pin.on { transform: scale(1.38); box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 2px 8px rgba(0,0,0,.55); }
.num-pin.seg { transform: scale(1.4); box-shadow: 0 0 0 3px rgba(255,255,255,.65), 0 2px 9px rgba(0,0,0,.6); }
.num-pin.cur { transform: scale(1.45); box-shadow: 0 0 0 3px var(--accent-2), 0 2px 9px rgba(0,0,0,.6); }
.num-pin.past { opacity: .4; }
/* стопка накладывающихся пинов + счётчик (кликнуть = раздвинуть) */
.num-pin.stacked { box-shadow: 2.5px 2.5px 0 -1px var(--card-bg), 4px 4px 0 -1px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.5); }
.num-pin[data-count]::after { content: attr(data-count); position: absolute; top: -7px; right: -9px; min-width: 15px; height: 15px; padding: 0 3px; box-sizing: border-box; border-radius: 8px; background: #1b1b1b; color: #fff; font-size: 10px; font-weight: 700; line-height: 12px; text-align: center; border: 1.5px solid var(--card-bg); }
.num-pin.fanned { box-shadow: 0 1px 5px rgba(0,0,0,.55); }
.num-pin.fanned::after { display: none; }
.ep-item.seg-active { background: var(--hover-2); }

/* ---------- Метки мест на карте ---------- */
.place-label {
    background: none; border: 0; box-shadow: none;
    color: var(--label-ink); font-size: 11.5px; font-weight: 600;
    text-shadow: 0 0 3px var(--label-halo), 0 0 3px var(--label-halo), 0 0 3px var(--label-halo), 0 0 4px var(--label-halo);
    white-space: nowrap;
}
.leaflet-tooltip.place-label::before { display: none; }

/* ---------- Крошечная подсказка при наведении на пин ---------- */
.atlas-hint {
    position: absolute; z-index: 480; pointer-events: none;
    transform: translate(-50%, -100%);
    max-width: 230px; padding: 5px 9px; border-radius: 8px;
    background: var(--hint-bg); border: 1px solid var(--hint-border); color: var(--hint-ink);
    box-shadow: 0 2px 8px rgba(0,0,0,.28); font-size: 12.5px; line-height: 1.35;
}
.atlas-hint.hidden { display: none; }
.atlas-hint-name { font-weight: 700; }
.atlas-hint-city { margin-left: 6px; font-size: 10.5px; font-weight: 400; opacity: .6; }
.atlas-hint-text { margin-top: 1px; }

/* ---------- Стрелка-выноска от карточки к точке (P8) ---------- */
.atlas-leader { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 445; pointer-events: none; overflow: visible; }
.atlas-leader-path { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .92; }
.atlas-leader marker path { fill: var(--accent); }

/* Тёмная карта — синий тон вместо мрачно-серого (тонировка тайлов фильтром) */
:root[data-theme="dark"] .leaflet-tile-pane { filter: grayscale(1) sepia(1) hue-rotate(180deg) saturate(1.4) brightness(1.05); }

/* Leaflet-контролы в тёмной теме */
:root[data-theme="dark"] .leaflet-bar a { background: var(--card-bg); color: var(--ink); border-bottom-color: var(--line); }
:root[data-theme="dark"] .leaflet-bar a:hover { background: var(--hover); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(20,23,28,.8) !important; color: var(--ink-soft); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--accent-2); }

/* Кнопка-тумблер подписей карты (P9) — рядом с зумом (leaflet-bar) */
.atlas-labels-ctrl a { display: flex; align-items: center; justify-content: center; font-size: 13px; }
.atlas-labels-ctrl a.active { background: var(--accent-2); color: var(--on-accent); }
:root[data-theme="dark"] .atlas-labels-ctrl a.active { background: var(--accent-2); color: var(--on-accent); }

/* ---------- Обнаружимость режима города ---------- */
/* Контрол-каталог «Города с подробными картами» (leaflet-bar, рядом с зумом) */
.atlas-cities-ctrl a { display: flex; align-items: center; justify-content: center; font-size: 13px; }
.atlas-cities-menu {
    position: absolute; top: 12px; left: 54px; z-index: 466; width: 232px;
    max-height: calc(100% - 24px); overflow-y: auto;
    background: var(--overlay-bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); backdrop-filter: blur(4px); padding: 8px;
}
.atlas-cities-menu.hidden { display: none; }
.cities-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; padding: 2px 6px 6px; }
.cities-menu-list { display: flex; flex-direction: column; }
.cities-menu-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink); text-align: left; }
.cities-menu-row:hover { background: var(--hover); }
.cities-menu-row i { color: var(--accent-2); font-size: 13px; width: 16px; text-align: center; flex: none; }
.cm-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-n { flex: none; font-size: 11px; color: var(--ink-soft); background: var(--badge-bg); border-radius: 10px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.cities-menu-hint { font-size: 11.5px; color: var(--ink-soft); line-height: 1.35; padding: 0 6px 8px; }
.cm-check { flex: none; width: 15px; height: 15px; margin: 0; accent-color: var(--accent-2); cursor: pointer; }
.cities-menu-foot { padding: 8px 4px 2px; margin-top: 4px; border-top: 1px solid var(--line); }
.cities-menu-go { width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: var(--accent-2); color: var(--on-accent); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.cities-menu-go:hover { filter: brightness(1.08); }
.cities-menu-go:disabled { background: var(--badge-bg); color: var(--ink-soft); cursor: default; filter: none; }
.bld-city-head { padding-top: 15px; color: var(--accent-2); }

/* Метка «богатого» города на нумерованном пине траектории (уголок с колонной) */
.num-pin.has-city { box-shadow: 0 1px 4px rgba(0,0,0,.5), 0 0 0 2px #e0b964; }
.pin-city { position: absolute; bottom: -5px; right: -5px; width: 15px; height: 15px; border-radius: 50%; background: #e0b964; color: #3a2c07; display: flex; align-items: center; justify-content: center; font-size: 8.5px; border: 1.5px solid var(--card-bg); box-shadow: 0 1px 2px rgba(0,0,0,.4); pointer-events: none; }

/* Ссылка «Подробная карта города» в списке траектории */
.ep-city-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--accent-2); background: none; color: var(--accent-2); cursor: pointer; }
.ep-city-link:hover { background: var(--accent-2); color: var(--on-accent); }
.ep-city-link i { font-size: 11px; }

/* Кнопка «Подробная карта» в карточке эпизода */
.card-tool.city { color: var(--accent-2); }

.atlas-empty { position: fixed; left: 50%; top: 60%; transform: translate(-50%,-50%); background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; box-shadow: var(--shadow); z-index: 600; max-width: 420px; font-size: 14px; }
.atlas-empty code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------- Полупрозрачность оверлеев в покое (P2) ----------
   В покое оверлеи над картой приглушены, чтобы не заслонять её;
   при наведении/фокусе становятся плотными. */
.atlas-poets, .atlas-timeline, .atlas-card { transition: opacity .18s ease; }
.atlas-poets  { opacity: .66; }
.atlas-timeline { opacity: .68; }
.atlas-card   { opacity: .9; }
.atlas-hint   { opacity: .94; }
.atlas-poets:hover, .atlas-poets:focus-within,
.atlas-timeline:hover, .atlas-timeline:focus-within,
.atlas-card:hover, .atlas-card:focus-within { opacity: 1; }

/* ================================================================== */
/* Режим города (микро-слой: дома внутри города)                       */
/* ================================================================== */
/* В режиме города макро-оверлеи (поэты, таймлайн, ручка панели) прячем */
.atlas-main.city-mode #poets,
.atlas-main.city-mode #timeline { display: none !important; }
/* #panel-toggle (ручка сворачивания левой панели) в режиме города РАБОТАЕТ, как в макро */

/* --- пин дома: заливка = роль, кольцо-обёртка = поэт(ы) --- */
.leaflet-div-icon.bld-wrap { background: transparent; border: 0; }
.bld-pin-wrap {
    display: inline-flex; padding: 3px; border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer;
    transition: transform .1s ease, opacity .12s ease;
}
.bld-pin-wrap.hub { padding: 4px; }                          /* дом-хаб (несколько поэтов) — кольцо толще */
.bld-pin {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; border: 2px solid #fff;
}
:root[data-theme="dark"] .bld-pin { border-color: #dbe6f0; }
.bld-pin-wrap.active { transform: scale(1.3); box-shadow: 0 0 0 3px var(--accent-2), 0 2px 9px rgba(0,0,0,.55); }
.bld-pin-wrap.poet-hi { transform: scale(1.18); z-index: 500; }
.bld-pin-wrap.poet-dim { opacity: .25; }

/* Панель «Поэты» режима города (#city-poets) переиспользует классы макро-панели
   .atlas-poets/.poets-*/.poet-row — отдельного оформления не нужно. */

/* --- баннер режима города (сверху по центру карты) --- */
.city-bar {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    z-index: 470; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    max-width: calc(100% - 24px);
    background: var(--overlay-bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); padding: 8px 12px; backdrop-filter: blur(4px);
}
.city-bar-main { display: flex; flex-direction: column; line-height: 1.1; padding-right: 10px; border-right: 1px solid var(--line); }
.city-bar-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.city-bar-name { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.city-roles { display: flex; gap: 6px; flex-wrap: wrap; }
.city-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink-soft); cursor: pointer; }
.city-chip .city-chip-dot { width: 9px; height: 9px; border-radius: 50%; }
.city-chip.on { color: var(--ink); border-color: var(--ink-soft); }
.city-chip:not(.on) { opacity: .5; text-decoration: line-through; }
.city-exit { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-bg); color: var(--ink); cursor: pointer; }
.city-exit:hover { border-color: var(--ink-soft); background: var(--hover); }

/* --- подсказка «Перейти в режим города» --- */
.city-flash {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    z-index: 472; display: flex; align-items: center; gap: 10px;
    background: var(--accent-2); color: var(--on-accent);
    border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px 8px 14px;
    font-size: 13.5px; max-width: calc(100% - 24px);
}
.city-flash.hidden { display: none; }
.city-flash-go { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 5px 12px; border-radius: 7px; border: 0; background: var(--on-accent); color: var(--accent-2); white-space: nowrap; }
.city-flash-x { border: 0; background: none; color: var(--on-accent); cursor: pointer; font-size: 14px; opacity: .85; }
.city-flash-x:hover { opacity: 1; }

/* --- список домов (левая панель) --- */
.bld-list { padding: 6px 8px 24px; }
.bld-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.bld-row:hover { background: var(--hover); }
.bld-row-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; border: 2px solid var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.bld-row-info { flex: 1 1 auto; min-width: 0; }
.bld-row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld-row-poets { display: flex; flex-wrap: wrap; gap: 3px 10px; margin: 1px 0; }
.bld-row-poet { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); }
.bld-row-psw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.bld-row-addr { font-size: 12.5px; color: var(--ink-soft); }
.bld-row-dots { flex: none; display: flex; gap: 3px; }
.bld-dot { width: 8px; height: 8px; border-radius: 50%; }

/* --- карточка дома (дом-центричный вид) --- */
.bld-head { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.bld-title { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 0 0 3px; }
.bld-addr { font-size: 14px; color: var(--ink); }
.bld-addr-old { color: var(--ink-soft); font-size: 12.5px; }
.bld-present { margin-top: 8px; font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.bld-present i { color: var(--accent); }
.bld-note { margin-top: 8px; font-size: 13.5px; color: var(--ink-soft); font-style: italic; line-height: 1.5; }
.bld-persons { padding: 6px 12px 26px; }
.bld-person { padding: 10px 6px; border-bottom: 1px solid var(--hover); }
.bld-person:last-child { border-bottom: 0; }
.bld-person-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.bld-person-sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.bld-person-name { font-weight: 700; font-size: 15px; }
.bld-person-go { margin-left: auto; flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; color: var(--accent-2); text-decoration: none; font-size: 12px; }
.bld-person-go:hover { background: var(--hover); border-color: var(--ink-soft); }
.bld-link { margin: 6px 0 4px; padding-left: 21px; }
.bld-role { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 9px; border-radius: 20px; color: #fff; }
.bld-years { margin-left: 8px; font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bld-link-note { margin-top: 4px; font-size: 13px; color: var(--ink); line-height: 1.5; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 800px) {
    :root { --panel-w: 100%; }
    .atlas-main { flex-direction: column; }
    .atlas-map-wrap { flex: none; height: 50vh; order: -1; }     /* карта сверху */
    .atlas-panel { flex: 1 1 auto; border-right: 0; border-top: 1px solid var(--line); width: 100% !important; }
    .atlas-resizer { display: none; }
    .panel-toggle { display: none; }
    .atlas-main.panel-collapsed .atlas-panel { width: 100% !important; overflow-y: auto; }   /* на мобильном сворачивание не применяем */
    .atlas-header { padding: 0 12px; gap: 10px; }
    .atlas-brand-text { font-size: 15px; }
    .atlas-brand-text small { display: none; }
    .atlas-header-logo img { height: 32px; }
    .atlas-poets { width: 174px; max-height: 56%; top: 6px; right: 6px; }
    .atlas-exit-city .exit-full { display: none; }   /* на мобильном — коротко «Выйти» */
    .poets-filter { display: none; }
    .atlas-timeline { left: 8px; right: 8px; bottom: 8px; gap: 9px; padding: 7px 10px; }
    .atlas-card { max-width: none; }
    /* переключатель вида — компактный, слева (правый верх занят панелью поэтов, левый — зумом карты) */
    .atlas-view-toggle { left: 46px; top: 6px; transform: none; }
    .atlas-view-toggle button { padding: 7px 10px; }
    .atlas-view-toggle button span { display: none; }   /* только иконки на узком экране */
}

/* ============================================================
   ЧЁРНО-БЕЛЫЙ РЕЖИМ (общая галочка сайта: settings.grayscale).
   Атрибут data-grayscale="1" ставит index.php серверно.
   Обесцвечиваем через fixed-оверлей с backdrop-filter, а НЕ через
   filter на <html>: filter создал бы containing block и сломал бы
   position:fixed слои Leaflet/панелей/тултипов. Оверлей раскладку
   не трогает и красит всё под собой в серое — тайлы карты, пины,
   дуги, портреты и WebGL-глобус. pointer-events:none — карта
   остаётся кликабельной и перетаскиваемой.
   ============================================================ */
html[data-grayscale="1"]::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    pointer-events: none;
    -webkit-backdrop-filter: grayscale(1);
    backdrop-filter: grayscale(1);
}
