html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

.traces-page {
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.traces-page .page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

.traces-page.traces-app-shell .navbar {
    display: none;
}

#map-container {
    flex: 1;
    width: 100%;
    position: relative;
    background: #111;
}

/* UI OVERLAYS */
#ui-overlay {
    position: absolute;
    top: 80px; /* Below navbar */
    left: 20px;
    right: 20px;
    bottom: 20px;
    pointer-events: none;
    z-index: 1000;
    /* Одна кривая и длительность для FAB «Оставить сигнал» и .map-search-control */
    --fab-sync-dur: 0.34s;
    --fab-sync-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

.traces-page.traces-app-shell #ui-overlay {
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    bottom: 12px;
}

.map-search-control {
    position: absolute;
    right: calc(20px + env(safe-area-inset-right, 0px) + 252px + 18px);
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 1;
    transition:
        right var(--fab-sync-dur) var(--fab-sync-ease),
        opacity var(--fab-sync-dur) var(--fab-sync-ease);
    pointer-events: auto;
    /* Выше hitbox FAB: пустая зона hitbox с pointer-events: none не должна «съедать» клики по иконке */
    z-index: 6;
}

/* Поиск двигается синхронно с FAB: те же --fab-sync-dur / --fab-sync-ease (блоки в разметке отдельные). Дребезг снят ранним сбросом fab-expand-shield в app.js. */
#add-trace-hitbox:hover + .map-search-control,
#add-trace-hitbox:focus-within + .map-search-control,
#ui-overlay.placing .map-search-control {
    right: calc(20px + env(safe-area-inset-right, 0px) + 58px + 12px);
    opacity: 1;
}

/* Открытая панель — чуть выше, чтобы поле не терялось под соседними слоями */
.map-search-control.is-open {
    z-index: 7;
}

.map-search-toggle {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: var(--border-solid);
    border-radius: 6px;
    background: rgba(14, 14, 18, 0.94);
    color: #fff;
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    backdrop-filter: blur(16px);
    cursor: pointer;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        background-color 0.18s ease;
}

.map-search-toggle:hover {
    transform: translateY(-1px);
    color: #fff;
    border-color: rgba(217, 28, 28, 0.7);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(217, 28, 28, 0.28) inset;
}

.map-search-toggle:active {
    transform: translateY(0);
}

.map-search-toggle svg {
    width: 24px;
    height: 24px;
    display: block;
}

.map-search-panel {
    position: absolute;
    /* 100% ширины родителя — левый край иконки; иначе calc(100% + 10px) уезжает вправо и наезжает на «Оставить сигнал» */
    right: 100%;
    margin-right: 12px;
    bottom: 0;
    width: min(320px, calc(100vw - 40px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    transform-origin: right center;
}

.map-search-panel.hidden {
    display: none;
}

.map-search-panel__input {
    width: 100%;
    min-width: 0;
    height: 58px;
    border: var(--border-solid);
    border-radius: 6px;
    /* Плотный тёмный фон: на светлой карте полупрозрачность + blur дают «белое» поле с невидимым белым текстом */
    background: rgba(14, 14, 18, 0.94);
    color: #fff;
    padding: 0 16px;
    font: inherit;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    outline: none;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    backdrop-filter: blur(16px);
    animation: map-search-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.map-search-panel__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.map-search-panel__input:focus {
    border-color: rgba(217, 28, 28, 0.7);
    box-shadow: 0 0 0 3px rgba(217, 28, 28, 0.14);
    background: rgba(10, 10, 14, 0.98);
    transform: translateY(-1px);
}

.map-search-results {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: min(52vh, 320px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none; /* Firefox: прокрутка без видимого скроллбара */
    -ms-overflow-style: none; /* legacy Edge */
    border: var(--border-solid);
    border-radius: 6px;
    background: rgba(14, 14, 18, 0.96);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    backdrop-filter: blur(16px);
}

.map-search-results::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.map-search-results[hidden] {
    display: none !important;
}

.map-search-results__item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.map-search-results__item:last-child {
    border-bottom: none;
}

.map-search-results__btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #fff;
    font: inherit;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.88rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.14s ease;
}

.map-search-results__btn:hover,
.map-search-results__btn:focus-visible {
    background: rgba(217, 28, 28, 0.12);
    outline: none;
}

.map-search-results__btn.is-active {
    background: rgba(217, 28, 28, 0.2);
}

.map-search-results__title {
    display: block;
    font-weight: 600;
}

.map-search-results__sub {
    display: block;
    margin-top: 3px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.52);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.map-search-preview-marker {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 28%, rgba(217, 28, 28, 0.95) 29% 100%);
    border: 2px solid rgba(255, 255, 255, 0.98);
    box-shadow:
        0 0 0 7px rgba(217, 28, 28, 0.18),
        0 10px 24px rgba(0, 0, 0, 0.34);
}

.map-search-preview-marker::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(217, 28, 28, 0.34);
    animation: map-search-pulse 1.8s ease-out infinite;
}

@keyframes map-search-pulse {
    from {
        transform: scale(0.72);
        opacity: 0.9;
    }

    to {
        transform: scale(1.28);
        opacity: 0;
    }
}

@keyframes map-search-panel-in {
    from {
        opacity: 0;
        transform: translateX(14px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 768px) {
    #add-trace-hitbox {
        right: calc(12px + env(safe-area-inset-right, 0px));
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .map-search-control {
        right: calc(12px + env(safe-area-inset-right, 0px) + 252px + 14px);
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    #add-trace-hitbox:hover + .map-search-control,
    #add-trace-hitbox:focus-within + .map-search-control,
    #ui-overlay.placing .map-search-control {
        right: calc(12px + env(safe-area-inset-right, 0px) + 58px + 10px);
    }

    .map-search-panel {
        width: min(228px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    }
}

.glass-panel {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(217, 28, 28, 0.28);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 20px;
    pointer-events: auto;
}

#add-trace-hitbox {
    position: absolute;
    right: calc(20px + env(safe-area-inset-right, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 252px;
    height: 58px;
    /* auto: вся полоса 252×58 держит :hover при сжатой кнопке — иначе «наложение» и дребезг в центре */
    pointer-events: auto;
    transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 5;
}

/* После ухода курсора FAB разворачивается влево; без щита под курсором снова оказывается hitbox → ложный :hover и «следование». Небольшой щит — события идут на карту. */
#add-trace-hitbox.fab-expand-shield,
#add-trace-hitbox.fab-expand-shield #add-trace-btn {
    pointer-events: none !important;
}

/* Режим расстановки: FAB уезжает вниз и остаётся только «+», чтобы не перекрывать сценарий */
#ui-overlay.placing #add-trace-hitbox {
    transform: translateY(52px);
    width: 58px;
}

#ui-overlay.placing #add-trace-hitbox #add-trace-btn {
    width: 58px;
    min-width: 58px;
    border-radius: var(--fab-radius-square, 2px);
    padding: 0;
    gap: 0;
    justify-content: center;
    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

#ui-overlay.placing #add-trace-hitbox #add-trace-btn .btn-label-wrap {
    max-width: 0;
    min-width: 0;
    width: 0;
    flex: 0 0 0;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Схлопывание: hover по всей полосе hitbox + фокус (клавиатура) */
#add-trace-hitbox:hover #add-trace-btn,
#add-trace-hitbox:focus-within #add-trace-btn {
    width: 58px;
    min-width: 58px;
    border-radius: var(--fab-radius-square);
    padding: 0;
    gap: 0;
    justify-content: center;
}

#add-trace-hitbox:hover #add-trace-btn .btn-label-wrap,
#add-trace-hitbox:focus-within #add-trace-btn .btn-label-wrap {
    max-width: 0;
    min-width: 0;
    width: 0;
    flex: 0 0 0;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Кнопка якорится справа: узкий вид — квадрат 58×58 с «+»; полоса растёт влево с теми же прямыми углами; текст — btn-label-wrap. */
#add-trace-btn {
    --fab-ease: var(--fab-sync-ease);
    --fab-dur: var(--fab-sync-dur);
    --fab-radius-bar: 6px;
    --fab-radius-square: 2px;
    position: absolute;
    inset: 0;
    left: auto;
    right: 0;
    bottom: 0;
    top: 0;
    margin-left: auto;
    pointer-events: auto;
    width: 264px;
    max-width: 100%;
    height: 58px;
    padding: 0 18px;
    /* Как раньше: display-шрифт страницы, не «усыпленный» Inter */
    font-family: 'Jora TYGRA', 'JoraTYGRA', 'Bebas Neue', 'Impact', sans-serif;
    text-transform: uppercase;
    font-size: 1.34rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--fab-radius-bar);
    background: var(--color-red);
    color: #fff;
    border: var(--border-solid);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.85);
    overflow: hidden;
    transition:
        width var(--fab-dur) var(--fab-ease),
        border-radius var(--fab-dur) var(--fab-ease),
        padding var(--fab-dur) var(--fab-ease),
        gap var(--fab-dur) var(--fab-ease),
        box-shadow var(--fab-dur) var(--fab-ease),
        transform 0.12s ease;
}

/* Без translate при hover — вместе с анимацией ширины давало «двойную» тень/текст */
#add-trace-hitbox:hover #add-trace-btn {
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.82);
}

#add-trace-btn:active {
    transform: translate(2px, 2px);
}

#add-trace-btn .btn-label-wrap {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(280px, 70vw);
    overflow: hidden;
    transition: max-width var(--fab-dur) var(--fab-ease);
}

#add-trace-btn .btn-label {
    display: block;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
}

#add-trace-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.15em;
    height: 1.15em;
    font-size: 1em;
    line-height: 1;
}

/* Узкий FAB только в режиме расстановки точки (.placing), пока пользователь тапает по карте */

/* Вертикальный стек звёзд над кнопкой «+» */
#signal-star-stack {
    position: absolute;
    right: 20px;
    bottom: 90px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: auto;
    z-index: 1001;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition:
        opacity 0.24s ease,
        transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s;
}

#signal-star-stack.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(16px);
    transition:
        opacity 0.18s ease,
        transform 0.22s ease,
        visibility 0s linear 0.22s;
}

.star-stack-row {
    position: relative;
    display: flex;
    justify-content: flex-end;
    width: 48px;
    flex-shrink: 0;
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.28s ease,
        transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

#signal-star-stack:not(.hidden) .star-stack-row {
    opacity: 1;
    transform: translateY(0);
}

#signal-star-stack:not(.hidden) .star-stack-row:nth-child(1) {
    transition-delay: 0.05s;
}

#signal-star-stack:not(.hidden) .star-stack-row:nth-child(2) {
    transition-delay: 0.1s;
}

#signal-star-stack:not(.hidden) .star-stack-row:nth-child(3) {
    transition-delay: 0.15s;
}

/* Плитки звёзд — тот же «premium» язык, что архив / главная: белая карточка, мягкая тень */
.signal-star-btn {
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 7px;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    cursor: pointer;
    background: #ffffff;
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.03);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.signal-star-btn:hover {
    transform: translateY(-2px);
    border-color: #dcdcdc;
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.07),
        0 1px 3px rgba(0, 0, 0, 0.04);
}

.signal-star-btn:active {
    transform: translateY(0);
}

.signal-star-btn svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.1));
}

.signal-star-btn path {
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 3.5;
    transition: transform 0.16s ease;
}

.signal-star-btn.moment path {
    fill: #2563eb;
}

.signal-star-btn.trace path {
    fill: #eab308;
}

.signal-star-btn.scenario path {
    fill: #9333ea;
}

.signal-star-btn:hover path {
    transform: scale(1.06);
    transform-origin: center;
}

/*
 * Панели описаний — в духе archive-key-panel__hint-box / premium-card:
 * белый фон, лёгкая рамка, тень, полоска сверху (как в архиве), акцент слева + мягкое «неоновое» свечение.
 */
.kind-hover-panel {
    --kind-accent: var(--color-red, #e60033);
    --kind-glow-inner: rgba(230, 0, 51, 0.1);
    --kind-glow-outer: rgba(230, 0, 51, 0.04);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    z-index: 2;
    width: max-content;
    max-width: min(400px, calc(100vw - 120px));
    padding: 0.95rem 1rem 1rem 1.05rem;
    box-sizing: border-box;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 14px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.55),
        inset 0 0 40px -6px var(--kind-glow-inner),
        inset 0 0 92px -28px var(--kind-glow-outer);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%) translateX(14px);
    transition:
        opacity 0.24s ease,
        transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.28s;
}

.kind-hover-panel.moment {
    --kind-accent: #2563eb;
    --kind-glow-inner: rgba(37, 99, 235, 0.13);
    --kind-glow-outer: rgba(37, 99, 235, 0.05);
}

.kind-hover-panel.trace {
    --kind-accent: #ca8a04;
    --kind-glow-inner: rgba(234, 179, 8, 0.14);
    --kind-glow-outer: rgba(202, 138, 4, 0.06);
}

.kind-hover-panel.scenario {
    --kind-accent: #9333ea;
    --kind-glow-inner: rgba(147, 51, 234, 0.13);
    --kind-glow-outer: rgba(147, 51, 234, 0.05);
}

.kind-hover-copy {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
    text-align: left;
}

/* Как .archive-key-panel__hint-box p: Inter, жирный первый блок */
.kind-hover-lead {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: #111111;
    display: block;
    margin-bottom: 0.45rem;
}

.kind-hover-panel.moment .kind-hover-lead {
    color: #0f172a;
}

.kind-hover-panel.trace .kind-hover-lead {
    color: #1c1917;
}

.kind-hover-panel.scenario .kind-hover-lead {
    color: #0f172a;
}

.kind-hover-body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: #555555;
}

.star-stack-row:hover .kind-hover-panel,
.star-stack-row:focus-within .kind-hover-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0s, 0s, 0s;
}

/* Кнопка сценария: не наследует гигантский .btn-primary с главной */
.scenario-finish-btn {
    position: absolute;
    right: 20px;
    bottom: 96px;
    pointer-events: auto;
    z-index: 1002;
    margin: 0;
    align-self: auto;
    appearance: none;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.35;
    color: #fafafa;
    padding: 0.5rem 0.95rem;
    max-width: min(268px, calc(100vw - 40px));
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(165deg, #d4002c 0%, #9f0020 100%);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition:
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.scenario-finish-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow:
        0 8px 22px rgba(212, 0, 44, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.scenario-finish-btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

.scenario-finish-btn.hidden {
    display: none !important;
}

@media (max-width: 520px) {
    .scenario-finish-btn {
        right: 16px;
        left: auto;
        max-width: calc(100vw - 32px);
        font-size: 0.58rem;
        padding: 0.45rem 0.75rem;
    }
}

/* Подсказка до выбора точки (редактор открывается только по клику на звезду) */
.scenario-step-select-hint {
    position: absolute;
    right: 20px;
    bottom: 148px;
    max-width: min(300px, calc(100% - 40px));
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        0 8px 26px rgba(17, 17, 17, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    z-index: 1001;
    pointer-events: none;
}

.scenario-step-select-hint.hidden {
    display: none !important;
}

.scenario-step-select-hint__text {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.45;
    letter-spacing: 0.04em;
    color: #444;
}

@media (max-width: 520px) {
    .scenario-step-select-hint {
        right: 16px;
        bottom: 138px;
        max-width: calc(100% - 32px);
    }
}

/* Редактор точки сценария — над выбранной звездой (как всплывашка у меток) */
.scenario-step-editor {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, calc(100vw - 24px));
    max-height: min(520px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.72rem 0.78rem 0.82rem;
    border-radius: 18px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.985) 0%, rgba(247, 246, 242, 0.985) 100%);
    box-shadow:
        8px 8px 0 rgba(0, 0, 0, 0.72),
        0 12px 34px rgba(0, 0, 0, 0.2),
        inset 0 0 44px -6px rgba(142, 76, 255, 0.1),
        inset 0 0 100px -32px rgba(142, 76, 255, 0.05);
    z-index: 10003;
    overflow: auto;
    pointer-events: auto;
    transform: none;
}

.scenario-step-editor.hidden {
    display: none !important;
}

.scenario-step-panel-form {
    display: grid;
    gap: 0.75rem;
}

.scenario-step-panel__label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 0.28rem;
}

.scenario-step-panel__input,
.scenario-step-panel__textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-size: 0.92rem;
    background: #fff;
}

.scenario-step-panel__textarea {
    resize: vertical;
    min-height: 96px;
}

.scenario-step-panel-media {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.scenario-step-panel__hint {
    font-size: 0.58rem;
    color: #888;
}

.scenario-step-panel__media-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.45rem;
}

.scenario-step-panel__media-empty {
    padding: 0.7rem;
    border-radius: 12px;
    border: 1px dashed rgba(17, 17, 17, 0.12);
    color: #777;
    font-size: 0.62rem;
    line-height: 1.45;
}

.scenario-step-panel__media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: #f6f6f8;
}

