    /* ═══════════════════════════════════════════════════════════════
       RESET & TOKENS
     ═══════════════════════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:       #0A0A0A;
      --surface:  #141517;
      --surface2: #1C1D21;
      --surface3: #25262B;
      --border:   #2A2B30;
      --accent:   #00E5A0;
      --accent-glow: rgba(0, 229, 160, 0.3);
      --text:     #F2F2F2;
      --text-sec: #8E9299;
      --text-dim: #55585E;
      --danger:   #FF4455;
      --voice:    #FF6B35;
      --tesla-c:  #E31937;
      --r:        12px;
      --r-sm:     6px;
      --f-sans:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --f-mono:   'JetBrains Mono', monospace;
    }

    html, body {
      height: 100%; background: var(--bg); color: var(--text);
      font-family: var(--f-sans); font-size: 18px; line-height: 1.4;
      overflow: hidden; -webkit-tap-highlight-color: transparent;
      -webkit-font-smoothing: antialiased; user-select: none;
      -webkit-text-size-adjust: 100%;
    }
    /* Kill iOS double-tap-zoom on every interactive control. `manipulation`
       allows pan + pinch but disables the 300 ms double-tap-zoom gesture.
       The Leaflet container sets its own touch-action (none → handled by
       its own gesture code) so the map is unaffected. The chat scroller
       and panel scrollers also keep their normal scroll behaviour. */
    button, input, textarea, select, label,
    .signal-btn, .map-btn, .tab-btn, .lcd-frame, .lang-chip, .lang-pill,
    .ch-row, .mode-opt, .tesla-swatch, .tesla-model-chip,
    .pinned-add-btn, .pinned-item, .pin-sheet-btn, .pin-action-btn,
    .pin-compose-input, .qr-modal .qr-close, .code-dropdown-item,
    #qr-header-btn, #chat-toggle-btn, #quit-btn, #road-trip-btn,
    #handle-input, #code-input {
      touch-action: manipulation;
    }

    /* Subtle grain texture */
    body::before {
      content: "";
      position: fixed; inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
      opacity: 0.03;
      pointer-events: none;
      z-index: 9999;
    }

    /* ═══════════════════════════════════════════════════════════════
       SCREENS
    ═══════════════════════════════════════════════════════════════ */
    .screen {
      position: fixed; inset: 0; display: flex; flex-direction: column;
      transition: opacity 0.25s ease, transform 0.25s ease;
    }
    .screen.hidden { opacity: 0; pointer-events: none; transform: scale(0.98); }

    /* ═══════════════════════════════════════════════════════════════
       JOIN SCREEN
    ═══════════════════════════════════════════════════════════════ */
    #join-screen {
      align-items: center; justify-content: flex-start;
      padding: 36px 28px 24px; overflow-y: auto;
      background-image:
        linear-gradient(rgba(10,10,10,0.72), rgba(10,10,10,0.88)),
        url('/assets/background.png');
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      background-attachment: fixed;
    }

    /* ── Language picker (top of join screen) ───────────────────────────── */
    /* Lang picker = single chip top-right + popover */
    .lang-picker {
      position: absolute; top: 16px; right: 16px;
      z-index: 50;
    }
    .lang-chip {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 10px 14px; border-radius: var(--r-sm);
      background: var(--surface2); border: 1px solid var(--border);
      color: var(--text); font-family: var(--f-mono);
      font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
      cursor: pointer; user-select: none;
      transition: background 0.15s, border-color 0.15s, transform 0.1s;
      position: relative;
    }
    .lang-chip:hover  { background: var(--surface3, #2a2c30); border-color: var(--text-sec); }
    .lang-chip:active { transform: scale(0.96); }
    .lang-chip .flag    { font-size: 22px; line-height: 1; }
    .lang-chip .chev    { font-size: 13px; opacity: 0.6; transition: transform 0.2s; }
    .lang-picker.open .lang-chip .chev { transform: rotate(180deg); opacity: 1; }
    /* Pulse hint when no language has been explicitly chosen yet */
    .lang-chip.unset::after {
      content: ''; position: absolute; right: 4px; top: 4px;
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--accent); box-shadow: 0 0 6px var(--accent-glow);
      animation: lang-hint-pulse 1.6s ease-in-out infinite;
    }
    @keyframes lang-hint-pulse {
      0%, 100% { transform: scale(1);   opacity: 0.9; }
      50%      { transform: scale(1.4); opacity: 0.4; }
    }
    .lang-dropdown {
      position: absolute; right: 0; top: calc(100% + 6px);
      min-width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: var(--r-sm);
      box-shadow: 0 10px 28px rgba(0,0,0,0.55);
      padding: 4px 0;
      display: flex; flex-direction: column;
      opacity: 0; transform: translateY(-4px); pointer-events: none;
      transition: opacity 0.15s, transform 0.15s;
      z-index: 200;
    }
    .lang-picker.open .lang-dropdown { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .lang-pill {
      display: flex; align-items: center; gap: 10px;
      padding: 12px 16px;
      background: transparent; border: none;
      color: var(--text); font-family: var(--f-mono);
      font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
      cursor: pointer; white-space: nowrap;
      transition: background 0.12s;
    }
    .lang-pill:hover  { background: var(--surface3, #2a2c30); }
    .lang-pill.active { color: var(--accent); }
    .lang-pill .flag  { font-size: 20px; line-height: 1; }

    .logo { text-align: center; margin-bottom: 28px; width: 100%; flex-shrink: 0; }
    .logo-img {
      display: block; margin: 0 auto 10px;
      width: 140px; height: 140px;
      object-fit: contain;
      filter: drop-shadow(0 0 24px rgba(0,229,160,0.3));
    }
    .logo-car {
      font-size: 72px; display: block; line-height: 1; margin-bottom: 10px;
      filter: drop-shadow(0 0 24px var(--accent-glow));
    }
    .logo-title  { font-size: 40px; font-weight: 900; letter-spacing: -1.5px; font-family: var(--f-sans); }
    .logo-tagline { font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: 2px; margin-top: 6px; text-transform: uppercase; font-family: var(--f-mono); }

    /* Mode toggle */
    .mode-toggle {
      display: flex;
      border: 1px solid var(--border);
      border-radius: var(--r);
      overflow: hidden;
      margin-bottom: 28px;
      width: 100%;
      max-width: 500px;
      flex-shrink: 0;
      background: rgba(0,0,0,0.4);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    }
    .mode-opt {
      flex: 1;
      display: flex; flex-direction: column; align-items: center; gap: 6px;
      padding: 16px 10px;
      background: transparent; border: none;
      border-right: 1px solid var(--border);
      cursor: pointer; font-family: var(--f-sans);
      color: var(--text-sec); font-size: 20px; font-weight: 800;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mode-opt:last-child { border-right: none; }
    .mode-opt:hover      { background: rgba(255,255,255,0.03); color: var(--text); }
    .mode-opt:active     { transform: scale(0.98); }
    .mode-opt.active.tesla    { background: rgba(227,25,55,0.15); color: #FF4D6D; border-bottom: 2px solid var(--tesla-c); }
    .mode-opt.active.standard { background: rgba(0,229,160,0.1); color: var(--accent); border-bottom: 2px solid var(--accent); }
    .mode-opt .mode-icon { font-size: 32px; line-height: 1; transition: transform 0.2s; }
    .mode-opt.active .mode-icon { transform: scale(1.1); }
    .mode-opt .mode-name { font-size: 17px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; }
    .mode-opt .mode-sub  { font-size: 10px; font-weight: 700; letter-spacing: 1px; opacity: 0.6; text-transform: uppercase; font-family: var(--f-mono); }

    .join-form { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
    .field-group { display: flex; flex-direction: column; gap: 8px; }
    .field-label { font-size: 11px; font-weight: 800; color: var(--text-sec); text-transform: uppercase; letter-spacing: 2px; font-family: var(--f-mono); }

    input.txt {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--r); color: var(--text);
      font-size: 32px; font-weight: 800; font-family: var(--f-mono);
      padding: 0 24px; height: 84px; outline: none; width: 100%;
      transition: all 0.2s;
      letter-spacing: 4px; text-transform: uppercase; caret-color: var(--accent);
    }
    input.txt.handle { text-transform: none; letter-spacing: 0; font-size: 26px; font-family: var(--f-sans); }
    input.txt:focus  { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); background: var(--surface2); }
    input.txt::placeholder { color: var(--text-dim); letter-spacing: 2px; opacity: 0.5; }
    input.txt.handle::placeholder { letter-spacing: 0; }

    .hint  { font-size: 12px; color: var(--text-dim); padding-left: 2px; font-family: var(--f-mono); }
    .error-msg { color: var(--danger); font-size: 15px; font-weight: 700; text-align: center; min-height: 22px; }

    /* PWA install prompt */
    #pwa-install-wrap {
      width: 100%; max-width: 500px;
      margin-top: 16px; margin-bottom: 4px;
      display: none; flex-direction: column; align-items: stretch; gap: 8px;
    }
    #pwa-install-wrap.visible { display: flex; }
    #pwa-install-btn {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      padding: 14px 20px; border-radius: var(--r);
      background: var(--surface2); border: 1px solid var(--accent);
      color: var(--accent); font-size: 15px; font-weight: 800;
      font-family: var(--font); cursor: pointer; letter-spacing: 0.5px;
      transition: background 0.15s, opacity 0.15s;
    }
    #pwa-install-btn:active { opacity: 0.75; }
    #pwa-ios-hint {
      font-size: 12px; color: var(--text-sec); text-align: center;
      line-height: 1.5; padding: 0 4px;
    }
    #pwa-ios-hint strong { color: var(--text); }

    /* ── Pairing challenge modal (join screen) ── */
    #pairing-modal {
      position: fixed; inset: 0; z-index: 500;
      background: rgba(10,10,10,0.92); backdrop-filter: blur(8px);
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      padding: 28px; gap: 20px;
    }
    #pairing-modal.hidden { display: none; }
    .pairing-title {
      font-size: 20px; font-weight: 900; color: var(--text);
      text-align: center; letter-spacing: 0.5px;
    }
    .pairing-sub {
      font-size: 14px; color: var(--text-sec); text-align: center; line-height: 1.5;
    }
    .pairing-grid {
      display: grid; grid-template-columns: repeat(3, 1fr);
      gap: 12px; width: 100%; max-width: 320px;
    }
    .pairing-cell {
      aspect-ratio: 1; border-radius: var(--r);
      background: var(--surface2); border: 2px solid var(--border);
      color: var(--text); font-size: 28px; font-weight: 900;
      font-family: var(--font); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: background 0.12s, border-color 0.12s, transform 0.1s;
    }
    .pairing-cell:active { background: var(--accent); color: #000; border-color: var(--accent); transform: scale(0.93); }
    .pairing-cancel-btn {
      font-size: 13px; color: var(--text-dim); background: none; border: none;
      cursor: pointer; letter-spacing: 0.5px; padding: 4px 8px;
    }
    .pairing-cancel-btn:active { color: var(--text-sec); }

    /* ── Pairing toast (main screen, first device) ── */
    #pairing-toast {
      position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
      z-index: 400; min-width: 240px; max-width: calc(100vw - 32px);
      background: var(--surface); border: 1px solid var(--accent);
      border-radius: var(--r); padding: 14px 20px;
      display: flex; flex-direction: column; align-items: center; gap: 6px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.6);
      transition: opacity 0.25s; pointer-events: none;
    }
    #pairing-toast.hidden { display: none; }
    .toast-label {
      font-size: 13px; color: var(--text-sec); font-weight: 700;
      text-transform: uppercase; letter-spacing: 1px;
    }
    .toast-code {
      font-size: 44px; font-weight: 900; letter-spacing: 8px;
      color: var(--accent); line-height: 1;
    }
    .toast-hint { font-size: 11px; color: var(--text-dim); text-align: center; }

    /* Join screen — privacy notice */
    .join-notice {
      width: 100%; max-width: 500px;
      background: rgba(255, 183, 77, 0.08);
      border: 1px solid rgba(255, 183, 77, 0.35);
      border-radius: var(--r);
      padding: 14px 16px;
      margin-top: 8px;
      color: var(--text-sec);
      font-size: 12.5px; font-weight: 600; line-height: 1.5;
    }
    .join-notice .notice-title {
      display: flex; align-items: center; gap: 8px;
      color: #FFB74D; font-size: 12px; font-weight: 900;
      text-transform: uppercase; letter-spacing: 1.5px;
      margin-bottom: 8px;
    }
    .join-notice ul { margin: 0; padding-left: 18px; }
    .join-notice li { margin: 3px 0; }
    .join-notice strong { color: var(--text); font-weight: 800; }

    .btn-join {
      background: var(--accent); color: #000; border: none; border-radius: var(--r);
      font-size: 22px; font-weight: 900; font-family: var(--font);
      height: 84px; cursor: pointer; letter-spacing: 1px;
      display: flex; align-items: center; justify-content: center; gap: 14px;
      transition: opacity 0.15s, transform 0.1s;
    }
    .btn-join:active  { transform: scale(0.97); opacity: 0.85; }
    .btn-join:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

    .btn-public {
      background: var(--accent); color: #000;
      font-size: 20px; letter-spacing: 1px;
    }
    .btn-private {
      background: var(--surface2); color: var(--text);
      border: 2px solid var(--border); flex-shrink: 0;
      width: 84px; height: 84px; font-size: 26px; border-radius: var(--r);
      padding: 0;
    }
    .btn-private:active { transform: scale(0.95); opacity: 0.8; }

    /* ── Invite banner (shown when ?join=CODE) ───────────────────────────────── */
    .invite-banner {
      width: 100%; max-width: 500px;
      background: rgba(0, 229, 160, 0.07);
      border: 1px solid rgba(0, 229, 160, 0.28);
      border-radius: var(--r);
      padding: 14px 16px 12px;
      display: flex; flex-direction: column; gap: 4px;
    }
    .invite-banner-title {
      color: var(--accent); font-size: 11px; font-weight: 900;
      text-transform: uppercase; letter-spacing: 2px;
      display: flex; align-items: center; gap: 6px;
    }
    .invite-banner-code {
      font-size: 30px; font-weight: 900; letter-spacing: 5px;
      color: var(--text); line-height: 1.15;
    }
    .invite-banner-sub { color: var(--text-sec); font-size: 12px; font-weight: 600; }

    /* ── Bouton Partager le lien et rejoindre ────────────────────────────────── */
    .btn-share-join {
      width: 100%; max-width: 500px;
      background: transparent; color: var(--accent);
      border: 2px solid var(--accent); border-radius: var(--r);
      font-size: 17px; font-weight: 900; font-family: var(--font);
      height: 68px; cursor: pointer; letter-spacing: 0.5px;
      display: flex; align-items: center; justify-content: center; gap: 10px;
      transition: opacity 0.15s, transform 0.1s, background 0.15s;
    }
    .btn-share-join:active   { transform: scale(0.97); opacity: 0.85; }
    .btn-share-join:disabled { opacity: 0.25; cursor: not-allowed; transform: none; }

    /* ── FAB ✉️ (main screen, position fixe) ────────────────────────────────── */
    .fab-share {
      position: fixed; bottom: 80px; right: 20px; left: auto; z-index: 200;
      background: var(--surface2); color: var(--accent);
      border: 2px solid var(--accent); border-radius: 50%;
      width: 44px; height: 44px;
      padding: 0; font-size: 20px;
      cursor: pointer;
      display: none; align-items: center; justify-content: center;
      box-shadow: 0 4px 14px rgba(0,0,0,0.5);
      transition: opacity 0.2s, transform 0.15s;
    }
    .fab-share.visible { display: flex; }
    .fab-share:active  { opacity: 0.75; transform: scale(0.95); }
    body.tesla-mode .fab-share { display: none !important; }

    /* ── Toast "Lien copié !" ────────────────────────────────────────────────── */
    .share-toast {
      position: fixed; bottom: 76px; left: 50%;
      transform: translateX(-50%) translateY(8px);
      background: var(--accent); color: #000;
      padding: 10px 22px; border-radius: 50px;
      font-size: 14px; font-weight: 900; font-family: var(--font);
      opacity: 0; transition: opacity 0.25s, transform 0.25s;
      pointer-events: none; z-index: 9999; white-space: nowrap;
    }
    .share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes bounce {
      0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
      40% { transform: translateY(-10px); }
      60% { transform: translateY(-5px); }
    }

    .join-divider {
      display: flex; align-items: center; gap: 12px;
      color: var(--text-dim); font-size: 12px; font-weight: 800;
      text-transform: uppercase; letter-spacing: 2px;
    }
    .join-divider::before,
    .join-divider::after {
      content: ''; flex: 1; height: 1px; background: var(--border);
    }

    .trip-state-panel {
      display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 16px;
    }
    .trip-state-panel.hidden { display: none !important; }

    .join-private-row {
      display: flex; gap: 12px; align-items: stretch;
      position: relative;
    }
    .join-private-row .txt {
      flex: 1; font-size: 26px; letter-spacing: 6px;
    }
    /* Dropdown of previously-joined private channels (excludes CB + SuC).
       Positioned ABOVE the field so the on-screen keyboard (Tesla browser,
       mobile) doesn't hide it. */
    .code-dropdown {
      position: absolute;
      bottom: calc(100% + 6px); left: 0; right: 0;
      background: var(--surface2);
      border: 1px solid var(--accent);
      border-radius: var(--r-sm);
      max-height: 200px;
      overflow-y: auto;
      z-index: 100;
      box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    }
    .code-dropdown.hidden { display: none; }
    .code-dropdown-hint {
      padding: 6px 12px; font-size: 10px; font-family: var(--f-mono);
      color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase;
      border-bottom: 1px solid var(--border);
    }
    .code-dropdown-item {
      padding: 12px 14px; cursor: pointer;
      display: flex; justify-content: space-between; align-items: center;
      font-family: var(--f-mono); font-size: 18px; font-weight: 800;
      letter-spacing: 2px; color: var(--text);
      border-bottom: 1px solid var(--border);
    }
    .code-dropdown-item:last-child { border-bottom: none; }
    .code-dropdown-item:hover { background: var(--surface3); color: var(--accent); }
    .code-dropdown-item:active { transform: scale(0.98); }

    /* ═══════════════════════════════════════════════════════════════
       HEADER
    ═══════════════════════════════════════════════════════════════ */
    .header {
      display: flex; align-items: center; height: 68px; padding: 0 16px;
      background: var(--surface); border-bottom: 1px solid var(--border);
      gap: 12px; flex-shrink: 0;
      /* Above Leaflet's panes (max 700) so children that overflow below the
         header — e.g. the LCD URL badge — paint on top of the map tiles. */
      z-index: 800;
      box-shadow: 0 4px 20px rgba(0,0,0,0.3);
      position: relative;
    }
    /* Connection indicator (left side of header) */
    .conn-status {
      display: inline-flex; align-items: center; gap: 8px;
      flex-shrink: 0; line-height: 1;
    }
    .conn-dot {
      width: 16px; height: 16px; border-radius: 50%;
      background: var(--danger); flex-shrink: 0; transition: all 0.4s;
      border: 2px solid rgba(0,0,0,0.3);
    }
    .conn-dot.on { background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
    .conn-label {
      font-family: var(--f-mono); font-size: 10px;
      letter-spacing: 1.5px; text-transform: uppercase;
      color: var(--text-sec); font-weight: 700;
      transition: color 0.3s;
    }
    .conn-dot.on + .conn-label { color: var(--accent); }
    /* Audit α 0.9: SuC ⚡ override removed — it doubled up with the LCD's
       own ⚡ glyph. Connection dot stays the classic online indicator. */
    /* Mobile: hide the conn status block (dot+label) AND the user-count pill.
       Connection state is signalled by greying-out the LCD when offline (see
       body.offline rule below). Tesla mode keeps both for the dashboard look. */
    body:not(.tesla-mode) .conn-status,
    body:not(.tesla-mode) .hdr-pill,
    body:not(.tesla-mode) .hdr-handle { display: none; }
    /* Greyed LCD = "not connected" — works on green/amber/blue alike. */
    body.offline .lcd-frame { filter: grayscale(1) brightness(0.6); }

    /* URL signature badge — visually anchored on the LCD's bottom edge so
       the LCD's bottom line sits at the badge's mid-height (badge sticks
       half above + half below). Non-interactive (pointer-events:none) so
       taps in this zone hit the LCD button beneath = open channel panel. */
    .lcd-badge {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      background: #0a0a0a;
      border: 1px solid #2a2b30;
      border-radius: 4px;
      box-shadow: 0 2px 4px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
      font-family: var(--f-mono);
      font-weight: 700;
      text-transform: lowercase;
      color: var(--accent);
      text-decoration: none;
      z-index: 2;
      pointer-events: none;              /* let taps reach the LCD button */
      white-space: nowrap;
      user-select: none;
      /* Mobile defaults — smaller pill, sits mostly below the LCD so it
         doesn't crowd the compact 22 px display. */
      bottom: -8px;
      padding: 2px 7px;
      font-size: 8px;
      letter-spacing: 1.5px;
    }
    /* Tesla split: the LCD is the hero (44 px font), badge can be bigger and
       overlap further (half above / half below the LCD's bottom edge). */
    body.tesla-mode .lcd-badge {
      bottom: -10px;
      padding: 3px 9px;
      font-size: 9px;
      letter-spacing: 2px;
    }

    /* ── Channel name — LCD display (Raystar RC1602A inspired) ──────────────
       Always absolute-centred in the header so its position never shifts when
       buttons (SuC toggle, CB shortcut, etc.) appear/disappear with channel.
       The header's left + right flex groups arrange themselves around it. */
    .lcd-wrap {
      position: absolute; left: 50%; top: 50%;
      transform: translate(-50%, -50%);
      display: inline-flex; align-items: center;
      z-index: 1;
      pointer-events: none; /* let the inner button handle clicks itself */
    }
    .lcd-wrap > * { pointer-events: auto; }
    .lcd-frame {
      display: inline-flex; align-items: center; justify-content: center;
      background: linear-gradient(180deg, #B4D850 0%, #8FBE2C 100%);
      border: 2px solid #1a1a1a;
      border-radius: 5px;
      /* Mobile defaults — narrow enough to leave room for conn-status,
         signal/sc/cb buttons, handle, count and quit in the header. */
      padding: 3px 8px;
      width: 130px;
      box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.4),
        0 2px 0 rgba(255,255,255,0.06);
      cursor: pointer;
      transition: filter 0.15s, transform 0.1s;
      position: relative;
      overflow: hidden;
      outline: none; font: inherit; color: inherit;
      -webkit-appearance: none; appearance: none;
    }
    .lcd-frame:focus-visible {
      outline: 2px solid var(--accent); outline-offset: 2px;
    }
    .lcd-frame::after {
      content: ''; position: absolute; inset: 0;
      background-image: radial-gradient(rgba(0,0,0,0.08) 1px, transparent 1px);
      background-size: 4px 4px;
      pointer-events: none;
    }
    .lcd-frame:hover  { filter: brightness(1.05); }
    .lcd-frame:active { transform: scale(0.98); }
    .hdr-room {
      color: #0d0d0d;
      font-family: 'VT323', 'Share Tech Mono', ui-monospace, Menlo, monospace;
      /* Mobile defaults */
      font-size: 22px; font-weight: 400; letter-spacing: 1px;
      text-transform: uppercase;
      line-height: 1;
      pointer-events: none;
      user-select: none;
      white-space: nowrap;
      overflow: hidden; text-overflow: ellipsis;
      max-width: 100%;
    }
    /* Tesla mode: LCD becomes a hero — bigger frame + bigger font. */
    body.tesla-mode .lcd-frame {
      width: 320px; padding: 6px 18px;
      border-width: 3px; border-radius: 6px;
    }
    body.tesla-mode .hdr-room {
      font-size: 44px; letter-spacing: 2px;
    }
    /* Channel kind = LCD colour:
        default (CB)   → green
        body.sc-channel → amber (Tesla SuC)
        body.private-channel → light blue */
    body.sc-channel .lcd-frame {
      background: linear-gradient(180deg, #FFC400 0%, #F9A825 100%);
    }
    body.sc-channel .lcd-frame::before {
      content: '⚡'; margin-right: 6px;
      font-size: 20px; color: #1a1a1a; line-height: 1;
    }
    body.tesla-mode.sc-channel .lcd-frame::before {
      font-size: 30px; margin-right: 8px;
    }
    body.private-channel .lcd-frame {
      background: linear-gradient(180deg, #A5D6FF 0%, #6FB5F0 100%);
    }
    .hdr-sep    { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }
    .hdr-handle { font-size: 15px; font-weight: 700; color: var(--text-sec); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-sans); }

    /* ── Bouton Signal (filtre distance audio) ── */
    .signal-btn {
      font-family: var(--f-mono);
      font-size: 10px; font-weight: 700; letter-spacing: 1px;
      padding: 6px 10px; border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--surface2); color: var(--text-sec);
      cursor: pointer; white-space: nowrap; flex-shrink: 0;
      transition: all 0.15s;
      display: flex; flex-direction: column; align-items: center; gap: 1px;
      line-height: 1;
    }
    .signal-btn .sig-icon { font-size: 12px; }
    .signal-btn .sig-label { font-size: 8px; letter-spacing: 0.5px; opacity: 0.7; }

    /* ── Twemoji icon/flag images (replace native emoji glyphs) ──────────────
       1em by default: emoji always rendered at the ambient font-size of
       whatever wrapped them, so sizing the image the same way means every
       existing font-size rule (incl. tesla-mode overrides) keeps working
       unchanged — no per-context override list to maintain. */
    .icon-img, .flag-img {
      width: 1em; height: 1em; display: inline-block;
      vertical-align: -0.15em; object-fit: contain; user-select: none;
    }
    .flag-img { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
    .signal-btn.active {
      background: rgba(0,229,160,0.08);
      border-color: var(--accent);
      color: var(--accent);
      box-shadow: 0 0 12px var(--accent-glow);
    }
    .signal-btn:active { transform: scale(0.95); }
    .signal-btn.no-pos { opacity: 0.2; cursor: not-allowed; pointer-events: none; }

    /* ── Signal zone: distance filter + language filter grouped together ── */
    .signal-group { display: flex; align-items: stretch; gap: 4px; flex-shrink: 0; }
    .signal-group .signal-btn { flex-shrink: 0; }
    /* Non-tesla (phone/desktop): the header doesn't have Tesla's width to
       spare — two buttons push into the absolutely-centred LCD channel
       display and get hidden behind it. Fold distance into the language
       panel instead (see .filter-dist-row) and keep a single button. */
    body:not(.tesla-mode) #signal-btn { display: none; }

    /* ── Language filter picker (bottom sheet, reuses .pin-sheet chrome) ── */
    .lang-filter-title {
      font-size: 15px; font-weight: 700; font-family: var(--f-sans);
      color: var(--text); text-align: center; padding: 4px 0 12px;
    }
    .lang-filter-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
      margin-bottom: 8px;
    }
    .lang-filter-tile {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 4px; min-height: 72px; padding: 10px 6px;
      background: var(--surface2); color: var(--text);
      border: 1px solid var(--border); border-radius: var(--r-sm);
      cursor: pointer; font-family: var(--f-mono);
    }
    .lang-filter-tile:active { background: var(--surface3); transform: scale(0.97); }
    .lang-filter-tile.active {
      border-color: var(--accent); color: var(--accent);
      background: rgba(0,229,160,0.08); box-shadow: 0 0 12px var(--accent-glow);
    }
    .lang-filter-tile .lf-icon  { font-size: 32px; line-height: 1; }
    .lang-filter-tile .lf-label { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }

    /* Distance section folded into the same panel on non-tesla — Tesla
       keeps its own dedicated SIGNAL header button, so hide it there. */
    .filter-dist-title {
      font-size: 12px; font-weight: 700; letter-spacing: 1px;
      color: var(--text-sec); text-align: center; padding: 0 0 8px;
      font-family: var(--f-mono);
    }
    .filter-dist-row {
      display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
      margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
    }
    .filter-dist-chip {
      min-width: 46px; padding: 10px 6px;
      background: var(--surface2); color: var(--text);
      border: 1px solid var(--border); border-radius: var(--r-sm);
      font-family: var(--f-mono); font-size: 13px; font-weight: 700;
      cursor: pointer;
    }
    .filter-dist-chip:active { background: var(--surface3); transform: scale(0.97); }
    .filter-dist-chip.active {
      border-color: var(--accent); color: var(--accent);
      background: rgba(0,229,160,0.08); box-shadow: 0 0 12px var(--accent-glow);
    }
    body.tesla-mode .filter-dist-title,
    body.tesla-mode .filter-dist-row { display: none; }
    /* Tesla : panneau filtre langue ancré en haut à gauche, sous le header —
       proche du bouton LANGUE qui l'ouvre, plus facile à atteindre en
       conduisant que le centre/bas de l'écran. */
    body.tesla-mode #lang-filter-backdrop {
      align-items: flex-start;
      justify-content: flex-start;
    }
    body.tesla-mode #lang-filter-backdrop .pin-sheet {
      margin: 84px 0 0 16px;
      max-width: 420px;
      border-radius: 16px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    }

    .hdr-pill {
      display: flex; align-items: center; gap: 6px;
      background: var(--surface2); border: 1px solid var(--border);
      border-radius: 20px; padding: 6px 12px;
      font-size: 14px; font-weight: 700; font-family: var(--f-mono);
    }
    .spacer { flex: 1; }

    .btn-quit {
      background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm);
      color: var(--text-sec); font-family: var(--f-mono);
      height: 36px; padding: 0 8px; cursor: pointer;
      transition: all 0.2s; flex-shrink: 0;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 1px; line-height: 1;
    }
    .btn-quit .quit-icon  { font-size: 16px; line-height: 1; }
    .btn-quit .quit-label { font-size: 8px; letter-spacing: 0.5px; opacity: 0.7; font-weight: 800; text-transform: uppercase; }
    .btn-quit:hover { border-color: var(--danger); color: var(--danger); background: rgba(255,68,85,0.05); }
    .btn-quit:active { transform: scale(0.95); }

    /* ═══════════════════════════════════════════════════════════════
       TAB BAR
    ═══════════════════════════════════════════════════════════════ */
    .tab-bar { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; padding: 0 8px; }
    .tab-btn {
      flex: 1; height: 56px; background: transparent; border: none;
      border-bottom: 2px solid transparent; color: var(--text-sec);
      font-size: 15px; font-weight: 800; font-family: var(--f-sans);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      gap: 8px; transition: all 0.2s; letter-spacing: 1px;
    }
    .tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(0,229,160,0.03); }
    .tab-icon       { font-size: 18px; }
    .tab-badge {
      background: var(--danger); color: #fff;
      font-size: 10px; font-weight: 900; border-radius: 10px;
      padding: 2px 6px; min-width: 18px; text-align: center; line-height: 14px;
      font-family: var(--f-mono);
    }
    .tab-badge.hidden { display: none; }
    /* Notif "messages épinglés non lus" sur l'onglet chat (CB mobile) */
    .tab-btn { position: relative; }
    .tab-btn.has-pinned::after {
      content: url('/assets/icons/pushpin.svg');
      position: absolute; top: 6px; right: 10px;
      width: 12px; height: 12px;
      filter: drop-shadow(0 0 6px var(--accent-glow));
      animation: pin-tab-pulse 1.6s ease-in-out infinite;
    }
    .tab-btn.has-pinned:not(.active) {
      background: rgba(0,229,160,0.08);
    }
    @keyframes pin-tab-pulse {
      0%, 100% { transform: scale(1);   opacity: 0.85; }
      50%      { transform: scale(1.25); opacity: 1; }
    }

    /* ═══════════════════════════════════════════════════════════════
       VIEWS
    ═══════════════════════════════════════════════════════════════ */
    .view { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }
    .view.hidden { display: none; }

    /* ═══════════════════════════════════════════════════════════════
       MAP VIEW
    ═══════════════════════════════════════════════════════════════ */
    #map { flex: 1; width: 100%; }
    /* OSM tiles inverted → dark mode (no API key, always available) */
    .leaflet-tile-pane     { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }
    .leaflet-container     { background: #0A0A0A; }
    .leaflet-popup-content-wrapper {
      background: var(--surface2); color: var(--text);
      border: 1px solid var(--border); border-radius: var(--r-sm);
      font-family: var(--f-sans); font-size: 14px; font-weight: 700;
      box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    }
    .leaflet-popup-tip            { background: var(--surface2); }
    .leaflet-popup-close-button   { color: var(--text-sec) !important; font-size: 16px !important; }

    /* Members overlay */
    .members-overlay {
      position: absolute; top: 12px; left: 12px; z-index: 1000;
      background: rgba(20,21,23,0.85); backdrop-filter: blur(12px);
      border: 1px solid var(--border); border-radius: var(--r);
      padding: 14px 16px; max-width: 230px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    }
    /* Tesla mode = 15" screen → enlarge the members overlay so it's easy
       to glance at while driving. */
    body.tesla-mode .members-overlay { padding: 18px 22px; max-width: 320px; }
    body.tesla-mode .overlay-title   { font-size: 13px; margin-bottom: 14px; }
    body.tesla-mode .member-row      { font-size: 17px; padding: 8px 0; gap: 12px; }
    body.tesla-mode .member-dot      { width: 12px; height: 12px; }
    body.tesla-mode .member-me       { font-size: 12px; }
    body.tesla-mode .member-dist,
    body.tesla-mode .member-eta      { font-size: 14px; }
    body.tesla-mode .member-voice,
    body.tesla-mode .member-hp-off   { font-size: 17px; }
    .overlay-title { font-size: 10px; font-weight: 800; color: var(--text-sec); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; font-family: var(--f-mono); }
    .member-row    { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; font-weight: 700; transition: opacity 0.2s; font-family: var(--f-sans); }
    .member-row.dimmed { opacity: 0.3; }
    .member-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.2); }
    .member-name   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
    .member-me     { font-size: 10px; font-weight: 800; color: var(--accent); flex-shrink: 0; text-transform: uppercase; font-family: var(--f-mono); }
    .member-hp-off { font-size: 12px; flex-shrink: 0; opacity: 0.6; }
    .members-sep   { height: 1px; background: var(--border); margin: 6px 0; }
    .member-dist   { font-size: 11px; font-weight: 700; color: var(--text-sec); flex-shrink: 0; margin-left: auto; font-family: var(--f-mono); }
    .member-eta    { font-size: 11px; font-weight: 700; color: var(--text-sec); flex-shrink: 0; font-family: var(--f-mono); padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.05); }
    .member-eta.ahead   { color: var(--accent); }
    .member-eta.behind  { color: #ffb454; }
    .member-voice  { font-size: 14px; flex-shrink: 0; opacity: 0.15; transition: all 0.2s; }
    /* filter:drop-shadow (not text-shadow/color) so the glow still applies
       now that this is an <img> rather than a colorable text glyph. */
    .member-voice.active { opacity: 1; filter: drop-shadow(0 0 8px var(--accent-glow)); animation: micPulse 0.8s ease-in-out infinite alternate; }
    @keyframes micPulse { from { transform: scale(1); } to { transform: scale(1.25); } }

    /* Connection icon (spec: specs/connection-icons-spec.md) */
    .member-conn {
      position: relative; flex-shrink: 0; font-size: 15px; line-height: 1;
      display: inline-flex; align-items: center; user-select: none;
    }
    .member-conn.clickable { cursor: pointer; transition: transform 0.1s; }
    .member-conn.clickable:hover { transform: scale(1.15); }
    .member-conn-audio { font-size: 10px; margin-left: -1px; vertical-align: super; }
    .member-conn-tint {
      position: absolute; right: -3px; bottom: -2px;
      width: 8px; height: 8px; border-radius: 50%;
      border: 1.5px solid var(--surface2, #222);
      box-shadow: 0 1px 2px rgba(0,0,0,0.4);
      pointer-events: none;
    }
    body.tesla-mode .member-conn       { font-size: 18px; }
    body.tesla-mode .member-conn-tint  { width: 10px; height: 10px; }
    body.tesla-mode .member-conn-audio { font-size: 12px; }

    /* Tesla color picker */
    .tesla-picker {
      position: fixed; z-index: 3000;
      background: var(--surface2, #1e1e1e);
      border: 1px solid var(--border, #333);
      border-radius: var(--r, 10px);
      padding: 14px; min-width: 220px;
      box-shadow: 0 8px 28px rgba(0,0,0,0.65);
      font-family: var(--font);
    }
    .tesla-picker-title {
      font-size: 11px; font-weight: 800; color: var(--text-sec, #999);
      text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px;
    }
    .tesla-picker-grid {
      display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
    }
    .tesla-swatch {
      width: 34px; height: 34px; border-radius: 50%;
      border: 2px solid var(--border, #333);
      cursor: pointer; padding: 0; position: relative;
      transition: transform 0.1s, box-shadow 0.1s;
    }
    .tesla-swatch:hover { transform: scale(1.12); }
    .tesla-swatch.selected {
      border-color: var(--accent, #00E5A0);
      box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.35);
    }
    .tesla-swatch.selected::after {
      content: '✓'; position: absolute; inset: 0;
      display: flex; align-items: center; justify-content: center;
      color: #fff; font-size: 15px; font-weight: 900;
      text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    }
    .tesla-picker-clear {
      display: block; margin-top: 12px; width: 100%;
      background: transparent; border: 1px solid var(--border, #333);
      color: var(--text-sec, #999);
      font-family: var(--font); font-size: 11px; font-weight: 700;
      padding: 7px; border-radius: 6px; cursor: pointer;
      text-transform: uppercase; letter-spacing: 1px;
    }
    .tesla-picker-clear:hover { color: var(--text, #fff); border-color: var(--text-sec, #999); }
    /* Tesla model picker (row of 5 chips: S · 3 · X · Y · CT) */
    .tesla-model-section { margin-top: 14px; }
    .tesla-model-grid {
      display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
    }
    .tesla-model-chip {
      height: 34px; min-width: 34px; border-radius: 17px;
      background: var(--surface3, #2a2a2a);
      border: 2px solid var(--border, #333);
      color: var(--text, #fff);
      font-family: var(--f-mono); font-weight: 900; font-size: 14px;
      cursor: pointer; padding: 0 6px;
      transition: transform 0.1s, border-color 0.1s, background 0.15s;
    }
    .tesla-model-chip:hover { transform: scale(1.06); }
    .tesla-model-chip.selected {
      background: var(--accent, #00E5A0); color: #000;
      border-color: var(--accent, #00E5A0);
      box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.35);
    }

    /* Road Trip Timeline Mode */
    .members-overlay.road-trip-mode {
      height: calc(100vh - 200px);
      max-height: 600px;
      width: 390px;
      max-width: calc(100vw - 24px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      padding: 14px 16px 0 16px;
    }
    .overlay-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }
    .overlay-header .overlay-title { margin-bottom: 0; }

    #rt-panel {
      position: absolute;
      bottom: 20px;
      left: 12px;
      width: 390px;
      max-width: calc(100vw - 24px);
      z-index: 1000;
      background: rgba(20,21,23,0.85);
      backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 14px 16px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5);
      display: none;
      flex-direction: column;
      gap: 8px;
    }
    #rt-panel:not(.hidden) {
      display: flex;
    }
    #rt-panel.in-tab {
      position: static;
      width: 100%;
      max-width: none;
      box-shadow: none;
      border: 1px solid var(--border);
      background: var(--surface2);
      backdrop-filter: none;
      padding: 16px;
      margin: 0;
    }
    #rt-search-view { display: flex; flex-direction: column; gap: 8px; }
    #rt-search-view.hidden, #rt-active-view.hidden { display: none; }
    .rt-search-row { display: flex; gap: 8px; }
    #rt-search-input {
      flex: 1; background: var(--surface2); border: 1px solid var(--border);
      color: var(--text); padding: 6px 10px; border-radius: 4px; font-size: 12px;
    }
    #rt-search-btn {
      background: var(--surface2); border: 1px solid var(--border);
      color: var(--text); padding: 6px 10px; border-radius: 4px; cursor: pointer;
    }
    
    #rt-search-modal {
      position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
      background: rgba(0,0,0,0.8); z-index: 3000;
      display: flex; justify-content: center; align-items: center;
    }
    #rt-search-modal.hidden { display: none; }
    .rt-search-modal-content {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--r); width: 90%; max-width: 500px;
      max-height: 80vh; display: flex; flex-direction: column;
      box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    }
    .rt-search-modal-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 16px; border-bottom: 1px solid var(--border);
    }
    .rt-search-modal-header h3 { margin: 0; font-size: 18px; color: var(--text); }
    #rt-search-modal-close {
      background: transparent; border: none; color: var(--text-sec);
      font-size: 24px; cursor: pointer;
    }
    #rt-search-modal-results {
      padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
    }
    .rt-modal-result-item {
      padding: 16px; background: var(--surface2); border-radius: 8px;
      cursor: pointer; font-size: 16px; border: 1px solid transparent;
    }
    .rt-modal-result-item:hover { background: var(--surface3); border-color: var(--accent); }

    #rt-active-view { display: flex; flex-direction: column; gap: 8px; }
    .rt-dest-label { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rt-eta-line {
      font-size: 12px; font-weight: 700; color: var(--text);
      font-family: var(--f-mono); letter-spacing: 0.3px;
      display: flex; align-items: center; gap: 6px;
    }
    .rt-eta-line.hidden { display: none; }
    .rt-eta-sep { color: var(--text-dim); }
    .rt-eta-fallback {
      display: none; color: var(--text-dim); font-size: 10px;
      border: 1px solid var(--border); padding: 0 4px; border-radius: 4px;
    }
    .rt-eta-line.approx .rt-eta-fallback { display: inline; }
    #rt-cancel-btn {
      background: var(--surface2); border: 1px solid var(--border);
      color: var(--text-sec); font-size: 10px; padding: 4px 8px;
      border-radius: 4px; cursor: pointer; text-transform: uppercase; font-weight: 800;
      align-self: flex-start;
    }

    /* Tesla mode: trip panel content is too small to read/tap while driving. */
    body.tesla-mode #rt-panel        { padding: 18px 22px; gap: 12px; }
    body.tesla-mode .rt-dest-label   { font-size: 22px; }
    body.tesla-mode .rt-eta-line     { font-size: 20px; gap: 10px; }
    body.tesla-mode .rt-eta-fallback { font-size: 14px; padding: 1px 6px; }
    body.tesla-mode #rt-cancel-btn   {
      font-size: 14px; padding: 10px 18px; border-radius: 6px;
    }
    body.tesla-mode #rt-search-input {
      font-size: 18px; padding: 12px 14px; border-radius: 6px;
    }
    body.tesla-mode #rt-search-btn   {
      font-size: 18px; padding: 12px 16px; border-radius: 6px;
    }
    body.tesla-mode .rt-modal-result-item { font-size: 20px; padding: 20px; }
    body.tesla-mode .rt-search-modal-header h3 { font-size: 22px; }

    .members-overlay.road-trip-mode #members-list {
      flex: 1;
      position: relative;
      overflow: hidden;
      margin-left: -16px;
      margin-right: -16px;
      padding-left: 16px;
      padding-right: 16px;
    }
    
    .timeline-track {
      position: absolute;
      left: 20px;
      top: 10px;
      bottom: 10px;
      width: 2px;
      background: var(--border);
      z-index: 1;
    }
    .timeline-node {
      position: absolute;
      left: 16px;
      display: flex;
      align-items: center;
      transition: top 0.5s ease;
      z-index: 2;
      width: calc(100% - 32px);
    }
    .timeline-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      border: 2px solid var(--surface);
      flex-shrink: 0;
      z-index: 2;
    }
    .timeline-content {
      margin-left: 12px;
      background: rgba(0,0,0,0.6);
      padding: 4px 8px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 1;
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .timeline-node.disconnected .timeline-content {
      font-style: italic;
      opacity: 0.6;
    }

    .finish-flag { font-size: 32px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }

    /* Active-state panel must stretch its children full width, otherwise the
       timeline track and rtPanel shrink to content width (align-items:center
       is inherited from .trip-state-panel and suits the empty state only). */
    #trip-active-state { align-items: stretch; justify-content: flex-start; }

    /* ── CB tips panel (bottom-left of the map, dismissable) ──────────── */
    #tips-panel {
      position: absolute; bottom: 20px; left: 20px;
      width: 320px; max-width: calc(100vw - 40px);
      background: rgba(20, 21, 23, 0.92);
      border: 1px solid var(--accent);
      border-radius: var(--r);
      padding: 14px 16px 14px;
      box-shadow: 0 10px 32px rgba(0,0,0,0.6);
      backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
      /* Above the PTT (mic/HP) controls on mobile — sits in foreground until
         the user dismisses it. Single-shot UX (never re-shown after dismiss). */
      z-index: 1100;
    }
    #tips-panel.hidden { display: none; }
    /* Visible only when on CB and not dismissed. */
    body:not(.cb-channel) #tips-panel,
    body.tips-dismissed   #tips-panel { display: none; }
    .tips-header {
      font-size: 13px; font-weight: 800; color: var(--accent);
      font-family: var(--f-mono); letter-spacing: 1px;
      text-transform: uppercase; margin-bottom: 10px;
      padding-right: 26px; /* room for close X */
    }
    .tips-close {
      position: absolute; top: 6px; right: 8px;
      background: transparent; border: none;
      color: var(--text-sec); font-size: 22px; line-height: 1;
      padding: 4px 8px; cursor: pointer;
      transition: color 0.15s;
    }
    .tips-close:hover { color: var(--text); }
    .tips-viewport { overflow: hidden; min-height: 78px; }
    .tips-track {
      display: flex; transition: transform 0.25s ease;
      will-change: transform;
    }
    .tip-slide {
      flex: 0 0 100%; min-width: 0;
      display: flex; gap: 10px; align-items: flex-start;
      font-size: 12px; color: var(--text-sec); line-height: 1.45;
      padding-right: 4px;
    }
    .tip-icon { font-size: 26px; flex-shrink: 0; line-height: 1; margin-top: 1px; }
    .tip-text strong { color: var(--text); font-weight: 800; }
    .tip-text em     { color: var(--accent); font-style: normal; font-weight: 700; }
    .tips-nav {
      display: flex; align-items: center; justify-content: space-between;
      margin-top: 10px; padding-top: 8px;
      border-top: 1px solid var(--border);
    }
    .tips-arrow {
      background: transparent; border: 1px solid var(--border);
      color: var(--text-sec); width: 28px; height: 28px;
      border-radius: 50%; cursor: pointer;
      font-size: 18px; line-height: 1;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
    }
    .tips-arrow:hover   { color: var(--accent); border-color: var(--accent); }
    .tips-arrow:active  { transform: scale(0.92); }
    .tips-arrow[disabled] { opacity: 0.3; cursor: default; }
    .tips-dots { display: flex; gap: 7px; }
    .tips-dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: var(--surface3); cursor: pointer;
      transition: background 0.15s, transform 0.15s;
    }
    .tips-dot.active { background: var(--accent); transform: scale(1.3); }
    body.tesla-mode #tips-panel { width: 420px; padding: 20px 22px; }
    body.tesla-mode .tips-header { font-size: 15px; }
    body.tesla-mode .tip-slide   { font-size: 15px; }
    body.tesla-mode .tip-icon    { font-size: 30px; }
    body.tesla-mode .tips-close  { font-size: 26px; }
    body.tesla-mode .tips-viewport { min-height: 96px; }
    body.tesla-mode .tips-arrow  { width: 34px; height: 34px; font-size: 22px; }
    body.tesla-mode .tips-dot    { width: 9px; height: 9px; }

    #road-trip-btn { bottom: 20px; left: 20px; display: none; }
    #road-trip-btn.visible { display: flex; }
    #road-trip-btn.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 15px var(--accent-glow); }
    /* Private-channel callout: fill the trip button green so the driver
       notices the road-trip feature (same idea as the chat-toggle-btn that
       turns green when the chat panel is hidden). Toned down once the trip
       panel is actually open / active (.active state above wins). */
    body.private-channel #road-trip-btn.visible:not(.active) {
      background: var(--accent); color: #000;
      border-color: var(--accent);
      box-shadow: 0 0 14px var(--accent-glow);
    }

    /* GPS / Map controls */
    .gps-warning {
      position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
      z-index: 1000; background: rgba(255,68,85,0.95); color: #fff;
      font-size: 12px; font-weight: 800; padding: 8px 20px; border-radius: 20px;
      display: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
      border: 1px solid rgba(255,255,255,0.2); font-family: var(--f-sans);
      cursor: pointer;
    }
    .gps-warning.tappable::after { content: ' ›'; opacity: 0.85; }

    /* ── GPS help modal (reuses the .pin-sheet chrome) ── */
    .gps-help-title { font-size: 16px; font-weight: 800; font-family: var(--f-sans); padding: 4px 0 10px; text-align: center; }
    .gps-help-steps {
      font-size: 14px; line-height: 1.55; color: var(--text-sec);
      background: var(--surface2); border-radius: var(--r-sm);
      padding: 12px 14px; margin-bottom: 12px; white-space: pre-line;
    }
    .map-btn {
      position: absolute; z-index: 1000;
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
      color: var(--text); font-size: 24px; width: 56px; height: 56px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
      transition: all 0.15s;
    }
    .map-btn:active { transform: scale(0.92); background: var(--surface2); }
    #locate-btn { bottom: 20px; right: 20px; }

    /* Bouton audio split HP 📻 | Mic 🎙️ — phone, et Tesla si micro navigateur dispo */
    #ptt-wrap {
      position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
      z-index: 1000; display: none;
      flex-direction: row; gap: 4px;
      background: #000; border: 1px solid var(--border); border-radius: 44px; padding: 4px;
      box-shadow: 0 12px 32px rgba(0,0,0,0.7);
    }
    .ptt-half {
      width: 72px; height: 72px; border: none; cursor: pointer;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      font-size: 28px; transition: all 0.15s; border-radius: 36px;
      position: relative; overflow: hidden;
    }
    .ptt-half::after {
      content: ""; position: absolute; inset: 0;
      background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
      pointer-events: none;
    }
    .ptt-half:active { transform: scale(0.94); filter: brightness(0.8); }
    .ptt-half.on  { background: #27ae60; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 15px rgba(39,174,96,0.3); }
    .ptt-half.off { background: #c0392b; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }
    #mic-btn.off  { opacity: 0.8; }
    /* Tesla : boutons HP/Mic ~3x plus larges (même hauteur) pour rester
       faciles à toucher en conduisant — oblongs plutôt que ronds. */
    body.tesla-mode .ptt-half { width: 216px; border-radius: 36px; }

    /* Car markers */
    .car-pin { display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
    /* Filtre (distance ou langue, dans un sens ou l'autre) actif : le membre
       reste visible sur la carte mais estompé — jamais masqué, contrairement
       au chat, la position reste utile pour l'orientation générale. */
    .car-pin.filter-faded { opacity: 0.4; filter: saturate(0.25); transition: opacity 0.3s ease, filter 0.3s ease; }
    .car-pin .icon { font-size: 32px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
    .car-pin .tag  {
      font-size: 10px; font-weight: 800; font-family: var(--f-mono);
      padding: 3px 10px; border-radius: 12px; white-space: nowrap;
      color: #000; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
      border: 1px solid rgba(0,0,0,0.1);
    }
    .car-pin .speak-ring {
      position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
      width: 48px; height: 48px; border-radius: 50%;
      border: 2px solid var(--voice);
      animation: speakRing 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
      pointer-events: none;
    }
    .car-pin .tesla-tint {
      position: absolute; top: -4px; right: 0;
      width: 26px; height: 26px; border-radius: 50%;
      border: 2px solid #fff;
      box-shadow: 0 2px 4px rgba(0,0,0,0.5);
      pointer-events: none;
      display: flex; align-items: center; justify-content: center;
      font-family: var(--f-sans); font-weight: 900; font-size: 14px;
      line-height: 1; letter-spacing: 0;
    }
    .car-pin .tesla-tint.has-ct { font-size: 11px; letter-spacing: -0.5px; }
    /* Tesla screen is far + glossy — larger badge with stronger contrast */
    body.tesla-mode .car-pin .tesla-tint {
      width: 32px; height: 32px;
      font-size: 18px;
      border-width: 3px;
      top: -6px; right: -2px;
    }
    body.tesla-mode .car-pin .tesla-tint.has-ct { font-size: 14px; }
    @keyframes speakRing {
      0%   { transform: translateX(-50%) scale(0.8); opacity: 0.8; border-width: 4px; }
      100% { transform: translateX(-50%) scale(1.8); opacity: 0; border-width: 1px; }
    }

    /* Supercharger markers */
    .sc-pin {
      display: flex; flex-direction: column; align-items: center; gap: 2px;
      cursor: pointer;
    }
    .sc-pin .sc-icon {
      width: 32px; height: 32px; border-radius: 50%;
      background: #E31937; border: 2px solid #fff;
      display: flex; align-items: center; justify-content: center;
      font-size: 16px; line-height: 1;
      box-shadow: 0 4px 12px rgba(227,25,55,0.5);
    }
    .sc-pin .sc-tag {
      font-size: 9px; font-weight: 800; font-family: var(--f-mono);
      padding: 2px 8px; border-radius: 10px; white-space: nowrap;
      background: #E31937; color: #fff;
      box-shadow: 0 4px 8px rgba(0,0,0,0.4); letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    /* Popup Supercharger */
    .sc-popup { min-width: 180px; }
    .sc-popup-name { font-size: 15px; font-weight: 900; color: var(--text); margin-bottom: 4px; }
    .sc-popup-code { font-size: 12px; color: var(--text-sec); margin-bottom: 6px; }
    .sc-popup-code strong { color: #E31937; letter-spacing: 2px; }
    .sc-popup-users {
      font-size: 12px; font-weight: 700; color: #22c55e;
      margin-bottom: 10px; min-height: 0;
      display: flex; align-items: center; gap: 5px;
    }
    .sc-popup-users:empty { margin-bottom: 10px; }
    .sc-join-btn {
      display: block; width: 100%;
      background: #E31937; color: #fff; border: none; border-radius: 8px;
      font-size: 14px; font-weight: 900; font-family: var(--font);
      padding: 10px 0; cursor: pointer; letter-spacing: 0.5px;
      transition: opacity 0.15s;
    }
    .sc-join-btn:active { opacity: 0.75; }
    /* Supercharger actif (du monde connecté sur ce canal) */
    @keyframes sc-pulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.45), 0 2px 8px rgba(34,197,94,0.6); }
      50%       { box-shadow: 0 0 0 7px rgba(34,197,94,0.15), 0 2px 12px rgba(34,197,94,0.8); }
    }
    .sc-pin.sc-active .sc-icon {
      background: #22c55e;
      box-shadow: 0 0 0 3px rgba(34,197,94,0.45), 0 2px 8px rgba(34,197,94,0.6);
      animation: sc-pulse 2.2s ease-in-out infinite;
    }
    .sc-pin.sc-active .sc-tag { background: #22c55e; }
    .sc-badge {
      position: absolute; top: -5px; right: -5px;
      min-width: 17px; height: 17px; border-radius: 9px;
      background: #fff; color: #22c55e;
      font-size: 10px; font-weight: 900; font-family: -apple-system, system-ui, sans-serif;
      display: flex; align-items: center; justify-content: center;
      border: 1.5px solid #22c55e; padding: 0 3px; line-height: 1;
      box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    }

    /* ═══════════════════════════════════════════════════════════════
       CHAT VIEW
    ═══════════════════════════════════════════════════════════════ */
    #chat-view { background: var(--bg); }
    .messages {
      flex: 1; overflow-y: auto; padding: 20px 20px 12px;
      display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
    }
    /* Tesla : messages récents en bas */
    body.tesla-mode .messages { flex-direction: column; }
    .messages::-webkit-scrollbar       { width: 4px; }
    .messages::-webkit-scrollbar-track { background: transparent; }
    .messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

    .msg        { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
    .msg.mine   { align-self: flex-end;   align-items: flex-end; }
    .msg.theirs { align-self: flex-start; align-items: flex-start; }
    .msg-meta   { font-size: 11px; font-weight: 800; opacity: 0.7; font-family: var(--f-mono); text-transform: uppercase; letter-spacing: 0.5px; }
    .msg-bubble { padding: 12px 18px; border-radius: 16px; font-size: 17px; line-height: 1.5; word-break: break-word; font-family: var(--f-sans); }
    .msg.mine   .msg-bubble { background: var(--accent); color: #000; border-bottom-right-radius: 2px; box-shadow: 0 4px 12px var(--accent-glow); font-weight: 600; }
    .msg.theirs .msg-bubble { background: var(--surface2); color: var(--text); border-bottom-left-radius: 2px; border: 1px solid var(--border); }
    /* Filtre langue actif : masque les messages d'un membre dont la langue
       déclarée ne correspond pas au filtre choisi (reste dans le DOM, donc
       réapparaît si le filtre change ensuite). */
    .msg.lang-hidden { display: none; }
    .sys-msg { text-align: center; font-size: 12px; color: var(--text-dim); padding: 4px 0; font-family: var(--f-mono); text-transform: uppercase; letter-spacing: 1px; }

    .chat-bar {
      display: flex; align-items: center; gap: 12px; padding: 12px 16px;
      background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0;
      box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    }
    #chat-input {
      flex: 1; background: var(--surface2); border: 1px solid var(--border);
      border-radius: 24px; color: var(--text); font-size: 16px; font-family: var(--f-sans);
      padding: 0 20px; height: 48px; outline: none;
      text-transform: none; letter-spacing: 0; caret-color: var(--accent);
      transition: all 0.2s;
    }
    #chat-input:focus     { border-color: var(--accent); background: var(--surface3); box-shadow: 0 0 0 3px var(--accent-glow); }
    #chat-input::placeholder { color: var(--text-dim); opacity: 0.6; }
    .btn-send {
      background: var(--accent); border: none; border-radius: 50%;
      width: 48px; height: 48px; font-size: 20px; cursor: pointer; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s; box-shadow: 0 4px 12px var(--accent-glow);
    }
    .btn-send:active { transform: scale(0.9); opacity: 0.8; }

    /* BMC / ToS footer inside chat view */
    #bmc-wrap {
      display: flex; align-items: center; justify-content: center; gap: 16px;
      padding: 5px 16px 6px;
      background: var(--surface); border-top: 1px solid var(--border);
      flex-shrink: 0;
    }
    #bmc-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 6px 14px; border-radius: 20px;
      background: var(--surface2); border: 1px solid var(--border);
      color: var(--text); font-size: 13px; font-weight: 700;
      text-decoration: none; letter-spacing: 0.3px;
      transition: opacity 0.2s;
    }
    #bmc-btn:active { opacity: 0.7; }
    #tos-link {
      font-size: 11px; color: var(--text-dim); text-decoration: none;
      letter-spacing: 0.3px; transition: color 0.15s;
    }
    #tos-link:active { color: var(--text-sec); }

    /* ── Pinned messages panel (public rooms only) ───────────────────── */
    #pinned-panel {
      flex-shrink: 0;
      background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
      border-bottom: 1px solid var(--border);
      max-height: 40vh; overflow-y: auto;
    }
    #pinned-panel.hidden { display: none; }
    .pinned-header {
      display: flex; align-items: center; justify-content: flex-end;
      padding: 4px 10px;
      background: transparent;
      position: sticky; top: 0; z-index: 2;
    }
    .pinned-add-btn {
      background: var(--accent); color: #000; border: none;
      padding: 4px 10px; border-radius: 12px;
      font-size: 11px; font-weight: 900; font-family: var(--f-mono);
      letter-spacing: 0.5px; cursor: pointer;
      box-shadow: 0 2px 6px var(--accent-glow);
      transition: transform 0.1s;
    }
    .pinned-add-btn:active { transform: scale(0.94); }
    .pinned-add-btn[disabled] { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
    .pinned-list {
      display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px;
    }
    .pinned-empty {
      padding: 14px 16px; text-align: center;
      font-size: 13px; color: var(--text-dim); font-style: italic;
    }
    .pinned-item {
      display: flex; gap: 10px; align-items: flex-start;
      padding: 10px 12px;
      background: var(--surface2); border: 1px solid var(--border);
      border-left: 3px solid var(--accent);
      border-radius: var(--r-sm);
      position: relative;
    }
    .pinned-item.mine { border-left-color: var(--accent); }
    .pinned-item-body { flex: 1; min-width: 0; }
    .pinned-item-meta {
      font-size: 10px; font-weight: 800; font-family: var(--f-mono);
      text-transform: uppercase; letter-spacing: 0.5px;
      color: var(--text-sec); margin-bottom: 4px;
    }
    .pinned-item-meta .pinned-author { color: var(--text); }
    .pinned-item-text {
      font-size: 14px; line-height: 1.4; color: var(--text); word-break: break-word;
    }
    .pinned-item-actions {
      display: flex; gap: 4px; flex-shrink: 0;
    }
    .pin-action-btn {
      background: none; border: none; padding: 4px 6px;
      color: var(--text-dim); cursor: pointer; font-size: 14px;
      border-radius: 4px; line-height: 1;
    }
    .pin-action-btn:hover  { color: var(--text); background: var(--surface3); }
    .pin-action-btn:active { transform: scale(0.92); }
    .pin-action-btn.danger:hover { color: var(--danger); }
    body.tesla-mode .pinned-item-text { font-size: 16px; }
    body.tesla-mode #pinned-panel { max-height: 30vh; }

    /* ── Long-press / pin action sheet (overlay) ─────────────────────── */
    .pin-sheet-backdrop {
      position: fixed; inset: 0; background: rgba(0,0,0,0.6);
      z-index: 9000; display: flex; align-items: flex-end; justify-content: center;
      animation: fadeIn 0.15s ease-out;
    }
    .pin-sheet-backdrop.hidden { display: none; }
    .pin-sheet {
      width: 100%; max-width: 480px;
      background: var(--surface); border-top: 1px solid var(--border);
      border-radius: 16px 16px 0 0; padding: 12px;
      box-shadow: 0 -10px 30px rgba(0,0,0,0.6);
    }
    .pin-sheet-preview {
      padding: 10px 12px; margin-bottom: 10px;
      background: var(--surface2); border-radius: var(--r-sm);
      font-size: 13px; color: var(--text-sec); max-height: 80px; overflow: hidden;
    }
    .pin-sheet-btn {
      display: flex; align-items: center; gap: 10px; width: 100%;
      padding: 14px 16px; margin: 0; background: var(--surface2); color: var(--text);
      border: 1px solid var(--border); border-radius: var(--r-sm);
      font-size: 16px; font-weight: 700; font-family: var(--f-sans);
      cursor: pointer; margin-bottom: 6px;
    }
    .pin-sheet-btn:active { background: var(--surface3); }
    .pin-sheet-btn.danger { color: var(--danger); }
    .pin-sheet-btn.primary { background: var(--accent); color: #000; border-color: var(--accent); }
    .pin-sheet-cancel { background: transparent; border: none; color: var(--text-sec); margin-top: 6px; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* ── Pin compose modal (the "+ Épingler" entry point) ────────────── */
    .pin-compose-input {
      width: 100%; min-height: 80px; resize: vertical;
      padding: 10px 12px; margin-bottom: 8px;
      background: var(--surface2); color: var(--text);
      border: 1px solid var(--border); border-radius: var(--r-sm);
      font-size: 15px; font-family: var(--f-sans);
      outline: none; text-transform: none;
    }
    .pin-compose-input:focus { border-color: var(--accent); }
    .pin-compose-counter {
      text-align: right; font-size: 11px; color: var(--text-dim);
      font-family: var(--f-mono); margin-bottom: 8px;
    }
    .pin-compose-counter.over { color: var(--danger); }

    /* ── SC marker badge: pinned message count (bottom-right of icon) ── */
    .sc-pin-badge {
      position: absolute; bottom: -4px; right: -6px;
      min-width: 17px; height: 17px; border-radius: 9px;
      background: var(--accent); color: #000;
      font-size: 10px; font-weight: 900; font-family: -apple-system, system-ui, sans-serif;
      display: flex; align-items: center; justify-content: center;
      padding: 0 4px; line-height: 1;
      box-shadow: 0 1px 4px rgba(0,0,0,0.5);
      border: 1.5px solid #0a0a0a;
    }
    .sc-pin-badge::before {
      content: url('/assets/icons/pushpin.svg');
      display: inline-block; width: 8px; height: 8px; margin-right: 2px;
      vertical-align: -1px;
    }

    /* Footer mentions légales sur l'écran d'accueil */
    .join-footer {
      margin-top: 18px; padding: 12px 0 4px; text-align: center;
      border-top: 1px solid var(--border);
    }
    .join-footer a {
      font-size: 12px; color: var(--text-dim); text-decoration: none;
      letter-spacing: 0.3px; transition: color 0.15s;
    }
    .join-footer a:hover,
    .join-footer a:active { color: var(--text-sec); text-decoration: underline; }

    /* ═══════════════════════════════════════════════════════════════
       SWITCH CHANNEL PANEL
    ═══════════════════════════════════════════════════════════════ */
    .panel-backdrop {
      position: fixed; inset: 0; z-index: 200;
      background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    }
    .panel-backdrop.hidden { display: none; }

    /* Dropdown ancré sous le nom du canal (haut-gauche), pas en bas d'écran */
    .panel {
      position: fixed;
      top: 72px; /* juste sous le header (68px) */
      left: 50%; transform: translateX(-50%);
      width: min(420px, calc(100vw - 24px));
      z-index: 201;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px 20px 20px;
      max-height: 52vh; overflow-y: auto;
      box-shadow: 0 8px 40px rgba(0,0,0,0.55);
    }
    .panel.hidden { display: none; }
    /* Tesla : largeur plus généreuse sur grand écran */
    body.tesla-mode .panel { width: min(480px, 40vw); }

    /* Identity row at the top of the channel switch panel — replaces the
       handle in the header bar on mobile. */
    .panel-handle-row {
      display: flex; align-items: center; gap: 8px;
      padding: 4px 4px 12px; margin: 0 0 8px;
      border-bottom: 1px solid var(--border);
      font-family: var(--f-mono); font-size: 12px;
      color: var(--text-sec); text-transform: uppercase; letter-spacing: 1px;
    }
    .panel-handle-row .panel-handle-icon { font-size: 16px; }
    .panel-handle-row .panel-handle-name {
      color: var(--text); font-weight: 700; letter-spacing: 0.5px;
      text-transform: none; font-family: var(--f-sans); font-size: 15px;
    }
    /* "💡 Astuces" link on the right of the handle row — only shown when
       the user has dismissed the tips at least once. Click → re-enables;
       tips will appear the next time the user is on CB (or immediately
       if they're on CB right now and reopen the map). */
    .panel-tips-restore {
      margin-left: auto;
      background: transparent;
      border: 1px solid var(--border);
      color: var(--accent);
      font-family: var(--f-mono); font-size: 11px; font-weight: 700;
      letter-spacing: 0.5px;
      padding: 4px 10px; border-radius: 12px;
      cursor: pointer; white-space: nowrap;
      transition: background 0.15s, border-color 0.15s;
    }
    .panel-tips-restore:hover {
      border-color: var(--accent);
      background: rgba(0,229,160,0.08);
    }
    .panel-tips-restore:active { transform: scale(0.96); }
    /* Show only when on CB *and* the user has dismissed the tips. Pointless
       on private (no tips there, the trip panel takes the bottom-left) or
       SuC (tips currently CB-only). */
    body:not(.tips-dismissed) .panel-tips-restore,
    body:not(.cb-channel)     .panel-tips-restore { display: none; }
    .panel-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 14px;
    }
    .panel-title { font-size: 17px; font-weight: 900; color: var(--text-sec); text-transform: uppercase; letter-spacing: 1px; }
    .btn-panel-close {
      background: var(--surface2); border: none; border-radius: 50%;
      width: 40px; height: 40px; font-size: 18px; cursor: pointer;
      color: var(--text-sec); display: flex; align-items: center; justify-content: center;
    }

    .panel-input-row { display: flex; gap: 12px; align-items: stretch; }
    .panel-input-row input.txt { font-size: 22px; height: 72px; flex: 1; }
    .btn-join-panel {
      background: var(--accent); color: #000; border: none; border-radius: var(--r);
      font-size: 18px; font-weight: 900; font-family: var(--font);
      padding: 0 24px; height: 72px; cursor: pointer;
      display: flex; align-items: center; gap: 8px; white-space: nowrap;
      transition: opacity 0.15s;
    }
    .btn-join-panel:active { opacity: 0.75; }

    .recents-label {
      font-size: 11px; font-weight: 800; color: var(--text-dim);
      text-transform: uppercase; letter-spacing: 2px;
      margin: 22px 0 12px;
    }

    .ch-row {
      display: flex; align-items: center; gap: 14px;
      padding: 14px 0; border-bottom: 1px solid var(--border);
      cursor: pointer; transition: opacity 0.15s;
    }
    .ch-row:last-child { border-bottom: none; }
    .ch-row:active { opacity: 0.6; }
    .ch-code  { font-size: 22px; font-weight: 900; letter-spacing: 3px; color: var(--text); min-width: 80px; }
    /* CB recent entry: text in the LCD's green tone, no chip. */
    .ch-code.ch-lcd { color: #8FBE2C; }
    .ch-active   { font-size: 13px; font-weight: 700; color: var(--accent); }
    .ch-inactive { font-size: 13px; font-weight: 700; color: var(--text-dim); }
    .ch-spacer   { flex: 1; }

    .no-recents { font-size: 15px; color: var(--text-dim); padding: 12px 0; text-align: center; }

    /* ══════════════════════════════════════════════════════════════
       TESLA SPLIT LAYOUT
    ══════════════════════════════════════════════════════════════ */
    body.tesla-mode #main-screen {
      display: grid;
      grid-template-rows: auto 1fr;
      grid-template-columns: 70fr 30fr;
    }
    body.tesla-mode .header {
      grid-column: 1 / -1;
      grid-row: 1;
      height: 72px;
    }
    body.tesla-mode .tab-bar { display: none; }

    body.tesla-mode #map-view {
      grid-column: 1;
      grid-row: 2;
      display: flex !important;
      border-right: 1px solid var(--border);
    }
    body.tesla-mode #chat-view {
      grid-column: 2;
      grid-row: 2;
      display: flex !important;
      background: #0D0E10;
    }

    body.tesla-mode .messages {
      padding: 24px;
    }
    body.tesla-mode #chat-input {
      font-size: 20px;
      height: 64px;
      border-radius: 32px;
    }
    body.tesla-mode .btn-send {
      width: 64px;
      height: 64px;
      font-size: 24px;
    }
    body.tesla-mode .msg-bubble { font-size: 20px; padding: 14px 20px; }
    body.tesla-mode .msg-meta   { font-size: 12px; }

    /* Bannière audio Tesla — texte sur une ligne, CTA en dessous */
    .tesla-audio-banner {
      display: none; /* masquée par défaut et sur téléphone */
      flex-direction: column; align-items: stretch; gap: 10px;
      padding: 12px 16px;
      background: rgba(227,25,55,0.10);
      border-bottom: 1px solid rgba(227,25,55,0.25);
      font-size: 13px; font-weight: 600; color: #ff6680; line-height: 1.4;
      flex-shrink: 0;
      position: relative;
    }
    .tesla-audio-banner .ab-row { display: flex; align-items: flex-start; gap: 10px; padding-right: 24px; }
    .tesla-audio-banner .tab-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
    .tesla-audio-banner .ab-text { flex: 1; }
    .tesla-audio-banner .ab-cta {
      align-self: center;
      background: var(--accent); color: #000; border: none;
      padding: 10px 18px; border-radius: 14px;
      font-size: 14px; font-weight: 900; font-family: var(--f-mono);
      letter-spacing: 0.5px; cursor: pointer;
      box-shadow: 0 2px 6px var(--accent-glow);
      transition: transform 0.1s;
      white-space: nowrap;
    }
    .tesla-audio-banner .ab-cta:active { transform: scale(0.94); }
    .tesla-audio-banner .ab-dismiss {
      position: absolute; top: 6px; right: 8px;
      background: transparent; border: none;
      color: #ff6680; font-size: 18px; line-height: 1;
      padding: 4px 6px; cursor: pointer;
      opacity: 0.6; transition: opacity 0.15s;
    }
    .tesla-audio-banner .ab-dismiss:hover { opacity: 1; }
    body.tesla-mode .tesla-audio-banner { display: flex; }
    /* Masquée dès qu'un téléphone companion est connecté ou que l'utilisateur a fermé */
    body.tesla-mode.has-companion .tesla-audio-banner,
    body.tesla-mode.has-tesla-mic .tesla-audio-banner,
    body.tesla-mode .tesla-audio-banner.dismissed { display: none; }

    /* QR modal (📱 Connecter mon mobile) */
    .qr-modal-bd {
      position: fixed; inset: 0; background: rgba(0,0,0,0.75);
      z-index: 9500; display: flex; align-items: center; justify-content: center;
      padding: 20px;
    }
    .qr-modal-bd.hidden { display: none; }
    .qr-modal {
      width: 100%; max-width: 340px;
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 16px; padding: 22px;
      box-shadow: 0 16px 48px rgba(0,0,0,0.7);
      text-align: center;
    }
    .qr-modal h3 {
      font-size: 18px; font-weight: 900; color: var(--text);
      margin: 0 0 8px; font-family: var(--f-sans);
    }
    .qr-modal p {
      font-size: 13px; color: var(--text-sec); margin: 0 0 16px;
      line-height: 1.5;
    }
    .qr-modal img {
      display: block; margin: 0 auto 16px;
      width: 240px; height: 240px;
      background: #fff; padding: 8px; border-radius: 8px;
    }
    .qr-modal .qr-close {
      width: 100%; background: var(--surface2); border: 1px solid var(--border);
      color: var(--text); padding: 12px; border-radius: var(--r-sm);
      font-size: 14px; font-weight: 800; cursor: pointer;
    }
    .qr-modal .qr-close:active { transform: scale(0.98); }

    /* Message bubbles slightly larger on Tesla */
    body.tesla-mode .msg-bubble   { font-size: 22px; padding: 16px 22px; }
    body.tesla-mode .msg-meta     { font-size: 13px; }
    body.tesla-mode .sys-msg      { font-size: 14px; }

    /* ── Tesla mode specific ── */
    body.tesla-mode #main-screen {
      display: grid;
      grid-template-rows: auto 1fr;
      grid-template-columns: 1fr 380px;
      transition: grid-template-columns 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }
    body.tesla-mode.chat-hidden #main-screen {
      grid-template-columns: 1fr 0px;
    }
    body.tesla-mode #chat-view {
      grid-column: 2;
      grid-row: 2;
      display: flex !important;
      background: #0D0E10;
      border-left: 1px solid var(--border);
      transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
      overflow: hidden;
    }
    body.tesla-mode.chat-hidden #chat-view {
      transform: translateX(100%);
      opacity: 0;
      pointer-events: none;
      border-left: none;
    }

    /* Header buttons — chat toggle + QR pairing (both Tesla-only) */
    #chat-toggle-btn, #qr-header-btn {
      background: var(--surface2); border: 1.5px solid var(--accent);
      color: var(--accent);
      width: 48px; height: 48px; border-radius: var(--r-sm);
      display: flex; align-items: center; justify-content: center;
      font-size: 22px; cursor: pointer; flex-shrink: 0;
      transition: all 0.15s;
    }
    #chat-toggle-btn:active, #qr-header-btn:active { transform: scale(0.95); }
    body:not(.tesla-mode) #chat-toggle-btn,
    body:not(.tesla-mode) #qr-header-btn { display: none; }
    /* Chat-toggle gets a brief green-fill "attention" pulse for 10 s when
       the chat is hidden (initial hide) OR when a new message arrives while
       the chat stays hidden. Otherwise stays outlined-accent → less
       distracting while driving. */
    body.tesla-mode.chat-hidden #chat-toggle-btn.attention {
      background: var(--accent); color: #000;
      box-shadow: 0 0 12px var(--accent-glow);
    }
    /* QR pairing button: hide as soon as a companion phone joins. */
    body.tesla-mode.has-companion #qr-header-btn { display: none; }

    /* ── Tesla mode: enlarge the header controls (~+25%) for in-car reach.
       LCD already has its own size override; this is for SuC/CB/Signal,
       QR, chat, quit. */
    body.tesla-mode .signal-btn {
      padding: 8px 13px; font-size: 13px;
    }
    body.tesla-mode .signal-btn .sig-icon  { font-size: 16px; }
    body.tesla-mode .signal-btn .sig-label { font-size: 10px; letter-spacing: 0.6px; }
    /* Language filter tiles get an extra size bump on the car screen — bigger
       than the header buttons since this panel is meant to be tapped while
       actually driving, not just glanced at. */
    body.tesla-mode .lang-filter-tile { min-height: 92px; }
    body.tesla-mode .lang-filter-tile .lf-icon  { font-size: 42px; }
    body.tesla-mode .lang-filter-tile .lf-label { font-size: 15px; }
    body.tesla-mode #chat-toggle-btn,
    body.tesla-mode #qr-header-btn {
      width: 60px; height: 60px; font-size: 28px;
    }
    body.tesla-mode .btn-quit {
      height: 45px; padding: 0 12px;
    }
    body.tesla-mode .btn-quit .quit-icon  { font-size: 20px; }
    body.tesla-mode .btn-quit .quit-label { font-size: 10px; }

    /* ── Rescue: Tesla mode on a narrow (= mobile) screen.
       The 15″ Tesla layout doesn't fit a phone — header items get pushed
       offscreen and the user can't quit or toggle the chat. Float the
       essential controls so they stay reachable regardless. */
    @media (max-width: 900px) {
      body.tesla-mode #quit-btn,
      body.tesla-mode #chat-toggle-btn,
      body.tesla-mode #qr-header-btn {
        position: fixed; top: 8px; z-index: 9100;
        box-shadow: 0 4px 16px rgba(0,0,0,0.6);
      }
      body.tesla-mode #quit-btn        { right: 8px; }
      body.tesla-mode #chat-toggle-btn { right: 64px; }
      body.tesla-mode #qr-header-btn   { right: 120px; }
    }

    /* Map message bubbles (Tesla mode) */
    .map-msg-bubble {
      border: 2px solid rgba(0,0,0,0.5) !important;
      border-radius: 16px !important;
      padding: 8px 14px !important;
      color: #000 !important;
      font-size: 1.5rem !important;
      font-weight: 800 !important;
      text-align: center;
      box-shadow: 0 8px 24px rgba(0,0,0,0.4) !important;
      width: max-content !important;
      max-width: 280px !important;
      white-space: normal !important;
      word-wrap: break-word !important;
      pointer-events: auto !important;
      cursor: pointer;
      /* Animation opacity-only : NE PAS animer transform, sinon écrase
         le translate3d(...) que Leaflet pose en inline pour le positionnement. */
      animation: bubbleFade 0.25s ease-out;
      transition: opacity 0.3s ease;
    }
    @keyframes bubbleFade {
      from { opacity: 0; }
      to   { opacity: 1; }
    }
    .map-msg-bubble.fade-out { opacity: 0; }
    /* Lignes empilées dans une même bulle */
    .bubble-line {
      padding: 4px 2px;
      transition: opacity 0.3s ease, max-height 0.3s ease;
      max-height: 200px;
      overflow: hidden;
    }
    .bubble-line + .bubble-line {
      border-top: 1px solid rgba(0,0,0,0.18);
      margin-top: 2px;
    }
    .bubble-line.fading { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }

    .member-muted-icon {
      color: var(--danger);
      margin-left: 4px;
      display: inline-flex;
      align-items: center;
    }
    .member-row.tesla-muted .member-name {
      color: var(--text-dim);
    }

    /* ── About modal (opened by the corner-logo) ──────────────────────────── */
    #about-modal {
      position: fixed; inset: 0; z-index: 4000;
      background: rgba(10,10,10,0.85); backdrop-filter: blur(8px);
      display: flex; align-items: center; justify-content: center; padding: 24px;
    }
    #about-modal.hidden { display: none; }
    .about-card {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
      padding: 32px 28px; max-width: 340px; width: 100%;
      display: flex; flex-direction: column; align-items: center; gap: 10px;
      box-shadow: 0 24px 60px rgba(0,0,0,0.7);
    }
    .about-logo { width: 64px; height: 64px; filter: drop-shadow(0 0 24px var(--accent-glow)); }
    #about-title { margin: 6px 0 0; font-size: 24px; font-weight: 900; letter-spacing: -0.5px; }
    .about-tagline {
      font-family: var(--f-mono); font-size: 11px; font-weight: 700;
      color: var(--accent); letter-spacing: 2px; text-transform: uppercase;
    }
    .about-version {
      font-family: var(--f-mono); font-size: 12px; color: var(--text-dim);
      letter-spacing: 1px; margin-top: 8px;
    }
    .about-links {
      display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%;
    }
    .about-links a {
      text-align: center; padding: 10px; border-radius: var(--r-sm);
      background: var(--surface2); color: var(--text-sec);
      font-size: 13px; font-weight: 700; text-decoration: none;
      border: 1px solid var(--border); transition: all 0.15s;
    }
    .about-links a:hover { color: var(--accent); border-color: var(--accent-glow); }
    .about-close {
      margin-top: 14px; padding: 8px 18px; border-radius: var(--r-sm);
      background: transparent; border: 1px solid var(--border);
      color: var(--text-sec); font-family: var(--f-mono);
      font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
      cursor: pointer;
    }
    .about-close:hover { color: var(--text); border-color: var(--text-sec); }

    /* ── Corner logo (right side of header) — opens the About popup ── */
    .corner-logo {
      display: inline-flex;
      align-items: center;
      padding: 4px;
      border-radius: 6px;
      background: transparent;
      border: none;
      cursor: pointer;
      opacity: 0.65;
      transition: opacity 0.15s, background 0.15s;
      flex-shrink: 0;
    }
    .corner-logo:hover  { opacity: 1; background: rgba(255,255,255,0.04); }
    .corner-logo:active { transform: scale(0.96); }
    .corner-logo img    { width: 28px; height: 28px; display: block; }

    /* ── Small screens (iPhone SE, older Android) ── */
    @media (max-height: 680px) {
      #join-screen     { padding: 20px 20px 16px; }
      .logo            { margin-bottom: 16px; }
      .logo-img        { width: 96px; height: 96px; margin-bottom: 6px; }
      .logo-car        { font-size: 52px; margin-bottom: 6px; }
      .logo-title      { font-size: 32px; }
      .logo-tagline    { font-size: 14px; margin-top: 4px; }
      .mode-toggle     { margin-bottom: 16px; }
      .mode-opt        { padding: 10px 8px; }
      .mode-opt .mode-icon { font-size: 22px; }
      .mode-opt .mode-name { font-size: 14px; }
      .mode-opt .mode-sub  { display: none; }
      .join-form       { gap: 10px; }
      input.txt        { height: 68px; font-size: 24px; }
      .btn-join        { height: 68px; font-size: 17px; }
      .btn-private     { width: 68px; height: 68px; }
      .join-private-row .txt { font-size: 22px; }
    }
