/* Публічна мапа відключень (energy.ks.ua/map): міста й села. Темна/світла тема, кольори — як у веб-дашборді. */

:root {
    --bg: #12151c;
    --bg-panel: #1a1f2b;
    --bg-cell: #232a38;
    --border: #2e3646;
    --text: #e5e9f0;
    --text-dim: #8b93a3;
    --accent: #3b82f6;
    --legend-bg: rgba(26, 31, 43, 0.92);
    --strip-cur: #ffffff;
    /* Контроли шапки */
    --control-h: 34px;
    --radius: 8px;
    --border-hover: #46506a;
    --accent-soft: rgba(59, 130, 246, 0.18);
    --seg-active: #3a4458;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    color-scheme: dark;
}

/* Світла тема: перемикач у шапці (map.js), вибір зберігається в localStorage */
:root[data-theme="light"] {
    --bg: #f4f6fa;
    --bg-panel: #ffffff;
    --bg-cell: #eef1f6;
    --border: #d3d9e3;
    --text: #1a1f2b;
    --text-dim: #5b6475;
    --accent: #2563eb;
    --legend-bg: rgba(255, 255, 255, 0.94);
    --strip-cur: #1a1f2b;
    --border-hover: #b3bccb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --seg-active: #ffffff;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6475' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6475' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.hidden {
    display: none !important;
}

/* Мапа — на весь екран; під нею (прокруткою сторінки) — текстовий опис .map-about */
.map-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.map-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    /* Вище за контроли MapLibre (z-index 2): випадний список пошуку перекриває мапу */
    position: relative;
    z-index: 5;
}

.map-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

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

/* Назва з іконкою додатка (та сама, що на сайті й у Google Play) */
.map-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 6px 0 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.map-logo {
    flex: 0 0 auto;
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

/* Спільне для контролів: висота, фокус */
.map-select,
.search-input,
.pill-btn,
.icon-btn,
.field-box {
    height: var(--control-h);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--bg-cell);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s, color 0.15s;
}

.map-select:hover,
.search-input:hover:not(:disabled),
.pill-btn:hover,
.icon-btn:hover,
.field-box:hover {
    border-color: var(--border-hover);
}

.map-select:focus-visible,
.search-input:focus,
.pill-btn:focus-visible,
.icon-btn:focus-visible,
.seg-btn:focus-visible,
.field-box:focus-within {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Селекти: своя стрілка замість системної */
.select-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.map-select {
    -webkit-appearance: none;
    appearance: none;
    padding: 0 32px 0 12px;
    background-image: var(--chevron);
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.map-select option {
    background: var(--bg-panel);
    color: var(--text);
}

/* Селект із підписом усередині рамки: «Група усі ▾» */
.field-box {
    gap: 6px;
    padding-left: 12px;
    cursor: pointer;
}

.field-prefix {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.field-box .map-select {
    height: calc(var(--control-h) - 2px);
    border: 0;
    padding-left: 0;
    background-color: transparent;
    box-shadow: none;
}

/* Сегментовані перемикачі: «Світло | Групи», «Сьогодні | Завтра» */
.seg {
    display: inline-flex;
    height: var(--control-h);
    padding: 3px;
    gap: 2px;
    background: var(--bg-cell);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.seg-btn {
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg-btn:hover {
    color: var(--text);
}

.seg-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* День — другорядний вибір: активна кнопка нейтральна */
.map-day .seg-btn.active {
    background: var(--seg-active);
    color: var(--text);
}

/* Кнопка-іконка (тема) — у правому краї першого ряду */
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: var(--control-h);
    padding: 0;
    cursor: pointer;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-theme {
    margin-left: auto;
}

/* Час: повзунок із заповненою частиною (--pct з map.js), мітка слоту, «Зараз» */
.map-time {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 6px;
}

.map-range {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 20px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}

.map-range::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--border) var(--pct, 0%));
}

.map-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.15s;
}

.map-range::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
}

.map-range::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
}

.map-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.map-range:focus {
    outline: none;
}

.map-range:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px var(--accent-soft), 0 1px 4px rgba(0, 0, 0, 0.35);
}

.map-range:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px var(--accent-soft), 0 1px 4px rgba(0, 0, 0, 0.35);
}