.scenario-step-panel__media-el {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.scenario-step-panel__media-pill {
    position: absolute;
    left: 0.45rem;
    bottom: 0.45rem;
    padding: 0.22rem 0.38rem;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.74);
    color: #fff;
    font-size: 0.48rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scenario-step-panel__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.scenario-step-panel__btn--media {
    border-color: rgba(142, 76, 255, 0.35);
    color: #5b21b6;
}

.scenario-step-panel__btn--danger {
    border-color: rgba(196, 0, 47, 0.35);
    color: #b91c1c;
    margin-top: 0.25rem;
}

.scenario-step-editor__note {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #666;
}

.signal-title-input {
    min-height: 0;
    height: 50px;
    resize: none;
}

.signal-gallery-wrap {
    display: grid;
    gap: 8px;
    font-size: 0.75rem;
    letter-spacing: 0.7px;
    color: #9b9b9b;
    text-transform: uppercase;
}

/* Скрытие секций в форме следа (класс .hidden в модалке нигде глобально не задан) */
#modal-add-trace .hidden {
    display: none !important;
}

#add-trace-form [hidden] {
    display: none !important;
}

/* Форма следа: стек карточек + сетка «точка» */
.trace-form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.trace-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 220px);
    grid-template-rows: 1fr;
    gap: 1rem 1.25rem;
    align-items: stretch;
}

/* Карточки модалки «След» */
#modal-add-trace .trace-form-stack {
    gap: 0.85rem;
}

#modal-add-trace .trace-card {
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 12px 36px rgba(17, 17, 17, 0.07);
    padding: 1rem 1.2rem 1.2rem;
}

#modal-add-trace .trace-card--toolbar {
    padding: 1rem 1rem 1.05rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
    background: #ffffff;
    border-color: rgba(17, 17, 17, 0.09);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 6px 18px rgba(17, 17, 17, 0.05);
}

#modal-add-trace .trace-card--kind-picker {
    padding: 1.05rem;
    overflow: hidden;
}

#modal-add-trace .trace-v2-kind--cards {
    width: 100%;
    display: grid;
    gap: 0.9rem;
}

#modal-add-trace .trace-kind-picker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
}

#modal-add-trace .trace-kind-picker-head-main {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    min-width: 0;
}

#modal-add-trace .trace-kind-picker-line {
    width: 4px;
    min-width: 4px;
    height: 54px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff003c 0%, #8f001f 100%);
    box-shadow: 0 0 20px rgba(255, 0, 60, 0.28);
}

#modal-add-trace .trace-kind-picker-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

#modal-add-trace .trace-kind-picker-head .trace-card__title {
    margin: 0;
}

#modal-add-trace .trace-kind-picker-head .trace-card__kicker {
    margin: 0;
    max-width: 52ch;
}

#modal-add-trace .trace-kind-picker-head-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

#modal-add-trace .trace-kind-picked-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.55rem;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#modal-add-trace .trace-kind-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    max-height: 440px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition:
        max-height 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.28s ease,
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        margin-top 0.4s ease;
}

#modal-add-trace .trace-kind-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 0.8rem;
    width: 100%;
    padding: 0.8rem;
    text-align: left;
    cursor: pointer;
    border-radius: 20px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 248, 250, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 10px 24px rgba(17, 17, 17, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#modal-add-trace .trace-kind-card:hover {
    transform: translateY(-2px);
    border-color: rgba(196, 0, 47, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 14px 30px rgba(17, 17, 17, 0.1);
}

#modal-add-trace .trace-kind-card.is-active {
    border-color: rgba(196, 0, 47, 0.36);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.98),
        0 16px 38px rgba(17, 17, 17, 0.12),
        0 0 0 2px rgba(196, 0, 47, 0.09);
}

#modal-add-trace .trace-kind-card.is-active::after {
    content: 'выбрано';
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.28rem 0.5rem;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: #111;
    color: #fff;
}

#modal-add-trace .trace-kind-card__visual {
    position: relative;
    height: 150px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: #ffffff;
}

#modal-add-trace .trace-kind-card__visual--qr {
    background: #17171d;
}

#modal-add-trace .trace-kind-card__visual--object {
    background: #e8e0d8;
}

#modal-add-trace .trace-kind-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.01);
}

#modal-add-trace .trace-kind-card__body {
    display: grid;
    gap: 0.28rem;
}

#modal-add-trace .trace-kind-card__title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.45rem;
    letter-spacing: 0.08em;
    color: #111;
}

#modal-add-trace .trace-kind-card__copy {
    font-size: 0.84rem;
    line-height: 1.45;
    color: #666;
}

#modal-add-trace .trace-card--kind-picker.is-collapsing::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0)),
        repeating-linear-gradient(180deg, rgba(255,255,255,0.12) 0 2px, rgba(0,0,0,0) 2px 8px);
    mix-blend-mode: screen;
    animation: trace-film-sweep 0.72s steps(10, end);
}

#modal-add-trace .trace-card--kind-picker.is-locked {
    padding-top: 0.9rem;
    padding-bottom: 0.85rem;
}

#modal-add-trace .trace-card--kind-picker.is-locked .trace-kind-card-grid {
    max-height: 0;
    opacity: 0;
    transform: translateY(-18px);
    margin-top: -0.35rem;
    pointer-events: none;
}

#modal-add-trace .trace-card--kind-picker.is-locked .trace-kind-picker-head .trace-card__kicker {
    max-width: 38ch;
}

@keyframes trace-film-sweep {
    0% { opacity: 0.2; transform: translateY(0); }
    35% { opacity: 0.48; transform: translateY(-8px); }
    100% { opacity: 0; transform: translateY(-30px); }
}

/* Мастер-поток «След»: шаги и сводки */
#modal-add-trace .trace-wizard-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    list-style: none;
    margin: 0;
    padding: 0.55rem 0.65rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.07);
    background: rgba(255, 255, 255, 0.72);
}

#modal-add-trace .trace-wizard-steps__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9a9a9a;
    font-weight: 600;
}

#modal-add-trace .trace-wizard-steps__n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    font-size: 0.65rem;
    font-family: 'JetBrains Mono', monospace;
}

#modal-add-trace .trace-wizard-steps__item.is-current .trace-wizard-steps__n {
    border-color: rgba(196, 0, 47, 0.45);
    background: rgba(196, 0, 47, 0.1);
    color: #111;
}

#modal-add-trace .trace-wizard-steps__item.is-current .trace-wizard-steps__txt {
    color: #111;
}

#modal-add-trace .trace-wizard-steps__item.is-done {
    color: #5a5a5a;
}

#modal-add-trace .trace-wizard-steps__item.is-done .trace-wizard-steps__n {
    border-color: rgba(17, 17, 17, 0.22);
    background: #111;
    color: #fff;
}

#modal-add-trace .trace-wizard-steps__item.is-upcoming {
    opacity: 0.55;
}

#modal-add-trace .trace-kind-change-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    background: #fff;
    font: inherit;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    color: #333;
}

#modal-add-trace .trace-kind-change-btn:hover {
    border-color: rgba(196, 0, 47, 0.35);
    color: #111;
}

#modal-add-trace .trace-place-summary {
    margin-top: 0.5rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: rgba(255, 255, 255, 0.85);
}

#modal-add-trace .trace-place-summary__label {
    margin: 0 0 0.35rem;
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: #888;
}

#modal-add-trace .trace-place-summary__text {
    margin: 0 0 0.55rem;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #444;
}

#modal-add-trace .trace-place-summary__edit {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #c4002f;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

#modal-add-trace .trace-place-nav {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

#modal-add-trace .trace-place-continue-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    border: none;
    background: #111;
    color: #fff;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(17, 17, 17, 0.18);
}

#modal-add-trace .trace-place-continue-btn:hover {
    background: #c4002f;
}

#modal-add-trace .trace-wizard-card.trace-wizard-card--current {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 12px 36px rgba(17, 17, 17, 0.07),
        0 0 0 1px rgba(196, 0, 47, 0.12);
}

#modal-add-trace .trace-wizard-card.trace-wizard-card--done {
    opacity: 0.92;
}

@media (max-width: 760px) {
    #modal-add-trace .trace-kind-picker-head {
        flex-direction: column;
        align-items: stretch;
    }

    #modal-add-trace .trace-kind-picker-head-actions {
        justify-content: space-between;
    }

    #modal-add-trace .trace-kind-card-grid {
        grid-template-columns: 1fr;
    }

    #modal-add-trace .trace-kind-card__visual {
        height: 132px;
    }
}

#modal-add-trace .trace-card__head {
    margin: 0 0 0.9rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(17, 17, 17, 0.07);
}

#modal-add-trace .trace-card__title {
    font-size: clamp(1.15rem, 2.8vw, 1.45rem);
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: #111;
}

#modal-add-trace .trace-card__kicker {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #7a7a7a;
    max-width: 36em;
}

#modal-add-trace .trace-card--place .trace-main-grid {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 34%);
    gap: 1rem 1.35rem;
    align-items: stretch;
    min-height: min(50vh, 360px);
}

#modal-add-trace .trace-col--text {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
    height: 100%;
    align-self: stretch;
}

#modal-add-trace .trace-col--text .trace-field-story {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#modal-add-trace .trace-col--text .trace-field-story .trace-input-fill {
    flex: 1 1 auto;
    min-height: 9rem;
    resize: vertical;
    field-sizing: fixed;
}

#modal-add-trace .trace-field-photo {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#modal-add-trace .trace-field-photo .trace-place-drop {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-add-trace .trace-field-photo .trace-place-preview {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0;
}

#modal-add-trace .trace-card--qr .trace-qr-head {
    align-items: flex-start;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(17, 17, 17, 0.07);
    gap: 1rem;
}

#modal-add-trace .trace-card--qr .trace-card__head-text {
    flex: 1;
    min-width: 0;
}

#modal-add-trace .trace-card--qr .trace-secret-mode-toggle {
    flex-shrink: 0;
    margin-top: 0.15rem;
}

#modal-add-trace .trace-qr-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem 0.55rem;
    flex: 1 1 220px;
    min-width: 0;
}

#modal-add-trace .trace-qr-toolbar .trace-secret-mode-toggle {
    margin-top: 0;
}

#modal-add-trace .trace-qr-mode-tag {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a8a8a;
}

#modal-add-trace .trace-qr-preview-btn,
#modal-add-trace .trace-qr-html-guide-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(196, 0, 47, 0.35);
    border-radius: 10px;
    background: linear-gradient(165deg, #fff 0%, #fff5f7 100%);
    color: #c4002f;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 0, 60, 0.12);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

#modal-add-trace .trace-qr-html-guide-btn[hidden] {
    display: none !important;
}

#modal-add-trace .trace-qr-preview-btn:hover,
#modal-add-trace .trace-qr-html-guide-btn:hover {
    border-color: #ff003c;
    box-shadow: 0 2px 14px rgba(255, 0, 60, 0.28);
    transform: translateY(-1px);
}

#modal-add-trace .trace-card--qr .trace-v2-field + .trace-v2-field,
#modal-add-trace .trace-card--qr .trace-secret-panel {
    margin-top: 0.65rem;
}

#modal-add-trace .trace-card--qr textarea.trace-input-fill {
    min-height: 8.5rem;
}

#modal-add-trace .trace-card--material .trace-object-row {
    align-items: center;
    gap: 0.65rem;
}

.trace-field-photo {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
}

.trace-qr-ttl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #111;
}

#modal-add-trace .trace-qr-ttl {
    font-size: 0.92rem;
    letter-spacing: 0.12em;
}

#modal-add-trace .trace-head-min {
    margin-bottom: 0.35rem;
    text-align: center;
}

#modal-add-trace .trace-head-min h2 {
    margin: 0;
}

#modal-add-trace .add-signal-accent-top,
#modal-add-trace .trace-head-min,
#modal-add-trace .modal-close--trace-shell {
    display: none;
}

#modal-add-trace .add-signal-panel {
    padding-top: 1.3rem;
}

#modal-add-trace .modal-close--trace-inline {
    position: static;
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: rgba(17, 17, 17, 0.04);
    border: 1px solid rgba(17, 17, 17, 0.08);
    color: #111;
    font-size: 1.7rem;
}

#modal-add-trace .modal-close--trace-inline:hover {
    background: rgba(255, 0, 60, 0.08);
    border-color: rgba(255, 0, 60, 0.18);
}

.trace-form-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

#modal-add-trace .trace-form-main.hidden {
    display: none !important;
}

.trace-layout-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 0.85rem;
    align-items: stretch;
}

@media (max-width: 640px) {
    .trace-main-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    #modal-add-trace .trace-card--place .trace-main-grid {
        min-height: 0;
    }

    #modal-add-trace .trace-col--text {
        grid-column: 1;
        grid-row: auto;
        height: auto;
    }

    #modal-add-trace .trace-col--text .trace-field-story .trace-input-fill {
        min-height: 6.5rem;
        flex: 0 1 auto;
    }

    .trace-field-photo {
        grid-column: 1;
        grid-row: auto;
    }
}

.trace-section-ttl {
    display: block;
    margin: 0 0 0.35rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
}

#secret-html-panel[hidden],
#secret-simple-panel[hidden] {
    display: none !important;
}

.trace-publish-success {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
}

.trace-publish-success[hidden] {
    display: none !important;
}

.trace-success-kicker {
    margin: 0;
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    color: #888;
}

.trace-success-title {
    margin: 0.35rem 0 0.5rem;
    font-size: clamp(1.45rem, 4vw, 1.85rem);
}

.trace-success-text {
    margin: 0 0 1rem;
    font-size: 1rem;
    line-height: 1.45;
    color: #444;
    max-width: 22em;
    margin-left: auto;
    margin-right: auto;
}

.trace-qr-open-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    background: #111;
    color: #fff !important;
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    transition: opacity 0.15s, transform 0.15s;
}

.trace-qr-open-link:hover {
    opacity: 0.9;
}

.trace-eye-ico {
    display: flex;
    color: #fff;
}

.trace-success-url {
    margin: 0 0 1rem;
    font-size: 0.65rem;
    word-break: break-all;
    color: #777;
    max-width: 100%;
    padding: 0 0.25rem;
}

/* --- Trace modal v2: компактно, одна колонка, без «коробок в коробках» --- */
#modal-add-trace .add-signal-panel {
    display: flex;
    flex-direction: column;
    max-height: min(92vh, 820px);
    padding: 1.1rem 1.15rem 0.95rem;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(180deg, #f6f6f7 0%, #ffffff 28%, #ffffff 100%);
    border: 1px solid rgba(17, 17, 17, 0.07);
    box-shadow:
        0 24px 60px rgba(17, 17, 17, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 0 64px -14px rgba(17, 17, 17, 0.06),
        inset 0 0 120px -40px rgba(17, 17, 17, 0.03);
}

#modal-add-trace .add-signal-head {
    flex-shrink: 0;
    margin-bottom: 0.55rem;
}

#modal-add-trace .add-signal-head h2 {
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
}

#modal-add-trace .add-signal-intro {
    font-size: 0.84rem;
    margin-top: 0.35rem;
}

#add-trace-form.trace-form-v2 {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 0;
    flex: 1;
    font-family: 'Inter', system-ui, sans-serif;
}

#modal-add-trace .trace-v2-lbl {
    margin-bottom: 0.42rem;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    color: #111;
}

#modal-add-trace .trace-kind-btn:not(.trace-kind-card) {
    font-size: 0.82rem;
    padding: 0.62rem 0.9rem;
}

#modal-add-trace .trace-line-input.trace-input-lg,
#modal-add-trace .trace-input-lg.trace-line-input {
    min-height: 46px;
    height: auto;
    font-size: 1rem;
    padding: 0.55rem 0.85rem;
}

#modal-add-trace textarea.trace-input-lg,
#modal-add-trace .trace-area-sm.trace-input-lg,
#modal-add-trace .trace-area-html.trace-input-lg {
    font-size: 1rem;
    line-height: 1.45;
    min-height: 72px;
    padding: 0.65rem 0.85rem;
}

#modal-add-trace .trace-autogrow.trace-input-lg {
    min-height: 46px;
}

#modal-add-trace .trace-place-preview {
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 100%;
    min-height: unset !important;
    max-height: none !important;
    margin-inline: auto;
    box-sizing: border-box;
}

#modal-add-trace .trace-col--media {
    display: flex;
    min-width: 0;
}

#modal-add-trace .trace-place-drop {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 100%;
}

#modal-add-trace .trace-place-preview-inner {
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.65rem;
    text-align: center;
}

#modal-add-trace .trace-place-txt strong {
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

#modal-add-trace .add-signal-actions {
    flex-shrink: 0;
    margin-top: 0.45rem;
}

#modal-add-trace .add-signal-actions.trace-actions-only {
    gap: 0;
}

/* Модалка следа: поля и превью */
#modal-add-trace .trace-v2-kind:not(.trace-v2-kind--cards) {
    margin: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

#modal-add-trace .trace-line-input,
#modal-add-trace .trace-autogrow,
#modal-add-trace .trace-area-sm,
#modal-add-trace .trace-area-html {
    border-radius: 12px;
    border-color: #e4e4e4;
    background: #fbfbfb;
}

