* {
    box-sizing: border-box;
}

:root {
    --bg: #111;
    --panel: #1b1b1b;
    --panel-2: #242424;
    --text: #fff;
    --muted: #aaa;
    --accent: #f58220;
    --accent-dark: #c65c08;
    --border: rgba(255, 255, 255, .08);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --transition-page: 220ms;
    --ease-page: cubic-bezier(.4, 0, .2, 1);
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    width: min(760px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: calc(18px + var(--safe-top)) 16px calc(40px + var(--safe-bottom));
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 30px;
}

h2 {
    margin-bottom: 8px;
}

.round-btn,
.back-btn,
.close-btn {
    display: grid;
    place-items: center;
    border: 0;
    color: #fff;
    background: var(--panel-2);
    cursor: pointer;
}

.round-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 28px;
}

.round-btn--small {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    font-size: 22px;
}

.hero-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(245, 130, 32, .18), transparent 55%),
        var(--panel);
    box-shadow: 0 18px 38px rgba(0, 0, 0, .22);
}

.hero-card p:not(.eyebrow) {
    margin-bottom: 20px;
    color: var(--muted);
    line-height: 1.5;
}

.primary-btn {
    min-height: 52px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 15px;
    color: #111;
    background: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

.primary-btn:disabled {
    opacity: .55;
    cursor: default;
}

.primary-btn--full {
    width: 100%;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin: 30px 2px 14px;
}

.section-head h2 {
    margin-bottom: 0;
}

.section-head > span {
    display: grid;
    min-width: 36px;
    height: 30px;
    padding: 0 9px;
    place-items: center;
    border-radius: 999px;
    color: var(--muted);
    background: var(--panel-2);
    font-weight: 700;
}

.route-list {
    display: grid;
    gap: 11px;
}

.route-card {
    min-height: 104px;
    padding: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
}

.route-card__main {
    min-width: 0;
}

.route-card h3 {
    margin: 5px 0 11px;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.author {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
}

.route-meta span:not(:last-child)::after {
    content: "•";
    margin-left: 7px;
}

.route-arrow {
    color: var(--accent);
    font-size: 34px;
}

.empty-card {
    padding: 24px;
    border: 1px dashed rgba(255, 255, 255, .16);
    border-radius: 20px;
    color: var(--muted);
    text-align: center;
}

.empty-card h3 {
    color: var(--text);
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    z-index: 3000;
    inset: 0;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(4px);
}

.modal__panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-bottom));
    max-height: calc(100dvh - 20px - var(--safe-top));
    padding: 22px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: var(--panel);
}

.modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.close-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 28px;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 15px;
}

.field > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    color: var(--text);
    background: var(--panel-2);
}

.field input {
    min-height: 50px;
    padding: 0 14px;
}

.field textarea {
    padding: 13px 14px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--accent);
}

.file-picker {
    min-height: 58px;
    margin-bottom: 15px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border: 1px dashed rgba(245, 130, 32, .55);
    border-radius: 15px;
    color: var(--accent);
    background: rgba(245, 130, 32, .07);
    font-weight: 800;
    cursor: pointer;
}

.file-picker input {
    position: fixed;
    left: -9999px;
    opacity: 0;
}

.switch-line {
    min-height: 64px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.switch-line span {
    display: grid;
    gap: 4px;
}

.switch-line small {
    color: var(--muted);
}

.switch-line input {
    width: 24px;
    height: 24px;
    accent-color: var(--accent);
}

.form-message {
    display: none;
    margin: 13px 0 0;
    padding: 11px 13px;
    border-radius: 12px;
    color: #ffbbb7;
    background: rgba(255, 95, 87, .12);
    font-size: 13px;
}

.form-message.is-visible {
    display: block;
}

.form-message.is-info {
    color: #ffd0aa;
    background: rgba(245, 130, 32, .12);
}

.route-view-page {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}

#routeMap {
    position: fixed;
    inset: 0;
    background: #ddd;
}

