*{box-sizing:border-box}html,body{margin:0;height:100%;font-family:system-ui,-apple-system,Segoe UI,sans-serif;color:#1e2329}body{background:#f5f5f2}header{height:58px;background:#fff;border-bottom:1px solid #ddd;display:flex;align-items:center;justify-content:space-between;padding:0 18px}header strong{font-size:18px}header span{font-size:12px;margin-left:8px;color:#777}.actions{display:flex;gap:8px}button{border:1px solid #bbb;background:white;border-radius:8px;padding:9px 12px;cursor:pointer}main{display:grid;grid-template-columns:minmax(0,1fr) 320px;height:calc(100% - 58px)}#map{height:100%;min-height:500px}aside{background:#fff;border-left:1px solid #ddd;padding:18px;overflow:auto}h2,h3{margin:0 0 12px}.hint,.small{color:#666;font-size:13px;line-height:1.4}label{display:block;font-size:13px;font-weight:600;margin:14px 0}input[type=text]{width:100%;padding:9px;border:1px solid #ccc;border-radius:7px;margin-top:5px}input[type=range]{width:100%;margin-top:8px}.file{font-size:12px;color:#555;word-break:break-all}.danger{margin-top:18px;border-color:#c66}.zone-row{padding:9px;border-bottom:1px solid #eee;font-size:13px;cursor:pointer}.zone-row:hover{background:#f7f7f7}hr{border:0;border-top:1px solid #eee;margin:22px 0}@media(max-width:760px){main{grid-template-columns:1fr;grid-template-rows:60vh auto}aside{border-left:0;border-top:1px solid #ddd}header{padding:0 10px}.actions button{padding:7px 8px;font-size:12px}}
.selected-info{
  margin:10px 0 4px;
  padding:9px 10px;
  border-radius:8px;
  background:#f2f4f7;
  font-size:13px;
  font-weight:600;
}
.zone-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  border-left:4px solid transparent;
}
.zone-row.selected{
  background:#eef3ff;
  border-left-color:#315efb;
  font-weight:700;
}
.zone-row .zone-main{
  flex:1;
  min-width:0;
}
.zone-row .zone-delete{
  border:0;
  background:transparent;
  padding:4px 6px;
  font-size:15px;
  line-height:1;
  opacity:.6;
}
.zone-row .zone-delete:hover{opacity:1}


/* V3 — espace de travail 50 / 50 */
main{
  grid-template-columns: 1fr 1fr;
}
aside{
  padding: 24px;
}

/* Sur téléphone/tablette en portrait : deux moitiés verticales,
   carte en haut et panneau de réglages en bas. */
@media(max-width:760px){
  header{
    height:58px;
  }
  main{
    height:calc(100dvh - 58px);
    display:grid;
    grid-template-columns:1fr;
    grid-template-rows:1fr 1fr;
  }
  #map{
    height:100%;
    min-height:0;
  }
  aside{
    height:100%;
    min-height:0;
    overflow-y:auto;
    padding:16px;
    border-left:0;
    border-top:1px solid #ddd;
    -webkit-overflow-scrolling:touch;
  }
  #editor label{
    margin:10px 0;
  }
}

