:root {
    --bg:       #f4e3db;
    --text:     #c79e86;
    --border:   #ecdfd4;
    --accent:   #d84c0b;
    --dark:    #c58e7a;
    --creme_01:   #f5ebe6;
    --creme_02:   #f7e6de;
    --popup-bg:  #f5ebe6;
    --gap:      6px;
    --row-h:    240px;
    --pad:      16px;
    /* Filtre logo SVG → couleur accent #d84c0b */
    --logo-filter: invert(35%) sepia(85%) saturate(900%) hue-rotate(340deg) brightness(88%);
  }

@media (max-width: 767px) {
  :root {
    --pad: 60px; /* Ajuste cette valeur pour la marge mobile souhaitée */
  }
}


@media (min-width: 768px) {
  :root {
    --pad: 50px; /* ou 48px, ajuste selon ton goût */
  }
}

  [data-theme="gris"] {
  --bg:#f0f0ee; --text:#9a9a96; --border:#ddddd9; --accent:#4b4a4a; --popup-bg:  #e8e8e6;  --dark: #888888;
  --logo-filter: invert(35%) sepia(0%) saturate(0%) brightness(85%);
}

  [data-theme="ardoise"] {
    --bg:#d7e9fd; --text:#6b8299; --border:#cdd8e3; --accent:#2d6a9f; --popup-bg:  #dde4ed; --dark: #4f6479;
    --logo-filter: invert(26%) sepia(60%) saturate(700%) hue-rotate(190deg) brightness(80%);
  }
  [data-theme="sauge"] {
    --bg:#d7e6da; --text:#6b8c6e; --border:#cddace; --accent:#3a7d44; --popup-bg:  #dde8de;--dark: #536d55;
    --logo-filter: invert(38%) sepia(40%) saturate(600%) hue-rotate(90deg) brightness(80%);
  }
  [data-theme="nuit"] {
    --bg:#1e2130; --text:#8b9bbf; --border:#2e3450; --accent:#5b7fd4; --popup-bg:  #252839;--dark: #3a6b3d; --dark: #c8d4f0;
    --logo-filter: invert(48%) sepia(40%) saturate(700%) hue-rotate(195deg) brightness(105%);
  }



  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

 html, body {
  height: 100%;
  font-family: 'Quicksand', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
  overflow: hidden;
}

  /* ─── BODY ───────────────────────────────────────────────────────── */
#body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
 
  margin-top: 0;
}

  /* ─── LAYOUT ─────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

  /* ─── TOPBAR ─────────────────────────────────────────────────────── */
#topbar {
  display: flex;
  position: fixed;   /* ← fixed au lieu de sticky */
  top: 0;
  left: 0;
  right: 0;
  align-items: center;
  gap: 8px;
  padding: 0 var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
  height: 80px;
  flex-shrink: 0;
  z-index: 10;

  background: color-mix(in srgb, var(--bg), transparent 15%);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(20px);
}


  /* ── Bloc gauche : logo + textes empilés ── */
  #topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
#topbar-logo {
  flex-shrink: 0;
  height: 38px;
  width: auto;
  display: block;
  color: var(--accent);
  transition: color .3s;
}
  [data-theme="nuit"] #topbar-logo { filter: brightness(0) invert(1); opacity: .75; }

  #topbar-texts {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.0;
    min-width: 0;
    overflow: hidden;
  }
  #topbar-texts .app-name {
    font-weight: 400;
    font-size: 20px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--dark);
    white-space: nowrap;
    transition: color .3s;
  }
  #topbar-texts .gallery-label {
    font-weight: 400;
    font-size: 20px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dark);
    opacity: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #topbar-texts .gallery-name {
    display: inline;
    font-weight: 800;
    color: var(--accent);
    transition: color .3s;
  }
  .icon-btn {
    width: 45px; height: 45px;
    border: none; background: none; cursor: pointer;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--dark);
    opacity: 1;
    transition: opacity .2s, background .2s;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  @media (hover: hover) {
    .icon-btn:hover { opacity: 1; background: rgba(0,0,0,.02);     color: var(--accent);
 }
  }
  .icon-btn:active { opacity: 1; background: rgba(0,0,0,.06); }
  .icon-btn.active { color: var(--accent); opacity: 1; }



  /* ─── POPUP RÉGLAGES UNIFIÉE ─────────────────────────────────────── */
  #settings-popup-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,.28);
    display: none; align-items: center; justify-content: center;
    animation: fadein .18s;
  }
  #settings-popup-overlay.open { display: flex; }

  #settings-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  #settings-popup-header h3 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dark);
    opacity: 1;
    margin: 0;
  }
  #settings-popup-close {
    width: 35px; height: 35px;
    font-size: 20px;
    border: none; background: none; cursor: pointer;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--dark); opacity: 1;
    transition: opacity .15s, background .15s;
  }
  #settings-popup-close:hover { opacity: 1; background: rgba(0,0,0,.07); }

