/* Polices servies par l'application (aucun appel à un service externe), licence SIL OFL : voir assets/fonts/.
   Andika (interface) et Scheherazade New (arabe) sont deux polices de SIL conçues pour apprendre à lire. */
@font-face { font-family: "Andika"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/andika-latin-400-normal-KhRN-8Q.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Andika"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/andika-latin-700-normal-Rl6J65j.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Latin étendu : les translittérations (ā, ḥ, ṭ, ʿ, ʾ…) */
@font-face { font-family: "Andika"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/andika-latin-ext-400-normal-gwjcaXt.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Andika"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/andika-latin-ext-700-normal-kS_1Km8.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Scheherazade New"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/scheherazade-new-arabic-400-normal--0aYIv8.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

:root {
    /* Nuit et mandarine : la nuit structure, la mandarine donne l'énergie, le turquoise récompense.
       Les pages de lecture restent claires et calmes. */
    --bg: #f6f8fb;          /* blanc froid */
    --surface: #ffffff;
    --ink: #16233f;         /* nuit, pour le texte */
    --text-soft: #3a4763;
    --muted: #5b6680;
    --brand: #16233f;       /* nuit */
    --brand-deep: #0e1830;
    --brand-ink: #ffffff;
    --brand-soft: #e7ecf6;
    --accent: #ff9f1c;      /* mandarine */
    --accent-ink: #3d2300;
    --accent-dark: #a85a00;
    --accent-soft: #fff0d9;
    --turquoise: #2ec4b6;
    --good: #129e8f;        /* turquoise foncé, lisible */
    --good-soft: #d9f5f1;
    --warn: #d64545;
    --warn-soft: #fbe3e3;
    --line: #dde3ee;
    --line-strong: #c5cedd;
    --radius: 14px;
    --radius-lg: 22px;
    /* Le latin glissé dans un texte arabe retombe sur Andika. */
    --ar-font: "Scheherazade New", "Andika", "Noto Naskh Arabic", "Geeza Pro", serif;
    /* Pas de « Arial Rounded MT Bold » en secours : elle n'existe qu'en gras (tout s'affichait en gras dans Chrome). */
    --ui-font: "Andika", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* Taille de l'arabe par rapport au texte français : à corps égal, l'arabe paraît plus petit. */
    --ar-scale: 1.4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 17px/1.55 var(--ui-font);
}

a { color: var(--brand); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: .4em 0 .6em; line-height: 1.2; }
h2 { font-size: 1.3rem; margin: .2em 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; justify-content: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); margin: 0; }

.ar { font-family: var(--ar-font); line-height: 1.7; }
.big { font-size: 2.2rem; }
.giant { font-size: clamp(4rem, 14vw, 7rem); line-height: 1.75; display: block; }
.giant-emoji { font-size: 4rem; margin: 0; }

/* Barre du haut */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem;
    padding: .7rem 1.2rem; color: var(--brand-ink);
    background: var(--brand);
}
.topbar a { color: inherit; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.brand-mark { background: var(--accent); color: var(--brand); width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center; font-size: 1.7rem; line-height: 1; padding-bottom: .4rem; overflow: hidden; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-left: auto; }
.nav a { padding: .35rem .8rem; border-radius: 999px; display: flex; align-items: center; gap: .35rem; }
.nav-icon { font-size: 1rem; line-height: 1; }
.nav-icon.ar { font-size: 1.2rem; font-weight: 700; }
.nav a:hover { background: rgba(255, 255, 255, .15); }
.nav a[aria-current] { background: var(--bg); color: var(--brand); font-weight: 600; }
.who { font-size: .9rem; opacity: .9; }

.page { max-width: 880px; margin: 0 auto; padding: 1.2rem 16px 4rem; }
.flash { background: var(--warn-soft); border: 1px solid var(--warn); padding: .6rem 1rem; border-radius: 10px; }

/* Éléments communs */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1rem 0; }
.hero { background: var(--surface); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.lessons { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; }

.btn {
    display: inline-block; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
    padding: .65rem 1.4rem; text-decoration: none; min-height: 44px;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-quiet { background: var(--brand-soft); color: var(--brand); }
.btn-good { background: var(--good); }
.btn-warn { background: var(--warn); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; text-align: center; display: flex; flex-direction: column; }
.stats strong { font-size: 1.8rem; color: var(--brand); }
.stats span { font-size: .85rem; color: var(--muted); }

/* Profils */
.profiles { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 130px; padding: 1rem; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 600; }
.profile-card:hover { border-color: var(--brand); }
.avatar { font-size: 3rem; line-height: 1; }
.form { display: grid; gap: 1rem; max-width: 420px; }
.form label { display: grid; gap: .3rem; font-weight: 600; }
input[type=text], input:not([type]) { font: inherit; padding: .65rem .9rem; border: 2px solid var(--line); border-radius: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: .4rem; }
.avatars { display: flex; flex-wrap: wrap; gap: .4rem; }
.avatar-choice { display: block !important; }
.avatar-choice input { position: absolute; opacity: 0; }
.avatar-choice span { display: grid; place-items: center; width: 52px; height: 52px; font-size: 1.8rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.avatar-choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.avatar-choice input:focus-visible + span { outline: 3px solid var(--accent); }
.manage summary { cursor: pointer; color: var(--muted); }
.manage form { display: inline-block; margin: .4rem .4rem 0 0; }

/* Alphabet */
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .7rem; margin-top: 1rem; }
.letter-tile { display: flex; flex-direction: column; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: .5rem; text-decoration: none; color: var(--ink); }
.letter-tile:hover { border-color: var(--brand); }
.glyph { font-size: 3rem; line-height: 1.9; margin-top: -.5rem; }
.letter-page { text-align: center; }
.forms { display: flex; justify-content: center; gap: .8rem; flex-wrap: wrap; }
.forms div { display: flex; flex-direction: column; align-items: center; min-width: 80px; padding: .3rem .6rem; background: var(--bg); border-radius: 12px; }

/* Leçons */
.lesson-card { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.lesson-card:hover { border-color: var(--brand); }
.lesson-card.is-done { border-color: var(--good); }
.lesson-card .emoji { font-size: 2rem; }
.badge { align-self: flex-start; background: var(--good); color: #fff; border-radius: 999px; padding: .05rem .6rem; font-size: .8rem; }
.badge-todo { background: var(--accent); color: var(--accent-ink); }

/* Cartes et quiz */
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .3rem 0 1.2rem; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
    width: 100%; min-height: 300px; padding: 1.5rem; font: inherit; color: var(--ink); cursor: pointer;
    background: var(--surface); border: 2px solid var(--line); border-radius: 24px; box-shadow: 0 6px 0 var(--line);
}
.card:hover { border-color: var(--brand); }
.card-back { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; }
.card-back strong { font-size: 1.6rem; color: var(--brand); }
.card-back[hidden], [hidden] { display: none !important; }

.prompt { font-size: 1.8rem; font-weight: 600; margin: .3rem 0; min-height: 1.5em; }
.prompt.giant { font-weight: 400; font-size: clamp(3.5rem, 12vw, 6rem); line-height: 1.75; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 1rem 0; }
.option { font: inherit; font-size: 1.15rem; padding: .9rem 1rem; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; cursor: pointer; color: var(--ink); min-height: 56px; }
.option.ar { font-size: 2rem; }
.option:hover:not(:disabled) { border-color: var(--brand); }
.option:disabled { cursor: default; }
.option.is-right { background: var(--good-soft); border-color: var(--good); }
.option.is-wrong { background: var(--warn-soft); border-color: var(--warn); }
.feedback { min-height: 1.6em; font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); max-width: min(92vw, 440px); background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: 12px; transition: transform .25s; z-index: 10; }
#toast.show { transform: translate(-50%, 0); }

/* Mobile : la navigation passe en barre d'onglets en bas de l'écran */
@media (max-width: 640px) {
    .options { grid-template-columns: 1fr; }
    .topbar { flex-wrap: nowrap; justify-content: space-between; }
    .nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; gap: 0;
        display: grid; grid-template-columns: repeat(5, 1fr);
        background: var(--brand); padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
        box-shadow: 0 -2px 10px rgba(0, 0, 0, .12);
    }
    .nav a { flex-direction: column; gap: .1rem; padding: .3rem .1rem; border-radius: 12px; font-size: .72rem; }
    .nav-icon { font-size: 1.3rem; }
    .nav-icon.ar { font-size: 1.45rem; line-height: 1; }
    .has-nav .page { padding-bottom: 6rem; }
    #toast { bottom: 5.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Images (emoji) */
.emoji-big { font-size: 3.4rem; line-height: 1.1; margin: 0; display: block; }
.card-back .emoji-big { font-size: 3rem; }
.fact { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: .8rem 1.1rem; margin-top: 1.2rem; }
.fact p { margin: .3rem 0 0; }

/* Memory : cartes qui se retournent */
.memory-settings { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .6rem; }
.pill-group { display: flex; flex-wrap: wrap; gap: .3rem; }
.pill { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9rem; }
.pill[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.memory-status { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .6rem 0 1rem; }
.memory-grid.memory-10 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 640px) { .memory-grid, .memory-grid.memory-10 { grid-template-columns: repeat(3, 1fr); } }
.tile { position: relative; aspect-ratio: 4 / 5; padding: 0; border: 0; background: none; font: inherit; cursor: pointer; perspective: 800px; }
.tile-inner { position: absolute; inset: 0; transition: transform .45s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d; }
.tile.is-open .tile-inner, .tile.is-found .tile-inner { transform: rotateY(180deg); }
.tile-back, .tile-front { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: .3rem; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.tile-back { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1 L15.22 4.22 L19.78 4.22 L19.78 8.78 L23 12 L19.78 15.22 L19.78 19.78 L15.22 19.78 L12 23 L8.78 19.78 L4.22 19.78 L4.22 15.22 L1 12 L4.22 8.78 L4.22 4.22 L8.78 4.22 Z' fill='none' stroke='%23e0a11b' stroke-width='1.2'/%3E%3C/svg%3E") center / 46% no-repeat; border: 2px solid var(--brand-deep); }
.tile:hover:not(.is-open):not(.is-found) .tile-back { filter: brightness(1.12); }
.tile-front { transform: rotateY(180deg); background: var(--surface); border: 2px solid var(--line); color: var(--ink); }
.tile.is-found .tile-front { background: var(--good-soft); border-color: var(--good); }
.tile.is-found { cursor: default; }
.tile-face { font-size: 2.6rem; line-height: 1.3; text-align: center; }
.tile-face.ar { line-height: 1.75; }
.tile-word .tile-face, .tile-face.ar { font-size: clamp(1.4rem, 4.5vw, 2rem); }
.tile-glyph .tile-face { font-size: clamp(2.6rem, 9vw, 3.6rem); }
.tile-text .tile-face { font-size: clamp(.95rem, 3vw, 1.15rem); font-weight: 600; }
.tile-caption { visibility: hidden; font-size: .8rem; color: var(--muted); text-align: center; line-height: 1.2; }
.tile-caption.ar { font-size: 1.1rem; }
.tile.is-found .tile-caption { visibility: visible; }
.memory-recap { list-style: none; padding: 0; margin: .8rem auto; max-width: 520px; display: grid; gap: .3rem; text-align: left; }
.memory-recap li { display: flex; align-items: center; gap: .8rem; padding: .2rem .6rem; background: var(--bg); border-radius: 10px; }
.memory-recap button { font-family: var(--ar-font); font-size: 1.5rem; background: none; border: 0; cursor: pointer; color: var(--ink); min-width: 4.5rem; }
.tile.is-open::after, .tile.is-found::after { content: none; }
.tile.is-open .tile-face, .tile.is-found .tile-face, .tile.is-open small, .tile.is-found small { visibility: visible; }
.tile.is-found { border-color: var(--good); background: var(--good-soft); }

/* Parcours : voir « Le parcours » plus bas */
.level-badge { flex: none; display: inline-grid; place-items: center; min-width: 3.2rem; height: 2.4rem; padding: 0 .6rem; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; }
.lesson-visual { font-size: 2rem; line-height: 1.7; min-height: 2.6rem; }
.lesson-visual.ar { font-size: 1.9rem; color: var(--brand); }
.lesson-card.is-next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.badge-next { background: var(--accent); color: var(--accent-ink); }

/* Page d'une leçon */
.crumbs { margin: 0; }
.lesson-num { display: block; font-size: .9rem; font-weight: 600; letter-spacing: .02em; }
.lesson-letters { margin: -.4rem 0 .4rem; color: var(--brand); }
.fact { text-align: left; }

/* ===== Leçon vivante =====
   En haut, la nuit : la leçon, ses lettres qui arrivent une à une, et les étapes reliées par un fil qui se remplit.
   Chaque étape arrive en glissant ; les blocs de la fiche montent l'un après l'autre (ordinateur seulement). */
.lesson-hero {
    position: relative; isolation: isolate; overflow: hidden; color: #fff;
    margin: .2rem 0 1.6rem; padding: 1rem 1.6rem 1.3rem; border-radius: var(--radius-lg);
    background:
        radial-gradient(380px 240px at 0% 100%, rgba(255, 159, 28, .38), transparent 70%),
        radial-gradient(360px 260px at 100% 0%, rgba(46, 196, 182, .3), transparent 70%),
        var(--brand);
}
.lesson-hero-glyph { position: absolute; z-index: -1; right: -1rem; top: -3.5rem; font-size: 15rem; line-height: 1; color: rgba(255, 255, 255, .05); pointer-events: none; }
.lesson-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; margin: 0 0 .7rem; font-size: .9rem; color: #a9b4cc; }
.lesson-crumbs a { color: #fff; font-weight: 700; text-decoration: none; }
.lesson-crumbs a:hover { text-decoration: underline; }
.lesson-hero-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .2rem 2rem; }
.lesson-hero-text { min-width: 0; }
.lesson-hero .lesson-num { display: block; margin: 0 0 .15rem; color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lesson-hero h1 { margin: 0; color: #fff; font-size: clamp(1.7rem, 4.4vw, 2.5rem); }
.lesson-sub { margin: .25rem 0 0; color: #cfd6e6; }
.lesson-hero .lesson-letters.ruled { flex: 1 1 14rem; max-width: 26rem; margin: 0; gap: .45em; font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1.75; color: #fff; justify-content: center; }
.lesson-hero .lesson-letters.ruled::before, .lesson-hero .lesson-letters.ruled::after { flex-grow: 1; min-width: .4em; border-bottom-color: rgba(255, 255, 255, .3); }
.lesson-letters span { display: inline-block; transition: color .2s, transform .2s; animation: letter-in .6s cubic-bezier(.2, 1.3, .4, 1) backwards; animation-delay: calc(var(--i, 0) * 130ms + 150ms); }
.lesson-letters span:hover { color: var(--accent); transform: translateY(-4px); }
@keyframes letter-in { from { opacity: 0; transform: translateY(20px) scale(.7); } }
.lesson-emoji { margin: 0; font-size: 4rem; line-height: 1; animation: bob 3s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-8px) rotate(-5deg); } }

/* Les étapes : des pastilles reliées par un fil. Fait = turquoise et coché ; en cours = mandarine. */
.steps { list-style: none; display: grid; grid-template-columns: repeat(var(--steps, 5), minmax(0, 1fr)); padding: 0; margin: 1.3rem 0 0; }
.steps li { position: relative; display: flex; justify-content: center; }
.steps li + li::before { content: ""; position: absolute; top: 1.05rem; left: -50%; right: 50%; height: 3px; margin-top: -1.5px; border-radius: 99px; background: rgba(255, 255, 255, .16); transition: background .4s ease; }
.steps li.is-reached::before, .steps li[aria-current]::before { background: var(--turquoise); }
.steps button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 0 .15rem; font: inherit; color: rgba(255, 255, 255, .55); background: none; border: 0; cursor: default; }
.step-dot { position: relative; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--brand); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28); color: #fff; font-size: .9rem; font-weight: 700; transition: transform .2s ease; }
.step-label { font-size: .82rem; font-weight: 600; line-height: 1.2; text-align: center; }
.steps li.is-reached button { color: rgba(255, 255, 255, .85); cursor: pointer; }
.steps li.is-reached button:hover .step-dot { transform: scale(1.1); }
.steps li.is-done .step-dot { background: var(--turquoise); box-shadow: none; color: transparent; }
.steps li.is-done .step-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: .45rem; height: .85rem; margin: -.55rem 0 0 -.25rem; border: solid var(--brand); border-width: 0 3px 3px 0; transform: rotate(45deg); animation: check-in .3s ease-out backwards; }
.steps li[aria-current] button { color: #fff; }
.steps li[aria-current] .step-dot { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px rgba(255, 159, 28, .28); animation: step-pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.steps li[aria-current] .step-label { font-weight: 700; }
@keyframes step-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes check-in { from { opacity: 0; transform: rotate(45deg) scale(.3); } }

/* Les étapes arrivent en glissant, la fiche monte bloc par bloc. */
.phase.is-entering { animation: phase-in .45s cubic-bezier(.2, .8, .2, 1) backwards; }
.phase.is-entering[data-dir="prev"] { animation-name: phase-back; }
@keyframes phase-in { from { opacity: 0; transform: translateX(48px); } }
@keyframes phase-back { from { opacity: 0; transform: translateX(-48px); } }
.phase.is-entering .sheet-section, .phase.is-entering .sheet-box { animation: rise .55s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 100ms + 150ms); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.phase-title { font-size: clamp(1.3rem, 3vw, 1.6rem); margin: 0 0 .5rem; }

/* Passer à l'étape suivante : un gros bouton mandarine qui s'enfonce quand on appuie. */
.phase-next { display: flex; flex-direction: column; align-items: center; gap: .55rem; margin: 2rem 0 .5rem; padding-top: 1.4rem; border-top: 2px dashed var(--line); }
.btn-go { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-dark); transition: transform .12s ease, box-shadow .12s ease; }
.btn-go:hover { filter: none; transform: translateY(-2px); box-shadow: 0 6px 0 var(--accent-dark); }
.btn-go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }

@media (max-width: 600px) {
    .lesson-hero { margin-bottom: 1.1rem; padding: .8rem 1rem 1rem; border-radius: 18px; }
    .lesson-crumbs span { display: none; }
    .lesson-hero-glyph { font-size: 11rem; top: -2.5rem; }
    .lesson-hero .lesson-letters.ruled { flex-basis: 100%; max-width: none; font-size: 2.4rem; }
    .lesson-emoji { font-size: 2.8rem; }
    .steps { margin-top: .8rem; }
    .step-dot { width: 1.8rem; height: 1.8rem; font-size: .8rem; }
    .steps li + li::before { top: .9rem; }
    .step-label { font-size: .7rem; }
}

/* Alphabet */
.letter-tile.is-known { border-color: var(--good); background: var(--good-soft); }
.legend-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 4px; border: 2px solid var(--good); background: var(--good-soft); vertical-align: middle; }
.letter-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.letter-nav .row { margin: 0; gap: .4rem; }
.letter-nav .btn { padding: .35rem .9rem; min-height: 40px; font-weight: 500; }
.letter-nav .ar { font-size: 1.3rem; line-height: 1; }

.levels-progress { display: grid; gap: .6rem; margin: 1rem 0; }
.level-progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; text-decoration: none; color: var(--ink); }
.level-progress:hover { border-color: var(--brand); }
.level-progress .level-badge { height: 2rem; min-width: 2.8rem; font-size: .9rem; }
.level-bar, .level-bar .bar { display: block; }
.level-bar .bar { margin: 0; height: 10px; }
.level-bar .bar span { background: var(--good); }

.prompt.is-listen { cursor: pointer; font-size: 4rem; }
.feedback .reveal { display: inline-block; font-size: 1.8rem; font-weight: 400; margin-left: .6rem; vertical-align: middle; }

/* Dialogues */
.dialogue-lines { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .7rem; }
.bubble { display: flex; flex-direction: column; gap: .1rem; max-width: 85%; padding: .6rem 1rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.bubble-a { justify-self: start; border-bottom-left-radius: 4px; }
.bubble-b { justify-self: end; border-bottom-right-radius: 4px; background: var(--brand-soft); }
.bubble.is-playing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bubble .who { font-weight: 700; color: var(--brand); }
.bubble-ar { font: inherit; font-family: var(--ar-font); font-size: 1.7rem; line-height: 1.6; text-align: right; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; }
.bubble-fr { color: var(--ink); }
.dialogue-check .option { min-width: 160px; }

/* Dictée */
.dict-clue { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; }
.dict-clue strong { font-size: 1.4rem; color: var(--brand); }
.dict-answer { display: flex; flex-direction: column; align-items: center; gap: .2rem; margin: 1rem auto; padding: .6rem 1rem; max-width: 420px; min-height: 7.5rem; background: var(--surface); border: 2px dashed var(--line); border-radius: 18px; }
.dict-answer .ar { font-size: 3.4rem; line-height: 1.5; min-height: 1.5em; border-radius: 12px; padding: 0 .6rem; }
.dict-answer .ar.is-right { background: var(--good-soft); }
.dict-answer .ar.is-wrong { background: var(--warn-soft); text-decoration: line-through; text-decoration-thickness: 2px; }
.dict-slots { color: var(--muted); letter-spacing: .15em; font-size: .9rem; }
.dict-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 1rem 0; }
.dict-tile { width: 68px; height: 76px; font-size: 2.2rem; line-height: 1.6; padding: 0; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.dict-tile:hover:not(:disabled) { border-color: var(--brand); }
.dict-tile:disabled { opacity: .3; cursor: default; box-shadow: none; }

/* Fiches de règles */
/* Les parties sont numérotées ; les exemples sont des touches qu'on enfonce pour les entendre. */
.sheet { text-align: left; }
.sheet-intro { font-size: 1.15rem; line-height: 1.6; max-width: 46em; margin: 0 0 1.2rem; }
.sheet-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.3rem 1.2rem; margin: 1rem 0; box-shadow: 0 4px 0 var(--brand-soft); }
.sheet-section h3 { display: flex; align-items: center; gap: .65rem; margin: 0 0 .45rem; font-size: 1.15rem; color: var(--ink); }
.sheet-num { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: var(--brand); color: var(--accent); font-size: .95rem; font-weight: 700; }
.sheet-section p { margin: 0 0 .8rem; }
.sheet .ar-inline { color: var(--accent-dark); }
.sheet-examples { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.sheet-examples li { display: flex; }
.sheet-examples button {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: .45rem .5rem .6rem; font: inherit; color: var(--ink); cursor: pointer;
    background: var(--surface); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 4px 0 var(--line);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
/* Petit haut-parleur dessiné au trait, dans le coin. */
.sheet-examples button::after {
    content: ""; position: absolute; top: .45rem; right: .5rem; width: 16px; height: 16px; color: var(--muted); background: currentColor; opacity: .55;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sheet-examples button:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 0 var(--accent-soft); }
.sheet-examples button:hover::after { opacity: 1; color: var(--accent-dark); }
.sheet-examples button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.sheet-examples button.is-playing { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 4px 0 var(--accent); }
.sheet-examples button.is-playing::after { opacity: 1; color: var(--accent-dark); animation: speaker .45s ease-in-out infinite alternate; }
.sheet-examples button.is-playing .sheet-ar { animation: say .4s ease-out; }
@keyframes speaker { to { transform: scale(1.3); } }
@keyframes say { 50% { transform: scale(1.12); } }
.sheet-examples .sheet-ar { display: inline-block; font-size: 2.2rem; line-height: 1.6; }
.sheet-group + .sheet-group { margin-top: .9rem; }
.sheet-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-bottom: .55rem; }
.sheet-group-head h4 { margin: 0; font-size: 1rem; }

/* « Tout écouter » : bouton lecture ; pendant la lecture il devient « Arrêter » et son disque pulse. */
.btn-play { display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: .3rem 1rem .3rem .35rem; border: 0; border-radius: 999px; background: var(--brand); color: #fff; font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; transition: transform .12s ease; }
.btn-play:hover { transform: translateY(-1px); }
.btn-play:active { transform: translateY(1px); }
.play-icon { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent); }
.play-icon::before { content: ""; margin-left: 3px; border-style: solid; border-width: .38rem 0 .38rem .6rem; border-color: transparent transparent transparent var(--accent-ink); }
.btn-play[aria-pressed="true"] .play-icon { animation: ring 1.1s ease-out infinite; }
.btn-play[aria-pressed="true"] .play-icon::before { width: .6rem; height: .6rem; margin: 0; border: 0; border-radius: 2px; background: var(--accent-ink); }
@keyframes ring { from { box-shadow: 0 0 0 0 rgba(255, 159, 28, .6); } to { box-shadow: 0 0 0 10px rgba(255, 159, 28, 0); } }

/* À retenir : la carte de nuit, cochée en turquoise. */
.sheet-box { border-radius: var(--radius-lg); padding: 1rem 1.3rem; margin: 1rem 0; }
.sheet-box ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.sheet-box p { margin: .3rem 0 0; }
.sheet-remember { background: var(--brand); color: #fff; }
.sheet-remember > strong { color: var(--accent); }
.sheet-remember ul { list-style: none; display: grid; gap: .5rem; margin-top: .6rem; padding: 0; }
.sheet-remember li { position: relative; padding-left: 1.7rem; }
.sheet-remember li::before { content: ""; position: absolute; left: .35rem; top: .3rem; width: .4rem; height: .8rem; border: solid var(--turquoise); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.sheet-remember .ar-inline { color: var(--accent); }
.sheet-origin { background: var(--accent-soft); border: 1px solid var(--accent); }
@media (max-width: 600px) {
    .sheet-section { padding: .85rem .9rem 1rem; }
    .sheet-examples { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
    .sheet-examples .sheet-ar { font-size: 2rem; }
}
.memo-item summary { cursor: pointer; }
.memo-item[open] summary { margin-bottom: .6rem; }
h2 .level-badge { height: 2rem; min-width: 2.8rem; font-size: .9rem; vertical-align: middle; }

/* Mot-repère sous la carte */
.example-word { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem auto 0; padding: .7rem 1.2rem; max-width: 460px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); }
.example-word > div { display: flex; flex-direction: column; align-items: center; }
.example-word .emoji-big { font-size: 3rem; }
.example-ar { font-size: 2.4rem; line-height: 1.75; }

.ar-inline { font-size: 1.35em; line-height: 1; padding: 0 .1em; }

/* Typographie : titres plus affirmés */
h1 { font-weight: 800; letter-spacing: -.01em; }
h2 { font-weight: 750; }

/* Étoiles de zellige */
.zstar { display: inline-block; vertical-align: -3px; }
.zstar path { fill: var(--line); stroke: var(--line-strong); stroke-width: .8; }
.zstar.is-on path { fill: var(--accent); stroke: #d97e00; }
.zstars { display: inline-flex; gap: 2px; }
.lesson-stars { align-self: flex-start; }
.result-stars { display: flex; justify-content: center; gap: .6rem; margin: .4rem 0 .2rem; }
.result-stars .zstar:nth-child(2) { transform: translateY(-10px); }
.zstar.pop { animation: star-pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes star-pop { 0% { transform: scale(.3) rotate(-25deg); } 100% { transform: scale(1) rotate(0); } }
.result-stars .zstar.pop:nth-child(2) { animation-name: star-pop-mid; }
@keyframes star-pop-mid { 0% { transform: translateY(-10px) scale(.3) rotate(-25deg); } 100% { transform: translateY(-10px) scale(1) rotate(0); } }
.result-day { font-weight: 600; color: var(--brand); }
.recall-tag { display: inline-block; margin-right: .5rem; padding: .05rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: .8rem; font-weight: 700; }

/* Réponses : retour visuel à l'action */
.option.is-right { animation: right-pop .3s ease-out; }
.option.is-wrong { animation: wrong-shake .35s ease-in-out; }
@keyframes right-pop { 50% { transform: scale(1.04); } }
@keyframes wrong-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.card-back:not([hidden]) { animation: reveal .25s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } }

/* Accueil */
.btn-big { font-size: 1.1rem; padding: .8rem 1.8rem; }
.dash-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; }
.dash-head { margin-bottom: 1.1rem; }
.dash-head h1 { margin-bottom: .2rem; }
.streak { margin: 0; color: var(--brand); }
.streak strong { font-size: 1.3rem; }
.dash-grid { display: grid; gap: 1rem; grid-template-columns: 1.6fr 1fr; }
.dash-grid .panel { margin: 0; }
.continue { grid-row: span 1; border: 2px solid var(--brand); border-radius: var(--radius-lg); }
.continue h2 { font-size: 1.6rem; margin: .1rem 0 .2rem; }
.continue-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.continue-visual { font-size: 3.4rem; line-height: 1.7; margin: 0; }
.continue-visual.ar { color: var(--brand); }
.today { text-align: center; }
.today h2, .review-card h2, .levels-card h2 { font-size: 1.05rem; color: var(--muted); margin-bottom: .6rem; }
.goal-ring { --pct: 0; width: 120px; height: 120px; margin: 0 auto .3rem; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--good) calc(var(--pct) * 1%), var(--line) 0); }
.goal-ring span { display: flex; align-items: baseline; justify-content: center; gap: 1px; width: 92px; line-height: 92px; height: 92px; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: .9rem; }
.goal-ring strong { font-size: 1.8rem; color: var(--ink); line-height: 1; }
.week { list-style: none; display: flex; justify-content: center; gap: .3rem; padding: 0; margin: .8rem 0 0; }
.week li { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: .75rem; font-weight: 700; }
.week li.is-active { background: var(--good); color: #fff; }
.week li.is-today { outline: 2px solid var(--brand); outline-offset: 1px; }
.big-num { font-size: 2.2rem; color: var(--brand); }
.levels-card .level-progress { grid-template-columns: auto 1fr auto auto; border: 0; padding: .4rem 0; background: none; }
.level-stars { color: var(--muted); white-space: nowrap; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0 0; text-align: center; }
.mini-stats div { background: var(--bg); border-radius: 12px; padding: .5rem .3rem; }
.mini-stats dt { font-size: .75rem; color: var(--muted); }
.mini-stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--brand); }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }

