/* ============================================================================================
   Leçon jouée écran par écran : chemin d'étapes, cartes de cours, exercices un par un,
   étoiles, Photon qui guide, célébrations.
   ============================================================================================ */

.play-top { display: flex; align-items: center; gap: 14px; max-width: 920px; margin: 0 auto 10px; }
.play-back { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--rule-2); text-decoration: none; color: var(--ink); font-size: 1.2rem; font-weight: 700; background: var(--card); transition: transform .15s var(--ease), border-color .15s; }
.play-back:hover { transform: translateX(-2px); border-color: var(--ink); }
.play-titles { flex: 1; min-width: 0; }
.play-titles .eyebrow { margin-bottom: 2px; }
.play-titles h1 { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.9rem); margin: 0; overflow-wrap: anywhere; }
.play-stars { flex: none; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: #b7791f; background: #fff6d6; border: 2px solid #f5c84c; border-radius: 999px; padding: 4px 14px; box-shadow: 0 2px 0 #e7b53c; }
.play-stars.is-pop { animation: starpop .5s var(--ease); }
@keyframes starpop { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-4deg); } 100% { transform: scale(1); } }

/* ---- chemin des étapes ---- */
.play-map { max-width: 920px; margin: 0 auto 16px; position: relative; }
.play-progress { height: 6px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-bottom: 10px; }
.play-progress > span { display: block; height: 100%; width: 0; background: var(--accent, var(--ink)); border-radius: inherit; transition: width .5s var(--ease); }
.play-path { list-style: none; margin: 0; padding: 0 0 4px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.play-path li { flex: 1 0 auto; }
.play-station { width: 100%; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; cursor: pointer; padding: 4px 2px; color: var(--ink-3); font: inherit; border-radius: 12px; }
.play-station > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px dashed var(--rule-2); background: var(--card); font-size: 1.15rem; transition: transform .2s var(--ease), background .2s, border-color .2s; }
.play-station small { font-size: .7rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.play-station:hover > span { transform: translateY(-2px); }
.play-station.is-done > span { border-style: solid; border-color: var(--accent, var(--ink)); background: color-mix(in srgb, var(--accent, var(--ink)) 12%, var(--card)); }
.play-station.is-done { color: var(--ink-2); }
.play-station.is-current { color: var(--ink); }
.play-station.is-current > span { border-style: solid; border-color: var(--accent, var(--ink)); background: var(--accent, var(--ink)); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent, var(--ink)) 22%, transparent); transform: scale(1.08); }
.play-station:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- scène ---- */
.play-stage { max-width: 920px; margin: 0 auto; }
.step { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-l); padding: clamp(18px, 2.5vw, 30px); box-shadow: var(--shadow-2); position: relative; overflow: hidden; }
.step::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--accent, var(--ink)); }
.enter-fwd { animation: enterfwd .45s var(--ease) both; }
.enter-back { animation: enterback .45s var(--ease) both; }
@keyframes enterfwd { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes enterback { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
.step-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.step-icon { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; font-size: 1.7rem; background: color-mix(in srgb, var(--accent, var(--ink)) 14%, var(--card)); border: 2px solid color-mix(in srgb, var(--accent, var(--ink)) 40%, transparent); transform: rotate(-4deg); }
.step-kind { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent, var(--ink-3)); }
.step-title { margin: 0; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); }
.step-title:focus { outline: none; }
.step-lead { font-size: 1.15rem; line-height: 1.6; }
.step-body > * + * { margin-top: 14px; }
.step-activity { margin-top: 12px; }
.step--fin::before { background: linear-gradient(90deg, #ffb703, #3b4cca, #0f7b7d, #c2410c, #2e7d32); }

/* ---- Photon qui parle ---- */
.guide { display: flex; gap: 10px; align-items: center; margin: 4px 0 14px; }
.guide .photon { flex: none; animation: bob 3.2s ease-in-out infinite; }
.guide-bubble { position: relative; margin: 0; background: var(--paper-2); border-radius: 14px; padding: 9px 14px; font-size: .97rem; color: var(--ink-2); }
.guide-bubble::before { content: ''; position: absolute; left: -7px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-left: 0; border-right-color: var(--paper-2); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.photon--bravo .photon-mouth { fill: #7a2e0e; }
.photon--surpris .photon-mouth { fill: #7a2e0e; }

/* ---- barre du bas ---- */
.play-nav { position: sticky; bottom: 0; z-index: 5; max-width: 920px; margin: 14px auto 0; display: flex; align-items: center; gap: 12px; padding: 12px 0 14px; background: linear-gradient(to top, var(--paper) 70%, transparent); }
.play-wait { flex: 1; text-align: center; }
.play-nav .btn--primary { margin-left: auto; }
.btn--big { padding: 12px 24px; font-size: 1.05rem; }
.btn.is-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink) 35%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }

/* ---- cartes du cours ---- */
.deck-stage { min-height: 220px; }
.deck-card { position: relative; border-radius: 18px; border: 2px solid color-mix(in srgb, var(--accent, var(--ink)) 35%, var(--rule)); background: var(--card); padding: 18px 20px 20px; box-shadow: 0 10px 0 -4px color-mix(in srgb, var(--accent, var(--ink)) 18%, var(--paper-2)), 0 20px 0 -8px color-mix(in srgb, var(--accent, var(--ink)) 9%, var(--paper-2)); margin-bottom: 26px; }
.deck-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.deck-emoji { flex: none; font-size: 2.2rem; line-height: 1; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--paper-2); }
.deck-card-n { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.deck-card h3 { margin: 0; font-size: 1.35rem; }
.deck-card-body { font-size: 1.08rem; line-height: 1.6; }
.deck-example { background: var(--paper-2); border-radius: 10px; padding: 8px 12px; }
.deck-example-tag, .deck-reveal-tag { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent, var(--ink-2)); }
.deck-reveal { margin-top: 14px; border-top: 2px dashed var(--rule-2); padding-top: 12px; }
.deck-reveal-q { font-weight: 700; font-size: 1.05rem; }
.deck-reveal-answer { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--ok-bg); border: 1.5px solid var(--ok); animation: flipin .5s var(--ease); }
@keyframes flipin { from { transform: rotateX(70deg); opacity: 0; } to { transform: none; opacity: 1; } }
.deck-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.deck-dots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.deck-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--rule-2); background: var(--card); padding: 0; cursor: pointer; transition: transform .2s; }
.deck-dot.is-seen { background: color-mix(in srgb, var(--accent, var(--ink)) 35%, var(--card)); border-color: var(--accent, var(--ink)); }
.deck-dot.is-current { transform: scale(1.35); background: var(--accent, var(--ink)); border-color: var(--accent, var(--ink)); }
.deck-counter { font-weight: 700; color: var(--ink-3); font-size: .9rem; }