.map-slot-label {
    min-width: 98px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    background: var(--accent-soft);
    font-size: 13px;
    font-weight: 600;
    line-height: 28px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px 0 12px;
    border-radius: 999px;
    color: var(--text-dim);
    font-weight: 500;
    cursor: pointer;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

/* «Зараз» увімкнено: мапа йде за поточним часом */
.pill-btn.active {
    color: var(--text);
    border-color: rgba(34, 197, 94, 0.55);
    background-color: rgba(34, 197, 94, 0.12);
}

.pill-btn.active .live-dot {
    background: #22c55e;
    opacity: 1;
    animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .pill-btn.active .live-dot {
        animation: none;
    }
}

/* Чипи — кнопки в попапах */
.map-chip {
    background: var(--bg-cell);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    min-height: 32px;
}

.map-chip:hover {
    border-color: var(--border-hover);
}

.map-field {
    display: flex;
    align-items: center;
}

/* Комбобокс пошуку: «Пункт» → «Вулиця» (map.js, createCombo) */
.combo {
    position: relative;
}

/* Пункт і вулиця заповнюють решту ряду (у межах 170–280 px) */
#city-field,
#street-field {
    flex: 1 1 170px;
    max-width: 280px;
}

.map-field .combo {
    flex: 1 1 auto;
    min-width: 0;
}

/* Поле пошуку з лупою */
.search-input {
    width: 100%;
    padding: 0 30px 0 34px;
    background-image: var(--search-icon);
    background-repeat: no-repeat;
    background-position: 11px center;
    background-size: 15px;
}

.search-input::placeholder {
    color: var(--text-dim);
    opacity: 1;
}

.search-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.combo-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.combo-clear:hover {
    color: var(--text);
    background: var(--border);
}

.combo-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 10;
    width: max(100%, 300px);
    max-width: calc(100vw - 24px);
    max-height: min(360px, 60vh);
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.combo-list li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 10px;
    color: var(--text);
    cursor: pointer;
}

.combo-list li.active {
    background: var(--bg-cell);
    box-shadow: inset 3px 0 0 var(--accent);
}

.combo-list li b {
    color: var(--accent);
    font-weight: 700;
}

.combo-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.combo-hint {
    flex: 0 0 auto;
    color: var(--text-dim);
    font-size: 12px;
    white-space: nowrap;
}

.combo-list li.combo-note {
    color: var(--text-dim);
    font-size: 12px;
    cursor: default;
}

.map-banner {
    background: #7f1d1d;
    color: #fee2e2;
    text-align: center;
    padding: 6px 12px;
    font-weight: 600;
}

.map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.map {
    position: absolute;
    inset: 0;
}

.map-state {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    z-index: 3;
}

/* Довантаження будинків пунктів у видимій області */
.map-loading {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-dim);
    z-index: 3;
}

