/* ============================================================
   SummerScreen — Design System
   Univers éducatif ludique, doux et premium pour enfant de 9 ans.
   ============================================================ */

:root {
    /* Palette — douce et énergique */
    --sun: #FFB03B;
    --sun-deep: #FF8A34;
    --coral: #FF6B6B;
    --turquoise: #2CD4C6;
    --turquoise-deep: #17B3A6;
    --sky: #5AA9FF;
    --grape: #8B7CF6;
    --grape-deep: #7A63F0;
    --mint: #7BE0AD;
    --pink: #FF8FB1;

    --ink: #2E2A4A;
    --ink-soft: #5B567A;
    --muted: #9A96B4;

    --bg: #FFF7EE;
    --bg-2: #FFEFE0;
    --surface: #FFFFFF;
    --surface-2: #FBF7FF;
    --line: #EFE7F5;

    --success: #34C77B;
    --success-soft: #E4F9EE;
    --danger: #F4826B;
    --danger-soft: #FDEDE8;

    --radius-sm: 14px;
    --radius: 22px;
    --radius-lg: 32px;
    --radius-pill: 999px;

    --shadow-sm: 0 4px 14px rgba(70, 50, 120, 0.08);
    --shadow: 0 12px 30px rgba(70, 50, 120, 0.12);
    --shadow-lg: 0 24px 55px rgba(70, 50, 120, 0.18);

    --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, -apple-system, sans-serif;

    --nav-h: 74px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden; /* never spill past 100vw (no horizontal scrollbar) */
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: radial-gradient(1200px 600px at 15% -10%, var(--bg-2), transparent 60%),
                radial-gradient(900px 500px at 110% 0%, #FFF0F6, transparent 55%),
                var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--ink);
    line-height: 1.15;
    margin: 0 0 .4em;
    font-weight: 700;
}

h1 { font-size: clamp(1.8rem, 4.5vw, 2.7rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

a { color: var(--grape-deep); text-decoration: none; }

p { margin: 0 0 1rem; }

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}
body.route-app_parcours .container {
    /* Le chemin quotidien occupe toute la largeur de l'écran. */
    max-width: none;
    padding: 0 14px;
}
body.route-app_jeu_ordre .container {
    max-width: 980px;
}

/* ---------- App shell (fixed header, single inner scroll area) ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}
.app-banner {
    flex: none;
    text-align: center;
    padding: 8px 14px;
    font-weight: 700;
    color: #fff;
}
.app-banner a { color: #fff; text-decoration: underline; }

.page {
    flex: 1 1 auto;
    min-height: 0;               /* allow the flex child to shrink & scroll */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 24px 0 32px;
    animation: page-in .22s ease both;
}

.app-footer {
    text-align: center;
    padding: 22px 16px 8px;
    color: var(--muted);
    font-size: .85rem;
}
.app-footer a { color: var(--ink-soft); }

@keyframes page-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Top navigation ---------- */
.topbar {
    flex: none;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--ink);
}
.brand .mascot { width: 40px; height: 40px; flex: none; }

.nav-links {
    display: flex;
    gap: 6px;
    margin-left: 8px;
}
.nav-links a {
    padding: 9px 15px;
    border-radius: var(--radius-pill);
    color: var(--ink-soft);
    font-weight: 700;
    transition: background .18s, color .18s;
}
.nav-links a:hover { background: var(--surface-2); }
.nav-links a.active { background: var(--grape); color: #fff; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.star-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--sun), var(--sun-deep));
    color: #fff;
    font-weight: 800;
    padding: 8px 15px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
}

