/* ============================================================
   Mobilité Stéphanoise — Carte
   Desktop : sidebar latérale  ·  Mobile : feuille en bas
   Palette : carbone + codes officiels STAS (rouge tram / jaune bus / lime vélivert)
   ============================================================ */

:root {
    /* surfaces */
    --bg:           #08090b;
    --bg-elev:      #11131a;
    --bg-elev-2:    #181b22;
    --bg-elev-3:    #20242c;
    --bg-card-hi:   #1c2027;
    --rule:         #262b34;
    --rule-soft:    #1c2028;

    /* ink — paper white chaud */
    --ink:          #f2efe8;
    --ink-bright:   #ffffff;
    --ink-dim:      #93897c;
    --ink-faint:    #8b8275;   /* AA ≥4.5:1 sur bg/elev/elev-2 (ex-#5e574e ~2.6:1) */

    /* identité Saint-Étienne — accent / sélection uniquement */
    --asse:         #00733f;
    --asse-bright:  #14a05e;
    --asse-glow:    rgba(20, 160, 94, .16);
    --copper:       #c98a3e;
    --copper-dim:   #7a5424;

    /* codes officiels STAS — modes */
    --tram:         #e0221b;
    --tram-ink:     #ffffff;
    --tram-glow:    rgba(224, 34, 27, .35);
    --bus:          #f5b400;
    --bus-ink:      #1a1408;
    --bus-glow:     rgba(245, 180, 0, .35);
    --trolley:      #e08a00;          /* bus jaune teinté ambre */
    --trolley-ink:  #1a1408;
    --velivert:     #b8d840;
    --velivert-ink: #1a1f08;
    --velivert-glow: rgba(184, 216, 64, .35);

    /* signal */
    --danger:       #ff4a3d;
    --warn:         #f5b400;

    /* typo */
    --display:      'Fraunces', 'Iowan Old Style', Georgia, serif;
    --sans:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:         'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* motion */
    --ease-out:     cubic-bezier(.16, 1, .3, 1);
    --ease-in-out:  cubic-bezier(.65, 0, .35, 1);
    --ease-spring:  cubic-bezier(.2, .9, .25, 1.2);

    --shadow-deep:    0 24px 60px -28px rgba(0,0,0,.7);
    --shadow-overlay: 0 18px 38px -22px rgba(0,0,0,.9);
    --shadow-sheet:   0 -14px 50px -20px rgba(0,0,0,.8);

    /* bottom-sheet snap (mobile) */
    --sheet-peek:    160px;
    --sheet-half:    62vh;
    --sheet-full:    92vh;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
}

/* ============================================================
   Layout — sidebar / carte
   ============================================================ */
.mp {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100vh;
    height: 100dvh;
    background:
        radial-gradient(circle at 90% -10%, var(--asse-glow), transparent 45%),
        radial-gradient(circle at -10% 60%, rgba(201, 138, 62, .04), transparent 50%),
        var(--bg);
}

/* ============================================================
   Sidebar (desktop)
   ============================================================ */
.mp-aside {
    background: var(--bg-elev);
    border-right: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 5;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elev-3) transparent;
}

.mp-aside::-webkit-scrollbar { width: 6px; }
.mp-aside::-webkit-scrollbar-track { background: transparent; }
.mp-aside::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: 100px; }

/* Drag handle (mobile only) */
.mp-sheet-handle { display: none; }

/* ============================================================
   Header — back-link + identité
   ============================================================ */
.mp-head {
    padding: 24px 28px 22px;
    border-bottom: 1px solid var(--rule);
    background: linear-gradient(180deg, rgba(20, 160, 94, .03) 0%, transparent 100%);
    position: relative;
}

.mp-head::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--rule) 20%, var(--rule) 80%, transparent);
}

.mp-head__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mp-head__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-dim);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 500;
    padding: 6px 10px;
    border: 1px solid var(--rule);
    border-radius: 100px;
    background: var(--bg-elev-2);
    transition: color .15s var(--ease-out), border-color .15s var(--ease-out), background .15s var(--ease-out), transform .15s var(--ease-out);
}

.mp-head__back:hover {
    color: var(--ink);
    border-color: var(--asse);
    background: var(--bg-elev-3);
}

.mp-head__back:active { transform: scale(.97); }

.mp-head__mark {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.22em;
    color: var(--ink-dim);
    text-transform: uppercase;
    font-weight: 500;
    white-space: nowrap;
}

