body {
    padding: 0;
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Suppression overlay bleu sur TOUS les éléments ── */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ── Animation zoom au clic — éléments ciblés explicitement
   ⚠️ Pas de [onclick] ni de sélecteur générique : ça casse les marqueurs Leaflet ── */
button,
[role="button"],
.control-button,
.action-button,
.clear-button,
.bottom-nav-item,
.bottom-nav-fab,
.bottom-nav-icon,
.tc-btn,
.dash-carte,
.dash-stat,
.dash-btn-create,
.dash-sheet-btn,
.dash-modal-btn,
.dash-avatar-hide,
.dash-avatar-item,
.dash-color-opt,
.login-tab,
.login-btn,
.popup-title {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

button:active,
[role="button"]:active,
.control-button:active,
.action-button:active,
.clear-button:active,
.tc-btn:active,
.dash-stat:active,
.dash-btn-create:active,
.dash-sheet-btn:active,
.dash-modal-btn:active,
.dash-avatar-hide:active,
.dash-avatar-item:active,
.dash-color-opt:active,
.login-tab:active,
.login-btn:active,
.popup-title:active {
    transform: scale(0.92);
    opacity: 0.82;
}

/* Cartes dashboard : zoom plus subtil */
.dash-carte:active {
    transform: scale(0.97) !important;
    opacity: 0.9;
}

/* ── Neutraliser toute transition sur les marqueurs (MapLibre : classe unique .app-marker, voir leaflet-compat.js) ── */
.app-marker {
    transition: none !important;
}
#map {
    height: 100vh;
    width: 100vw;
    /* 🔧 CORRECTIF MIGRATION MAPLIBRE : z-index explicite pour que #map crée
       son propre contexte d'empilement CSS. Sans ça, les marqueurs internes
       (z-index jusqu'à 51000 pour l'avatar de partage de position — voir
       leaflet-compat.js) s'échappent du conteneur et se comparent
       directement à des éléments d'interface externes comme #bottom-nav-bar
       (z-index:500), passant au-dessus. Sous Leaflet, .leaflet-container
       créait déjà ce contexte, donc le problème n'existait pas. On garde
       cette valeur volontairement basse : tout ce qui doit rester au-dessus
       de la carte (barre de recherche, boussole, barre de navigation...) a
       un z-index ≥ 500, donc reste bien au-dessus quel que soit le z-index
       interne des marqueurs.
    */
    position: relative;
    z-index: 1;
}

/* 🔧 CORRECTIF MIGRATION MAPLIBRE : la popup doit passer au-dessus des marqueurs.
   Sous Leaflet, popupPane (700) était toujours au-dessus de markerPane (600) par
   défaut, quel que soit le z-index des marqueurs. MapLibre n'a pas de système de
   panes : marker et popup sont de simples enfants de #map, et l'ordre d'empilement
   dépend uniquement du z-index. Les marqueurs vont jusqu'à 1000 + zIndexOffset
   (voir leaflet-compat.js), donc sans règle explicite ici, .maplibregl-popup reste
   à z-index:auto et se retrouve SOUS n'importe quel marqueur → la fenêtre popup
   apparaît en dessous des pins au lieu d'au-dessus. On force donc un z-index
   supérieur au plus haut zIndexOffset "normal" utilisé pour des marqueurs de
   points d'intérêt (max 2000 → z-index 3000), tout en restant sous les éléments
   toujours au-dessus de la carte (avatar de partage 51000, position live 201000). */
.maplibregl-popup {
    z-index: 5000;
}

/* Barre de recherche */
.search-container {
    position: absolute;
    top: 21px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

/* Bouton d'information "i" à droite de la barre de recherche */
.search-info-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 50%;
    font-size: 15px;
    font-weight: bold;
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        0 0 0 1.5px rgba(180,180,190,0.9),
        0 0 0 2.5px rgba(120,120,130,0.4),
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -1px 0 rgba(0,0,0,0.08),
        0 6px 16px rgba(0,0,0,0.35);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.2s;
}

.search-info-btn:active {
    transform: scale(0.9);
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.4);
}

body.dark .search-info-btn {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(35, 38, 55, 0.60);
    box-shadow:
        0 0 0 1.5px rgba(255,255,255,0.12),
        0 6px 16px rgba(0,0,0,0.45);
}

body.dark .search-info-btn:active {
    background: rgba(60, 65, 90, 0.75);
}

#searchInput {
    width: 100%;
    padding: 12px 45px 12px 15px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    outline: none;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Contour métallique : bord sombre en bas, reflet clair en haut */
    box-shadow:
        0 0 0 1.5px rgba(180,180,190,0.9),
        0 0 0 2.5px rgba(120,120,130,0.4),
        inset 0 1px 0 rgba(255,255,255,0.7),
        inset 0 -1px 0 rgba(0,0,0,0.08),
        0 10px 30px rgba(0,0,0,0.45),
        0 4px 10px rgba(0,0,0,0.35);
}

#searchInput:focus {
    background: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 0 0 1.5px rgba(160,160,175,1),
        0 0 0 2.5px rgba(100,100,120,0.5),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.1),
        0 6px 22px rgba(0,0,0,0.38),
        0 2px 8px rgba(0,0,0,0.28);
}

#searchInput::placeholder {
    color: rgba(0, 0, 0, 0.6);
}

/* Bouton effacer (croix) */
.clear-button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: none;
    width: 25px;
    height: 25px;
    text-align: center;
    line-height: 25px;
    border-radius: 50%;
    transition: all 0.2s;
}

