/* ============================================================
   Épanovia — Le Sentier Créatif — styles du jeu
   ============================================================ */

html, body { height: 100%; }

body.jeu {
  background: var(--creme);
  overflow-x: hidden;
}

.jeu-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Barre supérieure --- */
.jeu-barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  background: var(--creme-clair);
  border-bottom: 1px solid rgba(42,69,60,0.09);
  position: sticky;
  top: 0;
  z-index: 20;
}
.jeu-barre__titre {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--vert-profond);
  display: flex;
  align-items: center;
  gap: 10px;
}
.jeu-barre__titre img, .jeu-barre__titre svg { width: 22px; height: 22px; }
.bouton svg { width: 16px; height: 16px; flex-shrink: 0; }
.jeu-barre__lien-retour {
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--vert-profond);
  opacity: 0.7;
  border: 1px solid rgba(42,69,60,0.25);
  padding: 8px 16px;
  border-radius: 999px;
}
.jeu-barre__lien-retour:hover { opacity: 1; }

/* --- Inventaire --- */
.jeu-inventaire {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.jeton {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--beige);
  border: 1.5px solid rgba(42,69,60,0.15);
  font-size: 15px;
  opacity: 0.25;
  filter: grayscale(1);
  transition: opacity var(--transition), filter var(--transition), transform var(--transition);
}
.jeton.acquis { opacity: 1; filter: none; transform: scale(1.05); background: var(--creme-clair); box-shadow: var(--ombre-douce); }

/* --- Scène --- */
.scene {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px 60px;
}
.scene__carte {
  width: 100%;
  max-width: 760px;
  background: var(--creme-clair);
  border-radius: 28px;
  box-shadow: var(--ombre-douce);
  padding: 48px 44px;
  position: relative;
  overflow: hidden;
  animation: apparition 0.5s ease;
}
@keyframes apparition {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.scene__carte--large { max-width: 980px; }
.scene__decor {
  margin: -48px -44px 30px;
  height: 190px;
  position: relative;
  overflow: hidden;
}
.scene__decor svg { display: block; width: 100%; height: 100%; }
.scene__decor .flottant { animation: decor-flotte 6s ease-in-out infinite; transform-origin: 50% 100%; }
.scene__decor .flottant2 { animation: decor-flotte 7.5s ease-in-out infinite 0.6s; transform-origin: 50% 100%; }
.scene__decor .flottant3 { animation: decor-flotte 5.2s ease-in-out infinite 1.1s; transform-origin: 50% 100%; }
@keyframes decor-flotte {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(0.6deg); }
}
@media (max-width: 720px) {
  .scene__decor { margin: -32px -22px 22px; height: 150px; }
}
.decor-prop { animation: vivant 4.5s ease-in-out infinite; transform-origin: 50% 85%; transform-box: fill-box; }
.decor-prop.decor-lueur {
  animation: flamme-vacille 0.9s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(233,140,60,0.65));
  transform-origin: 50% 88%;
  transform-box: fill-box;
}
.decor-prop.decor-glow {
  animation: decor-mijote-glow 2.4s ease-in-out infinite;
  transform-origin: 50% 88%;
  transform-box: fill-box;
}
@keyframes decor-mijote-glow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(220,201,160,0.25)); }
  50% { filter: drop-shadow(0 0 16px rgba(220,201,160,0.75)); }
}
.scene__decor.coup .decor-prop { animation: coup-pilon 0.22s ease-out; }

.scene__illustration { display: flex; justify-content: center; margin-bottom: 22px; position: relative; }
.scene__illustration svg { width: 150px; height: 150px; animation: vivant 4.5s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes vivant {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-3px) rotate(1deg); }
}
.lieu svg, .station svg { animation: vivant 5s ease-in-out infinite; transform-origin: 50% 85%; }

/* --- feu : flamme vivante --- */
.scene__illustration--feu svg {
  animation: flamme-vacille 0.9s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(233,140,60,0.55));
}
@keyframes flamme-vacille {
  0%, 100% { transform: scale(1) rotate(-2deg); filter: drop-shadow(0 0 8px rgba(233,140,60,0.5)) brightness(1); }
  30% { transform: scale(1.04) rotate(1deg); filter: drop-shadow(0 0 14px rgba(233,140,60,0.7)) brightness(1.1); }
  60% { transform: scale(0.98) rotate(-1deg); filter: drop-shadow(0 0 10px rgba(201,85,46,0.6)) brightness(1.03); }
}
.scene__illustration--feu::before {
  content: "";
  position: absolute; left: 50%; bottom: -6px;
  width: 90px; height: 26px;
  background: radial-gradient(ellipse, rgba(233,140,60,0.45), transparent 70%);
  transform: translateX(-50%);
  animation: lueur-sol 0.9s ease-in-out infinite;
  border-radius: 50%;
  z-index: -1;
}
@keyframes lueur-sol {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(0.9); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(1.1); }
}