.floating-header {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
    min-height: calc(82px + var(--safe-top));
    padding: calc(14px + var(--safe-top)) 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .82), transparent);
    pointer-events: none;
}

.floating-header > * {
    pointer-events: auto;
}

.floating-header h1 {
    max-width: calc(100vw - 90px);
    overflow: hidden;
    font-size: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.back-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(20, 20, 20, .9);
    font-size: 36px;
    line-height: 1;
}

.route-sheet {
    position: fixed;
    z-index: 1000;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-bottom));
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(24, 24, 24, .96);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .42);
    backdrop-filter: blur(12px);
}

.route-sheet__title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.route-sheet__title h2 {
    margin-bottom: 14px;
}

.route-description {
    margin-bottom: 15px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.stats-grid article {
    min-width: 0;
    padding: 11px 9px;
    border-radius: 14px;
    background: var(--panel-2);
}

.stats-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
}

.stats-grid strong {
    display: block;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-marker {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: #1b1b1b;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
    font-size: 11px;
    font-weight: 900;
}

.map-marker--end {
    color: #111;
    background: var(--accent);
}

.leaflet-control-attribution {
    margin-bottom: 8px !important;
    font-size: 9px !important;
}

@media (min-width: 720px) {
    .modal__panel,
    .route-sheet {
        left: 50%;
        right: auto;
        width: min(560px, calc(100vw - 30px));
        transform: translateX(-50%);
    }
}


/* ===== Layout général ===== */

body {
    overflow-x: hidden;
}

.app-shell {
    min-height: 100dvh;
    background: var(--bg);
}

.app-shell--standard {
    padding-bottom: calc(82px + var(--safe-bottom));
}

.app-content {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 22px 16px 30px;
}

.main-header {
    position: sticky;
    z-index: 1500;
    top: 0;
    min-height: calc(72px + var(--safe-top));
    padding-top: var(--safe-top);
    border-bottom: 1px solid var(--border);
    background: rgba(17, 17, 17, .94);
    backdrop-filter: blur(16px);
}

.main-header__inner {
    width: min(760px, 100%);
    min-height: 72px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.main-header h1 {
    margin: 0;
    font-size: 27px;
}

.brand,
.header-title {
    min-width: 0;
}

.header-title {
    flex: 1;
}

.header-title h1 {
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-back {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--panel-2);
    font-size: 34px;
    line-height: 1;
}

.header-spacer {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
}

.main-footer {
    position: fixed;
    z-index: 1800;
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid var(--border);
    background: rgba(18, 18, 18, .97);
    backdrop-filter: blur(18px);
}

.footer-nav {
    position: relative;
    width: min(760px, 100%);
    min-height: 72px;
    margin: 0 auto;
    padding: 7px 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
}

.footer-nav__item {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.footer-nav__item.is-active {
    color: var(--accent);
}

.footer-nav__icon {
    font-size: 21px;
    line-height: 1;
}

.footer-nav__main {
    width: 54px;
    height: 54px;
    margin: -28px auto 0;
    border: 5px solid var(--bg);
    border-radius: 50%;
    color: #111;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(245, 130, 32, .28);
    font-size: 30px;
    font-weight: 700;
    cursor: pointer;
}

.app-shell--map {
    height: 100dvh;
    overflow: hidden;
}

.app-shell--map .main-header {
    position: fixed;
    left: 0;
    right: 0;
    border-bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .84), transparent);
    backdrop-filter: none;
}

.app-shell--map .app-content {
    width: 100%;
    max-width: none;
    height: 100%;
    padding: 0;
}

.route-view-page .main-header__inner {
    width: 100%;
    max-width: none;
}

@media (min-width: 720px) {
    .app-content {
        padding-top: 28px;
    }
}


/* ===== Footer navigation maTrace ===== */

.footer-nav {
    grid-template-columns: repeat(4, 1fr);
    min-height: 76px;
    padding: 7px 10px 8px;
}

.footer-nav__item,
.footer-nav__record {
    min-width: 0;
    min-height: 58px;
    border: 0;
    background: transparent;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.footer-nav__item.is-active,
.footer-nav__record.is-active {
    color: var(--accent);
}

.footer-nav__icon,
.footer-nav__record svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.footer-nav__record {
    color: #fff;
}

.footer-nav__record-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: rgba(245, 130, 32, .12);
}

.footer-nav__record-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--accent);
    stroke: var(--accent);
}

