/* « Personnalise ta voiture » : choix de la voiture et éditeur de livrée 3D (couleurs et polices du site). */

/* ---------- Choix de la voiture ---------- */

.ed-choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; margin-bottom: 40px; }
.ed-carte { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-grand); overflow: hidden; color: var(--texte); text-decoration: none !important; transition: transform .15s, border-color .15s, box-shadow .15s; }
.ed-carte:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--ombre-douce); }
.ed-carte-image { display: block; aspect-ratio: 16 / 9; background: var(--fond-2); }
.ed-carte-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-carte-texte { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; }
.ed-carte-texte strong { font: italic 900 1.4rem/1.05 var(--police-titre); text-transform: uppercase; }
.ed-etapes { list-style: none; counter-reset: etape; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; }
.ed-etapes li { counter-increment: etape; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-grand); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.ed-etapes li::before { content: counter(etape); font: italic 900 2.2rem/1 var(--police-titre); color: var(--accent); }
.ed-etapes strong { font: italic 800 1.2rem/1.1 var(--police-cond); text-transform: uppercase; }
.ed-etapes span { color: var(--texte-2); }

/* ---------- Mes livrées (par voiture) ---------- */

.ed-retour-garage { margin: 0 0 10px -10px; }
.ed-garage-info { display: flex; align-items: center; gap: .5em; color: var(--texte-2); margin: 0 0 16px; }
.ed-importer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ed-garage .ed-h { margin-top: 8px; }
.ed-livrees { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.ed-livree { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-grand); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ed-livree:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--ombre-douce); }
.ed-livree-image { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--fond-2); overflow: hidden; }
.ed-livree-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-livree-sans-photo { opacity: .45; filter: grayscale(1); }
.ed-livree-badge { position: absolute; left: 10px; top: 10px; background: var(--surface); }
.ed-livree-texte { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 4px; min-width: 0; }
.ed-livree-nom { font: italic 900 1.25rem/1.1 var(--police-titre); text-transform: uppercase; color: var(--texte); text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-livree-nom:hover { color: var(--accent); }
.ed-livree-date { color: var(--texte-3); font-size: .88rem; }
.ed-livree-champ { min-height: 34px; padding: .25em .5em; background: var(--fond-2); color: var(--texte); border: 1px solid var(--accent); border-radius: 6px; font: italic 900 1.15rem/1.1 var(--police-titre); text-transform: uppercase; }
.ed-livree-actions { display: flex; gap: 6px; padding: 8px 14px 14px; }
.ed-livree-actions .ed-icone { width: 34px; height: 34px; }
.ed-livree-actions .ed-icone svg { width: 17px; height: 17px; }
.ed-livree-nouvelle { align-items: center; justify-content: center; gap: 6px; min-height: 250px; padding: 20px; border: 2px dashed var(--bord-fort); background: transparent; color: var(--texte); cursor: pointer; font: inherit; text-align: center; }
.ed-livree-nouvelle:hover { background: var(--accent-doux); }
.ed-livree-nouvelle strong { font: italic 900 1.4rem/1.1 var(--police-titre); text-transform: uppercase; }
.ed-livree-plus { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-texte); font: 300 2.6rem/1 var(--police-texte); margin-bottom: 6px; }
.ed-livree-nouvelle[disabled] { opacity: .6; cursor: wait; }

/* ---------- Éditeur : page pleine hauteur ---------- */

.page-editeur .pied { display: none; }
.editeur { display: flex; flex-direction: column; height: calc(100vh - 71px); height: calc(100dvh - 71px); min-height: 560px; background: var(--fond); }
.ed-barre { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--bord); min-height: 58px; }
.ed-retour { display: inline-flex; align-items: center; gap: .4em; color: var(--texte-2); font: italic 800 1rem/1 var(--police-cond); text-transform: uppercase; letter-spacing: .03em; text-decoration: none !important; padding: .5em .6em; border-radius: var(--rayon); }
.ed-retour:hover { color: var(--texte); background: var(--surface-2); }
.ico-retour { transform: scaleX(-1); }
.ed-titre { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ed-titre-sur { font: 600 .74rem/1 var(--police-cond); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.ed-nom { width: 100%; max-width: 420px; min-width: 0; padding: 2px 6px; margin-left: -6px; background: transparent; color: var(--texte); border: 1px solid transparent; border-radius: 6px; font: italic 900 clamp(1.15rem, 2vw, 1.5rem)/1.1 var(--police-titre); text-transform: uppercase; text-overflow: ellipsis; }
.ed-nom:hover { border-color: var(--bord); }
.ed-nom:focus { outline: none; border-color: var(--accent); background: var(--fond-2); }
.ed-etat { display: inline-flex; align-items: center; gap: 6px; font: 600 .78rem/1.2 var(--police-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); white-space: nowrap; }
.ed-etat::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--texte-3); }
.ed-etat[data-etat="ok"]::before { background: var(--vert); }
.ed-etat[data-etat="encours"]::before { background: var(--accent); animation: ed-clignote 1s infinite; }
.ed-etat[data-etat="erreur"] { color: var(--rouge); white-space: normal; }
.ed-etat[data-etat="erreur"]::before { background: var(--rouge); }
@keyframes ed-clignote { 50% { opacity: .3; } }
.ed-outils { display: flex; align-items: center; gap: 8px; }