/* --- mijotage : halo coloré + ondulations sous une décoction --- */
.scene__illustration--mijote::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 120px; height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--teinte, #93A38E) 0%, transparent 68%);
  opacity: 0.28;
  animation: mijote-pulse 2.4s ease-in-out infinite;
  z-index: -1;
}
@keyframes mijote-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.18; }
  50% { transform: scale(1.08); opacity: 0.32; }
}
.ondulation { position: relative; display: flex; justify-content: center; height: 0; }
.ondulation span {
  position: absolute; top: -6px;
  width: 30px; height: 10px;
  border: 1.5px solid var(--teinte, #93A38E);
  border-radius: 50%;
  opacity: 0;
  animation: onde 2.4s ease-out infinite;
}
.ondulation span:nth-child(2) { animation-delay: 0.8s; }
.ondulation span:nth-child(3) { animation-delay: 1.6s; }
@keyframes onde {
  0% { transform: scale(0.3); opacity: 0.7; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* --- broyage : petit choc sur l'icône à chaque coup de pilon --- */
.scene__illustration.coup svg { animation: coup-pilon 0.22s ease-out; }
@keyframes coup-pilon {
  0% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(4px) rotate(-3deg); }
  60% { transform: translateY(-2px) rotate(2deg); }
  100% { transform: translateY(0) rotate(0); }
}

/* --- éclat glossy sur les puits de couleur et l'outil actif : effet "pigment humide" --- */
.puit, .outil-btn, .melange-swatch, .cuve-teinte {
  position: relative;
  overflow: hidden;
}
.puit::after, .outil-btn::after, .melange-swatch::after, .cuve-teinte::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.5) 46%, rgba(255,255,255,0.05) 58%, transparent 70%);
  background-size: 220% 220%;
  background-position: 120% -20%;
  animation: reflet-humide 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes reflet-humide {
  0%, 40% { background-position: 130% -30%; }
  60% { background-position: -10% 110%; }
  100% { background-position: -10% 110%; }
}
.scene h2 { text-align: center; font-size: 1.5rem; }
.scene__texte { text-align: center; max-width: 52ch; margin: 0 auto 30px; opacity: 0.85; }
.scene__actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }

/* --- respiration --- */
.respiration-cercle {
  width: 160px; height: 160px;
  margin: 10px auto 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,163,142,0.55), rgba(147,163,142,0.15));
  border: 1.5px solid var(--vert-sauge);
  animation: respirer 8s ease-in-out infinite;
}
@keyframes respirer {
  0%, 100% { transform: scale(0.7); }
  50% { transform: scale(1.15); }
}
.respiration-consigne {
  text-align: center;
  font-size: 0.95rem;
  color: var(--vert-profond);
  opacity: 0.75;
  min-height: 1.4em;
}

/* --- sentier / carte des lieux --- */
.sentier-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 22px;
  margin-top: 10px;
}
.lieu {
  border: 1.5px solid rgba(42,69,60,0.12);
  border-radius: 20px;
  padding: 26px 20px;
  text-align: center;
  background: var(--creme);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.lieu:hover { transform: translateY(-4px); box-shadow: var(--ombre-douce); border-color: var(--vert-sauge); }
.lieu svg { width: 60px; height: 60px; margin: 0 auto 14px; }
.lieu h3 { font-size: 1rem; margin-bottom: 6px; }
.lieu p { font-size: 0.82rem; opacity: 0.7; margin: 0; }
.lieu__statut { display: block; margin-top: 12px; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--terracotta); }
.lieu.termine { border-color: var(--vert-sauge); background: rgba(147,163,142,0.1); }
.lieu.termine .lieu__statut { color: var(--vert-sauge); }
.lieu.verrouille { opacity: 0.45; cursor: not-allowed; }
.lieu.verrouille:hover { transform: none; box-shadow: none; }

/* --- zone de dépôt / drag & drop --- */
.zone-geste {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 14px 0 26px;
}
.zone-depot {
  width: 220px; height: 150px;
  border: 2px dashed rgba(42,69,60,0.3);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--vert-profond);
  font-size: 0.85rem;
  text-align: center;
  padding: 12px;
  transition: background var(--transition), border-color var(--transition);
}
.zone-depot.survole { background: rgba(147,163,142,0.18); border-color: var(--vert-sauge); }
.zone-depot.rempli { border-style: solid; border-color: var(--vert-sauge); background: rgba(147,163,142,0.12); }
.objet-glissable {
  width: 88px; height: 88px;
  border-radius: 16px;
  background: var(--creme);
  border: 1.5px solid rgba(42,69,60,0.15);
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
  box-shadow: 0 4px 10px rgba(42,69,60,0.08);
}
.objet-glissable svg { width: 46px; height: 46px; }
.objet-glissable:active { cursor: grabbing; }
.objet-glissable.utilise { opacity: 0.3; pointer-events: none; }