/* Choix du parcours */
.audience-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.audience-choice label { position: relative; display: block !important; font-weight: 400 !important; }
.audience-choice input { position: absolute; opacity: 0; }
.audience-choice span { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.audience-choice small { color: var(--muted); font-size: .8rem; }
.audience-choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.audience-choice input:focus-visible + span { outline: 3px solid var(--accent); }
.audience-switch { display: inline; margin: 0; }
.audience-switch button { font: inherit; font-size: .85rem; color: var(--brand); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

.focus-tag { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: .05rem .55rem; }
.sheet-more { margin: .6rem 0; }
.sheet-more summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.audience-line { margin: 0; }

/* Parcours adulte : plus sobre (images plus discrètes, pas d'avatar géant) */
.audience-adult .lesson-visual:not(.ar), .audience-adult .continue-visual:not(.ar) { font-size: 1.7rem; filter: saturate(.55); }
.audience-adult .dash-head h1 span { display: none; }

/* Forme féminine sous la carte */
.fem-form { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .2rem .6rem; margin: 1rem auto 0; padding: .5rem 1.1rem; max-width: 520px; border: 1px dashed var(--brand); border-radius: var(--radius); text-align: center; }
.fem-ar { font-family: var(--ar-font); font-size: 1.7rem; line-height: 1.5; background: none; border: 0; padding: 0 .4rem; color: var(--ink); cursor: pointer; border-radius: 8px; }
.fem-ar:hover { background: var(--brand-soft); }

/* Phrase d'exemple sous la carte */
.example-sentence { display: flex; flex-direction: column; align-items: center; gap: .1rem; margin: 1rem auto 0; padding: .6rem 1.1rem; max-width: 520px; background: var(--brand-soft); border-radius: var(--radius); text-align: center; }
.sentence-ar { font-family: var(--ar-font); font-size: 1.9rem; line-height: 1.6; background: none; border: 0; padding: 0 .4rem; color: var(--ink); cursor: pointer; border-radius: 8px; }
.sentence-ar:hover { background: #fff; }

.prompt.giant.is-sentence { font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.7; max-width: 640px; margin-inline: auto; }
.option.ar { line-height: 1.6; }
.option.is-sentence { font-size: 1.05rem; }
.option.ar.is-sentence { font-size: 1.5rem; }
.review-card-unit { border-style: dashed; }
.review-card-unit.is-done, .review-card-unit.is-next { border-style: solid; }

/* Phrases dans l'ordre */
.order-answer { margin: 1rem auto; padding: .6rem 1rem; max-width: 560px; min-height: 4.2rem; font-family: var(--ar-font); font-size: 2rem; line-height: 1.7; text-align: center; background: var(--surface); border: 2px dashed var(--line); border-radius: 18px; }
.order-answer.is-right { background: var(--good-soft); border-style: solid; border-color: var(--good); }
.order-answer.is-wrong { background: var(--warn-soft); border-style: solid; border-color: var(--warn); }
.order-words { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 1rem 0; }
.order-word { font-size: 1.7rem; line-height: 1.5; padding: .2rem .9rem; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.order-word:hover:not(:disabled) { border-color: var(--brand); }
.order-word:disabled { opacity: .3; cursor: default; box-shadow: none; }

/* Contre la montre */
.timer-big { font-size: 3.4rem; font-weight: 800; color: var(--brand); margin: .2rem 0; }
.timed-head { display: flex; justify-content: space-between; align-items: baseline; }
.timer { font-size: 1.6rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.timer.is-low { color: var(--warn); }
.timed-score strong { font-size: 1.4rem; color: var(--good); }
.timer-bar span { background: var(--brand); transition: width .2s linear; }

/* Lettres qui se ressemblent */
.lookalikes { margin: 1.2rem auto; max-width: 560px; padding: .8rem 1.1rem; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); text-align: left; }
.lookalikes p { margin: .4rem 0 0; }
.lookalike-letters { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.lookalike-letters a { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: .1rem .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); }
.lookalike-letters .ar { font-size: 2.2rem; line-height: 1.8; }

/* ===== Site vitrine ===== */
.site { max-width: none; padding: 0; }
.site-head { display: flex; align-items: center; gap: 1rem; padding: .8rem clamp(16px, 4vw, 48px); color: #fff; background: var(--brand); }
.site-head a { color: inherit; text-decoration: none; }
.site-nav { display: flex; gap: 1.2rem; margin-left: auto; font-weight: 600; }
.site-nav a { opacity: .9; }
.site-nav a:hover { opacity: 1; text-decoration: underline; }
.btn-light { background: var(--accent); color: var(--accent-ink); }
.site-hero, .site-section, .site-cta, .site-foot { padding-inline: clamp(16px, 5vw, 64px); }
.site-hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; max-width: 1180px; margin: 0 auto; padding-block: clamp(2.5rem, 7vw, 5.5rem); }
.site-hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); line-height: 1.05; letter-spacing: -.025em; margin: 0 0 1rem; max-width: 14ch; }
.hero-lead { font-size: 1.15rem; line-height: 1.6; color: var(--text-soft); max-width: 34em; }
.vowel-demo { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.demo-card { position: relative; width: min(100%, 380px); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface); border: 2px solid var(--line); border-radius: 32px; box-shadow: 0 10px 0 var(--line); }
.demo-card .zstar { position: absolute; top: 18px; right: 18px; }
.demo-letter { font-size: clamp(7rem, 22vw, 11rem); line-height: 1.6; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0 .2em; }
.demo-letter.pulse { animation: demo-pulse .35s ease-out; }
@keyframes demo-pulse { 0% { transform: scale(.9); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
.demo-reading { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.demo-vowels { display: flex; gap: .4rem; }
.demo-vowels button { font: inherit; font-weight: 700; min-width: 3.2rem; padding: .45rem .8rem; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.demo-vowels button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.vowel-demo figcaption { max-width: 30ch; text-align: center; color: var(--muted); font-size: .95rem; }

.site-section { max-width: 1180px; margin: 0 auto; padding-block: clamp(2rem, 6vw, 4.5rem); border-top: 1px solid var(--line); }
.site-section h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.015em; margin: 0 0 1.2rem; }
.section-lead { font-size: 1.08rem; line-height: 1.65; max-width: 46em; color: var(--text-soft); }
.soon { display: inline-block; vertical-align: middle; margin-left: .3rem; padding: .05rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: .72rem; font-weight: 700; letter-spacing: 0; }

.method { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; counter-reset: none; }
.method li { position: relative; padding-top: 1rem; border-top: 3px solid var(--brand); }
.method li.is-soon { border-top-style: dashed; border-top-color: var(--accent); }
.method-step { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.method li.is-soon .method-step { background: var(--accent); color: var(--accent-ink); }
.method h3 { margin: .6rem 0 .3rem; font-size: 1.15rem; }
.method p { margin: 0; color: var(--text-soft); line-height: 1.55; }

.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 1.4rem; }
.level-col h3 { font-size: 1rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: .7rem; margin: 0 0 .8rem; }
.unit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.unit-list li { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.unit-list span { grid-column: 1; color: var(--muted); font-size: .9rem; }
.unit-list small { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--brand); font-weight: 700; white-space: nowrap; }

.audience-cols, .plans { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.audience-cols article { padding: 1.2rem 1.4rem; background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line); }
.audience-cols h3 { margin-top: 0; }
.audience-cols p { margin-bottom: 0; line-height: 1.6; color: var(--text-soft); }
.plan { display: flex; flex-direction: column; gap: .4rem; padding: 1.5rem; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg); }
.plan-accent { border-color: var(--accent); border-style: dashed; }
.plan h3 { margin: 0; font-size: 1.4rem; }
.plan-price { margin: 0 0 .4rem; font-size: 1.15rem; font-weight: 800; color: var(--brand); }
.plan ul { margin: 0 0 1rem; padding-left: 1.2rem; line-height: 1.8; }
.plan .btn { align-self: flex-start; margin-top: auto; }

.promise-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.promise-list li { line-height: 1.6; color: var(--text-soft); }
.promise-list strong { display: block; color: var(--ink); margin-bottom: .2rem; }

.site-cta { text-align: center; color: #fff; padding-block: clamp(2.5rem, 7vw, 4.5rem); background: var(--brand-deep); }
.cta-ar { font-size: clamp(2.6rem, 8vw, 4.5rem); margin: 0; color: var(--accent); }
.site-cta h2 { margin: .3rem 0 1.4rem; font-size: clamp(1.4rem, 3vw, 2rem); }
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-block: 1.4rem; color: var(--muted); font-size: .9rem; max-width: 1180px; margin: 0 auto; }

@media (max-width: 860px) {
    .site-hero { grid-template-columns: 1fr; }
    .method { grid-template-columns: 1fr 1fr; }
    .levels, .audience-cols, .plans, .promise-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .site-nav { display: none; }
    .site-head .btn { margin-left: auto; }
    .method { grid-template-columns: 1fr; }
}

.plan-price small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.why-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.why-cols p { margin: 0; line-height: 1.6; color: var(--text-soft); }
.why-cols strong { display: block; color: var(--ink); margin-bottom: .3rem; }
@media (max-width: 860px) { .why-cols { grid-template-columns: 1fr; } }

.free { display: inline-block; vertical-align: middle; margin-left: .3rem; padding: .05rem .55rem; border-radius: 999px; background: var(--good-soft); color: #0c6a60; font-size: .72rem; font-weight: 700; }
.plans-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .plans-3 { grid-template-columns: 1fr; } }

/* ===== Révision du design ===== */
:root { --guide: #c3ccdd; --guide-soft: #dde3ee; }

/* Icônes de navigation */
.icon { display: block; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.nav-icon.ar { width: auto; }
.nav a[aria-current] .icon { stroke-width: 2.2; }

/* La ligne d'écriture : la lettre se pose sur sa ligne de base, comme dans un cahier d'écriture arabe.
   Les deux traits sont des éléments sans texte alignés « sur la ligne de base » du texte :
   le navigateur les place exactement sous les lettres, quelle que soit la police de l'appareil. */
.ruled { display: flex; align-items: baseline; justify-content: center; gap: .12em; }
.ruled::before, .ruled::after { content: ""; flex: 1 1 0; min-width: .4em; height: 0; border-bottom: 2px solid var(--guide); }
.card3d .ruled { width: 100%; padding-inline: 4%; }
.lesson-letters.ruled { font-size: 2.2rem; line-height: 1.8; margin: .2rem 0 1rem; color: var(--brand); justify-content: flex-start; }
.lesson-letters.ruled::after { flex-grow: 0; min-width: 0; }
.lesson-letters.ruled::before { flex-grow: 1; }
.continue-visual.ruled { justify-content: flex-start; }
.demo-letter.ruled { width: 100%; padding-inline: 8%; }
.prompt.ruled { justify-content: center; }

/* Fil d'Ariane sans points médians */
.crumbs { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; }

/* ===== Le parcours =====
   En haut, la prochaine étape (la nuit, comme « Continuer » à l'accueil).
   Puis chaque unité en accordéon : fermée, elle se résume à un chapelet (un grain par leçon, l'étoile du bilan au bout) ;
   ouverte, ses leçons sont des pages de cahier, l'arabe posé sur sa ligne d'écriture. */
.path-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6rem 1.2rem; }
.path-head h1 { margin: .4em 0 .2em; }
.path-intro { margin: 0; max-width: 38em; }
.path-note { margin: 0; }

.next-step {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text sample" "progress progress";
    align-items: center; gap: .6rem 2.5rem; margin: 1.4rem 0 .8rem; padding: 1.5rem 1.7rem 1.1rem;
    border-radius: var(--radius-lg); background: var(--brand); color: #fff;
}
.next-text { grid-area: text; min-width: 0; }
.next-where { margin: 0; color: var(--accent); font-weight: 700; font-size: .92rem; }
.next-step h2 { margin: .15rem 0 .3rem; color: #fff; font-size: clamp(1.4rem, 3.4vw, 1.8rem); line-height: 1.2; }
.next-meta { margin: 0 0 1.1rem; color: #a9b4cc; font-size: .95rem; max-width: 32em; }
.next-step .btn-big { background: var(--accent); color: var(--accent-ink); }
.next-sample { grid-area: sample; margin: 0; min-width: 16rem; font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1.75; white-space: nowrap; }
.next-sample.ruled::before { flex-grow: 0; min-width: .5em; }
.next-sample.ruled::before, .next-sample.ruled::after { border-bottom-color: rgba(255, 255, 255, .3); }
.next-progress { grid-area: progress; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; margin-top: .4rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .14); color: #cfd6e6; font-size: .92rem; }
.next-progress strong { color: #fff; }
.next-progress .bar { flex: 1 1 10rem; margin: 0; background: rgba(255, 255, 255, .14); }
.next-progress .bar span { background: var(--turquoise); }
.next-stars { display: inline-flex; align-items: center; gap: .35rem; }

.level { margin: 2.6rem 0 0; }
.level-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.level-head h2 { margin: 0; font-size: 1.35rem; }
.level-head p { margin: 0; }
.level-count { margin-left: auto; flex: none; font-weight: 700; color: var(--muted); font-size: .92rem; white-space: nowrap; }

/* L'unité : un accordéon. */
.unit { margin: 0 0 .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.unit[open] { border-color: var(--line-strong); box-shadow: 0 5px 0 var(--brand-soft); margin-bottom: 1.3rem; }
.unit-head {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "abjad title count chev" "abjad beads count chev";
    align-items: center; gap: .3rem 1rem; padding: .9rem 1.1rem; cursor: pointer; list-style: none; border-radius: var(--radius-lg);
}
.unit-head::-webkit-details-marker { display: none; }
.unit-head .abjad { grid-area: abjad; }
.unit-head h3 { grid-area: title; align-self: end; margin: 0; font-size: 1.12rem; line-height: 1.3; }
.unit-head:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.unit-progress { grid-area: count; font-weight: 600; font-size: .9rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .7rem; white-space: nowrap; }
.unit-progress.is-done { color: #fff; background: var(--good); border-color: var(--good); }
.chevron { grid-area: chev; color: var(--muted); transition: transform .2s ease; }
.unit[open] .chevron { transform: rotate(180deg); }

/* Le chapelet : un grain par leçon, reliés par un fil. */
.beads { grid-area: beads; justify-self: start; align-self: start; position: relative; display: inline-flex; align-items: center; gap: 6px; }
.beads::before { content: ""; position: absolute; left: 4px; right: 8px; top: 50%; height: 2px; margin-top: -1px; background: var(--line); }
.bead { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-strong); }
.bead.is-done { background: var(--good); box-shadow: none; }
.bead.is-tried { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.bead.is-next { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bead-review { position: relative; display: block; line-height: 0; margin-left: 2px; }
.bead-review .zstar { vertical-align: 0; }

.unit-body { padding: .1rem 1.1rem 1.2rem; }
.unit-intro { margin: 0 0 1rem; padding-left: 4rem; max-width: 48em; color: var(--text-soft); font-size: .92rem; }

/* Les leçons : des pages de cahier. */
.lcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); gap: .8rem; }
.lcard > a { display: flex; flex-direction: column; height: 100%; overflow: hidden; color: var(--ink); text-decoration: none; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); }
.lcard > a:hover { border-color: var(--brand); }
.lcard > a:hover strong { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.lcard-page { position: relative; display: block; padding: 2.4rem .9rem .35rem; background: var(--bg); }
.lcard-num { position: absolute; top: .6rem; left: .65rem; display: grid; place-items: center; min-width: 1.8rem; height: 1.8rem; padding: 0 .35rem; border-radius: 999px; background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); font-size: .82rem; font-weight: 700; }
.lcard.is-done .lcard-num { background: var(--good); border-color: var(--good); color: #fff; }
.lcard.is-tried .lcard-num { border-color: var(--accent); color: var(--accent-dark); }
.lcard.is-next .lcard-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lcard-status { position: absolute; top: .6rem; right: .65rem; display: flex; align-items: center; }
.lcard-sample { min-height: calc(1.95rem * 1.75); font-size: 1.95rem; line-height: 1.75; color: var(--brand); white-space: nowrap; overflow: hidden; }
.lcard:not(.is-done):not(.is-next) .lcard-sample { color: var(--text-soft); }
.lcard.is-next .lcard-sample.ruled::before, .lcard.is-next .lcard-sample.ruled::after { border-bottom-color: var(--accent); }
.lcard-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .7rem .9rem .9rem; }
.lcard-body strong { font-size: 1.04rem; line-height: 1.3; }
.lcard-sub { font-size: .88rem; color: var(--text-soft); }
.lcard-meta { font-size: .84rem; color: var(--muted); }
.lcard-body .focus-tag { margin-top: .35rem; }
.lcard.is-next > a { border: 2px solid var(--accent); box-shadow: 0 5px 0 var(--accent-soft); }
.lcard.is-next .lcard-page { background: var(--accent-soft); }
.pill-next { font-size: .78rem; font-weight: 700; color: #fff; background: var(--brand); border-radius: 999px; padding: .12rem .6rem; }
.path-score { font-weight: 700; font-size: .85rem; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: .1rem .55rem; }
.btn-small { min-height: 0; padding: .35rem .9rem; font-size: .9rem; }

/* Le bilan ferme l'unité : une bande sur toute la largeur. */
.lcard-review { grid-column: 1 / -1; }
.lcard-review > a { flex-direction: row; align-items: center; gap: 1rem; padding: .8rem 1rem; background: transparent; border-style: dashed; border-color: var(--line-strong); }
.lcard-review .lcard-body { padding: 0; }
.lcard-review .lcard-status { position: static; margin-left: auto; flex: none; }
.lcard-review-icon { flex: none; line-height: 0; }
.lcard-review-icon .zstar { vertical-align: 0; }
.lcard-review.is-done > a { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.lcard-review.is-next > a { background: var(--surface); }

@media (max-width: 600px) {
    .next-step { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sample" "text" "progress"; gap: .2rem; padding: 1rem 1.1rem 1rem; }
    .next-sample { min-width: 0; font-size: 2.6rem; }
    .next-step .btn-big { display: block; text-align: center; }
    .level-head { gap: .7rem; }
    .unit-head { grid-template-areas: "abjad title title chev" "abjad beads count chev"; gap: .35rem .7rem; padding: .8rem .75rem .8rem .9rem; }
    .unit-progress { font-size: .8rem; padding: 0 .5rem; }
    .beads { gap: 4px; }
    .bead { width: 9px; height: 9px; }
    .unit-body { padding: .1rem .65rem .9rem; }
    .unit-intro { padding-left: .25rem; }
    .lcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .lcard-page { padding: 2.3rem .5rem .2rem; }
    .lcard-num { top: .5rem; left: .5rem; }
    .lcard-status { top: .5rem; right: .5rem; }
    .lcard-status .zstar { width: 13px; height: 13px; }
    .lcard-sample { font-size: 1.6rem; min-height: calc(1.6rem * 1.75); }
    .lcard-body { padding: .55rem .65rem .75rem; }
    .lcard-body strong { font-size: .96rem; }
    .lcard-review > a { flex-wrap: wrap; gap: .4rem .8rem; }
}
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }

/* Accueil : moins de boîtes. Seules « Continuer » et « Aujourd'hui » restent des cartes ; le reste est posé sur la page. */
.dash-grid .review-card, .dash-grid .levels-card { background: none; border: 0; border-top: 2px solid var(--line); border-radius: 0; padding: 1rem .2rem 0; }
.audience-line .audience-switch { margin-left: .3rem; }

/* ===== 3D (ordinateur uniquement) ===== */

/* Carte recto-verso des leçons */
.card3d { display: block; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; perspective: 1400px; }
.card-inner { position: relative; display: block; min-height: 330px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .25, 1); }
.card3d.is-flipped .card-inner { transform: rotateY(180deg); }
.card3d.no-anim .card-inner { transition: none; }
.card-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.5rem;
    background: var(--surface); border: 2px solid var(--line); border-radius: 24px; box-shadow: 0 6px 0 var(--line);
    backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: auto; }
.card-face-back { transform: rotateY(180deg); }
.card3d:hover .card-face { border-color: var(--brand); }
.card-mini { font-size: 2.2rem; line-height: 1.4; color: var(--muted); }
.card-back { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; }

/* Vitrine : la carte se pose comme une tuile (une seule fois), la voyelle pivote comme une page */
.demo-card { animation: tile-in 1.1s cubic-bezier(.2, .8, .2, 1) both; transform-style: preserve-3d; }
@keyframes tile-in { from { opacity: 0; transform: perspective(900px) rotateX(58deg) translateY(50px) scale(.92); } to { opacity: 1; transform: none; } }
.demo-letter.pulse { animation: page-turn .45s cubic-bezier(.3, .7, .3, 1); }
@keyframes page-turn { from { transform: perspective(700px) rotateY(-95deg); opacity: .2; } to { transform: none; opacity: 1; } }
.is-tiltable { transition: transform .2s ease-out; will-change: transform; }
.is-tiltable .demo-letter, .is-tiltable .continue-visual { transform: translateZ(0); }

/* Étoiles gagnées : elles tournent sur elles-mêmes en s'allumant */
@keyframes star-pop { 0% { transform: perspective(500px) rotateY(-540deg) scale(.2); } 100% { transform: perspective(500px) rotateY(0) scale(1); } }
@keyframes star-pop-mid { 0% { transform: translateY(-10px) perspective(500px) rotateY(-540deg) scale(.2); } 100% { transform: translateY(-10px) perspective(500px) rotateY(0) scale(1); } }
.zstar.pop { animation-duration: .8s; }

/* ===== Smartphone et tablette : ni animation ni 3D ===== */
@media (max-width: 1024px), (pointer: coarse) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    /* Carte recto-verso : on affiche simplement l'autre face, sans pivoter. */
    .card-inner { transform-style: flat; }
    .card3d.is-flipped .card-inner { transform: none; }
    .card-face, .card-face-back { position: relative; transform: none; backface-visibility: visible; -webkit-backface-visibility: visible; min-height: 300px; }
    .card3d .card-face-back { display: none; }
    .card3d.is-flipped .card-front { display: none; }
    .card3d.is-flipped .card-face-back { display: flex; }
    /* Memory : même principe. */
    .tile-inner { transform-style: flat; }
    .tile.is-open .tile-inner, .tile.is-found .tile-inner { transform: none; }
    .tile-back, .tile-front { backface-visibility: visible; -webkit-backface-visibility: visible; transform: none; }
    .tile-front { display: none; }
    .tile.is-open .tile-front, .tile.is-found .tile-front { display: flex; }
    .tile.is-open .tile-back, .tile.is-found .tile-back { display: none; }
    .result-stars .zstar:nth-child(2) { transform: translateY(-10px); }
}

/* ===== Vitrine, direction « les lettres en grand » (nuit et mandarine) ===== */
.landing { overflow-x: clip; }
.site-hero { position: relative; isolation: isolate; overflow: hidden; max-width: none; margin: 0; color: #fff; background: var(--brand);
    padding: clamp(3rem, 8vw, 6.5rem) max(clamp(16px, 5vw, 64px), calc((100vw - 1180px) / 2)); }
.site-hero .hero-text, .site-hero .vowel-demo { position: relative; z-index: 1; }
.site-hero h1 { color: #fff; }
.site-hero .hero-lead { color: #c9d2e6; }
.hero-note { color: #9aa7c2; }
.btn-ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px #fff; }
.site-head { position: relative; z-index: 2; }
.hero-glyph { position: absolute; z-index: 0; line-height: 1; pointer-events: none; font-size: clamp(12rem, 32vw, 30rem); transform: translateY(var(--shift, 0)); }
.glyph-1 { color: var(--accent); right: -5vw; top: -6rem; }
.glyph-2 { color: var(--turquoise); left: -3vw; bottom: -9rem; opacity: .9; }
.glyph-3 { color: transparent; -webkit-text-stroke: 2px rgba(255, 255, 255, .18); left: 38%; top: -4rem; font-size: clamp(8rem, 18vw, 16rem); }
.site-hero .demo-card { border-color: transparent; box-shadow: 0 18px 0 rgba(0, 0, 0, .18); }
.site-hero .vowel-demo figcaption { color: #9aa7c2; }
.site-hero .demo-vowels button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.site-hero .demo-vowels button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Formes en arrière-plan */
.site-section, .assemble, .site-cta { position: relative; isolation: isolate; }
.shape { position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; transform: translateY(var(--shift, 0)); }
.shape-circle { background: var(--accent); opacity: .16; }
.shape-ring { border: 28px solid var(--turquoise); opacity: .14; }
.shape-a { width: 340px; height: 340px; left: -120px; top: 10%; }
.shape-b { width: 220px; height: 220px; right: -60px; bottom: -40px; background: var(--turquoise); }
.shape-c { width: 420px; height: 420px; right: -200px; top: -60px; }
.shape-d { width: 520px; height: 520px; left: 50%; top: -240px; margin-left: -260px; opacity: .12; }
.bg-glyph { position: absolute; z-index: -1; right: 2%; top: -2rem; font-size: clamp(10rem, 22vw, 20rem); line-height: 1; color: var(--brand-soft); pointer-events: none; transform: translateY(var(--shift, 0)); }

/* « Lire, c'est assembler » */
.assemble { text-align: center; padding: clamp(3rem, 8vw, 6rem) clamp(16px, 5vw, 64px); overflow: hidden; }
.assemble h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -.02em; margin: 0 0 1rem; }
.assemble-stage { position: relative; height: clamp(8rem, 20vw, 13rem); margin: 0 auto; max-width: 900px; }
.piece, .assembled { position: absolute; top: 50%; left: 50%; font-size: clamp(5rem, 13vw, 9rem); line-height: 1; }
/* État final par défaut (smartphone, tablette, sans animation) : le mot lié seul. */
.piece { opacity: 0; transform: translate(calc(-50% + var(--x)), -55%); }
.assembled { color: var(--brand); transform: translate(-50%, -55%); }
.piece-1 { color: var(--brand); --x: 1.35em; --sx: 45vw; --sy: 0px; --sr: 18deg; --d: 0s; }
.piece-2 { color: var(--good); --x: 0em; --sx: 0vw; --sy: 160px; --sr: -12deg; --d: .12s; }
.piece-3 { color: var(--accent-dark); --x: -1.35em; --sx: -45vw; --sy: 0px; --sr: -18deg; --d: .24s; }
/* Sur ordinateur : les lettres arrivent des côtés, se rejoignent, puis laissent place au mot lié. */
.motion-ok .assemble .assembled { opacity: 0; }
.motion-ok .assemble.is-in .piece { animation: assemble-piece 2.2s cubic-bezier(.2, .8, .2, 1) var(--d) both; }
.motion-ok .assemble.is-in .assembled { animation: assembled-in .7s ease-out 1.9s both; }
@keyframes assemble-piece {
    0% { opacity: 0; transform: translate(calc(-50% + var(--sx)), calc(-55% + var(--sy))) rotate(var(--sr)); }
    45% { opacity: 1; transform: translate(calc(-50% + var(--x)), -55%) rotate(0deg); }
    75% { opacity: 1; transform: translate(calc(-50% + var(--x)), -55%) rotate(0deg); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x) * .3), -55%) rotate(0deg); }
}
@keyframes assembled-in { from { opacity: 0; transform: translate(-50%, -55%) scale(.88); } to { opacity: 1; transform: translate(-50%, -55%) scale(1); } }
.assemble-caption { max-width: 38em; margin: 1rem auto 0; color: var(--text-soft); line-height: 1.65; }
.assemble-caption .ar { font-size: 1.35em; }

/* Arrivées au défilement (uniquement quand le contrôleur a activé « motion-ok ») */
.motion-ok [data-reveal] { opacity: 0; transition: opacity .7s ease-out var(--delay, 0ms), transform .8s cubic-bezier(.2, .8, .2, 1) var(--delay, 0ms); }
.motion-ok [data-reveal="up"] { transform: translateY(60px); }
.motion-ok [data-reveal="left"] { transform: translateX(-120px) rotate(-2deg); }
.motion-ok [data-reveal="right"] { transform: translateX(120px) rotate(2deg); }
.motion-ok [data-reveal].is-in { opacity: 1; transform: none; }
.motion-ok .assemble[data-reveal] { opacity: 1; transform: none; }

/* Section CTA */
.site-cta { overflow: hidden; background: var(--brand); }
.cta-ar { color: var(--accent); }

@media (max-width: 1024px), (pointer: coarse) {
    .hero-glyph { font-size: 11rem; }
    .glyph-1 { top: -3rem; right: -2rem; }
    .glyph-2 { bottom: -4rem; }
    .glyph-3 { display: none; }
}

/* ===== Espace élève, nuit et mandarine ===== */
.continue { position: relative; overflow: hidden; isolation: isolate; color: #fff; background: var(--brand); border-color: var(--brand); }
.continue h2 { color: #fff; }
.continue .muted, .continue .continue-meta { color: #a9b4cc; }
.continue .continue-visual { color: #fff; }
.continue .ruled::before, .continue .ruled::after { border-bottom-color: rgba(255, 255, 255, .25); }
.continue .btn-big { background: var(--accent); color: var(--accent-ink); }
.continue .btn-quiet { background: rgba(255, 255, 255, .12); color: #fff; }
.continue-glyph { position: absolute; z-index: -1; right: -1.5rem; bottom: -5rem; font-size: 15rem; line-height: 1; color: var(--accent); opacity: .9; pointer-events: none; }
.continue .continue-visual.ruled { position: relative; }
/* Tuile d'unité : le numéro en lettre (abjad), et le chiffre en pastille pour le décoder. */
.abjad { position: relative; flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; background: var(--brand); color: var(--accent); line-height: 1; }
.abjad .ar { font-size: 1.9rem; line-height: 1; margin-top: -.2rem; }
.abjad-num { position: absolute; right: -.4rem; bottom: -.4rem; display: grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .25rem; border-radius: 999px; background: var(--surface); color: var(--brand); border: 2px solid var(--brand); font-size: .72rem; font-weight: 700; }
.level-badge { background: var(--brand); color: var(--accent); }
.btn-small { background: var(--accent); color: var(--accent-ink); }
.lcard.is-next .btn-small { background: var(--brand); color: #fff; }
.nav a[aria-current] { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 640px) { .continue-glyph { font-size: 10rem; bottom: -3rem; } }

.plans-note { margin: 1.2rem 0 0; color: var(--text-soft); font-style: italic; }

/* Compte et connexion */
input[type=password] { font: inherit; padding: .65rem .9rem; border: 2px solid var(--line); border-radius: 12px; }
.auth { max-width: 480px; margin-inline: auto; }

/* Porte : connexion et inscription, scène à gauche, carte à droite */
main.auth-gate { max-width: none; margin: 0; padding: 0; }
body:has(main.auth-gate) { background: #f3efe6; }
.gate { min-height: 100dvh; display: grid; }
.story {
    position: relative; overflow: hidden; color: #e7eefc;
    background:
        radial-gradient(420px 320px at 8% 88%, rgba(255, 159, 28, .95), transparent 70%),
        radial-gradient(380px 280px at 92% 8%, rgba(46, 196, 182, .35), transparent 68%),
        var(--brand-deep);
    padding: 1.6rem 1.3rem 1.4rem;
    display: flex; flex-direction: column; gap: 1.2rem;
}
.story::before, .story::after {
    content: ""; position: absolute; border-radius: 40% 60% 55% 45%; pointer-events: none;
}
.story::before { width: 280px; height: 180px; right: -80px; top: 18%; background: rgba(255, 159, 28, .16); transform: rotate(-18deg); }
.story::after { width: 220px; height: 220px; left: -90px; bottom: 8%; background: rgba(46, 196, 182, .14); }
.story-brand { position: relative; color: #fff; text-decoration: none; z-index: 1; }
.story-copy { position: relative; z-index: 1; max-width: 34rem; }
.story h1 { margin: .2rem 0 .7rem; color: #fff; font-size: clamp(2.1rem, 4vw, 3.5rem); line-height: 1.05; letter-spacing: -.03em; text-wrap: balance; }
.story h1 em { font-style: normal; color: var(--accent); }
.story-copy p { margin: 0 0 1.1rem; max-width: 38ch; color: #d5def2; }
.story ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.story li { display: flex; align-items: center; gap: .75rem; font-weight: 650; color: #fff; }
.story-badge { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: var(--accent); }
.still { position: relative; z-index: 1; height: 230px; margin-top: auto; display: none; }
.float-tile { font-weight: 700; }
.float-tile, .float-mark {
    position: absolute; display: grid; place-items: center;
    background: #f6efe2; color: var(--brand); border-radius: 18px;
    box-shadow: 0 14px 24px rgba(8, 16, 40, .28);
}
.float-ba { width: 78px; height: 78px; font-size: 2.6rem; right: 18%; top: 8px; animation: float-tile 5.5s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.float-alif { width: 64px; height: 64px; font-size: 2.3rem; left: 8%; bottom: 36px; animation: float-tile 6.5s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.float-mark { width: 54px; height: 54px; right: 4%; bottom: 18px; background: var(--accent); animation: float-tile 7s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.float-mark::before { content: ""; width: 18px; height: 3px; border-radius: 99px; background: #fff; transform: rotate(-40deg); }
.book-stack { position: absolute; left: 18%; bottom: 0; width: 250px; height: 190px; }
.book { position: absolute; border-radius: 14px; box-shadow: 0 16px 28px rgba(6, 12, 32, .35); }
.book-navy { width: 196px; height: 138px; left: 18px; top: 0; background: #2f5bff; color: #f6efe2; display: grid; place-items: center; font-size: 4.4rem; line-height: 1; transform: rotate(-8deg); }
.book-cream { width: 214px; height: 36px; left: 8px; bottom: 48px; background: #f6efe2; transform: rotate(-3deg); }
.book-cream::after { content: ""; position: absolute; left: 16px; right: 16px; top: 8px; height: 4px; border-radius: 99px; background: #e4d8c4; box-shadow: 0 10px 0 #e4d8c4; }
.book-orange { width: 228px; height: 46px; left: 0; bottom: 6px; background: var(--accent); }
@keyframes float-tile { from { translate: 0 0; } to { translate: 0 -14px; } }
@media (prefers-reduced-motion: reduce) {
    .float-ba, .float-alif, .float-mark { animation: none; }
}
.gate-pane { display: flex; justify-content: center; padding: 1rem 1rem 2rem; background: #f3efe6; }
.gate-card { width: min(100%, 520px); background: #fff; border-radius: 28px; padding: 1.6rem 1.5rem 1.3rem; box-shadow: 0 18px 40px rgba(22, 35, 63, .08); }
.gate-card h1 { display: flex; align-items: center; gap: .45rem; margin: 0 0 .35rem; font-size: 1.65rem; letter-spacing: -.02em; }
.spark { color: var(--accent); flex: none; width: 22px; height: 22px; }
.gate-card > .muted { margin: 0 0 .9rem; }
.gate-card .form { max-width: none; }
.field { position: relative; display: block; }
.field-icon { position: absolute; left: .85rem; top: 50%; translate: 0 -50%; color: var(--text-soft); pointer-events: none; }
.gate-card input[type=text], .gate-card input[type=password] {
    width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
    padding: .75rem .9rem .75rem 2.6rem; color: var(--ink); caret-color: var(--accent-dark);
}
.gate-card input::placeholder { color: var(--text-soft); opacity: 1; }
.gate-card ::selection { background: var(--accent-soft); color: var(--ink); }
.gate .audience-choice { grid-template-columns: 1fr; }
.gate .audience-choice label { display: flex !important; align-items: center; gap: .75rem; }
.gate .audience-choice input { position: static; opacity: 1; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: #2f6bff; flex: none; }
.gate .audience-choice span { border: 0; background: none; padding: 0; height: auto; }
.gate .audience-choice label { padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.gate .audience-choice label:has(input:checked) { background: #eef3ff; border-color: #8eb0ff; }
.gate .audience-choice input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gate .audience-choice .holder-badge {
    flex: none; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
}
.gate .audience-choice .holder-badge svg { width: 22px; height: 22px; }
.gate .holder-self .holder-badge { background: var(--brand); color: #fff; }
.gate .holder-child .holder-badge { background: var(--accent); color: var(--accent-ink); }
.gate .audience-choice label > span:last-child { flex: 1; min-width: 0; }
.gate .audience-choice small { color: var(--text-soft); }
.gate .audience-choice label.holder-self:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
.gate .audience-choice label.holder-child:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.gate .holder-self input { accent-color: var(--brand); }
.gate .holder-child input { accent-color: var(--accent-dark); }
.gate-card .notice { display: flex; gap: .7rem; align-items: flex-start; background: #eef5ff; }
.notice-mark { flex: none; width: 22px; height: 22px; color: #2f6bff; margin-top: .15rem; }
.gate-card .btn { width: 100%; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .85rem 1.2rem; }
.btn-arrow { flex: none; width: 18px; height: 18px; }
.gate-links { text-align: center; margin: .85rem 0 0; color: var(--text-soft); }
.gate-links a { font-weight: 700; }
@media (min-width: 980px) {
    .gate { height: 100dvh; grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr); }
    .story, .gate-pane { height: 100dvh; overflow: auto; }
    .story { padding: 2.2rem 2.6rem 1.6rem; }
    .still { display: block; }
    .gate-pane { align-items: center; padding: 2rem; }
    .gate-card { width: min(100%, 520px); }
}
@media (max-width: 979px) {
    .story ul { gap: .55rem; }
    .story-copy p { display: none; }
}
.auth .form { max-width: none; }
.auth .audience-choice { grid-template-columns: 1fr; }
.form label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.form small { font-weight: 400; }
.notice { background: var(--brand-soft); border-radius: 12px; padding: .8rem 1rem; }
.notice p { margin: 0 0 .5rem; }
.recovery-code { font: 700 1.5rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-align: center; background: var(--brand-soft); color: var(--brand); border: 2px dashed var(--brand); border-radius: 12px; padding: 1rem; user-select: all; }
.flash-good { background: var(--brand-soft); border-color: var(--brand); }
.flash p { margin: .2rem 0; }
.account-nav { display: flex; align-items: center; gap: 1rem; margin-left: auto; font-size: .9rem; }
.account-nav form { margin: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* Vitrine : la promesse, mise en avant */
.site-quote { padding: clamp(2.5rem, 7vw, 5rem) 16px; text-align: center; }
.site-quote blockquote { max-width: 820px; margin: 0 auto; position: relative; }
.site-quote blockquote::before { content: "«"; display: block; font-size: 4rem; line-height: .6; color: var(--accent); margin-bottom: .6rem; }
.site-quote p { margin: 0; font-size: clamp(1.4rem, 3.4vw, 2.2rem); line-height: 1.3; font-weight: 700; color: var(--brand); text-wrap: balance; }
.site-quote em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent) 62%); padding: 0 .1em; color: var(--ink); }

/* Page d'une lettre : la lettre seule n'a pas de voyelle au-dessus, inutile de lui laisser autant de place. */
.letter-page .giant { line-height: 1.3; margin: 0 0 2.4rem; }

/* Grille de lecture (leçons « Lire ») */
.reading-grid .grid-legend { background: var(--warn-soft); border-radius: var(--radius); padding: .5rem .9rem; }
.reading-grid .is-new { color: var(--warn); }
.grid-table { display: grid; gap: .5rem; margin: 1rem 0; }
.grid-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: .5rem; }
.grid-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 76px; padding: .2rem .4rem;
    font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.grid-cell .ar { font-size: calc(1.5rem * var(--ar-scale)); line-height: 1.6; }
.grid-cell:hover { border-color: var(--brand); }
.grid-cell.has-new { border-color: var(--warn); }
.grid-cell.is-right { background: var(--good-soft); border-color: var(--good); }
.grid-cell.is-wrong { background: var(--warn-soft); border-color: var(--warn); }
.grid-tr { display: none; font-size: .8rem; color: var(--muted); }
.reading-grid.show-reading .grid-tr { display: block; }
.reading-grid.is-game .grid-tr { display: none; }
.grid-repeat { display: none; }
.reading-grid.is-game .grid-repeat { display: inline-flex; }
.grid-status { min-height: 1.6em; font-weight: 600; }

/* Écrire à la main */
.write-forms { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; flex-direction: row-reverse; margin: .5rem 0; }
.write-forms div { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: .2rem .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.write-forms .ar { font-size: calc(1.8rem * var(--ar-scale)); }
.write-parts { display: flex; justify-content: center; align-items: center; gap: .6rem; flex-wrap: wrap; }
.write-part { font-size: calc(1.8rem * var(--ar-scale)); padding: 0 .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.write-pad { position: relative; width: 100%; max-width: 560px; height: 240px; margin: .8rem auto; background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.write-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.write-pad canvas:last-child { touch-action: none; cursor: crosshair; }
@media (max-width: 560px) {
    .grid-table, .grid-row { gap: .3rem; }
    .grid-row { grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); }
    .grid-cell { min-height: 60px; padding: .1rem; border-radius: 10px; }
    .grid-cell .ar { font-size: calc(1.15rem * var(--ar-scale)); }
}