.avatar-btn {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
    background: var(--surface-2);
    display: grid; place-items: center;
    font-size: 24px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px;
    border: 1px solid rgba(255,255,255,.7);
}

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Big playful hub tiles */
.hub-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 190px;
    padding: 24px;
    border-radius: var(--radius-lg);
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
    isolation: isolate;
}
.hub-tile:hover { transform: translateY(-6px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.hub-tile .emoji { position: absolute; top: 14px; right: 18px; font-size: 64px; opacity: .5; z-index: -1; }
.hub-tile h3 { color: #fff; font-size: 1.5rem; margin-bottom: 2px; }
.hub-tile p { color: rgba(255,255,255,.92); margin: 0; font-weight: 600; }
.hub-tile.francais { background: linear-gradient(140deg, var(--grape), var(--sky)); }
.hub-tile.maths { background: linear-gradient(140deg, var(--turquoise), var(--mint)); }
.hub-tile.langues { background: linear-gradient(140deg, var(--coral), var(--sun)); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 14px 26px;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    color: #fff;
    background: linear-gradient(135deg, var(--grape), var(--grape-deep));
    box-shadow: 0 8px 18px rgba(123, 99, 240, .35);
    text-align: center;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.big { font-size: 1.2rem; padding: 18px 34px; }
.btn.block { display: flex; width: 100%; }
.btn.sun { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); box-shadow: 0 8px 18px rgba(255,138,52,.35); }
.btn.turquoise { background: linear-gradient(135deg, var(--turquoise), var(--turquoise-deep)); box-shadow: 0 8px 18px rgba(23,179,166,.35); }
.btn.coral { background: linear-gradient(135deg, var(--coral), #F04E4E); box-shadow: 0 8px 18px rgba(240,78,78,.32); }
.btn.ghost {
    background: #fff; color: var(--ink-soft);
    box-shadow: var(--shadow-sm); border: 2px solid var(--line);
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Progress bar ---------- */
.progress {
    height: 16px;
    background: var(--line);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--turquoise), var(--mint));
    transition: width .5s cubic-bezier(.2,.8,.2,1);
}

/* ---------- Answer choices ---------- */
.choices { display: grid; gap: 14px; margin: 22px 0; }
.choice {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    padding: 18px 22px;
    border-radius: var(--radius);
    border: 3px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-align: center;
    transition: transform .12s, border-color .12s, background .12s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--grape); }
.choice.correct { border-color: var(--success); background: var(--success-soft); }
.choice.wrong { border-color: var(--danger); background: var(--danger-soft); }
.choice:disabled { cursor: default; }

/* ---------- Sentence builder (order the words) ---------- */
.order-build {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    min-height: 60px; padding: 14px;
    border: 3px dashed var(--line); border-radius: var(--radius);
    margin-bottom: 16px;
}
.order-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
    font-family: var(--font-head); font-weight: 700; font-size: 1.1rem;
    padding: 10px 16px; border-radius: var(--radius-pill);
    border: 2px solid var(--line); background: #fff; color: var(--ink);
    cursor: pointer; transition: transform .1s, border-color .1s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--grape); }
.chip-chosen { background: var(--grape); color: #fff; border-color: var(--grape); }

.answer-input {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    border: 3px solid var(--line);
    color: var(--ink);
    outline: none;
    transition: border-color .12s;
}
.answer-input:focus { border-color: var(--grape); }

/* ---------- Feedback banner ---------- */
.feedback {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 16px;
}
.feedback.ok { background: var(--success-soft); color: #1E8A55; }
.feedback.ko { background: var(--danger-soft); color: #C4472F; }

/* ---------- Badges & stats ---------- */
.stat {
    text-align: center;
    padding: 20px;
}
.stat .num { font-family: var(--font-head); font-size: 2.4rem; font-weight: 800; color: var(--grape-deep); line-height: 1; }
.stat .lbl { color: var(--ink-soft); font-weight: 600; margin-top: 4px; }

.badge-chip {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 2px solid var(--line);
}
.badge-chip .ic { font-size: 34px; }
.badge-chip.locked { filter: grayscale(1); opacity: .5; }
.badge-chip .bt { font-family: var(--font-head); font-weight: 700; }
.badge-chip .bd { font-size: .85rem; color: var(--ink-soft); }

/* ---------- Flash / callouts ---------- */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.flash.success { background: var(--success-soft); color: #1E8A55; }
.flash.error { background: var(--danger-soft); color: #C4472F; }
.flash.info { background: #E7F1FF; color: #2C6BC4; }

.recommendation {
    display: flex; gap: 14px; align-items: center;
    background: linear-gradient(135deg, #FFF6E6, #FFEFE0);
    border: 2px dashed var(--sun);
    border-radius: var(--radius);
    padding: 18px 20px;
    font-weight: 600;
}
.recommendation .mascot { width: 54px; height: 54px; flex: none; }

/* ---------- Section heading ---------- */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head .kicker {
    font-family: var(--font-head);
    background: var(--grape); color: #fff;
    padding: 5px 14px; border-radius: var(--radius-pill);
    font-size: .85rem; font-weight: 700;
}

.exercise-play-wrap {
    min-height: calc(100dvh - 230px);
    display: grid;
    align-content: center;
    gap: 18px;
    padding: 22px 0 44px;
}
.exercise-section-head {
    justify-content: center;
    text-align: center;
    margin-bottom: 0;
}
.exercise-play-shell {
    width: min(860px, 100%);
    margin: 0 auto;
}
.exercise-card {
    padding: clamp(22px, 4vw, 34px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.subtitle { color: var(--ink-soft); font-weight: 600; }

.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.pill-tag {
    display: inline-block; background: var(--surface-2); color: var(--ink-soft);
    padding: 3px 12px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.family-add-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}
.family-add-summary::-webkit-details-marker { display: none; }
.family-add-summary > span { display: inline-flex; align-items: center; gap: 10px; }
.family-add-summary small { color: var(--ink-soft); font-weight: 800; }
.family-add-plus {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--grape);
    color: #fff;
    font-family: var(--font-head);
    font-size: 1.6rem;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}
.family-add-card[open] .family-add-plus { background: var(--mint); transform: rotate(45deg); }

/* ---------- Auth card ---------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px 16px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
}
.auth-card .mascot { width: 84px; height: 84px; display: block; margin: 0 auto 10px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--ink-soft); }
.field input,
.field select,
.field textarea {
    width: 100%; padding: 13px 16px;
    border: 2px solid var(--line); border-radius: var(--radius);
    font-size: 1rem; font-family: var(--font-body); outline: none;
    transition: border-color .12s;
    background: var(--surface);
    color: var(--ink);
}
.field textarea { resize: vertical; min-height: 92px; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--grape); }
.choice-pill { display: inline-flex; cursor: pointer; }
.choice-pill input { position: absolute; opacity: 0; pointer-events: none; }
.choice-pill span {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 13px; border-radius: var(--radius-pill);
    background: var(--surface-2); color: var(--ink-soft);
    border: 2px solid var(--line); font-weight: 800;
}
.choice-pill input:checked + span {
    background: var(--grape); color: #fff; border-color: var(--grape);
    box-shadow: 0 8px 18px rgba(123, 99, 240, .22);
}
.consent-box {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; margin: 4px 0 16px;
    border-radius: var(--radius); background: var(--surface-2);
    color: var(--ink-soft); font-weight: 700;
}
.consent-box input { margin-top: 5px; }
.family-learning-panel {
    padding: 14px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--line);
}

/* ---------- Mobile bottom nav ---------- */
.tabbar { display: none; }

/* ---------- Tablet: 2 columns for dense grids ---------- */
@media (min-width: 761px) and (max-width: 1024px) {
    .container { max-width: 760px; }
    .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
    body { font-size: 16px; }
    .nav-links { display: none; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    /* Exception : les compteurs (étoiles, badges, série…) sont courts —
       en une seule colonne ils mangeaient tout l'écran avant le contenu utile. */
    .grid.cols-4.kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .kpi-grid > .card.stat { padding: 14px 10px; }
    .kpi-grid > .card.stat .num { font-size: 1.5rem; }
    .container { padding: 0 14px; }

    .topbar { padding: 0 14px; gap: 10px; }
    .brand { font-size: 1.05rem; }

    /* Bottom tab bar is a flex item of the shell (not fixed) */
    .tabbar {
        display: flex;
        flex: none;
        height: 64px;
        background: rgba(255,255,255,.97);
        border-top: 1px solid var(--line);
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .tabbar a {
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        color: var(--ink-soft); font-size: .64rem; font-weight: 700;
        flex: 1; min-width: 0; text-align: center;
    }
    .tabbar a .ic { font-size: 20px; }
    .tabbar a.active { color: var(--grape); }

    /* Screen-time chip sits above the tab bar */
    .timer-chip { bottom: 76px !important; }
    /* Cards & headings a touch tighter */
    .card { padding: 20px; }
    h1 { font-size: 1.7rem; }
    .hub-tile { min-height: 150px; }
}

/* ---------- Celebration / feedback overlay ---------- */
.celebrate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    pointer-events: none;
}
.celebrate-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px 40px;
    text-align: center;
    transform: scale(.6);
    opacity: 0;
    animation: pop-in .45s cubic-bezier(.2,1.4,.4,1) forwards;
}
.celebrate-card .mascot { width: 120px; height: 120px; }
.celebrate-card .msg { font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; margin-top: 6px; }
.celebrate-card .stars-won { font-size: 1.6rem; margin-top: 6px; color: var(--sun-deep); font-weight: 800; }

.celebrate-card.sad .msg { color: var(--ink-soft); font-size: 1.25rem; }
.mascot-reaction {
    position: fixed;
    top: clamp(96px, 13vh, 142px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 980;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(520px, calc(100vw - 28px));
    animation: mascot-reaction-in .24s ease-out both;
    pointer-events: none;
}
.mascot-reaction .filou-tip-bubble {
    margin: 0;
    flex: 1 1 auto;
}
.mascot-reaction .mascot {
    /* Grande réaction bien visible : Filou commente vraiment la réponse. */
    width: 132px;
    height: 132px;
    animation: bounce .55s ease;
}
.mascot-reaction-text {
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.18rem;
    line-height: 1.14;
    text-align: center;
}
.mascot-reaction.great {
    border-color: rgba(44, 212, 198, .45);
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(233, 255, 250, .96));
}
.mascot-reaction.oops,
.mascot-reaction.sad {
    border-color: rgba(255, 107, 107, .34);
}
.mascot-reaction.sad .mascot { animation: wobble-sad .75s ease; }
.mascot-reaction.leaving { animation: mascot-reaction-out .22s ease-in forwards; }

@keyframes pop-in {
    0% { transform: scale(.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes mascot-reaction-in {
    0% { transform: translateX(-50%) translateY(-10px) scale(.94); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
@keyframes mascot-reaction-out {
    100% { transform: translateX(-50%) translateY(-8px) scale(.96); opacity: 0; }
}

/* Home hero: Filou has a real stage, so full-body PNGs never cover actions. */
.home-hero-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #FFF6E6, #FFEFE0);
    border: none;
    margin-bottom: 24px;
    padding: 28px 30px;
}
.home-hero-main {
    display: grid;
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
}
.home-hero-mascot {
    position: relative;
    display: grid;
    place-items: end center;
    min-height: 184px;
    isolation: isolate;
}
.home-hero-mascot::after {
    content: "";
    position: absolute;
    left: 22%;
    right: 18%;
    bottom: 8px;
    height: 18px;
    border-radius: 999px;
    background: rgba(122, 84, 36, .14);
    filter: blur(6px);
    z-index: -1;
}
.home-hero-mascot .mascot-hero {
    width: 178px;
    height: 178px;
}
.home-hero-copy { min-width: 0; }
.home-hero-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    padding-left: 214px;
}
.filou-bio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,246,230,.9)),
        radial-gradient(circle at 88% 18%, rgba(44,212,198,.18), transparent 34%);
    border: 1px solid rgba(255,176,59,.28);
    box-shadow: var(--shadow-sm);
}
.filou-bio .kicker {
    display: inline-flex;
    width: max-content;
    margin-bottom: 8px;
    background: var(--turquoise-deep);
    color: #fff;
    padding: 4px 11px;
    border-radius: 10px;
    font-family: var(--font-head);
    font-size: .78rem;
    font-weight: 800;
}
.filou-bio h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}
.filou-bio p {
    margin: 0;
    color: var(--ink-soft);
    font-weight: 650;
    line-height: 1.45;
}
.filou-bio p + p { margin-top: 8px; }
.filou-bio-comic {
    display: grid;
    gap: 8px;
    justify-items: center;
    align-items: end;
}
.filou-bio-bubble {
    position: relative;
    max-width: 178px;
    padding: 10px 12px;
    border: 2px solid rgba(46,42,74,.18);
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    font-family: var(--font-head);
    font-size: .88rem;
    font-weight: 800;
    line-height: 1.12;
    text-align: center;
    box-shadow: 0 8px 18px rgba(46,42,74,.1);
}
.filou-bio-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -9px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-right: 2px solid rgba(46,42,74,.18);
    border-bottom: 2px solid rgba(46,42,74,.18);
    transform: translateX(-50%) rotate(45deg);
}
.filou-bio-mascot {
    width: 118px;
    height: 118px;
    justify-self: center;
}
.filou-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
}
.filou-tip.compact { margin-top: -4px; }
.filou-tip-mascot {
    width: 76px;
    height: 76px;
}
.filou-tip-bubble {
    position: relative;
    max-width: 520px;
    padding: 12px 16px;
    border-radius: 16px;
    background: #fff;
    border: 2px solid rgba(139,124,246,.18);
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 800;
    line-height: 1.18;
    box-shadow: var(--shadow-sm);
}
.filou-tip-bubble::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 28px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-left: 2px solid rgba(139,124,246,.18);
    border-bottom: 2px solid rgba(139,124,246,.18);
    transform: rotate(45deg);
}
.little-game-grid .hub-tile .tile-focus { display: none; }
.simple-more {
    margin-top: 8px;
}
.simple-more > summary {
    width: max-content;
    list-style: none;
    cursor: pointer;
    margin-bottom: 16px;
}
.simple-more > summary::-webkit-details-marker { display: none; }

/* Mascot expressions — shown according to the mood class (no infinite loops). */
.mascot { transform-origin: bottom center; width: 76px; height: 76px; flex: none; }
.mascot-hero { width: 118px; height: 118px; }
.mascot-png {
    /* position:relative + img en absolu : l'image est GARANTIE de rester dans
       sa boîte (un % de hauteur sur l'ancien inline-grid se résolvait contre la
       page → Filou débordait et masquait le contenu en dessous). */
    position: relative;
    display: inline-block;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    filter: drop-shadow(0 8px 14px rgba(46,42,74,.18));
}
.mascot-png img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1);
    pointer-events: none;
    user-select: none;
}
.mascot-logo { width: 52px; height: 56px; margin-right: -6px; }
.mascot-logo img { transform: scale(1.28); transform-origin: 50% 78%; }
.mascot-png.mood-angry img { transform: scale(1.04); }
.mascot-png.mood-sad img { transform: scale(1.02); }
.mascot .m-happy, .mascot .m-neutral, .mascot .m-sad, .mascot .m-angry, .mascot .brows { display: none; }
.mascot.mood-happy .m-happy { display: block; }
.mascot.mood-neutral .m-neutral { display: block; }
.mascot.mood-sad .m-sad { display: block; }
.mascot.mood-angry .m-angry { display: block; }
.mascot.mood-angry .brows { display: block; }

/* Interactive mascot: reacts to hover / clicks (short, one-shot animations). */
.mascot[data-controller~="mascot"] { cursor: pointer; }
.mascot[data-controller~="mascot"]:hover { animation: wiggle .5s ease; }
.mascot.anim-bounce { animation: bounce .55s ease 2; }
.mascot.anim-shake { animation: shake .5s ease; }
.mascot.anim-wobble { animation: wobble-sad 1s ease; }

@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-14px) rotate(2deg); }
}
@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    30% { transform: rotate(-7deg); }
    60% { transform: rotate(5deg); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px) rotate(-3deg); }
    40% { transform: translateX(5px) rotate(3deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
@keyframes wobble-sad {
    0% { transform: rotate(0); }
    25% { transform: rotate(-6deg) translateY(2px); }
    50% { transform: rotate(4deg); }
    75% { transform: rotate(-3deg); }
    100% { transform: rotate(0); }
}
/* Celebration overlay mascot: brief bounce, independent of the mood system. */
.celebrate-card .mascot { animation: bounce .55s ease 2; }

/* ---------- Parcours map ("cahier de l'été") ---------- */
.path { display: flex; flex-direction: column; gap: 12px; }
.path-step {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: var(--radius);
    border: 2px solid var(--line); background: var(--surface);
}
.path-node {
    width: 48px; height: 48px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: 24px;
    background: var(--surface-2);
}
.path-body { flex: 1; min-width: 0; }
.path-title { font-family: var(--font-head); font-weight: 700; }
.path-validated { border-color: var(--success); background: var(--success-soft); }
.path-validated .path-node { background: var(--success); }
.path-available { border-color: var(--grape); box-shadow: var(--shadow-sm); }
.path-available .path-node { background: linear-gradient(135deg, var(--grape), var(--sky)); color: #fff; animation: pulse 1.2s ease infinite; }
.path-locked { opacity: .6; }

/* ---------- Fun celebration effects (gift explosion, rocket, balloons…) ---------- */
.fx-center {
    position: fixed; left: 50%; top: 42%;
    transform: translate(-50%, -50%);
    z-index: 1001; pointer-events: none;
}
.fx-gift { font-size: 96px; animation: gift-shake .6s ease; }
@keyframes gift-shake {
    0%, 100% { transform: rotate(0) scale(1); }
    20% { transform: rotate(-14deg) scale(1.05); }
    40% { transform: rotate(14deg); }
    60% { transform: rotate(-9deg); }
    80% { transform: rotate(9deg); }
}
.fx-boom { font-size: 130px; animation: fx-boom .55s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes fx-boom {
    0% { transform: scale(.2); opacity: 0; }
    45% { transform: scale(1.35); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.burst-piece {
    position: fixed; left: 50%; top: 42%; font-size: 30px;
    z-index: 1000; pointer-events: none;
    animation: burst .95s ease-out forwards;
}
@keyframes burst {
    0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(1.1); opacity: 0; }
}
.fx-rocket {
    position: fixed; left: -12%; bottom: -12%; font-size: 68px;
    z-index: 1000; pointer-events: none;
    animation: rocket-fly 1.5s ease-in forwards;
}
@keyframes rocket-fly {
    0% { transform: translate(0, 0) rotate(38deg); opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translate(130vw, -130vh) rotate(38deg); opacity: 0; }
}
.fx-balloon {
    position: fixed; bottom: -70px; font-size: 46px;
    z-index: 999; pointer-events: none;
    animation: balloon-up var(--dur, 3s) ease-in forwards;
}
@keyframes balloon-up {
    0% { transform: translateY(0) translateX(0) rotate(-4deg); }
    50% { transform: translateY(-55vh) translateX(var(--sway, 18px)) rotate(4deg); }
    100% { transform: translateY(-120vh) translateX(0) rotate(-4deg); }
}

/* Confetti */
.confetti-piece {
    position: fixed;
    top: -12px;
    width: 11px; height: 16px;
    border-radius: 3px;
    z-index: 999;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* Falling sad star (gentle) */
.sad-star {
    position: fixed;
    z-index: 999;
    font-size: 34px;
    pointer-events: none;
    animation: sad-drop 1.6s ease-in forwards;
}
@keyframes sad-drop {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(150px) rotate(40deg); opacity: 0; }
}

/* Flashcard flip */
.flashcard {
    perspective: 1000px;
    height: 260px;
    cursor: pointer;
}
.flashcard-inner {
    position: relative;
    width: 100%; height: 100%;
    transition: transform .6s cubic-bezier(.2,.8,.2,1);
    transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.flashcard-front { background: var(--surface); }
.flashcard-front .emoji { font-size: 84px; }
.flashcard-back {
    background: linear-gradient(140deg, var(--grape), var(--sky));
    color: #fff;
    transform: rotateY(180deg);
}
.flashcard-back .word { font-family: var(--font-head); font-weight: 800; font-size: 1.4rem; }
.flashcard-back .lang { opacity: .85; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

/* Memory game */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.memory-card {
    aspect-ratio: 1;
    border-radius: var(--radius);
    background: linear-gradient(140deg, var(--grape), var(--grape-deep));
    display: grid; place-items: center;
    font-size: 2rem; cursor: pointer;
    color: transparent;
    box-shadow: var(--shadow-sm);
    transition: transform .15s;
    border: none;
}
.memory-card.revealed { background: var(--surface); color: var(--ink); border: 2px solid var(--line); }
.memory-card.matched { background: var(--success-soft); color: var(--ink); border: 2px solid var(--success); }
.memory-card:not(.revealed):not(.matched)::after { content: '❓'; color: rgba(255,255,255,.85); }
.memory-card.revealed::after, .memory-card.matched::after { content: none; }

/* Mystery grid */
.mystery-board { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.mystery-image { display: block; width: 100%; }
.mystery-tiles { position: absolute; inset: 0; display: grid; }
.mystery-tile { background: linear-gradient(140deg, var(--grape), var(--sky)); transition: opacity .5s; }
.mystery-tile.revealed { opacity: 0; }

/* Timer chip */
.timer-chip {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.6rem;
    background: #fff;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    color: var(--grape-deep);
}
.timer-chip.hurry { color: var(--coral); animation: pulse .6s ease infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ============================================================
   Theme "grand" — for children older than ~10.
   Softer, more mature kawaï / nature palette (Ghibli-ish),
   applied via <body class="theme-grand">.
   ============================================================ */
body.theme-grand {
    --sun: #E6A94E;
    --sun-deep: #D68A2E;
    --coral: #E07856;
    --turquoise: #3AA8A0;
    --turquoise-deep: #2C8880;
    --sky: #6F9CC4;
    --grape: #6C63A6;
    --grape-deep: #574F8E;
    --mint: #8FCF9E;
    --pink: #D98BA0;

    --ink: #2B2A33;
    --ink-soft: #55535F;
    --muted: #8E8A80;

    --bg: #F5F1E8;
    --bg-2: #ECE6D6;
    --surface: #FFFDF8;
    --surface-2: #F3EFE6;
    --line: #E4DDCE;

    --radius: 18px;
    --radius-lg: 24px;

    background: radial-gradient(1100px 520px at 12% -10%, #E7EFE3, transparent 60%),
                radial-gradient(900px 500px at 110% 0%, #EDE6DA, transparent 55%),
                var(--bg);
}
body.theme-grand .hub-tile { min-height: 170px; }
body.theme-grand .hub-tile .emoji { opacity: .35; }
/* A touch calmer: less bouncy hover on cards for the older set. */
body.theme-grand .hub-tile:hover { transform: translateY(-4px); }

/* ============================================================
   Theme "adulte" — for learners aged 15+.
   Sober, refined, premium light look (no childish bubbles).
   ============================================================ */
body.theme-adulte {
    --sun: #C79A3F;
    --sun-deep: #A97F2C;
    --coral: #C56B57;
    --turquoise: #3E8E86;
    --turquoise-deep: #2F6F69;
    --sky: #5B77A8;
    --grape: #5B6CA8;
    --grape-deep: #47578C;
    --mint: #6FAE90;
    --pink: #B9789A;

    --ink: #23252B;
    --ink-soft: #4C4F58;
    --muted: #8A8D96;

    --bg: #F4F4F2;
    --bg-2: #ECECE8;
    --surface: #FFFFFF;
    --surface-2: #F5F5F3;
    --line: #E2E2DE;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    /* Refined, not bubbly */
    --font-head: 'Nunito', system-ui, sans-serif;

    --shadow-sm: 0 2px 8px rgba(30,30,40,.06);
    --shadow: 0 8px 22px rgba(30,30,40,.08);
    --shadow-lg: 0 18px 40px rgba(30,30,40,.12);

    background: linear-gradient(180deg, #F7F7F5, var(--bg));
}
body.theme-adulte h1, body.theme-adulte h2, body.theme-adulte h3 { font-weight: 800; letter-spacing: -0.01em; }
/* Flatter, more sober tiles & buttons */
body.theme-adulte .hub-tile { min-height: 140px; border-radius: var(--radius-lg); }
body.theme-adulte .hub-tile .emoji { display: none; }
body.theme-adulte .hub-tile:hover { transform: translateY(-3px); }
body.theme-adulte .btn { border-radius: 10px; }
body.theme-adulte .section-head .kicker { border-radius: 8px; background: var(--ink); }
body.theme-adulte .star-pill,
body.theme-adulte .pill-tag { border-radius: 8px; }
body.theme-adulte .mascot { display: inline-grid; }
body.theme-adulte .recommendation {
    background: var(--surface-2);
    border: 1px solid var(--line);
}
/* Suitcase widget: sober */
body.theme-adulte .card { border: 1px solid var(--line); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    .mascot, .celebrate-card .mascot { animation: none !important; }
}

@media (max-width: 760px) {
    .home-hero-card { padding: 22px; }
    .home-hero-main {
        grid-template-columns: 108px minmax(0, 1fr);
        gap: 14px;
    }
    .home-hero-mascot { min-height: 128px; }
    .home-hero-mascot .mascot-hero {
        width: 126px;
        height: 126px;
        margin-left: -8px;
    }
    .home-hero-actions {
        padding-left: 0;
        margin-top: 16px;
    }
    .filou-bio {
        grid-template-columns: minmax(0, 1fr) 86px;
        padding: 18px;
        gap: 12px;
    }
    .filou-bio h2 { font-size: 1.15rem; }
    .filou-bio p { font-size: .94rem; }
    .filou-bio-bubble {
        max-width: 150px;
        font-size: .78rem;
        padding: 9px 10px;
    }
    .filou-bio-mascot {
        width: 86px;
        height: 86px;
    }
    .filou-tip-mascot {
        width: 62px;
        height: 62px;
    }
    .filou-tip-bubble {
        font-size: .92rem;
        padding: 10px 12px;
    }
}

@media (max-width: 520px) {
    .home-hero-main {
        grid-template-columns: 92px minmax(0, 1fr);
        align-items: start;
    }
    .home-hero-mascot { min-height: 112px; }
    .home-hero-mascot .mascot-hero {
        width: 108px;
        height: 108px;
    }
    .filou-bio {
        grid-template-columns: 1fr;
    }
    .filou-bio-comic {
        grid-template-columns: 82px minmax(0, 1fr);
        align-items: center;
        justify-items: start;
    }
    .filou-bio-bubble {
        order: 2;
        max-width: none;
        text-align: left;
    }
    .filou-bio-bubble::after {
        left: -8px;
        bottom: 18px;
        transform: rotate(135deg);
    }
    .filou-bio-mascot {
        order: 1;
        width: 78px;
        height: 78px;
    }
    .filou-tip {
        align-items: flex-start;
    }
    .filou-tip-bubble {
        flex: 1;
    }
}

/* ============================================================
   Salle de jeux (Bulles, Tri express, Mot mystère)
   ============================================================ */
.stat-row { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 14px 0 18px; }
.mode-chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* --- Bulles magiques --- */
.bubbles-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bubbles-prompt { text-align: center; font-size: clamp(20px, 4vw, 30px); font-weight: 800; margin: 4px 0 8px; }
.bubbles-pool { display: flex; flex-wrap: wrap; gap: 18px 22px; align-items: center; justify-content: center;
    min-height: 300px; padding: 24px; border-radius: 22px;
    background: radial-gradient(120% 100% at 50% 100%, rgba(93,169,233,.16), transparent 70%); }
.bubble { flex: 0 0 auto; width: 92px; height: 92px; border: 3px solid rgba(255,255,255,.7); border-radius: 50%;
    font-size: 36px; font-weight: 900; color: #fff; cursor: pointer;
    background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.7), var(--sky) 48%, var(--grape) 100%);
    box-shadow: inset 0 -7px 14px rgba(0,0,0,.18), 0 8px 18px rgba(0,0,0,.18);
    text-shadow: 0 2px 3px rgba(0,0,0,.35);
    animation-name: bubbleFloat; animation-timing-function: ease-in-out;
    animation-iteration-count: infinite; animation-direction: alternate; }
.bubble:hover { filter: brightness(1.05); }
.bubble.pop { animation: bubblePop .42s ease forwards; }
.bubble.wobble { animation: bubbleWobble .4s ease; }
@keyframes bubbleFloat { from { transform: translateY(0) scale(1); } to { transform: translateY(-26px) scale(1.04); } }
@keyframes bubblePop { 60% { transform: scale(1.35); opacity: 1; } 100% { transform: scale(.2); opacity: 0; } }
@keyframes bubbleWobble { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px) rotate(-6deg); } 75% { transform: translateX(8px) rotate(6deg); } }

/* --- Tri express --- */
.sort-hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sort-hud .hurry { background: var(--coral); color: #fff; }
.sort-card-slot { display: flex; justify-content: center; min-height: 150px; align-items: center; }
.sort-card { width: 150px; height: 130px; display: flex; align-items: center; justify-content: center;
    font-size: 56px; font-weight: 900; color: var(--ink);
    background: var(--paper, #fff); border-radius: 20px; box-shadow: 0 10px 26px rgba(0,0,0,.14);
    animation: sortIn .25s ease; }
@keyframes sortIn { from { transform: translateY(-14px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.sort-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.sort-bin { min-height: 120px; border: 3px dashed rgba(93,169,233,.55); border-radius: 20px; cursor: pointer;
    background: rgba(93,169,233,.08); font-size: 22px; display: flex; align-items: center; justify-content: center;
    transition: transform .12s ease, background .12s ease; }
.sort-bin:hover { transform: translateY(-2px); }
.sort-bin.good { background: rgba(74,201,155,.35); border-color: var(--mint); transform: scale(1.03); }
.sort-bin.bad { background: rgba(233,99,99,.28); border-color: var(--coral); animation: bubbleWobble .35s ease; }
.bin-title { font-weight: 800; }

/* --- Mot mystère --- */
.wg-hud { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
.wg-sun { position: relative; width: 120px; height: 120px; margin: 6px auto 2px; }
.wg-sun .sun-core { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; }
.wg-sun .ray { position: absolute; top: calc(50% - 11px); left: calc(50% - 3px); width: 6px; height: 22px;
    border-radius: 4px; background: var(--sun, #ffc23c); transition: opacity .25s ease, background .25s ease; }
.wg-sun .ray.lost { opacity: .12; background: var(--ink-soft, #9aa); }
.wg-hint { text-align: center; font-size: 17px; color: var(--ink-soft); margin: 8px 0; }
.wg-word { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0 16px; }
.wg-word .slot { min-width: 30px; height: 42px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; border-bottom: 4px solid rgba(0,0,0,.25); }
.wg-word .slot.filled { border-bottom-color: var(--mint); animation: sortIn .2s ease; }
.wg-word .slot.sep { border-bottom: none; }
.wg-word .slot.miss { color: var(--coral); border-bottom-color: var(--coral); }
.wg-keys { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; max-width: 460px; margin: 0 auto; }
.wg-keys .key { aspect-ratio: 1; border: none; border-radius: 10px; font-size: 17px; font-weight: 800; cursor: pointer;
    background: rgba(93,169,233,.16); color: var(--ink); transition: transform .1s ease; }
.wg-keys .key:hover:not(:disabled) { transform: translateY(-2px); }
.wg-keys .key:disabled { cursor: default; }
.wg-keys .key-good { background: var(--mint); color: #fff; }
.wg-keys .key-bad { background: rgba(0,0,0,.10); color: var(--ink-soft); text-decoration: line-through; }

@media (max-width: 560px) {
    .wg-keys { grid-template-columns: repeat(7, 1fr); }
    .bubbles-pool { height: 320px; }
}

/* --- Paires (memory) --- */
.pairs-hud { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.pairs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 440px; margin: 0 auto; }
.pair-card { position: relative; aspect-ratio: 3/4; border: none; border-radius: 14px; cursor: pointer;
    background: transparent; perspective: 600px; }
.pair-card .pair-front, .pair-card .pair-back { position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; border-radius: 14px; backface-visibility: hidden; transition: transform .3s ease;
    font-weight: 800; }
.pair-card .pair-front { background: linear-gradient(140deg, var(--sky), var(--grape)); color: #fff; font-size: 26px;
    transform: rotateY(0deg); }
.pair-card .pair-back { background: var(--paper, #fff); color: var(--ink); font-size: clamp(18px, 5vw, 30px);
    box-shadow: inset 0 0 0 2px rgba(93,169,233,.4); transform: rotateY(180deg); word-break: break-word; padding: 8px;
    flex-direction: column; gap: 3px; text-align: center; }
.pair-picture { font-size: clamp(26px, 7vw, 42px); line-height: 1; }
.pair-word { font-size: clamp(13px, 3.5vw, 20px); line-height: 1.1; }
.pair-language { font-size: 9px; line-height: 1; padding: 3px 5px; border-radius: 4px; color: var(--ink-soft); background: rgba(93,169,233,.12); }
.pair-card-visual .pair-picture { font-size: clamp(42px, 11vw, 64px); }
.pair-card-adult .pair-picture { font-size: clamp(23px, 5vw, 34px); }
.pair-card-adult .pair-word { font-size: clamp(12px, 2.8vw, 17px); }
.pair-card.is-up .pair-front { transform: rotateY(180deg); }
.pair-card.is-up .pair-back { transform: rotateY(360deg); }
.pair-card.is-done { animation: sortIn .3s ease; }
.pair-card.is-done .pair-back { box-shadow: inset 0 0 0 3px var(--mint); }

/* --- Cible de calcul --- */
.target-hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.target-goal { text-align: center; font-size: clamp(22px, 5vw, 34px); font-weight: 800; margin: 6px 0 2px; }
.target-goal strong { color: var(--coral); }
.target-sum { text-align: center; font-size: 18px; color: var(--ink-soft); margin: 0 0 12px; }
.target-sum.over span { color: var(--coral); }
.target-sum span.hit { color: var(--mint); font-weight: 800; }
.target-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 360px; margin: 0 auto; }
.target-tile { aspect-ratio: 1; border: none; border-radius: 16px; font-size: 28px; font-weight: 800; cursor: pointer;
    background: rgba(93,169,233,.14); color: var(--ink); transition: transform .1s ease, background .1s ease; }
.target-tile:hover { transform: translateY(-2px); }
.target-tile.is-on { background: var(--sun); color: #fff; transform: scale(1.04); box-shadow: 0 6px 16px rgba(0,0,0,.15); }

/* --- Rythme des tables --- */
.rhythm-hud { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.rhythm-hud .combo.hot { background: var(--coral); color: #fff; }
.rhythm-bar { height: 14px; border-radius: 999px; background: rgba(0,0,0,.08); overflow: hidden; }
.rhythm-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--mint), var(--sky)); }
.rhythm-fill.hurry { background: linear-gradient(90deg, var(--sun-deep), var(--coral)); }
.rhythm-q { text-align: center; font-size: clamp(32px, 8vw, 52px); font-weight: 900; margin: 14px 0; }
.rhythm-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 380px; margin: 0 auto; }
.rhythm-choice { padding: 18px; border: none; border-radius: 16px; font-size: 26px; font-weight: 800; cursor: pointer;
    background: rgba(93,169,233,.14); color: var(--ink); transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
    touch-action: manipulation; user-select: none; }
.rhythm-choice:hover { transform: translateY(-2px); }
.rhythm-choice:active { transform: translateY(1px) scale(.98); }
.rhythm-choice:disabled { cursor: default; }
.rhythm-choice.good { background: var(--mint); color: #fff; }
.rhythm-choice.bad { background: var(--coral); color: #fff; animation: bubbleWobble .35s ease; }

/* --- Trouve l'intrus --- */
.intruder-hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.intruder-theme { text-align: center; font-size: clamp(19px, 4vw, 26px); font-weight: 800; margin: 6px 0 14px; }
.intruder-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 460px; margin: 0 auto; }
.intruder-card { padding: 22px 12px; border: none; border-radius: 18px; font-size: clamp(24px, 6vw, 34px); font-weight: 800;
    cursor: pointer; background: rgba(93,169,233,.14); color: var(--ink); transition: transform .1s ease, background .15s ease; }
.intruder-card:hover { transform: translateY(-2px); }
.intruder-card.good { background: var(--mint); color: #fff; transform: scale(1.03); }
.intruder-card.bad { background: var(--coral); color: #fff; animation: bubbleWobble .35s ease; }
.intruder-feedback { text-align: center; min-height: 26px; margin-top: 14px; font-size: 16px; color: var(--ink-soft); font-weight: 600; }
@media (min-width: 620px) { .intruder-grid { grid-template-columns: repeat(4, 1fr); } }

/* ============================================================
   Passe premium — accessibilité, contraste, cibles tactiles
   ============================================================ */
/* Focus clavier visible partout (a11y / navigation clavier) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .choice:focus-visible, .chip:focus-visible,
.bubble:focus-visible, .target-tile:focus-visible, .rhythm-choice:focus-visible,
.intruder-card:focus-visible, .sort-bin:focus-visible, .pair-card:focus-visible,
.wg-keys .key:focus-visible, .nav-links a:focus-visible, .tabbar a:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
    border-radius: 10px;
}
.hub-tile:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }

/* Contraste : voile sombre + ombre de texte pour garder le blanc lisible (AA)
   sur les tuiles aux dégradés clairs */
.hub-tile::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(to top, rgba(20,10,40,.34), rgba(20,10,40,0) 58%);
}
.hub-tile h3, .hub-tile p { text-shadow: 0 1px 3px rgba(20,10,40,.38); }

/* Cibles tactiles ≥ 44px sur petit mobile */
@media (max-width: 480px) {
    .chip { min-height: 44px; }
    .wg-keys { grid-template-columns: repeat(6, 1fr); }
    .wg-keys .key { min-height: 44px; }
    .intruder-card, .rhythm-choice, .target-tile { min-height: 56px; }
    .bubble { width: 82px; height: 82px; font-size: 32px; }
    .sort-bin { min-height: 104px; }
}

/* ---------- Salle de jeux : domaines + focus ---------- */
.games-domain { margin-top: 22px; }
.domain-title { font-size: 1.15rem; margin: 0 0 12px; color: var(--ink-soft); }
.hub-tile .tile-focus {
    display: inline-block; align-self: flex-start; margin-bottom: auto;
    background: rgba(255,255,255,.22); color: #fff; font-weight: 700; font-size: .72rem;
    padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(2px);
}

/* --- Ordre croissant --- */
.game-play-wrap {
    min-height: calc(100dvh - 240px);
    display: grid;
    align-content: center;
    gap: 16px;
    padding: 26px 0 42px;
}
.game-section-head {
    justify-content: center;
    text-align: center;
    margin-bottom: 0;
}
.game-play-card {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    min-height: 330px;
    padding: 28px;
    border-radius: 22px;
    background: rgba(255,255,255,.82);
    border: 2px solid rgba(139,124,246,.12);
    box-shadow: var(--shadow-lg);
}
.game-filou-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.game-filou-side .filou-tip-bubble {
    margin: 0;
    text-align: center;
}
.game-filou {
    width: 128px;
    height: 128px;
}
.game-stage {
    display: grid;
    place-items: center;
    min-height: 260px;
}
.seq-board {
    width: min(520px, 100%);
    margin: 0 auto;
}
.seq-hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.seq-instruction { text-align: center; font-size: 18px; color: var(--ink-soft); margin: 6px 0 16px; }
.seq-tiles { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.seq-tile { position: relative; min-width: 74px; min-height: 74px; padding: 0 14px; border: none; border-radius: 18px;
    font-size: 26px; font-weight: 800; cursor: pointer; background: rgba(93,169,233,.16); color: var(--ink);
    transition: transform .1s ease, background .15s ease; }
.seq-tile:hover { transform: translateY(-2px); }
.seq-tile.seq-done { background: var(--mint); color: #fff; }
.seq-tile.shake { animation: bubbleWobble .35s ease; }
.seq-rank { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--grape); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.2); }

@media (max-width: 760px) {
    .game-play-card {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .game-filou-side { flex-direction: row; align-items: center; }
    .game-filou { width: 82px; height: 82px; flex: none; }
}

/* --- Suite logique --- */
.pat-hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pat-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px 0; }
.pat-cell { min-width: 56px; height: 56px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 800; border-radius: 14px; background: var(--surface-2); color: var(--ink);
    box-shadow: inset 0 0 0 2px var(--line); }
.pat-cell.pat-q { background: var(--sun); color: #fff; box-shadow: none; }
.pat-hint { text-align: center; color: var(--ink-soft); margin: 10px 0; }
.pat-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 380px; margin: 0 auto; }
.pat-choice { padding: 16px; border: none; border-radius: 16px; font-size: 24px; font-weight: 800; cursor: pointer;
    background: rgba(139,124,246,.16); color: var(--ink); transition: transform .1s ease; }
.pat-choice:hover { transform: translateY(-2px); }
.pat-choice.good { background: var(--mint); color: #fff; }
.pat-choice.bad { background: var(--coral); color: #fff; animation: bubbleWobble .35s ease; }
.pat-feedback { text-align: center; min-height: 24px; margin-top: 12px; color: var(--ink-soft); font-weight: 600; }

/* ============================================================
   Mini-BD de fin de parcours (modale histoire)
   ============================================================ */
body.bd-open { overflow: hidden; }
.bd-overlay { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px;
    background:
        linear-gradient(180deg, rgba(255,248,238,.88), rgba(255,248,238,.94)),
        var(--bd-bg, linear-gradient(135deg, #FFEFE0, #EAF8FF));
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(3px); animation: bd-fade .2s ease both; }
.bd-overlay.bd-leaving { animation: bd-fade .2s ease reverse both; }
.bd-modal { position: relative; width: min(1180px, 100%); max-height: calc(100dvh - 36px); overflow: auto;
    background: rgba(255,255,255,.94); border: 3px solid rgba(45,37,78,.12); border-radius: 22px;
    box-shadow: var(--shadow-lg); padding: 26px 24px 24px; text-align: center; animation: bd-pop .28s ease both; }
.bd-skip { position: absolute; top: 10px; right: 12px; border: none; background: var(--surface-2); color: var(--ink-soft);
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-weight: 800; font-size: 15px; }
.bd-skip:hover { background: var(--line); }
.bd-heading { margin: 0 auto 18px; max-width: 720px; }
.bd-heading .kicker { display: inline-block; margin-bottom: 8px; background: var(--grape); color: #fff; }
.bd-summary { margin: 8px auto 0; color: var(--ink-soft); font-weight: 800; line-height: 1.35; }
.bd-stage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.bd-comic-panel { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 380px;
    padding: 12px; border-radius: 16px; background: #FFF9ED; border: 3px solid var(--ink);
    box-shadow: 6px 7px 0 rgba(45,37,78,.12); }
.bd-panel-number { position: absolute; top: -12px; left: -12px; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; background: var(--sun-deep); color: #fff; border: 3px solid #fff;
    font-family: var(--font-head); font-weight: 900; z-index: 2; }
.bd-frame { flex: 1; min-height: 230px; display: grid; place-items: center; border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,239,224,.92)); overflow: hidden; }
.bd-frame img { width: 100%; height: 100%; max-height: 292px; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(45,37,78,.18)); }
.bd-bubble { position: relative; margin: 0; min-height: 86px; background: #fff; border: 3px solid var(--ink);
    border-radius: 18px; padding: 13px 14px; font-family: var(--font-head); font-weight: 800; color: var(--ink);
    line-height: 1.18; display: flex; align-items: center; justify-content: center; }
.bd-bubble::before { content: ""; position: absolute; top: -13px; left: 32px; width: 18px; height: 18px;
    background: #fff; border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); transform: rotate(45deg); }
.bd-reward { margin: 18px auto 0; max-width: 520px; }
.bd-reward-card { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px 16px;
    border-radius: 16px; background: linear-gradient(135deg, #FFF6E6, #E9FFFA); border: 2px solid rgba(255,176,59,.38);
    color: var(--ink); font-weight: 800; }
.bd-reward-card.is-link { text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .12s ease; }
.bd-reward-card.is-link:hover { transform: translateY(-2px); }
.bd-reward-card strong { display: block; font-family: var(--font-head); }
.bd-reward-card em { display: block; color: var(--ink-soft); font-style: normal; font-size: .9rem; }
.bd-reward-icon { font-size: 34px; line-height: 1; }
.bd-controls { margin: 14px auto 0; max-width: 520px; }
.bd-controls .btn { width: 100%; }

@keyframes bd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bd-pop { 0% { transform: translateY(14px) scale(.94); opacity: 0; } 100% { transform: none; opacity: 1; } }

@media (max-width: 820px) {
    .bd-stage { grid-template-columns: 1fr; }
    .bd-comic-panel { min-height: 0; }
    .bd-frame { min-height: 180px; }
}

/* --- Parcours : manche "Associe" (relie) --- */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 8px 0; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item { padding: 14px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface-2);
    color: var(--ink); font-weight: 800; font-size: 1.05rem; cursor: pointer; transition: transform .1s ease, border-color .12s ease, background .12s ease; }
.match-item:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--grape); }
.match-item.sel { border-color: var(--grape); background: rgba(139,124,246,.14); }
.match-item.correct, .match-item.matched { background: var(--success-soft); border-color: var(--mint); color: var(--ink); cursor: default; }
.match-item.wrong { border-color: var(--coral); background: var(--danger-soft); animation: bubbleWobble .35s ease; }

/* ============================================================
   Parcours "chemin horizontal" (décor + principal/détours)
   ============================================================ */
.daily-path {
    margin-bottom: 24px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.8);
    background: var(--surface);
}
.daily-path-sky {
    position: relative;
    min-height: 560px;
    padding: 18px 20px 22px;
    background-image: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.18) 28%, rgba(255,255,255,.08)), var(--daily-bg, url('/images/parcours.webp'));
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.daily-path-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    position: relative;
    z-index: 3;
}
.daily-path-head h2 { margin: 2px 0 0; }
.daily-path-progress { position: relative; z-index: 3; height: 11px; margin: 12px 0 8px; max-width: 520px; }
.daily-path-stage {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 438px;
    padding: 182px 24px 48px;
    -webkit-overflow-scrolling: touch;
}
.daily-road {
    --road-y: 86px;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    gap: 58px;
    width: max-content;
    min-width: 100%;
    list-style: none;
    margin: 0;
    padding: 0 36px;
}
.daily-road::before {
    content: "";
    position: absolute;
    left: 28px;
    right: 112px;
    top: var(--road-y);
    height: 10px;
    border-radius: 999px;
    background: repeating-linear-gradient(90deg, rgba(137, 92, 43, .92) 0 26px, rgba(255,255,255,.88) 26px 40px);
    box-shadow: 0 4px 0 rgba(95, 61, 24, .18);
}
.daily-step {
    position: relative;
    z-index: 2;
    flex: none;
    width: 150px;
}
.daily-step:nth-child(even) { margin-top: 42px; }
.daily-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    text-decoration: none;
}
.daily-node {
    position: relative;
    /* z-index : le rond (matière + numéro) reste TOUJOURS au-dessus de
       l'étiquette kraft, qui le masquait quand elles se chevauchent. */
    z-index: 2;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 4px solid #fff;
    box-shadow: var(--shadow);
}
.daily-subject { font-size: 28px; line-height: 1; }
.daily-num {
    position: absolute;
    right: -7px;
    bottom: -7px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}
/* Étiquette « kraft » : un panneau de papier crème qui fait partie du décor
   (léger grain, coin scotché, rotation alternée) au lieu d'une carte UI plate. */
.daily-card {
    position: relative;
    width: 150px;
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 10px 9px 9px;
    border-radius: 10px 14px 12px 13px;
    background:
        linear-gradient(160deg, rgba(255,252,244,.98), rgba(247,238,219,.97));
    border: 1px solid rgba(139,106,58,.28);
    box-shadow: 0 5px 12px rgba(60,40,10,.28), inset 0 0 18px rgba(139,106,58,.07);
    text-align: center;
    transform: rotate(-1.4deg);
}
.daily-step:nth-child(even) .daily-card { transform: rotate(1.2deg); }
.daily-card::before {
    /* petit morceau de scotch en haut de l'étiquette */
    content: "";
    position: absolute;
    top: -7px;
    left: 50%;
    width: 42px;
    height: 13px;
    transform: translateX(-50%) rotate(-2deg);
    background: rgba(255,255,255,.55);
    border: 1px solid rgba(139,106,58,.18);
    border-radius: 2px;
}
.daily-matter {
    color: var(--ink-soft);
    font-size: .72rem;
    font-weight: 800;
}
.daily-francais .daily-card { border-top: 4px solid #8b7cf6; }
.daily-maths .daily-card { border-top: 4px solid #22b8a7; }
.daily-langues .daily-card { border-top: 4px solid #3b82f6; }
.daily-monde .daily-card { border-top: 4px solid #22a95f; }
.daily-histoire .daily-card { border-top: 4px solid #f59e0b; }
.daily-title {
    font-family: var(--font-head);
    font-size: .95rem;
    font-weight: 900;
    line-height: 1.08;
}
.daily-cta,
.daily-done,
.daily-locked {
    margin-top: 3px;
    font-size: .78rem;
    font-weight: 900;
}
.daily-cta { color: var(--grape-deep); }
.daily-done { color: #168567; }
.daily-locked { color: var(--ink-soft); }
.daily-validated .daily-node {
    background: linear-gradient(135deg, #DCFFF1, #BDF8E7);
    border-color: var(--mint);
}
.daily-validated .daily-node::after {
    content: "✓";
    position: absolute;
    inset: -8px auto auto -8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--mint);
    color: #fff;
    font-weight: 900;
}
.daily-available .daily-node {
    background: linear-gradient(135deg, var(--sun), var(--sun-deep));
    color: #fff;
    animation: road-pulse 1.6s ease-in-out infinite;
}
.daily-available .daily-card {
    border-color: rgba(255,154,44,.72);
    box-shadow: 0 6px 16px rgba(60,40,10,.32), 0 0 0 3px rgba(255,176,59,.35), inset 0 0 18px rgba(139,106,58,.07);
}
.daily-locked { opacity: .64; }
.daily-locked .daily-link { cursor: default; }
.daily-locked .daily-node { background: rgba(255,255,255,.68); filter: grayscale(.45); }
.daily-filou {
    position: absolute;
    top: -70px;
    left: 50%;
    width: 82px;
    height: 82px;
    object-fit: contain;
    transform: translateX(-50%);
    filter: drop-shadow(0 8px 8px rgba(41, 29, 16, .24));
    animation: road-hop 1.4s ease-in-out infinite;
    pointer-events: none;
}
.daily-goal {
    width: 176px;
    margin-top: -46px;
}
.daily-goal-inner {
    position: relative;
    min-height: 156px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 0 8px;
}
.daily-school {
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 900;
    box-shadow: var(--shadow-sm);
}
.daily-target {
    width: 92px;
    height: 118px;
    object-fit: contain;
    /* PNG détourés (RGBA) : on garde les couleurs intactes. Le multiply,
       utilisé avant pour gommer les fonds blancs, ternissait les personnages
       transparents en les mélangeant au décor. */
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .28));
}
/* Repli pour une image SANS transparence (fond blanc) : à cocher dans le
   Studio si besoin — le blanc disparaît alors dans le décor. */
.daily-target.has-white-bg { mix-blend-mode: multiply; }
.daily-goal-text {
    max-width: 150px;
    padding: 7px 10px;
    border-radius: 13px;
    background: rgba(255,255,255,.94);
    color: var(--ink);
    font-family: var(--font-head);
    font-size: .82rem;
    font-weight: 900;
    line-height: 1.08;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.daily-goal-inner.reached .daily-goal-text {
    background: var(--mint);
    color: #fff;
}
.daily-day-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: -6px 0 24px;
}
.daily-day-nav > :last-child {
    justify-self: end;
}
.daily-boulon {
    position: absolute;
    z-index: 3;
    top: 82px;
    right: 74px;
    width: 62px;
    height: 62px;
    object-fit: contain;
    filter: drop-shadow(0 7px 5px rgba(0,0,0,.22));
    pointer-events: none;
}
.daily-boulon-fly { animation: daily-boulon-fly 7s ease-in-out infinite; }
.daily-boulon-bounce { animation: boulon-bounce 1.6s ease-in-out infinite; }
.daily-boulon-peek { animation: boulon-peek 3.2s ease-in-out infinite; }
.daily-boulon-still { animation: none; }
@keyframes daily-boulon-fly {
    0%   { transform: translate(-50%, -50%) rotate(-6deg); }
    25%  { transform: translate(calc(-50% - 70px), calc(-50% + 18px)) rotate(8deg); }
    50%  { transform: translate(calc(-50% - 120px), calc(-50% - 8px)) rotate(-4deg); }
    75%  { transform: translate(calc(-50% - 50px), calc(-50% + 22px)) rotate(10deg); }
    100% { transform: translate(-50%, -50%) rotate(-6deg); }
}
@keyframes boulon-bounce {
    0%, 100% { transform: translate(-50%, -50%) rotate(-4deg); }
    50% { transform: translate(-50%, calc(-50% - 18px)) rotate(5deg); }
}
@keyframes boulon-peek {
    0%, 22%, 100% { opacity: 0; transform: translate(calc(-50% + 28px), calc(-50% - 10px)) scale(.86); }
    38%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (min-width: 1120px) {
    .daily-path-sky {
        min-height: min(72vh, 680px);
        background-size: 100% 100%;
        background-position: center top;
    }
    .daily-path-stage {
        min-height: min(60vh, 560px);
        overflow-x: visible;
        padding: 0;
    }
    .daily-road {
        display: block;
        position: absolute;
        inset: 0;
        min-width: 0;
        width: 100%;
        height: 100%;
        padding: 0;
    }
    .daily-road::before { display: none; }
    .daily-step {
        position: absolute;
        left: var(--x);
        /* Fidélité au Studio : le CENTRE DU ROND est ancré exactement sur le
           point placé (comme le marqueur du Studio), l'étiquette pend dessous. */
        top: var(--y);
        width: 150px;
        transform: translate(-50%, -32px);
    }
    /* Point placé bas : l'étiquette bascule AU-DESSUS du rond au lieu d'être
       coupée — le rond reste pile sur le point. */
    .daily-step.daily-flip {
        transform: translate(-50%, calc(-100% + 32px));
    }
    .daily-flip .daily-link { flex-direction: column-reverse; }
    .daily-step:nth-child(even) {
        margin-top: 0;
    }
    .daily-card {
        width: 150px;
    }
    .daily-goal {
        width: 150px;
        margin-top: 0;
        transform: translate(-50%, -50%);
    }
    .daily-goal-inner {
        min-height: 150px;
    }
    .daily-filou {
        top: -76px;
        width: 96px;
        height: 96px;
    }
    .daily-boulon {
        top: var(--by);
        left: var(--bx);
        right: auto;
        transform: translate(-50%, -50%);
    }
}

.chemin2 { margin-bottom: 22px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.7); background: var(--surface); }
.chemin2-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 6px; flex-wrap: wrap; }
.chemin2-head h2 { margin: 0; }
.chemin2-tag { font-weight: 800; font-size: .8rem; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.chemin2.is-main .chemin2-tag { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); color: #fff; }
.chemin2-progress { height: 10px; margin: 0 20px 6px; }

.chemin2-scroll { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    padding: 16px 22px 26px;
    background: linear-gradient(180deg, #CDEEFF 0%, #E6F6FF 46%, #C6EFBE 46%, #AEE4A6 100%); }
.chemin2.is-branch .chemin2-scroll { background: linear-gradient(180deg, #ECE7FF 0%, #F4F1FF 46%, #DBEFDF 46%, #CDE9D2 100%); }

.chemin2-road { position: relative; list-style: none; margin: 0; padding: 30px 4px 8px; display: flex; align-items: center; gap: 52px; width: max-content; }
.chemin2-road::before { content: ""; position: absolute; left: 0; right: 0; top: 54px; height: 0; border-top: 5px dashed rgba(255,255,255,.9); z-index: 0; }

.road2-step { position: relative; z-index: 1; flex: none; width: 118px; }
.road2-link { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.road2-node { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
    background: var(--surface); border: 3px solid #fff; box-shadow: var(--shadow-sm); position: relative; }
.road2-num { position: absolute; bottom: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.road2-label { text-align: center; background: rgba(255,255,255,.94); border-radius: 12px; padding: 6px 8px; box-shadow: var(--shadow-sm); width: 100%; }
.road2-title { display: block; font-family: var(--font-head); font-weight: 800; font-size: .84rem; line-height: 1.1; }
.road2-cta { color: var(--grape-deep); font-weight: 800; font-size: .8rem; }
.road2-note { color: var(--ink-soft); font-size: .78rem; }

.road2-validated .road2-node { background: var(--success-soft); border-color: var(--mint); }
.road2-available .road2-node { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); color: #fff; border-color: #fff;
    animation: road-pulse 1.6s ease-in-out infinite; }
.road2-locked { opacity: .62; }
.road2-locked .road2-link { cursor: default; }
.road2-locked .road2-node { background: var(--line); }

.road2-filou { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); width: 46px; height: 46px;
    object-fit: contain; filter: drop-shadow(0 4px 5px rgba(0,0,0,.2)); animation: road-hop 1.4s ease-in-out infinite; pointer-events: none; }

.road2-goal { width: auto; }
.road2-goal-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 26px 6px 14px; }
.road2-school { font-size: 54px; line-height: 1; }
.road2-filette { position: absolute; right: -10px; bottom: 30px; width: 48px; height: 74px; object-fit: contain; }
.road2-filette-emoji { position: absolute; right: 0; bottom: 38px; font-size: 30px; }
.road2-goal-text { font-family: var(--font-head); font-weight: 800; background: rgba(255,255,255,.94); padding: 4px 10px; border-radius: 10px; font-size: .82rem; white-space: nowrap; }
.road2-goal-inner.reached .road2-goal-text { background: var(--mint); color: #fff; }

.chemin2-boulon { position: absolute; top: 16px; right: 44px; width: 40px; height: 40px; object-fit: contain;
    animation: boulon-fly 7s ease-in-out infinite; pointer-events: none; z-index: 2; }
.chemin2-boulon-emoji { font-size: 26px; }
@keyframes boulon-fly {
    0%   { transform: translate(0,0) rotate(-6deg); }
    25%  { transform: translate(-140px,22px) rotate(8deg); }
    50%  { transform: translate(-280px,-8px) rotate(-4deg); }
    75%  { transform: translate(-130px,26px) rotate(10deg); }
    100% { transform: translate(0,0) rotate(-6deg); }
}

/* Version sobre (ados / adultes) : premium mais sans décor cartoon */
.chemin2.is-sober .chemin2-scroll { background: var(--surface-2); }
.chemin2.is-sober .chemin2-road::before { border-top-color: var(--line); }
.chemin2.is-sober .road2-node { border-color: var(--line); }
.chemin2.is-sober .road2-available .road2-node { background: var(--grape); animation: none; }
.chemin2.is-sober .road2-label { background: var(--surface); }
.chemin2.is-sober .road2-school { font-size: 40px; }

@media (max-width: 720px) {
    /* Sur téléphone, on abandonne le placement libre sur le décor (qui faisait
       se chevaucher les étiquettes) : le chemin devient une LISTE VERTICALE
       nette, lisible, posée sur un bandeau de décor en tête. */
    .daily-path-sky {
        min-height: 0;
        padding: 14px 12px 18px;
        background-position: center top;
        background-size: cover;
    }
    .daily-path-head { align-items: stretch; flex-direction: column; }
    .daily-path-stage {
        min-height: 0;
        overflow: visible;
        padding: 0;
        margin-top: 150px; /* laisse voir le haut du décor comme une bannière */
    }
    .daily-road {
        display: flex;
        flex-direction: column;
        position: static;
        inset: auto;
        width: 100%;
        height: auto;
        gap: 10px;
        padding: 0;
    }
    .daily-road::before { display: none; }
    .daily-step {
        position: static;
        left: auto; top: auto;
        width: 100%;
        transform: none !important;
        margin: 0 !important;
    }
    .daily-link {
        flex-direction: row !important;
        justify-content: flex-start;
        align-items: center;
        gap: 12px;
        background: rgba(255, 255, 255, .94);
        border-radius: 16px;
        padding: 10px 14px;
        box-shadow: 0 4px 12px rgba(43, 31, 58, .12);
    }
    .daily-node { width: 52px; height: 52px; flex: none; }
    .daily-subject { font-size: 24px; }
    .daily-card {
        position: static; width: auto; flex: 1; min-height: 0;
        transform: none !important; text-align: left;
        background: none; border: none; box-shadow: none; padding: 0;
    }
    .daily-card::before { display: none; } /* plus de scotch en vue liste */
    .daily-title { font-size: .92rem; }
    .daily-filou { display: none; }        /* Filou saute sur desktop ; en liste, on épure */
    .daily-boulon { display: none; }
    /* La cible (objectif) devient une carte de pied de liste. */
    .daily-goal { width: 100%; margin: 6px 0 0; transform: none !important; }
    .daily-goal-inner {
        min-height: 0; flex-direction: row; justify-content: flex-start; gap: 12px;
        background: rgba(255, 255, 255, .94); border-radius: 16px; padding: 10px 14px;
        box-shadow: 0 4px 12px rgba(43, 31, 58, .12);
    }
    .daily-target { width: 48px; height: 60px; }
    .daily-goal-text { max-width: none; background: none; box-shadow: none; text-align: left; }
    .daily-school { position: static; }
}

@media (prefers-reduced-motion: reduce) { .daily-filou, .daily-boulon, .road2-filou, .chemin2-boulon { animation: none; } }

/* --- Session de parcours : le décor du jour continue derrière l'exercice --- */
.exercise-play-wrap.has-backdrop {
    position: relative;
    isolation: isolate;
    border-radius: var(--radius-lg);
    padding: 16px;
}
.exercise-play-wrap.has-backdrop::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: var(--radius-lg);
    background-image: var(--session-backdrop);
    background-size: cover;
    background-position: center 30%;
    opacity: .34;
}
.exercise-play-wrap.has-backdrop::after {
    /* voile crème pour préserver la lisibilité de la question */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255,247,238,.55), rgba(255,247,238,.28) 42%, rgba(255,247,238,.62));
}

/* --- La bibliothèque de Filou (révision) ------------------------------- */
/* Une étagère par matière ; chaque règle est un livre qu'on ouvre en
   double page (règle + vidéo/entraînement). */
.library { display: grid; gap: 30px; }
/* min-width:0 : sans lui, l'étagère (enfant de grid) s'étire à la largeur de
   ses livres et le défilement horizontal ne se déclenche jamais. */
.shelf { --book: var(--grape); --book-deep: var(--grape-deep); min-width: 0; max-width: 100%; }
.shelf-francais { --book: var(--grape); --book-deep: var(--grape-deep); }
.shelf-maths { --book: var(--turquoise); --book-deep: var(--turquoise-deep); }
.shelf-langues { --book: var(--coral); --book-deep: var(--sun-deep); }
.shelf-monde { --book: var(--mint); --book-deep: var(--turquoise-deep); }
.shelf-histoire { --book: var(--sun-deep); --book-deep: var(--coral); }

.shelf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 0 4px; }
.shelf-head h2 { margin: 0; flex: 1; }
.shelf-emoji { font-size: 30px; }
.shelf-arrows { display: flex; gap: 6px; }
.shelf-arrows[hidden] { display: none; }
.shelf-arrow { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line);
    background: var(--surface); font-size: 1.25rem; font-weight: 900; line-height: 1; cursor: pointer;
    color: var(--ink); box-shadow: var(--shadow-sm); }
.shelf-arrow:hover { background: var(--surface-2); }
/* Livres rangés SUR LA TRANCHE, comme une vraie étagère (défilement + flèches). */
.shelf-books { display: flex; flex-wrap: nowrap; gap: 7px; align-items: flex-end;
    padding: 10px 14px 0; overflow-x: auto; scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; scroll-snap-type: x proximity; }
.shelf-books .book { scroll-snap-align: start; }
.shelf-books::-webkit-scrollbar { display: none; }
.shelf-board { height: 16px; border-radius: 8px;
    background: linear-gradient(180deg, #c48a54, #a96f3f 55%, #8a5730);
    box-shadow: 0 6px 12px rgba(138, 87, 48, .3), inset 0 2px 0 rgba(255, 255, 255, .25); }

.book { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
    width: 52px; height: 196px; border: none; border-radius: 5px 9px 9px 5px;
    padding: 10px 4px 8px; cursor: pointer; color: #fff;
    background: linear-gradient(90deg, var(--book-deep), var(--book) 30%, var(--book) 72%, var(--book-deep));
    box-shadow: 0 8px 12px rgba(43, 31, 58, .22), inset 0 1px 0 rgba(255, 255, 255, .28);
    transition: transform .18s ease, box-shadow .18s ease; }
.book::before, .book::after { /* nerfs dorés du dos */ content: ""; position: absolute; left: 7px; right: 7px;
    height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .36); }
.book::before { top: 6px; }
.book::after { bottom: 26px; }
.shelf-books .book:nth-of-type(5n+2) { height: 184px; }
.shelf-books .book:nth-of-type(5n+4) { height: 190px; transform: rotate(1.6deg); transform-origin: bottom; }
.book:hover, .book:focus-visible { transform: translateY(-14px) rotate(0deg);
    box-shadow: 0 18px 26px rgba(43, 31, 58, .3), inset 0 1px 0 rgba(255, 255, 255, .28); }
.book-cover-title { flex: 1; min-height: 0; writing-mode: vertical-rl; text-orientation: mixed;
    font-weight: 800; font-size: .84rem; line-height: 1.1; overflow: hidden; text-align: left; max-height: 100%; }
.book-cover-level { flex: none; font-size: .58rem; font-weight: 800; background: rgba(255, 255, 255, .3);
    padding: 2px 5px; border-radius: 999px; white-space: nowrap; }
.book-cover-video { flex: none; font-size: .8rem; line-height: 1; }
/* Le niveau de l'enfant est mis en avant : livre plus grand et doré. */
.book.is-mine { height: 212px; width: 58px;
    box-shadow: 0 8px 14px rgba(43, 31, 58, .26), 0 0 0 3px rgba(255, 199, 56, .75), inset 0 1px 0 rgba(255, 255, 255, .3); }
.book-mine-tag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); white-space: nowrap;
    background: linear-gradient(135deg, var(--sun), var(--sun-deep)); color: #fff; font-size: .6rem;
    font-weight: 900; padding: 2px 8px; border-radius: 999px; box-shadow: var(--shadow-sm); }

/* Livre ouvert (double page) */
.book-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(43, 31, 58, .55);
    backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; }
.book-overlay[hidden] { display: none; }
.book-close { position: absolute; top: 14px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
    border: none; background: #fff; font-size: 1.05rem; font-weight: 900; cursor: pointer;
    box-shadow: var(--shadow); z-index: 2; }
.book-stage { width: min(940px, 100%); perspective: 1600px; }
.book3d { position: relative; transform-style: preserve-3d; animation: book-pop .3s ease; }
.book-spread { position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: 430px;
    border-radius: 14px; overflow: hidden; background: #fdf7ec; border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 30px 60px rgba(43, 31, 58, .35); }
.book-spread::before { /* gouttière centrale */ content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
    width: 28px; transform: translateX(-50%); pointer-events: none; z-index: 1;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .09) 45%, rgba(0, 0, 0, .16) 50%, rgba(0, 0, 0, .09) 55%, transparent); }
.book-page { padding: 28px 30px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .65), rgba(255, 255, 255, 0) 30%),
        repeating-linear-gradient(180deg, transparent, transparent 27px, rgba(139, 124, 246, .09) 28px),
        #fdf7ec; }
.book-page-left { border-right: 1px solid rgba(0, 0, 0, .05); }
.book-page h3 { margin: 0; font-size: 1.35rem; }
.book-page-kicker { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--book, var(--grape)); }
.book-rule { line-height: 1.7; font-size: 1.02rem; }
.book-video { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9;
    background: #000; box-shadow: var(--shadow); }
.book-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.book-video-hint { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.book-page-doodle { font-size: 84px; opacity: .16; margin: auto; }
.book-train { margin-top: auto; display: flex; justify-content: flex-end; }

/* Couverture qui se tourne (1re ouverture d'un livre dans la visite) */
.book-cover3d { position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; z-index: 2;
    transform-origin: left center; border-radius: 0 14px 14px 6px; display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px;
    color: #fff; text-align: center; backface-visibility: hidden;
    background: linear-gradient(160deg, var(--book, var(--grape)), var(--book-deep, var(--grape-deep)));
    box-shadow: -10px 0 24px rgba(0, 0, 0, .25); }
.book-cover3d .book-cover-title { font-size: 1.2rem; -webkit-line-clamp: 5; }
.book-cover3d img { width: 92px; height: 92px; object-fit: contain; }
/* Séquence « le livre sort de l'étagère puis s'ouvre » :
   1. le livre fermé monte depuis le bas (comme tiré de l'étagère),
   2. la couverture se tourne et révèle la double page. */
.book3d.is-opening { animation: book-pull .6s cubic-bezier(.2, .7, .3, 1); }
.book3d.is-opening .book-cover3d { display: flex;
    animation: book-open3d 1s cubic-bezier(.6, .05, .3, 1) .65s forwards; }
@keyframes book-pull {
    0% { transform: translateY(56vh) rotate(5deg) scale(.3); opacity: 0; }
    60% { opacity: 1; }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}
@keyframes book-open3d {
    0% { transform: rotateY(0); opacity: 1; }
    75% { opacity: 1; }
    100% { transform: rotateY(-165deg); opacity: 0; }
}
@keyframes book-pop { from { transform: scale(.86) translateY(16px); opacity: .3; } }

@media (max-width: 760px) {
    .book { width: 44px; height: 164px; }
    .book.is-mine { width: 50px; height: 178px; }
    .book-cover-title { font-size: .78rem; }
    .book-spread { grid-template-columns: 1fr; min-height: 0; }
    .book-spread::before { display: none; }
    .book-page-left { border-right: none; border-bottom: 1px dashed rgba(0, 0, 0, .10); }
    .book-cover3d { display: none !important; }
    .book-overlay { padding: 10px; align-items: flex-start; overflow-y: auto; }
    .book-stage { margin: 54px 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .book3d, .book3d.is-opening .book-cover3d { animation: none; }
    .book3d.is-opening .book-cover3d { display: none; }
    .book, .book:hover { transition: none; }
}
/* Programme content generator (super-admin). */
.curriculum-head {
  align-items: flex-end;
  margin-bottom: 24px;
}

.curriculum-head h1,
.curriculum-coverage h2,
.curriculum-generator h2 {
  margin: 4px 0 6px;
}

.curriculum-generator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 32px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--grape);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(46, 42, 74, .08);
}

.curriculum-generator p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.curriculum-step {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--grape);
  color: #fff;
  font-weight: 800;
}

.curriculum-form {
  display: grid;
  gap: 10px;
}

.curriculum-form label {
  color: var(--ink);
  font-weight: 800;
}

.curriculum-form .curriculum-auto-publish {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.curriculum-auto-publish input { margin-top: 4px; accent-color: var(--grape); }
.curriculum-auto-publish span { display: grid; gap: 1px; }
.curriculum-auto-publish small { color: var(--muted); font-weight: 500; }

.curriculum-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.curriculum-form select:focus {
  border-color: var(--grape);
  outline: 3px solid rgba(139, 124, 246, .18);
}

.curriculum-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin: 28px 0 36px;
  padding: 0 18px;
}

.curriculum-flow span {
  display: grid;
  gap: 2px;
  text-align: center;
}

.curriculum-flow small,
.curriculum-table small {
  display: block;
  color: var(--muted);
}

.curriculum-flow .flow-arrow {
  color: var(--grape);
  font-size: 1.25rem;
  font-weight: 800;
}

.curriculum-coverage {
  margin-top: 4px;
}

.curriculum-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.curriculum-table {
  min-width: 880px;
}

.curriculum-table th {
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
}

.curriculum-table td {
  padding: 14px;
  vertical-align: middle;
}

.curriculum-count {
  display: inline-grid;
  min-width: 38px;
  height: 30px;
  padding: 0 8px;
  place-items: center;
  border-radius: 999px;
  font-weight: 800;
}

.curriculum-count.pending {
  background: #fff0cf;
  color: #8a5200;
}

.curriculum-count.published {
  background: #dff7e9;
  color: #12643a;
}

.curriculum-source {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  white-space: nowrap;
  color: var(--grape-deep);
  font-weight: 800;
}

.curriculum-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 850;
}

.curriculum-status.ready { background: #dff7e9; color: #12643a; }
.curriculum-status.waiting { background: #fff0cf; color: #8a5200; }
.curriculum-status.empty { background: var(--surface-2); color: var(--muted); }

.exercise-mission {
  max-width: 760px;
  margin: 0 auto 18px;
  padding: 10px 14px;
  border-left: 4px solid var(--turquoise);
  background: rgba(255,255,255,.78);
  color: var(--ink-soft);
  font-weight: 700;
}

.curriculum-sources summary {
  max-width: 430px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 750;
}

.curriculum-sources[open] summary {
  margin-bottom: 10px;
}

.curriculum-sources a {
  display: block;
  max-width: 480px;
  margin: 8px 0;
  color: var(--grape-deep);
  font-weight: 700;
  text-decoration: none;
}

.curriculum-sources a:hover,
.curriculum-sources a:focus-visible {
  text-decoration: underline;
}

.curriculum-note {
  max-width: 920px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.feedback.source-note {
  border-color: rgba(90, 169, 255, .42);
  background: #edf6ff;
  color: #25577f;
}

@media (max-width: 760px) {
  .curriculum-head,
  .curriculum-generator {
    align-items: stretch;
  }

  .curriculum-generator {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .curriculum-flow {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .curriculum-flow .flow-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }
}

/* --- Salle de jeux détente : Où est Filou ? + Les 7 différences --------- */
.seek-hud { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seek-goal img { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; }
.seek-scene { position: relative; height: min(62vh, 540px); border-radius: var(--radius-lg); overflow: hidden;
    background: linear-gradient(180deg, #bfe8ff 0 58%, #ffe9b8 58%); box-shadow: var(--shadow); }
.seek-item { position: absolute; transform-origin: center; cursor: pointer; user-select: none; line-height: 1; }
.seek-target { position: absolute; border: none; background: transparent; padding: 0; cursor: pointer; }
.seek-target img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2)); }
.seek-target.seek-found { animation: seek-pop .6s ease; }
.seek-target.seek-found::after { content: ""; position: absolute; inset: -10px; border: 4px solid var(--mint); border-radius: 50%; }
@keyframes seek-pop { 50% { transform: scale(1.35); } }
.seek-shake { animation: seek-no .35s ease; }
@keyframes seek-no { 25% { margin-left: -6px; } 75% { margin-left: 6px; } }

.diff-hud { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.diff-scenes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.diff-scene { border-radius: var(--radius-lg); padding: 10px; box-shadow: var(--shadow);
    background: linear-gradient(180deg, #bfe8ff 0 58%, #ffe9b8 58%); }
.diff-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.diff-cell { display: grid; place-items: center; aspect-ratio: 1; font-size: clamp(18px, 3vw, 32px);
    background: rgba(255, 255, 255, .5); border: none; border-radius: 10px; line-height: 1; }
button.diff-cell { cursor: pointer; }
button.diff-cell:hover, button.diff-cell:focus-visible { background: rgba(255, 255, 255, .85); }
.diff-found { outline: 4px solid var(--mint); outline-offset: -3px; background: #dcfff1 !important; }
.diff-shake { animation: seek-no .35s ease; }
@media (max-width: 760px) { .diff-scenes { grid-template-columns: 1fr; } }

/* --- L'album des 60 jours + calendrier de régularité ------------------- */
.album-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.album-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-height: 150px; padding: 12px 10px; border-radius: 14px; text-align: center;
    background: linear-gradient(160deg, #fffcf4, #f7eedb); border: 2px solid rgba(139, 106, 58, .25);
    box-shadow: var(--shadow-sm); }
.album-card.is-owned { border-color: var(--sun-deep);
    background: linear-gradient(160deg, #fff8e6, #ffefc8);
    box-shadow: 0 6px 14px rgba(255, 154, 44, .22); transition: transform .15s ease; }
.album-card.is-owned:hover { transform: translateY(-4px) rotate(-1deg); }
.album-card.is-missing { opacity: .62; border-style: dashed; }
.album-day { font-size: .68rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.album-emoji { font-size: 44px; line-height: 1.2; }
.album-name { font-family: var(--font-head); font-weight: 900; font-size: .92rem; line-height: 1.15; }
.album-desc { font-size: .76rem; color: var(--ink-soft); line-height: 1.3; }

.card-won { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 16px;
    border-radius: 14px; text-decoration: none; color: var(--ink); text-align: left;
    background: linear-gradient(135deg, #fff8e6, #ffe9b8); border: 2px solid var(--sun-deep);
    box-shadow: 0 6px 14px rgba(255, 154, 44, .25); }
.card-won-flip { flex: none; width: 58px; height: 74px; border-radius: 8px; display: grid; place-items: center;
    background: linear-gradient(160deg, var(--sun), var(--sun-deep)); box-shadow: var(--shadow-sm);
    animation: card-won-flip .8s cubic-bezier(.2, .7, .3, 1); }
.card-won-emoji { font-size: 30px; }
.card-won-text { font-size: .92rem; line-height: 1.35; }
@keyframes card-won-flip { 0% { transform: rotateY(90deg) scale(.6); } 60% { transform: rotateY(-20deg) scale(1.08); } }

.streak-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.streak-day { display: grid; place-items: center; aspect-ratio: 1; border-radius: 9px; font-size: .78rem;
    font-weight: 800; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); }
.streak-day.is-played { background: linear-gradient(135deg, #fff3d6, #ffe4a8); border-color: var(--sun); font-size: 1rem; }
.streak-day.is-today { outline: 2px solid var(--grape); outline-offset: 1px; }

.book-listen { align-self: flex-start; margin-top: 4px; border: 2px solid var(--line); border-radius: 999px;
    background: #fff; padding: 8px 14px; font-weight: 800; font-size: .85rem; cursor: pointer; color: var(--ink); }
.book-listen:hover { background: var(--surface-2); }
.book-listen.is-speaking { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); color: #fff;
    border-color: var(--sun-deep); animation: listen-bounce .6s ease-in-out infinite alternate; }
@keyframes listen-bounce { from { transform: scale(1); } to { transform: scale(1.05); } }

/* --- Coloriage magique --- */
.coloring-palette { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-bottom:14px; }
.color-swatch { width:40px; height:40px; border-radius:50%; border:3px solid #fff; cursor:pointer;
    box-shadow:0 2px 6px rgba(0,0,0,.2); }
.color-swatch.is-active { outline:3px solid var(--grape); outline-offset:2px; transform:scale(1.12); }
.color-swatch.color-clear { background:var(--surface-2); display:grid; place-items:center; font-size:18px; }
.coloring-board { max-width:520px; margin:0 auto; background:#fff; border-radius:var(--radius-lg);
    box-shadow:var(--shadow); padding:12px; }
.coloring-board svg { width:100%; height:auto; display:block; }

/* --- Puzzle des décors (taquin) --- */
.puzzle-hud { text-align:center; margin-bottom:10px; }
.puzzle-grid { width:min(90vw,330px); aspect-ratio:1; margin:0 auto; display:grid;
    grid-template-columns:repeat(3,1fr); gap:4px; background:var(--ink); padding:4px; border-radius:14px; }
.puzzle-cell { border:none; border-radius:6px; padding:0; background-color:var(--surface-2); cursor:pointer; }
.puzzle-hole { background:transparent !important; cursor:default; }

/* Page de droite du livre sans vidéo : Filou + astuce (plus de page vide). */
.book-note { display:flex; flex-direction:column; align-items:center; gap:12px; margin:auto 0; text-align:center; }
.book-note-filou { width:110px; height:110px; object-fit:contain;
    filter:drop-shadow(0 6px 6px rgba(41,29,16,.18)); }
.book-note-tip { margin:0; max-width:280px; font-size:.96rem; line-height:1.5; color:var(--ink-soft);
    background:rgba(139,124,246,.08); border:1px dashed rgba(139,124,246,.35); border-radius:14px; padding:12px 16px; }

/* --- Répétition espacée : bloc « Tes petites révisions » ----------------- */
.review-flash { position: relative; margin-bottom: 22px; padding: 20px 22px 22px;
    border-radius: 22px; overflow: hidden;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .75), transparent 55%),
        linear-gradient(135deg, #fff6e6 0%, #ffe9d2 55%, #ffe2e8 100%);
    border: 1px solid rgba(255, 154, 44, .38);
    box-shadow: 0 14px 30px rgba(214, 122, 30, .16), inset 0 1px 0 rgba(255, 255, 255, .9); }
.review-flash::after { /* liseré doré discret en haut */
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--sun), var(--coral), var(--grape)); }
.review-flash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.review-flash-titles { flex: 1; min-width: 0; }
.review-flash-head h2 { margin: 0; font-size: 1.28rem; letter-spacing: -.01em; }
.review-flash-kicker { display: block; font-size: .7rem; font-weight: 900; letter-spacing: .09em;
    text-transform: uppercase; color: var(--sun-deep); }
.review-flash-badge { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid;
    place-items: center; font-size: 26px; background: linear-gradient(140deg, var(--sun), var(--sun-deep));
    box-shadow: 0 8px 16px rgba(255, 154, 44, .38), inset 0 1px 0 rgba(255, 255, 255, .5);
    animation: review-badge 3.2s ease-in-out infinite; }
@keyframes review-badge { 50% { transform: rotate(-8deg) scale(1.06); } }
.review-flash-count { flex: none; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px;
    display: grid; place-items: center; font-weight: 900; color: #fff;
    background: var(--grape); box-shadow: var(--shadow-sm); }
.review-flash-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.review-flash-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
    background: #fff; text-decoration: none; color: var(--ink); border: 1px solid rgba(139, 106, 58, .18);
    box-shadow: var(--shadow-sm); transition: transform .15s ease; border-left: 5px solid var(--sun-deep); }
.review-flash-item:hover { transform: translateY(-2px); }
.review-flash-item.daily-francais { border-left-color: #8b7cf6; }
.review-flash-item.daily-maths { border-left-color: #22b8a7; }
.review-flash-item.daily-langues { border-left-color: #3b82f6; }
.review-flash-item.daily-monde { border-left-color: #22a95f; }
.review-flash-item.daily-histoire { border-left-color: #f59e0b; }
.review-flash-ic { font-size: 22px; flex: none; }
.review-flash-label { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.review-flash-matter { font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.review-flash-cta { font-size: .82rem; font-weight: 900; color: var(--grape-deep); white-space: nowrap; }

/* Boucle de l'erreur : bandeau « on revoit celle-ci » */
.retry-banner { text-align: center; font-weight: 800; color: var(--sun-deep); font-size: .95rem;
    background: rgba(255, 154, 44, .12); border: 1px dashed var(--sun); border-radius: 12px;
    padding: 8px 12px; margin-bottom: 14px; }

/* Le compteur de bonnes réponses réagit immédiatement (retour visible). */
.counter-pop { animation: counter-pop .45s ease; }
@keyframes counter-pop {
    35% { transform: scale(1.28); background: var(--mint); color: #fff; }
}

/* Fiches de RÉVISION du jour : la règle + son exemple, puis l'entraînement. */
.review-card { position: relative; display: flex; flex-direction: column; gap: 11px;
    padding: 16px 18px; background: #fff; border-radius: 18px;
    border: 1px solid rgba(43, 31, 58, .08); border-left: 5px solid var(--sun-deep);
    box-shadow: 0 6px 18px rgba(43, 31, 58, .09);
    transition: transform .16s ease, box-shadow .16s ease; }
.review-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(43, 31, 58, .15); }
.review-card-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid;
    place-items: center; font-size: 21px; background: var(--surface-2); }
.review-card-chip { flex: none; align-self: flex-start; font-size: .64rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: .05em; color: var(--sun-deep);
    background: rgba(255, 154, 44, .14); border: 1px solid rgba(255, 154, 44, .34);
    padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.review-card.daily-francais { border-left-color: #8b7cf6; }
.review-card.daily-maths { border-left-color: #22b8a7; }
.review-card.daily-langues { border-left-color: #3b82f6; }
.review-card.daily-monde { border-left-color: #22a95f; }
.review-card.daily-histoire { border-left-color: #f59e0b; }
.review-card-head { display: flex; align-items: center; gap: 10px; }
.review-card-rule { position: relative; background: linear-gradient(180deg, #fbfaff, #f5f2ff);
    border: 1px solid rgba(139, 124, 246, .22); border-radius: 14px;
    padding: 13px 15px 13px 40px; line-height: 1.62; font-size: .97rem; }
.review-card-rule::before { content: "💡"; position: absolute; left: 13px; top: 12px; font-size: 17px; }
.review-card-rule-empty { color: var(--ink-soft); font-style: italic; }
.review-card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.review-card-actions .btn { padding: 9px 16px; font-size: .9rem; }
.review-flash-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* --- Page publique : présentation (visiteurs + référencement) ------------ */
.auth-pitch { max-width: 640px; margin: 26px auto 8px; padding: 26px 28px 30px;
    background: rgba(255, 255, 255, .92); border-radius: 22px;
    border: 1px solid rgba(43, 31, 58, .07);
    box-shadow: 0 16px 40px rgba(43, 31, 58, .12); }
.auth-pitch h1 { font-size: 1.42rem; line-height: 1.25; margin: 0 0 12px; }
.auth-pitch p { color: var(--ink-soft); line-height: 1.68; margin: 0 0 16px; }
.auth-pitch-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 14px; }
.auth-pitch-list li { display: flex; gap: 13px; align-items: flex-start; line-height: 1.5; font-size: .95rem; }
.auth-pitch-list li > span { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid;
    place-items: center; font-size: 20px; background: linear-gradient(140deg, #fff2dc, #ffe6cf);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9); }
.auth-pitch-list strong { color: var(--ink); }
.auth-pitch-foot { font-size: .9rem; padding-top: 14px; border-top: 1px dashed var(--line); margin: 0; }
@media (max-width: 760px) { .auth-pitch { padding: 20px; border-radius: 18px; } .auth-pitch h1 { font-size: 1.24rem; } }

/* --- Passe « premium » : matières douces, profondeur, transitions -------- */
.btn { transition: transform .14s ease, box-shadow .18s ease, filter .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.sun, .btn.big.sun { box-shadow: 0 8px 20px rgba(255, 154, 44, .32); }
.btn.sun:hover { box-shadow: 0 12px 26px rgba(255, 154, 44, .42); }
.card { transition: box-shadow .2s ease; }
.hub-tile { transition: transform .16s ease, box-shadow .2s ease; }
.hub-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(43, 31, 58, .2); }
.pill-tag { backdrop-filter: saturate(140%); }
/* Rendu de texte plus net sur les grands titres */
h1, h2, .brand { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
@media (prefers-reduced-motion: reduce) {
    .btn, .hub-tile, .card, .review-card { transition: none; }
    .btn:hover, .hub-tile:hover, .review-card:hover { transform: none; }
}