.mp-head__mark strong {
    color: var(--asse-bright);
    font-weight: 600;
}

.mp-head__pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--asse-bright);
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: 1px;
    animation: mp-pulse 2s var(--ease-in-out) infinite;
}

@keyframes mp-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--asse-glow); }
    50%      { opacity: .55; box-shadow: 0 0 0 4px transparent; }
}

/* ============================================================
   Sections — titre commun
   ============================================================ */
.mp-section__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 14px;
}

.mp-section__bar {
    width: 14px;
    height: 1px;
    background: var(--asse-bright);
    flex-shrink: 0;
    align-self: center;
}

.mp-section__title {
    margin: 0;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: var(--ink);
    text-transform: uppercase;
}

.mp-section__meta {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--ink-dim);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* ============================================================
   Hero — arrêt sélectionné
   ============================================================ */
.mp-hero {
    margin: 18px 22px 0;
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, rgba(20, 160, 94, .08) 0%, var(--bg-elev-2) 60%);
    border: 1px solid var(--rule);
    border-left: 2px solid var(--asse-bright);
    border-radius: 14px;
    box-shadow: var(--shadow-overlay);
    animation: mp-hero-in .35s var(--ease-spring);
}

.mp-hero[hidden] { display: none; }

@keyframes mp-hero-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mp-hero__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.mp-hero__name {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.1;
    color: var(--ink-bright);
    letter-spacing: -0.015em;
    font-variation-settings: "opsz" 120, "SOFT" 50;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.mp-hero__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elev);
    border: 1px solid var(--rule);
    color: var(--ink-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .15s var(--ease-out), border-color .15s var(--ease-out), background .15s var(--ease-out), transform .15s var(--ease-out);
}

.mp-hero__close:hover {
    color: var(--ink);
    border-color: var(--danger);
    background: rgba(255, 74, 61, .08);
}

.mp-hero__close:active { transform: scale(.92); }

.mp-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ============================================================
   Search
   ============================================================ */
.mp-search {
    padding: 18px 28px 6px;
    position: relative;
}

.mp-search__wrap {
    position: relative;
    background: var(--bg-elev-2);
    border: 1px solid var(--rule);
    border-radius: 14px;
    transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}

.mp-search__wrap:focus-within {
    border-color: var(--asse);
    background: var(--bg-elev-3);
}

.mp-search__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ink-dim);
    pointer-events: none;
    transition: color .2s var(--ease-out);
}

.mp-search__wrap:focus-within .mp-search__icon { color: var(--asse-bright); }

.mp-search__input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    padding: 14px 16px 14px 40px;
    outline: none;
    min-height: 48px;
}

.mp-search__input::placeholder { color: var(--ink-faint); }

.mp-search__results {
    position: absolute;
    top: 100%;
    left: 28px;
    right: 28px;
    z-index: 25;
    margin: 6px 0 0;
    padding: 6px;
    list-style: none;
    background: var(--bg-elev-2);
    border: 1px solid var(--rule);
    border-radius: 12px;
    box-shadow: var(--shadow-deep);
    max-height: 320px;
    overflow-y: auto;
}

.mp-search__results[hidden] { display: none; }

.mp-search__results li {
    padding: 12px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    transition: background .12s var(--ease-out), color .12s var(--ease-out);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.mp-search__results li:hover,
.mp-search__results li[data-active="true"] {
    background: var(--bg-elev-3);
    color: var(--asse-bright);
}

/* ============================================================
   Couches — pills (Tram · Bus · Vélivert)
   ============================================================ */
.mp-layers {
    padding: 18px 28px 6px;
}

.mp-layers__pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mp-pill {
    flex: 1;
    background: var(--bg-elev-2);
    border: 1px solid var(--rule);
    color: var(--ink-dim);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    padding: 10px 10px;
    border-radius: 100px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all .15s var(--ease-out);
    min-height: 40px;
    text-transform: uppercase;
    font-weight: 600;
}

.mp-pill:hover {
    border-color: var(--ink-dim);
    color: var(--ink);
}

.mp-pill.is-on { color: var(--ink); background: var(--bg-elev-3); }

.mp-pill--tram.is-on     { border-color: var(--tram);     box-shadow: inset 0 0 0 1px var(--tram-glow); }
.mp-pill--bus.is-on      { border-color: var(--bus);      box-shadow: inset 0 0 0 1px var(--bus-glow); }
.mp-pill--velivert.is-on { border-color: var(--velivert); box-shadow: inset 0 0 0 1px var(--velivert-glow); }

.mp-pill:not(.is-on) { opacity: 0.5; }
.mp-pill:not(.is-on) .mp-pill__dot { opacity: 0.4; }

.mp-pill__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mp-pill__dot--tram     { background: var(--tram); }
.mp-pill__dot--bus      { background: var(--bus);  border-radius: 2px; }
.mp-pill__dot--velivert { background: var(--velivert); }

/* ============================================================
   Board — prochains passages
   ============================================================ */
.mp-board {
    padding: 22px 28px 12px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.mp-board__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elev-3) transparent;
}