.clear-button:hover {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.8);
}

.clear-button.show {
    display: block;
}

/* Compteur de résultats */
.result-count {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-size: 14px;
    font-family: Arial, sans-serif;
    display: none;
}

/* Boutons en bas à droite */
.control-buttons {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-button {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-size: 14px;
    font-family: Arial, sans-serif;
    cursor: pointer;
    user-select: none;
    border: 2px solid rgba(204, 204, 204, 0.4);
    text-align: center;
    min-width: 100px;
}

.control-button:active {
    background: rgba(240, 240, 240, 0.5);
}

/* Style pour le popup personnalisé */
.custom-popup {
    text-align: center;
    position: relative;
}

.popup-title {
    font-weight: bold;
    margin-bottom: 8px;
    padding-top: 25px;
    font-size: 16px;
    cursor: pointer;
    color: #2196F3;
}

.popup-title:hover {
    text-decoration: underline;
}

.popup-address {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    line-height: 1.4;
    display: none;
}

.popup-address.show {
    display: block;
}

/* Vue normale et vue commentaire/horaires */
.popup-view {
    display: block;
}

.popup-view.hidden {
    display: none;
}

/* Zone de texte pour commentaire et horaires */
.text-area-input {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    font-size: 14px;
    border: 2px solid rgba(204, 204, 204, 0.6);
    border-radius: 10px;
    box-sizing: border-box;
    resize: vertical;
    font-family: Arial, sans-serif;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.text-area-input:focus {
    outline: none;
    border-color: #4285F4;
}

.char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-bottom: 10px;
}

/* NOUVEAU : Style pour les horaires structurés - VERSION COMPACTE */
.schedule-editor {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.schedule-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 3px;
}

.schedule-label {
    font-weight: bold;
    font-size: 12px;
    color: #333;
    user-select: none;
    white-space: nowrap;
}

.schedule-inputs {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.time-input {
    width: 40px;
    padding: 4px 2px;
    text-align: center;
    font-size: 12px;
    border: 1px solid rgba(204, 204, 204, 0.8);
    border-radius: 4px;
    background: white;
    font-family: monospace;
}

.time-input:focus {
    outline: none;
    border-color: #4285F4;
    background: #f0f8ff;
}

.time-separator {
    color: #666;
    font-size: 11px;
    user-select: none;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Rendre le popup transparent à 80% (20% opaque)
   🔧 MAPLIBRE : contrairement à Leaflet (wrapper + content séparés), MapLibre
   n'a qu'un seul conteneur .maplibregl-popup-content qui joue les deux rôles.
   On y fusionne donc le fond/blur (ex .leaflet-popup-content-wrapper) et les
   marges/largeurs (ex .leaflet-popup-content). */
.maplibregl-popup-content {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 0;
    padding: 15px;
    min-width: 200px;
    max-width: 250px;
}

.maplibregl-popup-tip {
    background: rgba(255, 255, 255, 0.2) !important;
}

.action-button {
    background: #4285F4;
    color: white !important;
    padding: 8px 16px;
    border-radius: 15px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: block;
    text-decoration: none !important;
    margin-top: 5px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.action-button:active {
    background: #3367D6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transform: translateY(1px);
}

.comment-button {
    background: #FF9800;
}

.comment-button:active {
    background: #F57C00;
}

/* 🆕 Bouton Trajets avec couleur verte émeraude stylée */
.trips-button {
    background: #10B981;  /* Vert émeraude moderne */
}

.trips-button:active {
    background: #059669;  /* Vert plus foncé au clic */
}

.schedule-button {
    background: #9C27B0;
}

.schedule-button:active {
    background: #7B1FA2;
}

.back-button {
    background: #9E9E9E;
}

.back-button:active {
    background: #757575;
}

.modify-button {
    background: #FF9800;
}

.modify-button:active {
    background: #F57C00;
}

/* Affichage du texte enregistré (commentaire ou horaires) */
.text-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: left;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-line;
}

/* ========================================
   STYLES POUR LE SYSTÈME DE NOTATION
   ======================================== */

/* Conteneur de la note moyenne affichée */
.rating-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 15px;
    border-radius: 12px;
    margin: 8px 0;
    text-align: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.rating-display .stars {
    font-size: 18px;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.rating-display .rating-text {
    font-size: 13px;
    opacity: 0.9;
}

/* Conteneur du système de vote */
.rating-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.rating-title {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

/* Étoiles cliquables */
.star-rating {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 10px 0;
}

.star {
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    line-height: 1;
}

.star:hover,
.star.hover {
    color: #ffd700;
    transform: scale(1.2);
}

.star.selected {
    color: #ffd700;
}

/* Message après vote */
.rating-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.rating-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    display: block;
}

.rating-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #c62828;
    display: block;
}

.rating-message.already-voted {
    background: rgba(255, 152, 0, 0.2);
    color: #e65100;
    display: block;
}

/* 🆕 BOUTON CRAYON AVEC RELIEF */
.edit-position-icon {
    position: absolute;
    top: -10px;
    left: -10px;

    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(6px);

    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);

    font-size: 16px;
    cursor: pointer;

    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.25),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);

    transition: all 0.2s ease;
    z-index: 1000;
}


