/* Académie des Sortilèges — thème nuit violette, gros éléments tactiles pour enfants */
.eg {
    --eg-card: rgba(35, 18, 70, 0.92);
    --eg-card-2: rgba(255, 207, 64, 0.08);
    --eg-text: var(--text-light);
    --eg-muted: var(--text-muted);
    --eg-accent: var(--gold);
    --eg-accent-ink: #1b0e3a;
    --eg-border: rgba(255, 207, 64, 0.3);
    --eg-ok: #6ff0a8;
    --eg-err: var(--pink-fairy);
    --eg-radius: 18px;
    --eg-font-head: var(--font-magic);
    --eg-font-body: var(--font-body);
    --eg-font-mono: var(--font-body);
    position: relative;
    z-index: 2;
}
.eg .eg-story { font-size: 1.15rem; }
.kid-icon { font-size: 2rem; line-height: 1; }
.kid-icon.big { font-size: 3rem; }
.listen-btn { margin-bottom: 0.6rem; font-size: 1.05rem; }
.kid-stars { font-size: 1.8rem; letter-spacing: 0.2em; text-align: center; margin: 0.2rem 0 0.6rem; }
.kid-spark { position: fixed; z-index: 9999; pointer-events: none; font-size: 1.2rem; animation: kid-burst 0.9s ease-out forwards; }
@keyframes kid-burst { to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }
.shake { animation: kid-shake 0.45s ease; }
@keyframes kid-shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }

/* Salle 1 : rune */
.rune-area { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 320px); gap: 1.2rem; justify-content: center; align-items: center; margin-bottom: 0.6rem; }
.rune-book { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem; border-radius: 14px; background: #f6e7c1; }
.rune-model-svg { width: 130px; height: 130px; }
.rune-model-svg circle { fill: #8a6a3a; }
.rune-model-svg polyline { fill: none; stroke: #7b2cbf; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.rune-board { position: relative; aspect-ratio: 1; width: 100%; touch-action: none; border-radius: 20px; background: radial-gradient(circle, #3a1f6e, #1b0e3a); box-shadow: 0 0 30px rgba(77, 240, 255, 0.15) inset; }
.rune-dot { position: absolute; width: 18%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid var(--cyan-magic); background: rgba(77, 240, 255, 0.12); cursor: pointer; z-index: 2; }
.rune-dot:nth-child(3n+1) { left: 20%; } .rune-dot:nth-child(3n+2) { left: 50%; } .rune-dot:nth-child(3n) { left: 80%; }
.rune-dot:nth-child(-n+3) { top: 20%; } .rune-dot:nth-child(n+4):nth-child(-n+6) { top: 50%; } .rune-dot:nth-child(n+7):nth-child(-n+9) { top: 80%; }
.rune-dot.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 18px var(--gold); }
.rune-lines { position: absolute; inset: 0; pointer-events: none; }
.rune-trace { width: 100%; height: 100%; }
.rune-trace circle { display: none; }
.rune-trace polyline { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px var(--gold)); }

/* Salle 2 : couleurs */
.color-area { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 1rem; align-items: center; justify-items: center; }
.color-goal { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.color-target { width: 90px; height: 90px; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.4); }
.cauldron { position: relative; width: 150px; height: 150px; border-radius: 0 0 75px 75px; background: #2a2340; border: 6px solid #120c22; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.cauldron-liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 0; transition: height 0.4s ease, background 0.4s ease; }
.pot-icon { position: relative; z-index: 1; margin-bottom: 0.4rem; opacity: 0.35; }
.paint-pots { display: flex; flex-direction: column; gap: 0.6rem; }
.paint-pot { width: 70px; height: 70px; border-radius: 16px 16px 26px 26px; border: 4px solid #fff; background: var(--paint); cursor: pointer; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3); }
.paint-pot:active { transform: translateY(4px); box-shadow: none; }

/* Salle 3 : lucioles */
.firefly-sky { position: relative; height: 300px; border-radius: 20px; background: radial-gradient(ellipse at 50% 120%, #1f4d3a, #0c0620 70%); overflow: hidden; margin-bottom: 0.8rem; }
.firefly { position: absolute; transform: translate(-50%, -50%); font-size: 2rem; background: none; border: 0; padding: 0.3rem; cursor: pointer; filter: drop-shadow(0 0 8px #fff27a); }
.firefly.marked { filter: drop-shadow(0 0 10px #ff7bac) hue-rotate(260deg); }
.count-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; }
.count-btn { display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0.2rem; border-radius: 14px; border: 3px solid var(--gold); background: rgba(255, 207, 64, 0.12); color: #fff; cursor: pointer; }
.count-btn b { font-size: 1.8rem; font-family: var(--font-body); }
.count-dots { font-size: 0.8rem; letter-spacing: 0.05em; color: var(--gold); word-break: break-all; line-height: 1; }

/* Salle 4 : ombres */
.shadow-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.5rem; max-width: 620px; margin: 0 auto; }
.animal, .shadow { aspect-ratio: 1; font-size: clamp(2rem, 9vw, 3.4rem); border-radius: 18px; border: 3px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.shadow { background: #f3e9d2; }
.silhouette { filter: brightness(0); opacity: 0.85; }
.animal.picked { border-color: var(--gold); box-shadow: 0 0 18px var(--gold); transform: scale(1.06); }
.animal.matched, .shadow.matched { border-color: #6ff0a8; opacity: 0.55; }
.shadow.matched .silhouette { filter: none; opacity: 1; }
.shadow-arrow { text-align: center; margin: 0.4rem 0; }

/* Salle 5 : constellation */
.const-sky { position: relative; aspect-ratio: 100 / 85; width: min(100%, 560px); margin: 0 auto 0.8rem; border-radius: 20px; background: radial-gradient(circle at 30% 20%, #2c1660, #0b0420 75%); overflow: hidden; }
.const-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.const-lines polyline { fill: none; stroke: var(--cyan-magic); stroke-width: 0.8; stroke-linejoin: round; filter: drop-shadow(0 0 1.5px var(--cyan-magic)); }
.const-sky.done .const-lines polyline { stroke: var(--gold); }
.const-star { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: radial-gradient(circle, #fff 0 30%, rgba(255, 255, 255, 0.15) 32%); color: #1b0e3a; font-weight: 800; font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; }
.const-star.lit { background: radial-gradient(circle, var(--gold) 0 40%, rgba(255, 207, 64, 0.2) 42%); }
.const-star.next { animation: kid-pulse 1s ease-in-out infinite; }
@keyframes kid-pulse { 50% { transform: translate(-50%, -50%) scale(1.25); } }
.kid-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.kid-choice { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1rem; border-radius: 20px; border: 3px solid var(--gold); background: rgba(255, 207, 64, 0.1); color: #fff; font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; }

@media (max-width: 720px) {
    .rune-area { grid-template-columns: 1fr; }
    .rune-book { flex-direction: row; justify-content: center; }
    .rune-model-svg { width: 100px; height: 100px; }
    .color-area { grid-template-columns: 1fr 1fr; }
    .paint-pots { flex-direction: row; grid-column: 1 / -1; }
    .count-buttons { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.3rem; }
    .count-btn b { font-size: 1.4rem; }
    .shadow-row { gap: 0.3rem; }
    .kid-choices { grid-template-columns: 1fr; }
    .const-star { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
    .const-star.next, .kid-spark { animation: none; }
}