.footer-nav__item--live {
    position: relative;
}

.live-dot {
    position: absolute;
    top: 9px;
    right: calc(50% - 18px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff4d4d;
    box-shadow: 0 0 0 4px rgba(255, 77, 77, .14);
}

.footer-nav__item.is-disabled {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}


/* ===== Navigation V5 ===== */

.footer-nav {
    grid-template-columns: repeat(5, 1fr);
}

.footer-nav__add {
    width: 54px;
    height: 54px;
    margin: -28px auto 0;
    display: grid;
    place-items: center;
    border: 5px solid var(--bg);
    border-radius: 50%;
    color: #111;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(245, 130, 32, .28);
    font-size: 31px;
    font-weight: 800;
    cursor: pointer;
}

.footer-nav__item {
    border: 0;
}

.footer-nav__icon--record circle:first-child {
    stroke: currentColor;
}

.footer-nav__icon--record circle:last-child {
    fill: currentColor;
    stroke: currentColor;
}

.section-head--first {
    margin-top: 4px;
}

.activity-list {
    display: grid;
    gap: 11px;
}

.activity-card {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
}

.activity-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.activity-card h3 {
    margin: 5px 0 12px;
}

.activity-card time {
    color: var(--muted);
    font-size: 12px;
}

.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
}

.activity-meta span:not(:last-child)::after {
    content: "•";
    margin-left: 7px;
}


.activity-status {
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: var(--panel-2);
    font-size: 11px;
    font-weight: 800;
}

.activity-status.is-live {
    color: #ff8c87;
    background: rgba(255, 77, 77, .12);
}

#liveMap {
    position: fixed;
    inset: 0 0 calc(76px + var(--safe-bottom)) 0;
    background: #ddd;
}

.live-panel {
    position: fixed;
    z-index: 1200;
    left: 10px;
    right: 10px;
    bottom: calc(86px + var(--safe-bottom));
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(24, 24, 24, .96);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .42);
    backdrop-filter: blur(12px);
}

.live-panel__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.live-badge {
    align-self: flex-start;
    padding: 6px 9px;
    border-radius: 999px;
    color: #fff;
    background: #ff4d4d;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.danger-btn {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 15px;
    color: #fff;
    background: #c73737;
    font-weight: 800;
    cursor: pointer;
}


.prepare-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--panel);
}

.activity-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.activity-type {
    position: relative;
    min-height: 64px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--panel-2);
    cursor: pointer;
}

.activity-type input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.activity-type:has(input:checked) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(245, 130, 32, .10);
}

.activity-type span {
    font-weight: 800;
}

.secondary-btn {
    min-height: 50px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    color: var(--muted);
    background: var(--panel-2);
    font-weight: 800;
}


/* ===== Confirmation intégrée de fin d'activité ===== */

.finish-actions {
    width: 100%;
}

.finish-confirm-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.finish-confirm-actions:not([hidden]) {
    display: grid;
}

.secondary-action-btn {
    min-height: 50px;
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text);
    background: var(--panel-2);
    font-weight: 800;
    cursor: pointer;
}

.secondary-action-btn:disabled,
.danger-btn:disabled {
    opacity: .55;
    cursor: default;
}


/* ===== Enregistrer : interface bottom sheet ===== */

.record-page {
    overflow: hidden;
}

.app-shell--record {
    height: 100dvh;
    overflow: hidden;
}

.app-shell--record .app-content {
    width: 100%;
    max-width: none;
    height: 100%;
    padding: 0;
}

.prepare-map {
    position: fixed;
    inset: calc(72px + var(--safe-top)) 0 calc(76px + var(--safe-bottom)) 0;
    background:
        linear-gradient(rgba(17, 17, 17, .06), rgba(17, 17, 17, .06)),
        repeating-linear-gradient(
            45deg,
            #d7d9d7,
            #d7d9d7 14px,
            #e1e3e1 14px,
            #e1e3e1 28px
        );
}

