* { box-sizing: border-box; margin: 0; padding: 0; }

  /* ── FOCUS CLAVIER PAR DÉFAUT ──
     Anneau cohérent pour tout élément interactif qui n'a pas déjà son propre
     traitement (.crumb, .switch, .quick-nav-item, .map-point ont le leur et
     restent prioritaires grâce à leur spécificité de sélecteur). */
  button:focus-visible, a:focus-visible, input:focus-visible,
  select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }

  /* ── BARRE DE SCROLL PERSONNALISÉE ── */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
  }
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
    border: 1px solid transparent;
    background-clip: padding-box;
  }
  #settings-panel, #notes-list, #favorites-list, #history-list, #note-view-card, #panel-body {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
  }

  :root {
    --bg: #05050f;
    --surface: #0a0a1a;
    --surface2: #0f0f22;
    --border: #1a1a4a;
    --border-h: 240; --border-s: 48%; --border-l: 20%;
    --gold: #ffa600;
    --gold-dim: rgba(255,166,0,0.12);
    --gold-glow: rgba(255,166,0,0.35);
    --text: #d4cfc4;
    --text-dim: #989898;
    --point: #ffa600;
    --point-hover: #ffcc55;
    --scrollbar-thumb: rgba(255,166,0,0.35);
    --scrollbar-thumb-hover: rgba(255,166,0,0.6);
    --panel-w: clamp(360px, 28vw, 560px);
    --header-h: 52px;

    /* ── RAYONS DE BORDURE (échelle centralisée) ──
       sm : petits contrôles (boutons, badges) — md : cartes flottantes moyennes
       (tooltip, minimap, toast) — lg : grandes cartes overlay (terminal, tips) */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* ── ÉLÉVATION (ombres) ──
       sm : petits éléments flottants (menu déroulant, dropdown recherche)
       md : notifications/toasts — lg : grandes cartes modales (terminal, tips) */
    --shadow-sm: 0 6px 16px rgba(0,0,0,0.35);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.35);
    --shadow-lg: 0 16px 32px rgba(0,0,0,0.45);

    /* ── ECHELLE TYPOGRAPHIQUE FLUIDE ──
       Toutes les tailles grandissent ensemble entre 400px et 1800px de largeur
       d'écran, avec un plafond propre à chaque rôle : les boutons/labels
       gagnent le plus, les textes un peu, les titres modérément. */
    --fs-2xs: clamp(0.5625rem, calc(0.527rem + 0.143vw), 0.6875rem);
    --fs-xs:  clamp(0.6875rem, calc(0.652rem + 0.143vw), 0.8125rem);
    --fs-sm:  clamp(0.75rem, calc(0.679rem + 0.286vw), 1rem);
    --fs-base:clamp(0.8125rem, calc(0.759rem + 0.214vw), 1rem);
    --fs-md:  clamp(0.8125rem, calc(0.741rem + 0.286vw), 1.0625rem);
    --fs-lg:  clamp(1.125rem, calc(1.036rem + 0.357vw), 1.4375rem);
    --fs-xl:  clamp(1.25rem, calc(1.143rem + 0.429vw), 1.625rem);

    /* ── PARAMÈTRES UTILISATEUR (réglables via le panel ⚙️) ── */
    --anim-speed: 1;       /* 0.5 (lent) — 1.75 (rapide) */
    --minimap-scale: 1;    /* 0.7 — 1.6 */
    --font-scale: 1;       /* 0.9 — 1.3 */
    --point-active: var(--point);
    --point-active-hover: var(--point-hover);
    --point-active-glow: var(--gold-glow);
    --point-active-dim: var(--gold-dim);
    --ui-text-accent: var(--gold);       /* texte "hors carte" (devient bleu en thème clair) */
    --ui-title-accent: #f0ead8;          /* titres (panel/terminal), devient bleu foncé en thème clair */
    --ui-underline: var(--gold);         /* soulignage des liens inline */
    --ui-underline-fill: var(--gold-dim);
    --ui-hover-accent: var(--point-hover);
    --overlay-text-dim: #989898;         /* texte des contrôles superposés à la carte (fond sombre fixe) */
    --font-family-base: 'Georgia', serif; /* jeu de police "Défaut" */
  }

  html { font-size: calc(100% * var(--font-scale)); }

  /* ── JEUX DE POLICES (réglable via le panel ⚙️) ── */
  html[data-font-family="fantasy"] { --font-family-base: 'Almendra', 'Georgia', serif; }
  html[data-font-family="readability"] { --font-family-base: 'Atkinson Hyperlegible', Arial, sans-serif; }

  /* ── MODE DYSLEXIE (espacements, indépendant de la police choisie) ── */
  html.dyslexia-mode body {
    letter-spacing: 0.03em;
    word-spacing: 0.14em;
  }
  html.dyslexia-mode #panel-description,
  html.dyslexia-mode #terminal-card {
    line-height: 2 !important;
  }
  html.dyslexia-mode #panel-description p,
  html.dyslexia-mode #terminal-card p {
    margin-bottom: 0.9em;
  }

  /* ── THÈME CLAIR (optionnel, sombre par défaut) ── */
  html.light-theme {
    --bg: #f3efe6;
    --surface: #ffffff;
    --surface2: #ffffff;
    --border: #d8d0bd;
    --border-h: 42; --border-s: 32%; --border-l: 79%;
    --text: #2a2620;
    --text-dim: #6b6558;
    --gold-dim: rgba(200,130,0,0.12);
    --ui-text-accent: #1d5fd1;
    --ui-title-accent: #143a7d;
    --ui-underline: rgba(29,95,209,0.55);
    --ui-underline-fill: rgba(29,95,209,0.14);
    --ui-hover-accent: #143a7d;
    --scrollbar-thumb: rgba(29,95,209,0.35);
    --scrollbar-thumb-hover: rgba(29,95,209,0.6);
  }
  html.light-theme body { box-shadow: none; }

  /* ── CONTRASTE RENFORCÉ ── */
  html.high-contrast { --border: #6b6558; }
  html.high-contrast.light-theme { --text-dim: #3a352c; --border: #333; --border-h: 0; --border-s: 0%; --border-l: 20%; }
  html.high-contrast:not(.light-theme) { --text-dim: #c9c9c9; --border: #555; --border-h: 0; --border-s: 0%; --border-l: 33%; }

  /* ── PARALLAXE DÉSACTIVÉE ── */
  html.no-parallax #map-parallax-bg { display: none; }

  /* ── ASSISTANCE DALTONISME ──
     Plutôt qu'un filtre de "correction" approximatif peu fiable, on standardise
     la couleur des points (évite les paires rouge/vert ambiguës) et on renforce
     légèrement le contraste.
     Le boost de saturation/contraste de l'image de carte n'est plus un filtre CSS
     live (coûteux à recomposer en continu, et particulièrement mal géré par le
     moteur de rendu de Firefox sur mobile où le ralentissement était le plus
     flagrant) : il est désormais calculé une seule fois, en pixels, via canvas
     (ctx.filter au moment du dessin/chargement — voir colorblindFilterString(),
     applyColorblindToImage() en JS), puis affiché comme une image normale sans
     aucun traitement de rendu supplémentaire par la suite. Le fond parallax
     (simple décor, pas d'information à distinguer) n'a plus ce boost — compromis
     jugé acceptable pour éviter de complexifier le traitement d'un fond répété. */


  /* ── HALO CURSEUR (option, petit, désactivé par défaut) ── */
  #cursor-halo {
    position: fixed;
    top: 0; left: 0;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--point-active-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    display: none;
    transform: translate(-100px, -100px);
    transition: transform 0.06s linear;
  }
  html.cursor-halo-on #cursor-halo { display: block; }

  /* ── ANNEAU DE SURVOL (indique le "cliquable", élément séparé du curseur : anime sans être rogné) ── */
  #cursor-hover-ring {
    position: fixed;
    top: 0; left: 0;
    width: 20px; height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 1.5px solid #ffa600;
    pointer-events: none;
    z-index: 9998;
    display: none;
    transform: translate(-100px, -100px);
    transition: transform 0.05s linear;
    animation: cursor-ring-cycle 2.4s ease-in-out infinite;
  }
  #cursor-hover-ring.active { display: block; }
  @keyframes cursor-ring-cycle {
    0%, 100% { border-color: #1d5fd1; }
    50% { border-color: #ffa600; }
  }

  /* ── CURSEUR PERSONNALISÉ : périmètre d'application ──
     Sélecteur universel : garantit la couverture de TOUT élément (boutons, liens,
     champs, contenu du panel paramètres...) sans avoir à lister chaque cas un par un,
     et sans se faire écraser par un "cursor: pointer" plus spécifique posé ailleurs. */
  html.custom-cursor-app,
  html.custom-cursor-app * {
    cursor: var(--cursor-default) !important;
  }
  html.custom-cursor-map #map-zone,
  html.custom-cursor-map #map-zone * {
    cursor: var(--cursor-default) !important;
  }

  /* Curseur "main" dédié au pan de la carte, uniquement quand un zoom est actif
     (rien à glisser sinon) — ouverte au repos, fermée pendant le glisser. */
  html.zoomed-in.custom-cursor-app #zoom-viewport,
  html.zoomed-in.custom-cursor-map #zoom-viewport {
    cursor: var(--cursor-hand) !important;
  }
  html.zoomed-in.custom-cursor-app #zoom-viewport.panning,
  html.zoomed-in.custom-cursor-map #zoom-viewport.panning {
    cursor: var(--cursor-hand-grab) !important;
  }

  /* ── ZONE TACTILE VISIBLE (accessibilité) ── */
  html.show-touch-zones .map-point::before {
    content: '';
    position: absolute;
    inset: -1px;
    min-width: 28px;
    min-height: 28px;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    border: 1px dashed var(--point-active);
    border-radius: 50%;
    opacity: 0.55;
    pointer-events: none;
  }

  /* ── TOAST : mise à jour de la carte disponible ── */
  #update-toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translate(-50%, 24px);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(420px, 92vw);
    background: var(--surface2, #12121c);
    border: 1px solid var(--gold);
    padding: 12px 12px 12px 16px;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
  }
  #update-toast.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: all; }
  #update-toast span { font-size: var(--fs-sm); color: var(--text); line-height: 1.4; }
  #update-toast-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
  #update-toast-apply {
    background: none;
    border: 1px solid var(--gold);
    color: var(--ui-text-accent);
    font-family: inherit;
    font-size: var(--fs-xs);
    letter-spacing: 0.05em;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
  }
  #update-toast-apply:hover { background: var(--gold-dim); }
  #update-toast-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: var(--fs-lg);
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
  }
  #update-toast-close:hover { color: var(--ui-text-accent); }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-family-base);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* ── HEADER ── */
  header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
  }
  #site-back-btn {
    color: var(--text-dim);
    text-decoration: none;
    font-size: var(--fs-sm);
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
    }
  #site-back-btn:hover { border-color: var(--gold); color: var(--ui-text-accent); }

  #breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .crumb {
    font-size: var(--fs-md);
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s;
    letter-spacing: 0.03em;
    animation: crumb-in calc(0.25s / var(--anim-speed)) ease;
  }
  .crumb:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 2px;
    color: var(--ui-text-accent);
  }
  @keyframes crumb-in {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  .crumb:hover { color: var(--ui-text-accent); }
  .crumb.active { color: var(--ui-text-accent); font-style: italic; cursor: default; }
  .crumb-ellipsis { padding: 0 2px; letter-spacing: 0.1em; }
  .crumb-sep { color: var(--border); font-size: var(--fs-2xs); }

  #back-btn, #tips-toggle-btn, #notes-add-mode-btn, #notes-map-toggle-btn {
    background: rgba(8,8,15,0.7);
    border: 1px solid var(--border);
    color: var(--overlay-text-dim);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    font-family: inherit;
    pointer-events: auto;
  }
  #back-btn:hover, #tips-toggle-btn:hover, #tips-toggle-btn.active,
  #notes-add-mode-btn:hover, #notes-map-toggle-btn:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  #notes-add-mode-btn.active { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
  #notes-map-toggle-btn.map-notes-off { opacity: 0.45; }
  @media (max-width: 520px) {
    #map-topbar .btn-label { display: none; }
  }
  #back-btn:active:not(:disabled) { transform: scale(0.92); }
  #back-btn:disabled { opacity: 0.3; cursor: default; }
  #back-btn:disabled:hover { border-color: var(--border); color: var(--overlay-text-dim); }

  #account-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    margin-left: auto;
    }
  #account-toggle:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  #account-toggle:active { transform: scale(0.92); }

  /* ── MENU HAMBURGER MOBILE ── */
  #mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s;
  }
  #mobile-menu-toggle:hover, #mobile-menu-toggle.active { border-color: var(--gold); color: var(--ui-text-accent); }
  #mobile-menu-panel {
    position: fixed;
    top: 0;
    left: 12px;
    right: 12px;
    background: var(--surface2, #12121c);
    border: 1px solid var(--border);
    z-index: 45;
    display: none;
    flex-direction: column;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }
  #mobile-menu-panel.open { display: flex; }
  #mobile-menu-panel a, #mobile-menu-panel button {
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: var(--text);
    text-align: left;
    padding: 12px 14px;
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
    text-decoration: none;
  }
  #mobile-menu-panel a:last-child, #mobile-menu-panel button:last-child { border-bottom: none; }
  #mobile-menu-panel a:hover, #mobile-menu-panel button:hover { background: rgba(255,166,0,0.08); color: var(--ui-text-accent); }
  @media (min-width: 769px) {
    #mobile-menu-panel { left: 12px; right: auto; width: 260px; }
  }
  /* Historique / Favoris / Notes regroupés dans le menu ☰ à toutes les tailles d'écran */
  #history-toggle, #favorites-toggle, #notes-toggle { display: none; }

  /* ── RECHERCHE ── */
  #search-panel {
    position: fixed;
    top: 0;
    right: 16px;
    width: min(420px, 92vw);
    background: var(--surface2, #12121c);
    border: 1px solid var(--border);
    z-index: 40;
    display: none;
    flex-direction: column;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }
  @media (max-width: 768px) {
    #search-panel { left: 12px; right: 12px; width: auto; }
  }

  /* ── BASE COMMUNE : fenêtres plein écran (Historique/Favoris/Notes/Note seule) ── */
  .fs-overlay {
    position: fixed;
    inset: 0;
    background: var(--surface);
    z-index: 400;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .fs-overlay.visible { opacity: 1; pointer-events: all; }
  .fs-card {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    display: flex;
    flex-direction: column;
    border: none;
    background: var(--surface);
    padding: 32px;
    transform: none;
  }
  .modal-close-x {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: var(--fs-lg);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
  }
  .modal-close-x:hover { color: var(--ui-text-accent); }
  .modal-title {
    font-size: var(--fs-lg);
    font-style: italic;
    color: var(--ui-title-accent);
    margin-bottom: 16px;
  }
  /* liste défilante en grille responsive (Favoris/Notes) */
  .scroll-grid-list {
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
    margin: 0 -14px;
    display: grid;
    align-content: start;
    align-items: start;
    gap: 0 24px;
  }
  /* ligne de liste cliquable (Historique/Favoris) */
  .list-row {
    display: flex;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .list-row:hover { background: rgba(255,166,0,0.08); }
  /* lien d'évitement (visible uniquement au focus clavier) */
  .skip-link {
    position: absolute;
    top: 0;
    left: 8px;
    z-index: 1000;
    background: var(--surface2, #12121c);
    color: var(--gold, #ffa600);
    border: 1px solid var(--gold, #ffa600);
    padding: 8px 16px;
    font-size: var(--fs-sm);
    text-decoration: none;
    transform: translateY(-150%);
    transition: transform 0.15s ease;
  }
  .skip-link:focus { transform: translateY(8px); }
  /* bouton contour standard (fond transparent, survol doré) */
  .btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
    transition: all 0.2s;
  }
  .btn-outline:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  .btn-outline--danger:hover { border-color: #e05252; color: #e05252; }
  /* état vide d'une liste */
  .empty-state { padding: 14px; color: var(--text-dim); font-style: italic; }

  /* ── HISTORIQUE DE NAVIGATION ── */
  #history-toggle, #favorites-toggle, #notes-toggle, #settings-toggle, #search-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
  }
  #history-toggle:hover, #history-toggle.active,
  #favorites-toggle:hover, #favorites-toggle.active,
  #notes-toggle:hover, #notes-toggle.active,
  #settings-toggle:hover, #settings-toggle.active,
  #search-toggle:hover, #search-toggle.active { border-color: var(--gold); color: var(--ui-text-accent); }

  #history-card > * { width: 100%; max-width: 1400px; margin-left: auto; margin-right: auto; }
  #history-title { flex-shrink: 0; }
  #history-list {
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
    margin: 0 -14px;
    columns: 320px;
    column-gap: 24px;
    column-fill: auto;
  }
  .history-item { break-inside: avoid; align-items: baseline; gap: 8px; }
  .history-item .hi-order { color: var(--text-dim); font-size: var(--fs-xs); flex-shrink: 0; }
  .history-item .hi-name { color: var(--ui-text-accent); font-size: var(--fs-sm); }
  .history-item.current { cursor: default; }
  .history-item.current .hi-name { font-style: italic; }
  .history-item.current:hover { background: none; }
  #history-empty { font-size: var(--fs-xs); }
  #search-panel.open { display: flex; }
  #search-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.03);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text, #eae6da);
    padding: 10px 14px;
    font-size: var(--fs-sm);
    font-family: inherit;
  }
  #search-input:focus { outline: none; border-bottom-color: var(--gold); }
  #search-results {
    max-height: 50vh;
    overflow-y: auto;
  }
  .search-result {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .search-result:hover, .search-result.active { background: rgba(255,166,0,0.08); }
  .search-result .sr-name { color: var(--ui-text-accent); font-size: var(--fs-sm); }
  .search-result .sr-path { color: var(--text-dim); font-size: var(--fs-xs); margin-top: 2px; }
  .search-result .sr-snippet { color: var(--text-dim); font-size: var(--fs-xs); margin-top: 4px; font-style: italic; }
  .search-result .sr-snippet mark { color: var(--ui-text-accent); background: none; font-style: normal; }
  #search-empty { font-size: var(--fs-xs); }
  .search-section-label { padding: 8px 14px 4px; color: var(--text-dim); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }

  /* ── PANEL PARAMÈTRES ── */
  #settings-panel {
    overflow-x: hidden;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    background: var(--surface2, #12121c);
    border: none;
    z-index: 400;
    display: none;
    flex-direction: column;
    box-shadow: none;
    overflow-y: auto;
  }
  #settings-panel.open { display: flex; }
  .settings-body {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    align-items: start;
    column-gap: 32px;
  }

  .settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface2, #12121c); z-index: 1;
  }
  .settings-header h3 { font-size: var(--fs-md); color: var(--ui-text-accent); font-weight: normal; letter-spacing: 0.04em; }
  .settings-close { background: none; border: none; color: var(--text-dim); font-size: var(--fs-lg); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: var(--radius-sm); }
  .settings-close:hover { color: var(--ui-text-accent); }
  .settings-section h4 {
    font-size: var(--fs-xs); color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase;
    padding: 12px 14px 4px; font-weight: normal;
  }
  .settings-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .settings-row label { font-size: var(--fs-sm); color: var(--text); flex: 1; }
  .settings-hint { display: block; font-size: var(--fs-2xs); color: var(--text-dim); margin-top: 2px; font-style: italic; }
  .settings-row select, .settings-row input[type="color"] {
    background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: var(--fs-xs); padding: 4px 6px; cursor: pointer;
  }
  .settings-row input[type="range"] { accent-color: var(--gold); width: 110px; flex-shrink: 0; }
  .settings-row input[type="color"] { width: 36px; height: 26px; padding: 2px; }
  .settings-footer { display: flex; gap: 8px; padding: 12px 14px; }

  /* ── MICRO-INTERACTION : retour tactile au clic ──
     Léger scale sur l'ensemble des boutons "chrome" de l'appli (même trio
     radius/police/press que .btn-outline). Ceux qui ont déjà leur propre
     :active (ex. #hors-cadre-mobile-btn) restent prioritaires. */
  #back-btn:active, #tips-toggle-btn:active, #notes-add-mode-btn:active, #notes-map-toggle-btn:active,
  #account-toggle:active, #mobile-menu-toggle:active,
  #history-toggle:active, #favorites-toggle:active, #notes-toggle:active, #settings-toggle:active, #search-toggle:active,
  .btn-outline:active, #notes-add-btn:active, .oeuvres-voir-plus:active,
  #oeuvres-modal-close:active, .note-map-link:active, .settings-close:active, .settings-footer button:active,
  #zoom-controls button:active, #minimap-toggle:active, .pin-btn:active, #tips-nav button:active,
  .modal-close-x:active {
    transform: scale(0.94);
  }
  /* #panel-toggle a son propre transform de base (translateY(-50%) pour le centrage
     vertical) : une règle générique "transform: scale(0.94)" l'écraserait et ferait
     sauter le bouton hors de son axe au clic. On combine donc les deux ici. */
  #panel-toggle:active {
    transform: translateY(-50%) scale(0.94);
  }

  /* Le curseur personnalisé n'a aucun effet sans pointeur (souris/trackpad) :
     on masque la section uniquement sur les appareils réellement tactiles,
     pas simplement en dessous d'une largeur d'écran (tablette + souris, etc. restent concernés). */
  @media (hover: none) and (pointer: coarse) {
    #settings-cursor-section { display: none; }
  }
  .settings-footer button {
    flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-dim);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: var(--fs-sm); padding: 8px; cursor: pointer; transition: all 0.2s;
  }
  .settings-footer button:hover { border-color: var(--gold); color: var(--gold); }
  #settings-import-input { display: none; }

  /* ── TOGGLE SWITCH (capsule on/off, couleurs du site) ── */
  .switch {
    position: relative; display: inline-block; width: 42px; height: 23px; flex-shrink: 0;
  }
  .switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
  .switch .switch-track {
    position: absolute; inset: 0; background: rgba(255,255,255,0.08); border: 1px solid var(--border);
    border-radius: 24px; cursor: pointer; transition: background 0.2s, border-color 0.2s;
  }
  .switch .switch-track::before {
    content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px;
    background: #eae6da; border-radius: 50%; transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }
  .switch input:checked + .switch-track { background: var(--gold); border-color: var(--gold); }
  .switch input:checked + .switch-track::before { transform: translateX(19px); background: #17130a; }
  .switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }
  html.light-theme .switch .switch-track::before { background: #fff; }

  /* ── QUICK NAV (fixe) ── */
  #quick-nav {
    height: 34px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    font-size: var(--fs-sm);
  }
  .quick-nav-item {
    position: relative;
    color: var(--text-dim);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: color 0.2s;
    padding-bottom: 2px;
  }
  .quick-nav-item::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
  }
  .quick-nav-item:hover { color: var(--ui-text-accent); }
  .quick-nav-item:hover::after, .quick-nav-item.active::after { transform: scaleX(1); }
  .quick-nav-item.active { color: var(--ui-text-accent); font-style: italic; cursor: default; }
  .quick-nav-item:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 2px;
  }
  .quick-nav-sep { color: var(--border); font-size: var(--fs-2xs); }

  /* ── INTERFACE ÉPURÉE (masquage à l'inactivité, option désactivée par défaut) ──
     header/quick-nav : hauteur ramenée à 0 (flex-shrink:0 + overflow hidden), donc #main
     (flex:1) récupère automatiquement l'espace libéré, sans avoir à toucher #map-zone/#side-panel.
     map-topbar/minimap/zoom-controls sont des overlays absolus dans #map-zone : simple fondu. */
  header, #quick-nav {
    transition: opacity 0.35s ease, height 0.35s ease, border-color 0.35s ease;
  }
  #map-topbar, #minimap, #zoom-controls {
    transition: opacity 0.35s ease;
  }
  html.ui-idle-hidden header,
  html.ui-idle-hidden #quick-nav {
    height: 0;
    overflow: hidden;
    border-bottom-color: transparent;
    opacity: 0;
    pointer-events: none;
  }
  html.ui-idle-hidden #map-topbar,
  html.ui-idle-hidden #minimap,
  html.ui-idle-hidden #zoom-controls {
    opacity: 0;
    pointer-events: none;
  }

  /* ── MAIN AREA ── */
  #main {
    flex: 1;
    display: flex;
    overflow: hidden;
  }

  /* ── MAP ZONE ── */
  #map-zone {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #map-zone:focus-visible { outline: none; }

  #map-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  /* ── PARALLAX (fond derrière la carte) ──
     Auparavant 6 radial-gradient() empilés, calculés analytiquement par le
     navigateur sur toute la zone à chaque re-rasterisation (resize, masquage
     de l'interface épurée qui redimensionne #map-zone...). Remplacé par une
     tuile SVG précalculée (mêmes points, mêmes couleurs) : le navigateur la
     décode et la met en cache une seule fois, puis se contente de la répéter
     — nettement moins cher à chaque redimensionnement. */
  #map-parallax-bg {
    position: absolute;
    inset: -10%;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='340'%3E%3Ccircle cx='68' cy='102' r='1' fill='rgba(255,245,214,0.7)'/%3E%3Ccircle cx='221' cy='51' r='1' fill='rgba(255,245,214,0.5)'/%3E%3Ccircle cx='272' cy='221' r='1.5' fill='rgba(255,166,0,0.5)'/%3E%3Ccircle cx='136' cy='272' r='1' fill='rgba(255,245,214,0.4)'/%3E%3Ccircle cx='306' cy='136' r='2' fill='rgba(255,245,214,0.6)'/%3E%3Ccircle cx='34' cy='204' r='1' fill='rgba(255,166,0,0.35)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 340px 340px;
    will-change: transform;
    transition: transform 0.15s linear;
  }

  #zoom-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  #zoom-viewport.panning { cursor: grabbing; }

  #zoom-stage {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform-origin: center center;
    will-change: transform;
  }

  canvas#map-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
    object-fit: contain;
  }

  #map-real-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    display: none;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  #initial-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 50;
    color: var(--text-dim);
    font-style: italic;
    font-size: var(--fs-md);
    background: var(--bg);
  }
  #initial-loader .spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  #map-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    pointer-events: none;
    background: rgba(5,5,15,0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  #map-loader.visible { opacity: 1; }
  #map-loader .spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  #zoom-controls {
    position: absolute;
    right: 16px;
    top: 95%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 15;
  }
  #zoom-controls.visible { display: flex; flex-direction: row; }
  #zoom-controls button {
    width: 36px; height: 36px;
    background: rgba(8,8,15,0.75);
    border: 1px solid var(--border);
    color: var(--gold);
    font-size: 20px;
    cursor: pointer;
    font-family: inherit;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  #zoom-controls button:hover {
    border-color: var(--gold);
    color: var(--point-hover);
    background: rgba(8,8,15,0.92);
  }

  /* ── MINIMAP ── */
  #minimap {
    position: absolute;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 15;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  #minimap.visible { display: flex; }
  @media (max-width: 768px) {
    #minimap-body { width: calc(110px * var(--minimap-scale)); height: calc(70px * var(--minimap-scale)); }
  }
  #minimap-toggle {
    width: 28px; height: 28px;
    background: rgba(8,8,15,0.75);
    border: 1px solid var(--border);
    color: var(--gold);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
  }
  #minimap-toggle:hover { border-color: var(--gold); color: var(--point-hover); }
  #minimap-body {
    width: calc(160px * var(--minimap-scale));
    height: calc(100px * var(--minimap-scale));
    position: relative;
    background: rgba(8,8,15,0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: opacity 0.2s ease;
    cursor: pointer;
    touch-action: none;
  }
  #minimap.collapsed #minimap-body { display: none; }
  #minimap-img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
  }
  #minimap-viewport {
    position: absolute;
    border: 1px solid var(--gold);
    background: rgba(255,166,0,0.12);
    pointer-events: none;
  }
  #minimap-points {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  .minimap-point {
    position: absolute;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--gold);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 2px rgba(0,0,0,0.8);
  }

  /* ── COORDONNÉES AU SURVOL ── */
  #coord-display {
    position: absolute;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 15;
    background: rgba(8,8,15,0.75);
    border: 1px solid var(--border);
    color: var(--gold);
    font-size: 12px;
    padding: 4px 8px;
    font-family: inherit;
    pointer-events: none;
    display: none;
    white-space: nowrap;
  }
  #coord-display.visible { display: block; }
  html.hide-coords #coord-display { display: none !important; }

  /* ── TITRE DE LIEU (fade in/out au changement de carte) ──
     Bordure de sécurité : le texte peut se retrouver sur une carte de couleur
     imprévisible (claire en thème sombre, ou l'inverse) ; un contour contrasté
     garantit la lisibilité dans tous les cas, en plus de l'ombre.
     Contour via -webkit-text-stroke (trait vectoriel uni, contrairement à
     l'astuce text-shadow multi-directions qui laisse des trous sur les
     courbes/diagonales). paint-order: stroke fill place le trait derrière le
     remplissage pour un rendu net. Du padding est nécessaire car la boîte se
     dimensionne au texte (shrink-to-fit) : sans marge, le contour et l'ombre
     débordent de la boîte et se retrouvent rognés par overflow:hidden. */
  #place-title-banner {
    position: absolute;
    top: 9%;
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 12;
    max-width: min(88%, 720px);
    padding: 10px 18px;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    font-size: var(--fs-xl);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ui-title-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    paint-order: stroke fill;
    -webkit-text-stroke: 3px #10102c;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7), 0 0 14px var(--gold-glow);
  }
  html.light-theme #place-title-banner {
    /* Texte bleu foncé (thème clair) : contour clair + ombre claire cohérente */
    -webkit-text-stroke: 3px #faf6ec;
    text-shadow: 0 2px 8px rgba(255,255,255,0.55);
  }
  html.high-contrast #place-title-banner {
    /* Contraste renforcé : contour plus épais, pas de halo doré ni d'ombre douce */
    -webkit-text-stroke: 3.5px #10102c;
    text-shadow: none;
  }
  html.high-contrast.light-theme #place-title-banner {
    -webkit-text-stroke: 3.5px #faf6ec;
    text-shadow: none;
  }
  #place-title-banner.showing {
    animation: place-title-fade calc(3.6s / var(--anim-speed)) ease;
  }
  @keyframes place-title-fade {
    0%   { opacity: 0; transform: translate(-50%, -8px); }
    12%  { opacity: 1; transform: translate(-50%, 0); }
    80%  { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -6px); }
  }

  #points-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
  }

  #notes-map-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
  }
  html.hide-notes-map #notes-map-layer { display: none; }

  .note-point {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: all;
    cursor: pointer;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #1a1a4a;
    background: #f0ead8;
    border: 2px solid var(--gold);
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
    user-select: none;
    -webkit-user-select: none;
    animation: point-in calc(0.35s / var(--anim-speed)) ease both;
  }
  .note-point:hover { background: #fff; }
  .note-point.dragging { cursor: grabbing; opacity: 0.85; box-shadow: 0 0 14px 4px var(--gold); z-index: 60; animation: none; }
  .note-point.note-point-highlight {
    animation: note-point-pulse 0.8s ease-in-out 2;
  }
  @keyframes note-point-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(0,0,0,0.4); transform: translate(-50%, -100%) scale(1); }
    50% { box-shadow: 0 0 18px 6px var(--gold); transform: translate(-50%, -100%) scale(1.25); }
  }
  .note-point .note-point-badge {
    position: absolute;
    top: -6px; right: -8px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background: var(--gold);
    color: #1a1a4a;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #note-placement-banner {
    position: fixed;
    left: 50%;
    top: 70px;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--gold);
    color: var(--text);
    padding: 8px 16px;
    font-size: var(--fs-sm);
    z-index: 500;
    display: none;
    align-items: center;
    gap: 12px;
  }
  #note-placement-banner.visible { display: flex; }
  #note-placement-cancel {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 3px 10px;
    font-size: var(--fs-xs);
    cursor: pointer;
    font-family: inherit;
  }
  #note-placement-cancel:hover { border-color: var(--gold); color: var(--ui-text-accent); }

  #notes-filter-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: var(--fs-xs);
    flex-shrink: 0;
  }
  #notes-filter-banner.visible { display: flex; }
  #notes-filter-clear {
    background: none;
    border: none;
    color: var(--ui-text-accent);
    cursor: pointer;
    font-size: var(--fs-xs);
    text-decoration: underline;
  }

  /* ── LOCATION POINTS ── */
  .map-point {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: all;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 28px;
    min-height: 28px;
    animation: point-in calc(0.35s / var(--anim-speed)) ease both;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .map-point:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
  }
  @keyframes point-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }

  .point-ripple {
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--pc, var(--point));
    opacity: 0.55;
    pointer-events: none;
    animation: point-ripple-anim calc(0.5s / var(--anim-speed)) ease-out forwards;
  }
  @keyframes point-ripple-anim {
    to { width: 50px; height: 50px; margin: -25px 0 0 -25px; opacity: 0; }
  }

  .mystery-point .point-dot {
    animation: pulse calc(2.5s / var(--anim-speed)) infinite, mystery-point-flicker calc(3.6s / var(--anim-speed)) ease-in-out infinite;
  }
  @keyframes mystery-point-flicker {
    0%, 100% { filter: blur(0px); opacity: 1; }
    48%       { filter: blur(0px); opacity: 1; }
    50%       { filter: blur(1.5px); opacity: 0.55; }
    52%       { filter: blur(0px); opacity: 1; }
  }

  /* ── RIPPLE GENERIQUE (carte + panneau) ── */
  .generic-ripple {
    position: absolute;
    top: 0; left: 0;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none;
    z-index: 6;
    animation: generic-ripple-anim calc(0.55s / var(--anim-speed)) ease-out forwards;
  }
  @keyframes generic-ripple-anim {
    to { width: 100px; height: 100px; margin: -50px 0 0 -50px; opacity: 0; }
  }

  .point-dot {
    position: relative;
    width: var(--psize, 12px); height: var(--psize, 12px);
    border-radius: 50%;
    background: var(--pc, var(--point));
    border: 2px solid rgba(255,245,214,0.6);
    box-shadow: 0 0 calc(var(--psize, 12px) * 0.67) var(--pc-glow, var(--gold-glow)), 0 0 0 0 var(--pc-glow, var(--gold-glow));
    transition: all 0.2s;
    animation: pulse calc(2.5s / var(--anim-speed)) infinite;
  }

  .map-point:hover .point-dot {
    background: var(--pc-hover, var(--point-hover));
    box-shadow: 0 0 calc(var(--psize, 12px) * 1.17) var(--pc-glow, var(--gold-glow)), 0 0 0 calc(var(--psize, 12px) * 0.42) var(--pc-dim, var(--gold-dim));
    animation: none;
    transform: scale(1.3);
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.45));
  }

  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 calc(var(--psize, 12px) * 0.5) var(--pc-glow, var(--gold-glow)), 0 0 0 0 var(--pc-dim, var(--gold-dim)); }
    50%       { box-shadow: 0 0 calc(var(--psize, 12px) * 0.83) var(--pc-glow, var(--gold-glow)), 0 0 0 calc(var(--psize, 12px) * 0.5) var(--pc-dim-soft, rgba(201,168,76,0.05)); }
  }

  /* ── COULEUR DES POINTS FORCÉE (mode "doré" ou "personnalisé") ── */
  html.force-point-color .map-point {
    --pc: var(--point-active) !important;
    --pc-hover: var(--point-active-hover) !important;
    --pc-glow: var(--point-active-glow) !important;
    --pc-dim: var(--point-active-dim) !important;
  }
  /* Renfort : certains points définissent leur couleur en style inline très spécifique,
     on force donc aussi directement les propriétés rendues du point-dot. */
  html.force-point-color .point-dot {
    background: var(--point-active) !important;
    box-shadow: 0 0 calc(var(--psize, 12px) * 0.67) var(--point-active-glow), 0 0 0 0 var(--point-active-glow) !important;
  }
  html.force-point-color .map-point:hover .point-dot {
    background: var(--point-active-hover) !important;
    box-shadow: 0 0 calc(var(--psize, 12px) * 1.17) var(--point-active-glow), 0 0 0 calc(var(--psize, 12px) * 0.42) var(--point-active-dim) !important;
  }
  html.force-point-color .point-label { color: var(--point-active) !important; }

  .point-label {
    font-size: calc(var(--fs-base) * var(--lscale, 1));
    color: var(--gold);
    letter-spacing: 0.06em;
    text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 1px 3px #000;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
  }

  /* ── RÉDUCTION DES ANIMATIONS (préférence OS ou bouton manuel) ── */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
    }
  }
  html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  /* ── ANIMATIONS DYNAMIQUES (option, désactivé par défaut) ──
     Les BORDURES de l'interface (boutons, panneaux, badges) changent de
     teinte selon la vitesse de déplacement de la souris / pan / zoom sur
     la carte. Uniquement border-color, jamais le fond ni le texte.
     Neutralisé si "Réduire les animations" est actif. */
  :root { --nav-energy: 0; }
  html.dynamic-anim-on:not(.reduce-motion) {
    --border: hsl(calc(var(--border-h) + var(--nav-energy) * 130), calc(var(--border-s) + var(--nav-energy) * 20%), var(--border-l));
  }
  /* Les marqueurs de carte (.note-point, .point-dot, badge de note) gardent
     leur propre couleur d'identité (var(--gold), var(--point), rgba…) :
     volontairement exclus de l'effet dynamique. */

  /* ── MODE UNE SEULE MAIN (smartphone, option, désactivé par défaut) ──
     Duplique le menu ☰ dans une bulle flottante accessible au pouce. */
  #one-hand-bubble {
    display: none;
    position: fixed;
    bottom: 18px;
    z-index: 200;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(8,8,15,0.88);
    border: 1px solid var(--border);
    color: var(--gold, #ffa600);
    font-size: 22px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 14px rgba(0,0,0,0.5);
  }
  html.one-hand-on[data-one-hand-side="right"] #one-hand-bubble { display: flex; right: 16px; }
  html.one-hand-on[data-one-hand-side="left"] #one-hand-bubble { display: flex; left: 16px; }
  @media (min-width: 769px) { #one-hand-bubble { display: none !important; } }
  @media (max-width: 768px) {
    html.one-hand-on[data-one-hand-side="right"] #zoom-controls { right: 76px; }
    html.one-hand-on[data-one-hand-side="left"] #minimap { left: 76px; }
  }

  /* ── READING RULER (option, désactivé par défaut) ──
     Bande qui suit le doigt/curseur sur les textes longs (descriptions,
     notes), assombrit/floute le reste pour aider la concentration. */
  .reading-ruler-zone { position: relative; }
  html.reading-ruler-on .reading-ruler-zone.ruler-active {
    --ruler-y: 50%;
    --ruler-h: 60px;
  }
  html.reading-ruler-on .reading-ruler-zone.ruler-active::before,
  html.reading-ruler-on .reading-ruler-zone.ruler-active::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.15s ease;
  }
  html.reading-ruler-on .reading-ruler-zone.ruler-active::before {
    top: 0;
    height: calc(var(--ruler-y) - var(--ruler-h) / 2);
    background: rgba(6,6,10,0.72);
    backdrop-filter: blur(1.5px);
  }
  html.reading-ruler-on .reading-ruler-zone.ruler-active::after {
    top: calc(var(--ruler-y) + var(--ruler-h) / 2);
    bottom: 0;
    background: rgba(6,6,10,0.72);
    backdrop-filter: blur(1.5px);
  }

  /* ── SIDE PANEL ── */
  #side-panel {
    width: var(--panel-w);
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: visible;
    flex-shrink: 0;
    position: relative;
  }

  #side-panel.hidden { width: 0; border-left: none; }

  #panel-inner {
    width: var(--panel-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s ease;
  }
  #side-panel.hidden #panel-inner { opacity: 0; }

  .panel-fade-in { animation: panel-content-fade 0.3s ease; }
  @keyframes panel-content-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  #panel-header {
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  #panel-type {
    font-size: var(--fs-xs);
    letter-spacing: 0.15em;
    color: var(--ui-text-accent);
    text-transform: uppercase;
    margin-bottom: 6px;
  }

  #panel-title {
    font-size: var(--fs-lg);
    font-weight: normal;
    font-style: italic;
    color: var(--ui-title-accent);
    line-height: 1.2;
  }

  #panel-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }
  #panel-title-row #panel-title { flex: 1; }

  #panel-toggle {
    position: absolute;
    font-size: 24px;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--ui-text-accent);
    width: 28px; height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 10;
  }
  #panel-toggle:hover { color: var(--point-hover); }

  #side-panel { position: relative; }

  #panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    background-color: var(--surface);
    background-image:
      linear-gradient(var(--surface) 30%, rgba(0,0,0,0)),
      linear-gradient(rgba(0,0,0,0), var(--surface) 70%),
      linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0)),
      linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.35));
    background-repeat: no-repeat;
    background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
    background-position: 0 0, 0 100%, 0 0, 0 100%;
    background-attachment: local, local, scroll, scroll;
  }

  #panel-description {
    font-size: var(--fs-base);
    line-height: 1.75;
    color: var(--text);
    padding: 0 16px;
  }

  /* Inline clickable elements in description */
  .inline-link {
    color: var(--ui-text-accent);
    cursor: pointer;
    border-bottom: 1px dotted var(--ui-underline);
    background-image: linear-gradient(var(--ui-underline-fill), var(--ui-underline-fill));
    background-repeat: no-repeat;
    background-position: left center;
    background-size: 0% 100%;
    transition: color 0.15s, background-size 0.25s ease;
  }
  .inline-link:hover { color: var(--ui-hover-accent); background-size: 100% 100%; }

  #panel-description mark, #terminal-card mark, #tooltip mark {
    background-color: transparent;
    background-image: linear-gradient(var(--gold-dim), var(--gold-dim));
    background-repeat: no-repeat;
    background-position: left center;
    color: var(--ui-text-accent);
    padding: 0 2px;
    animation: mark-fill 0.45s ease-out both;
  }
  @keyframes mark-fill {
    from { background-size: 0% 100%; }
    to   { background-size: 100% 100%; }
  }

  /* ── MYSTÈRE (éléments "unknown") ── */
  .mystery-text {
    color: var(--text-dim);
    font-style: italic;
    animation: mystery-breathe 3.2s ease-in-out infinite;
  }
  @keyframes mystery-breathe {
    0%, 100%  { filter: blur(0px) drop-shadow(0 0 0 rgba(70,140,255,0)); opacity: 0.85; }
    50%        { filter: blur(1px) drop-shadow(0 0 4px rgba(70,140,255,0.6)) hue-rotate(15deg); opacity: 1; }
  }
  .mystery-text.glitching {
    animation: mystery-breathe 3.2s ease-in-out infinite, mystery-glitch 0.45s steps(2, end) 1;
  }
  @keyframes mystery-glitch {
    0%   { transform: translate(0, 0); text-shadow: none; }
    20%  { transform: translate(-2px, 1px); text-shadow: 2px 0 rgba(255,70,70,0.55), -2px 0 rgba(70,180,255,0.55); }
    40%  { transform: translate(2px, -1px); text-shadow: -2px 0 rgba(255,70,70,0.55), 2px 0 rgba(70,180,255,0.55); }
    60%  { transform: translate(-1px, 0); text-shadow: 1px 0 rgba(255,70,70,0.4), -1px 0 rgba(70,180,255,0.4); }
    80%  { transform: translate(1px, 1px); text-shadow: -1px 0 rgba(255,70,70,0.35), 1px 0 rgba(70,180,255,0.35); }
    100% { transform: translate(0, 0); text-shadow: none; }
  }

  /* ── OEUVRES LIEES (livres) ── */
  .oeuvres-section {
    margin-top: 20px;
    padding: 16px;
    border-top: 1px solid var(--border);
  }
  .oeuvres-title {
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ui-text-accent);
    margin-bottom: 10px;
  }
  .oeuvres-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 160px;
    overflow: hidden;
    position: relative;
  }
  .oeuvre-item {
    width: max(64px, 10ch);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .oeuvre-item img {
    width: 64px;
    height: 91px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: block;
    transition: border-color 0.2s;
    background: var(--surface2);
  }
  .oeuvre-item img.oeuvre-img-loading {
    animation: oeuvre-img-pulse 1.4s ease-in-out infinite;
  }
  @keyframes oeuvre-img-pulse {
    0%, 100% { background: var(--surface2); }
    50% { background: rgba(255,255,255,0.06); }
  }
  .oeuvre-item:hover img { border-color: var(--gold); }
  .oeuvre-item span {
    font-size: var(--fs-xs);
    color: var(--text-dim);
    line-height: 1.3;
  }
  .oeuvres-voir-plus {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    padding: 6px 14px;
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.05em;
    margin-top: 10px;
    transition: all 0.2s;
  }
  .oeuvres-voir-plus:hover { border-color: var(--gold); color: var(--ui-text-accent); }

  /* ── MODALE CATALOGUE OEUVRES ── */
  #oeuvres-modal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  #oeuvres-modal.visible { opacity: 1; pointer-events: all; }
  #oeuvres-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  #oeuvres-modal-title {
    font-size: var(--fs-lg);
    font-style: italic;
    color: var(--text);
  }
  #oeuvres-modal-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    padding: 6px 16px;
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
    transition: all 0.2s;
  }
  #oeuvres-modal-close:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  #oeuvres-modal-grid {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 24px;
    align-content: start;
    transform: scale(0.97);
    transition: transform 0.3s cubic-bezier(.34,1.2,.64,1);
  }
  #oeuvres-modal.visible #oeuvres-modal-grid { transform: scale(1); }
  #oeuvres-modal-grid .oeuvre-item {
    width: auto;
    animation: card-in 0.4s ease both;
  }
  @keyframes card-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  #oeuvres-modal-grid .oeuvre-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 874 / 1240;
  }
  #oeuvres-modal-grid .oeuvre-item span { font-size: var(--fs-xs); }

  /* ── FENÊTRE SIGNALEMENT (bug / suggestion) ── */
  #report-overlay, #account-overlay, #dash-overlay, #about-overlay, #share-overlay, #shareimp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,8,15,0.75);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  #report-overlay.visible, #account-overlay.visible, #dash-overlay.visible, #about-overlay.visible, #share-overlay.visible, #shareimp-overlay.visible { opacity: 1; pointer-events: all; }
  #report-card, #account-card, #dash-card, #about-card, #share-card, #shareimp-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 100%;
    overflow-y: auto;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.94) translateY(8px);
    transition: transform 0.3s cubic-bezier(.34,1.3,.64,1);
  }
  #report-overlay.visible #report-card, #account-overlay.visible #account-card, #dash-overlay.visible #dash-card, #about-overlay.visible #about-card, #share-overlay.visible #share-card, #shareimp-overlay.visible #shareimp-card { transform: scale(1) translateY(0); }
  #report-title, #account-title, #dash-title, #about-title, #share-title, #shareimp-title {
    font-size: var(--fs-lg);
    font-style: italic;
    color: var(--ui-title-accent);
    margin: 0 28px 16px 0;
  }
  #report-type { display: flex; gap: 8px; margin-bottom: 14px; }
  .report-type-opt { flex: 1; cursor: pointer; }
  .report-type-opt input { position: absolute; opacity: 0; pointer-events: none; }
  .report-type-opt span {
    display: block;
    text-align: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: var(--fs-sm);
    transition: all 0.2s;
  }
  .report-type-opt:hover span { border-color: var(--gold); }
  .report-type-opt input:checked + span {
    border-color: var(--gold);
    background: var(--gold-dim);
    color: var(--ui-text-accent);
  }
  .report-type-opt input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
  .report-field {
    display: block;
    margin-bottom: 14px;
    font-size: var(--fs-sm);
    color: var(--text-dim);
  }
  .report-field input[type="text"], .report-field input[type="email"], .report-field input[type="password"], .report-field textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: max(16px, var(--fs-base));
    box-sizing: border-box;
  }
  .report-field textarea { resize: vertical; min-height: 110px; }
  .report-field input:focus, .report-field textarea:focus { outline: none; border-color: var(--gold); }
  .report-hint { font-size: var(--fs-xs); color: var(--text-dim); }
  .report-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  #report-error { margin: 0 0 12px; color: #e05252; font-size: var(--fs-sm); }
  #report-actions, #report-actions-done { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
  #report-send:not(:disabled) { border-color: var(--gold); color: var(--ui-text-accent); }
  #report-send:disabled { opacity: 0.5; cursor: wait; }
  #report-done-msg { color: var(--text); line-height: 1.6; margin: 0 0 12px; }
  #report-done-link { display: block; word-break: break-all; color: var(--ui-text-accent); font-size: var(--fs-sm); }

  /* ── FENÊTRE COMPTE ── (réutilise le style de la fenêtre Signalement) */
  #account-tabs, #dash-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  #account-tabs button, #dash-tabs button {
    flex: 1;
    padding: 8px 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-family: inherit;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.2s;
  }
  #account-tabs button:hover, #dash-tabs button:hover { border-color: var(--gold); }
  #account-tabs button[aria-selected="true"], #dash-tabs button[aria-selected="true"] { border-color: var(--gold); background: var(--gold-dim); color: var(--ui-text-accent); }
  .account-links { margin: 0 0 12px; }
  .account-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--ui-text-accent);
    font-family: inherit;
    font-size: var(--fs-sm);
    text-decoration: underline;
    cursor: pointer;
  }
  .account-warn {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--gold);
    border-radius: var(--radius-sm);
    background: var(--gold-dim);
    color: var(--text);
    font-size: var(--fs-sm);
    line-height: 1.5;
  }
  .account-msg { margin: 0 0 12px; color: #e05252; font-size: var(--fs-sm); }
  .account-msg.is-ok { color: #6fd08c; }
  .account-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
  .account-submit:not(:disabled) { border-color: var(--gold); color: var(--ui-text-accent); }
  .account-submit:disabled { opacity: 0.5; cursor: wait; }
  .account-actions-col { flex-direction: column; align-items: stretch; margin-top: 8px; }
  .account-actions-left { justify-content: flex-start; flex-wrap: wrap; margin: 0 0 8px; }

  /* ── Progression (lieux visités, succès) ── */
  #dash-card { max-width: 560px; }
  #dash-card [hidden] { display: none !important; }
  .dash-section { margin: 0 0 22px; }
  .dash-section h3 { margin: 0 0 10px; font-size: var(--fs-base); font-weight: normal; font-style: italic; color: var(--ui-title-accent); }
  #dash-profile .dash-section + .dash-section { padding-top: 16px; border-top: 1px solid var(--border); }
  .dash-section > .report-hint { margin: 0 0 12px; }
  .rep-list { list-style: none; margin: 0; padding: 0; }
  .rep { padding: 10px 0; border-top: 1px solid var(--border); }
  .rep:first-child { border-top: none; }
  .rep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
  .rep-tag, .rep-badge { font-size: var(--fs-xs); padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-dim); }
  .rep-badge.is-reply { border-color: var(--gold); color: var(--ui-text-accent); }
  .rep-title { font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; }
  .rep-meta { font-size: var(--fs-xs); color: var(--text-dim); }
  .rep-meta a { color: var(--ui-text-accent); }
  .rep-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .rep-actions .btn-outline { padding: 4px 10px; font-size: var(--fs-xs); }
  .rep-row { display: flex; align-items: center; gap: 10px; }
  .rep-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: none; color: inherit; font-family: inherit; cursor: pointer; padding: 0; }
  .rep-main:hover .rep-title { color: var(--ui-text-accent); }
  .rep-row .btn-outline { padding: 4px 10px; }
  .dash-guest { color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.5; margin: 0 0 14px; }
  .achv-cat { margin: 14px 0 4px; font-size: var(--fs-xs); font-weight: normal; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
  .progress-summary { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--text-dim); }
  .progress-summary strong { color: var(--text); }
  .achv-list, .region-list { list-style: none; margin: 0; padding: 0; }
  .achv { display: flex; align-items: center; gap: 10px; padding: 6px 0; opacity: 0.55; }
  .achv.is-on { opacity: 1; }
  .achv-icon { width: 26px; text-align: center; font-size: var(--fs-lg); flex-shrink: 0; }
  .achv-text { display: flex; flex-direction: column; min-width: 0; }
  .achv-title { font-size: var(--fs-sm); color: var(--text); }
  .achv.is-on .achv-title { color: var(--ui-text-accent); }
  .achv-desc { font-size: var(--fs-xs); color: var(--text-dim); }
  .progress-regions { margin-top: 12px; }
  .progress-regions summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-dim); }
  .region-list { margin-top: 8px; max-height: 220px; overflow-y: auto; }
  .region { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 5px 0; font-size: var(--fs-sm); }
  .region-count { color: var(--text-dim); font-size: var(--fs-xs); align-self: center; }
  .region.is-on .region-name { color: var(--ui-text-accent); }
  .region-bar { grid-column: 1 / -1; height: 3px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
  .region-bar > span { display: block; height: 100%; background: var(--gold); }

  /* Notification de succès : discrète, en haut au centre, cliquable */
  #achv-toast {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translate(-50%, -12px);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(340px, 92vw);
    padding: 8px 14px;
    background: var(--surface2, #12121c);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    z-index: 450;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s;
  }
  #achv-toast.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: all; }
  #achv-toast:hover { border-color: var(--gold); }
  #achv-toast-icon { font-size: var(--fs-lg); flex-shrink: 0; }
  .achv-toast-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  #achv-toast-title { font-size: var(--fs-sm); color: var(--ui-text-accent); }
  #achv-toast-desc { font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  @media (prefers-reduced-motion: reduce) { #achv-toast { transition: opacity 0.2s ease; transform: translate(-50%, 0); } }
  #account-import-text { color: var(--text); line-height: 1.6; margin: 0 0 8px; }
  #dash-danger { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-dim); }
  #dash-danger summary { cursor: pointer; padding: 4px 0; }
  #dash-danger form { margin-top: 10px; }
  #account-me-pseudo { font-size: var(--fs-lg); color: var(--text); margin: 0 0 4px; }
  #account-me-email { margin: 0 0 14px; }

  /* ── FENÊTRE DE BIENVENUE / ASTUCES (tips) ── */
  #tips-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,8,15,0.75);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  #tips-overlay.visible { opacity: 1; pointer-events: all; }
  #tips-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 100%;
    overflow-y: auto;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.94) translateY(8px);
    transition: transform 0.3s cubic-bezier(.34,1.3,.64,1);
  }
  #tips-overlay.visible #tips-card { transform: scale(1) translateY(0); }
  #tips-icon { font-size: var(--fs-xl); margin-bottom: 12px; }
  #tips-title {
    font-size: var(--fs-lg);
    font-style: italic;
    color: var(--ui-title-accent);
    margin-bottom: 14px;
  }
  #tips-body { font-size: var(--fs-base); line-height: 1.75; color: var(--text); min-height: 5.25em; }
  #tips-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
  }
  #tips-nav button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: var(--fs-base);
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
  }
  #tips-nav button:hover:not(:disabled) { border-color: var(--gold); color: var(--ui-text-accent); }
  #tips-nav button:disabled { opacity: 0.35; cursor: default; }
  #tips-counter { font-size: var(--fs-sm); color: var(--text-dim); min-width: 3.5em; text-align: center; }
  #tips-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }
  #tips-dontshow-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    color: var(--text-dim);
    cursor: pointer;
  }


  /* ── FENÊTRE FAVORIS ── */
  #favorites-card > * { width: 100%; max-width: 1400px; margin-left: auto; margin-right: auto; }
  #favorites-title { flex-shrink: 0; }
  #favorites-list { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
  #favorites-empty { font-size: var(--fs-sm); }
  .favorite-result { align-items: center; justify-content: space-between; gap: 10px; }
  .favorite-result .fav-result-main { flex: 1; min-width: 0; }
  .fav-remove-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--fs-sm);
    flex-shrink: 0;
    padding: 4px 6px;
  }
  .fav-remove-btn:hover { color: var(--gold); }
  #favorites-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
  }


  /* ── FENÊTRE NOTE SEULE (plein écran) ── */
  #note-view-overlay { z-index: 410; }
  #note-view-card { overflow-y: auto; }
  #note-view-card > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
  #note-view-title { word-break: break-word; }
  #note-view-body {
    color: var(--text);
    font-size: var(--fs-sm);
    white-space: pre-line;
    word-break: break-word;
    line-height: 1.6;
  }

  /* ── FENÊTRE MES NOTES ── */
  #notes-card > * { width: 100%; max-width: 1400px; margin-left: auto; margin-right: auto; }
  #notes-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-shrink: 0;
  }
  #notes-title {
    font-size: var(--fs-lg);
    font-style: italic;
    color: var(--ui-title-accent);
  }
  #notes-add-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--ui-text-accent);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.04em;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  #notes-add-btn:hover { border-color: var(--gold); }
  #notes-list { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
  #notes-empty { font-size: var(--fs-sm); }
  .note-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .note-item.pinned { background: var(--gold-dim); }
  .note-item-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-direction: column-reverse;
  }
  .note-item-main { flex: 1; min-width: 0; cursor: default; }
  .note-item-title {
    color: var(--ui-title-accent);
    font-size: var(--fs-md);
    margin-bottom: 2px;
    word-break: break-word;
  }
  .note-item-excerpt {
    color: var(--text-dim);
    font-size: var(--fs-sm);
    white-space: pre-line;
    word-break: break-word;
  }
  .note-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }
  .note-action-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--fs-sm);
    padding: 4px 6px;
  }
  .note-action-btn:hover { color: var(--ui-text-accent); }
  .note-action-btn.note-pin-btn.pinned { color: var(--gold); }
  .note-map-link {
    margin-top: 6px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--ui-text-accent);
    padding: 3px 10px;
    font-size: var(--fs-xs);
    cursor: pointer;
    font-family: inherit;
  }
  .note-map-link:hover { border-color: var(--gold); }
  .note-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .note-edit-form input[type="text"],
  .note-edit-form textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-sm);
    padding: 6px 8px;
  }
  .note-edit-form textarea { min-height: 80px; resize: vertical; }
  .note-edit-actions { display: flex; gap: 8px; }
  .note-edit-actions button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 5px 14px;
    font-size: var(--fs-xs);
    cursor: pointer;
    font-family: inherit;
  }
  .note-edit-save { color: var(--ui-text-accent) !important; }
  .note-edit-actions button:hover { border-color: var(--gold); }
  #notes-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
  }
  #notes-delete-all-btn { margin-left: auto; }

  /* ── INLINE TOOLTIP ── */
  #tooltip {
    position: fixed;
    z-index: 100;
    background: var(--surface2);
    border: 1px solid var(--gold);
    padding: 12px 14px;
    max-width: 320px; /* valeur de repli ; recalculée en JS à l'affichage (voir showTooltip) */
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--text);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
  }
  #tooltip.visible { visibility: visible; opacity: 1; transform: scale(1); }
  #tt-title {
    display: block;
    color: var(--ui-text-accent);
    font-size: var(--fs-sm);
    letter-spacing: 0.08em;
    margin-bottom: 5px;
    font-style: italic;
  }

  /* ── LEVEL BADGE ── */
  #map-topbar {
    position: absolute;
    top: 12px; left: 12px;
    max-width: calc(100% - 24px);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    z-index: 16;
  }
  #level-badge {
    background: rgba(8,8,15,0.7);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    color: var(--overlay-text-dim);
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  #empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--fs-md);
    text-align: center;
    pointer-events: none;
    z-index: 3;
    padding: 0 24px;
    max-width: min(40ch, calc(100vw - 20px));
  }

  /* ── TRANSITIONS ── */
  #map-container { transition: opacity 0.28s ease, filter 0.28s ease; }
  #map-container.fading { opacity: 0; filter: blur(8px); }

  /* ── TERMINAL PANEL (no sub-map) ── */
  #terminal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8,8,15,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  #terminal-overlay.visible { opacity: 1; pointer-events: all; }
  #terminal-card {
    max-width: min(70ch, calc(100vw - 20px));
    max-height: 100%;
    overflow-y: auto;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.94) translateY(8px);
    transition: transform 0.3s cubic-bezier(.34,1.3,.64,1);
  }
  #terminal-overlay.visible #terminal-card { transform: scale(1) translateY(0); }
  #terminal-card .t-type {
    font-size: var(--fs-xs); letter-spacing: 0.15em; color: var(--ui-text-accent);
    text-transform: uppercase; margin-bottom: 10px;
  }
  #terminal-card .t-title {
    font-size: var(--fs-xl); font-style: italic; font-weight: normal;
    color: var(--ui-title-accent); margin-bottom: 0;
  }
  #terminal-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
  }
  #terminal-title-row .t-title { flex: 1; }

  /* ── BOUTON ÉPINGLER (favoris) ── */
  .pin-btn {
    position: relative;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: var(--fs-base);
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
  }
  .pin-btn:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  .pin-btn.pinned { color: var(--gold); border-color: var(--gold); }
  .place-notes-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background: var(--gold);
    color: #1a1a4a;
    font-size: 10px;
    font-weight: bold;
    line-height: 15px;
    text-align: center;
    display: none;
  }
  .place-notes-count.visible { display: block; }
  #terminal-card .t-body {
    font-size: var(--fs-base); line-height: 1.75; color: var(--text);
  }
  #terminal-close { margin-top: 24px; }

  /* ── Jauge de lecture (discrète, visible seulement si le texte défile) ── */
  .read-gauge { height: 3px; flex-shrink: 0; background: transparent; opacity: 0; transition: opacity 0.25s ease; pointer-events: none; overflow: hidden; }
  .read-gauge.active { opacity: 1; }
  .read-gauge > span { display: block; height: 100%; width: 100%; background: var(--gold); opacity: 0.55; transform-origin: left center; transform: scaleX(0); transition: transform 0.15s linear; }
  #terminal-gauge { position: sticky; top: -32px; z-index: 2; margin: -32px -32px 29px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  @media (prefers-reduced-motion: reduce) { .read-gauge > span { transition: none; } }
  html.reduce-motion .read-gauge > span { transition: none; }

  #panel-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    }

  #hors-cadre-mobile-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    font-family: inherit;
    width: 100%;
    }
  #hors-cadre-mobile-btn:hover { border-color: var(--gold); color: var(--ui-text-accent); }
  #hors-cadre-mobile-btn:active { transform: scale(0.96); }

  /* ── MOBILE ── */
