:root { --fond:#fbf6ef; --encre:#2c211d; --doux:#7d6c64; --accent:#e9a46b; --rebond:cubic-bezier(.3,1.5,.5,1); }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
[hidden] { display:none !important; }
body { margin:0; background:var(--fond); color:var(--encre); font:17px/1.45 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif; }
button { font:inherit; color:inherit; border:0; background:none; cursor:pointer; }
button:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
h1, h2 { margin:0; letter-spacing:-.02em; line-height:1.1; }

.niveaux { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.niveaux button { display:flex; flex-direction:column; gap:4px; padding:18px 10px; border-radius:24px; background:#0000000a; border:3px solid transparent; transition:transform .3s var(--rebond), background .2s; }
.niveaux button:active { transform:scale(.94); }
.niveaux [aria-checked="true"] { background:#fff; border-color:var(--encre); transform:translateY(-3px); }
#accueil { max-width:980px; margin:0 auto; padding:max(40px,env(safe-area-inset-top)) 24px 32px; }
h1 { font-size:40px; }
#accueil > p { color:var(--doux); margin:6px 0 28px; }
#liste { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
#liste button { width:100%; aspect-ratio:1; border-radius:28px; background:var(--c); position:relative; padding:0; display:block; overflow:hidden; text-align:left; font-weight:700; font-size:19px; line-height:1.2; transition:transform .35s var(--rebond), box-shadow .35s; }
#liste button:not(:disabled):hover { transform:translateY(-5px); box-shadow:0 14px 28px #5a3a2a26; }
#liste button:not(:disabled):active { transform:scale(.94); }
#liste button:disabled { opacity:.38; cursor:default; flex-direction:column; align-items:flex-start; justify-content:flex-end; }
#liste .vignette { position:absolute; inset:0; width:100%; height:100%; display:block; }
#liste button > span { position:absolute; z-index:1; left:8px; right:8px; top:8px; width:max-content; max-width:calc(100% - 16px); background:#fffffff0; padding:5px 12px; border-radius:16px; }
#liste small { font-weight:500; font-size:13px; }
#liste li { animation:monte .5s var(--rebond) backwards; animation-delay:calc(var(--i) * 35ms); }
@keyframes monte { from { opacity:0; transform:translateY(18px) scale(.94); } }

#depart { min-height:100vh; min-height:100dvh; display:grid; grid-template-columns:1.1fr 1fr; gap:32px; align-items:center; max-width:1180px; margin:0 auto; padding:max(72px,env(safe-area-inset-top)) 24px 32px; animation:monte .45s var(--rebond); }
#vitrine { aspect-ratio:1; max-height:76vh; width:100%; border-radius:36px; overflow:hidden; background:#ff9f7a; }
#vitrine svg { width:100%; height:100%; display:block; }
.fiche h2 { font-size:42px; }
#phrase { color:var(--doux); font-size:20px; margin:8px 0 0; }
#contexte { margin:18px 0 0; }
.fiche h3 { font-size:17px; margin:26px 0 12px; }
.fiche .principal { width:100%; }
.principal { margin-top:26px; background:var(--encre); color:var(--fond); font-weight:700; font-size:20px; padding:18px 34px; border-radius:99px; transition:transform .3s var(--rebond); }
.principal:active { transform:scale(.93); }

.coin { position:absolute; top:max(14px,env(safe-area-inset-top)); left:14px; width:46px; height:46px; border-radius:50%; background:#ffffffb3; font-size:20px; z-index:2; }
#depart .coin { background:#0000000d; }

#scene { position:fixed; inset:0; background:#ff9f7a; animation:fondu .7s; }
@keyframes fondu { from { opacity:0; } }
#avatar, #avatar svg { width:100%; height:100%; display:block; touch-action:manipulation; user-select:none; }
.derive { animation:derive 24s ease-in-out infinite alternate; }
@keyframes derive { to { transform:translateX(150px); } }
.roule { animation:roule 11s linear infinite; }
@keyframes roule { from { transform:translateX(-60px); } 55%, to { transform:translateX(380px); } }
.vole { animation:vole 13s linear infinite; }
@keyframes vole { from { transform:translate(-300px, 40px); } 70%, to { transform:translate(380px, -70px); } }
.train { animation:train 14s ease-in-out infinite; }
@keyframes train { 0% { transform:translateX(-1050px); } 35%, 65% { transform:translateX(150px); } 100% { transform:translateX(1400px); } }
.flotte { animation:flotte 3.6s ease-in-out infinite alternate; }
@keyframes flotte { to { transform:translateY(-26px); } }
.luit { animation:luit 2.6s ease-in-out infinite alternate; }
@keyframes luit { from { opacity:.55; } }
.balance { animation:balance 4.5s ease-in-out infinite alternate; }
@keyframes balance { from { transform:rotate(-2.2deg); } to { transform:rotate(2.2deg); } }
.tourne { animation:tourne 40s linear infinite; }
@keyframes tourne { to { transform:rotate(360deg); } }
.bat { animation:bat 1.1s ease-in-out infinite; }
@keyframes bat { 18% { transform:scale(1.16); } 36% { transform:scale(1); } }
.vapeur { animation:monter 2.4s ease-out infinite; transform:translate(var(--x), var(--y)); }
@keyframes monter { from { transform:translate(var(--x), var(--y)) scale(.5); opacity:0; } 35% { opacity:.85; } to { transform:translate(var(--x), calc(var(--y) - 60px)) scale(1); opacity:0; } }
.tombe { animation:tombe 4s linear infinite; }
@keyframes tombe { from { transform:translate(30px, -220px) rotate(0deg); } 50% { transform:translate(-20px, 440px) rotate(8deg); } to { transform:translate(20px, 1100px) rotate(0deg); } }
.envol { opacity:0; animation:envol 5s ease-out infinite; }
@keyframes envol { from { transform:translate(0, 60px); opacity:0; } 25% { opacity:1; } to { transform:translate(30px, -190px) rotate(14deg); opacity:0; } }
.rides { animation:rides 1.6s ease-out infinite; }
@keyframes rides { from { transform:scale(.2); opacity:1; } to { transform:scale(1.7); opacity:0; } }
.court { animation:court 12s linear infinite; }
@keyframes court { 0% { transform:translate(-350px, 0); } 7% { transform:translate(-30px, -26px); } 14% { transform:translate(290px, 0); } 21% { transform:translate(610px, -26px); } 28% { transform:translate(930px, 0); } 35% { transform:translate(1250px, -26px); } 45%, 100% { transform:translate(1700px, 0); } }
.decolle { animation:decolle 15s ease-in infinite; }
@keyframes decolle { 0% { transform:translate(-500px, 470px); } 30% { transform:translate(260px, 440px); } 75%, 100% { transform:translate(1650px, -120px) rotate(-14deg); } }
.ecran { animation:ecran 3.4s steps(6, end) infinite alternate; }
@keyframes ecran { 20% { opacity:.82; } 45% { filter:hue-rotate(45deg); } 70% { opacity:.65; } }
.vacille { animation:vacille .9s ease-in-out infinite alternate; }
@keyframes vacille { 35% { transform:scale(1.05, .94); opacity:.85; } 70% { transform:scale(.95, 1.07); } }
.eclair { opacity:0; animation:eclair 9s linear infinite; }
@keyframes eclair { 0%, 70%, 74%, 79%, 100% { opacity:0; } 72% { opacity:.8; } 76% { opacity:.45; } }
.ondes path, .points circle { opacity:0; }
[data-mode="ecoute"] .ondes path { animation:onde 1.4s ease-out infinite; }
@keyframes onde { 35% { opacity:.9; } to { opacity:0; } }
[data-mode="pense"] .points circle { animation:rebondit .9s ease-in-out infinite; }
@keyframes rebondit { 0%, 100% { opacity:.6; transform:translateY(0); } 45% { opacity:1; transform:translateY(-18px); } }
#alerte { position:absolute; left:50%; bottom:max(24px,env(safe-area-inset-bottom)); transform:translateX(-50%); width:max-content; max-width:90vw; background:var(--fond); padding:14px 22px; border-radius:99px; z-index:2; }

@media (max-width:700px) { #liste { grid-template-columns:repeat(3,1fr); gap:12px; } #liste button { font-size:13px; border-radius:20px; } }
@media (prefers-reduced-motion:reduce) { * { animation:none !important; transition:none !important; } }
@media (prefers-reduced-motion:reduce) { [data-mode="ecoute"] .ondes path, [data-mode="pense"] .points circle { opacity:.9; } }
.niveaux span { color:var(--doux); font-size:13px; }
@media (max-width:760px), (orientation:portrait) { #depart { grid-template-columns:1fr; align-content:start; gap:22px; } #vitrine { aspect-ratio:4/3; max-height:42vh; } }
@media (max-width:480px) { .niveaux { grid-template-columns:1fr; } }

#accueil{position:relative}
.cobalt-back{position:absolute;top:max(14px,env(safe-area-inset-top));left:max(14px,env(safe-area-inset-left));display:inline-flex;align-items:center;min-height:44px;padding:6px 16px;border-radius:99px;font:700 16px system-ui,sans-serif;color:#fff;background:#ffffff26;border:1px solid #ffffff55;text-decoration:none}

/* iPad installé : page au moins aussi haute que l'écran (sinon WebKit la coupe en bas, bug 301108) + fine bande fixe en haut contre le flou du système — même réglage que Blast Block / Rush */
.noblur{display:none}
@supports (-webkit-touch-callout:none){@media (display-mode:standalone){
  html{min-height:min(100lvh,calc(100% + env(safe-area-inset-top,0px)))}
  .noblur{display:block;position:fixed;top:0;left:0;right:0;height:11px;pointer-events:none;z-index:9999;background:#f6efe4;-webkit-background-clip:text;background-clip:text}
}}