.prepare-map__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 4px;
    color: #676b67;
}

.prepare-map__placeholder span {
    font-size: 28px;
    font-weight: 900;
}

.prepare-map__placeholder small {
    font-size: 12px;
}

.record-sheet {
    position: fixed;
    z-index: 1200;
    left: 10px;
    right: 10px;
    bottom: calc(86px + var(--safe-bottom));
    padding: 10px 18px 18px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: rgba(24, 24, 24, .97);
    box-shadow: 0 16px 42px rgba(0, 0, 0, .42);
    backdrop-filter: blur(16px);
}

.sheet-handle {
    width: 42px;
    height: 5px;
    margin: 0 auto 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}

.record-sheet__top {
    display: grid;
    grid-template-columns: 1fr 62px;
    gap: 12px;
    align-items: center;
}

.activity-choice {
    min-width: 0;
    min-height: 62px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 17px;
    color: var(--text);
    background: var(--panel-2);
    text-align: left;
    cursor: pointer;
}

.activity-choice__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: rgba(245, 130, 32, .12);
    font-size: 24px;
}

.activity-choice__text {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.activity-choice__text small {
    color: var(--muted);
    font-size: 11px;
}

.activity-choice__text strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-choice__arrow {
    color: var(--accent);
    font-size: 26px;
}

.play-btn {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #111;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(245, 130, 32, .28);
    cursor: pointer;
}

.play-btn svg {
    width: 29px;
    height: 29px;
    fill: currentColor;
}

.play-btn.is-loading {
    opacity: .6;
}

.add-route-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 12px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px dashed rgba(245, 130, 32, .45);
    border-radius: 15px;
    color: var(--accent);
    background: rgba(245, 130, 32, .06);
    font-weight: 800;
    cursor: pointer;
}

.add-route-btn svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.choice-sheet[hidden] {
    display: none;
}

.choice-sheet {
    position: fixed;
    z-index: 4000;
    inset: 0;
}

.choice-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(4px);
}

.choice-sheet__panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-bottom));
    padding: 10px 18px 20px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: var(--panel);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .46);
}

.choice-sheet__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.activity-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.activity-option {
    min-height: 92px;
    display: grid;
    place-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    background: var(--panel-2);
    cursor: pointer;
}

.activity-option span {
    font-size: 30px;
}

.activity-option strong {
    font-size: 14px;
}

body.sheet-open {
    overflow: hidden;
}

/* ===== Live compact ===== */

.app-shell--live .main-header {
    display: none;
}

.app-shell--live .app-content {
    height: 100dvh;
    padding: 0;
}

.live-compact-page #liveMap {
    position: fixed;
    inset: 0;
}

.live-back-btn {
    position: fixed;
    z-index: 1500;
    top: calc(12px + var(--safe-top));
    left: 12px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(20, 20, 20, .86);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .28);
    backdrop-filter: blur(10px);
    font-size: 34px;
    line-height: 1;
}

.live-sheet {
    position: fixed;
    z-index: 1400;
    left: 8px;
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
    padding: 7px 12px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(24, 24, 24, .96);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .40);
    backdrop-filter: blur(14px);
}

.live-sheet .sheet-handle {
    width: 34px;
    height: 4px;
    margin-bottom: 8px;
}

.live-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.live-stats article {
    min-width: 0;
    padding: 7px 6px;
    border-radius: 11px;
    background: var(--panel-2);
    text-align: center;
}

.live-stats span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.live-stats strong {
    display: block;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finish-actions {
    margin-top: 8px;
}

.finish-btn,
.secondary-action-btn {
    min-height: 42px;
    border-radius: 12px;
    font-size: 13px;
}

.finish-btn {
    width: 100%;
    border: 0;
    color: #fff;
    background: #c73737;
    font-weight: 800;
    cursor: pointer;
}

.finish-confirm-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.header-live-link {
    min-height: 38px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 77, 77, .12);
    font-size: 12px;
    font-weight: 800;
}