.ed-icone { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0; background: none; color: var(--texte-2); border: 1px solid var(--bord); border-radius: var(--rayon); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.ed-icone:hover:not([disabled]) { color: var(--texte); border-color: var(--bord-fort); background: var(--surface-2); }
.ed-icone[disabled] { opacity: .35; cursor: default; }
.ed-icone svg, .ed-icone .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-icone-danger:hover:not([disabled]) { color: var(--rouge); border-color: color-mix(in srgb, var(--rouge) 55%, transparent); }

.ed-menu { position: relative; }
.ed-menu summary { list-style: none; }
.ed-menu summary::-webkit-details-marker { display: none; }
.ed-menu-liste { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; background: var(--surface); border: 1px solid var(--bord-fort); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 6px; display: flex; flex-direction: column; }
.ed-menu-liste button { display: flex; align-items: center; gap: .6em; background: none; border: 0; color: var(--texte); font: 500 .98rem/1.2 var(--police-texte); padding: .65em .75em; border-radius: 6px; cursor: pointer; text-align: left; }
.ed-menu-liste button:hover { background: var(--surface-2); }

.ed-corps { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr) 310px; }
.ed-panneau { min-height: 0; overflow-y: auto; background: var(--surface); scrollbar-width: thin; }
.ed-gauche { border-right: 1px solid var(--bord); }
.ed-droite { border-left: 1px solid var(--bord); }
.ed-section { padding: 16px; border-bottom: 1px solid var(--bord); }
.ed-section:last-child { border-bottom: 0; }
.ed-h { font: italic 900 1.15rem/1.1 var(--police-titre); text-transform: uppercase; margin: 0 0 12px; display: flex; align-items: center; gap: .5em; }
.ed-h::before { content: ''; width: 14px; height: 4px; background: var(--accent); transform: skewX(-24deg); flex: none; }
.ed-compte { font: 600 .8rem/1 var(--police-cond); color: var(--texte-2); border: 1px solid var(--bord-fort); border-radius: 999px; padding: .25em .6em; font-style: normal; }
.ed-vide, .ed-astuce { color: var(--texte-2); font-size: .9rem; margin: 0; }
.ed-astuce { margin-top: 12px; }

