/* Полётная карта — построчная сетка (1 строка = узел + сегмент + подпись) */

#tab-flight-map {
    --fm-tube-future: #2c2e33;
    --fm-tube-done-top: #25334d;
    --fm-tube-done-bottom: #36528c;
    --fm-node-active: #10b981;
    --fm-head: #34d399;
    --fm-path-capsule: #3d4149;
    --fm-path-active: #1e6b4b;
    --fm-card-bg: #181a1f;
    --fm-card-head: #202329;
}

#tab-flight-map.schedule-data-pane {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-top: 12px;
    padding-bottom: 24px;
    gap: 12px;
}

/* Внешний заголовок — только для a11y (глобального .visually-hidden нет) */
#tab-flight-map .flight-map__section,
#tab-flight-map .flight-map__meta {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.flight-map-pane {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 0 8px 14px;
}

.flight-map__footnote {
    display: none;
}

.flight-map__card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    background: var(--fm-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
}

.fm-card__head {
    background: var(--fm-card-head);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fm-card__body {
    padding: 12px 10px 10px;
}

.fm-card__foot {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.fm-card__source {
    font-size: 11px;
    color: rgba(232, 237, 245, 0.42);
}

.fm-card__title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-right: 4px;
}

.fm-path {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.fm-path__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(240, 244, 248, 0.88);
}

.fm-path__capsule {
    display: flex;
    flex: 1;
    max-width: 280px;
    margin-left: auto;
    padding: 3px;
    border-radius: 10px;
    background: var(--fm-path-capsule);
}

.fm-path__tab {
    flex: 1;
    min-height: 34px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: rgba(232, 237, 245, 0.82);
    background: transparent;
}

#scheduleGlassStack .fm-path__tab.is-active,
#tab-flight-map .fm-path__tab.is-active {
    color: #ecfdf5;
    background: var(--brand-grad, linear-gradient(135deg, #06c785, #024c4e));
    box-shadow:
        0 0 0 1px rgba(6, 199, 133, 0.55),
        0 2px 8px rgba(2, 76, 78, 0.45);
    transform: scale(1.02);
}

.fm-path__active-hint {
    flex-shrink: 0;
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #d1fae5;
    background: rgba(6, 199, 133, 0.18);
    border: 1px solid rgba(6, 199, 133, 0.35);
}

.fm-path__tab:disabled,
.fm-path__tab.is-disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

.fm-path--compact {
    flex-wrap: wrap;
    row-gap: 6px;
}

.fm-path--compact .fm-path__capsule {
    flex: 1 1 200px;
    max-width: none;
    min-width: 0;
    order: 3;
    width: 100%;
}

.fm-path--compact .fm-path__label {
    order: 1;
}

.fm-path--compact .fm-path__active-hint {
    order: 2;
    margin-left: 0;
}

#scheduleGlassStack .fm-path-bar-mount {
    box-sizing: border-box;
    width: 100%;
    padding: 6px 12px 8px 18px;
    background: #121820;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

#scheduleGlassStack .fm-path-bar-mount .fm-path {
    gap: 8px;
    flex-wrap: nowrap;
}

#scheduleGlassStack .fm-path-bar-mount .fm-path__label {
    flex-shrink: 0;
}

#scheduleGlassStack .fm-path-bar-mount:not([hidden]) {
    display: block;
}

#scheduleGlassStack .schedule-glass-body + .fm-path-bar-mount:not([hidden]) {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#scheduleGlassStack.fm-path-bar-mount--changed,
#scheduleGlassStack .fm-path-bar-mount--changed {
    animation: fm-path-bar-pulse 0.42s ease-out;
}

@keyframes fm-path-bar-pulse {
    from {
        box-shadow: inset 0 0 0 1px rgba(6, 199, 133, 0.65);
    }
    to {
        box-shadow: none;
    }
}

/* Вкладка «Полётная»: 2 строки в route-card, без даты и дубля пути */
.schedule-glass-stack--flight-tab #scheduleHeader .schedule-route-card-footer,
.schedule-glass-stack--flight-tab #scheduleHeader .schedule-route-category {
    display: none !important;
}