@media (max-width: 768px) {
  header {
    flex-wrap: nowrap;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
  }
  #site-back-btn, #account-toggle, #search-toggle {
    display: none;
  }

  #side-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 100% !important;
    overflow: visible;
    transition: transform 0.25s ease !important;
    transform: translateX(100%);
    visibility: visible;
    z-index: 50;
  }
  #panel-inner {
    width: 100% !important;
  }
  #side-panel.mobile-open {
    transform: translateX(0);
  }
  #panel-toggle {
    transform: translateY(-50%) !important;
  }
  #side-panel.mobile-open #panel-toggle {
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border);
  }

  #oeuvres-modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    padding: 16px;
  }
}
/* ── Consentement succès + CGU ── */
.account-terms { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 10px; font-size: var(--fs-sm); line-height: 1.4; cursor: pointer; }
.account-terms input { margin-top: 3px; flex: none; }
.account-terms a, .account-legal a, #ach-consent a { color: inherit; text-decoration: underline; }
.account-legal { margin: 0 0 12px; padding: 8px 10px; border: 1px solid rgba(128,128,128,.35); border-radius: 6px; font-size: calc(var(--fs-sm) - 1px); line-height: 1.4; opacity: .9; }
.account-legal p { margin: 0 0 6px; }
.account-legal p:last-child { margin: 0; }
#ach-consent { position: fixed; left: 12px; bottom: 12px; z-index: 390; width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--surface2, #12121c); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); line-height: 1.4; }
#ach-consent[hidden] { display: none; }
#ach-consent p { margin: 0 0 8px; }
#ach-consent .ach-consent-title { font-weight: 600; font-size: 1.05em; }
.ach-consent-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ach-consent-actions button { flex: 1; }
.achv-off { text-align: center; padding: 12px 4px; }
.achv-off p { margin: 0 0 10px; }