.sp-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text);
  opacity: .75;  /* était .45 */
}

.sp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  
}

.sp-section--first {
  padding-top: 0;
  border-top: none;
}
  /* Recherche dans la popup */
  #sp-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 10px;
    background: var(--bg);
    transition: border-color .2s;
  }
  #sp-search-box:focus-within { border-color: var(--accent); }
  #sp-search-input {
    flex: 1;
    border: none; background: none; outline: none;
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    color: var(--text);
  }
  #sp-search-input::placeholder { color: var(--text); opacity: .4; }
  #sp-search-clear {
    cursor: pointer; display: none;
    color: var(--text); opacity: .5;
    font-size: 15px; line-height: 1;
  }
  #sp-search-clear:hover { opacity: 1; }

  /* Thèmes dans la popup */
  #sp-theme-swatches {
    display: flex;
    justify-content: space-evenly;
    gap: 18px;
    align-items: center;
    height: 72px;
  }
  .sp-swatch-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    cursor: pointer;
    height: 72px;
    justify-content: flex-end;
  }
  .sp-swatch {
    border-radius: 50%;
    border: 2.5px solid transparent;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1), border-color .2s, box-shadow .2s;
  }
  .sp-dot {
    width: 16px; height: 16px; border-radius: 50%;
    transition: transform .2s;
  }
  .sp-swatch-wrap.active .sp-swatch {
    transform: scale(1.2);
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
  }
  .sp-swatch-name {
    font-size: 10px; font-weight: 500;
    color: var(--text);
    min-height: 14px;
    transition: font-weight .15s;
  }
  .sp-swatch-wrap.active .sp-swatch-name { font-weight: 700; }

  /* Slider taille dans la popup */
  #sp-slider-row {
    display: flex; align-items: center; gap: 10px;
  }
  #sp-slider-row svg { opacity: .38; flex-shrink: 0; }
#sp-size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 16px;          /* Hauteur de la zone cliquable (alignée sur l'icône) */
  background: transparent;
  outline: none;
  border: none;          /* Supprime le contour dont tu parles */
  margin: 0;
}

/* La ligne (piste) pour Chrome/Safari */
#sp-size-slider::-webkit-slider-runnable-track {
  height: 1px;           /* Ligne ultra-fine */
  background: var(--dark);
  opacity: 0.7;
  border: none;
}

/* Le bouton pour Chrome/Safari */
#sp-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -7.5px;    /* Aligne le bouton sur la ligne de 1px */
  border: none;
}

/* La ligne pour Firefox */
#sp-size-slider::-moz-range-track {
  height: 1px;
  background: var(--border);
  border: none;
}

/* Le bouton pour Firefox */
#sp-size-slider::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

  /* Bouton accueil dans la popup */
  #sp-home-btn {
    display: flex; align-items: center; gap: 10px;
    justify-content: center;   
    height: 40px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    background: none;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    transition: background .15s, border-color .15s;
    width: 100%;
    text-align: center;
    border-color: var(--accent);
  }
  #sp-home-btn:hover { background: rgba(0,0,0,.05); border-color: var(--accent); }
  #sp-home-btn svg { opacity: .6; flex-shrink: 0; }

  /* Suggestions (overlay flottant utilisé par la recherche dans la popup) */
#suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 400;
  display: none;
  overflow: hidden;
}
  .suggestion-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: .5px solid var(--border);
    transition: background .15s;
  }
  .suggestion-item:last-child { border-bottom: none; }
  .suggestion-item:hover { background: rgba(0,0,0,.04); }
  .suggestion-icon { opacity: .35; font-size: 14px; }



  /* ─── GALERIE ────────────────────────────────────────────────────── */
#gallery-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--pad) 80px;
  scrollbar-width: none;
  scroll-padding-top: 80px;
}
  #gallery-scroll::-webkit-scrollbar { display: none; }

  .year-section { margin-bottom: 24px; }

  .year-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .year-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text);
    opacity: .5;
    white-space: nowrap;
  }
  .year-line {
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* Lignes d'images */
  .img-row {
    display: flex;
    gap: var(--gap);
    margin-bottom: var(--gap);
    align-items: flex-start; /* toutes les images partent du même haut */
  }
  .img-tile {
    flex-shrink: 0;
    flex-grow: 0;
    cursor: pointer;
    position: relative;
    transition: transform .15s, box-shadow .15s;
    line-height: 0;
    -webkit-tap-highlight-color: transparent;
    /* La largeur est imposée par JS ; la hauteur résulte naturellement
       du ratio réel de l'image → aucun crop, aucun fond */
  }
  @media (hover: hover) {
    .img-tile:hover { transform: scale(1.012); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
  }
  .img-tile img {
    display: block;
    width: 100%;
    height: auto;        /* JAMAIS de height forcée */
    vertical-align: top;
  }
  .img-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text); opacity: .4; font-size: 28px;
  }

  /* ─── BARRE ANNÉES (scrollbar style) ────────────────────────────── */
  #year-bar {
    position: absolute;
    top: 0; right: -5px; bottom: 0;
    width: 90px;            /* plus large pour ne pas couper le thumb */
    padding-right: 6px;     /* espace à droite pour le thumb */
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    display: flex;
    align-items: stretch;
  }
  #year-bar.visible { opacity: 1; }
  /* Rester visible quand la souris est sur la barre */
  #year-bar.hovered { opacity: 1; }
  #year-bar-inner {
    flex: 1;
    display: flex;
    align-items: stretch;
    gap: 0;
  }
  #year-labels {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    padding: 12px 0;
    pointer-events: all;
    gap: 4px;
  }
  .year-pill {
    cursor: pointer;
    border-radius: 20px;
    font-family: 'Quicksand', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    padding: 4px 10px;
    min-width: 64px;
    text-align: center;
    background: rgba(0,0,0,.05);
    transition: background .2s, color .2s, opacity .2s;
    backdrop-filter: blur(5px);
    white-space: nowrap;
    user-select: none;
  }
  .year-pill:hover { opacity: .85; background: rgba(0,0,0,.20); }
  .year-pill.active {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
  }
  #scrolltrack-wrap {
    width: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 5px;      /* 5px de chaque côté → thumb centré et visible */
    position: relative;
    pointer-events: all;
  }
  #scrolltrack {
    width: 3px;
    flex: 1;
    background: var(--border);
    border-radius: 2px;
    position: relative;
    background: transparent;
  }
  #scrollthumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 13px; height: 48px;
    background: var(--accent);
    opacity: 1;
    border-radius: 6px;
    cursor: grab;
    transition: width .15s, height .15s, opacity .15s, border-radius .15s;
    top: 0;
  }
  #scrollthumb:hover {
    width: 14px;
    opacity: 1;
    background: var(--dark);

  }
  #scrollthumb:active, #scrollthumb.dragging {
    width: 14px; height: 52px;
    opacity: 1; border-radius: 9px; cursor: grabbing;
  }

  /* ─── ÉTAT VIDE ──────────────────────────────────────────────────── */
  #empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    color: var(--text);
    padding: 32px;
    text-align: center;
  }
  #empty.show { display: flex; }
  #empty svg { opacity: .4; }
  #empty h2 { font-size: 18px; font-weight: 600; opacity: .8; }
  #empty p { font-size: 14px; opacity: .6; }
  #empty-clear {
    font-size: 14px; font-weight: 600; color: var(--accent);
    cursor: pointer; display: none;
  }
  #empty-clear:hover { text-decoration: underline; }

  /* ─── LOADER ─────────────────────────────────────────────────────── */
  #loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    z-index: 20;
    transition: opacity .3s;
  }
  #loader.hidden { opacity: 0; pointer-events: none; }
  .spinner {
    width: 32px; height: 32px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ─── LIGHTBOX ───────────────────────────────────────────────────── */
  #lightbox {
    position: fixed; inset: 0; z-index: 200;
    display: none;
    flex-direction: column;
    background: var(--bg);
  }
  #lightbox.open { display: flex; }
  @keyframes lb-fadein { from { opacity: 0; } to { opacity: 1; } }

  /* Barre haute */
  #lb-topbar {
    flex-shrink: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    animation: lb-fadein .18s;
  }
  #lb-counter {
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
  }
  #lb-actions { display: flex; align-items: center; gap: 8px; }

  /* Bouton action (partager, télécharger, zoom, fermer) */
  .lb-action-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
  }
  .lb-action-btn:hover { background: var(--border); }
  .lb-action-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }
  /* Étoile favorite : remplie en accent, pas de bg */
  #lb-btn-fav.fav-on {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg);
  }
  #lb-btn-fav.fav-on svg { fill: var(--accent); }
  .lb-action-btn.danger { color: var(--accent); border-color: var(--accent); }
  .lb-action-btn.danger:hover { background: var(--accent); color: #fff; }

  /* Curseur pan quand zoomé */
  #lb-stage.panning { cursor: grab; }
  #lb-stage.panning:active { cursor: grabbing; }
  #lb-stage.zoomed #lb-prev,
  #lb-stage.zoomed #lb-next { display: none; }

  /* Bouton fermer (accent) */
  #lb-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: opacity .15s;
    flex-shrink: 0;
  }
  #lb-close:hover { opacity: .85; }

  /* Zone image centrale */
  #lb-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Pages (une par image) */
  #lb-pages {
    position: absolute; inset: 0;
    display: flex;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    will-change: transform;
    cursor: grab;
  }
  #lb-pages:active { cursor: grabbing; }
  .lb-page {
    flex-shrink: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 56px;
    user-select: none;
    -webkit-user-select: none;
  }
  .lb-page img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    animation: lb-fadein .22s;
    transform-origin: center center;
    transition: transform .25s ease;
  }
  @media (max-width: 600px) {
    .lb-page { padding: 0 8px; }
  }

  /* Flèches nav */
  .lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, opacity .2s;
    z-index: 2;
    opacity: .85;
  }
  .lb-nav:hover { background: var(--border); opacity: 1; }
  .lb-nav:disabled { opacity: 0; pointer-events: none; }
  #lb-prev { left: 8px; }
  #lb-next { right: 8px; }

  /* Barre basse */
  #lb-bottombar {
    flex-shrink: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    animation: lb-fadein .18s;
    gap: 12px;
  }
  #lb-title {
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: var(--text);
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
  }
  #lb-date {
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    flex-shrink: 0;
  }

  /* Dialog confirm suppression */
  #lb-dialog-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,.35);
    display: none; align-items: center; justify-content: center;
  }
  #lb-dialog-overlay.open { display: flex; }
  #lb-dialog {
    background: var(--bg);
    border-radius: 12px;
    padding: 24px;
    width: min(320px, 90vw);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
  }
  #lb-dialog h3 {
    font-family: 'Quicksand', sans-serif; font-size: 16px; font-weight: 700;
    color: var(--text); margin-bottom: 8px;
  }
  #lb-dialog p {
    font-family: 'Quicksand', sans-serif; font-size: 14px;
    color: var(--text); opacity: .7; margin-bottom: 20px;
  }
  #lb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
  .lb-dlg-btn {
    padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
    font-family: 'Quicksand', sans-serif; font-size: 14px; font-weight: 600;
    transition: opacity .15s;
  }
  .lb-dlg-btn:hover { opacity: .8; }
  .lb-dlg-cancel { background: var(--border); color: var(--text); }
  .lb-dlg-confirm { background: var(--accent); color: #fff; }

  /* ─── SUPABASE CONFIG NOTICE ─────────────────────────────────────── */
  #config-notice {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff;
    padding: 10px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 300; display: none;
    text-align: center;
    max-width: 90vw;
  }

  /* ─── RESPONSIVE ─────────────────────────────────────────────────── */

  /* Tablette */
  @media (max-width: 768px) {
    :root { --row-h: 200px; --pad: 12px; }
    #gallery-scroll { padding: 0 12px 100px; }
    #year-bar { width: 70px; }
    .year-pill { font-size: 13px; padding: 4px 8px; min-width: 52px; }
  }

  /* Mobile */
  @media (max-width: 480px) {
    :root { --row-h: 160px; --pad: 10px; }

    /* — Topbar compacte — */
 #topbar { height: auto; padding: 8px 10px; }  #topbar-logo {
    display: block;
    height: 28px;
  }
   #body { margin-top: 0; padding-top: 0; }
    #topbar-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
   #topbar-texts {
    display: flex;

  }
    #topbar-texts .app-name { font-size: 18px; }
    #topbar-texts .gallery-label { font-size: 18px; }

    /* Boutons icon plus petits */
    .icon-btn { width: 40px; height: 40px; position: absolute;
    right: 0px;
    top:44px;
    bottom: 15px;}
    /* Le hamburger reste dans le flux normal de la topbar */