/* Vue 3D */
.ed-vue { position: relative; min-width: 0; min-height: 0; background: var(--fond-2); overflow: hidden; }
.ed-vue canvas[data-vue] { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.ed-cube { position: absolute; top: 12px; right: 12px; width: 112px; height: 112px; z-index: 2; touch-action: none; }
.ed-recentrer { position: absolute; top: 132px; right: 48px; z-index: 2; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.ed-aide { position: absolute; left: 12px; bottom: 10px; right: 140px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font: 600 .72rem/1.3 var(--police-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--texte-3); pointer-events: none; }
.ed-chargement { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; gap: 14px; text-align: center; background: var(--fond-2); }
.ed-chargement p { margin: 0; font: italic 800 1.2rem/1.2 var(--police-cond); text-transform: uppercase; }
.ed-chargement-erreur p { color: var(--rouge); max-width: 420px; padding: 0 16px; }
.ed-chargement-erreur .ed-progression { display: none; }
.ed-progression { width: min(320px, 70vw); height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.ed-progression i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Poignées du calque sélectionné, sur la voiture */
.ed-poignees { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: visible; }
.ed-contour { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.ed-contour-sym { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .6; }
.ed-tige { stroke: var(--accent); stroke-width: 1.6; }
.ed-poignee { pointer-events: all; touch-action: none; }
.ed-poignee-zone { fill: transparent; }
.ed-poignee-carre { fill: #ffffff; stroke: var(--accent); stroke-width: 2; transition: transform .12s; }
.ed-poignee:hover .ed-poignee-carre, .ed-poignees-actif .ed-poignee-carre { transform: scale(1.25); }
.ed-poignee-rotation { cursor: grab; }
.ed-poignees-actif .ed-poignee-rotation { cursor: grabbing; }
.ed-rotation-rond { fill: var(--accent); stroke: #ffffff; stroke-width: 2; }
.ed-rotation-icone { fill: none; stroke: #ffffff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ed-poignee-rotation:hover .ed-rotation-rond { fill: var(--accent-fort); }
@media (pointer: coarse) { .ed-poignee-carre { transform: scale(1.4); } .ed-poignee-zone { r: 22px; } }

/* Pastilles de couleur */
.ed-pastilles { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ed-pastilles:empty { display: none; }
.ed-pastille { width: 26px; height: 26px; border-radius: 50%; padding: 0; background: var(--c); border: 2px solid color-mix(in srgb, var(--texte) 18%, transparent); cursor: pointer; transition: transform .12s; }
.ed-pastille:hover { transform: scale(1.12); }
.ed-pastille[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-pastilles-petites .ed-pastille { width: 22px; height: 22px; }
.ed-pastilles-petites { gap: 6px; }

/* Lignes de réglage */
.ed-ligne { display: grid; grid-template-columns: 78px minmax(0, 1fr) 52px; align-items: center; gap: 10px; margin: 0 0 10px; }
.ed-ligne:has(select), .ed-ligne:has(input[type="color"]) { grid-template-columns: 110px minmax(0, 1fr); }
.ed-ligne-nom { font: 600 .82rem/1.2 var(--police-cond); letter-spacing: .08em; text-transform: uppercase; color: var(--texte-2); }
.ed-ligne-val { font: 600 .9rem/1 var(--police-cond); text-align: right; color: var(--texte); font-variant-numeric: tabular-nums; }
.ed-ligne input[type="range"] { width: 100%; accent-color: var(--accent); }
.ed-ligne select, .ed-champ input { width: 100%; min-height: 38px; padding: .4em .6em; background: var(--fond-2); color: var(--texte); border: 1px solid var(--bord-fort); border-radius: var(--rayon); font: 500 .95rem/1.2 var(--police-texte); }
.ed-ligne input[type="color"] { width: 100%; height: 34px; padding: 2px; background: var(--fond-2); border: 1px solid var(--bord-fort); border-radius: var(--rayon); cursor: pointer; }
.ed-champ { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.ed-champ > span { font: 600 .82rem/1.2 var(--police-cond); letter-spacing: .08em; text-transform: uppercase; color: var(--texte-2); }
.ed-champ em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--texte-3); }
.ed-interrupteur { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; cursor: pointer; font-size: .95rem; }
.ed-interrupteur input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.ed-prop-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ed-prop-tete .ed-h { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-prop-boutons { display: flex; gap: 6px; }

/* Catalogue */
.ed-onglets { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.ed-onglets button { background: none; border: 1px solid var(--bord); color: var(--texte-2); border-radius: 999px; padding: .35em .8em; font: italic 800 .92rem/1.1 var(--police-cond); text-transform: uppercase; letter-spacing: .03em; cursor: pointer; }
.ed-onglets button:hover { color: var(--texte); border-color: var(--bord-fort); }
.ed-onglets button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.ed-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.ed-element { aspect-ratio: 1; padding: 9px; background: var(--fond-2); border: 1px solid var(--bord); border-radius: var(--rayon); color: var(--texte); cursor: pointer; transition: border-color .12s, background .12s, transform .12s; }
.ed-element:hover { border-color: var(--accent); background: var(--accent-doux); transform: translateY(-1px); }
.ed-vignette { display: block; width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--masque) center / contain no-repeat; mask: var(--masque) center / contain no-repeat; }
.ed-vignette.ed-vignette-image { background: var(--image) center / contain no-repeat; -webkit-mask: none; mask: none; }
.ed-grille-logos { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.ed-grille-logos .ed-element { padding: 6px; }
.ed-astuce-haut { margin: 0 0 10px; }
[data-form-texte] .btn { width: 100%; }

/* Mes images (bibliothèque perso) */
.ed-images-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ed-images-compte { color: var(--texte-2); font-size: .85rem; white-space: nowrap; }
.ed-images-message { margin: 0 0 10px; font-size: .9rem; color: var(--texte-2); }
.ed-images-message.ed-images-erreur { color: var(--accent); }
.ed-image { position: relative; }
.ed-image .ed-element { width: 100%; }
.ed-image-suppr { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--bord); background: var(--fond); color: var(--texte-2); font: 700 15px/1 var(--police-texte); cursor: pointer; opacity: 0; transition: opacity .12s; }
.ed-image:hover .ed-image-suppr, .ed-image-suppr:focus-visible { opacity: 1; }
.ed-image-suppr:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
@media (hover: none) { .ed-image-suppr { opacity: 1; } }

/* Liste des calques */
.ed-calques { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ed-calque { display: flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: var(--rayon); padding: 2px 2px 2px 4px; }
.ed-calque:hover { background: var(--surface-2); }
.ed-calque-choisi { border-color: var(--accent); background: var(--accent-doux); }
.ed-calque-cache .ed-calque-nom { opacity: .45; }
.ed-calque-nom { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--texte); font: 500 .95rem/1.2 var(--police-texte); text-align: left; padding: 6px 4px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ed-calque-nom .ed-vignette { width: 26px; height: 26px; flex: none; filter: drop-shadow(0 0 1px var(--texte-3)) drop-shadow(0 0 .5px var(--texte-3)); }
.ed-calque .ed-icone { width: 32px; height: 32px; border-color: transparent; }
.ed-calque .ed-icone svg { width: 17px; height: 17px; }
.ed-calque .ed-calque-fleche { width: 24px; }
.ed-calque .ed-calque-fleche svg { width: 15px; height: 15px; }
.ed-calque .ed-calque-fleche:disabled { opacity: .25; cursor: default; }
/* Glisser un calque dans la liste pour changer l'ordre (à la souris : toute la ligne ; au doigt : la poignée). */
.ed-calque { position: relative; cursor: grab; }
.ed-calque-poignee { flex: none; align-self: stretch; width: 16px; display: grid; place-items: center; color: var(--texte-3); touch-action: none; }
.ed-calque-poignee svg { width: 10px; height: 16px; fill: currentColor; }
.ed-calque:hover .ed-calque-poignee { color: var(--texte-2); }
.ed-calques-glisse, .ed-calques-glisse .ed-calque, .ed-calques-glisse .ed-calque-nom { cursor: grabbing; user-select: none; }
.ed-calque-glisse { z-index: 2; background: var(--surface); border-color: var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, .35); }
.ed-calque-avant::before, .ed-calque-apres::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; }
.ed-calque-avant::before { top: -4px; }
.ed-calque-apres::after { bottom: -4px; }

/* Fenêtre d'export */
.ed-dialogue { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; background: var(--surface); color: var(--texte); border: 1px solid var(--bord-fort); border-radius: var(--rayon-grand); box-shadow: var(--ombre); }
.ed-dialogue::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.ed-dialogue-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.ed-dialogue-tete h2 { margin: 0; display: flex; align-items: center; gap: .4em; }
.ed-dialogue-tete h2 .ico { color: var(--vert); }
.ed-champs-2 { display: grid; grid-template-columns: 1fr 110px; gap: 12px; }
.ed-export-prog { margin: 6px 0 16px; }
.ed-export-prog p { margin: 0 0 8px; font: 600 .9rem/1.2 var(--police-cond); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-2); }
.ed-export-prog .ed-progression { width: 100%; }
.ed-bloc { background: var(--fond-2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; margin-top: 14px; }
.ed-bloc p:last-child { margin-bottom: 0; }
.ed-bloc-exclusif { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-doux); }
.ed-liste { margin: 0 0 10px; padding-left: 1.2em; }
.ed-liste li { margin-bottom: 4px; }

/* ---------- Écrans étroits : vue 3D en haut, panneaux dessous ---------- */

@media (max-width: 1100px) {
  .ed-corps { grid-template-columns: 260px minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
  .editeur { height: auto; min-height: 0; }
  .ed-corps { display: flex; flex-direction: column; }
  .ed-vue { order: -1; height: 52vh; height: 52dvh; min-height: 300px; }
  .ed-panneau { overflow: visible; border: 0; border-top: 1px solid var(--bord); }
  .ed-droite { order: 0; }
  .ed-gauche { order: 1; }
  .ed-cube { width: 92px; height: 92px; top: 8px; right: 8px; }
  .ed-recentrer { top: 106px; right: 34px; }
  .ed-aide { display: none; }
  .ed-barre { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .ed-retour span, .ed-titre-sur { display: none; }
  .ed-etat { order: 5; width: 100%; }
  .ed-outils .btn span { display: none; }
}