#modal-add-trace .trace-line-input:focus,
#modal-add-trace .trace-autogrow:focus,
#modal-add-trace .trace-area-sm:focus,
#modal-add-trace .trace-area-html:focus {
    background: #fff;
}

#modal-add-trace .trace-place-preview {
    border: none;
    border-radius: 14px;
    background: linear-gradient(165deg, #f8f8f9 0%, #ebebed 55%, #e4e4e7 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 2px 8px rgba(17, 17, 17, 0.06);
}

#modal-add-trace .trace-place-preview.empty {
    border-style: none;
}

#modal-add-trace .trace-place-preview.has-image {
    border: none;
    box-shadow: 0 4px 14px rgba(17, 17, 17, 0.1);
}

#modal-add-trace .trace-place-ico {
    color: #ff003c;
    opacity: 0.75;
}

#modal-add-trace .trace-qr-section {
    border-top: none;
    margin-top: 0;
}

#modal-add-trace .trace-secret-mode-toggle {
    display: inline-flex;
    padding: 3px;
    gap: 0;
    border: none;
    border-radius: 999px;
    background: #e6e6e9;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

#modal-add-trace .trace-mode-btn {
    border-radius: 999px;
    padding: 0.42rem 0.95rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    background: transparent;
    color: #5a5a5a;
}

#modal-add-trace .trace-mode-btn.is-active {
    background: #fff;
    color: #c4002f;
    font-weight: 700;
    box-shadow:
        0 2px 8px rgba(17, 17, 17, 0.08),
        0 0 0 1px rgba(196, 0, 47, 0.12);
}

/* Скролл формы следа: красный бегунок и лёгкое свечение */
#modal-add-trace .trace-form-scroll-v2 {
    scrollbar-width: thin;
    scrollbar-color: #ff003c rgba(17, 17, 17, 0.06);
}

#modal-add-trace .trace-form-scroll-v2::-webkit-scrollbar {
    width: 5px;
}

#modal-add-trace .trace-form-scroll-v2::-webkit-scrollbar-track {
    background: rgba(17, 17, 17, 0.06);
    border-radius: 99px;
}

#modal-add-trace .trace-form-scroll-v2::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff0044 0%, #c4002f 100%);
    border-radius: 99px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 12px rgba(255, 0, 60, 0.5);
}

#modal-add-trace .trace-form-scroll-v2::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 0, 60, 0.95);
}

#secret-simple-title-wrap[hidden] {
    display: none !important;
}

#modal-add-trace .trace-card--material .trace-card__head {
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
}

#modal-add-trace .trace-card--material .trace-object-row {
    margin-top: 0;
    align-items: stretch;
}

#modal-add-trace .trace-object-input {
    min-height: 46px;
    height: 100%;
}

#modal-add-trace .trace-object-photo-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    border: 1px solid rgba(196, 0, 47, 0.35);
    background: linear-gradient(165deg, #fff 0%, #fff5f7 100%);
    color: #c4002f;
    box-shadow: 0 2px 10px rgba(255, 0, 60, 0.12);
    transition: transform 0.15s, box-shadow 0.15s;
}

#modal-add-trace .trace-object-photo-btn:hover {
    border-color: #ff003c;
    box-shadow: 0 2px 14px rgba(255, 0, 60, 0.28);
    transform: translateY(-1px);
}

#modal-add-trace .trace-html-paste-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

#modal-add-trace .trace-v2-lbl--sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#modal-add-trace .trace-v2-help {
    margin: 0.5rem 0 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: rgba(17, 17, 17, 0.56);
}

#modal-add-trace .trace-preview-actions-bar {
    margin-top: 0.35rem;
}

#modal-add-trace .trace-preview-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid rgba(17, 17, 17, 0.1);
    border-radius: 10px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#modal-add-trace .trace-preview-open-btn:hover {
    border-color: rgba(196, 0, 47, 0.45);
    box-shadow: 0 2px 10px rgba(255, 0, 60, 0.12);
}

#modal-add-trace .trace-preview-eye-ico {
    display: flex;
    color: #c4002f;
}

#modal-add-trace .trace-preview-panel {
    margin-top: 0.65rem;
    border: 1px solid rgba(17, 17, 17, 0.1);
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

#modal-add-trace .trace-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.65rem;
}

#modal-add-trace .trace-preview-hint {
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.06em;
}

#modal-add-trace .trace-preview-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

#modal-add-trace .trace-preview-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

#modal-add-trace .trace-preview-iframe {
    display: block;
    width: 100%;
    min-height: 220px;
    height: 280px;
    border: none;
    background: #fff;
}

#modal-add-trace .trace-preview-iframe--html {
    min-height: 260px;
    height: 320px;
}

#modal-add-trace .trace-preview-panel--unified {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(52vh, 420px);
}

#modal-add-trace .trace-preview-panel--unified .trace-preview-iframe.trace-preview-iframe--unified {
    flex: 1 1 auto;
    min-height: 200px;
    height: auto;
}

#modal-add-trace .trace-preview-panel--unified.trace-preview-panel--floating {
    position: fixed;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(1080px, 92vw);
    height: min(74vh, 760px);
    max-height: none;
    margin: 0;
    z-index: 2600;
    border-radius: 16px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.45),
        0 0 0 100vmax rgba(0, 0, 0, 0.56);
}

#modal-add-trace .trace-preview-panel--unified.trace-preview-panel--floating .trace-preview-toolbar {
    padding: 0.55rem 0.7rem;
}

#modal-add-trace .trace-preview-panel--unified.trace-preview-panel--floating .trace-preview-iframe.trace-preview-iframe--unified {
    min-height: 0;
    height: auto;
}

.trace-v2-lbl {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6e6e6e;
    margin-bottom: 0.35rem;
}

.trace-v2-field-hint {
    margin: -0.05rem 0 0.45rem;
    font-size: 0.58rem;
    line-height: 1.45;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: none;
    color: rgba(17, 17, 17, 0.52);
    max-width: 40em;
}

.trace-v2-opt {
    font-weight: 500;
    letter-spacing: 0.08em;
    color: #a8a8a8;
    text-transform: none;
}

.trace-line-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    height: 40px;
    padding: 0 0.75rem;
    font-size: 0.92rem;
    line-height: 1.35;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fafafa;
    color: #111;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.trace-line-input:focus {
    border-color: var(--color-red, #ff0044);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 0, 68, 0.08);
}

.trace-v2-title {
    flex-shrink: 0;
}

.trace-v2-kind {
    flex-shrink: 0;
}

.trace-kind-toggle {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e4e4e4;
    max-width: 100%;
}

.trace-kind-btn:not(.trace-kind-card) {
    flex: 1;
    padding: 0.5rem 0.65rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    background: #f4f4f4;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.trace-kind-btn:not(.trace-kind-card):hover {
    background: #ececec;
}

.trace-kind-btn:not(.trace-kind-card).is-active {
    background: linear-gradient(135deg, #fff0f3 0%, #fff 100%);
    color: #c4002f;
    box-shadow: inset 0 0 0 1px rgba(255, 0, 68, 0.18);
}

.trace-form-scroll-v2 {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    scrollbar-gutter: stable;
}

.trace-place-drop {
    display: block;
    cursor: pointer;
    margin: 0;
}

.trace-place-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    min-height: 72px;
    max-height: none;
    border-radius: 10px;
    border: 1px dashed #cfcfcf;
    background:
        linear-gradient(145deg, rgba(255, 0, 68, 0.06), transparent 55%),
        #f6f6f7;
    background-size: cover;
    background-position: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.trace-place-preview.empty {
    border-style: dashed;
}

.trace-place-preview.has-image {
    border-style: solid;
    border-color: #d8d8d8;
}

.trace-place-preview-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    pointer-events: none;
}

.trace-place-preview.has-image .trace-place-preview-inner {
    display: none;
}

.trace-place-ico {
    color: #c4002f;
    opacity: 0.85;
    flex-shrink: 0;
}

.trace-place-txt {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: left;
}

.trace-place-txt strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: #222;
}

.trace-place-txt small {
    font-size: 0.72rem;
    color: #777;
}

.trace-v2-field {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.trace-autogrow {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    max-height: 200px;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.45;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fafafa;
    resize: none;
    overflow-y: auto;
    field-sizing: content;
    outline: none;
    font-family: 'Inter', sans-serif;
}

@supports not (field-sizing: content) {
    .trace-autogrow {
        min-height: 42px;
    }
}

.trace-autogrow:focus {
    border-color: var(--color-red, #ff0044);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 0, 68, 0.08);
}

.trace-area-sm,
.trace-area-html {
    width: 100%;
    box-sizing: border-box;
    min-height: 72px;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
    line-height: 1.45;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #fafafa;
    resize: vertical;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.trace-area-tight {
    min-height: 52px !important;
    padding: 0.45rem 0.65rem;
    font-size: 0.86rem;
}

.trace-area-html {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.trace-area-sm:focus,
.trace-area-html:focus {
    border-color: var(--color-red, #ff0044);
    background: #fff;
}

.trace-material-block {
    padding-top: 0;
}

.trace-object-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.trace-object-text {
    flex: 1;
    min-width: 0;
}

.trace-object-photo-slot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.trace-hidden-file {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.trace-object-photo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #dedede;
    background: #fafafa;
    color: #444;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.trace-object-photo-btn:hover {
    border-color: var(--color-red, #ff0044);
    color: #c4002f;
    background: #fff;
}

.trace-object-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    overflow: hidden;
}

.trace-object-thumb .eiforia-square-media__item,
.trace-object-thumb .eiforia-square-media__media {
    width: 100%;
    height: 100%;
}

.trace-object-thumb.hidden {
    display: none;
}

.trace-qr-section {
    margin-top: 0;
    padding: 0;
}

.trace-qr-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}


.trace-qr-field-tight {
    margin-bottom: 0.3rem;
}

.trace-secret-panel {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.trace-secret-mode-toggle {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e4e4e4;
}

.trace-mode-btn {
    padding: 0.35rem 0.65rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    background: #f4f4f4;
    color: #666;
    cursor: pointer;
}

.trace-mode-btn.is-active {
    background: #111;
    color: #fff;
}

.trace-hint {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    line-height: 1.4;
    color: #888;
}

.trace-hint code {
    font-size: 0.68rem;
    background: #f0f0f0;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.trace-html-file-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.trace-pseudo-file {
    padding: 0.4rem 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid #111;
    border-radius: 8px;
    background: #111;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}

.trace-pseudo-file:hover {
    opacity: 0.88;
}

.trace-file-name {
    font-size: 0.72rem;
    color: #666;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


#modal-add-trace .signal-message-input {
    min-height: unset;
}

#modal-add-trace .signal-submit-btn {
    font-size: 0.95rem;
}

.signal-select-input {
    min-height: 50px;
    height: 50px;
    padding: 0 0.9rem;
    line-height: 1;
    resize: none;
}

.signal-short-textarea {
    min-height: 110px;
}

.trace-secret-label {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #8a8a8a;
}

.scenario-builder {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #fcfcfc;
}

.scenario-meta {
    font-size: 0.72rem;
    color: #777;
}

.scenario-phases-builder {
    display: grid;
    gap: 10px;
}

.scenario-phases-note {
    margin: 0;
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    color: #8d8d8d;
    text-transform: uppercase;
    line-height: 1.55;
}

.scenario-phases-list {
    display: grid;
    gap: 10px;
}

.scenario-phase-card {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #ffffff;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.scenario-phase-card h4 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}

.scenario-step-marker {
    position: relative;
    width: 34px;
    height: 34px;
    overflow: visible;
}

.scenario-step-marker.is-selected .scenario-step-star {
    filter: drop-shadow(0 0 0 2px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 12px rgba(142, 76, 255, 0.85));
}

.scenario-step-marker.is-selected .scenario-step-badge {
    background: #111;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.scenario-step-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    min-width: 270px;
    padding: 0.85rem 0.9rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(142, 76, 255, 0.2);
    background: #ffffff;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.55),
        inset 0 0 44px -6px rgba(147, 51, 234, 0.12),
        inset 0 0 96px -30px rgba(147, 51, 234, 0.06);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    display: grid;
    gap: 0.55rem;
}

.scenario-step-popover::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    width: 52px;
    height: 18px;
    transform: translateX(-50%);
}

.scenario-step-marker:hover .scenario-step-popover,
.scenario-step-marker:focus-within .scenario-step-popover,
.scenario-step-marker.is-open .scenario-step-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.scenario-step-trigger {
    position: relative;
    display: block;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.scenario-step-star {
    display: block;
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 6px 18px rgba(142, 76, 255, 0.24));
}

.scenario-step-star svg {
    width: 100%;
    height: 100%;
    display: block;
}

.scenario-step-star path {
    fill: #8e4cff;
    stroke: #ffffff;
    stroke-width: 4;
}

/* Звёзды на карте (момент / след / сценарий) — тот же силуэт, что у точек сценария */
.trace-marker.trace-map-star {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
}

.trace-map-star__inner {
    display: block;
    width: 38px;
    height: 38px;
}

.trace-map-star--moment .trace-map-star__inner {
    filter:
        drop-shadow(0 0 8px rgba(37, 99, 235, 0.62))
        drop-shadow(0 0 20px rgba(59, 130, 246, 0.32))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.38));
}

.trace-map-star--trace .trace-map-star__inner {
    filter:
        drop-shadow(0 0 8px rgba(245, 196, 0, 0.55))
        drop-shadow(0 0 18px rgba(245, 196, 0, 0.28))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.38));
}

.trace-map-star--scenario .trace-map-star__inner {
    filter:
        drop-shadow(0 0 8px rgba(142, 76, 255, 0.52))
        drop-shadow(0 0 20px rgba(167, 139, 250, 0.26))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.38));
}

.trace-map-star--event .trace-map-star__inner {
    filter:
        drop-shadow(0 0 8px rgba(255, 0, 60, 0.5))
        drop-shadow(0 0 20px rgba(251, 113, 133, 0.28))
        drop-shadow(0 1px 2px rgba(0, 0, 0, 0.38));
}

.trace-map-star__svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.trace-map-star__path {
    /* Только заливка: обводка на маленьком SVG делала звезду почти белой */
    stroke: none;
}

.trace-map-star--moment .trace-map-star__path {
    fill: #2563eb;
}

.trace-map-star--trace .trace-map-star__path {
    fill: #f5c400;
}

.trace-map-star--scenario .trace-map-star__path {
    fill: #8e4cff;
}

.trace-map-star--event .trace-map-star__path {
    fill: #ff003c;
}

/* --- Карта: всплывашка у метки (как scenario-step-popover, цвет по типу) --- */
/* z-index открытой метки задаёт syncMapMarkerZStack() в app.js; внутри метки — изоляция, чтобы звезда не перекрывала панель. */
.map-marker-root {
    position: relative;
    z-index: 0;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.map-marker-hitbox {
    position: relative;
    z-index: 1;
    display: block;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.map-marker-hitbox:focus-visible {
    outline: 2px solid var(--color-red);
    outline-offset: 3px;
}

.map-marker-popover {
    --map-pop-g1: rgba(37, 99, 235, 0.12);
    --map-pop-g2: rgba(37, 99, 235, 0.05);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(6px);
    min-width: min(92vw, 286px);
    max-width: min(94vw, 352px);
    max-height: min(84vh, 640px);
    overflow: hidden;
    padding: 0.72rem 0.72rem 0.78rem;
    border-radius: 18px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.985) 0%, rgba(247, 246, 242, 0.985) 100%);
    box-shadow:
        10px 10px 0 rgba(0, 0, 0, 0.72),
        0 12px 34px rgba(0, 0, 0, 0.2),
        inset 0 0 44px -6px var(--map-pop-g1),
        inset 0 0 100px -32px var(--map-pop-g2);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    text-align: left;
}

/* След: всплывашки уходят за край основного попапа — не обрезаем */
.map-marker-popover--trace {
    overflow: visible;
}

.map-marker-root.is-open .map-marker-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.map-marker-popover__shell {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.map-marker-popover__peek-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
}

.map-marker-popover__peek-button,
.map-marker-popover__tab {
    font: inherit;
    border: 1px solid rgba(17, 17, 17, 0.16);
    background: rgba(255, 255, 255, 0.74);
    color: #161616;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.map-marker-popover__peek-button {
    min-height: 2rem;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.map-marker-popover__peek-button:hover,
.map-marker-popover__tab:hover,
.map-marker-popover__tab.is-active,
.map-marker-popover__peek-button.is-active {
    background: rgba(17, 17, 17, 0.94);
    border-color: rgba(17, 17, 17, 0.94);
    color: #fff;
}

.map-marker-popover__peek-hint {
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.52);
}

.map-marker-popover__content-block--shell {
    display: grid;
    gap: 0.55rem;
    padding: 0.72rem 0.75rem 0.78rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(247, 244, 238, 0.94) 100%),
        linear-gradient(135deg, rgba(17, 17, 17, 0.045), transparent);
}