/* --- barre de progression (broyage, cuisson...) --- */
.jauge {
  width: 100%;
  max-width: 320px;
  height: 10px;
  border-radius: 999px;
  background: var(--beige);
  overflow: hidden;
  margin: 8px auto 4px;
}
.jauge__remplissage {
  height: 100%;
  background: linear-gradient(90deg, var(--or), var(--terracotta));
  width: 0%;
  transition: width 0.25s ease;
}
.jauge__remplissage--feu {
  background: linear-gradient(90deg, #E8B93A, #C9552E, #A2312A);
  animation: braise-vacille 0.6s ease-in-out infinite;
}
.jauge__remplissage--vapeur {
  background: linear-gradient(90deg, var(--vert-sauge), var(--or));
}
.jauge__remplissage--sechage {
  background: linear-gradient(90deg, #DCC9A0, var(--or));
}
.jauge__remplissage--pierre {
  background: linear-gradient(90deg, #9c9488, #6f675c);
}
@keyframes braise-vacille {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}
.jauge-conteneur { text-align: center; margin: 14px 0; position: relative; }
.jauge-legende { font-size: 0.78rem; opacity: 0.65; margin-top: 6px; }

/* --- ambiance : vapeur, bulles, poussière --- */
.ambiance {
  display: flex;
  justify-content: center;
  gap: 14px;
  height: 34px;
  margin-bottom: 2px;
}
.ambiance .wisp {
  width: 6px; height: 16px;
  border-radius: 50%;
  background: var(--teinte, rgba(147,163,142,0.6));
  filter: blur(1.5px);
  animation: monter 2.2s ease-in infinite;
  opacity: 0;
}
.ambiance .wisp:nth-child(2) { animation-delay: 0.5s; }
.ambiance .wisp:nth-child(3) { animation-delay: 1s; }
.ambiance .wisp:nth-child(4) { animation-delay: 1.5s; }
@keyframes monter {
  0% { transform: translateY(6px) scale(0.6); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: translateY(-26px) scale(1.3); opacity: 0; }
}
.ambiance-flamme {
  display: flex; justify-content: center; gap: 7px; height: 26px; margin-bottom: 2px;
}
.ambiance-flamme span {
  width: 4px; height: 4px; border-radius: 50%;
  background: radial-gradient(circle, #FCE2A0, #E9903C 55%, #A2312A 100%);
  animation: etincelle 1.1s ease-in infinite;
  opacity: 0;
  box-shadow: 0 0 5px rgba(233,140,60,0.8);
}
.ambiance-flamme span:nth-child(1) { --dx: -3px; width: 6px; height: 6px; }
.ambiance-flamme span:nth-child(2) { animation-delay: 0.22s; --dx: 6px; }
.ambiance-flamme span:nth-child(3) { animation-delay: 0.44s; --dx: -8px; width: 3px; height: 3px; }
.ambiance-flamme span:nth-child(4) { animation-delay: 0.66s; --dx: 9px; width: 5px; height: 5px; }
.ambiance-flamme span:nth-child(5) { animation-delay: 0.88s; --dx: -2px; width: 3px; height: 3px; }
@keyframes etincelle {
  0% { transform: translateY(6px) translateX(0) scale(0.6); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(-26px) translateX(var(--dx, 4px)) scale(0.4); opacity: 0; }
}
.poussiere-broyage {
  display: flex; justify-content: center; gap: 6px; height: 18px; margin: 2px 0 6px;
}
.poussiere-broyage span {
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(120,110,95,0.55);
  animation: eclat-poussiere 0.55s ease-out 1;
  opacity: 0;
}
.poussiere-broyage span:nth-child(2) { animation-delay: 0.05s; }
.poussiere-broyage span:nth-child(3) { animation-delay: 0.1s; }
.poussiere-broyage span:nth-child(4) { animation-delay: 0.02s; }
@keyframes eclat-poussiere {
  0% { transform: translate(0,0) scale(0.5); opacity: 0.9; }
  100% { transform: translate(var(--dx,12px), -14px) scale(1); opacity: 0; }
}
.poussiere-broyage span:nth-child(1) { --dx: -16px; }
.poussiere-broyage span:nth-child(2) { --dx: -4px; }
.poussiere-broyage span:nth-child(3) { --dx: 6px; }
.poussiere-broyage span:nth-child(4) { --dx: 16px; }

.bouton-geste {
  padding: 16px 26px;
  border-radius: 18px;
  border: 1.5px solid var(--vert-profond);
  background: var(--creme-clair);
  color: var(--vert-profond);
  font-family: var(--font-principale);
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease, background var(--transition);
  user-select: none;
}
.bouton-geste:hover { background: rgba(42,69,60,0.06); }
.bouton-geste:active { transform: scale(0.96); }

/* --- choix de teinte (chou rouge) --- */
.choix-teinte { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 18px 0 8px; }
.pastille-teinte {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; border: none; background: transparent; font-family: var(--font-principale);
}
.pastille-teinte .rond { width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(42,69,60,0.15); box-shadow: inset 0 0 0 3px var(--creme-clair); transition: transform var(--transition); }
.pastille-teinte:hover .rond { transform: scale(1.08); }
.pastille-teinte.selection .rond { border-color: var(--vert-profond); }
.pastille-teinte span.nom { font-size: 0.75rem; opacity: 0.75; }
.cuve-teinte { width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 18px; transition: background 0.5s ease; box-shadow: inset 0 10px 20px rgba(0,0,0,0.12); }

/* --- fabrication : cartes de l'atelier --- */
.atelier-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-top: 10px;
}
.station {
  border-radius: 18px;
  padding: 20px 16px;
  text-align: center;
  background: var(--creme);
  border: 1.5px solid rgba(42,69,60,0.12);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.station:hover:not(.verrouille) { transform: translateY(-3px); box-shadow: var(--ombre-douce); }
.station svg { width: 46px; height: 46px; margin: 0 auto 10px; }
.station h4 { font-size: 0.88rem; margin: 0 0 4px; color: var(--vert-profond); font-weight: 500; }
.station p { font-size: 0.72rem; opacity: 0.65; margin: 0; }
.station.fait { border-color: var(--vert-sauge); background: rgba(147,163,142,0.12); }
.station.fait h4::after { content: " ✓"; color: var(--vert-sauge); }
.station.verrouille { opacity: 0.4; cursor: not-allowed; }

/* --- atelier de création --- */
.creation-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 18px 14px 40px;
  gap: 16px;
}
.creation-toile-conteneur {
  background: var(--beige);
  padding: 18px;
  border-radius: 20px;
  box-shadow: var(--ombre-douce);
}
#toile {
  background: var(--creme-clair);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
  display: block;
  max-width: 100%;
}
.creation-outils {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  align-items: flex-start;
  background: var(--creme-clair);
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: var(--ombre-douce);
}
.groupe-outils { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.groupe-outils__titre { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; }
.rangee-outils { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.outil-btn {
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.outil-btn.actif { border-color: var(--vert-profond); }
.outil-btn[data-outil="fusain"] { background: #3a3a38; }
.outil-taille { width: 130px; }
.creation-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* --- palette de mélange --- */
.palette-melange {
  width: 100%;
  max-width: 900px;
  background: var(--creme-clair);
  border-radius: 20px;
  padding: 18px 22px 22px;
  box-shadow: var(--ombre-douce);
  text-align: center;
}
.palette-melange__corps {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
}
.palette-puits { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 340px; }
.puit {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(42,69,60,0.15);
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 5px rgba(42,69,60,0.12);
}
.puit:hover { transform: scale(1.12); }
.puit:active { transform: scale(0.94); }
.melange-resultat { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.melange-swatch {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: repeating-linear-gradient(45deg, #e7dbc6, #e7dbc6 6px, #fbf6ec 6px, #fbf6ec 12px);
  box-shadow: inset 0 6px 14px rgba(0,0,0,0.18), 0 2px 6px rgba(42,69,60,0.1);
  transition: background 0.35s ease;
}
.melange-compteur { font-size: 0.72rem; opacity: 0.6; }
.melange-boutons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.melange-boutons--outils { max-width: 260px; }
.bouton-mini {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(42,69,60,0.25);
  background: transparent;
  color: var(--vert-profond);
  font-family: var(--font-principale);
  font-size: 0.78rem;
  cursor: pointer;
}
.bouton-mini--terre { background: var(--terracotta); color: var(--creme-clair); border-color: var(--terracotta); }
.bouton-mini:disabled { opacity: 0.4; cursor: not-allowed; }
#outil-melange-actif { border: 2px dashed rgba(42,69,60,0.25); }

@media (max-width: 640px) {
  .scene__carte { padding: 32px 22px; }
  .jeu-barre { flex-wrap: wrap; gap: 10px; }
}
