:root {
  --papier: #f3eee7;
  --carte: #fbf8f4;
  --trait: #e3dacd;
  --encre: #2b2622;
  --doux: #7d7268;
  --accent: #a8532f;
  --accent-clair: #f2e2d8;
  --orange: #c07a1c;
  --rouge: #b23a2e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; background: var(--papier); color: var(--encre); font-family: var(--sans); font-size: 15px; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--trait);
  background: var(--papier); position: sticky; top: 0; z-index: 3;
}
.barre h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: 0.02em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bouton { border-radius: 999px; padding: 8px 14px; border: 1px solid var(--trait); background: var(--carte); font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s; }
.bouton.fantome:hover { border-color: var(--doux); }
.bouton.plein { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.bouton.plein:hover { background: var(--accent); border-color: var(--accent); }

.atelier { display: grid; grid-template-columns: minmax(0, 1fr); }
.scene {
  position: sticky; top: var(--hb, 56px); z-index: 2; height: 50svh; min-height: 280px;
  background: radial-gradient(120% 90% at 50% 35%, #fffdf9 0%, #f1ebe2 55%, #e6ddd0 100%);
  border-bottom: 1px solid var(--trait); overflow: hidden;
}
#vue { width: 100%; height: 100%; display: block; touch-action: none; }
.teintes { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; }
.teinte { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); padding: 0; }
.teinte.on { outline: 2px solid var(--encre); outline-offset: 1px; }
.teinte.soie { background-image: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,0) 55%); }
.cote, .estim { position: absolute; bottom: 12px; font-size: 12.5px; color: var(--doux); line-height: 1.45; pointer-events: none; }
.cote { left: 14px; font-family: var(--serif); font-size: 15px; color: var(--encre); }
.estim { right: 14px; text-align: right; }
.tourner { position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--trait); background: rgba(251,248,244,.8); font-size: 16px; line-height: 1; }
.tourner.on { background: var(--encre); color: var(--papier); }