.map-marker-popover__preview-copy {
    font-size: 0.84rem;
    line-height: 1.48;
    color: #272727;
}

.map-marker-popover__meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.map-marker-popover__meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 1.85rem;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: rgba(17, 17, 17, 0.04);
    color: #2a2a2a;
    font-size: 0.61rem;
    letter-spacing: 0.08em;
}

.map-marker-scenario-shell {
    display: grid;
    gap: 0.75rem;
}

.map-marker-scenario-hero {
    position: relative;
    display: block;
    width: 100%;
    min-height: 170px;
    padding: 0;
    overflow: hidden;
    border: 2px solid rgba(17, 17, 17, 0.82);
    border-radius: 18px;
    background: #17171d;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.72);
    cursor: pointer;
    text-align: left;
}

.map-marker-scenario-hero img {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: cover;
    transform: scale(1.02);
}

.map-marker-scenario-hero__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(12, 12, 18, 0.08) 5%, rgba(12, 12, 18, 0.3) 40%, rgba(12, 12, 18, 0.88) 100%),
        linear-gradient(135deg, rgba(142, 76, 255, 0.28), rgba(0, 0, 0, 0));
}

.map-marker-scenario-hero__caption {
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.78rem;
    display: grid;
    gap: 0.2rem;
    color: #fff;
}

.map-marker-scenario-hero__eyebrow {
    font-size: 0.54rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
}

.map-marker-scenario-hero__title {
    font-size: 1.25rem;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

.map-marker-scenario-hero--empty {
    display: grid;
    gap: 0.28rem;
    align-content: end;
    padding: 0.9rem;
    color: #f5f5f5;
    background:
        linear-gradient(160deg, rgba(142, 76, 255, 0.95), rgba(37, 99, 235, 0.92)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

.map-marker-scenario-hero--empty strong {
    font-size: 1.2rem;
    line-height: 1;
}

.map-marker-scenario-hero--empty span:last-child {
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.88);
}

.map-marker-scenario-summary-card,
.map-marker-scenario-route-card {
    display: grid;
    gap: 0.6rem;
    padding: 0.78rem 0.82rem 0.85rem;
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 246, 252, 0.98)),
        linear-gradient(135deg, rgba(142, 76, 255, 0.08), rgba(255, 255, 255, 0));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 10px 24px rgba(17, 17, 17, 0.08);
}

.map-marker-scenario-route-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}

.map-marker-scenario-route-card__eyebrow {
    font-size: 0.54rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.46);
    margin-bottom: 0.16rem;
}

.map-marker-scenario-route-card__title {
    font-size: 1rem;
    line-height: 1;
    color: #111;
}

.map-marker-scenario-route-card__open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    background: #fff;
    color: #111;
    cursor: pointer;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.map-marker-scenario-route-card__open:hover {
    background: #111;
    border-color: #111;
    color: #fff;
}

.map-marker-scenario-preview-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(128px, 1fr);
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
}

.map-marker-scenario-preview-card {
    display: grid;
    gap: 0.38rem;
    min-height: 148px;
    padding: 0.68rem;
    border-radius: 16px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 242, 255, 0.98)),
        linear-gradient(135deg, rgba(142, 76, 255, 0.08), rgba(255, 255, 255, 0));
    color: #111;
    text-align: left;
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.map-marker-scenario-preview-card:hover {
    transform: translateY(-2px);
    border-color: rgba(142, 76, 255, 0.38);
    box-shadow: 0 10px 20px rgba(17, 17, 17, 0.08);
}

.map-marker-scenario-preview-card.is-active {
    border-color: rgba(142, 76, 255, 0.56);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 12px 24px rgba(142, 76, 255, 0.16);
}

.map-marker-scenario-preview-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.map-marker-scenario-preview-card__num,
.map-marker-scenario-preview-card__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.55rem;
    border-radius: 999px;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.map-marker-scenario-preview-card__num {
    min-width: 1.55rem;
    padding: 0 0.45rem;
    background: #111;
    color: #fff;
}

.map-marker-scenario-preview-card__tag {
    padding: 0 0.5rem;
    border: 1px solid rgba(17, 17, 17, 0.1);
    background: rgba(17, 17, 17, 0.04);
    color: rgba(17, 17, 17, 0.56);
}

.map-marker-scenario-preview-card__title {
    font-size: 0.94rem;
    line-height: 1.02;
    color: #111;
}

.map-marker-scenario-preview-card__copy {
    font-size: 0.73rem;
    line-height: 1.42;
    color: #4d4d4d;
}

.map-marker-scenario-preview-more,
.map-marker-scenario-preview-empty {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    color: rgba(17, 17, 17, 0.5);
}

.map-marker-scenario-preview-empty {
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    border: 1px dashed rgba(142, 76, 255, 0.35);
    background: rgba(142, 76, 255, 0.05);
}

.map-marker-popover__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.map-marker-popover__tab {
    min-height: 2rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.map-marker-popover__panels {
    display: grid;
    gap: 0.45rem;
}

.map-marker-popover__panel[hidden] {
    display: none !important;
}

.map-marker-popover__panel {
    padding: 0.72rem 0.72rem 0.78rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.map-marker-popover__panel-title {
    margin-bottom: 0.5rem;
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.54);
}

.map-marker-popover__panel-body {
    display: grid;
    gap: 0.55rem;
}

.map-marker-popover__media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.map-marker-popover__media-image {
    display: block;
    width: 100%;
    height: 112px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: #e8e8e8;
}

.map-marker-popover__media-image--hero {
    grid-column: 1 / -1;
    height: 144px;
}

.map-marker-popover__detail-grid {
    display: grid;
    gap: 0.4rem;
}

.map-marker-popover__detail-row {
    display: grid;
    gap: 0.22rem;
    padding: 0.55rem 0.62rem;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 10px;
    background: rgba(17, 17, 17, 0.03);
}

.map-marker-popover__detail-row span {
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.54);
}

.map-marker-popover__detail-row strong {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #181818;
}

.map-marker-popover__route-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
    gap: 0.35rem;
    align-items: center;
}

.map-marker-popover__route-node {
    display: grid;
    place-items: center;
    min-height: 1.9rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.16);
    background: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    color: #181818;
}

.map-marker-popover__phase-cards {
    display: grid;
    gap: 0.42rem;
}

.map-marker-popover__phase-card {
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(17, 17, 17, 0.025);
}

.map-marker-popover__phase-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 30px 1fr 16px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.58rem 0.62rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.map-marker-popover__phase-index {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.68rem;
}

.map-marker-popover__phase-toggle-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #171717;
}

.map-marker-popover__phase-toggle-arrow {
    font-size: 1rem;
    color: rgba(17, 17, 17, 0.55);
    transition: transform 0.15s ease;
}

.map-marker-popover__phase-toggle[aria-expanded='true'] .map-marker-popover__phase-toggle-arrow {
    transform: rotate(90deg);
}

.map-marker-popover__phase-card-body {
    display: grid;
    gap: 0.45rem;
    padding: 0 0.62rem 0.66rem;
}

.map-marker-popover__phase-copy,
.map-marker-popover__phase-hint {
    font-size: 0.78rem;
    line-height: 1.45;
    color: #2a2a2a;
}

.map-marker-popover__phase-media-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

.map-marker-popover__phase-media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    overflow: hidden;
}

.map-marker-popover__phase-media-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-marker-popover__phase-media-pill {
    position: absolute;
    left: 0.3rem;
    bottom: 0.3rem;
    padding: 0.14rem 0.26rem;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.72);
    color: #fff;
    font-size: 0.38rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.map-marker-popover__author-panel {
    display: grid;
    gap: 0.5rem;
}

.map-marker-popover__author-note {
    font-size: 0.78rem;
    line-height: 1.45;
    color: #2f2f2f;
}

.map-marker-popover__author-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.2rem;
    padding: 0.45rem 0.72rem;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    background: #111;
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
}

.map-marker-popover__author-inline {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.55rem 0.62rem;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: rgba(17, 17, 17, 0.03);
}

.map-marker-popover__empty-state {
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(17, 17, 17, 0.6);
}

.map-marker-popover--moment {
    --map-pop-g1: rgba(37, 99, 235, 0.13);
    --map-pop-g2: rgba(37, 99, 235, 0.05);
    --moment-blue: #2563eb;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: min(88vw, 268px);
    max-width: min(92vw, 300px);
    max-height: none;
    overflow: visible;
    /* Без translateY(6px) у базового .map-marker-popover — иначе при открытии карточка смещается вверх и звезда «прыгает» */
    transform: translateX(-50%) translateY(0);
}

.map-marker-popover__shell--moment {
    display: block;
    --map-marker-card-width: min(320px, calc(100vw - 2rem));
}

.map-marker-moment {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    width: var(--map-marker-card-width);
    max-width: 100%;
}