#btn-settings-popup { position: static; width: 32px; height: auto; }

@media (max-width: 480px) {
  #btn-settings-popup { width: 28px; }
  #hamburger-icon { width: 28px; height: 14px; }
}
    

    /* — Galerie centrée — */
    #gallery-scroll { padding: 0 8px 90px; }
    #gallery-content { display: flex; flex-direction: column; align-items: center; }
    .year-section { width: 100%; }

    /* — Barre années : collée à droite — */
    #year-bar { right: 22px; width: 52px; }
    #year-labels { gap: 6px; padding: 8px 0; }
    .year-pill { font-size: 15px; padding: 4px 6px; min-width: 60px; border-radius: 14px; backdrop-filter: blur(10px);}
    #scrolltrack-wrap { width: 16px; padding: 12px 3px;  }
    #scrollthumb { width: 10px; height: 36px; }
     #scrollthumb:hover {
    width: 16px;
    opacity: .85;
  }
  #scrollthumb:active, #scrollthumb.dragging {
    width: 11px; height: 44px;
    opacity: 1; border-radius: 9px; cursor: grabbing;
  }


    /* — Lightbox barre haute — */
    #lb-topbar { padding: 0 8px; height: 44px; }
    #lb-actions { gap: 4px; }
    .lb-action-btn { width: 30px; height: 30px; }
    #lb-close { width: 30px; height: 30px; }

    /* — Lightbox barre basse — */
    #lb-bottombar { height: 44px; padding: 0 10px; gap: 8px; }
    #lb-title { font-size: 12px; }
    #lb-date  { font-size: 12px; }

    /* — FAB — */
    #fab-add {
      bottom: calc(20px + env(safe-area-inset-bottom, 0px));
      right: 20px; width: 54px; height: 54px;
    }

    /* — Popup réglages — */
    #settings-popup { padding: 22px 20px 18px; }
    #sp-theme-swatches { gap: 12px; flex-wrap: wrap; justify-content: center; }

    /* — Year section — */
    .year-label { font-size: 11px; letter-spacing: 1px; }
  }

  /* Très petits écrans (iPhone SE, etc.) */
  @media (max-width: 360px) {
    :root { --row-h: 130px; }
    #topbar-texts .app-name { font-size: 10px; }
    .year-pill { font-size: 10px; min-width: 34px; padding: 3px 5px; }
    #year-bar { width: 44px; }
    #scrolltrack-wrap { display: none; }
  }

  /* ─── (ancienne popup thème supprimée — remplacée par #settings-popup-overlay) ─── */

  /* ─── POPUP RÉGLAGES — DEUX PANNEAUX ───────────────────────────── */
  #settings-popup {
    background: var(--popup-bg);
    border-radius: 22px;
    box-shadow: 0 16px 56px rgba(0,0,0,.22);
    width: min(340px, 92vw);
    max-height: 80vh;
    overflow: hidden;
    animation: popup-in .22s cubic-bezier(.34,1.56,.64,1);
  }
  #sp-panel-main {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px 28px 24px;
    box-sizing: border-box;
  }
  #sp-panel-galeries {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 28px 28px 24px;
    box-sizing: border-box;
    max-height: 80vh;
  }
  /* Quand le panneau galeries est actif, on force la même hauteur que le panneau main
     en rendant le popup à hauteur fixe via JS — voir openSettingsPopup */
  #settings-popup.show-galeries #sp-panel-main    { display: none; }
  #settings-popup.show-galeries #sp-panel-galeries { display: flex; }

  /* Header panneau galeries */
  #galeries-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }
  #galeries-popup-header h3 {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dark);
    margin: 0;
  }
  #galeries-popup-close {
    width: 35px; height: 35px;
    font-size: 20px;
    border: none; background: none; cursor: pointer;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--dark); opacity: 1;
    transition: opacity .15s, background .15s;
    flex-shrink: 0;
  }
  #galeries-popup-close:hover { opacity: 1; background: rgba(0,0,0,.07); }
  #galeries-popup-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: none;
    flex: 1;
  }
  #galeries-popup-body::-webkit-scrollbar { display: none; }

  /* Bouton Mes galeries dans réglages */
  #sp-galeries-btn {
    display: flex; align-items: center; gap: 10px;
    justify-content: center;
    height: 40px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    background: none;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: background .15s, border-color .15s, color .15s;
    width: 100%;
  }
  #sp-galeries-btn:hover { background: rgba(0,0,0,.04); border-color: var(--accent); color: var(--accent); }
  #sp-galeries-btn svg { opacity: .6; flex-shrink: 0; }
  @keyframes fadein { from { opacity:0; } to { opacity:1; } }

  /* ─── FAB AJOUTER ───────────────────────────────────────────────── */
  #fab-add {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.28);
    z-index: 50;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s, background .2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  @media (hover: hover) {
    #fab-add:hover {
      transform: scale(1.08);
      box-shadow: 0 8px 28px rgba(0,0,0,.32);
      background: color-mix(in srgb, var(--accent) 85%, #000);
    }
  }
  #fab-add:active { transform: scale(.93); }
  /* ─── BOTTOM SHEET MODIFIER (même style qu'ajout) ───────────────── */
  #modifier-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,.35);
    display: none; align-items: flex-end; justify-content: center;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    animation: fadein .2s;
  }
  #modifier-overlay.open { display: flex; }
  #modifier-sheet {
    background: var(--bg); width: 100%; height: 88vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.18);
    display: flex; flex-direction: column; overflow: hidden;
    animation: sheet-up .28s cubic-bezier(.4,0,.2,1);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  #modifier-handle-bar { display: flex; justify-content: center; padding: 10px 0 4px; flex-shrink: 0; cursor: grab; }
  #modifier-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); }
  #modifier-iframe { flex: 1; border: none; width: 100%; background: transparent; }
  @media (min-width: 769px) {
    #modifier-overlay { align-items: center; }
    #modifier-sheet { width: min(760px, 92vw); height: min(92vh, 980px); border-radius: 20px; animation: popup-in .25s cubic-bezier(.34,1.4,.64,1); }
    #modifier-handle-bar { display: none; }
  }
  @media (max-width: 768px) and (orientation: landscape) { #modifier-sheet { height: 90vh; } }

  /* ─── BOTTOM SHEET AJOUT ─────────────────────────────────────────── */
  #ajout-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,.35);
    display: none;
    align-items: flex-end;       /* mobile : collé en bas */
    justify-content: center;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadein .2s;
  }
  #ajout-overlay.open { display: flex; }

  #ajout-sheet {
    background: var(--bg);
    width: 100%;
    /* Mobile : 88% de la hauteur écran pour plus de place */
    height: 88vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sheet-up .28s cubic-bezier(.4,0,.2,1);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  @keyframes sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Poignée */
  #ajout-handle-bar {
    display: flex; justify-content: center;
    padding: 10px 0 4px;
    flex-shrink: 0;
    cursor: grab;
  }
  #ajout-handle {
    width: 36px; height: 4px;
    border-radius: 2px;
    background: var(--border);
  }

  /* L'iframe prend tout l'espace restant */
  #ajout-iframe {
    flex: 1;
    border: none;
    width: 100%;
    background: transparent;
  }

  /* ── Desktop : panneau centré, plus large, avec marges ── */
  @media (min-width: 769px) {
    #ajout-overlay {
      align-items: center;
    }
    #ajout-sheet {
      width: min(760px, 92vw);
      height: min(92vh, 980px);
      border-radius: 20px;
      animation: popup-in .25s cubic-bezier(.34,1.4,.64,1);
    }
    #ajout-handle-bar { display: none; }
    @keyframes popup-in {
      from { transform: scale(.94); opacity: 0; }
      to   { transform: scale(1);   opacity: 1; }
    }
  }

  /* ── Mobile paysage : hauteur adaptée ── */
  @media (max-width: 768px) and (orientation: landscape) {
    #ajout-sheet { height: 90vh; }
  }