/* Press (effet enfoncé) */
.edit-position-icon:active {
    transform: scale(0.95);
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* 🆕 BOUTON FERMER LES TRACÉS GPS */
#close-routes-btn {
    display: none;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 90%;
    max-width: 400px;
    background: rgba(30, 30, 30, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    border: none;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow:
        /* 🖼️ Moulure : anneaux concentriques imitant un cadre gravé (clair-creux-clair) */
        0 0 0 1px rgba(255,255,255,0.65),
        0 0 0 2.5px rgba(120,120,120,0.55),
        0 0 0 4px rgba(255,255,255,0.4),
        0 0 0 5px rgba(0,0,0,0.18),
        /* Ombre portée générale */
        0 2px 6px rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

#close-routes-btn:active {
    background: rgba(60, 60, 60, 0.95);
    transform: translateX(-50%) scale(0.97);
}

#share-route-btn {
    display: none;
    position: absolute;
    top: 62px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: linear-gradient(145deg, rgba(232,232,232,0.92) 0%, rgba(200,200,200,0.92) 40%, rgba(176,176,176,0.92) 60%, rgba(208,208,208,0.92) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #1c1c1e;
    padding: 12px 26px;
    border-radius: 50px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    cursor: pointer;
    box-shadow:
        /* 🖼️ Moulure : identique à la barre du dessus pour rester cohérent */
        0 0 0 1px rgba(255,255,255,0.65),
        0 0 0 2.5px rgba(120,120,120,0.55),
        0 0 0 4px rgba(255,255,255,0.4),
        0 0 0 5px rgba(0,0,0,0.18),
        0 8px 20px rgba(0,0,0,0.35),
        0 3px 7px rgba(0,0,0,0.22),
        inset 0 2px 3px rgba(255,255,255,0.75),
        inset 0 -2px 3px rgba(0,0,0,0.12);
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#share-route-btn:active {
    transform: translateX(-50%) scale(0.95);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.65),
        0 0 0 2.5px rgba(120,120,120,0.55),
        0 0 0 4px rgba(255,255,255,0.4),
        0 0 0 5px rgba(0,0,0,0.18),
        0 1px 4px rgba(0,0,0,0.22),
        inset 0 2px 5px rgba(0,0,0,0.2),
        inset 0 -1px 2px rgba(255,255,255,0.35);
}

/* ── Modale SMS ─────────────────────────────────────────────────────────────── */
@keyframes slideUpSms {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

#sms-import-card {
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.6) !important;
    color: #1a1a1a !important;
}

#sms-import-card div,
#sms-import-card span {
    color: #1a1a1a !important;
}

#sms-import-card textarea {
    background: rgba(255, 255, 255, 0.7);
    border: 1.5px solid rgba(180, 180, 180, 0.5);
    color: #1a1a1a !important;
}

#sms-import-card textarea::placeholder {
    color: rgba(80, 80, 80, 0.6) !important;
}

#sms-import-card textarea:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(33, 150, 243, 0.7);
}

/* ========================================
   🆕 SYSTÈME DE COMMENTAIRES UTILISATEURS
   ======================================== */

.uc-wrapper {
    margin-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 10px;
}

.uc-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uc-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

/* ── Liste des commentaires des autres ── */
.uc-others-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.uc-comment-item {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 7px 10px;
}

.uc-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.uc-comment-author {
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.uc-comment-date {
    font-size: 10px;
    color: #999;
}

.uc-comment-text {
    font-size: 12px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

/* ── Mon commentaire ── */
.uc-my-comment {
    background: rgba(33, 150, 243, 0.07);
    border: 1px solid rgba(33, 150, 243, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uc-my-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.uc-my-label {
    font-size: 11px;
    font-weight: 600;
    color: #1976d2;
}

.uc-my-text {
    font-size: 12px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

.uc-my-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

/* ── Formulaire ── */
.uc-textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border: 1.5px solid rgba(180, 180, 180, 0.5);
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 12px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a1a;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.uc-textarea:focus {
    border-color: rgba(33, 150, 243, 0.7);
    background: #fff;
}

.uc-char-count {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: -2px;
}

.uc-form-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ── Boutons ── */
.uc-btn {
    padding: 5px 11px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.uc-btn:active {
    transform: scale(0.97);
}

.uc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.uc-btn-save {
    background: #2196f3;
    color: #fff;
}

.uc-btn-save:hover {
    background: #1976d2;
}

.uc-btn-edit {
    background: rgba(33, 150, 243, 0.12);
    color: #1976d2;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.uc-btn-delete {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 1px solid rgba(244, 67, 54, 0.25);
}

.uc-btn-cancel {
    background: rgba(0, 0, 0, 0.07);
    color: #555;
}

/* ── États ── */
.uc-loading,
.uc-empty,
.uc-not-logged,
.uc-error {
    font-size: 12px;
    color: #888;
    text-align: center;
    padding: 6px 0;
}

.uc-error {
    color: #c62828;
}

.uc-message {
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 5px;
    text-align: center;
}

.uc-message-error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

.uc-message-success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

/* ========================================
   🍔 BOUTON BURGER — bas gauche, rond
   ======================================== */
#burger-btn {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    z-index: 1100;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(204, 204, 204, 0.4);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}

#burger-btn:active {
    transform: scale(0.93);
    background: rgba(240, 240, 240, 0.5);
}

.burger-line {
    display: block;
    width: 18px;
    height: 2.5px;
    border-radius: 2px;
    background: #2196F3;
}

/* ========================================
   📋 OVERLAY (fond sombre derrière le volet)
   ======================================== */
#settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 1199;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.30s ease;
}

#settings-overlay.show {
    background: rgba(0, 0, 0, 0.35);
    pointer-events: all;
}

/* ========================================
   📂 WRAPPER — glisse depuis la gauche
   ======================================== */
#settings-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

#settings-wrapper.open {
    transform: translateX(0);
    pointer-events: all;
}

/* ========================================
   📂 VOLET PARAMÈTRES
   ======================================== */
#settings-panel {
    position: relative;
    width: min(82vw, 310px);
    height: 100%;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border-right: 1px solid rgba(255, 255, 255, 0.70);
    border-radius: 0 28px 28px 0;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    pointer-events: all;
}

/* ========================================
   🟰 LANGUETTE — intérieure, bord droit, milieu vertical
   ======================================== */
#settings-tab {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 48px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 3px;
    cursor: pointer;
    pointer-events: all;
}