.map-marker-moment-card {
    width: 100%;
    border-radius: 18px;
    border: 3px solid var(--moment-blue, #2563eb);
    background: #fff;
    box-shadow:
        0 0 22px rgba(37, 99, 235, 0.38),
        0 0 46px rgba(59, 130, 246, 0.14),
        0 10px 28px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.map-marker-moment-card--trace {
    --moment-blue: #d97706;
    border-color: #eab308;
    box-shadow:
        0 0 22px rgba(234, 179, 8, 0.38),
        0 0 46px rgba(251, 191, 36, 0.16),
        0 10px 28px rgba(0, 0, 0, 0.14);
    overflow: visible;
}

.map-marker-moment-card--trace .map-marker-moment-photo {
    background: linear-gradient(165deg, #fffbeb 0%, #fef3c7 45%, #fde68a 100%);
}

.map-marker-moment-card--trace .map-marker-moment-photo--empty {
    color: rgba(180, 83, 9, 0.42);
}

.map-marker-moment-card--scenario {
    --moment-blue: #8e4cff;
    border-color: #8e4cff;
    box-shadow:
        0 0 22px rgba(142, 76, 255, 0.32),
        0 0 46px rgba(167, 139, 250, 0.14),
        0 10px 28px rgba(0, 0, 0, 0.14);
    overflow: visible;
}

.map-marker-moment-card--scenario .map-marker-moment-photo {
    background: linear-gradient(165deg, #faf5ff 0%, #f3e8ff 45%, #ede9fe 100%);
}

.map-marker-moment-card--scenario .map-marker-moment-photo--empty {
    color: rgba(109, 40, 217, 0.38);
}

.map-marker-moment-photo-stage {
    position: relative;
    width: 100%;
    overflow: visible;
}

.map-marker-moment-author-float {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.35rem;
}

.map-marker-moment-author-float--trace-tools {
    align-items: center;
    justify-content: flex-end;
    padding: 0.34rem;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(16, 18, 28, 0.86), rgba(12, 14, 24, 0.74));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(1.12);
    -webkit-backdrop-filter: blur(16px) saturate(1.12);
}

/* След: отдельное облако действий над карточкой */
.map-marker-trace-toolbar-cloud-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    position: relative;
    z-index: 7;
    margin-bottom: -0.1rem;
}

.map-marker-trace-toolbar-cloud {
    width: min(100%, calc(var(--map-marker-card-width) - 1.1rem));
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 0.5rem;
    padding: 0.44rem;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(16, 18, 28, 0.94), rgba(12, 14, 24, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(22px) saturate(1.16);
    -webkit-backdrop-filter: blur(22px) saturate(1.16);
    pointer-events: auto;
}

.map-marker-moment-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.map-marker-moment-author-float--trace-tools .map-marker-moment-delete-btn {
    flex-shrink: 0;
    width: 2.05rem;
    height: 2.05rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
    color: rgba(255, 255, 255, 0.9);
}

.map-marker-moment-delete-btn:hover {
    background: rgba(220, 38, 38, 0.88);
    border-color: rgba(255, 255, 255, 0.92);
    transform: scale(1.06);
}

.map-marker-moment-author-float--trace-tools .map-marker-moment-delete-btn:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(252, 165, 165, 0.45);
    color: #fff;
    transform: scale(1.04);
    box-shadow: none;
}

.map-marker-moment-delete-ico {
    display: block;
    pointer-events: none;
}

.map-marker-moment-flip {
    padding: 0;
}

.map-marker-moment-flip__stack {
    position: relative;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
}

.map-marker-moment-flip__face--front {
    position: relative;
    z-index: 2;
    transition:
        opacity 0.45s cubic-bezier(0.32, 0.72, 0, 1),
        transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.map-marker-moment-flip__face--back {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1;
    overflow: auto;
    max-height: 240px;
    padding: 0.65rem 0.72rem 0.7rem;
    background: #fff;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.97);
    transition:
        opacity 0.45s cubic-bezier(0.32, 0.72, 0, 1),
        transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Только область фото/текста (.map-marker-moment-flip), без нижнего бара метрик */
.map-marker-moment-flip:hover .map-marker-moment-flip__face--front {
    opacity: 0;
    transform: scale(0.985);
    pointer-events: none;
}

.map-marker-moment-flip:hover .map-marker-moment-flip__face--back {
    opacity: 1;
    z-index: 3;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Момент: отдельная карточка с описанием слева (как у следа), без переворота фото */
.map-marker-popover__shell--moment-flyout {
    overflow: visible;
}

.map-marker-popover--moment {
    overflow: visible;
}

.map-marker-moment-popover-wrap {
    position: relative;
    display: block;
    width: var(--map-marker-card-width);
    max-width: 100%;
    margin: 0 auto;
}

.map-marker-moment-photo-engage {
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    outline: none;
}

.map-marker-moment-photo-engage:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.map-marker-moment-flyout {
    position: absolute;
    top: 0;
    z-index: 35;
    width: min(300px, calc(100vw - 2rem));
    height: var(--map-marker-flyout-target-height, auto);
    max-height: min(82vh, 480px);
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 0;
    border-radius: 18px;
    border: 3px solid #2563eb;
    background: #fff;
    box-shadow:
        0 0 22px rgba(37, 99, 235, 0.38),
        0 0 46px rgba(59, 130, 246, 0.14),
        0 10px 28px rgba(0, 0, 0, 0.14);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(0.965);
    transform-origin: right top;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s linear 0.22s;
    will-change: transform, opacity, height;
}

.map-marker-moment-flyout.map-marker-flyout--scrollable {
    overflow-y: auto;
}

.map-marker-moment-popover-wrap:has(.map-marker-moment-photo-engage:hover) .map-marker-moment-flyout--desc,
.map-marker-moment-popover-wrap:has(.map-marker-moment-photo-engage:focus-within) .map-marker-moment-flyout--desc {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s;
}

.map-marker-moment-flyout--desc {
    right: 100%;
    left: auto;
    margin-right: 0.42rem;
}

.map-marker-moment-flyout-body {
    padding: 0.65rem 0.75rem 0.75rem;
    min-height: 0;
}

.map-marker-moment-flyout .map-marker-moment-back-title {
    margin: 0 0 0.4rem;
}

/* След: всплывашки как карточка следа (жёлтая рамка, те же тени). Слева — описание при наведении на фото. Справа — «Как найти» после «Ищу» в метриках. */
.map-marker-popover__shell--trace {
    overflow: visible;
}

.map-marker-trace-popover-wrap {
    position: relative;
    display: block;
    width: var(--map-marker-card-width);
    max-width: 100%;
    margin: 0 auto;
}

.map-marker-trace-photo-engage {
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    outline: none;
}

.map-marker-trace-photo-engage:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(217, 119, 6, 0.55);
}

.map-marker-trace-flyout {
    position: absolute;
    top: 0;
    z-index: 35;
    width: min(300px, calc(100vw - 2rem));
    height: var(--map-marker-flyout-target-height, auto);
    max-height: min(82vh, 480px);
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 0;
    border-radius: 18px;
    border: 3px solid #eab308;
    background: #fff;
    box-shadow:
        0 0 22px rgba(234, 179, 8, 0.38),
        0 0 46px rgba(251, 191, 36, 0.16),
        0 10px 28px rgba(0, 0, 0, 0.14);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(0.965);
    transform-origin: right top;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s linear 0.22s;
    will-change: transform, opacity, height;
}

.map-marker-trace-flyout.map-marker-flyout--scrollable {
    overflow-y: auto;
}

.map-marker-trace-popover-wrap:not(:has(.map-marker-moment-card--trace.is-user-seeking)):has(.map-marker-trace-photo-engage:hover)
    .map-marker-trace-flyout--idle,
.map-marker-trace-popover-wrap:not(:has(.map-marker-moment-card--trace.is-user-seeking)):has(.map-marker-trace-photo-engage:focus-within)
    .map-marker-trace-flyout--idle {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s;
}

.map-marker-trace-popover-wrap:has(.map-marker-moment-card--trace.is-user-seeking) .map-marker-trace-flyout--seek {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s;
}

.map-marker-trace-popover-wrap:has(.map-marker-moment-card--trace.is-user-seeking) .map-marker-trace-flyout--idle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.map-marker-trace-flyout--idle {
    right: 100%;
    left: auto;
    margin-right: 0.42rem;
}

.map-marker-trace-flyout--seek {
    left: 100%;
    right: auto;
    margin-left: 0.42rem;
    width: min(340px, calc(100vw - 2rem));
    max-height: min(86vh, 520px);
    transform-origin: left top;
    background: linear-gradient(155deg, rgba(22, 20, 32, 0.98) 0%, rgba(10, 9, 16, 0.99) 100%);
    border: 1px solid rgba(251, 191, 36, 0.32);
    box-shadow:
        0 22px 56px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(253, 230, 138, 0.06);
}

.map-marker-trace-flyout-body {
    padding: 0.65rem 0.75rem 0.75rem;
    min-height: 0;
}

.map-marker-trace-flyout-body--seek {
    padding-top: 0.62rem;
    padding-bottom: 0.72rem;
}

.map-marker-trace-flyout--seek-has-hero .map-marker-trace-flyout-body--seek {
    padding-top: 0.58rem;
}

.map-marker-trace-flyout .map-marker-moment-back-title {
    margin: 0 0 0.4rem;
}

.map-marker-trace-flyout-body--seek .map-marker-moment-back-eyebrow {
    color: rgba(253, 224, 138, 0.55);
    margin-bottom: 0.4rem;
}

.map-marker-trace-flyout-body--seek .map-marker-moment-back-text {
    color: rgba(248, 246, 255, 0.92);
    line-height: 1.55;
}

.map-marker-popover__shell--scenario {
    overflow: visible;
}

.map-marker-scenario-popover-wrap {
    position: relative;
    display: block;
    width: var(--map-marker-card-width);
    max-width: 100%;
    margin: 0 auto;
}

.map-marker-scenario-photo-engage {
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    outline: none;
}

.map-marker-scenario-photo-engage:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(142, 76, 255, 0.5);
}

.map-marker-scenario-flyout {
    position: absolute;
    top: 0;
    z-index: 35;
    width: min(300px, calc(100vw - 2rem));
    height: var(--map-marker-flyout-target-height, auto);
    max-height: min(82vh, 480px);
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 0;
    border-radius: 18px;
    border: 3px solid #8e4cff;
    background: #fff;
    box-shadow:
        0 0 22px rgba(142, 76, 255, 0.34),
        0 0 46px rgba(167, 139, 250, 0.16),
        0 10px 28px rgba(0, 0, 0, 0.14);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(0.965);
    transform-origin: right top;
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s linear 0.22s;
    will-change: transform, opacity, height;
}

.map-marker-scenario-flyout.map-marker-flyout--scrollable {
    overflow-y: auto;
}

.map-marker-scenario-popover-wrap:not(:has(.map-marker-moment-card--scenario.is-user-walking)):has(.map-marker-scenario-photo-engage:hover)
    .map-marker-scenario-flyout--idle,
.map-marker-scenario-popover-wrap:not(:has(.map-marker-moment-card--scenario.is-user-walking)):has(.map-marker-scenario-photo-engage:focus-within)
    .map-marker-scenario-flyout--idle {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s;
}

.map-marker-scenario-popover-wrap:has(.map-marker-moment-card--scenario.is-user-walking) .map-marker-scenario-flyout--walk {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        height 0.28s cubic-bezier(0.22, 0.7, 0, 1),
        visibility 0s;
}

.map-marker-scenario-popover-wrap:has(.map-marker-moment-card--scenario.is-user-walking) .map-marker-scenario-flyout--idle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.map-marker-scenario-flyout--idle {
    right: 100%;
    left: auto;
    margin-right: 0.42rem;
}

.map-marker-scenario-flyout--walk {
    left: 100%;
    right: auto;
    margin-left: 0.42rem;
    transform-origin: left top;
}

.map-marker-scenario-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    margin-top: 0.7rem;
}

.map-marker-scenario-meta-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.18rem 0.68rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    background: rgba(17, 17, 17, 0.04);
    color: rgba(17, 17, 17, 0.72);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.map-marker-scenario-walk-stop-btn {
    display: block;
    width: 100%;
    margin: 0.65rem 0 0;
    padding: 0.52rem 0.75rem 0.5rem;
    border-radius: 12px;
    border: 2px solid rgba(142, 76, 255, 0.88);
    background: linear-gradient(180deg, #8e4cff 0%, #7c3aed 100%);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    text-shadow: 0 1px 0 rgba(91, 33, 182, 0.35);
    box-shadow:
        0 4px 0 rgba(91, 33, 182, 0.22),
        0 10px 24px rgba(109, 40, 217, 0.2);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.map-marker-scenario-walk-stop-btn:hover {
    background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
}

.map-marker-scenario-walk-stop-btn:active {
    transform: translateY(1px) scale(0.99);
}

.map-marker-scenario-walk-stop-btn:focus-visible {
    outline: 2px solid rgba(196, 181, 253, 0.95);
    outline-offset: 3px;
}

/* Крупное фото объекта — цельный верх карточки поиска, без отдельной «коробки» */
.map-marker-trace-seek-hero {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 48%, #fde68a 100%);
    border-radius: 15px 15px 0 0;
}

.map-marker-trace-seek-hero__img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 11rem;
    max-height: 15rem;
    object-fit: contain;
    object-position: center;
}

.map-marker-moment-photo {
    margin: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(165deg, #ffffff 0%, #f4f8ff 40%, #e8f0fe 100%);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.map-marker-moment-photo img,
.map-marker-moment-photo video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.map-marker-moment-photo--empty {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: rgba(37, 99, 235, 0.35);
    align-self: center;
    justify-self: center;
    margin: auto;
}

/* QR-след: автор видит вместо фото места QR сгенерированной страницы */
.map-marker-moment-photo--trace-qr {
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    background: #fff;
    box-sizing: border-box;
}

.map-marker-moment-photo--trace-qr img {
    width: auto !important;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.map-marker-trace-qr-author-tools {
    margin: 0;
    padding: 0.55rem 0.65rem 0.65rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, #f8fafc 100%);
}

.map-marker-trace-qr-author-tools__label {
    margin: 0 0 0.35rem;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.45);
}

.map-marker-trace-qr-author-tools__link {
    display: block;
    word-break: break-all;
    font-size: 0.68rem;
    line-height: 1.45;
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Автор QR-следа: QR + ссылка в панели «Ищу» (как в walk-app — тёмно, без белых плашек) */
.map-marker-trace-seek-qr-author {
    padding: 0.55rem 0.6rem 0.45rem;
    border-bottom: 1px solid rgba(251, 191, 36, 0.12);
}

.map-marker-trace-seek-qr-author__label {
    margin: 0 0 0.4rem;
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(253, 230, 138, 0.75);
    text-align: center;
}

.map-marker-trace-seek-qr-author__hit {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    line-height: 0;
}

.map-marker-trace-seek-qr-author__hit:focus-visible {
    outline: 2px solid rgba(251, 191, 36, 0.65);
    outline-offset: 3px;
    border-radius: 4px;
}

.map-marker-trace-seek-qr-author__hit:active .map-marker-trace-seek-qr-author__img {
    opacity: 0.92;
}

.map-marker-trace-seek-qr-author__img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(38vh, 220px);
    object-fit: contain;
}

.map-marker-trace-seek-qr-author__hint {
    margin: 0.28rem 0 0.35rem;
    text-align: center;
    font-size: 0.46rem;
    letter-spacing: 0.05em;
    color: rgba(253, 224, 138, 0.42);
}

.map-marker-trace-seek-qr-author__link {
    display: block;
    word-break: break-all;
    font-size: 0.62rem;
    line-height: 1.35;
    text-align: center;
    color: #fde68a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.map-marker-trace-seek-qr-author__link:hover {
    color: #fff7c2;
}

.map-marker-moment-back-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.48);
}

.map-marker-moment-back-title {
    margin: 0 0 0.4rem;
    font-size: 0.92rem;
    line-height: 1.25;
    color: #0f172a;
}

.map-marker-moment-back-text {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #111;
    white-space: pre-wrap;
    word-break: break-word;
}

.map-marker-moment-footer {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.map-marker-moment-footer--metric-hints {
    position: relative;
}

.map-marker-moment-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    background: var(--moment-blue, #2563eb);
    color: #fff;
    border-radius: 0 0 14px 14px;
}

.map-marker-moment-metrics--trace {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.map-marker-moment-metrics--scenario {
    background: linear-gradient(180deg, #8e4cff 0%, #7c3aed 100%);
}

.map-marker-moment-metric {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.65rem;
    border-right: 1px solid rgba(255, 255, 255, 0.22);
    cursor: default;
}

.map-marker-moment-metric--vote,
.map-marker-moment-metric--seek,
.map-marker-moment-metric--walk {
    appearance: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 2.65rem;
    border: none;
    border-radius: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}

.map-marker-moment-metric--vote:focus-visible,
.map-marker-moment-metric--seek:focus-visible,
.map-marker-moment-metric--walk:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.95);
    outline-offset: -4px;
}

/* Лайк/дизлайк только после просмотра карточки (или для следа — после ИЩУ), см. data-vote-gate */
.map-marker-moment-metric--vote--gated {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.map-marker-moment-metrics[data-vote-gate='open'] .map-marker-moment-metric--vote {
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
}

.map-marker-moment-metric--seek[aria-pressed='true'],
.map-marker-moment-metric--walk[aria-pressed='true'] {
    background: rgba(255, 255, 255, 0.14);
}

.map-marker-moment-metric--seek[aria-pressed='true']:hover,
.map-marker-moment-metric--walk[aria-pressed='true']:hover {
    background: rgba(255, 255, 255, 0.2);
}

.map-marker-moment-metric:last-child {
    border-right: none;
}

/* Подсказки метрик — под карточкой по центру; стрелки к своим иконкам */
.map-marker-moment-seek-wrap,
.map-marker-moment-walk-wrap,
.map-marker-moment-like-wrap,
.map-marker-moment-dislike-wrap {
    padding: 0;
    cursor: default;
}

.map-marker-moment-seek-wrap .map-marker-moment-metric--seek,
.map-marker-moment-walk-wrap .map-marker-moment-metric--walk,
.map-marker-moment-like-wrap .map-marker-moment-metric--vote,
.map-marker-moment-dislike-wrap .map-marker-moment-metric--vote {
    flex: 1;
    min-width: 0;
    align-self: stretch;
}

.map-marker-moment-seek-tooltip,
.map-marker-moment-walk-tooltip,
.map-marker-moment-vote-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    z-index: 35;
    box-sizing: border-box;
    width: min(calc(100% - 0.5rem), 18.5rem);
    margin: 0;
    padding: 0.48rem 0.65rem 0.52rem;
    border-radius: 12px;
    background: linear-gradient(165deg, #fffbeb 0%, #ffffff 55%);
    border: 2px solid rgba(251, 191, 36, 0.98);
    box-shadow:
        0 4px 0 rgba(180, 83, 9, 0.22),
        0 12px 32px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(251, 191, 36, 0.35);
    color: #1c1917;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(-5px);
    transition:
        opacity 0.14s ease,
        transform 0.14s ease,
        visibility 0s linear 0.14s;
}

.map-marker-moment-seek-tooltip::before,
.map-marker-moment-walk-tooltip::before,
.map-marker-moment-vote-tooltip::before {
    content: '';
    position: absolute;
    top: -9px;
    margin-left: -9px;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid rgba(251, 191, 36, 0.98);
    border-top: none;
    filter: drop-shadow(0 -1px 0 rgba(180, 83, 9, 0.15));
}

/* Стрелки: центры колонок сетки (3 или 4 колонки) */
.map-marker-moment-seek-tooltip::before {
    left: 87.5%;
}

.map-marker-moment-walk-tooltip::before {
    left: 87.5%;
}

.map-marker-popover--scenario .map-marker-moment-vote-tooltip,
.map-marker-popover--scenario .map-marker-moment-walk-tooltip {
    background: linear-gradient(165deg, #f7f2ff 0%, #ffffff 55%);
    border-color: rgba(142, 76, 255, 0.98);
    box-shadow:
        0 4px 0 rgba(109, 40, 217, 0.2),
        0 12px 32px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(142, 76, 255, 0.28);
}

.map-marker-popover--scenario .map-marker-moment-vote-tooltip::before,
.map-marker-popover--scenario .map-marker-moment-walk-tooltip::before {
    border-bottom-color: rgba(142, 76, 255, 0.98);
    filter: drop-shadow(0 -1px 0 rgba(109, 40, 217, 0.15));
}

.map-marker-popover--scenario .map-marker-moment-vote-tooltip__line strong,
.map-marker-popover--scenario .map-marker-moment-walk-tooltip__line strong {
    color: #6d28d9;
}

.map-marker-moment-footer--metric-hints:has(.map-marker-moment-metrics--trace) .map-marker-moment-vote-tooltip--like::before {
    left: 37.5%;
}

.map-marker-moment-footer--metric-hints:has(.map-marker-moment-metrics--trace) .map-marker-moment-vote-tooltip--dislike::before {
    left: 62.5%;
}

.map-marker-moment-footer--metric-hints:not(:has(.map-marker-moment-metrics--trace)) .map-marker-moment-vote-tooltip--like::before {
    left: 50%;
}

.map-marker-moment-footer--metric-hints:not(:has(.map-marker-moment-metrics--trace)) .map-marker-moment-vote-tooltip--dislike::before {
    left: 83.33%;
}

.map-marker-moment-footer--metric-hints:has(.map-marker-moment-seek-wrap:hover) .map-marker-moment-seek-tooltip,
.map-marker-moment-footer--metric-hints:has(.map-marker-moment-seek-wrap:focus-within) .map-marker-moment-seek-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease,
        visibility 0s;
}

.map-marker-moment-footer--metric-hints:has(.map-marker-moment-walk-wrap:hover) .map-marker-moment-walk-tooltip,
.map-marker-moment-footer--metric-hints:has(.map-marker-moment-walk-wrap:focus-within) .map-marker-moment-walk-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease,
        visibility 0s;
}

.map-marker-moment-footer--metric-hints:has(.map-marker-moment-like-wrap:hover) .map-marker-moment-vote-tooltip--like,
.map-marker-moment-footer--metric-hints:has(.map-marker-moment-like-wrap:focus-within) .map-marker-moment-vote-tooltip--like,
.map-marker-moment-footer--metric-hints:has(.map-marker-moment-dislike-wrap:hover) .map-marker-moment-vote-tooltip--dislike,
.map-marker-moment-footer--metric-hints:has(.map-marker-moment-dislike-wrap:focus-within) .map-marker-moment-vote-tooltip--dislike {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease,
        visibility 0s;
}

/* Пока открыта «Как найти», подсказку «Ищу» не показываем */
.map-marker-moment-card--trace.is-user-seeking .map-marker-moment-seek-tooltip {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.map-marker-moment-card--scenario.is-user-walking .map-marker-moment-walk-tooltip {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.map-marker-moment-seek-tooltip__line,
.map-marker-moment-walk-tooltip__line,
.map-marker-moment-vote-tooltip__line {
    margin: 0;
    font-size: 0.58rem;
    line-height: 1.4;
    letter-spacing: 0.02em;
    color: #292524;
    text-align: center;
}

.map-marker-moment-seek-tooltip__line strong,
.map-marker-moment-walk-tooltip__line strong,
.map-marker-moment-vote-tooltip__line strong {
    color: #9a3412;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.map-marker-moment-metric__cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.2rem;
}

.map-marker-moment-ico {
    display: block;
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.map-marker-moment-metric__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        opacity 0.2s ease,
        transform 0.28s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.map-marker-moment-metric__value {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

.map-marker-moment-metric--stat:hover .map-marker-moment-metric__icon,
.map-marker-moment-metric--seek:hover .map-marker-moment-metric__icon,
.map-marker-moment-metric--walk:hover .map-marker-moment-metric__icon {
    opacity: 0;
}

.map-marker-moment-metric--stat:hover .map-marker-moment-metric__value,
.map-marker-moment-metric--seek:hover .map-marker-moment-metric__value,
.map-marker-moment-metric--walk:hover .map-marker-moment-metric__value {
    opacity: 1;
}

.map-marker-moment-metrics[data-vote-open='true'] .map-marker-moment-metric--vote .map-marker-moment-metric__value {
    opacity: 0;
}

.map-marker-moment-metrics[data-vote-open='true'] .map-marker-moment-metric--vote:hover .map-marker-moment-metric__icon {
    opacity: 1;
    transform: scale(1.06);
}

.map-marker-moment-metrics[data-vote-open='true'] .map-marker-moment-metric--vote:hover .map-marker-moment-metric__value {
    opacity: 0;
}

/* Гейт закрыт: счётчики лайков/дизлайков видны сразу, без наведения */
.map-marker-moment-metrics[data-vote-gate='locked'][data-vote-open='true'] .map-marker-moment-metric--vote--gated .map-marker-moment-metric__icon {
    opacity: 0;
}

.map-marker-moment-metrics[data-vote-gate='locked'][data-vote-open='true'] .map-marker-moment-metric--vote--gated .map-marker-moment-metric__value {
    opacity: 1;
}

.map-marker-moment-metrics[data-vote-gate='locked'][data-vote-open='true'] .map-marker-moment-metric--vote--gated:hover .map-marker-moment-metric__icon {
    opacity: 0;
    transform: none;
}

.map-marker-moment-metrics[data-vote-gate='locked'][data-vote-open='true'] .map-marker-moment-metric--vote--gated:hover .map-marker-moment-metric__value {
    opacity: 1;
}

/* След: после выхода из «Ищу» — оценка без цифр, подсветка кнопок */
.map-marker-moment-metrics[data-trace-vote-pick='true'] .map-marker-moment-metric--vote .map-marker-moment-metric__value {
    opacity: 0 !important;
}

.map-marker-moment-metrics[data-trace-vote-pick='true'] .map-marker-moment-metric--vote .map-marker-moment-metric__icon {
    opacity: 1 !important;
    transform: none;
}

.map-marker-moment-metrics[data-trace-vote-pick='true'] .map-marker-moment-metric--vote:hover .map-marker-moment-metric__value {
    opacity: 0 !important;
}

.map-marker-moment-metrics[data-trace-vote-pick='true'] .map-marker-moment-metric--vote:hover .map-marker-moment-metric__icon {
    opacity: 1 !important;
    transform: scale(1.08);
}

.map-marker-moment-metric--vote--pick-hint .map-marker-moment-metric__icon {
    animation: trace-vote-pick-pulse 1.15s ease-in-out infinite;
}

@keyframes trace-vote-pick-pulse {
    0%,
    100% {
        filter: drop-shadow(0 0 0 transparent);
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.95));
        transform: scale(1.09);
    }
}

/* Модалка удаления момента (автор) */
.moment-delete-modal-overlay.modal-overlay {
    background: rgba(10, 8, 16, 0.82);
    backdrop-filter: blur(10px);
}

.moment-delete-modal-overlay {
    z-index: 16000;
}

.trace-html-guide-overlay.modal-overlay {
    z-index: 17000;
    align-items: flex-start;
    padding: 4vh 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.moment-delete-modal--html-guide {
    width: min(94vw, 560px);
    max-height: min(92vh, 720px);
    display: flex;
    flex-direction: column;
}

.moment-delete-modal__accent--html-guide {
    background: linear-gradient(90deg, #c4002f 0%, #2563eb 100%);
}

.moment-delete-modal__inner--html-guide {
    position: relative;
    padding-top: 2.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.trace-html-guide-modal__x {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 10px;
    background: rgba(17, 17, 17, 0.06);
    color: #111;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.trace-html-guide-modal__x:hover {
    background: rgba(17, 17, 17, 0.12);
}

.trace-html-guide-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0 -0.15rem;
    padding: 0 0.15rem 0.35rem;
    -webkit-overflow-scrolling: touch;
}

.trace-html-guide-lead {
    margin-bottom: 0.75rem !important;
}

.trace-html-guide-list {
    margin: 0 0 1.1rem 1.1rem;
    padding: 0;
    font-size: 0.84rem;
    line-height: 1.55;
    color: rgba(40, 38, 36, 0.92);
}

.trace-html-guide-list li + li {
    margin-top: 0.45rem;
}

.trace-html-guide-prompt-label {
    margin: 0 0 0.35rem;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.42);
}

.trace-html-guide-prompt-hint {
    margin-top: 0 !important;
    margin-bottom: 0.55rem !important;
    font-size: 0.8rem !important;
    line-height: 1.5 !important;
}

.trace-html-guide-prompt-wrap {
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: rgba(255, 255, 255, 0.65);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.trace-html-guide-prompt {
    display: block;
    width: 100%;
    min-height: 11rem;
    max-height: 240px;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border: none;
    resize: vertical;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    line-height: 1.45;
    color: #1a1a1a;
    background: transparent;
    box-sizing: border-box;
}

.trace-html-guide-prompt:focus {
    outline: 2px solid rgba(196, 0, 47, 0.35);
    outline-offset: 2px;
}

.trace-html-guide-actions {
    margin-top: 0.85rem;
    flex-shrink: 0;
}

.moment-delete-modal {
    position: relative;
    width: min(92vw, 420px);
    border-radius: 22px;
    border: 2px solid rgba(17, 17, 17, 0.92);
    background: linear-gradient(168deg, rgba(255, 253, 250, 0.995) 0%, rgba(245, 242, 236, 0.99) 52%, rgba(252, 248, 240, 0.99) 100%);
    box-shadow:
        12px 12px 0 rgba(0, 0, 0, 0.72),
        0 28px 64px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    overflow: hidden;
    animation: modal-slide-up 0.32s ease-out;
}

.moment-delete-modal__accent {
    height: 6px;
    background: linear-gradient(90deg, var(--color-red, #d91c1c) 0%, #2563eb 100%);
}

.moment-delete-modal__accent--publish {
    background: linear-gradient(90deg, #f5c400 0%, #f59e0b 45%, #eab308 100%);
}

.moment-delete-modal__accent--delete {
    background: linear-gradient(90deg, #dc2626 0%, #7c3aed 100%);
}

.moment-delete-modal__inner {
    padding: 1.35rem 1.5rem 1.45rem;
}

.moment-delete-modal__eyebrow {
    margin: 0 0 0.4rem;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.42);
}

.moment-delete-modal__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.4rem, 4.2vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: #111;
}

.moment-delete-modal__text {
    margin: 0 0 1.35rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(40, 38, 36, 0.92);
}

.moment-delete-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
    align-items: center;
}

.moment-delete-modal__btn {
    min-height: 2.55rem;
    min-width: 6.5rem;
    padding: 0 1.2rem;
    border-radius: 13px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition:
        background 0.16s ease,
        color 0.16s ease,
        transform 0.12s ease,
        box-shadow 0.16s ease,
        border-color 0.16s ease;
}

.moment-delete-modal__btn:active {
    transform: translateY(1px);
}

.moment-delete-modal__btn--ghost {
    border: 2px solid rgba(17, 17, 17, 0.38);
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
}

.moment-delete-modal__btn--ghost:hover {
    background: #111;
    color: #fff;
    border-color: #111;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
}

.moment-delete-modal__btn--danger {
    border: 2px solid #111;
    background: var(--color-red, #d91c1c);
    color: #fff;
    text-transform: uppercase;
}

.moment-delete-modal__btn--danger:hover {
    background: #111;
    color: #fff;
    border-color: #111;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.55);
}

.moment-delete-modal__btn--publish {
    border: 2px solid #111;
    background: linear-gradient(180deg, #fde047 0%, #f5c400 55%, #eab308 100%);
    color: #111;
    text-transform: uppercase;
    font-weight: 800;
}

.moment-delete-modal__btn--publish:hover {
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.55);
    filter: brightness(1.03);
}

.map-marker-root--draft .trace-map-star--trace {
    opacity: 0.72;
    filter: saturate(0.85);
}

.map-marker-trace-draft-delete-btn {
    flex: 1;
    margin: 0;
    min-width: 0;
    min-height: 2.3rem;
    padding: 0.56rem 0.78rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    cursor: pointer;
    line-height: 1;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.map-marker-trace-draft-delete-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.34);
    color: #fff;
    transform: translateY(-1px);
}

.map-marker-trace-draft-delete-btn:active {
    transform: scale(0.98);
}

/* Подпись на звезде: черновик виден до открытия карточки */
.map-marker-draft-star-pill {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    max-width: min(168px, 52vw);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(254, 249, 195, 0.95);
    background: rgba(12, 14, 24, 0.72);
    border: 1px solid rgba(245, 196, 0, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    line-height: 1.15;
    box-sizing: border-box;
}

.map-marker-trace-publish-btn {
    margin: 0;
    box-sizing: border-box;
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    padding: 0.56rem 0.78rem;
    border-radius: 12px;
    border: 1px solid rgba(245, 196, 0, 0.2);
    background: linear-gradient(180deg, rgba(255, 240, 188, 0.98), rgba(245, 214, 108, 0.92));
    color: #2a2110;
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    cursor: pointer;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.52),
        0 6px 16px rgba(245, 196, 0, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.map-marker-trace-publish-btn:hover {
    background: linear-gradient(180deg, rgba(255, 244, 205, 1), rgba(250, 220, 120, 0.95));
    border-color: rgba(245, 196, 0, 0.3);
    transform: translateY(-1px);
}

.map-marker-popover--trace .map-marker-moment {
    padding-top: 0.4rem;
}

.map-marker-trace-publish-btn:active {
    transform: scale(0.98);
}

.map-marker-trace-publish-btn:focus-visible {
    outline: 2px solid rgba(253, 224, 71, 0.55);
    outline-offset: 2px;
}

.map-marker-moment-author-float--trace-tools .map-marker-moment-delete-btn:focus-visible {
    outline: 2px solid rgba(252, 165, 165, 0.95);
    outline-offset: 2px;
}

.scenario-walk-qr-modal-overlay {
    z-index: 15500;
    background: rgba(17, 17, 17, 0.42);
    backdrop-filter: blur(8px);
}

.scenario-walk-qr-modal {
    position: relative;
    width: min(92vw, 420px);
    border-radius: 24px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 244, 250, 0.98) 100%),
        radial-gradient(circle at top, rgba(142, 76, 255, 0.08), transparent 48%);
    color: #111;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 24px 60px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(142, 76, 255, 0.08);
    overflow: hidden;
}

.scenario-walk-qr-modal__inner {
    padding: 1.2rem 1.2rem 1.2rem;
}

.scenario-walk-qr-modal__close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 2.15rem;
    height: 2.15rem;
    border: 1px solid rgba(17, 17, 17, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #111;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.scenario-walk-qr-modal__close:hover {
    background: rgba(142, 76, 255, 0.1);
    border-color: rgba(142, 76, 255, 0.22);
}

.scenario-walk-qr-modal__eyebrow {
    margin: 0 0 0.45rem;
    font-size: 0.58rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.48);
}

.scenario-walk-qr-modal__title {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    line-height: 0.98;
    color: #111;
}

.scenario-walk-qr-modal__text {
    margin: 0.75rem 0 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #4f4b55;
    max-width: 30ch;
}

.scenario-walk-qr-modal__qr-shell {
    margin: 1.05rem auto 0;
    width: min(100%, 288px);
    padding: 0.85rem;
    border-radius: 20px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 14px 32px rgba(17, 17, 17, 0.08);
}

.scenario-walk-qr-modal__qr {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 12px;
    background: #fff;
    object-fit: contain;
}

.scenario-walk-qr-modal__scenario {
    margin: 0.8rem 0 0;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: rgba(17, 17, 17, 0.5);
    text-align: center;
}

.map-marker-popover--trace {
    --map-pop-g1: rgba(234, 179, 8, 0.15);
    --map-pop-g2: rgba(202, 138, 4, 0.06);
    --moment-blue: #d97706;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: min(90vw, 288px);
    max-width: min(94vw, 320px);
    max-height: none;
    overflow: visible;
    transform: translateX(-50%) translateY(0);
}

.map-marker-popover--scenario {
    --map-pop-g1: rgba(147, 51, 234, 0.13);
    --map-pop-g2: rgba(142, 76, 255, 0.06);
    --moment-blue: #8e4cff;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-width: min(90vw, 288px);
    max-width: min(94vw, 320px);
    max-height: none;
    overflow: visible;
    transform: translateX(-50%) translateY(0);
}

.map-marker-popover--event {
    --map-pop-g1: rgba(255, 0, 60, 0.12);
    --map-pop-g2: rgba(251, 113, 133, 0.06);
    transform: translateX(-50%) translateY(0);
}

/* --- Popover shell v2: core + right drawer + bottom tray --- */
.map-marker-popover__shell--v2 {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.map-marker-popover__layout {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.map-marker-popover[data-popover-ui-state='right'] .map-marker-popover__layout {
    flex-direction: row;
    align-items: stretch;
}

.map-marker-popover[data-popover-ui-state='bottom'] .map-marker-popover__layout {
    flex-direction: column;
}

.map-marker-popover[data-popover-ui-state='right'] {
    min-width: min(92vw, 520px);
    max-width: min(96vw, 560px);
}

.map-marker-popover__core-block {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.map-marker-popover__edge-triggers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    align-items: center;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(17, 17, 17, 0.07);
}

.map-marker-popover__dock-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 2rem;
    padding: 0.25rem 0.55rem;
    border-radius: 10px;
    border: 2px solid rgba(17, 17, 17, 0.85);
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    cursor: pointer;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.map-marker-popover__dock-trigger:hover {
    background: #111;
    color: #fff;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.65);
}

.map-marker-popover__ico {
    display: block;
    flex-shrink: 0;
}

.map-marker-popover__dock-hint {
    margin: 0;
    font-size: 0.52rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.45);
}

.map-marker-popover__reveal-photo {
    display: block;
    width: calc(100% + 0.2rem);
    margin: 0 -0.1rem 0.35rem;
    padding: 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    line-height: 0;
}

.map-marker-popover__reveal-photo img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
}

.map-marker-popover__right-drawer {
    flex: 1 1 220px;
    min-width: 0;
    max-width: 100%;
    max-height: min(52vh, 420px);
    overflow: auto;
    padding: 0.72rem 0.72rem 0.78rem;
    border-radius: 14px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 246, 242, 0.98) 100%);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.72);
}

.map-marker-popover[data-popover-ui-state='right'] .map-marker-popover__right-drawer {
    max-width: min(46%, 260px);
}

.map-marker-popover__bottom-tray {
    width: 100%;
    max-height: min(40vh, 320px);
    overflow: auto;
    padding: 0.62rem 0.72rem 0.78rem;
    border-radius: 14px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.72);
}

.map-marker-popover__drawer-head {
    font-size: 0.56rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.45);
    margin-bottom: 0.45rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.map-marker-popover__drawer-block {
    margin-bottom: 0.55rem;
}

.map-marker-popover__drawer-label {
    display: block;
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(17, 17, 17, 0.5);
    margin-bottom: 0.2rem;
}

.map-marker-popover__drawer-block p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #222;
}

.map-marker-popover__secret-teaser {
    font-size: 0.72rem;
    color: rgba(17, 17, 17, 0.55);
    padding: 0.45rem 0.5rem;
    border-radius: 10px;
    border: 1px dashed rgba(142, 76, 255, 0.35);
    background: rgba(142, 76, 255, 0.06);
}

.map-marker-popover__phase-stack {
    display: grid;
    gap: 0.55rem;
}

.map-marker-popover__phase-panel {
    padding: 0.72rem 0.72rem 0.76rem;
    border-radius: 16px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 246, 250, 0.98)),
        linear-gradient(135deg, rgba(142, 76, 255, 0.06), rgba(255, 255, 255, 0));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.map-marker-popover__phase-panel-title {
    font-size: 0.95rem;
    margin: 0 0 0.35rem;
    color: #111;
}

.map-marker-popover__phase-copy,
.map-marker-popover__phase-hint {
    font-size: 0.77rem;
    line-height: 1.45;
    color: #262626;
}

.map-marker-popover__phase-hint {
    margin-top: 0.4rem;
    padding-top: 0.42rem;
    border-top: 1px solid rgba(17, 17, 17, 0.08);
}

.map-marker-popover__route-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.map-marker-popover__route-dot {
    min-width: 2.2rem;
    min-height: 2.2rem;
    border-radius: 999px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: #fff;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.map-marker-popover__route-dot.is-active {
    background: #111;
    color: #fff;
    border-color: #111;
}

.map-marker-popover__route-dot:hover {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .map-marker-popover__dock-trigger,
    .map-marker-popover__route-dot {
        transition: none;
    }
}

/* Scenario participant mode */
.scenario-participant-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    pointer-events: none;
}

.scenario-participant-overlay.hidden {
    display: none !important;
}

.scenario-participant-overlay__top {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    pointer-events: auto;
    max-width: min(100%, 720px);
    margin: 0 auto;
}

.scenario-participant-overlay__exit {
    border: 2px solid rgba(17, 17, 17, 0.85);
    background: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
}

.scenario-participant-overlay__titles {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    text-align: right;
}

.scenario-participant-overlay__title {
    font-size: 1rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.scenario-participant-overlay__progress {
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: rgba(17, 17, 17, 0.55);
}

/* Step card bottom */
#scenario-participant-step-card.scenario-step-card {
    position: absolute;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    max-width: min(100%, 720px);
    margin: 0 auto;
    pointer-events: auto;
    padding: 0.85rem 1rem 1rem;
    border-radius: 18px;
    border: 2px solid rgba(17, 17, 17, 0.85);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 246, 242, 0.98) 100%);
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.72);
}