.audio-actions{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.audio-actions button{min-width:105px}
button:disabled{opacity:.45;cursor:not-allowed}
#generateBtn{font-weight:700}

/* V6 — barre d'actions compacte, pensée mobile */
header > div:first-child{
  display:flex;
  align-items:baseline;
  gap:5px;
  min-width:0;
}
header strong{
  font-size:15px;
  white-space:nowrap;
}
header span{
  margin-left:0;
}
.actions{
  gap:6px;
  flex-wrap:nowrap;
}
.actions button,
.file-button{
  min-height:38px;
  padding:7px 9px;
  border:1px solid #bbb;
  background:#fff;
  border-radius:8px;
  font-size:12px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  cursor:pointer;
  white-space:nowrap;
}
.file-button input{
  display:none;
}
@media(max-width:620px){
  header{
    padding:0 6px;
  }
  header strong{
    font-size:13px;
  }
  header > div:first-child span{
    display:none;
  }
  .actions{
    gap:4px;
  }
  .actions button,
  .file-button{
    width:40px;
    min-width:40px;
    height:38px;
    padding:0;
    font-size:17px;
  }
  .actions button span,
  .file-button span{
    display:none;
  }
}

/* V9.2 */
.map-wrap{position:relative;min-width:0;min-height:0}
.map-wrap #map{width:100%;height:100%}
.actions{align-items:center}
.file-button{margin:0!important;align-self:center;vertical-align:middle}

/* Dessin simplifié : pas de Finish/Delete last point/Cancel ni tooltip */
.leaflet-draw-actions{display:none!important;}
.leaflet-draw-tooltip{display:none!important;}
.leaflet-draw-toolbar a.draw-active{
  background-color:#dfe7ef!important;
  box-shadow:inset 0 0 0 2px #333;
}

/* Croix suppression : même gabarit que les autres contrôles */
.leaflet-control.zone-delete-control{display:block!important;width:34px;height:34px}
.leaflet-control.zone-delete-control button{
  display:block;width:32px;height:32px;min-width:32px;min-height:32px;
  padding:0;margin:0;border:0;border-radius:2px;background:#fff;
  color:#c62828;font-size:17px;font-weight:700;line-height:32px;text-align:center
}
.leaflet-control.zone-delete-control.disabled button{opacity:.35;cursor:default}

/* Adresse */
.address-panel{
  position:absolute;z-index:1001;top:10px;left:52px;right:10px;
  background:#fff;border:1px solid #ccc;border-radius:9px;padding:8px;
  display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:6px;
  box-shadow:0 1px 5px rgba(0,0,0,.2)
}
.address-panel[hidden]{display:none}
.address-panel input{min-width:0;height:38px;padding:7px 9px;border:1px solid #bbb;border-radius:7px;font-size:16px}
.address-panel button{height:38px;padding:6px 9px}
#addressResults{grid-column:1/-1;max-height:180px;overflow:auto}
.address-result{display:block;width:100%;height:auto!important;text-align:left;border:0;border-top:1px solid #eee;border-radius:0;padding:9px 5px!important;background:#fff}
@media(max-width:620px){
  .address-panel{left:8px;right:8px;top:8px;grid-template-columns:minmax(0,1fr) auto}
  #addressSearchBtn{grid-column:1/2}
  #addressCloseBtn{grid-column:2/3;grid-row:1/2}
}


/* V9.4 — publication directe */
.publish-modal{position:fixed;inset:0;z-index:3000;background:rgba(0,0,0,.45);display:grid;place-items:center;padding:18px}
.publish-modal[hidden]{display:none}
.publish-dialog{width:min(520px,100%);background:#fff;border-radius:14px;padding:20px;box-shadow:0 18px 60px rgba(0,0,0,.25)}
.publish-dialog h2{margin:0 0 10px}
.publish-dialog input[type=text],.publish-dialog input[type=password]{width:100%;padding:10px;border:1px solid #bbb;border-radius:8px;margin-top:5px;font:inherit}
.publish-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
#generateBtn.publish-busy{opacity:.7;pointer-events:none}

.project-row{display:flex;gap:8px;align-items:stretch;margin:8px 0}
.project-open{flex:1;text-align:left;display:flex;flex-direction:column;gap:3px;padding:12px}
.project-open span{font-size:12px;opacity:.65;font-weight:400}
.project-delete{width:42px;min-width:42px}


/* V9.9.1 — sélection MP3 claire : seul le bouton est visible */
.audio-file-field{margin:14px 0}
.audio-file-title{font-size:13px;font-weight:600;margin-bottom:6px}
.audio-file-input{display:none}
.audio-file-button{margin:0!important;width:max-content}

/* V10.0 Terrain — la barre reste utilisable avec les commandes de transfert. */
@media(max-width:760px){
  header{overflow:hidden}
  .actions{overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;flex:1;justify-content:flex-end}
  .actions::-webkit-scrollbar{display:none}
}


/* V10.2.2 — menu mobile Samsung : Sauver + Cloud restent visibles,
   les autres commandes passent dans un menu escamotable. */
.mobile-quick-actions{display:none}
@media(max-width:760px){
  header{position:relative;z-index:2200;overflow:visible!important;justify-content:space-between}
  .mobile-quick-actions{display:flex;align-items:center;gap:5px;margin-left:auto}
  .mobile-quick-actions button{width:40px;min-width:40px;height:38px;padding:0;font-size:18px;line-height:1}
  header .actions{
    display:none;
    position:absolute;
    top:52px;
    right:6px;
    z-index:2300;
    width:min(250px,calc(100vw - 12px));
    max-height:calc(100dvh - 70px);
    overflow-y:auto;
    padding:8px;
    background:#fff;
    border:1px solid #ccc;
    border-radius:10px;
    box-shadow:0 10px 28px rgba(0,0,0,.20);
    flex-direction:column;
    align-items:stretch;
    gap:5px;
  }
  header .actions.mobile-open{display:flex}
  header .actions button,
  header .actions .file-button{
    width:100%;height:42px;min-height:42px;padding:8px 11px;
    justify-content:flex-start;font-size:14px;gap:8px
  }
  header .actions button span,
  header .actions .file-button span{display:inline!important;font-size:14px;color:inherit}
  header .actions #saveBtn,
  header .actions #cloudBtn{display:none}
}

.toggle-line{display:flex;align-items:center;gap:8px;font-size:.88rem;line-height:1.3}.toggle-line input{width:auto;margin:0}.toggle-line+label{margin-top:10px}input[type="range"]:disabled{opacity:.45}

/* V10.4 — réorganisation tactile/souris des zones */
.zone-row{cursor:default}
.zone-drag-handle{
  flex:0 0 34px;
  width:34px;
  height:34px;
  border:0;
  border-radius:7px;
  background:transparent;
  font-size:18px;
  line-height:1;
  cursor:grab;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  color:#666;
}
.zone-drag-handle:active{cursor:grabbing}
.zone-row.dragging{
  opacity:.72;
  background:#f2f5ff;
  box-shadow:0 4px 14px rgba(0,0,0,.12);
}
.zone-reordering{user-select:none;-webkit-user-select:none}
.zone-list-title{font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.zone-list-details{font-size:12px;font-weight:400;color:#666;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.zone-row.selected .zone-list-details{color:#4b5563}
@media(max-width:760px){
  .zone-drag-handle{width:40px;height:40px;flex-basis:40px;font-size:20px}
  .zone-row{min-height:48px}
}

.movement-mode{margin:10px 0 14px}
.movement-options{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.movement-options label{display:inline-flex;align-items:center;gap:5px;padding:7px 9px;border:1px solid var(--line,#d8d8d8);border-radius:9px;cursor:pointer;font-size:.9rem}
.movement-options input{margin:0}