.mp-board__list::-webkit-scrollbar { width: 4px; }
.mp-board__list::-webkit-scrollbar-track { background: transparent; }
.mp-board__list::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: 100px; }

.mp-board__empty {
    background: var(--bg-elev-2);
    border: 1px dashed var(--rule);
    border-radius: 14px;
    padding: 24px 22px;
    text-align: center;
}

.mp-board__empty-title {
    font-family: var(--display);
    font-size: 17px;
    font-style: italic;
    font-weight: 400;
    color: var(--ink-dim);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.mp-board__empty-sub {
    font-family: var(--sans);
    font-size: 12.5px;
    color: var(--ink-faint);
    line-height: 1.5;
    margin: 0;
}

/* Lignes de départ */
.mp-dep {
    border-top: 1px dashed var(--rule-soft);
    animation: mp-blip .3s var(--ease-out);
}

.mp-dep:first-child { border-top: none; }

.mp-dep__row {
    display: grid;
    grid-template-columns: 44px 1fr auto 14px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 0;
    background: transparent;
    border: 0;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: opacity .15s var(--ease-out);
}

.mp-dep__row:hover { opacity: 0.85; }
.mp-dep__row:focus-visible { outline: 2px solid var(--asse-bright); outline-offset: 2px; border-radius: 4px; }

.mp-dep__caret {
    color: var(--ink-faint);
    transition: transform .2s var(--ease-out);
}

.mp-dep.is-open .mp-dep__caret { transform: rotate(180deg); color: var(--asse-bright); }
.mp-dep.is-open .mp-dep__row   { opacity: 1; }

@keyframes mp-blip {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mp-dep__route {
    height: 30px;
    min-width: 44px;
    padding: 0 8px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
    background: var(--bus);
    color: var(--bus-ink);
}

.mp-dep__route[data-type="tram"]    { background: var(--tram);    color: var(--tram-ink); border-radius: 100px; }
.mp-dep__route[data-type="bus"]     { background: var(--bus);     color: var(--bus-ink); }
.mp-dep__route[data-type="trolley"] { background: var(--trolley); color: var(--trolley-ink); }

.mp-dep__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mp-dep__sign {
    font-family: var(--sans);
    font-size: 13.5px;
    color: var(--ink);
    font-weight: 500;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-dep__time {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--ink-faint);
    letter-spacing: 0.04em;
}

.mp-dep__eta {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 500;
    color: var(--ink);
    text-align: right;
    line-height: 1;
    font-feature-settings: 'tnum' 1;
    letter-spacing: -0.01em;
}

.mp-dep__eta[data-soon="true"] {
    color: var(--asse-bright);
    animation: mp-blink-soft 1.6s var(--ease-in-out) infinite;
}

/* GTFS-RT confirmed — pulsing green dot to the left of the ETA. */
.mp-dep__eta[data-rt="true"] {
    position: relative;
    padding-left: 14px;
}
.mp-dep__eta[data-rt="true"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3.5px;
    border-radius: 50%;
    background: var(--asse-bright);
    box-shadow: 0 0 0 0 var(--asse-glow);
    animation: mp-rt-pulse 1.8s var(--ease-in-out) infinite;
}

@keyframes mp-rt-pulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 0 0 var(--asse-glow); }
    50%      { opacity: .55; box-shadow: 0 0 0 6px transparent; }
}

@keyframes mp-blink-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}

/* États dans la liste */
.mp-board__list .mp-dep--loading,
.mp-board__list .mp-dep--error,
.mp-board__list .mp-dep--empty {
    display: block;
    padding: 16px 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-faint);
    border-top: 1px dashed var(--rule-soft);
}