.header-live-link__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4d4d;
    box-shadow: 0 0 0 4px rgba(255, 77, 77, .12);
}

/* ===== Position GPS courante ===== */

.current-position-marker {
    position: relative;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #1687ff;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, .34),
        0 0 0 7px rgba(22, 135, 255, .18);
}

.current-position-marker span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}


.sheet-drag-zone {
    cursor: grab;
    touch-action: none;
}

.sheet-drag-zone:active {
    cursor: grabbing;
}

.live-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.live-actions .secondary-action-btn {
    flex: 1;
}

.finish-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#pauseActivityBtn.is-paused {
    border-color: var(--accent);
    color: var(--accent);
}

.pause-badge {
    margin: 0 0 8px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(245, 130, 32, .16);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* Paliers du bottom sheet : masqués par défaut, révélés selon data-position */
.live-sheet [data-tier="medium"],
.live-sheet [data-tier="large"] {
    display: none;
}

.live-sheet[data-position="medium"] [data-tier="medium"],
.live-sheet[data-position="large"] [data-tier="medium"],
.live-sheet[data-position="large"] [data-tier="large"] {
    display: block;
}

.live-sheet[data-position="large"] .live-actions[data-tier="large"] {
    display: flex;
}

.live-sheet[data-position="large"] #finishActions[data-tier="large"] {
    display: flex;
}
.pause-badge {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 100%;
    margin: 0 0 8px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(245, 130, 32, .16);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.login-brand {
    margin: 0 0 32px;
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .02em;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 18px;
}

.pin-dots span {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    transition: background .15s ease, transform .15s ease;
}

.pin-dots span.is-filled {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}

.pin-dots.is-shaking {
    animation: pin-shake .4s ease;
}

@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.pin-pad button {
    min-height: 64px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--panel-2);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
}

.pin-pad button:active {
    background: var(--panel);
}

.pin-pad__empty {
    visibility: hidden;
    pointer-events: none;
}

.route-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 46vh;
    margin-top: 10px;
    overflow-y: auto;
}

.route-option {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text);
    background: var(--panel-2);
    text-align: left;
    cursor: pointer;
}

.route-option--free {
    margin-top: 4px;
    border-style: dashed;
    border-color: rgba(245, 130, 32, .45);
    color: var(--accent);
    background: rgba(245, 130, 32, .06);
}

.route-option__name {
    display: block;
    font-weight: 800;
    font-size: 14px;
}

.route-option__meta {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.selected-route-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(245, 130, 32, .45);
    border-radius: 15px;
    background: rgba(245, 130, 32, .08);
}

.selected-route-chip__info span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.selected-route-chip__info strong {
    display: block;
    color: var(--text);
    font-size: 14px;
}

.selected-route-chip__remove {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    color: var(--text);
    background: var(--panel-2);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.live-map-rotator {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

#liveMap.is-oversized {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 142%;
    height: 142%;
    transition: transform 0.25s linear;
}

.app-shell--live.is-heading-up .leaflet-control-zoom {
    display: none;
}

#headingUpBtn.is-active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Remplace la règle .current-position-marker existante par celle-ci
   (flèche directionnelle au lieu du simple point) */
.current-position-marker {
    position: relative;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    transform: rotate(var(--marker-bearing, 0deg));
    transition: transform 0.2s linear;
}

.current-position-marker::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 22px solid #1687ff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}

.route-direction-arrow {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: #f58220;
    font-size: 22px;
    line-height: 1;
    transform: rotate(var(--arrow-bearing, 0deg));
    text-shadow: 0 1px 3px rgba(0, 0, 0, .65);
}

/* Remplace la règle #liveMap.is-oversized existante par celle-ci
   (marge dynamique au lieu de 142% fixe) */
#liveMap.is-oversized {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--map-oversize, 220%);
    height: var(--map-oversize, 220%);
    transition: transform 0.25s linear;
}