.map-legend {
    position: absolute;
    left: 12px;
    bottom: 28px;
    background: var(--legend-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    z-index: 3;
    max-width: 260px;
}

.map-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-legend-row b {
    margin-left: auto;
    padding-left: 12px;
    font-variant-numeric: tabular-nums;
}

/* Кнопка розгортання — лише на вузькому екрані */
.map-legend-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 0 0 0 4px;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

.dot.on { background: #22c55e; }
.dot.off { background: #ef4444; }
.dot.unknown { background: #6b7280; }

.map-meta,
.map-note {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 6px;
}

/* Режим «Групи»: повзунок часу не впливає на території — ховаємо; примітки легенди за режимом */
.mode-groups .map-time,
.mode-groups .map-note-state,
.map-note-groups {
    display: none;
}

.mode-groups .map-note-groups {
    display: block;
}

.legend-groups-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-groups-head b {
    font-variant-numeric: tabular-nums;
}

.legend-groups-all {
    margin-left: auto;
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
}

.legend-groups-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.legend-groups-actions .legend-groups-all {
    margin-left: 0;
}

/* Перелік груп: прокрутка для великих регіонів (Київ — 60+ груп) */
.group-legend-list {
    margin-top: 6px;
    max-height: min(38vh, 300px);
    overflow-x: hidden;
    overflow-y: auto;
    width: 300px;
}

/* Три колонки, порядок зверху вниз (кількість рядків — inline з map.js) */
.group-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 2px 6px;
}

.group-block-title {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 6px 0 2px;
}

.group-block-title:first-child {
    margin-top: 0;
}

.mode-groups .map-legend {
    max-width: 326px;
}

.group-row {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    background: none;
    border: 0;
    border-radius: 4px;
    padding: 2px 3px;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.group-row:hover {
    background: var(--bg-cell);
}

.group-row b {
    margin-left: auto;
    color: var(--text-dim);
    font-weight: 400;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.group-row.off {
    opacity: 0.4;
}

.group-row.off .swatch {
    background: transparent !important;
    box-shadow: inset 0 0 0 1px var(--text-dim);
}

.group-name {
    white-space: nowrap;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
    flex: 0 0 auto;
}

.pop-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}

.pop-row b {
    margin-left: auto;
    padding-left: 12px;
    font-variant-numeric: tabular-nums;
}

/* Попап MapLibre у темній темі */
.maplibregl-popup-content {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}

.maplibregl-popup-tip {
    border-top-color: var(--bg-panel) !important;
    border-bottom-color: var(--bg-panel) !important;
}

.maplibregl-popup-close-button {
    color: var(--text-dim);
    font-size: 18px;
}

.pop-addr {
    font-weight: 700;
    padding-right: 14px;
}

.pop-time,
.pop-note {
    color: var(--text-dim);
    font-size: 12px;
    margin: 2px 0 6px;
}

.pop-group {
    margin: 6px 0;
}

.pop-num {
    font-size: 15px;
}

.pop-btn {
    margin-top: 8px;
    width: 100%;
    color: var(--text);
    border-color: var(--accent);
}

.strip {
    display: flex;
    gap: 1px;
    margin-top: 4px;
}

.strip-cell {
    flex: 1 1 0;
    height: 10px;
    border-radius: 1px;
}

.strip-cell.cur {
    outline: 2px solid var(--strip-cur);
    outline-offset: 0;
    z-index: 1;
}

.strip-axis {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    font-size: 10px;
}

/* ── Нижня панель: промо додатка + місце під рекламу (promo.js) ─────────── */

.map-dock {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 4;
}

.app-promo {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-promo-icon {
    flex: 0 0 auto;
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.app-promo-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.app-promo-title {
    font-size: 14px;
    font-weight: 700;
}

.app-promo-desc {
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.35;
}

/* Кнопка в стилі значка магазину: чорна в обох темах */
.app-promo-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px 0 10px;
    border: 1px solid #5f6368;
    border-radius: 9px;
    background: #000;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s;
}

.app-promo-btn:hover {
    background: #1f1f1f;
    border-color: #9aa0a6;
}

.app-promo-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.app-promo-play {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.app-promo-btn-long {
    display: flex;
    flex-direction: column;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.05;
}

.app-promo-btn-long small {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.app-promo-btn-short {
    display: none;
    font-size: 14px;
    font-weight: 600;
}

.app-promo-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-dim);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.app-promo-close:hover {
    background: var(--bg-cell);
    color: var(--text);
}

/* Зарезервований розмір рекламного блока: 728×90 (на вузькому екрані — 320×50) */
.ad-slot {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
}

.ad-unit {
    display: block;
    width: 728px;
    height: 90px;
    overflow: hidden;
}

.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-hover);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Середня ширина: банер 728 не вміщається поруч із промо — під ним */
@media (min-width: 721px) and (max-width: 1180px) {
    .map-dock:has(.ad-slot:not(.hidden)) {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }

    .map-dock:has(.ad-slot:not(.hidden)) .app-promo {
        flex-basis: 100%;
    }
}

@media (max-width: 720px) {
    /* Нижня панель: компактне промо, реклама 320×50 під ним */
    .map-dock {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 6px 8px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .app-promo {
        gap: 10px;
    }

    .app-promo-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .app-promo-title {
        font-size: 13px;
    }

    .app-promo-desc {
        font-size: 11.5px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .app-promo-btn {
        height: 36px;
        padding: 0 12px 0 9px;
        gap: 6px;
    }

    .app-promo-play {
        width: 18px;
        height: 18px;
    }

    .app-promo-btn-long {
        display: none;
    }

    .app-promo-btn-short {
        display: inline;
    }

    .app-promo-close {
        width: 24px;
        height: 24px;
        margin-left: -4px;
    }

    .ad-unit {
        width: 320px;
        height: 50px;
    }

    .map-header {
        gap: 8px;
        padding: 8px 12px;
    }

    .map-brand {
        font-size: 15px;
        margin-right: 0;
        gap: 7px;
    }

    .map-logo {
        width: 28px;
        height: 28px;
    }

    /* Ряд 1: назва, регіон (на решту ширини), тема; далі — два перемикачі по половині */
    .map-region-box {
        flex: 1 1 110px;
        min-width: 0;
    }

    .map-region-box .map-select {
        width: 100%;
        min-width: 0;
    }

    .map-theme {
        margin-left: 0;
    }

    .seg {
        order: 5;
        flex: 1 1 140px;
    }

    .seg-btn {
        flex: 1 1 0;
        padding: 0 8px;
    }

    .map-time {
        width: 100%;
        margin-right: 0;
    }

    .map-range {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .field-box {
        flex: 0 1 auto;
    }

    /* Пункт і вулиця — по половині рядка */
    #city-field,
    #street-field {
        flex: 1 1 140px;
        max-width: none;
        min-width: 0;
    }

    #city-field .combo,
    #street-field .combo {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Список — на всю ширину шапки (не обрізаний краєм екрана): комбобокс без
       власного позиціонування, кнопка «×» — у потоці поверх правого краю поля */
    .combo {
        position: static;
        display: flex;
        align-items: center;
    }

    .search-input {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }

    .combo-clear {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        flex: 0 0 auto;
        margin-left: -26px;
    }

    .combo-list {
        top: 100%;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
    }

    .map-legend {
        left: 8px;
        right: auto;
        bottom: 24px;
        font-size: 12px;
        padding: 6px 10px;
        max-width: calc(100% - 16px);
        cursor: pointer;
    }

    /* Згорнуто: один рядок «точка + число», без підписів і приміток */
    .map-legend:not(.open) .map-legend-rows {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .map-legend:not(.open) .map-legend-label,
    .map-legend:not(.open) .map-meta,
    .map-legend:not(.open) .map-note {
        display: none;
    }

    .map-legend:not(.open) .map-legend-row {
        gap: 5px;
    }

    .map-legend:not(.open) .map-legend-row b {
        padding-left: 0;
    }

    .map-legend-toggle {
        display: block;
        min-width: 24px;
        min-height: 24px;
    }

    .map-legend:not(.open) .group-legend-list,
    .map-legend:not(.open) .legend-groups-actions {
        display: none !important;
    }

    .group-legend-list {
        width: min(300px, calc(100vw - 40px));
        max-height: 30vh;
    }

    .map-legend.open .legend-groups-head {
        padding-right: 22px;
    }

    .map-legend.open .map-legend-toggle {
        position: absolute;
        top: 6px;
        right: 8px;
    }

    .map-legend.open .map-legend-rows {
        padding-right: 22px;
    }
}

/* Низький екран (телефон горизонтально, вбудоване вікно): лише рядки легенди */
@media (max-height: 560px) {
    /* Нижня панель: лише назва й кнопка */
    .app-promo-desc {
        display: none;
    }

    /* Один ряд: промо + банер 320×50 (728×90 з'їв би майже всю мапу) */
    .map-dock,
    .map-dock:has(.ad-slot:not(.hidden)) {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .map-dock:has(.ad-slot:not(.hidden)) .app-promo {
        flex-basis: auto;
    }

    .ad-unit {
        width: 320px;
        height: 50px;
    }

    .map-meta,
    .map-note {
        display: none;
    }

    .map-legend {
        bottom: 8px;
        padding: 6px 8px;
    }
}

/* ── Опис під мапою (scripts/build_map_seo_pages.js) ─────────────────── */

.map-about {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 16px 40px;
    font-size: 15px;
    line-height: 1.6;
}

.map-about h2 {
    font-size: 24px;
    line-height: 1.3;
    margin: 8px 0 12px;
}

.map-about h3 {
    font-size: 17px;
    margin: 0 0 8px;
}

.map-about p,
.map-about ol {
    margin: 0 0 12px;
}

.map-about ol {
    padding-left: 20px;
}

.map-about a {
    color: var(--accent);
}

.map-about .lead {
    color: var(--text);
    font-size: 16px;
}

.map-crumbs {
    font-size: 13px;
    color: var(--text-dim);
}

.map-crumbs a {
    color: var(--text-dim);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 20px 0 24px;
}

.about-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.about-card p:last-child,
.about-card ol:last-child {
    margin-bottom: 0;
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.about-links a {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-panel);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
}

.about-links a:hover {
    border-color: var(--border-hover);
}

.about-links a[aria-current="page"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.about-links small {
    color: var(--text-dim);
}

.about-note {
    color: var(--text-dim);
    font-size: 13px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* Графік груп текстом (seo:about з --live) */
.map-today {
    margin: 20px 0 8px;
}

.map-today h4 {
    margin: 12px 0 6px;
    font-size: 15px;
}

.sched-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 4px 16px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.sched-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.sched-more,
.about-faq details {
    margin: 0 0 12px;
}

.sched-more summary,
.about-faq summary {
    cursor: pointer;
    font-weight: 600;
}

.about-faq {
    margin: 0 0 24px;
}

.about-faq details {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.about-faq p {
    margin: 8px 0 0;
    color: var(--text-dim);
}

.today-state,
.today-note {
    color: var(--text-dim);
}