#settings-tab-line {
    display: none;
}

/* En-tête du volet */
#settings-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 16px;
    flex-shrink: 0;
}

#settings-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2196F3, #1565C0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 6px 18px rgba(33, 150, 243, 0.35);
    flex-shrink: 0;
}

#settings-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

#settings-subtitle {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.40);
    margin-top: 2px;
}

/* Séparateurs */
.settings-sep {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 6px 0;
}

/* Label de section */
.settings-section-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 20px 5px;
}

/* Éléments de menu */
.settings-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 0;
}

.settings-item:active {
    background: rgba(33, 150, 243, 0.08);
}

.settings-item-icon {
    font-size: 20px;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.settings-item-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
}

.settings-item-arrow {
    font-size: 20px;
    color: rgba(0, 0, 0, 0.20);
    line-height: 1;
}

/* Item danger (déconnexion) */
.settings-item-danger .settings-item-text {
    color: #E53935;
}

/* Item avec toggle (pas de cursor pointer sur tout l'item car le clic est sur le switch) */
.settings-item-toggle {
    cursor: default;
}

.settings-item-toggle:active {
    background: transparent;
}

/* Contenu texte + sous-texte empilés */
.settings-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-item-subtext {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.38);
    font-weight: 400;
}

/* Toggle switch style iOS */
.settings-toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
    cursor: pointer;
}

.settings-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.settings-toggle-thumb {
    position: absolute;
    inset: 0;
    background: rgba(120, 120, 128, 0.32);
    border-radius: 31px;
    transition: background 0.25s ease;
}

.settings-toggle-thumb::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.20);
}

.settings-toggle-switch input:checked + .settings-toggle-thumb {
    background: #2196F3;
}

.settings-toggle-switch input:checked + .settings-toggle-thumb::before {
    transform: translateX(20px);
}

/* Version en bas */
#settings-version {
    margin-top: auto;
    padding: 20px 20px 0;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.25);
    text-align: center;
}

/* ========================================
   🌙 THÈME SOMBRE — body.dark
   ======================================== */

/* ── Fond carte pendant chargement des tuiles ── */
body.dark #map {
    background: #1a1e2e;
}

/* ── Carte MapLibre (tuiles raster rendues sur le <canvas> WebGL — le filtre
   CSS s'applique toujours normalement au résultat rasterisé) ── */
body.dark .maplibregl-canvas {
    filter: brightness(0.75) invert(1) contrast(1.0) hue-rotate(180deg) saturate(0.55);
}

/* ── Marqueurs adoucis (pas de pane commun sous MapLibre, on cible chaque marqueur) ── */
body.dark .app-marker {
    filter: saturate(0.72) brightness(0.88);
}

/* ── Attribution MapLibre — cachée ── */
.maplibregl-ctrl-attrib {
    display: none !important;
}

/* ── Attribution MapLibre — thème sombre discret ── */
body.dark .maplibregl-ctrl-attrib {
    background: rgba(20, 24, 38, 0.55) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.40) !important;
    border-radius: 8px 0 0 0;
    font-size: 10px;
}
body.dark .maplibregl-ctrl-attrib a {
    color: rgba(130, 196, 248, 0.60) !important;
}

/* ── Barre de recherche ── */
body.dark #searchInput {
    background: rgba(40, 45, 60, 0.55);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e8e8e8;
}
body.dark #searchInput:focus {
    border-color: rgba(76, 175, 80, 0.7);
    background: rgba(50, 55, 75, 0.70);
}
body.dark #searchInput::placeholder {
    color: rgba(255, 255, 255, 0.40);
}
body.dark .clear-button {
    color: rgba(255, 255, 255, 0.45);
}
body.dark .clear-button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}
body.dark .result-count {
    background: rgba(35, 38, 55, 0.60);
    color: #ccc;
}

/* ── Boutons contrôle bas-droite ── */
body.dark .control-button {
    background: rgba(35, 38, 55, 0.60);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
}
body.dark .control-button:active {
    background: rgba(55, 60, 80, 0.75);
}