/* ── À propos ── */
.about-sec { margin: 0 0 16px; }
.about-sec h3 { margin: 0 0 6px; font-size: var(--fs-md, 1em); color: var(--ui-title-accent); }
.about-sec p { margin: 0 0 6px; color: var(--text); line-height: 1.5; font-size: var(--fs-sm); }
.about-sec a { color: inherit; text-decoration: underline; }
.dash-about-row { margin: 16px 0 0; padding-top: 10px; border-top: 1px solid var(--border); text-align: center; }

/* ── Bandeau succès : réduction + pastille ── */
.ach-consent-min { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; background: none; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-dim); cursor: pointer; font-size: 14px; }
.ach-consent-min:hover { border-color: var(--border); color: var(--text); }
#ach-consent .ach-consent-title { margin-right: 28px; }
#ach-chip { position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 15; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: rgba(8,8,15,0.75); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-family: inherit; transition: border-color 0.2s; }
#ach-chip[hidden] { display: none; }
#ach-chip:hover { border-color: var(--gold); }
/* À droite de la mini-carte (jamais au-dessus), quelle que soit sa taille */
#minimap.visible.collapsed ~ #ach-chip { left: 52px; }
#minimap.visible:not(.collapsed) ~ #ach-chip { left: calc(16px + 160px * var(--minimap-scale) + 8px); }
@media (max-width: 768px) {
  #minimap.visible:not(.collapsed) ~ #ach-chip { left: calc(16px + 110px * var(--minimap-scale) + 8px); }
  html.one-hand-on[data-one-hand-side="left"] #ach-chip { left: 76px; }
  html.one-hand-on[data-one-hand-side="left"] #minimap.visible.collapsed ~ #ach-chip { left: 112px; }
  html.one-hand-on[data-one-hand-side="left"] #minimap.visible:not(.collapsed) ~ #ach-chip { left: calc(76px + 110px * var(--minimap-scale) + 8px); }
}