.deck-digest { display: grid; gap: 10px; margin-top: 8px; }
.deck-digest-card { border-left: 4px solid var(--accent, var(--ink)); background: var(--paper-2); border-radius: 0 12px 12px 0; padding: 8px 14px; }
.deck-digest-card h4 { margin: 0 0 4px; font-size: 1.02rem; }

/* ---- exemple résolu dévoilé pas à pas ---- */
.example-reveal { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ex-step { display: flex; gap: 12px; align-items: flex-start; background: var(--paper-2); border-radius: 12px; padding: 10px 14px; }
.ex-step-n { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent, var(--ink)); color: var(--paper); font-weight: 700; }
.ex-step p { margin: 0; }
.ex-step-math { margin-top: 4px !important; font-size: 1.15rem; }

/* ---- série d'exercices ---- */
.runner { margin-top: 8px; }
.run-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.run-counter { margin: 0; font-weight: 700; color: var(--ink-2); }
.run-dots { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex-wrap: wrap; }
.run-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--rule-2); background: var(--card); font-weight: 700; font-size: .8rem; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; padding: 0; }
.run-dot.is-current { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--ink)) 25%, transparent); }
.run-dot.is-done.s3 { background: #ffd34d; border-color: #e0a800; color: #7a4a00; }
.run-dot.is-done.s2 { background: #ffe58f; border-color: #e6b800; color: #7a4a00; }
.run-dot.is-done.s1 { background: #fff2c2; border-color: #e6c35c; color: #7a4a00; }
.run-dot.is-done.s0 { background: var(--paper-2); }
.run-slot { position: relative; }
.run-ex { position: relative; }
.run-foot { display: flex; justify-content: flex-end; }
.run-summary { display: flex; gap: 16px; align-items: center; background: var(--paper-2); border-radius: 16px; padding: 16px 20px; margin: 14px 0; }
.run-summary-stars { margin: 0; font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; color: #b7791f; }
.run-summary-stars small { font-size: 1rem; color: var(--ink-3); }
.run-summary-msg { margin: 2px 0 8px; }

/* ---- à retenir (affiche) ---- */
.step--poster .step-body { font-size: 1.08rem; }
.step--poster .retenir { border-width: 3px; padding: 18px 20px; background: color-mix(in srgb, #ffb703 10%, var(--card)); }

/* ---- écran final ---- */
.fin-hero { text-align: center; display: grid; justify-items: center; gap: 4px; margin-bottom: 10px; }
.fin-hero .guide { justify-content: center; }
.fin-stars { margin: 0; font-family: var(--font-display); font-size: clamp(2.4rem, 2rem + 2vw, 3.4rem); font-weight: 800; color: #b7791f; line-height: 1; }
.fin-stars small { font-size: 1.1rem; color: var(--ink-3); }
.fin-revision { background: var(--pending-bg); border-radius: 12px; padding: 10px 14px; }
.fin-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.play-track { text-decoration: none; color: inherit; }
.play-foot-links { margin-top: 18px; }

/* ---- Espace exercices : générateurs de problèmes ---- */
.gen-card--probleme { border-top-width: 7px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--ink)) 6%, var(--card)), var(--card) 40%); }

/* ---- carte : étoiles et leçons terminées ---- */
.map-stars { color: #b7791f; font-weight: 800; }
.btn.is-done { border-color: var(--ok); }

/* ---- célébrations ---- */
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 4; }
.fx-star { position: absolute; top: 30%; font-size: 1.4rem; animation: fxstar 1.1s cubic-bezier(.2, .8, .3, 1) forwards; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
@keyframes fxstar { from { transform: translate(0, 0) scale(.4) rotate(0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); opacity: 0; } }
.fx-layer--rain { overflow: hidden; }
.fx-confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fxrain 1.8s cubic-bezier(.3, .6, .5, 1) forwards; }
@keyframes fxrain { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--dx), 520px) rotate(var(--rot)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .enter-fwd, .enter-back, .guide .photon, .btn.is-pulse, .deck-reveal-answer, .play-stars.is-pop { animation: none !important; }
}
@media (max-width: 640px) {
  .play-station small { display: none; }
  .play-station { min-width: 44px; }
  .play-station > span { width: 34px; height: 34px; font-size: 1rem; }
  .step-icon { width: 44px; height: 44px; font-size: 1.35rem; }
  .play-nav { gap: 8px; }
  .play-wait { display: none; }
}