/* ── Popup MapLibre ── */
body.dark .maplibregl-popup-content {
    background: rgba(30, 34, 50, 0.65) !important;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.10);
}
body.dark .maplibregl-popup-tip {
    background: rgba(30, 34, 50, 0.65) !important;
}
body.dark .popup-title { color: #82c4f8; }
body.dark .popup-address { color: #aaa; }
body.dark .text-display {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
}
body.dark .text-area-input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: #e0e0e0;
}
body.dark .text-area-input:focus {
    border-color: #4285F4;
    background: rgba(66, 133, 244, 0.10);
}
body.dark .char-counter { color: #888; }

/* ── Schedule editor ── */
body.dark .schedule-editor { background: rgba(255, 255, 255, 0.06); }
body.dark .schedule-label { color: #ccc; }
body.dark .time-input {
    background: rgba(40, 45, 65, 0.70);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e0e0e0;
}
body.dark .time-input:focus {
    background: rgba(66, 133, 244, 0.15);
    border-color: #4285F4;
}
body.dark .time-separator { color: #888; }

/* ── Notation ── */
body.dark .rating-container {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.10);
}
body.dark .rating-title { color: #ddd; }
body.dark .star { color: #555; }
body.dark .star:hover, body.dark .star.hover, body.dark .star.selected { color: #ffd700; }
body.dark .rating-message.success { background: rgba(76,175,80,0.15); color: #81c784; }
body.dark .rating-message.error { background: rgba(244,67,54,0.15); color: #ef9a9a; }
body.dark .rating-message.already-voted { background: rgba(255,152,0,0.15); color: #ffcc80; }

/* ── Bouton crayon ── */
body.dark .edit-position-icon {
    background: rgba(40, 45, 65, 0.60);
    border-color: rgba(255, 255, 255, 0.20);
}

/* ── Modale SMS ── */
body.dark #sms-import-card {
    background: rgba(35, 40, 58, 0.72) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border-top-color: rgba(255, 255, 255, 0.10) !important;
    color: #e0e0e0 !important;
}
body.dark #sms-import-card div,
body.dark #sms-import-card span { color: #e0e0e0 !important; }
body.dark #sms-import-card textarea {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e0e0e0 !important;
}
body.dark #sms-import-card textarea::placeholder { color: rgba(200,200,200,0.38) !important; }
body.dark #sms-import-card textarea:focus {
    background: rgba(33, 150, 243, 0.10);
    border-color: rgba(33, 150, 243, 0.60);
}

/* ── Commentaires utilisateurs ── */
body.dark .uc-wrapper { border-top-color: rgba(255,255,255,0.09); }
body.dark .uc-title { color: #bbb; }
body.dark .uc-comment-item { background: rgba(255,255,255,0.06); }
body.dark .uc-comment-author { color: #aaa; }
body.dark .uc-comment-date { color: #666; }
body.dark .uc-comment-text { color: #ccc; }
body.dark .uc-my-comment { background: rgba(33,150,243,0.09); border-color: rgba(33,150,243,0.22); }
body.dark .uc-my-label { color: #82c4f8; }
body.dark .uc-my-text { color: #ccc; }
body.dark .uc-textarea {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: #e0e0e0;
}
body.dark .uc-textarea:focus { border-color: rgba(33,150,243,0.60); background: rgba(33,150,243,0.09); }
body.dark .uc-char-count { color: #666; }
body.dark .uc-btn-edit { background: rgba(33,150,243,0.10); color: #82c4f8; border-color: rgba(33,150,243,0.22); }
body.dark .uc-btn-delete { background: rgba(244,67,54,0.10); color: #ef9a9a; border-color: rgba(244,67,54,0.20); }
body.dark .uc-btn-cancel { background: rgba(255,255,255,0.08); color: #aaa; }
body.dark .uc-loading, body.dark .uc-empty, body.dark .uc-not-logged, body.dark .uc-error { color: #777; }
body.dark .uc-error { color: #ef9a9a; }
body.dark .uc-message-error { background: rgba(244,67,54,0.12); color: #ef9a9a; }
body.dark .uc-message-success { background: rgba(76,175,80,0.12); color: #81c784; }

/* ── Bouton burger ── */
body.dark #burger-btn {
    background: rgba(35, 40, 58, 0.65);
    border-color: rgba(255, 255, 255, 0.14);
}
body.dark #burger-btn:active { background: rgba(55, 62, 85, 0.80); }

/* ── Volet paramètres ── */
body.dark #settings-panel {
    background: rgba(28, 32, 48, 0.72);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-right-color: rgba(255, 255, 255, 0.09);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
}
body.dark #settings-tab { background: rgba(255,255,255,0.14); }
body.dark #settings-title { color: #eaeaea; }
body.dark #settings-subtitle { color: rgba(255,255,255,0.35); }
body.dark .settings-sep { background: rgba(255,255,255,0.08); }
body.dark .settings-section-label { color: rgba(255,255,255,0.32); }
body.dark .settings-item-text { color: #e2e2e2; }
body.dark .settings-item-subtext { color: rgba(255,255,255,0.32); }
body.dark .settings-item-arrow { color: rgba(255,255,255,0.20); }
body.dark .settings-item:active { background: rgba(33,150,243,0.10); }
body.dark .settings-toggle-thumb { background: rgba(255,255,255,0.20); }
body.dark #settings-version { color: rgba(255,255,255,0.20); }

/* ══════════════════════════════════════════
   Paramètres supplémentaires — light + dark
   ══════════════════════════════════════════ */

/* Light (défaut) */
#extra-settings-panel {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border-right: 1px solid rgba(255, 255, 255, 0.70);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.15);
}

/* Bouton retour — light */
#extra-settings-panel .back-btn-inner {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.80);
    box-shadow: 0 2px 12px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,0.9);
    transition: transform 0.15s, opacity 0.15s;
}
#extra-settings-panel .back-btn-inner span { color: #1a1a1a; }
#extra-settings-panel .back-btn-inner svg  { stroke: #2196F3; }

/* Texte description zones — light */
#zones-toggle-desc { color: rgba(0, 0, 0, 0.38); }

/* ── Dark ── */
body.dark #extra-settings-panel {
    background: rgba(28, 32, 48, 0.82);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.45);
}
body.dark #extra-settings-panel .back-btn-inner {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 12px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.06);
}
body.dark #extra-settings-panel .back-btn-inner span { color: #eaeaea; }
body.dark #extra-settings-panel .back-btn-inner svg  { stroke: #64b5f6; }
body.dark #zones-toggle-desc { color: rgba(255, 255, 255, 0.30); }

/* ── Bottom sheet historique trajets ── */
body.dark #trip-history-sheet {
    background: rgba(28, 32, 48, 0.72) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    border-top-color: rgba(255, 255, 255, 0.08) !important;
    color: #e0e0e0 !important;
}

/* ========================================
   🧭 BOUSSOLE — haut droite
   ======================================== */
#compass-widget {
    position: fixed;
    top: 92px;
    right: 10px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Mode Nord bloqué — cercle en bleu */
#compass-widget.north-locked #compass-circle {
    border-color: rgba(33, 150, 243, 0.8);
    box-shadow: 0 2px 12px rgba(33, 150, 243, 0.45);
    background: rgba(33, 150, 243, 0.15);
}
#compass-widget.north-locked #compass-deg {
    color: #1976D2;
    border-color: rgba(33, 150, 243, 0.5);
    background: rgba(33, 150, 243, 0.12);
}
body.dark #compass-widget.north-locked #compass-circle {
    background: rgba(33, 150, 243, 0.20);
}
body.dark #compass-widget.north-locked #compass-deg {
    color: #64b5f6;
}

#compass-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(204, 204, 204, 0.5);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

#compass-circle:active {
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

#compass-rose {
    position: relative;
    width: 44px;
    height: 44px;
    transition: transform 0.05s linear;
    will-change: transform;
}

/* Points cardinaux */
.compass-dir {
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    font-family: -apple-system, sans-serif;
    line-height: 1;
    pointer-events: none;
}
.compass-n { top: 1px;  left: 50%; transform: translateX(-50%); color: #e53935; }
.compass-s { bottom: 1px; left: 50%; transform: translateX(-50%); color: #555; }
.compass-e { right: 1px; top: 50%; transform: translateY(-50%); color: #555; }
.compass-w { left: 1px;  top: 50%; transform: translateY(-50%); color: #555; }

/* Aiguille */
#compass-needle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 5px;
    height: 28px;
    margin-top: -2px;
}

.needle-north {
    width: 0; height: 0;
    border-left: 2.5px solid transparent;
    border-right: 2.5px solid transparent;
    border-bottom: 14px solid #e53935;
    position: absolute;
    top: 0; left: 0;
    filter: drop-shadow(0 1px 2px rgba(229,57,53,0.5));
}

.needle-south {
    width: 0; height: 0;
    border-left: 2.5px solid transparent;
    border-right: 2.5px solid transparent;
    border-top: 14px solid rgba(80,80,80,0.6);
    position: absolute;
    bottom: 0; left: 0;
}

/* Étiquette degrés */
#compass-deg {
    font-size: 10px;
    font-family: -apple-system, monospace, sans-serif;
    font-weight: 600;
    color: rgba(0,0,0,0.65);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(204,204,204,0.4);
    white-space: nowrap;
    line-height: 1.4;
}

/* ── Dark mode ── */
body.dark #compass-circle {
    background: rgba(35, 40, 58, 0.65);
    border-color: rgba(255, 255, 255, 0.14);
}

body.dark .compass-s,
body.dark .compass-e,
body.dark .compass-w {
    color: rgba(255,255,255,0.45);
}

body.dark #compass-deg {
    background: rgba(35, 40, 58, 0.65);
    border-color: rgba(255, 255, 255, 0.14);
    color: rgba(255,255,255,0.75);
}

/* ===== BOUTON DÉCONNEXION ===== */
.dash-logout-wrapper {
    display: flex;
    justify-content: center;
    padding: 28px 24px 44px;
}

.dash-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    /* Fond opaque simulant le glassmorphism — sans backdrop-filter */
    /* backdrop-filter empêche drop-shadow de suivre le border-radius */
    background: rgba(50, 52, 65, 0.85);
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    /* box-shadow suit parfaitement le border-radius sans backdrop-filter */
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}

.dash-logout-btn:active {
    transform: scale(0.96);
    background: rgba(65, 68, 85, 0.90);
    color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.dash-logout-icon {
    font-size: 15px;
    line-height: 1;
    opacity: 0.6;
}

.dash-logout-label {
    line-height: 1;
}

/* ══ DÉZOOM — éléments dashboard supplémentaires ══ */
.dash-logout-btn:active,
#btn-upgrade-premium:active,
#premium-days-badge:active,
.dash-carte-role:active {
    transform: scale(0.94) !important;
    transition: transform 0.1s ease !important;
}

/* ========================================
   ⏱️ CALCULATRICE D'HEURES
   ======================================== */

/* Panneau bottom sheet */
.timecalc-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9001;
    border-radius: 24px 24px 0 0;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border-top: 1px solid rgba(255, 255, 255, 0.70);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Zone de préhension swipe (plus grande que la barre visible) */
.timecalc-handle-zone {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0 6px;
    cursor: grab;
    touch-action: none;
}

.timecalc-handle-zone:active {
    cursor: grabbing;
}

.timecalc-handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.18);
}

/* Contenu interne */
.timecalc-inner {
    padding: 4px 20px 20px;
}

/* En-tête */
.timecalc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.timecalc-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2196F3, #1565C0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 18px rgba(33, 150, 243, 0.35);
    flex-shrink: 0;
}

.timecalc-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

.timecalc-subtitle {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.38);
    margin-top: 2px;
}

/* Expression (ligne du calcul en cours) */
.timecalc-expr {
    min-height: 24px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.40);
    margin-bottom: 4px;
    letter-spacing: 0.01em;
    word-break: break-all;
    padding: 0 2px;
}

/* Résultat principal */
.timecalc-result {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #1a1a1a;
    min-height: 50px;
    margin-bottom: 20px;
    padding: 0 2px;
    line-height: 1.2;
}

/* Grille des touches */
.timecalc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Touches */
.tc-btn {
    border: none;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 700;
    padding: 0;
    height: 58px;
    cursor: pointer;
    transition: transform 0.08s, opacity 0.08s;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.tc-btn:active {
    transform: scale(0.93);
    opacity: 0.8;
}

/* Chiffres */
.tc-num {
    background: rgba(0, 0, 0, 0.07);
    color: #1a1a1a;
}

.tc-num:active {
    background: rgba(0, 0, 0, 0.13);
}

/* Opérateurs + − */
.tc-op {
    background: rgba(255, 149, 0, 0.18);
    color: #c87000;
    font-size: 22px;
}

.tc-op:active {
    background: rgba(255, 149, 0, 0.30);
}

/* Séparateurs h et : */
.tc-sep {
    background: rgba(33, 150, 243, 0.12);
    color: #1565C0;
    font-size: 20px;
}

.tc-sep:active {
    background: rgba(33, 150, 243, 0.22);
}

/* Supprimer */
.tc-del {
    background: rgba(0, 0, 0, 0.06);
    color: #FF9800;
    font-size: 22px;
}

.tc-del:active {
    background: rgba(255, 152, 0, 0.15);
}

/* Égal */
.tc-eq {
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.35);
}

.tc-eq:active {
    box-shadow: none;
}

/* Tout effacer */
.tc-clear {
    grid-column: span 4;
    background: rgba(229, 57, 53, 0.09);
    color: #c62828;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    height: 46px;
    letter-spacing: 0.01em;
}

.tc-clear:active {
    background: rgba(229, 57, 53, 0.18);
}

/* ── Dark mode calculatrice ── */
body.dark .timecalc-panel {
    background: rgba(28, 32, 48, 0.82);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-top-color: rgba(255, 255, 255, 0.09);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}

body.dark .timecalc-handle-bar {
    background: rgba(255, 255, 255, 0.22);
}

body.dark .timecalc-title {
    color: #eaeaea;
}

body.dark .timecalc-subtitle {
    color: rgba(255, 255, 255, 0.32);
}

body.dark .timecalc-expr {
    color: rgba(255, 255, 255, 0.38);
}

body.dark .timecalc-result {
    color: #eaeaea;
}

body.dark .tc-num {
    background: rgba(255, 255, 255, 0.10);
    color: #eaeaea;
}

body.dark .tc-num:active {
    background: rgba(255, 255, 255, 0.18);
}

body.dark .tc-op {
    background: rgba(255, 149, 0, 0.22);
    color: #ffb74d;
}

body.dark .tc-op:active {
    background: rgba(255, 149, 0, 0.35);
}

body.dark .tc-sep {
    background: rgba(33, 150, 243, 0.18);
    color: #82c4f8;
}

body.dark .tc-sep:active {
    background: rgba(33, 150, 243, 0.30);
}

body.dark .tc-del {
    background: rgba(255, 255, 255, 0.07);
    color: #ffb74d;
}

body.dark .tc-del:active {
    background: rgba(255, 152, 0, 0.18);
}

body.dark .tc-clear {
    background: rgba(239, 83, 80, 0.12);
    color: #ef9a9a;
}

body.dark .tc-clear:active {
    background: rgba(239, 83, 80, 0.22);
}























/* ========================================
   🆕 SPEEDOMETER — compteur de vitesse + limite, bas gauche
   Visible uniquement en mode navigation (boussole déverrouillée).
   Placé au-dessus de #bottom-nav-bar (120px de haut, voir plus bas)
   pour ne pas être recouvert.
   ======================================== */
#speed-widget {
    position: fixed;
    bottom: 130px;
    left: 12px;
    z-index: 900;
    display: none;
}

#speed-widget.show {
    display: flex;
}