/* ============================================================
   Trip timeline — suite du trajet dépliée sous un départ
   ============================================================ */
.mp-dep__timeline {
    padding: 4px 0 14px 0;
    animation: mp-blip .25s var(--ease-out);
}

.mp-tl {
    --mp-tl-color: var(--ink-faint);
    border-left: 0;
    padding-left: 0;
}

.mp-tl__head {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--ink-dim);
    padding: 0 0 8px 28px;
    text-transform: uppercase;
}

.mp-tl__list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Trait vertical qui relie tous les nœuds, couleur officielle de la ligne */
.mp-tl__list::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--mp-tl-color);
    opacity: 0.55;
    border-radius: 1px;
}

.mp-tl__stop {
    display: grid;
    grid-template-columns: 24px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-radius: 6px;
    transition: background .15s var(--ease-out);
}

.mp-tl__stop[role="button"] { cursor: pointer; }
.mp-tl__stop[role="button"]:hover { background: var(--bg-elev-2); }

.mp-tl__node {
    width: 10px;
    height: 10px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--mp-tl-color);
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.mp-tl__stop--current .mp-tl__node {
    width: 14px;
    height: 14px;
    margin-left: 5px;
    background: var(--mp-tl-color);
    box-shadow: 0 0 0 3px rgba(20, 160, 94, .18);
}

.mp-tl__name {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-tl__stop--current .mp-tl__name {
    font-weight: 600;
    color: var(--ink-bright);
}

.mp-tl__time {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-dim);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.mp-tl__time strong { color: var(--ink); font-weight: 600; }
.mp-tl__time-strike { color: var(--ink-faint); text-decoration: line-through; margin-right: 3px; }
.mp-tl__delay { color: var(--warn); font-weight: 600; margin-left: 2px; }

.mp-tl__eta {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-dim);
    text-align: right;
    min-width: 38px;
    font-feature-settings: 'tnum' 1;
}

.mp-tl__stop--current .mp-tl__eta {
    color: var(--asse-bright);
    font-weight: 600;
}

.mp-tl__loading, .mp-tl__error, .mp-tl__empty {
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    text-align: center;
}

.mp-tl__error { color: var(--danger); }

.mp-board__list .mp-dep--loading { color: var(--asse-bright); }
.mp-board__list .mp-dep--error   { color: var(--danger); }

/* ============================================================
   Footer
   ============================================================ */
.mp-foot {
    padding: 16px 28px 22px;
    border-top: 1px solid var(--rule);
    background: var(--bg);
}

.mp-foot__creds {
    display: block;
    text-align: center;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    color: var(--ink-faint);
    text-transform: uppercase;
    line-height: 1.6;
}

.mp-foot__sep {
    color: var(--ink-faint);
    margin: 0 4px;
    opacity: 0.6;
}

.mp-foot__legal {
    color: var(--ink-dim);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.mp-foot__legal:hover,
.mp-foot__legal:focus-visible {
    color: var(--ink);
    border-color: var(--ink-dim);
}

/* ============================================================
   Carte
   ============================================================ */
.mp-map-wrap {
    position: relative;
    overflow: hidden;
    background: #0a0c0f;
}

.mp-map {
    width: 100%;
    height: 100%;
}

.leaflet-container { background: #0a0c0f; font-family: var(--sans); }

/* Tile attribution discrete */
.leaflet-control-attribution {
    background: rgba(8, 9, 11, .75) !important;
    color: var(--ink-faint) !important;
    font-family: var(--mono) !important;
    font-size: 9px !important;
    letter-spacing: 0.04em;
    padding: 3px 8px !important;
    border-radius: 6px 0 0 0 !important;
    backdrop-filter: blur(6px);
    border: 1px solid var(--rule);
    border-right: none;
    border-bottom: none;
}

.leaflet-control-attribution a { color: var(--ink-dim) !important; text-decoration: none !important; }
.leaflet-control-attribution a:hover { color: var(--asse-bright) !important; }

/* Zoom control */
.leaflet-bar {
    background: var(--bg-elev) !important;
    border: 1px solid var(--rule) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-overlay) !important;
    overflow: hidden;
}

.leaflet-bar a {
    background: var(--bg-elev) !important;
    color: var(--ink) !important;
    border: none !important;
    border-bottom: 1px solid var(--rule) !important;
    font-family: var(--mono) !important;
    font-weight: 400 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    transition: background .15s var(--ease-out), color .15s var(--ease-out);
}

.leaflet-bar a:last-child { border-bottom: none !important; }

.leaflet-bar a:hover {
    background: var(--bg-elev-2) !important;
    color: var(--asse-bright) !important;
}

.leaflet-touch .leaflet-control-zoom {
    margin-bottom: 18px !important;
    margin-right: 18px !important;
}

/* Tooltip Leaflet */
.leaflet-tooltip {
    background: var(--bg-elev-2) !important;
    color: var(--ink) !important;
    border: 1px solid var(--rule) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-overlay) !important;
    padding: 6px 10px !important;
    font-family: var(--mono) !important;
    font-size: 11px !important;
    letter-spacing: 0.04em !important;
    font-weight: 500;
}