.scenario-step-card__body {
    max-height: min(42vh, 360px);
    overflow: auto;
}

.scenario-step-card__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.72rem;
    margin-bottom: 0.45rem;
}

.scenario-step-card__title {
    font-size: 1.05rem;
    margin: 0 0 0.45rem;
    border-left: 4px solid rgba(142, 76, 255, 0.85);
    padding-left: 0.55rem;
}

.scenario-step-card__desc,
.scenario-step-card__inst {
    font-size: 0.84rem;
    line-height: 1.5;
    color: #2a2a2a;
    margin: 0 0 0.45rem;
}

.scenario-step-card__media {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.scenario-step-card__media-card {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    overflow: hidden;
}

.scenario-step-card__media-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scenario-step-card__media-pill {
    position: absolute;
    left: 0.35rem;
    bottom: 0.35rem;
    padding: 0.18rem 0.3rem;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.72);
    color: #fff;
    font-size: 0.42rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scenario-step-card__nav {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(17, 17, 17, 0.1);
}

.scenario-step-card__nav-btn {
    flex: 1;
    min-height: 2.35rem;
    border-radius: 12px;
    border: 2px solid rgba(17, 17, 17, 0.82);
    background: #fff;
    cursor: pointer;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: background 0.15s ease, transform 0.1s ease;
}

.scenario-step-card__nav-btn:hover {
    background: #111;
    color: #fff;
}

.scenario-step-card__meta {
    margin: 0 0 0.45rem;
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    color: rgba(17, 17, 17, 0.55);
}

.scenario-participant-exit-row {
    width: 100%;
    margin-top: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    border: 1px dashed rgba(196, 30, 42, 0.45);
    background: rgba(196, 30, 42, 0.06);
    color: rgba(120, 20, 28, 0.95);
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.map-marker-popover__photo-wrap {
    margin: -0.75rem -0.8rem 0.55rem;
    border-radius: 15px 15px 10px 10px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(17, 17, 17, 0.06);
}

.map-marker-popover__photo {
    width: 100%;
    max-height: 132px;
    object-fit: cover;
    display: block;
}

.map-marker-popover__content-block {
    padding: 0.55rem 0.58rem 0.58rem;
    margin-bottom: 0.45rem;
    border-radius: 11px;
    background: linear-gradient(165deg, rgba(17, 17, 17, 0.035) 0%, rgba(17, 17, 17, 0.02) 100%);
    border: 1px solid rgba(17, 17, 17, 0.07);
}

.map-marker-popover--moment .map-marker-popover__content-block {
    background: linear-gradient(165deg, rgba(37, 99, 235, 0.07) 0%, rgba(37, 99, 235, 0.02) 100%);
    border-color: rgba(37, 99, 235, 0.12);
}

.map-marker-popover--trace .map-marker-popover__content-block {
    background: linear-gradient(165deg, rgba(234, 179, 8, 0.1) 0%, rgba(245, 196, 0, 0.03) 100%);
    border-color: rgba(200, 160, 0, 0.16);
}

.map-marker-popover--scenario .map-marker-popover__content-block {
    background: linear-gradient(165deg, rgba(142, 76, 255, 0.08) 0%, rgba(142, 76, 255, 0.02) 100%);
    border-color: rgba(142, 76, 255, 0.14);
}

.map-marker-popover--event .map-marker-popover__content-block {
    background: linear-gradient(165deg, rgba(255, 0, 60, 0.06) 0%, rgba(255, 0, 60, 0.02) 100%);
    border-color: rgba(255, 0, 60, 0.12);
}

.map-marker-popover__gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 0.65rem;
}

.map-marker-popover__gallery img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(17, 17, 17, 0.08);
}