/* Conteneur relatif : porte l'anneau SVG, le compteur et le panneau de limite,
   qui sont tous positionnés en absolu les uns par rapport aux autres. */
#speed-current-wrap {
    position: relative;
    width: 90px;   /* 🆕 72 → 90 : compteur agrandi */
    height: 90px;
}

/* Anneau de progression : se remplit de 0 à la limite (voir speedometer.js),
   puis change de couleur (orange / rouge) en cas de dépassement.
   rotate(-90deg) pour que le remplissage démarre en haut, comme une jauge. */
#speed-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 90px;   /* 🆕 72 → 90 : compteur agrandi */
    height: 90px;
    transform: rotate(-90deg);
    pointer-events: none;
    overflow: visible; /* 🆕 laisse le halo (drop-shadow) déborder du cadre SVG sans être coupé */
}

#speed-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 7;  /* 🆕 6 → 7 */
}

/* 🆕 Anneau épaissi (5 → 6.5) + halo lumineux (drop-shadow) qui reprend la
   couleur du palier courant, pour que l'anneau se détache bien de la carte.
   3 paliers : vert (dans les clous) → orange (léger dépassement) → rouge (net). */
#speed-ring-progress {
    fill: none;
    stroke: #4CAF50;
    stroke-width: 7;   /* 🆕 6.5 → 7 */
    stroke-linecap: round;
    /* stroke-dasharray = 2 * π * r (r=41) — doit rester cohérent avec RING_RADIUS dans speedometer.js */
    stroke-dasharray: 257.61;   /* 🆕 201.06 → 257.61 (r 32 → 41) */
    stroke-dashoffset: 257.61;
    filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.85));
    transition: stroke-dashoffset 0.3s linear, stroke 0.3s ease, filter 0.3s ease;
}