.schedule-glass-stack--flight-tab #scheduleHeader .route-card-top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.schedule-glass-stack--flight-tab #scheduleHeader .route-card-title {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: 100%;
}

.schedule-glass-stack--flight-tab #scheduleHeader .route-card-subtitle {
    flex: 0 0 auto;
    margin-top: 0;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
}

.schedule-glass-stack--flight-tab #scheduleHeader .schedule-route-card-path-row.fm-path-bar-mount {
    padding: 0 12px 10px 16px;
    margin: 0;
    background: transparent;
    border-top: none;
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path--compact {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 28px;
    row-gap: 0;
    width: 100%;
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path__label {
    flex-shrink: 0;
    order: 0;
    text-transform: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    color: rgba(232, 237, 245, 0.72);
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path__active-hint {
    display: none !important;
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path--compact .fm-path__capsule {
    flex: 0 0 auto;
    display: inline-flex;
    width: auto;
    max-width: none;
    min-width: 0;
    margin-left: auto;
    order: 0;
    padding: 2px;
    border-radius: 8px;
    min-height: 26px;
    background: rgba(255, 255, 255, 0.06);
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path--compact .fm-path__tab {
    flex: 0 0 auto;
    width: 34px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 6px;
}

.schedule-glass-stack--flight-tab #scheduleHeader .fm-path--compact .fm-path__tab.is-active {
    transform: none;
}

#scheduleGlassStack .fm-path__active-hint {
    display: none !important;
}

.flight-map__card[data-active-path] {
    border-top: 2px solid rgba(6, 199, 133, 0.35);
}

.flight-map__card.is-path-1 { --fm-path-accent: #38bdf8; }
.flight-map__card.is-path-2 { --fm-path-accent: #06c785; }
.flight-map__card.is-path-3 { --fm-path-accent: #f59e0b; }
.flight-map__card.is-path-4 { --fm-path-accent: #a78bfa; }
.flight-map__card.is-path-5 { --fm-path-accent: #f472b6; }
.flight-map__card.is-path-6 { --fm-path-accent: #22d3ee; }

.flight-map__card[data-active-path] {
    border-top-color: var(--fm-path-accent, rgba(6, 199, 133, 0.35));
}

/* --- Строки маршрута --- */
.fm-rail-rows {
    position: relative;
}

.fm-rail-rows::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--fm-track-left, 54px);
    width: var(--fm-track-w, 32px);
    background: var(--fm-tube-future);
    border-radius: 16px;
    pointer-events: none;
    z-index: 0;
}

@keyframes fm-track-flow {
    0% {
        transform: translate3d(0, -48px, 0);
        opacity: 0.35;
    }
    8% {
        opacity: 1;
    }
    92% {
        opacity: 1;
    }
    100% {
        transform: translate3d(0, var(--fm-fill-h, 120px), 0);
        opacity: 0.35;
    }
}

@keyframes fm-fill-edge-pulse {
    0%,
    100% {
        opacity: 0.35;
        box-shadow: 0 2px 8px rgba(54, 82, 140, 0.35);
    }
    50% {
        opacity: 1;
        box-shadow: 0 6px 18px rgba(72, 110, 180, 0.75);
    }
}

@keyframes fm-dwell-pulse {
    0% {
        box-shadow:
            0 0 0 1px rgba(14, 165, 233, 0.5),
            0 0 6px rgba(14, 165, 233, 0.75),
            0 0 0 0 rgba(56, 189, 248, 0.65);
    }
    70% {
        box-shadow:
            0 0 0 1px rgba(14, 165, 233, 0.45),
            0 0 8px rgba(14, 165, 233, 0.85),
            0 0 0 10px rgba(56, 189, 248, 0);
    }
    100% {
        box-shadow:
            0 0 0 1px rgba(14, 165, 233, 0.5),
            0 0 6px rgba(14, 165, 233, 0.75),
            0 0 0 0 rgba(56, 189, 248, 0);
    }
}

.fm-rail-rows__fill {
    position: absolute;
    top: 0;
    left: var(--fm-track-left, 54px);
    width: var(--fm-track-w, 32px);
    background: linear-gradient(180deg, var(--fm-tube-done-top) 0%, var(--fm-tube-done-bottom) 100%);
    border-radius: 16px;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    transition: height 0.9s linear;
}

.fm-rail-rows__fill.is-flowing {
    box-shadow: 0 4px 14px rgba(54, 82, 140, 0.5);
}

.fm-rail-rows__fill.is-flowing::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 12px;
    border-radius: 0 0 16px 16px;
    background: linear-gradient(180deg, transparent, rgba(140, 175, 235, 0.28));
    animation: fm-fill-edge-pulse 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

.fm-rail-rows__fill.is-flowing::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 48px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.26) 42%,
        rgba(255, 255, 255, 0.1) 58%,
        rgba(255, 255, 255, 0) 100%
    );
    will-change: transform, opacity;
    animation: fm-track-flow 1.65s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.fm-row {
    display: grid;
    grid-template-columns: 44px 32px minmax(0, 1fr);
    column-gap: 10px;
    align-items: start;
    position: relative;
    z-index: 1;
}

.fm-row__km {
    padding-top: 2px;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(232, 237, 245, 0.42);
    text-align: right;
    line-height: 1;
}

.fm-row--mark .fm-row__km {
    padding-top: 0;
    line-height: 6px;
}

.fm-row--station .fm-row__km {
    padding-top: 6px;
}

.fm-row__track {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    width: var(--fm-track-w, 32px);
    max-width: 100%;
}

.fm-row__bound {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    position: relative;
    z-index: 2;
}

.fm-row__node {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    border-radius: 50%;
    box-sizing: border-box;
}

.fm-row__node--stop {
    width: 26px;
    height: 26px;
    background: #4a4d52;
    border: 2px solid #fff;
}

.fm-row__node--pass,
.fm-row__node--brake {
    width: 14px;
    height: 14px;
    background: #4a4d52;
    border: 1.5px solid #2e6f52;
}

.fm-row__node--stop.is-passed {
    background: #181a1f;
    border-color: #b8d4ff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.fm-row__node--stop.is-upcoming:not(.is-dwelling) {
    background-color: #10b981;
    border-color: #fff;
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.5),
        0 0 6px rgba(16, 185, 129, 0.8),
        0 0 14px rgba(16, 185, 129, 0.35);
}

.fm-row__node--stop.is-dwelling {
    background-color: #0ea5e9;
    border-color: #fff;
    animation: fm-dwell-pulse 1.6s ease-in-out infinite;
}

.fm-row__leg,
.fm-row__seg {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 36px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: transparent;
    border: none;
    border-radius: 0;
}

.fm-row__speed {
    position: relative;
    z-index: 2;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    background: none;
    border: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
    pointer-events: none;
}

.fm-row--pass {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
    margin-bottom: 2px;
}

@keyframes fm-dwell-row-pulse {
    0%,
    100% {
        background: linear-gradient(
            90deg,
            rgba(56, 189, 248, 0.1) 0%,
            rgba(56, 189, 248, 0.02) 100%
        );
    }
    50% {
        background: linear-gradient(
            90deg,
            rgba(56, 189, 248, 0.18) 0%,
            rgba(56, 189, 248, 0.04) 100%
        );
    }
}

.fm-row--station {
    align-items: start;
}

.fm-row--station .fm-station-line {
    box-sizing: border-box;
}

.fm-row__info {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    min-height: 26px;
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
    overflow: hidden;
}

.fm-row--station .fm-row__info {
    align-items: stretch;
    min-height: 44px;
    padding-top: 0;
}

.fm-station-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    box-sizing: border-box;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    border-left: 3px solid transparent;
    background: transparent;
    transition:
        opacity 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease;
}

.fm-station-line__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.fm-station-line__times {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.fm-station-line__arr,
.fm-station-line__dep {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
    white-space: nowrap;
}

.fm-station-line__dwell {
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    background: #1e242b;
    color: rgba(232, 237, 245, 0.88);
    white-space: nowrap;
}

/* Пройденная */
.fm-row--passed {
    opacity: 0.45;
}

.fm-row--passed .fm-station-line {
    background: transparent;
    border-left-color: transparent;
}

/* Следующая остановка (перегон) — как is-next в «Расписании» */
.fm-row--next-stop {
    opacity: 1;
}

.fm-row--next-stop .fm-station-line {
    border-left-color: #10b981;
    background: linear-gradient(
        90deg,
        rgba(16, 185, 129, 0.14) 0%,
        rgba(16, 185, 129, 0.02) 100%
    );
}

.fm-row--next-stop .fm-station-line__arr {
    color: #34d399;
    font-weight: 700;
}

/* Активная стоянка — как is-current в «Расписании» */
.fm-row--dwelling {
    opacity: 1;
}

.fm-row--dwelling .fm-station-line {
    border-left-color: #38bdf8;
    background: linear-gradient(
        90deg,
        rgba(56, 189, 248, 0.14) 0%,
        rgba(56, 189, 248, 0.02) 100%
    );
    animation: fm-dwell-row-pulse 1.6s ease-in-out infinite;
}

.fm-row--dwelling .fm-station-line__dwell {
    background: #0ea5e9;
    color: #09151f;
    font-weight: 700;
}

.fm-row--dwelling .fm-station-line__arr {
    color: #38bdf8;
    font-weight: 700;
}

.fm-row--dwelling .fm-station-line__dep {
    color: #fff;
    font-weight: 700;
}

/* Будущие — без фона, белый текст */
.fm-row--station:not(.fm-row--passed):not(.fm-row--next-stop):not(.fm-row--dwelling) .fm-station-line {
    background: transparent;
    border-left-color: transparent;
}

.fm-row--station:not(.fm-row--passed):not(.fm-row--next-stop):not(.fm-row--dwelling) .fm-station-line__name,
.fm-row--station:not(.fm-row--passed):not(.fm-row--next-stop):not(.fm-row--dwelling) .fm-station-line__arr,
.fm-row--station:not(.fm-row--passed):not(.fm-row--next-stop):not(.fm-row--dwelling) .fm-station-line__dep {
    color: #fff;
}

.fm-pass-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.fm-row__title--pass {
    font-size: 14px;
    font-weight: 500;
    font-style: italic;
    color: rgba(255, 255, 255, 0.5);
}

.fm-row__pass-tag {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.fm-row__title--pt {
    font-weight: 700;
    color: #f59e0b;
    font-size: 14px;
}

.fm-row__title--ept {
    font-weight: 700;
    color: #34d399;
    font-size: 14px;
}

.flight-map__empty,
.flight-map__warn {
    margin: 0 0 10px;
    font-size: 13px;
    color: rgba(232, 237, 245, 0.72);
}

/* Шапка «Полётная»: 2 строки (часы+скорость | событие) */
#globalAppHeader .clock-wrap.is-flight-header {
    padding: 3px 10px !important;
    gap: 2px;
    max-width: min(100%, 13.5rem);
}

#globalAppHeader .clock-wrap__time-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
}

#globalAppHeader .clock-wrap.is-flight-header .clock-wrap__time {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

#globalAppHeader .clock-speed-pill {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

#globalAppHeader .clock-wrap.is-flight-header .clock-wrap__sub#scheduleMotionBadge {
    margin-top: 1px;
    max-width: 100%;
    font-size: 12.5px;
    font-weight: 500;
    color: #c4d0d8;
    -webkit-font-smoothing: antialiased;
    text-shadow: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#globalAppHeader .clock-wrap.is-flight-header .clock-wrap__sub#scheduleMotionBadge.clock-wrap__sub--dwell {
    color: rgba(56, 189, 248, 0.92);
}

#globalAppHeader .clock-wrap.is-flight-header .clock-wrap__sub#scheduleMotionBadge.clock-wrap__sub--danger {
    color: #f87171;
}

.da-pt-badge--fm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 5px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.04em;
    vertical-align: middle;
    flex-shrink: 0;
}

.fm-row--passed .da-pt-badge--fm {
    opacity: 0.42;
}