.leaflet-tooltip::before { display: none; }

/* Tooltip riche pour les arrêts (nom + chips de lignes) */
.leaflet-tooltip.mp-tt {
    padding: 9px 11px !important;
    font-family: var(--sans) !important;
    font-size: 12px !important;
    letter-spacing: 0 !important;
    white-space: normal !important;
    max-width: 240px;
    text-align: left;
}

.mp-tt__name {
    display: block;
    font-family: var(--display);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink-bright);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
    line-height: 1.15;
    font-variation-settings: "opsz" 120, "SOFT" 40;
}

.mp-tt__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mp-tt__chips .mp-marker__chip {
    min-width: 20px;
    height: 20px;
    font-size: 10.5px;
    border-width: 1.5px;
    box-shadow: none;
}

.mp-tt__chips .mp-marker__chip--tram { width: 20px; }
.mp-tt__chips .mp-marker__chip--velivert { min-width: 22px; width: 22px; height: 22px; }

/* Popup */
.leaflet-popup-content-wrapper {
    background: var(--bg-elev-2);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 12px;
    box-shadow: var(--shadow-overlay);
    padding: 4px;
}

.leaflet-popup-tip { background: var(--bg-elev-2); border: 1px solid var(--rule); }

.leaflet-popup-content {
    font-family: var(--sans);
    font-size: 12.5px;
    margin: 12px 14px;
    line-height: 1.5;
    color: var(--ink);
}

.leaflet-popup-close-button {
    color: var(--ink-dim) !important;
    font-size: 18px !important;
    padding: 6px 8px !important;
}

.leaflet-popup-close-button:hover { color: var(--asse-bright) !important; }

.popup-title {
    display: block;
    font-family: var(--display);
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    font-variation-settings: "opsz" 120, "SOFT" 30;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-dim);
    letter-spacing: 0.04em;
}

.popup-row strong { color: var(--ink); font-weight: 500; }

.popup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 4px;
}

/* ============================================================
   Marqueurs
   - z14-15  : petit dot mode-coloré
   - z16+    : badge unique avec compteur de lignes (ou paire pour multi-mode)
   ============================================================ */
.mp-marker {
    background: transparent !important;
    border: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
    pointer-events: auto;
}

.mp-marker--dot {
    width: auto !important;
    height: auto !important;
}

/* Chip — utilisé hors marqueurs (hero card, tooltip, légende). */
.mp-marker__chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.01em;
    border: 2px solid #08090b;
    box-shadow: 0 2px 6px -1px rgba(0,0,0,.45);
    font-feature-settings: 'tnum' 1;
}

.mp-marker__chip--tram {
    background: var(--tram);
    color: var(--tram-ink);
    border-radius: 50%;
    min-width: 22px;
    width: 22px;
    padding: 0;
}

.mp-marker__chip--bus {
    background: var(--bus);
    color: var(--bus-ink);
    border-radius: 6px;
}

.mp-marker__chip--trolley {
    background: var(--trolley);
    color: var(--trolley-ink);
    border-radius: 6px;
    border-color: var(--bus);
}

.mp-marker__chip--velivert {
    background: var(--velivert);
    color: var(--velivert-ink);
    border-radius: 50%;
    min-width: 26px;
    width: 26px;
    height: 26px;
    font-size: 11.5px;
}

/* ============================================================
   Hub — pill compacte pour les arrêts à 4+ lignes
   - Multi-mode (tram + bus) : chips trams + compteur "+N" bus
   - Bus-only : nom abrégé + compteur
   ============================================================ */