/* Palier 2 : dépassement léger (jusqu'à +5 km/h) */
#speed-ring-progress.ring-warn {
    stroke: #FF9800;
    filter: drop-shadow(0 0 6px rgba(255, 152, 0, 0.95));
}

/* Palier 3 : dépassement net — rouge + pulsation pour vraiment attirer l'œil */
#speed-ring-progress.ring-danger {
    stroke: #e53935;
    filter: drop-shadow(0 0 7px rgba(229, 57, 53, 1));
    animation: speed-ring-pulse 0.85s ease-in-out infinite;
}

@keyframes speed-ring-pulse {
    0%, 100% { stroke-width: 6.5; filter: drop-shadow(0 0 7px rgba(229, 57, 53, 1)); }
    50% { stroke-width: 8.5; filter: drop-shadow(0 0 11px rgba(229, 57, 53, 1)); }
}

#speed-current-box {
    position: absolute;
    top: 5px;    /* 🆕 4 → 5 */
    left: 5px;   /* 🆕 4 → 5 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;   /* 🆕 64 → 80 : compteur agrandi */
    height: 80px;  /* 🆕 64 → 80 */
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
}

#speed-current-value {
    font-size: 27px;  /* 🆕 22 → 27 */
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    transition: color 0.3s ease;
}