/* ─── POPUP SERVICES ─────────────────────────────────────────────── */
#lb-services-overlay {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(0,0,0,.40);
  display: none; align-items: flex-end; justify-content: center;
}
#lb-services-overlay.open { display: flex; }

#lb-services-popup {
  background: var(--popup-bg);
  border-radius: 22px 22px 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  overflow-y: auto;
  animation: lb-popup-in .2s cubic-bezier(.2,.8,.4,1) both;
}
@keyframes lb-popup-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (min-width: 600px) {
  #lb-services-overlay {
    align-items: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  #lb-services-popup {
    border-radius: 22px;
    max-height: 85vh;
    padding-bottom: 24px;
    animation: lb-popup-in-center .2s cubic-bezier(.2,.8,.4,1) both;
  }
}
@keyframes lb-popup-in-center {
  from { transform: scale(.97) translateY(8px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}

#lb-services-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
#lb-services-title {
  font-size: 13px; font-weight: 700; letter-spacing: .10em;
  text-transform: uppercase; color: var(--dark);
}
#lb-services-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: background .15s;
}
#lb-services-close:hover { background: var(--border); }

#lb-services-grid {
  display: flex; flex-direction: column; gap: 14px;
}

.lb-service-card {
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  transition: box-shadow .22s, transform .22s;
}
.lb-service-card:hover {
  box-shadow: 0 12px 36px rgba(58,34,24,.10);
  transform: translateY(-2px);
}
.lb-service-thumb {
  position: relative;
  overflow: hidden;
  background: var(--mockup-bg, #fadaca);
  width: 100%;
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
}
.lb-service-mockup {
  flex-shrink: 0;
  width: 110px; height: 78px;
  border-radius: 10px; overflow: hidden;
  background: var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,.10);
}
.lb-service-mockup-inner {
  width: 100%; height: 100%;
}
.lb-service-mockup img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.lb-service-info {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
}
.lb-service-name {
  font-size: 15px; font-weight: 700; color: var(--dark);
}
.lb-service-desc {
  font-size: 12px; color: var(--text); line-height: 1.5;
}
.lb-service-body {
  padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.lb-service-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.lb-service-price {
  font-size: 18px; font-weight: 700; color: var(--dark);
  flex: 1;
}
.lb-service-btn {
  margin-left: auto;
  padding: 9px 22px; border-radius: 99px;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px; font-weight: 700;
  transition: opacity .15s, transform .15s;
}
.lb-service-btn:hover { opacity: .88; transform: scale(1.04); }