#dash-account-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
#dash-account-bar .btn-outline { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dash-sync-status { margin: 0; }

/* ── Partages ── */
.share-pick-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; font-size: var(--fs-sm); }
.share-pick-head .account-link { margin-left: auto; }
#share-notes-list, #shareimp-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
#share-notes-list li, #shareimp-list li { border-bottom: 1px solid var(--border); }
#share-notes-list li:last-child, #shareimp-list li:last-child { border-bottom: 0; }
#share-notes-list label, #shareimp-list label { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; cursor: pointer; font-size: var(--fs-sm); line-height: 1.35; }
#share-notes-list input, #shareimp-list input { margin-top: 3px; flex: none; }
.share-note-title { display: block; color: var(--text); font-weight: 600; }
.share-note-sub { display: block; color: var(--text-dim); font-size: calc(var(--fs-sm) - 1px); overflow-wrap: anywhere; }
.share-author { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0 0 12px; padding: 6px 10px 8px; font-size: var(--fs-sm); }
.share-author legend { padding: 0 4px; color: var(--text-dim); }
.share-author label { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; cursor: pointer; }
#share-done-link { width: 100%; box-sizing: border-box; margin: 4px 0 10px; }
#shareimp-desc { color: var(--text); line-height: 1.5; margin: 0 0 12px; overflow-wrap: anywhere; }
#shareimp-meta { margin: 0 0 8px; }
.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
/* Fenêtres de partage au-dessus des fenêtres plein écran (notes…) */
#share-overlay, #shareimp-overlay { z-index: 420; }
#account-overlay { z-index: 430; }

#share-qr { width: 180px; max-width: 70%; margin: 8px auto 4px; background: #fff; border-radius: var(--radius-sm); padding: 4px; line-height: 0; }
#share-qr:empty { display: none; }
#share-qr svg { width: 100%; height: auto; display: block; }
#share-qr-hint { text-align: center; margin: 0 0 12px; }
#share-discord-box { margin: 8px 0 4px; padding-top: 10px; border-top: 1px solid var(--border); }
#share-discord-box[hidden] { display: none; }