.mp-marker--hub {
    background: rgba(8, 9, 11, .92) !important;
    border: 1px solid var(--rule) !important;
    border-radius: 8px !important;
    padding: 2px 5px !important;
    gap: 4px !important;
    box-shadow: 0 4px 12px -3px rgba(0,0,0,.7);
    backdrop-filter: blur(4px);
    transition: transform .2s var(--ease-spring), box-shadow .2s var(--ease-out);
}

.mp-marker--hub:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px -3px rgba(0,0,0,.85);
    border-color: var(--ink-faint);
}

.mp-marker__hub-name {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 9.5px;
    letter-spacing: 0.06em;
    color: var(--ink);
    padding: 0 2px;
    white-space: nowrap;
}

.mp-marker__hub-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 10.5px;
    line-height: 1;
    border-radius: 5px;
    font-feature-settings: 'tnum' 1;
}

.mp-marker__hub-count--bus {
    background: var(--bus);
    color: var(--bus-ink);
}

.mp-marker__hub-count--trolley {
    background: var(--trolley);
    color: var(--trolley-ink);
}

/* Chips dans une hub pill : un peu plus compacts pour tenir côte-à-côte */
.mp-marker--hub .mp-marker__chip {
    height: 18px;
    min-width: 18px;
    font-size: 10px;
    border-width: 1.5px;
}

.mp-marker--hub .mp-marker__chip--tram {
    width: 18px;
    min-width: 18px;
}

/* Variante dot — z14-15 */
.mp-marker__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #08090b;
    box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 2px 6px -2px rgba(0,0,0,.7);
}

.mp-marker__dot--tram     { background: var(--tram); }
.mp-marker__dot--bus      { background: var(--bus); border-radius: 3px; }
.mp-marker__dot--trolley  { background: var(--trolley); border-radius: 3px; }
.mp-marker__dot--multi    {
    background: linear-gradient(135deg, var(--tram) 0 50%, var(--bus) 50% 100%);
    border-radius: 3px;
}

/* État vélivert dégradé */
.mp-marker__chip--velivert.is-empty {
    background: var(--bg-elev-2);
    color: var(--ink-dim);
    border-color: var(--danger);
}

.mp-marker__chip--velivert.is-full {
    background: var(--copper);
    color: #1a1408;
    border-color: var(--copper-dim);
}

.mp-marker__chip--velivert.is-offline {
    background: var(--bg);
    color: var(--ink-faint);
    border-color: var(--danger);
    opacity: 0.8;
}

/* ============================================================
   Position utilisateur — point bleu façon Google Maps
   ============================================================ */
.mp-user-dot {
    background: transparent !important;
    border: 0 !important;
    pointer-events: none;
}

.mp-user-dot__core {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1a8cff;
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(26, 140, 255, .35);
}

.mp-user-dot__core::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    background: rgba(26, 140, 255, .4);
    animation: mp-user-pulse 2.2s var(--ease-out) infinite;
    z-index: -1;
}

@keyframes mp-user-pulse {
    0%   { transform: scale(.6); opacity: .85; }
    100% { transform: scale(3);  opacity: 0; }
}

/* Toast — message éphémère (géoloc) centré en haut de la carte */
.mp-toast {
    position: absolute;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 650;
    max-width: min(420px, calc(100% - 32px));
    background: rgba(11, 14, 18, .92);
    border: 1px solid var(--rule);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 12.5px;
    line-height: 1.45;
    padding: 11px 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-overlay);
    backdrop-filter: blur(10px);
    text-align: center;
    pointer-events: none;       /* informatif : ne bloque jamais la carte */
    animation: mp-hero-in .3s var(--ease-spring);
}

.mp-toast[hidden] { display: none; }

/* Bouton « me localiser » — haut-droit de la carte */
.mp-locate-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 600;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(11, 14, 18, .85);
    border: 1px solid var(--rule);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-overlay);
    backdrop-filter: blur(10px);
    transition: border-color .15s var(--ease-out), color .15s var(--ease-out), transform .15s var(--ease-out);
}

.mp-locate-btn:hover {
    border-color: var(--asse);
    color: var(--asse-bright);
}

.mp-locate-btn:active { transform: scale(.95); }

.mp-locate-btn[data-state="seeking"] {
    color: var(--asse-bright);
    border-color: var(--asse);
    animation: mp-locate-spin 1.4s linear infinite;
}

.mp-locate-btn[data-state="active"] {
    color: #1a8cff;
    border-color: rgba(26, 140, 255, .6);
    background: rgba(26, 140, 255, .12);
}