.panneau { min-width: 0; padding: 12px 16px calc(40px + env(safe-area-inset-bottom)); }
.modeles { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.modele { flex: 0 0 auto; width: 84px; border: 1px solid var(--trait); border-radius: 14px; background: var(--carte); padding: 6px 4px 8px; text-align: center; scroll-snap-align: start; }
.modele img { width: 72px; height: 88px; object-fit: contain; display: block; margin: 0 auto 4px; }
.modele span { font-size: 12px; }
.modele.on { border-color: var(--encre); box-shadow: 0 0 0 1px var(--encre) inset; }

.alertes:empty { display: none; }
.alertes { margin: 2px 0 12px; display: grid; gap: 6px; }
.alerte { font-size: 13px; border-radius: 10px; padding: 8px 10px; background: #fbf1e1; border-left: 3px solid var(--orange); }
.alerte.rouge { background: #f8e6e3; border-left-color: var(--rouge); }
.alerte.ok { background: #eef3ea; border-left-color: #6c8a5a; }
.alerte.info { background: #ebf0f5; border-left-color: #5b7590; }

details { border-top: 1px solid var(--trait); padding: 4px 0; }
summary { list-style: none; cursor: pointer; padding: 12px 0 10px; font-family: var(--serif); font-size: 19px; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--sans); color: var(--doux); font-size: 18px; }
details[open] summary::after { content: "–"; }

.reglage { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 6px 0; }
.reglage label { font-size: 14px; }
.reglage output { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--doux); min-width: 56px; text-align: right; }
.reglage input[type=range] { grid-column: 1 / -1; }
.reglage .note { grid-column: 1 / -1; font-size: 12px; color: var(--doux); margin-top: -2px; }
.choix { display: flex; gap: 6px; grid-column: 1 / -1; flex-wrap: wrap; }
.choix button { border: 1px solid var(--trait); background: var(--carte); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.choix button.on { background: var(--encre); color: var(--papier); border-color: var(--encre); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--encre) var(--pc, 50%), var(--trait) var(--pc, 50%)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--trait); }
input[type=range]::-moz-range-progress { height: 3px; background: var(--encre); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8.5px; border-radius: 50%; background: var(--carte); border: 1.5px solid var(--encre); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--carte); border: 1.5px solid var(--encre); }

.silhouette { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 4px; }
#profil { width: 170px; height: 170px; background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; touch-action: none; }
#profil .forme { fill: var(--accent-clair); stroke: var(--accent); stroke-width: 1.2; }
#profil .axe { stroke: var(--trait); stroke-dasharray: 3 3; }
#profil .poignee { fill: var(--carte); stroke: var(--encre); stroke-width: 1.5; cursor: grab; }
#profil .poignee.active { fill: var(--encre); }
.aide { font-size: 13px; color: var(--doux); margin: 0; }

.conseils { font-size: 13px; color: var(--doux); line-height: 1.5; }
.conseils ul { padding-left: 18px; margin: 4px 0 8px; }
.sauver { display: flex; gap: 8px; margin: 2px 0 10px; }
.sauver input { flex: 1; min-width: 0; border: 1px solid var(--trait); border-radius: 999px; padding: 8px 12px; background: var(--carte); font: inherit; }
.mes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.mes:empty::before { content: "Aucun vase gardé pour l'instant."; font-size: 13px; color: var(--doux); grid-column: 1 / -1; }
.mon { position: relative; border: 1px solid var(--trait); border-radius: 14px; background: var(--carte); padding: 6px; text-align: center; font-size: 12px; }
.mon img { width: 100%; height: 96px; object-fit: contain; display: block; }
.mon .suppr { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: var(--doux); font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--encre); color: var(--papier); padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: .25s; pointer-events: none; z-index: 10; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .barre h1 { font-size: 22px; }
  .bouton { padding: 7px 11px; font-size: 13px; }
  #partager { display: none; }
}
@media (min-width: 900px) {
  .atelier { grid-template-columns: minmax(0, 1fr) 400px; height: calc(100svh - 58px); }
  .scene { position: relative; height: auto; border-bottom: 0; border-right: 1px solid var(--trait); }
  .panneau { overflow-y: auto; }
  #partager { display: inline-block; }
}

.motifs-choix { margin: 2px 0 6px; }
.tirage, .tirage-texture { margin: 6px 0 4px; }
.sous-titre { font-size: 13px; color: var(--doux); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 4px; }
.reglage[hidden], .tirage[hidden], .tirage-texture[hidden] { display: none; }

/* Mode lampe */
.mode { display: flex; gap: 0; margin: 2px 0 12px; border: 1px solid var(--trait); border-radius: 999px; padding: 3px; background: var(--carte); width: max-content; }
.mode button { border: 0; background: none; border-radius: 999px; padding: 6px 18px; font-size: 14px; }
.mode button.on { background: var(--encre); color: var(--papier); }
.allumer { position: absolute; top: 52px; left: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--trait); background: rgba(251,248,244,.8); font-size: 16px; line-height: 1; }
.allumer.on { background: #ffcf8a; border-color: #ffcf8a; color: #3a2a12; box-shadow: 0 0 14px rgba(255,190,110,.8); }
.allumer[hidden], #section-lampe[hidden], .conseils[hidden] { display: none; }
.scene { transition: background .4s; }
.scene.nuit { background: radial-gradient(120% 90% at 50% 40%, #3a332c 0%, #1d1a17 55%, #121110 100%); }
.scene.nuit .cote, .scene.nuit .estim { color: #c9bfb2; }
.socle-teintes { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; }
.socle-teintes .teinte { width: 22px; height: 22px; }
.note .auto { border: 1px solid var(--trait); background: var(--carte); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.note .auto.on { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.choix small { opacity: .65; font-size: 11px; }
