/* ============================================================
   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;
}

/* ---------- 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 .4s 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;
}

.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; }

/* ---------- 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; }
    .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: .7rem; font-weight: 700;
        flex: 1;
    }
    .tabbar a .ic { font-size: 22px; }
    .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: 88px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 980;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: min(440px, calc(100vw - 28px));
    animation: mascot-reaction-in .24s ease-out both;
    pointer-events: none;
}
.mascot-reaction .filou-tip-bubble { margin: 0; }
.mascot-reaction .mascot {
    width: 74px;
    height: 74px;
    animation: bounce .55s ease;
}
.mascot-reaction-text {
    color: var(--ink);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: .98rem;
    line-height: 1.08;
    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: translateY(-10px) scale(.94); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes mascot-reaction-out {
    100% { transform: 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 {
    display: inline-grid;
    place-items: center;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    filter: drop-shadow(0 8px 14px rgba(46,42,74,.18));
}
.mascot-png img {
    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: 4px; }
.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 --- */
.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); }

/* --- 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; }

/* ============================================================
   Parcours "chemin de l'école" (zig-zag vers Filette)
   ============================================================ */
.chemin-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    padding: 22px 20px 8px; border: 1px solid rgba(255,255,255,.7); margin-bottom: 22px; }
.chemin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chemin-head h2 { margin: 0; }
.chemin-progress { height: 12px; margin: 12px 0 8px; }

.chemin-road { position: relative; list-style: none; margin: 0; padding: 8px 0 4px; }
.chemin-road::before { content: ""; position: absolute; left: 50%; top: 12px; bottom: 60px; width: 0;
    border-left: 5px dashed var(--line); transform: translateX(-50%); z-index: 0; }

.road-step { position: relative; display: flex; align-items: center; min-height: 82px; z-index: 1; }
.road-left { justify-content: flex-start; }
.road-right { justify-content: flex-end; }
.road-link { display: flex; align-items: center; gap: 14px; width: min(100%, calc(50% + 40px));
    text-decoration: none; color: var(--ink); }
.road-left .road-link { flex-direction: row-reverse; text-align: right; }

.road-node { position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%;
    display: grid; place-items: center; font-size: 26px; background: var(--surface-2);
    border: 3px solid var(--line); box-shadow: var(--shadow-sm); }
.road-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; }
.road-card { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2);
    border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-sm); max-width: 260px; }
.road-title { font-family: var(--font-head); font-weight: 800; }
.road-note { font-size: .82rem; color: var(--ink-soft); }
.road-cta { margin-top: 4px; align-self: flex-start; font-weight: 800; font-size: .85rem;
    color: var(--grape-deep); }
.road-left .road-cta { align-self: flex-end; }

/* States */
.road-validated .road-node { background: var(--success-soft); border-color: var(--mint); }
.road-available .road-node { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); border-color: #fff;
    color: #fff; animation: road-pulse 1.6s ease-in-out infinite; }
.road-available .road-card { box-shadow: var(--shadow); border: 2px solid rgba(255,176,59,.5); }
.road-locked { opacity: .62; }
.road-locked .road-link { cursor: default; }
.road-locked .road-node { background: var(--line); }

@keyframes road-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,138,52,.45); }
    50% { box-shadow: 0 0 0 10px rgba(255,138,52,0); }
}

.road-filou { position: absolute; top: -14px; width: 52px; height: 52px; pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); animation: road-hop 1.4s ease-in-out infinite; }
.road-left .road-filou { left: calc(50% + 24px); }
.road-right .road-filou { right: calc(50% + 24px); }
.road-filou img { width: 100%; height: 100%; object-fit: contain; }
@keyframes road-hop { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }

/* Goal : school + Filette */
.road-goal { justify-content: center; margin-top: 8px; }
.road-goal-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: linear-gradient(140deg, var(--grape), var(--sky)); color: #fff; border-radius: var(--radius-lg);
    padding: 16px 26px; box-shadow: var(--shadow); text-align: center; }
.road-goal-school { font-size: 46px; line-height: 1; }
.road-goal-filette { position: absolute; top: 10px; right: 14px; font-size: 28px; }
.road-goal-text { font-family: var(--font-head); font-weight: 800; }
.road-goal-inner.reached { background: linear-gradient(140deg, var(--mint), var(--turquoise)); animation: bounce .6s ease 2; }

@media (max-width: 560px) {
    .chemin-road::before { left: 34px; }
    .road-step, .road-left, .road-right { justify-content: flex-start; }
    .road-link, .road-left .road-link { width: 100%; flex-direction: row; text-align: left; }
    .road-left .road-cta { align-self: flex-start; }
    .road-left .road-filou, .road-right .road-filou { left: 40px; right: auto; }
    .road-card { max-width: none; }
    .road-goal { justify-content: flex-start; }
}

/* ============================================================
   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: rgba(30, 20, 55, .55); 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(460px, 100%); background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 26px 22px 22px; 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-panel { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bd-mascot { width: 132px; height: 132px; display: inline-block; animation: bounce .5s ease; }
.bd-mascot img { width: 100%; height: 100%; object-fit: contain; }
.bd-bubble { position: relative; margin: 0; background: var(--surface-2); border: 2px solid rgba(139,124,246,.22);
    border-radius: 18px; padding: 14px 18px; font-family: var(--font-head); font-weight: 800; color: var(--ink);
    line-height: 1.2; }
.bd-bubble::before { content: ""; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    border: 7px solid transparent; border-bottom-color: var(--surface-2); }
.bd-dots { display: flex; gap: 7px; justify-content: center; margin: 16px 0 4px; }
.bd-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.bd-dots span.on { background: var(--grape); transform: scale(1.15); }
.bd-controls { margin-top: 12px; }
.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; } }