.mp-locate-btn[data-state="error"] {
    color: var(--danger);
    border-color: var(--danger);
}

@keyframes mp-locate-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Pinpoint pour l'arrêt sélectionné — vert ASSE (ne conflicte plus avec le rouge tram) */
.mp-selection-pin {
    background: transparent !important;
    border: 0 !important;
    pointer-events: none;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .45));
    transform-origin: 50% 100%;
    animation: mp-pin-drop .35s var(--ease-spring);
}

.mp-selection-pin svg {
    width: 34px;
    height: 50px;
    display: block;
}

@keyframes mp-pin-drop {
    0%   { transform: translateY(-22px) scale(.6); opacity: 0; }
    60%  { transform: translateY(2px)   scale(1.05); opacity: 1; }
    100% { transform: translateY(0)     scale(1); opacity: 1; }
}

/* ============================================================
   Toolbar (haut-gauche carte) — Accueil + légende
   ============================================================ */
.mp-toolbar {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: calc(100% - 36px);
}

.mp-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(11, 14, 18, .85);
    border: 1px solid var(--rule);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 100px;
    text-decoration: none;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-overlay);
    transition: border-color .15s var(--ease-out), background .15s var(--ease-out), transform .15s var(--ease-out);
    min-height: 36px;
    line-height: 1;
}

.mp-chip:hover {
    border-color: var(--asse);
    background: rgba(20, 160, 94, .12);
}

.mp-chip:active { transform: scale(.97); }

.mp-chip--home svg { color: var(--asse-bright); }

.mp-legend {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(11, 14, 18, .85);
    border: 1px solid var(--rule);
    padding: 7px 14px;
    border-radius: 100px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-overlay);
    min-height: 36px;
}

.mp-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ink-dim);
}

.mp-marker__chip--legend {
    min-width: 18px;
    width: 18px;
    height: 18px;
    font-size: 9px;
    border-width: 1.5px;
}

/* ============================================================
   Overlays
   ============================================================ */
.mp-overlay {
    position: absolute;
    z-index: 600;
}

/* Ticker — bas-centre */
.mp-overlay--ticker {
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(11, 14, 18, .88);
    border: 1px solid var(--rule);
    padding: 10px 18px;
    border-radius: 100px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-overlay);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100% - 36px);
}

.mp-ticker__live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--asse-bright);
    text-transform: uppercase;
    font-weight: 600;
}

.mp-ticker__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--asse-bright);
    animation: mp-pulse 2s var(--ease-in-out) infinite;
}

.mp-ticker__sep {
    width: 1px;
    height: 12px;
    background: var(--rule);
}

.mp-ticker__info {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink);
    letter-spacing: 0.04em;
    font-feature-settings: 'tnum' 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* FAB — caché en desktop */
.mp-fab { display: none; }

/* Scrim — caché en desktop */
.mp-scrim { display: none; }

/* ============================================================
   Mobile — feuille en bas (bottom sheet) avec snap points
   ============================================================ */