.map-marker-popover__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}

.map-marker-popover__head-left {
    min-width: 0;
    flex: 1;
}

.map-marker-popover__head-right {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex-shrink: 0;
}

.map-marker-popover__kind--hero {
    padding: 0.32rem 0.58rem;
    border-radius: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.09em;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.22);
}

.map-marker-popover__reaction-slot {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    max-height: 10rem;
    opacity: 1;
    transform-origin: center bottom;
    transition:
        max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease,
        margin 0.4s ease;
}

.map-marker-popover__reaction-slot--empty[hidden] {
    display: none !important;
}

.map-marker-popover__reaction-slot--collapse-out {
    max-height: 0 !important;
    opacity: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    pointer-events: none;
}

.map-marker-popover__votes-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.map-marker-popover__votes-row {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.map-marker-popover__date {
    display: inline-block;
    margin: 0;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: #2c3b52;
    padding: 0.32rem 0.6rem;
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.03) 100%);
    border: 1px solid rgba(37, 99, 235, 0.18);
}

.map-marker-popover--trace .map-marker-popover__date {
    color: #5c4a00;
    background: linear-gradient(145deg, rgba(245, 196, 0, 0.2) 0%, rgba(245, 196, 0, 0.06) 100%);
    border-color: rgba(180, 140, 0, 0.28);
}

.map-marker-popover--scenario .map-marker-popover__date {
    color: #4a2d6b;
    background: linear-gradient(145deg, rgba(142, 76, 255, 0.12) 0%, rgba(142, 76, 255, 0.04) 100%);
    border-color: rgba(142, 76, 255, 0.22);
}

.map-marker-popover--event .map-marker-popover__date {
    color: #6b1f2a;
    background: linear-gradient(145deg, rgba(255, 0, 60, 0.1) 0%, rgba(255, 0, 60, 0.03) 100%);
    border-color: rgba(255, 0, 60, 0.2);
}

.map-marker-popover__meta-lines {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.map-marker-popover__meta {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    color: #7a7a7a;
}

.map-marker-popover__meta--strong {
    color: #32274a;
    line-height: 1.55;
}

.map-marker-popover__kind {
    flex-shrink: 0;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    color: #fff;
    background: var(--kind-bg, #2563eb);
}

.map-marker-popover__content-block .map-marker-popover__title {
    margin: 0 0 0.38rem;
}

.map-marker-popover__title {
    font-size: 1.02rem;
    margin: 0 0 0.45rem;
    color: #111;
    letter-spacing: -0.01em;
}

.map-marker-popover__content-block .map-marker-popover__story {
    margin-bottom: 0;
}

.map-marker-popover__story {
    font-size: 0.86rem;
    line-height: 1.52;
    color: #2f2f2f;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.65rem;
}

.map-marker-popover__label {
    display: block;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 0.35rem;
}

.map-marker-popover__meta-block {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.map-marker-popover__detail-card {
    margin-bottom: 0.65rem;
    padding: 0.62rem 0.72rem;
    border-radius: 12px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 246, 246, 0.9) 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.72) inset,
        0 8px 22px rgba(17, 17, 17, 0.04);
}

.map-marker-popover__detail-card--trace {
    border-color: rgba(200, 160, 0, 0.18);
    background: linear-gradient(180deg, rgba(255, 245, 196, 0.36) 0%, rgba(255, 250, 228, 0.9) 100%);
}

.map-marker-popover__detail-card--scenario {
    border-color: rgba(142, 76, 255, 0.16);
    background: linear-gradient(180deg, rgba(238, 231, 255, 0.76) 0%, rgba(249, 247, 255, 0.94) 100%);
}

.map-marker-popover__detail-card--trace-media {
    padding: 0.32rem;
    overflow: hidden;
}

.map-marker-popover__route-pill,
.map-marker-popover__section-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0.55rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(142, 76, 255, 0.16);
    background: rgba(142, 76, 255, 0.07);
    color: #5a3b86;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
}

.map-marker-popover__object-photo img {
    display: block;
    width: 100%;
    max-height: 120px;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.1);
    object-fit: cover;
}

.map-marker-popover__qr-hint {
    font-size: 0.72rem;
    line-height: 1.45;
    color: #5c5c5c;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: rgba(142, 76, 255, 0.06);
    border: 1px dashed rgba(142, 76, 255, 0.35);
    margin-bottom: 0.65rem;
}

.map-marker-popover__qr-author {
    margin-bottom: 0.65rem;
}

.map-marker-popover__link {
    display: block;
    font-size: 0.72rem;
    word-break: break-all;
    color: #c4002f;
    margin-bottom: 0.5rem;
}

.map-marker-popover__qr-img-wrap img {
    border-radius: 8px;
    border: 1px solid rgba(17, 17, 17, 0.1);
}

.map-marker-popover__phases {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.map-marker-popover__phase {
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
    border: 1px solid rgba(142, 76, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 241, 255, 0.9) 100%);
}

.map-marker-popover__phase-num {
    font-size: 0.58rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.map-marker-popover__phase-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: #111;
}

.map-marker-popover__phase-text,
.map-marker-popover__phase-inst {
    font-size: 0.82rem;
    line-height: 1.45;
    color: #333;
    margin-top: 0.35rem;
}

.map-marker-popover__phase-media {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 0.45rem;
}

.map-marker-popover__phase-media img {
    width: 100%;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

.map-marker-popover__footer {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 0.45rem;
    margin-top: 0.2rem;
    border-top: 1px solid rgba(17, 17, 17, 0.07);
}

.map-marker-popover__footer-panel {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.45rem 0.42rem 0.48rem;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.045) 0%, rgba(17, 17, 17, 0.02) 100%);
    border: 1px solid rgba(17, 17, 17, 0.08);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.map-marker-popover--moment .map-marker-popover__footer-panel {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.09) 0%, rgba(37, 99, 235, 0.03) 100%);
    border-color: rgba(37, 99, 235, 0.14);
}

.map-marker-popover--trace .map-marker-popover__footer-panel {
    background: linear-gradient(180deg, rgba(245, 196, 0, 0.12) 0%, rgba(245, 196, 0, 0.04) 100%);
    border-color: rgba(200, 160, 0, 0.2);
}

.map-marker-popover--scenario .map-marker-popover__footer-panel {
    background: linear-gradient(180deg, rgba(142, 76, 255, 0.1) 0%, rgba(142, 76, 255, 0.03) 100%);
    border-color: rgba(142, 76, 255, 0.16);
}

.map-marker-popover--event .map-marker-popover__footer-panel {
    background: linear-gradient(180deg, rgba(255, 0, 60, 0.08) 0%, rgba(255, 0, 60, 0.03) 100%);
    border-color: rgba(255, 0, 60, 0.14);
}

.map-marker-popover__metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.28rem 0.25rem;
    padding: 0.35rem 0.3rem 0.42rem;
    border-radius: 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(17, 17, 17, 0.07);
}

.map-marker-popover__metrics--in-panel {
    margin: 0;
}

.map-marker-popover__metrics--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.map-marker-popover--moment .map-marker-popover__metrics {
    border-bottom-color: rgba(37, 99, 235, 0.15);
}

.map-marker-popover--trace .map-marker-popover__metrics {
    border-bottom-color: rgba(200, 160, 0, 0.2);
}

.map-marker-popover--scenario .map-marker-popover__metrics {
    border-bottom-color: rgba(142, 76, 255, 0.16);
}

.map-marker-popover--event .map-marker-popover__metrics {
    border-bottom-color: rgba(255, 0, 60, 0.14);
}

.map-marker-popover__metric {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    text-align: center;
    min-width: 0;
}

.map-marker-popover__metric-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: #141414;
    line-height: 1.15;
}

.map-marker-popover__metric-label {
    font-size: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: #6a6a6a;
    line-height: 1.2;
}

.map-marker-popover__metric-emoji {
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.92;
}

.map-marker-popover__participation-row {
    display: flex;
    justify-content: center;
    padding: 0.2rem 0.35rem 0.35rem;
    border-bottom: 1px solid rgba(17, 17, 17, 0.07);
}

.map-marker-popover__participation-btn {
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.14);
    background: rgba(17, 17, 17, 0.04);
    color: #222;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.map-marker-popover__participation-ico {
    flex-shrink: 0;
    display: block;
}

.map-marker-popover__participation-btn[aria-pressed='true'] {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.12);
}

.map-marker-popover--trace .map-marker-popover__participation-btn[aria-pressed='true'] {
    border-color: rgba(200, 160, 0, 0.55);
    background: rgba(234, 179, 8, 0.18);
}

.map-marker-popover--scenario .map-marker-popover__participation-btn[aria-pressed='true'] {
    border-color: rgba(142, 76, 255, 0.45);
    background: rgba(142, 76, 255, 0.12);
}

.map-marker-popover__route-pill--public {
    margin-top: 0.35rem;
}

.map-marker-popover__footer-panel .map-marker-popover__votes-row {
    padding: 0.15rem 0.1rem 0;
    margin: 0;
}

.map-marker-popover__footer-panel .map-marker-popover__reaction-slot {
    padding-top: 0;
}

.map-marker-popover__reaction-done-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.map-marker-popover__reaction-done-block--toast-only {
    align-items: stretch;
}

.map-marker-popover__reaction-done-block--toast-only .map-marker-popover__reaction-toast {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.map-marker-popover__reaction-toast {
    font-size: 0.78rem;
    line-height: 1.45;
    margin: 0;
    padding: 0.5rem 0.68rem;
    border-radius: 10px;
    animation: map-marker-reaction-toast-in 0.32s ease;
}

.map-marker-popover__reaction-toast--like {
    color: #1a2f4d;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.map-marker-popover__reaction-toast--dislike {
    color: #4a3a12;
    background: rgba(234, 179, 8, 0.16);
    border: 1px solid rgba(202, 138, 4, 0.3);
}

@keyframes map-marker-reaction-toast-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.map-marker-popover__vote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 2.55rem;
    height: auto;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    background: #f6f7f8;
    cursor: pointer;
    color: #2a2a2a;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    box-sizing: border-box;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}

.map-marker-popover__vote:hover {
    background: #eceef0;
}

.map-marker-popover__vote--like:hover {
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.08);
}

.map-marker-popover__vote--dislike:hover {
    border-color: rgba(180, 83, 9, 0.35);
    background: rgba(245, 196, 0, 0.12);
}

.map-marker-popover__vote-emoji {
    font-size: 1.35rem;
    line-height: 1;
    pointer-events: none;
}

@media (max-width: 340px) {
    .map-marker-popover__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .map-marker-popover {
        min-width: min(94vw, 280px);
        max-width: min(96vw, 320px);
        box-shadow:
            6px 6px 0 rgba(0, 0, 0, 0.74),
            0 10px 24px rgba(0, 0, 0, 0.18);
    }

    .map-marker-popover__media-image--hero {
        height: 120px;
    }

    .map-marker-popover__tabs {
        gap: 0.28rem;
    }

    .map-marker-popover__tab,
    .map-marker-popover__peek-button {
        font-size: 0.6rem;
        padding-inline: 0.56rem;
    }
}

.scenario-step-badge {
    position: absolute;
    top: 50%;
    left: calc(100% + 6px);
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    transform: translateY(-50%);
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.08);
    color: #1f1f24;
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.scenario-step-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.scenario-step-head-actions {
    display: flex;
    align-items: center;
    gap: 0.42rem;
}

.scenario-step-title-input {
    width: 100%;
    min-width: 0;
    padding: 0.08rem 0 0.18rem;
    border: none;
    border-bottom: 1px solid rgba(142, 76, 255, 0.16);
    background: transparent;
    color: #17131f;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    outline: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.scenario-step-title-input::placeholder {
    color: #8f86a0;
    opacity: 1;
}

.scenario-step-title-input:focus {
    border-bottom-color: rgba(142, 76, 255, 0.55);
    color: #111111;
}

.scenario-step-close-btn {
    flex: 0 0 auto;
    padding: 0.34rem 0.58rem;
    border-radius: 999px;
    font-size: 0.62rem;
    line-height: 1;
    white-space: nowrap;
}

.scenario-step-delete-btn {
    flex: 0 0 auto;
    border-color: rgba(218, 51, 87, 0.18);
    background: linear-gradient(180deg, #fff3f5 0%, #ffe9ee 100%);
    color: #bb294a;
}

.scenario-step-delete-btn:hover {
    border-color: rgba(218, 51, 87, 0.34);
    background: #ffe2e9;
}

.scenario-step-field {
    display: grid;
    gap: 0.3rem;
}

.scenario-step-field__label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #827791;
}

.scenario-step-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 62px;
    max-height: 136px;
    padding: 0.62rem 0.72rem;
    border-radius: 10px;
    border: 1px solid #e4dfee;
    background: #faf8fd;
    color: #1f1f24;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.45;
    resize: none;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.scenario-step-input:focus {
    border-color: rgba(142, 76, 255, 0.44);
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(142, 76, 255, 0.08);
}

.scenario-step-media-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.scenario-step-btn {
    border: 1px solid rgba(142, 76, 255, 0.18);
    background: linear-gradient(180deg, #f8f5ff 0%, #f2edff 100%);
    color: #5e3faa;
    border-radius: 8px;
    font-size: 0.76rem;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
}

.scenario-step-btn:hover {
    border-color: rgba(142, 76, 255, 0.36);
    background: #efe8ff;
}

.scenario-step-btn--media {
    white-space: nowrap;
}

.scenario-step-media-count {
    color: #7f748e;
    font-size: 0.72rem;
    line-height: 1.4;
}

#ui-overlay.placing #add-trace-hitbox,
#ui-overlay.placing #signal-star-stack {
    opacity: 0.1;
    pointer-events: none;
}

