/* Vies sauvages — V2 : palette plus marquée, accueil animé, tirage, scènes vivantes, son, fin de vie, succès.
   Chargé après style.css : il complète et remplace certaines règles du MVP. */

/* ---------- Palette et typographie ---------- */
:root {
  --fond: #f5efe4; --fond2: #ebe1cf; --carte: #fffaf1; --texte: #231c14; --doux: #6b6052; --bord: #e0d3bc;
  --accent: #b5541c; --accent-fort: #873c10; --accent-doux: #f6e2cc; --or: #d99a2b;
  --danger: #b8362a; --ok: #3f7a32;
  --titre: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ressort: cubic-bezier(.2, .9, .25, 1.15);
}
body[data-espece="savane"] { --fond: #f8eedd; --fond2: #f0dfc2; --accent: #c2561a; --accent-fort: #8c3a0d; --accent-doux: #f8dfc4; --bord: #ebd3b1; --or: #e0a030; }
body[data-espece="ocean"] { --fond: #eaf4f3; --fond2: #d6e9e8; --accent: #0d7c89; --accent-fort: #075560; --accent-doux: #cfeaea; --bord: #c3dcda; --or: #2bb3a7; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --fond: #14110d; --fond2: #1e1914; --carte: #221c16; --texte: #f1e9dc; --doux: #ab9f8d; --bord: #3a3128; --accent: #e08a45; --accent-fort: #f3b27a; --accent-doux: #3b2817; --or: #e7b04d; --danger: #ef7a66; --ok: #8fc777; }
  :root:not([data-theme="light"]) body[data-espece="savane"] { --fond: #18110a; --fond2: #241910; --carte: #251b12; --accent: #ec8a3e; --accent-fort: #f7b57a; --accent-doux: #3f2612; --bord: #42301f; }
  :root:not([data-theme="light"]) body[data-espece="ocean"] { --fond: #08161a; --fond2: #0f2227; --carte: #12262b; --accent: #3fc3cc; --accent-fort: #8ae0e5; --accent-doux: #12393e; --bord: #20393e; --or: #49d1c4; }
}
:root[data-theme="dark"] { --fond: #14110d; --fond2: #1e1914; --carte: #221c16; --texte: #f1e9dc; --doux: #ab9f8d; --bord: #3a3128; --accent: #e08a45; --accent-fort: #f3b27a; --accent-doux: #3b2817; --or: #e7b04d; --danger: #ef7a66; --ok: #8fc777; }
:root[data-theme="dark"] body[data-espece="savane"] { --fond: #18110a; --fond2: #241910; --carte: #251b12; --accent: #ec8a3e; --accent-fort: #f7b57a; --accent-doux: #3f2612; --bord: #42301f; }
:root[data-theme="dark"] body[data-espece="ocean"] { --fond: #08161a; --fond2: #0f2227; --carte: #12262b; --accent: #3fc3cc; --accent-fort: #8ae0e5; --accent-doux: #12393e; --bord: #20393e; --or: #49d1c4; }

body { background: radial-gradient(1200px 600px at 85% -10%, var(--accent-doux), transparent 60%), var(--fond); background-attachment: fixed; }
h1 { font-weight: 800; letter-spacing: -.025em; }
h2 { font-weight: 700; letter-spacing: -.015em; }
.logo { font-weight: 900; letter-spacing: -.02em; display: inline-flex; gap: 8px; align-items: center; }
.logo span { display: inline-block; transition: transform .4s var(--ressort); }
.logo:hover span { transform: rotate(-18deg) scale(1.15); }
.surtitre { letter-spacing: .16em; font-weight: 700; }
.btn { transition: transform .2s var(--ressort), background .2s, border-color .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.principal { box-shadow: 0 6px 18px -8px var(--accent); }
.btn.principal:hover { box-shadow: 0 10px 24px -8px var(--accent); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

/* ---------- Son ---------- */
.son { display: inline-flex; align-items: center; gap: 2px; }
.son input[type="range"] { width: 76px; accent-color: var(--accent); }
.son.muet input[type="range"] { opacity: .45; }
.son.indispo { opacity: .5; }

/* ---------- Accueil ---------- */
.hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); margin-top: 4px; }
.hero-illu { border-radius: 22px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(40, 20, 5, .55); aspect-ratio: 20 / 9; position: relative; background: #3b1d46; }
.hero-illu svg { width: 100%; height: 100%; display: block; }
.hero-illu .svg-accueil { animation: kenburns 28s ease-in-out infinite alternate; transform-origin: 40% 60%; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.07) translate(-1%, -1%); } }
.hero-titre { font-size: clamp(2.2rem, 5.4vw, 4rem); line-height: 1.02; margin-bottom: .35em; }
.hero-titre span, .hero-titre em { display: inline-block; animation: monte .9s var(--ressort) both; }
.hero-titre em { font-style: italic; font-weight: 700; animation-delay: .18s; background: linear-gradient(90deg, #c2561a, #d99a2b 45%, #0d7c89); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sur { animation: monte .8s ease both; }
.hero .chapo { animation: monte .9s ease .3s both; }
@keyframes monte { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.reglages { animation: monte .8s ease .45s both; }
#btn-naitre { font-size: 1.15rem; padding: 14px 36px; position: relative; overflow: hidden; }
#btn-naitre::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-100%); animation: reflet 3.6s ease-in-out 1.5s infinite; }
@keyframes reflet { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.segment span { transition: border-color .2s, background .2s, transform .2s var(--ressort); }
.segment label:hover span { transform: translateY(-2px); }

/* ---------- Tirage ---------- */
.tirage { max-width: 760px; }
.revele { display: none; min-height: 46vh; flex-direction: column; align-items: center; justify-content: center; }
.phase-espece .revele { display: flex; }
.phase-espece #tirage-sur, .phase-espece .tirage-carte, .phase-espece .roulette { display: none; }
.revele-animal { width: min(320px, 70vw); aspect-ratio: 3 / 2; display: grid; place-items: center; }
.revele-animal svg { width: 100%; height: 100%; overflow: visible; }
.revele-animal.clignote { animation: clignote .12s ease; filter: brightness(0) opacity(.55); }
.revele-animal.choisi { animation: pop .9s var(--ressort) both; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .25)); }
@keyframes clignote { from { transform: scale(.92); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; filter: brightness(0); } 55% { transform: scale(1.12); opacity: 1; filter: brightness(1.2); } 100% { transform: none; } }
.revele-nom { font-family: var(--titre); font-weight: 900; font-size: clamp(2rem, 6vw, 3.2rem); margin: .2em 0 0; min-height: 1.2em; animation: monte .7s ease both; letter-spacing: -.02em; }
.tirage-carte { border-radius: 18px; overflow: hidden; box-shadow: var(--ombre); margin: 6px 0 10px; aspect-ratio: 2 / 1; background: #0f3d55; animation: monte .6s ease both; }
.phase-acte .tirage-carte { max-width: 420px; margin: 0 auto 10px; }
.svg-carte { width: 100%; height: 100%; display: block; }
.svg-carte .mer { fill: #12476a; }
.svg-carte .graticule line { stroke: rgba(255, 255, 255, .07); stroke-width: .6; }
.svg-carte .terre { fill: #d8c49a; stroke: #b59d6d; stroke-width: .5; }
body[data-espece="savane"] .svg-carte .terre { fill: #e2b878; }
.svg-carte .zoom { transition: transform 1.8s cubic-bezier(.5, 0, .2, 1); }
.svg-carte .point circle { fill: #fff; stroke: #1b1b1b; stroke-width: .5; transition: r .2s; }
.svg-carte .point.flash circle { fill: var(--or); }
.svg-carte .point.choisi circle:first-child { fill: #ff5a3c; }
.svg-carte .onde { fill: none !important; stroke: #ff5a3c !important; stroke-width: .8 !important; transform-box: fill-box; transform-origin: center; animation: onde 1.8s ease-out infinite; }
.svg-carte .onde.o2 { animation-delay: .9s; }
@keyframes onde { from { transform: scale(1); opacity: .9; } to { transform: scale(4.5); opacity: 0; } }
.roulette { font-weight: 800; }
.roulette span:first-child { transition: transform .15s; }
.roulette.fin span:first-child { color: var(--accent-fort); }
.acte { animation: monte .7s var(--ressort) both; }
.acte-emoji { width: 104px; flex: none; }
.acte-emoji .svg-portrait { width: 100%; height: auto; display: block; }

/* ---------- Scène du jeu ---------- */
.scene { position: relative; isolation: isolate; transition: filter 2.5s ease, box-shadow .4s; }
.scene .couche { position: absolute; inset: 0; }
.scene .couche.arrive { animation: fondu-in .9s ease both; }
.scene .couche.part { animation: fondu-out .9s ease both; z-index: -1; }
@keyframes fondu-in { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
@keyframes fondu-out { to { opacity: 0; } }
.scene .moment { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, .35); padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(4px); }
.scene.scene-fin { filter: grayscale(.85) brightness(.7) sepia(.2); }
.scene.fx-danger { animation: alerte 1.2s ease; }
.scene.fx-danger::after, .scene.fx-jalon::after { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit; animation: halo 1.2s ease both; }
.scene.fx-danger::after { box-shadow: inset 0 0 0 3px rgba(220, 50, 30, .8), inset 0 0 60px rgba(200, 30, 10, .55); }
.scene.fx-jalon::after { box-shadow: inset 0 0 0 3px var(--or), inset 0 0 70px rgba(255, 200, 80, .45); }
.scene.fx-choc { animation: choc .5s ease; }
@keyframes alerte { 10%, 30% { transform: translateX(-4px); } 20%, 40% { transform: translateX(4px); } 50% { transform: none; } }
@keyframes choc { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
@keyframes halo { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Animations des dessins SVG (scenes.js) ---------- */
.perso .souffle { transform-box: fill-box; transform-origin: 50% 100%; animation: souffle 3.4s ease-in-out infinite; }
.perso .queue { transform-box: fill-box; transform-origin: 100% 0; animation: queue 3s ease-in-out infinite; }
.perso .oeil { transform-box: fill-box; transform-origin: center; animation: cligne 5.5s infinite; }
.perso.tortue { animation: flotter 6s ease-in-out infinite; }
.perso.lion { animation: none; }
.perso.marche .patte { transform-box: fill-box; transform-origin: 50% 0; animation: pas .9s ease-in-out infinite alternate; }
.perso.marche .p2, .perso.marche .p3 { animation-delay: -.45s; }
.perso.tortue .nageoire { transform-box: fill-box; transform-origin: 80% 10%; animation: rame 2.6s ease-in-out infinite; }
.perso.tortue .nageoire.arr { transform-origin: 100% 0; animation-duration: 3.2s; }
.perso.tortue .nageoire.av2 { animation-delay: -1.3s; }
.perso.tortue.ramper .nageoire { animation-duration: 1.1s; }
@keyframes souffle { 50% { transform: scaleY(1.03); } }
@keyframes queue { 50% { transform: rotate(14deg); } }
@keyframes cligne { 0%, 94%, 100% { transform: none; } 97% { transform: scaleY(.1); } }
@keyframes pas { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
@keyframes rame { 50% { transform: rotate(-16deg); } }
.svg-scene .calque.c1 { animation: derive-lente 40s ease-in-out infinite alternate; }
@keyframes derive-lente { to { transform: translateX(-8px); } }
.etoiles circle { animation: scintille 3.2s ease-in-out infinite; }
@keyframes scintille { 50% { opacity: .25; } }
.nuages { animation: nuages 60s linear infinite alternate; }
@keyframes nuages { to { transform: translateX(40px); } }
.oiseaux { animation: oiseaux 26s linear infinite; }
@keyframes oiseaux { from { transform: translate(-80px, 10px); } to { transform: translate(480px, -20px); } }
svg .troupeau { animation: broute 9s ease-in-out infinite alternate; }
@keyframes broute { to { transform: translateX(-6px); } }
.reflet, .rayons { animation: miroite 5s ease-in-out infinite; }
@keyframes miroite { 50% { opacity: .45; } }
.croco { animation: flotter 4s ease-in-out infinite; }
.feu-camp, .phare, .flammes { animation: vacille .35s ease-in-out infinite alternate; }
@keyframes vacille { to { opacity: .6; } }
svg .banc { animation: banc 7s ease-in-out infinite; }
@keyframes banc { 50% { transform: translate(-14px, 4px); } }
svg .passe { animation: passe 14s linear infinite; }
svg .passe-lent { animation: passe 40s linear infinite; }
@keyframes passe { from { transform: translateX(260px); } to { transform: translateX(-520px); } }
svg .derive { animation: flotter 6s ease-in-out infinite; }
svg .crabe { animation: crabe 2.4s steps(6) infinite alternate; }
@keyframes crabe { to { transform: translateX(-12px); } }
.vague-plage { animation: lave 5s ease-in-out infinite; }
@keyframes lave { 50% { transform: translate(10px, -6px); opacity: .4; } }
.helice { animation: vacille .1s linear infinite alternate; }
.particules circle, .particules line { animation-name: poussiere; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.particules.poussiere circle { fill: rgba(255, 240, 210, .7); }
.particules.pluie line { stroke: rgba(220, 235, 245, .75); stroke-width: 1.1; animation-name: pluie; animation-timing-function: linear; }
.particules.bulles circle { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: .7; animation-name: bulle; animation-timing-function: linear; }
.particules.lucioles circle { fill: #ffe98a; animation-name: luciole; }
.particules.plancton circle { fill: #8ff3ff; animation-name: luciole; }
.particules.braises circle { fill: #ffb347; animation-name: braise; animation-timing-function: ease-out; }
@keyframes poussiere { 0%, 100% { transform: translate(0, 0); opacity: .2; } 50% { transform: translate(14px, -6px); opacity: .8; } }
@keyframes pluie { from { transform: translate(0, -40px); } to { transform: translate(-10px, 200px); } }
@keyframes bulle { from { transform: translateY(40px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-200px); opacity: 0; } }
@keyframes luciole { 0%, 100% { opacity: .1; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(6px, -8px); } }
@keyframes braise { from { transform: translateY(0); opacity: 1; } to { transform: translate(10px, -90px); opacity: 0; } }

/* ---------- Carte d'événement et jauges ---------- */
.carte-evt { position: relative; overflow: hidden; }
.carte-evt.entre { animation: carte-entre .55s var(--ressort) both; }
@keyframes carte-entre { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.carte-evt.jalon { border-color: var(--or); box-shadow: 0 0 0 1px var(--or), var(--ombre); }
.carte-evt.danger { border-color: var(--danger); }
.carte-evt.danger::before { content: 'Danger'; position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 3px 12px; border-bottom-left-radius: 10px; }
.carte-evt h2 { font-size: 1.5rem; }
.choix button { transition: border-color .15s, background .15s, transform .2s var(--ressort); }
.choix button:hover:not(:disabled) { transform: translateX(4px); }
.choix button.choisi { animation: choisi .5s var(--ressort); }
@keyframes choisi { 40% { transform: scale(1.02); } }
.jauge .piste { height: 10px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }
.jauge .rempli { background: linear-gradient(90deg, var(--accent), var(--or)); position: relative; }
.jauge.bas .rempli { background: var(--danger); animation: alarme 1.1s ease-in-out infinite; }
.jauge.perte .piste { animation: choc .45s ease; }
.jauge.gain .rempli { box-shadow: 0 0 10px var(--or); }
@keyframes alarme { 50% { opacity: .55; } }
.age { transition: color .3s; }

/* ---------- Fin de vie ---------- */
.carte-evt.fin { background: radial-gradient(500px 220px at 50% 0, var(--accent-doux), var(--carte)); border-color: var(--bord); padding-top: 34px; }
.carte-evt.fin h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; margin-bottom: 2px; }
.fin-age { font-family: var(--titre); font-style: italic; font-size: 1.2rem; color: var(--accent-fort); margin: 0 0 14px; }
.bougie { display: block; position: relative; width: 26px; height: 64px; margin: 0 auto 14px; }
.bougie .cire { position: absolute; bottom: 0; left: 3px; width: 20px; height: 40px; border-radius: 4px 4px 6px 6px; background: linear-gradient(90deg, #efe2c6, #fff8ea 45%, #d9c7a2); box-shadow: 0 4px 10px rgba(0, 0, 0, .15); }
.bougie .flamme { position: absolute; left: 7px; top: 0; width: 12px; height: 22px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%; background: radial-gradient(circle at 50% 75%, #fff8d0, #ffc24a 45%, #ff7b1c 80%); box-shadow: 0 0 18px 6px rgba(255, 170, 60, .45); transform-origin: 50% 100%; animation: flamme-v2 1.6s ease-in-out infinite; }
@keyframes flamme-v2 { 0%, 100% { transform: rotate(-2deg) scaleY(1); } 50% { transform: rotate(3deg) scaleY(1.12); } }
.nouveaux-succes { margin: 16px auto 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.nouveaux-succes .surtitre { width: 100%; margin: 0; }
.pastille { display: inline-block; background: var(--carte); border: 1px solid var(--or); border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: .9rem; animation: pop .8s var(--ressort) both; }
.pastille:nth-child(3) { animation-delay: .15s; } .pastille:nth-child(4) { animation-delay: .3s; }

/* ---------- Mémorial ---------- */
.bandeau-memo { border-radius: 20px 20px 0 0; overflow: hidden; aspect-ratio: 2 / 1; margin-bottom: -22px; filter: sepia(.25) saturate(.85); position: relative; }
.bandeau-memo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 72%, var(--fond)); }
.bandeau-memo svg { width: 100%; height: 100%; display: block; }
.plaque { position: relative; z-index: 1; }
.plaque h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 900; }
.plaque .generation { font-size: .9rem; color: var(--accent-fort); font-weight: 600; margin: 8px 0 0; }
.lignee { margin-top: 16px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(120deg, var(--accent-doux), var(--carte)); border: 1px solid var(--accent); border-radius: var(--rayon); padding: 16px 20px; }
.lignee p { margin: 0; }
.lignee > div { flex: 1 1 260px; }

/* ---------- Statistiques et succès ---------- */
.stats-vies { margin: 8px 0 28px; }
.stats-vies h3 { margin-top: 22px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tuile { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; }
.tuile strong { display: block; font-family: var(--titre); font-size: 1.8rem; font-weight: 800; line-height: 1.1; color: var(--accent-fort); }
.tuile span { font-size: .85rem; color: var(--doux); }
.par-espece { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.carte-espece { display: flex; gap: 12px; align-items: center; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px 14px; }
.carte-espece .em { font-size: 2rem; }
.carte-espece span { display: block; font-size: .86rem; color: var(--doux); }
.barres-causes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.barres-causes li { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 2.5em; gap: 10px; align-items: center; font-size: .9rem; }
.barre-c { height: 10px; background: var(--fond2); border-radius: 6px; overflow: hidden; }
.barre-c i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--or)); border-radius: 6px; animation: remplir 1s ease both; transform-origin: left; }
@keyframes remplir { from { transform: scaleX(0); } }
.barres-causes .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--doux); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.badge { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; background: var(--carte); border: 1px dashed var(--bord); border-radius: 12px; padding: 10px 12px; opacity: .6; }
.badge .ic { grid-row: span 2; font-size: 1.6rem; filter: grayscale(1); }
.badge strong { font-size: .92rem; }
.badge span:last-child { font-size: .8rem; color: var(--doux); }
.badge.obtenu { opacity: 1; border-style: solid; border-color: var(--or); }
.badge.obtenu .ic { filter: none; }
.titre-liste { margin-top: 8px; }

/* ---------- Pied de page ---------- */
.pied { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 28px; font-size: .8rem; color: var(--doux); }
.pied p { border-top: 1px solid var(--bord); padding-top: 14px; margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .son input[type="range"] { width: 60px; }
  .hero-illu { aspect-ratio: 16 / 9; }
  .barres-causes li { grid-template-columns: 1fr 1fr 2em; }
  .bandeau-memo { margin-bottom: -14px; }
  .acte-emoji { width: 76px; }
  .scene .moment { font-size: .64rem; }
}

/* ---------- Mouvement réduit : tout reste lisible, rien ne bouge ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-titre span, .hero-titre em, .hero-sur, .hero .chapo, .reglages, .revele-nom, .acte, .tirage-carte { opacity: 1 !important; transform: none !important; }
  .svg-carte .zoom { transition: none !important; }
  .scene .couche.part { display: none; }
  .revele-animal.clignote { filter: none; }
}
@media print { .pied, .bandeau-memo, .lignee, .son { display: none !important; } }