@media (max-width: 900px) {

    .mp {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* La feuille remplace la sidebar */
    .mp-aside {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: var(--sheet-full);
        max-height: var(--sheet-full);
        width: 100%;
        max-width: 640px;
        margin: 0 auto;
        border-right: none;
        border-top: 1px solid var(--rule);
        border-radius: 22px 22px 0 0;
        background: var(--bg-elev);
        box-shadow: var(--shadow-sheet);
        transform: translateY(calc(var(--sheet-full) - var(--sheet-peek)));
        transition: transform .42s var(--ease-spring);
        z-index: 800;
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    .mp[data-sheet-state="peek"] .mp-aside { transform: translateY(calc(var(--sheet-full) - var(--sheet-peek))); }
    .mp[data-sheet-state="half"] .mp-aside { transform: translateY(calc(var(--sheet-full) - var(--sheet-half))); }
    .mp[data-sheet-state="full"] .mp-aside { transform: translateY(0); }

    .mp[data-dragging="true"] .mp-aside { transition: none; }

    /* Drag handle visible + interactif */
    .mp-sheet-handle {
        display: block;
        position: sticky;
        top: 0;
        z-index: 5;
        background: var(--bg-elev);
        padding: 10px 0 6px;
        cursor: grab;
        touch-action: none;
        user-select: none;
        border-radius: 22px 22px 0 0;
    }

    .mp-sheet-handle:active { cursor: grabbing; }

    .mp-sheet-handle__grip {
        display: block;
        width: 42px;
        height: 4px;
        border-radius: 100px;
        background: var(--rule);
        margin: 0 auto;
        transition: background .15s var(--ease-out), width .15s var(--ease-out);
    }

    .mp-sheet-handle:hover .mp-sheet-handle__grip,
    .mp[data-dragging="true"] .mp-sheet-handle__grip {
        background: var(--ink-dim);
        width: 56px;
    }

    /* Header plus compact */
    .mp-head { padding: 8px 22px 14px; }
    .mp-head__top { margin-bottom: 0; }

    /* Search prend toute la largeur disponible */
    .mp-search { padding: 16px 22px 6px; }

    .mp-layers { padding: 12px 22px 6px; }

    .mp-board { padding: 18px 22px 18px; }

    .mp-foot { padding: 14px 22px 22px; }

    /* La toolbar passe sous le drag handle pour rester accessible */
    .mp-toolbar {
        top: 14px;
        left: 14px;
        right: 68px;          /* place pour le bouton « me localiser » */
        max-width: none;
        gap: 6px;
    }

    .mp-locate-btn {
        top: 14px;
        right: 14px;
        width: 42px;
        height: 42px;
    }

    .mp-chip { font-size: 10px; padding: 8px 12px; min-height: 34px; }

    /* Légende plus compacte en mobile */
    .mp-legend { gap: 9px; padding: 6px 12px; min-height: 34px; }
    .mp-legend__item { font-size: 9px; gap: 5px; }

    /* Ticker disparaît derrière la feuille en mobile */
    .mp-overlay--ticker {
        bottom: calc(var(--sheet-peek) + 14px);
        font-size: 10px;
        padding: 8px 14px;
        max-width: calc(100% - 24px);
    }

    .mp[data-sheet-state="half"] .mp-overlay--ticker,
    .mp[data-sheet-state="full"] .mp-overlay--ticker {
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s var(--ease-out);
    }

    /* FAB en bas à droite — ouvre la feuille à mi-hauteur */
    .mp-fab {
        display: inline-flex;
        position: absolute;
        right: 16px;
        bottom: calc(var(--sheet-peek) + 16px);
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: var(--bg-elev);
        border: 1px solid var(--rule);
        color: var(--asse-bright);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 700;
        box-shadow: var(--shadow-overlay);
        transition: transform .2s var(--ease-spring), background .15s var(--ease-out);
    }

    .mp-fab:active { transform: scale(.93); }

    .mp[data-sheet-state="half"] .mp-fab,
    .mp[data-sheet-state="full"] .mp-fab {
        opacity: 0;
        pointer-events: none;
        transform: scale(.6);
        transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
    }

    /* Scrim — assombrit la carte quand la feuille est ouverte au-delà du peek */
    .mp-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .35s var(--ease-out);
        z-index: 700;
    }

    .mp[data-sheet-state="half"] .mp-scrim { opacity: .35; pointer-events: auto; }
    .mp[data-sheet-state="full"] .mp-scrim { opacity: .65; pointer-events: auto; }

    /* Marqueurs un poil plus gros au touch */
    .mp-marker__chip {
        min-width: 24px;
        height: 24px;
        font-size: 11.5px;
    }
    .mp-marker__chip--tram { width: 24px; }
    .mp-marker__chip--velivert { min-width: 30px; width: 30px; height: 30px; }
    .mp-marker--hub .mp-marker__chip {
        height: 20px;
        min-width: 20px;
        font-size: 10.5px;
    }
    .mp-marker--hub .mp-marker__chip--tram { width: 20px; min-width: 20px; }
    .mp-marker__hub-name { font-size: 10.5px; }
    .mp-marker__hub-count { min-width: 22px; height: 20px; font-size: 11px; }

    /* Hero plus compact en mobile */
    .mp-hero { margin: 14px 22px 0; padding: 14px 16px 12px; }
    .mp-hero__name { font-size: 22px; }
}

/* Très petits écrans : on rapproche les overlays */
@media (max-width: 420px) {
    .mp-toolbar { gap: 5px; }
    .mp-chip { padding: 7px 10px; font-size: 9.5px; letter-spacing: 0.1em; }
    .mp-legend__item:nth-child(3) { display: none; } /* on garde tram + bus, vélivert visible via les pills */
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}