/* MODALS — выше любых маркеров; дополнительно маркеры скрываются через body:has выше */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.73);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15000;
    isolation: isolate;
    transition: opacity 0.3s;
}

/* Высокие формы (след): не обрезать по вертикали — прокрутка оверлея */
#modal-add-trace.modal-overlay {
    align-items: flex-start;
    padding: 2.5vh 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    display: grid;
    place-items: center;
    transition: 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 0, 60, 0.14);
    border-color: rgba(255, 0, 60, 0.35);
}

/* FORMS */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    margin-bottom: 5px;
    color: var(--accent-red, #ff003c);
}

.cyber-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    color: white;
    font-family: inherit;
}

.cyber-input:focus {
    outline: none;
    border-color: var(--accent-red, #ff003c);
    background: rgba(255, 255, 255, 0.1);
}

textarea.cyber-input {
    min-height: 100px;
    resize: vertical;
}

.cyber-file-input {
    font-size: 0.8rem;
    color: #888;
}

.form-hint {
    font-size: 0.7rem;
    margin: 10px 0;
}

/* TRACE DETAILS */
.trace-photo {
    width: 100%;
    height: 250px;
    object-fit: cover;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.trace-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.trace-meta {
    display: flex;
    flex-direction: column;
}

.emotion-tag {
    background: var(--accent-red, #ff003c);
    color: black;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    align-self: flex-start;
}

.trace-story {
    line-height: 1.6;
    margin-bottom: 20px;
}

.trace-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ADD SIGNAL MODAL */
.add-signal-modal {
    width: min(92vw, 520px);
    max-width: 520px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    animation: modal-slide-up 0.24s ease-out;
}

.add-signal-modal.add-signal-modal-compact {
    width: min(92vw, 520px);
    max-width: 520px;
}

#modal-add-trace .add-signal-modal-compact {
    width: min(94vw, 860px);
    max-width: 860px;
}

.add-signal-modal.add-signal-modal-fullscreen {
    width: min(98vw, 1320px);
    max-width: 1320px;
    height: min(94vh, 960px);
    max-height: 94vh;
}

.add-signal-panel {
    position: relative;
    padding: 2.5rem;
    background: #ffffff;
    color: #111111;
    border-radius: 16px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.55),
        inset 0 0 52px -10px rgba(255, 0, 68, 0.07),
        inset 0 0 110px -36px rgba(255, 0, 68, 0.03);
    overflow: hidden;
}

.add-signal-modal-fullscreen .add-signal-panel {
    height: 100%;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.5rem 1.25rem;
}

.add-signal-modal-fullscreen .add-signal-head {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.add-signal-modal-fullscreen .add-signal-form {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.add-signal-modal-fullscreen .add-signal-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 26%);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.add-signal-modal-fullscreen #scenario-phases-list {
    max-height: none;
}

.add-signal-modal .modal-close {
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.92);
    color: #8f8f8f;
    border: 1px solid #ececec;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.add-signal-modal .modal-close:hover {
    background: #ffffff;
    color: #111111;
    border-color: #d7d7d7;
}

/* Полоска сверху заменена на мягкое внутреннее свечение у .add-signal-panel */
.add-signal-accent-top {
    display: none;
}

.add-signal-head {
    position: relative;
    margin-bottom: 1.75rem;
    text-align: center;
}

.add-signal-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: #a0a0a0;
    text-transform: uppercase;
}

.add-signal-head h2 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1;
    letter-spacing: -0.5px;
    color: #111111;
}

.add-signal-head h2 span {
    color: var(--color-red);
}

.add-signal-intro {
    max-width: 360px;
    margin: 0.75rem auto 0;
    font-size: 0.96rem;
    line-height: 1.6;
    color: #666666;
}

.add-signal-form {
    display: grid;
    gap: 1rem;
}

.signal-dropzone {
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.signal-dropzone-input {
    display: none;
}

.signal-dropzone-preview {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    background:
        linear-gradient(135deg, rgba(255, 0, 68, 0.08), transparent 42%),
        #f8f9fa;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.signal-dropzone:hover .signal-dropzone-preview {
    transform: translateY(-2px);
    border-color: #cfcfcf;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.signal-dropzone-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.08));
    pointer-events: none;
}

.signal-dropzone-preview.has-image {
    background-size: cover;
    background-position: center;
}

.signal-dropzone-preview.has-image::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.24) 100%);
}

.signal-dropzone-copy {
    position: absolute;
    inset: auto 18px 18px 18px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
}

.signal-dropzone-badge {
    align-self: flex-start;
    padding: 0.38rem 0.6rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #ececec;
    border-radius: 999px;
    color: #888888;
    font-size: 0.65rem;
    letter-spacing: 1.2px;
}

.signal-dropzone-copy strong {
    font-size: 1.4rem;
    line-height: 1;
    color: #111111;
}

.signal-dropzone-copy p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #666666;
}

.signal-dropzone-preview.has-image .signal-dropzone-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #555555;
}

.signal-dropzone-preview.has-image .signal-dropzone-copy strong,
.signal-dropzone-preview.has-image .signal-dropzone-copy p {
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.add-signal-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin: 0.2rem 0 0.35rem;
}

.add-signal-divider div {
    flex: 1;
    height: 1px;
    background: #eaeaea;
}

.add-signal-divider span {
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: #a0a0a0;
    text-transform: uppercase;
}

.signal-field {
    display: grid;
    gap: 8px;
}

.signal-message-input {
    width: 100%;
    min-height: 150px;
    padding: 1.2rem 1rem;
    resize: vertical;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    color: #111111;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.signal-message-input::placeholder {
    color: #9a9a9a;
}

.signal-message-input:focus {
    border-color: var(--color-red);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 0, 60, 0.1);
}

.add-signal-actions {
    display: grid;
    gap: 1rem;
}

.add-signal-meta {
    margin: 0;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.6;
    letter-spacing: 0.4px;
    color: #999999;
}

.signal-submit-btn {
    width: 100%;
    min-height: 58px;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: #111111;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.signal-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.signal-submit-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    #add-trace-btn {
        width: 238px;
        padding: 0 16px;
        font-size: 1.2rem;
    }

    #signal-star-stack {
        right: 14px;
        bottom: 84px;
        gap: 5px;
    }

    .signal-star-btn {
        width: 44px;
        height: 44px;
        padding: 6px;
    }

    .kind-hover-panel {
        max-width: min(92vw, 340px);
        padding: 0.85rem 0.9rem 0.95rem 0.95rem;
    }

    .kind-hover-lead {
        font-size: 0.84rem;
        margin-bottom: 0.4rem;
    }

    .kind-hover-body {
        font-size: 0.82rem;
    }

    .add-signal-modal {
        width: min(94vw, 520px);
    }

    .add-signal-modal.add-signal-modal-fullscreen {
        width: 96vw;
        height: 92vh;
        max-height: 92vh;
    }

    .add-signal-panel {
        padding: 2rem 1.25rem 1.25rem;
    }

    .add-signal-modal-fullscreen .add-signal-panel {
        padding: 1.1rem 1rem 1rem;
    }

    .add-signal-head {
        margin-bottom: 1.25rem;
    }

    .signal-dropzone-copy {
        inset: auto 14px 14px 14px;
        max-width: calc(100% - 28px);
    }

    .signal-message-input {
        min-height: 150px;
    }

    .add-signal-actions {
        gap: 0.85rem;
    }

    #modal-add-trace .add-signal-panel {
        max-height: 92vh;
    }
}

/* --- Модалка «Сценарий»: та же логика, что у «Следа» (карточки, скролл, узкие поля) --- */
#modal-add-scenario .add-signal-panel {
    display: flex;
    flex-direction: column;
    max-height: min(92vh, 820px);
    padding: 1.1rem 1.15rem 0.95rem;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(180deg, #f6f6f7 0%, #ffffff 28%, #ffffff 100%);
    border: 1px solid rgba(17, 17, 17, 0.07);
    box-shadow:
        0 24px 60px rgba(17, 17, 17, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 0 64px -14px rgba(147, 51, 234, 0.06),
        inset 0 0 120px -40px rgba(147, 51, 234, 0.03);
}

#modal-add-scenario .scenario-modal-head {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    text-align: center;
}

#modal-add-scenario .scenario-modal-head h2 {
    margin: 0;
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
}

#modal-add-scenario .scenario-modal-intro {
    margin: 0.35rem 0 0;
    font-size: 0.84rem;
    line-height: 1.35;
    color: #7a7a7a;
}

#add-scenario-form.trace-form-v2 {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 0;
    flex: 1;
    font-family: 'Inter', system-ui, sans-serif;
}

#modal-add-scenario .trace-form-stack {
    gap: 0.85rem;
}

#modal-add-scenario .trace-card {
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 12px 36px rgba(17, 17, 17, 0.07);
    padding: 1rem 1.2rem 1.2rem;
}

#modal-add-scenario .trace-card__head {
    margin: 0 0 0.9rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(17, 17, 17, 0.07);
}

#modal-add-scenario .trace-card__title {
    font-size: clamp(1.15rem, 2.8vw, 1.45rem);
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: #111;
}

#modal-add-scenario .trace-card__kicker {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #7a7a7a;
    max-width: 36em;
}

#modal-add-scenario .trace-v2-lbl {
    margin-bottom: 0.42rem;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    color: #111;
}

#modal-add-scenario .trace-card--scenario-meta .trace-v2-field + .trace-v2-field {
    margin-top: 0.75rem;
}

#modal-add-scenario .trace-line-input.trace-input-lg,
#modal-add-scenario .trace-input-lg.trace-line-input {
    min-height: 46px;
    height: auto;
    font-size: 1rem;
    padding: 0.55rem 0.85rem;
}

#modal-add-scenario textarea.trace-input-lg,
#modal-add-scenario .trace-area-sm.trace-input-lg {
    font-size: 1rem;
    line-height: 1.45;
    min-height: 72px;
    padding: 0.65rem 0.85rem;
}

#modal-add-scenario .trace-line-input,
#modal-add-scenario .trace-autogrow,
#modal-add-scenario .trace-area-sm {
    border-radius: 12px;
    border-color: #e4e4e4;
    background: #fbfbfb;
}

#modal-add-scenario .trace-line-input:focus,
#modal-add-scenario .trace-area-sm:focus {
    background: #fff;
}

#modal-add-scenario .scenario-place-preview {
    aspect-ratio: 16 / 9;
    width: 100%;
    max-width: 100%;
    min-height: unset !important;
    max-height: none !important;
    margin-inline: auto;
    box-sizing: border-box;
    border: none;
    border-radius: 14px;
}

#modal-add-scenario .scenario-preview-drop {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

#modal-add-scenario .scenario-place-preview .trace-place-preview-inner {
    flex-direction: column;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 0.65rem;
    text-align: center;
}

#modal-add-scenario .scenario-place-preview .trace-place-txt strong {
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

#modal-add-scenario .trace-form-scroll-v2 {
    scrollbar-width: thin;
    scrollbar-color: #ff003c rgba(17, 17, 17, 0.06);
}

#modal-add-scenario .trace-form-scroll-v2::-webkit-scrollbar {
    width: 5px;
}

#modal-add-scenario .trace-form-scroll-v2::-webkit-scrollbar-track {
    background: rgba(17, 17, 17, 0.06);
    border-radius: 99px;
}

#modal-add-scenario .trace-form-scroll-v2::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff0044 0%, #c4002f 100%);
    border-radius: 99px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 12px rgba(255, 0, 60, 0.5);
}

#modal-add-scenario .add-signal-actions {
    flex-shrink: 0;
    margin-top: 0.45rem;
}

#modal-add-scenario .signal-submit-btn {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    #modal-add-scenario .add-signal-panel {
        max-height: 92vh;
    }
}

/* YANDEX MAP OVERRIDES (if possible via CSS) */
/* V3 uses Shadow DOM or complex classes, mostly styled via initialization options */
.ymaps3x0--map {
    filter: contrast(1.1) brightness(0.9);
}

/* --- Walk-app shell: внутренние overlay-панели traces больше не участвуют в mobile UI --- */
.traces-page.traces-walk-app-shell #ui-overlay {
    bottom: 0;
    pointer-events: none;
}

/* FAB дублирует центральную кнопку «Сигнал» в walk-app — скрываем */
.traces-page.traces-walk-app-shell #add-trace-hitbox {
    display: none !important;
}

/* Внутренний стек выбора типа сигнала в app-shell не нужен: выбор уже делает walk-app */
.traces-page.traces-walk-app-shell #signal-star-stack {
    display: none !important;
}

/* Add-signal модалки в app-shell больше не используются: окна рисует родительский walk-app */
.traces-page.traces-walk-app-shell #modal-add-moment,
.traces-page.traces-walk-app-shell #modal-add-trace,
.traces-page.traces-walk-app-shell #modal-add-scenario {
    display: none !important;
}

.traces-page.traces-walk-app-shell #scenario-finish-btn,
.traces-page.traces-walk-app-shell #scenario-step-select-hint,
.traces-page.traces-walk-app-shell #scenario-step-editor,
.traces-page.traces-walk-app-shell #signal-place-hint {
    display: none !important;
}

/* Во время выбора точки в app-shell существующие карточки маркеров не должны перехватывать тап. */
.traces-page.traces-walk-app-shell.traces-shell-placing-signal .map-marker-hitbox,
.traces-page.traces-walk-app-shell.traces-shell-placing-signal .map-marker-popover {
    pointer-events: none !important;
}

.traces-page.traces-walk-app-shell.traces-shell-placing-signal .map-marker-root.is-open .map-marker-popover {
    opacity: 0 !important;
    transform: none !important;
}

/* Верхние контролы карты в shell: слегка отступаем от safe-area. */
.traces-page.traces-walk-app-shell .maplibregl-ctrl-top-left {
    margin-top: calc(8px + env(safe-area-inset-top, 0px));
    margin-left: calc(8px + env(safe-area-inset-left, 0px));
}

.signal-place-hint {
    position: absolute;
    left: 50%;
    bottom: calc(128px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(100% - 24px, 22rem);
    padding: 0.85rem 0.95rem;
    border-radius: 22px;
    background: rgba(16, 18, 26, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    z-index: 1002;
    pointer-events: none;
}

.signal-place-hint.hidden {
    display: none !important;
}

.signal-place-hint__title {
    margin: 0 0 0.18rem;
    font-size: 1rem;
    line-height: 1.1;
    color: #fff;
    text-align: center;
}

.signal-place-hint__text {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.45;
    color: rgba(244, 242, 251, 0.8);
    text-align: center;
}

/* --- Embedded mobile: карточки маркеров как bottom sheet --- */
.traces-page.traces-embedded-mobile .map-marker-root {
    overflow: visible;
}

.traces-page.traces-embedded-mobile .map-marker-popover {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none !important;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    max-height: min(58vh, 520px);
    margin: 0;
    border-radius: 22px 22px 0 0;
    padding: 0.85rem 1rem 1rem;
    z-index: 10060;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}

.traces-page.traces-embedded-mobile .map-marker-root.is-open .map-marker-popover {
    transform: none !important;
}

.traces-page.traces-embedded-mobile .map-marker-hitbox {
    min-width: 48px;
    min-height: 48px;
}

/* Mobile: прохождение сценария — тёмная панель как в референсе */
.traces-page.traces-embedded-mobile .scenario-participant-overlay__top.glass-panel {
    background: rgba(13, 12, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f4f2fb;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.traces-page.traces-embedded-mobile .scenario-participant-overlay__title {
    color: #fff;
}

.traces-page.traces-embedded-mobile .scenario-participant-overlay__progress {
    color: rgba(244, 242, 251, 0.55);
}

.traces-page.traces-embedded-mobile .scenario-participant-overlay__exit {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.traces-page.traces-embedded-mobile #scenario-participant-step-card.scenario-step-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(28, 26, 38, 0.98) 0%, rgba(18, 16, 26, 0.99) 100%);
    color: #f4f2fb;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5);
}

.traces-page.traces-embedded-mobile .scenario-step-card__title,
.traces-page.traces-embedded-mobile .scenario-step-card__desc,
.traces-page.traces-embedded-mobile .scenario-step-card__inst {
    color: rgba(244, 242, 251, 0.92);
    border-left-color: rgba(167, 139, 250, 0.85);
}

.traces-page.traces-embedded-mobile .scenario-step-card__meta {
    color: rgba(244, 242, 251, 0.55);
}

.traces-page.traces-embedded-mobile .scenario-step-card__nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.traces-page.traces-embedded-mobile .scenario-step-card__nav-btn:last-child {
    background: linear-gradient(180deg, #c41e2a 0%, #8b1530 100%);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.traces-page.traces-embedded-mobile .scenario-participant-exit-row {
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(244, 242, 251, 0.75);
    background: rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
    .map-marker-root .map-marker-popover,
    #add-trace-btn,
    #add-trace-hitbox {
        transition: none !important;
    }
}
