/* Polices auto-hébergées (SIL Open Font License) */
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url(fonts/fredoka-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url(fonts/fredoka-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Andika'; font-weight: 400; font-display: swap; src: url(fonts/andika-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Andika'; font-weight: 700; font-display: swap; src: url(fonts/andika-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 600; font-display: swap; src: url(fonts/caveat-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Gochi Hand'; font-weight: 400; font-display: swap; src: url(fonts/gochi-hand-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Patrick Hand'; font-weight: 400; font-display: swap; src: url(fonts/patrick-hand-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Mono'; font-weight: 700; font-display: swap; src: url(fonts/space-mono-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Libre Baskerville'; font-weight: 700; font-display: swap; src: url(fonts/libre-baskerville-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Playwrite FR Moderne'; font-weight: 400; font-display: swap; src: url(fonts/playwrite-fr-moderne-latin-400-normal.woff2) format('woff2'); }

:root { --ink: #3a2a1e; --wood: #7a4e2d; --parch: #fbf3df; --cream: #fffaf0; --soft: #6b5040; --line: #e2d3b5; --blue: #2a6fb0; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2f4a2c; font-family: 'Andika', sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#stage { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; overflow: hidden; transform-origin: 0 0; background: #8fc3e8; }
#app, .app { position: absolute; inset: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
button:focus-visible { outline: 4px solid #2f6fd0; outline-offset: 3px; }
button:disabled { cursor: default; }
h1, h2 { margin: 0; font-family: 'Fredoka', sans-serif; font-weight: 600; color: var(--wood); }
h2 { font-size: 40px; }

/* décor */
.cloud { animation: drift 24s ease-in-out infinite alternate; }
.c2 { animation-duration: 32s; animation-delay: -8s; } .c3 { animation-duration: 28s; animation-delay: -14s; }
@keyframes drift { from { transform: translateX(-50px); } to { transform: translateX(50px); } }
.mote { position: absolute; width: 7px; height: 7px; background: #fff6c2; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); opacity: 0; animation: mote 9s ease-in-out infinite; pointer-events: none; }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 20% { opacity: .9; } 50% { transform: translate(14px, -36px); } 80% { opacity: .7; } 100% { opacity: 0; transform: translate(-6px, -70px); } }

/* en-tête */
.header { position: absolute; left: 24px; top: 16px; width: 1232px; height: 66px; display: flex; align-items: center; justify-content: space-between; }
.hside { display: flex; align-items: center; gap: 12px; width: 300px; }
.hside.hs-end { justify-content: flex-end; }
.ribbon { padding: 8px 44px; background: var(--wood); color: #fff5dc; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 30px; clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%); }
.slots { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: rgba(255, 250, 240, .92); border: 4px solid var(--wood); border-radius: 30px; }
.slot { transition: transform .2s ease; } .slot.cur { transform: scale(1.25); }
.starbox { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 18px 6px 10px; background: var(--cream); border: 4px solid var(--wood); border-radius: 30px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; }
.pulse { animation: pulse .6s ease .9s; }
@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* boutons */
.chunky { position: relative; border: 4px solid var(--wood); border-bottom-width: 9px; border-radius: 16px; transition: transform .12s ease, filter .12s ease; }
.chunky::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 46%; background: rgba(255, 255, 255, .28); clip-path: polygon(0 0, 100% 0, 100% 55%, 0 100%); border-radius: 12px 12px 0 0; pointer-events: none; }
button.chunky:hover { transform: translateY(-3px); filter: brightness(1.04); }
button.chunky:active { transform: translateY(2px); border-bottom-width: 5px; }
.icon-btn { width: 62px; height: 60px; display: flex; align-items: center; justify-content: center; }
.icon-btn.big { width: 84px; height: 76px; } .icon-btn.grow { flex-grow: 1; height: 76px; }
.primary { background: #f6cf57; } .secondary { background: var(--cream); } .go { background: #8fd07c; color: #1f3d17; } .gold { background: #f6cf57; }
.pill { background: var(--cream); color: var(--wood); min-width: 80px; height: 56px; padding: 0 18px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; }
.pill.on { background: #f6cf57; color: var(--ink); }
.tall { height: 80px; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: 'Fredoka', sans-serif; font-size: 28px; font-weight: 600; }
.wide-btn { height: 62px; padding: 0 30px; font-family: 'Fredoka', sans-serif; font-size: 26px; font-weight: 600; }
.btn-row { display: flex; gap: 14px; }

/* renard */
.foxcol { position: absolute; left: 12px; top: 250px; width: 200px; height: 540px; }
.bubble { position: absolute; left: 0; bottom: 216px; width: 198px; padding: 16px; background: #fff; border: 4px solid var(--wood); border-radius: 18px; font-size: 20px; line-height: 1.35; font-weight: 700; transform-origin: 40% 100%; }
.bubble-tail { position: absolute; left: 70px; bottom: 194px; }
.pop-a { animation: popa .35s ease-out; } .pop-b { animation: popb .35s ease-out; }
@keyframes popa { 0% { transform: scale(.85); opacity: .3; } 100% { transform: scale(1); opacity: 1; } }
@keyframes popb { 0% { transform: scale(.85); opacity: .3; } 100% { transform: scale(1); opacity: 1; } }
.fox { position: absolute; left: 20px; bottom: 10px; width: 160px; height: 178px; animation: bob 3.6s ease-in-out infinite; }
.fox.hop { animation: hop .7s ease-out; }
.fox .lamp { position: absolute; left: 120px; top: 0; animation: twinkle 2.8s ease-in-out infinite; }
.fox .fox-svg { position: absolute; left: 0; top: 24px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes hop { 0% { transform: translateY(0); } 35% { transform: translateY(-26px) rotate(-6deg); } 70% { transform: translateY(0) rotate(3deg); } 100% { transform: translateY(0); } }
@keyframes twinkle { 0%, 100% { opacity: .75; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }
.blink { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.tail { transform-box: fill-box; transform-origin: 0% 100%; animation: wag 2.8s ease-in-out infinite; }
@keyframes wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }

/* panneau */
.panel { position: absolute; left: 222px; top: 98px; width: 1036px; height: 684px; filter: drop-shadow(0 8px 0 rgba(60, 38, 20, .35)); }
.panel-border { position: absolute; inset: 0; background: var(--wood); clip-path: polygon(28px 0, calc(100% - 28px) 0, 100% 28px, 100% calc(100% - 28px), calc(100% - 28px) 100%, 28px 100%, 0 calc(100% - 28px), 0 28px); }
.panel-inner { position: absolute; inset: 6px; background: var(--parch); clip-path: polygon(25px 0, calc(100% - 25px) 0, 100% 25px, 100% calc(100% - 25px), calc(100% - 25px) 100%, 25px 100%, 0 calc(100% - 25px), 0 25px); }
.panel-deco { position: absolute; left: 0; top: 0; }
.screen { position: relative; width: 1024px; height: 672px; }
.screen-in { animation: screenin .4s ease-out; }
@keyframes screenin { 0% { opacity: 0; transform: translateY(14px); } 100% { opacity: 1; transform: translateY(0); } }

/* menu */
.menu { padding: 28px 40px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.title-banner { padding: 12px 70px 16px; background: var(--wood); clip-path: polygon(0 0, 100% 0, calc(100% - 34px) 50%, 100% 100%, 0 100%, 34px 50%); }
.title-banner h1 { font-size: 54px; font-weight: 700; color: #fff5dc; letter-spacing: 1px; }
.menu-row { display: flex; gap: 22px; }
.adventure { width: 262px; height: 350px; background: #fdf0c4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.label-xl { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 40px; }
.mode-grid { display: grid; grid-template-columns: repeat(4, 152px); grid-template-rows: repeat(2, 168px); gap: 14px; }
.mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; animation: tilein .45s ease-out backwards; animation-delay: calc(var(--i, 0) * 55ms); }
.mode-icon { display: flex; transition: transform .25s ease; }
.mode-icon svg { width: 88px; height: 88px; }
.mode:hover .mode-icon { transform: translateY(-4px) rotate(-3deg); }
.label { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 24px; letter-spacing: -.2px; }
.new-badge { position: absolute; top: -14px; right: -12px; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 18px; background: #e0584d; color: #fff; border: 3px solid var(--wood); font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 20px; line-height: 30px; animation: badge 2.4s ease-in-out infinite; }
@keyframes tilein { 0% { opacity: 0; transform: translateY(12px) scale(.96); } 100% { opacity: 1; transform: none; } }
@keyframes badge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.defi-btn { height: 84px; padding: 0 40px; display: flex; align-items: center; gap: 16px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 32px; }

/* carte */
.map-deco { position: absolute; left: 0; top: 0; }
.stage { position: absolute; width: 120px; height: 130px; filter: drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); transition: transform .15s ease; }
.stage:not(:disabled):hover { transform: translateY(-4px); }
.stage.current { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); } 50% { filter: drop-shadow(0 0 16px #fff3a0) drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); } }
.stage.locked { opacity: .75; }
.stage-label { position: absolute; inset: 0 0 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 34px; line-height: 1; }
.stage-label small { font-size: 17px; font-weight: 600; margin-top: 2px; }
.stage-stars { position: absolute; left: 0; right: 0; bottom: -18px; display: flex; justify-content: center; gap: 2px; }

/* pierres (explorer + carte) */
.hex { position: absolute; inset: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hexTop { position: absolute; inset: 0; background: rgba(255, 255, 255, .4); clip-path: polygon(50% 0, 100% 25%, 50% 42%, 0 25%); }
.hexSide { position: absolute; inset: 0; background: rgba(60, 30, 10, .1); clip-path: polygon(100% 25%, 100% 75%, 50% 100%, 50% 42%); }
.explore { padding: 34px 36px; display: flex; gap: 34px; align-items: center; }
.ex-left { width: 580px; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.ex-nav { display: flex; align-items: center; gap: 20px; min-height: 66px; }
.nav-btn { width: 70px; height: 66px; display: flex; align-items: center; justify-content: center; }
.ex-range { min-width: 250px; text-align: center; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 34px; color: var(--wood); }
.stones { display: grid; grid-template-columns: repeat(5, 96px); gap: 26px 18px; }
.stone { position: relative; width: 96px; height: 104px; filter: drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); transition: transform .15s ease, filter .15s ease; }
.stone:hover { transform: translateY(-3px); }
.stone.sel { transform: scale(1.15); filter: drop-shadow(0 0 12px #fff3a0) drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); }
.stone.lit { transform: scale(1.08); filter: drop-shadow(0 0 14px #fff6b8) drop-shadow(0 6px 0 rgba(90, 60, 30, .3)); }
.stoneNum { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: 'Fredoka', sans-serif; font-weight: 700; }
.ex-card { flex-grow: 1; height: 590px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px; background: var(--cream); border: 4px solid var(--line); border-radius: 22px; }
.big-num { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 150px; line-height: 1; color: var(--blue); }
.big-word { font-size: 32px; font-weight: 700; text-align: center; line-height: 1.15; }
.tens { display: flex; align-items: flex-end; gap: 6px; min-height: 154px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.ones { display: grid; grid-template-columns: repeat(5, 22px); gap: 6px; margin-left: 8px; }
.tenbar { width: 22px; height: 150px; border: 2px solid var(--blue); border-radius: 6px; background: repeating-linear-gradient(to bottom, #8fd3f4 0, #8fd3f4 11px, var(--blue) 11px, var(--blue) 13px); }
.onedot { width: 22px; height: 22px; background: #f2b53c; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

/* tracer */
.trace { padding: 30px 32px; display: flex; gap: 30px; align-items: center; }
.pad-frame { width: 612px; height: 492px; padding: 6px; background: var(--wood); border-radius: 18px; }
#pad { display: block; width: 600px; height: 480px; border-radius: 13px; touch-action: none; cursor: crosshair; background: #fffdf6; }
.trace-side { flex-grow: 1; display: flex; flex-direction: column; gap: 16px; }
.info-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; background: var(--cream); border: 4px solid var(--line); border-radius: 20px; }
.tr-num { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 104px; line-height: 1; color: var(--blue); }
.tr-num.small { font-size: 60px; }
.tr-word { font-size: 28px; font-weight: 700; text-align: center; }
.tr-word.cursive { font-family: 'Playwrite FR Moderne', cursive; font-weight: 400; font-size: 30px; line-height: 1.6; color: var(--wood); }
.dots { display: flex; gap: 8px; margin-top: 6px; }
.dot { width: 18px; height: 18px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

/* compter */
.count { padding: 28px 36px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.meadow { position: relative; width: 944px; height: 348px; display: flex; align-items: center; justify-content: center; gap: 30px; border: 4px solid #a9cc86; border-radius: 22px; overflow: hidden; background: #dcefc6; }
.meadow-deco { position: absolute; left: 0; top: 0; }
.gem-grid { position: relative; display: grid; grid-template-columns: repeat(5, 70px); gap: 12px 20px; }
.gem-grid.small { grid-template-columns: repeat(3, 58px); gap: 14px; }
.bundles { position: relative; display: flex; gap: 10px; align-items: flex-end; }
.gem { position: relative; border-radius: 14px; animation: gemin .45s ease-out backwards; transition: transform .15s ease, filter .15s ease; }
.gem:hover { transform: translateY(-3px); }
.gem.on { transform: scale(1.12); filter: drop-shadow(0 0 10px #fff6a8) brightness(1.12); }
@keyframes gemin { 0% { opacity: 0; transform: scale(.4) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.bundle { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 5px; border: 3px solid rgba(122, 78, 45, .4); border-radius: 12px; background: rgba(255, 255, 255, .6); animation: gemin .45s ease-out backwards; transition: transform .15s ease, filter .15s ease; }
.bundle:hover { transform: translateY(-3px); }
.bundle.on { background: #fff6c9; border-color: #c9951f; filter: drop-shadow(0 0 10px #fff6a8); }
.badge { position: absolute; top: -10px; right: -10px; min-width: 32px; height: 32px; padding: 0 4px; border-radius: 16px; background: #fff; border: 3px solid var(--wood); font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 17px; line-height: 26px; text-align: center; }
.counter-row { display: flex; align-items: center; gap: 14px; height: 60px; }
.counter { min-width: 86px; height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: center; background: var(--cream); border: 4px solid var(--line); border-radius: 26px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 32px; }
.answers { display: flex; align-items: center; gap: 26px; }
.ans { width: 156px; height: 116px; background: var(--cream); font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 66px; }
.next-btn { height: 116px; padding: 0 30px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 32px; }
.next-btn.short { height: 76px; padding: 0 44px; }

/* lire */
.read { padding: 30px 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.listen-btn { width: 120px; height: 100px; display: flex; align-items: center; justify-content: center; }
.cards { display: flex; gap: 30px; }
.card { width: 230px; height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.paper { background-color: #fffdf6; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 23px, rgba(90, 140, 210, .22) 23px, rgba(90, 140, 210, .22) 24px); color: #1f3a8a; }
.ecran { background: #20303f; border-color: #3a3f4b; color: #eaf6ff; }
.ecran .kindtag { color: #a9c6dc; }
.kindtag { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--soft); }
.regarde { display: flex; gap: 40px; align-items: center; }
.bigcard { width: 340px; height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.opts { display: flex; flex-direction: column; gap: 18px; }
.opt { width: 430px; height: 86px; background: var(--cream); display: flex; align-items: center; gap: 18px; padding: 0 22px; font-size: 32px; font-weight: 700; text-align: left; }
.opt.sel { background: #dff0ff; border-color: var(--blue); }
.wrong { opacity: .4; animation: shake .45s ease; }
.right { background-color: #fff0b3 !important; border-color: #c9951f !important; box-shadow: 0 0 0 6px rgba(246, 207, 87, .55); }
.ecran.right { background-color: #2c4a2f !important; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* fin de défi / d'étape */
.end { padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.trophy { animation: trophy 2.4s ease-in-out infinite; }
@keyframes trophy { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(2deg); } }
.score { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 84px; line-height: 1; color: var(--wood); }
.end-stars { display: flex; gap: 10px; }
.end-slots { display: flex; gap: 8px; }
.end-btn { height: 84px; padding: 0 40px; font-family: 'Fredoka', sans-serif; font-size: 30px; font-weight: 600; }

/* progrès */
.progress { padding: 30px 34px; display: flex; gap: 30px; align-items: center; }
.prog-grid { display: grid; grid-template-columns: repeat(10, 56px); gap: 4px; }
.pcell { height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 19px; border: 2px solid rgba(122, 78, 45, .18); }
.prog-side { display: flex; flex-direction: column; gap: 14px; width: 330px; }
.legend { display: flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 700; }
.legend span { width: 30px; height: 30px; border-radius: 8px; border: 2px solid rgba(122, 78, 45, .25); }
.legend b { margin-left: auto; font-family: 'Fredoka', sans-serif; font-size: 26px; }
.prog-note { margin: 6px 0; font-size: 17px; color: var(--soft); line-height: 1.4; }
.reset-btn { height: 58px; font-size: 17px; font-weight: 700; color: #a8322e; }

/* réglages */
.overlay { position: absolute; inset: 0; background: rgba(40, 28, 18, .45); display: flex; align-items: center; justify-content: center; }
.settings { width: 780px; padding: 28px 40px; background: var(--parch); border: 6px solid var(--wood); border-radius: 26px; display: flex; flex-direction: column; gap: 16px; }
.settings h2 { font-size: 34px; }
.set-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 6px 16px; }
.set-row > span { font-size: 20px; font-weight: 700; }
.set-row small { grid-column: 2; font-size: 16px; color: var(--soft); }
.pills { display: flex; gap: 12px; flex-wrap: wrap; }
.set-actions { display: flex; justify-content: space-between; margin-top: 4px; }
.set-actions .chunky { height: 62px; padding: 0 28px; font-family: 'Fredoka', sans-serif; font-size: 24px; font-weight: 600; }

/* effets */
.fx { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.spark { position: absolute; width: 20px; height: 20px; clip-path: polygon(50% 0, 100% 100%, 0 100%); opacity: 0; animation: burst 1.25s ease-out forwards; pointer-events: none; }
@keyframes b0 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(-190px, -150px) rotate(260deg); } }
@keyframes b1 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(180px, -160px) rotate(-220deg); } }
@keyframes b2 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(-240px, 20px) rotate(300deg); } }
@keyframes b3 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(250px, 10px) rotate(-280deg); } }
@keyframes b4 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(-120px, 170px) rotate(200deg); } }
@keyframes b5 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(130px, 180px) rotate(-240deg); } }
@keyframes b6 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(10px, -220px) rotate(180deg); } }
@keyframes b7 { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(-20px, 210px) rotate(-200deg); } }
.s0 { animation-name: b0; } .s1 { animation-name: b1; } .s2 { animation-name: b2; } .s3 { animation-name: b3; } .s4 { animation-name: b4; } .s5 { animation-name: b5; } .s6 { animation-name: b6; } .s7 { animation-name: b7; }
.ring { position: absolute; left: 640px; top: 330px; width: 200px; height: 200px; border: 6px solid #fff3a0; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); opacity: 0; animation: ring .9s ease-out forwards; pointer-events: none; }
@keyframes ring { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.8); } }
.flystar { position: absolute; left: 720px; top: 410px; width: 48px; height: 48px; animation: fly 1.1s cubic-bezier(.5, 0, .3, 1) forwards; pointer-events: none; }
@keyframes fly { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 20% { opacity: 1; transform: translate(0, -40px) scale(1.4); } 100% { opacity: .9; transform: translate(318px, -378px) scale(.7); } }

/* quantités (barres de dix + losanges) */
.qty { display: flex; align-items: flex-end; justify-content: center; gap: 5px; flex-wrap: wrap; min-height: 90px; }
.qbar { display: block; width: 14px; height: 86px; border: 2px solid var(--blue); border-radius: 5px; background: repeating-linear-gradient(to bottom, #8fd3f4 0, #8fd3f4 6.6px, var(--blue) 6.6px, var(--blue) 8.2px); }
.qdots { display: grid; grid-template-columns: repeat(5, 14px); gap: 4px; margin-left: 6px; }
.qdot { display: block; width: 14px; height: 14px; background: #f2b53c; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.qty.small { min-height: 70px; } .qty.small .qbar { height: 64px; width: 11px; } .qty.small .qdots { grid-template-columns: repeat(5, 11px); gap: 3px; } .qty.small .qdot { width: 11px; height: 11px; }
.qty.roomy .qbar { width: 20px; height: 120px; background: repeating-linear-gradient(to bottom, #8fd3f4 0, #8fd3f4 10px, var(--blue) 10px, var(--blue) 12px); }
.qty.roomy .qdots { grid-template-columns: repeat(5, 22px); gap: 6px; } .qty.roomy .qdot { width: 22px; height: 22px; }
.meadow .qty { position: relative; padding: 16px 20px; background: rgba(255, 255, 255, .55); border-radius: 16px; }
.meadow .qbar { width: 20px; height: 150px; background: repeating-linear-gradient(to bottom, #8fd3f4 0, #8fd3f4 12.8px, var(--blue) 12.8px, var(--blue) 14.8px); }
.meadow .qdots { grid-template-columns: repeat(5, 20px); gap: 6px; margin-left: 10px; } .meadow .qdot { width: 20px; height: 20px; }
.under-row { display: flex; align-items: center; justify-content: center; gap: 28px; min-height: 90px; }

/* comparer */
.compare { padding: 26px 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.cmp-row { display: flex; align-items: center; gap: 40px; }
.cmp-card { width: 330px; height: 350px; background: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; animation: gemin .45s ease-out backwards; }
.cmp-num { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 130px; line-height: 1; color: var(--blue); }
.cmp-sym { width: 110px; height: 110px; display: flex; align-items: center; justify-content: center; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 76px; color: var(--wood); background: var(--cream); border: 4px solid var(--line); border-radius: 50%; }
.cmp-sym.on { background: #fff0b3; border-color: #c9951f; animation: sympop .55s cubic-bezier(.3, 1.6, .5, 1); }
.cmp-sentence { font-size: 30px; font-weight: 700; color: var(--ink); animation: numin .4s ease-out; }
@keyframes sympop { 0% { transform: scale(.5) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }

/* cache-cache */
.suite { padding: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 44px; }
.seq-path { display: flex; align-items: center; gap: 6px; }
.seq-stone { position: relative; width: 110px; height: 120px; filter: drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); animation: gemin .45s ease-out backwards; transition: transform .2s ease, filter .2s ease; }
.seq-stone.lit { transform: scale(1.14); filter: drop-shadow(0 0 14px #fff3a0) drop-shadow(0 6px 0 rgba(90, 60, 30, .35)); }
.seq-step { width: 56px; display: flex; flex-direction: column; align-items: center; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; color: var(--wood); }
.seq-step span { height: 26px; }
.seq-leaf { position: absolute; left: -1px; top: 4px; transform-origin: 50% 90%; animation: sway 3.2s ease-in-out infinite; transition: transform .9s cubic-bezier(.4, 0, .6, 1), opacity .9s ease; }
.seq-leaf.off { transform: translate(70px, -150px) rotate(50deg) scale(.7); opacity: 0; animation: none; pointer-events: none; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* calculer */
.calc { padding: 22px 36px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.calc-eq { display: flex; align-items: center; gap: 18px; height: 78px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 64px; color: var(--ink); }
.calc-sign { color: var(--wood); }
.calc-res { min-width: 96px; height: 76px; padding: 0 12px; display: flex; align-items: center; justify-content: center; border: 4px dashed #c9ad82; border-radius: 16px; color: #a07a50; }
.calc-res.on { border-style: solid; border-color: #c9951f; background: #fff0b3; color: var(--blue); animation: sympop .5s cubic-bezier(.3, 1.6, .5, 1); }
.calc-meadow { height: 282px; gap: 26px; }
.calc-grid { grid-template-columns: repeat(5, 48px); gap: 10px; }
.calc-op { position: relative; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 72px; color: var(--wood); }
.gem.gone { opacity: .32; filter: grayscale(.7); cursor: default; }
.gem.gone::after { content: ''; position: absolute; left: 2px; right: 2px; top: 50%; height: 5px; margin-top: -2px; background: #a8322e; border-radius: 3px; transform: rotate(-35deg); }

/* jardin */
.garden { padding: 26px 30px; display: flex; gap: 26px; align-items: center; }
.garden-bed { width: 690px; height: 604px; padding: 14px 16px; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(4, 1fr); gap: 4px 8px; border: 4px solid #a9cc86; border-radius: 22px; background: #dcefc6; }
.plot { position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; }
.plot::before { content: ''; position: absolute; left: 6px; right: 6px; bottom: 2px; height: 22px; background: #a8744a; clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%); }
.plot::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 16px; height: 8px; background: #c08a5a; clip-path: polygon(8% 0, 92% 0, 94% 100%, 6% 100%); }
.plant { position: relative; z-index: 1; margin-bottom: -2px; }
.plant { transform-origin: 50% 100%; animation: sway 5s ease-in-out infinite; }
body.calm .zz { display: none; }
.plot:nth-child(2n) .plant { animation-delay: -1.7s; } .plot:nth-child(3n) .plant { animation-delay: -3.1s; }
.plant.grow { animation: grow .9s cubic-bezier(.3, 1.4, .5, 1) backwards, sway 5s ease-in-out 1s infinite; }
@keyframes grow { 0% { opacity: 0; transform: scale(.1); } 60% { opacity: 1; } 100% { transform: scale(1); } }
.seed { position: relative; z-index: 1; display: block; width: 12px; height: 12px; margin-bottom: 14px; background: #7a4e2d; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); opacity: .55; }
.garden-side { flex-grow: 1; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 20px; background: var(--cream); border: 4px solid var(--line); border-radius: 22px; }
.garden-total { display: flex; align-items: center; gap: 10px; font-family: 'Fredoka', sans-serif; font-size: 56px; color: var(--wood); }
.next-plant { display: flex; gap: 2px; }
.garden-note { margin: 0; font-size: 21px; line-height: 1.4; text-align: center; }

/* pause */
.break-card { align-items: center; text-align: center; }
.break-card p { margin: 0; font-size: 22px; line-height: 1.45; }
.sleepy { position: relative; width: 160px; height: 160px; animation: bob 4s ease-in-out infinite; }
.zz { position: absolute; left: 132px; top: 40px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 26px; color: #6440a8; opacity: 0; animation: zz 3s ease-in-out infinite; }
.z2 { animation-delay: 1s; } .z3 { animation-delay: 2s; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 30% { opacity: .9; } 100% { opacity: 0; transform: translate(18px, -44px) scale(1.2); } }

/* micro-animations */
.plus1 { position: absolute; right: -4px; top: -8px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; color: #b87818; opacity: 0; animation: plus1 1.3s ease-out .85s forwards; pointer-events: none; }
@keyframes plus1 { 0% { opacity: 0; transform: translateY(6px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }
.fox .fox-svg { transform-origin: 50% 100%; transition: transform .35s ease; }
.fox.tilt .fox-svg { transform: rotate(-5deg); }
.fox.talk .fox-svg { animation: talk .34s ease-in-out infinite alternate; }
@keyframes talk { 0% { transform: translateY(0) scaleY(1); } 100% { transform: translateY(-2px) scaleY(1.015); } }
.waves { position: absolute; left: 150px; top: 58px; pointer-events: none; }
.waves path { opacity: 0; animation: wave 1.1s ease-in-out infinite; } .waves .w2 { animation-delay: .25s; }
@keyframes wave { 0%, 100% { opacity: 0; } 40% { opacity: .9; } }
.ear { transform-box: fill-box; transform-origin: 50% 100%; }
.ear-l { animation: earl 7s ease-in-out infinite; } .ear-r { animation: earr 7s ease-in-out 2.4s infinite; }
@keyframes earl { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-9deg); } 96% { transform: rotate(3deg); } }
@keyframes earr { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(9deg); } 96% { transform: rotate(-3deg); } }
.big-num, .big-word { animation: numin .35s ease-out; }
@keyframes numin { 0% { opacity: 0; transform: translateY(8px) scale(.96); } 100% { opacity: 1; transform: none; } }
.right { animation: rightpop .5s ease-out; }
@keyframes rightpop { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }
.gem > svg { animation: shimmer 8s ease-in-out infinite; }
.gem:nth-child(3n) > svg { animation-delay: -2.7s; } .gem:nth-child(3n+1) > svg { animation-delay: -5.3s; }
@keyframes shimmer { 0%, 86%, 100% { filter: brightness(1); } 92% { filter: brightness(1.16); } }
.path-dots { animation: march 2.4s linear infinite; }
@keyframes march { to { stroke-dashoffset: -18; } }
.hint > .chunky:not(.wrong):not(.next-btn) { animation: nudge 1.5s ease-in-out 2; }
.hint > .chunky:nth-child(2) { animation-delay: .15s; } .hint > .chunky:nth-child(3) { animation-delay: .3s; }
@keyframes nudge { 0%, 60%, 100% { transform: none; } 15% { transform: translateY(-5px) rotate(-1.5deg); } 35% { transform: translateY(-2px) rotate(1.5deg); } }

/* orientation portrait : inviter à tourner l'appareil */
#rotate { display: none; }
@media (orientation: portrait) and (max-aspect-ratio: 4/5) {
  body:not(.rotate-ok) #rotate { display: flex; position: fixed; inset: 0; z-index: 10; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px; background: #2f4a2c; color: #fff5dc; text-align: center; font-family: 'Fredoka', sans-serif; font-size: 26px; }
  #rotate svg { animation: turn 2.4s ease-in-out infinite; }
  #rotate button { padding: 14px 26px; border-radius: 14px; background: #f6cf57; color: var(--ink); font-size: 20px; font-weight: 700; }
}
@keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spark, .ring, .flystar, .mote, .waves, .plus1 { display: none; }
}
/* réglage parent « Animations très calmes » */
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
body.calm .spark, body.calm .ring, body.calm .flystar, body.calm .mote, body.calm .waves, body.calm .plus1 { display: none; }