#speed-current-unit {
    font-size: 11px;  /* 🆕 9 → 11 */
    color: rgba(255,255,255,0.7);
    margin-top: 2px;
    letter-spacing: 0.3px;
}

/* Panneau rond façon panneau routier — chevauche le coin haut-droit du
   compteur, comme sur la photo de référence (style Waze). */
#speed-limit-box {
    position: absolute;
    top: -14px;    /* 🆕 -8 → -14 : décalé vers le haut pour ne plus mordre sur "km/h" */
    right: -14px;  /* 🆕 -8 → -14 : décalé vers la droite, hors du compteur */
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;   /* 🆕 34 → 40 : panneau agrandi */
    height: 40px;  /* 🆕 34 → 40 */
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #e53935;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

#speed-limit-value {
    font-size: 15px;  /* 🆕 13 → 15 */
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1;
}

/* Alerte dépassement de vitesse : les chiffres du compteur virent
   orange puis rouge (l'anneau change de couleur en parallèle). */
#speed-current-value.warn-limit {
    color: #FF9800;
}

#speed-current-value.over-limit {
    color: #e53935;
}

body.dark #speed-current-box {
    background: rgba(20, 20, 25, 0.78);
}

/* ========================================
   BOTTOM NAVIGATION BAR
   ======================================== */
#bottom-nav-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 500;
    height: 120px;
    display: flex;
    align-items: flex-end;
    background: transparent;
    filter: drop-shadow(0 -8px 24px rgba(0,0,0,0.45)) drop-shadow(0 -3px 8px rgba(0,0,0,0.30));
    overflow: visible;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 10px;
    gap: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    z-index: 1;
    height: 75px;
}

.bottom-nav-item:active .bottom-nav-label { opacity: 0.5; }

.bottom-nav-icon {
    font-size: 18px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(232,232,232,0.75) 0%, rgba(200,200,200,0.75) 40%, rgba(176,176,176,0.75) 60%, rgba(208,208,208,0.75) 100%);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 8px 20px rgba(0,0,0,0.45),
        0 3px 7px rgba(0,0,0,0.28),
        inset 0 2px 3px rgba(255,255,255,0.75),
        inset 0 -2px 3px rgba(0,0,0,0.15);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    position: relative;
    overflow: hidden;
}

.bottom-nav-icon::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 8px;
    width: 22px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.bottom-nav-item:active .bottom-nav-icon {
    transform: scale(0.93);
    box-shadow:
        0 1px 4px rgba(0,0,0,0.22),
        inset 0 2px 5px rgba(0,0,0,0.2),
        inset 0 -1px 2px rgba(255,255,255,0.35);
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 600;
    color: #444;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

.bottom-nav-fab-wrapper {
    flex: 1;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 120px;
}

/* Bouton bien centré dans la courbe */
.bottom-nav-fab {
    position: absolute;
    top: 25px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e8e8e8 0%, #c8c8c8 40%, #b0b0b0 60%, #d0d0d0 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        0 6px 20px rgba(0,0,0,0.35),
        0 2px 6px rgba(0,0,0,0.25),
        inset 0 2px 4px rgba(255,255,255,0.75),
        inset 0 -2px 4px rgba(0,0,0,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    z-index: 1200;
    outline: none;
    overflow: hidden;
}

.bottom-nav-fab::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 12px;
    width: 38px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.bottom-nav-fab:active {
    transform: scale(0.93);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 2px 6px rgba(0,0,0,0.25),
        inset 0 -1px 2px rgba(255,255,255,0.4);
}
