/*
 * Système de design « École Quiz » — univers enfants : espace élève, accès rapide, page
 * d'accueil publique et pages de connexion.
 *
 * Mobile d'abord : cibles tactiles >= 48 px, barre d'onglets en bas de l'écran sur téléphone,
 * aucune largeur fixe (pas de défilement horizontal), textes courts et gros.
 */

/* ================= Fond ================= */
body.area-kid {
    background:
        radial-gradient(circle at 8% 12%, rgba(255, 194, 60, .16) 0, transparent 26%),
        radial-gradient(circle at 92% 8%, rgba(33, 150, 243, .12) 0, transparent 24%),
        radial-gradient(circle at 85% 88%, rgba(226, 85, 192, .10) 0, transparent 26%),
        radial-gradient(circle at 10% 92%, rgba(20, 184, 138, .10) 0, transparent 24%),
        var(--c-bg);
    background-attachment: fixed;
}

.area-kid main {
    font-size: 1.05rem;
}

.kid-section {
    margin-bottom: 2.25rem;
}

.kid-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.kid-section-title h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
}

.kid-section-title a {
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

/* ================= En-têtes ================= */
.kid-topbar,
.public-header,
.play-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--c-line);
    backdrop-filter: saturate(1.4) blur(10px);
}

.kid-topbar-inner,
.public-header-inner,
.play-topbar-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 68px;
}

.kid-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 48px;
    color: var(--c-ink);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.kid-brand:hover {
    color: var(--c-primary-800);
}

.kid-nav {
    display: flex;
    gap: .35rem;
    margin: 0 auto;
}

.kid-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 48px;
    padding: .5rem 1.1rem;
    border-radius: var(--r-pill);
    color: var(--c-ink-soft);
    font-weight: 800;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.kid-nav-link .nav-emoji {
    font-size: 1.25rem;
}

.kid-nav-link:hover {
    background: var(--c-primary-50);
    color: var(--c-primary-800);
}

.kid-nav-link.is-active {
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 3px 0 var(--c-primary-800);
}

.kid-user {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.kid-nav + .kid-user {
    margin-left: 0;
}

.kid-avatar-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 48px;
    padding: .25rem .9rem .25rem .3rem;
    border: 2px solid var(--c-line);
    border-radius: var(--r-pill);
    background: var(--c-surface);
    color: var(--c-ink);
    font-weight: 800;
    text-decoration: none;
    max-width: 14rem;
}

.kid-avatar-chip:hover {
    border-color: var(--c-primary-200);
    color: var(--c-primary-800);
}

.kid-avatar-chip .chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 1.25rem;
}

/* Avatar rond coloré (emoji) */
.avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--tone-soft, var(--c-primary-100));
    box-shadow: inset 0 -4px 0 rgba(31, 27, 58, .06);
    font-size: 2.1rem;
    line-height: 1;
}

.avatar-sm {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
}

.avatar-lg {
    width: 96px;
    height: 96px;
    font-size: 3.2rem;
}

/* Barre d'onglets en bas (téléphone) */
.kid-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--c-line);
    box-shadow: 0 -6px 18px rgba(31, 27, 58, .06);
    backdrop-filter: blur(10px);
}

.kid-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    min-height: 56px;
    border-radius: 16px;
    color: var(--c-muted);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
}

.kid-tab .nav-emoji {
    font-size: 1.45rem;
    line-height: 1.1;
    transition: transform .2s var(--ease-bounce);
}

.kid-tab.is-active {
    background: var(--c-primary-100);
    color: var(--c-primary-800);
}

.kid-tab.is-active .nav-emoji {
    transform: translateY(-2px) scale(1.12);
}

@media (max-width: 767.98px) {
    body.has-tabbar main {
        padding-bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)) !important;
    }
}

/* En-tête du mode jeu (concentration : pas de menu) */
.play-topbar .play-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 1.1rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================= Mascotte ================= */
.mascot {
    display: block;
    width: 160px;
    height: auto;
    overflow: visible;
}

.mascot-float {
    animation: float 3.2s ease-in-out infinite;
}

.mascot-party .mascot-body {
    transform-origin: 80px 140px;
    animation: wiggle 1.2s ease-in-out 2;
}

.speech-bubble {
    position: relative;
    display: inline-block;
    padding: .8rem 1.1rem;
    border: 2px solid var(--c-line);
    border-radius: 20px;
    background: var(--c-surface);
    box-shadow: var(--sh-sm);
    font-weight: 800;
}

.speech-bubble::after {
    position: absolute;
    bottom: -10px;
    left: 28px;
    width: 18px;
    height: 18px;
    border-right: 2px solid var(--c-line);
    border-bottom: 2px solid var(--c-line);
    background: var(--c-surface);
    content: '';
    transform: rotate(45deg);
}

/* ================= Page d'accueil publique ================= */
.hero {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0 2rem;
}

@media (min-width: 992px) {
    .hero {
        grid-template-columns: 1.15fr .85fr;
        gap: 3rem;
        padding: 2.5rem 0 3rem;
    }
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .9rem;
    padding: .4rem .9rem;
    border-radius: var(--r-pill);
    background: var(--c-warning-soft);
    color: var(--c-warning);
    font-weight: 800;
}

.hero-title {
    margin-bottom: 1rem;
    font-size: clamp(2.1rem, 6vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.05;
}

.hero-title .hl {
    position: relative;
    color: var(--c-primary);
    white-space: nowrap;
}

.hero-title .hl::after {
    position: absolute;
    right: 0;
    bottom: .16em;
    left: -.05em;
    z-index: -1;
    height: .26em;
    border-radius: var(--r-pill);
    background: var(--c-sun);
    content: '';
    opacity: .7;
}

.hero-lead {
    max-width: 36rem;
    margin-bottom: 1.75rem;
    color: var(--c-ink-soft);
    font-size: 1.2rem;
    font-weight: 600;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
}

@media (max-width: 575.98px) {
    .hero-actions .btn {
        width: 100%;
    }
}

.hero-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 260px;
    order: -1;
}

@media (min-width: 992px) {
    .hero-art {
        min-height: 420px;
        order: 0;
    }
}

.hero-art .hero-blob {
    position: absolute;
    width: min(88vw, 400px);
    aspect-ratio: 1;
    border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
    background: linear-gradient(150deg, #ece8ff, #d9e9ff 55%, #ffeec2);
}

.hero-art .mascot {
    position: relative;
    width: min(56vw, 250px);
}

.hero-sticker {
    position: absolute;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--c-surface);
    box-shadow: var(--sh-md);
    font-size: 1.9rem;
    animation: float 4s ease-in-out infinite;
}

.hero-sticker.s1 { top: 6%; left: 8%; animation-delay: -.5s; }
.hero-sticker.s2 { top: 12%; right: 6%; animation-delay: -1.6s; }
.hero-sticker.s3 { bottom: 10%; left: 4%; animation-delay: -2.4s; }
.hero-sticker.s4 { right: 10%; bottom: 4%; animation-delay: -3.1s; }

@media (max-width: 575.98px) {
    .hero-sticker {
        width: 50px;
        height: 50px;
        border-radius: 16px;
        font-size: 1.5rem;
    }
}

/* Carte « J'ai un code » */
.code-card {
    position: relative;
    display: grid;
    gap: 1.25rem;
    align-items: center;
    overflow: hidden;
    padding: 1.75rem;
    border-radius: var(--r-xl);
    background: linear-gradient(135deg, var(--c-primary), #7b61ff 60%, #9b7bff);
    color: #fff;
    box-shadow: var(--sh-lg);
}

@media (min-width: 768px) {
    .code-card {
        grid-template-columns: 1fr auto;
        padding: 2.25rem 2.5rem;
    }
}

.code-card h2 {
    margin-bottom: .35rem;
    color: #fff;
    font-size: 1.7rem;
}

.code-card p {
    margin: 0;
    color: #efeaff;
    font-weight: 600;
}

.code-card::before {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    content: '';
}

.code-form {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.code-form .code-input {
    flex: 1 1 11rem;
}

@media (max-width: 575.98px) {
    .code-form .code-input {
        max-width: none;
    }

    .code-form .btn {
        width: 100%;
    }
}

/* Champ code à 4 chiffres : grand, espacé, lisible */
.code-input {
    width: 100%;
    max-width: 16rem;
    min-height: 64px;
    border: 3px solid var(--c-line);
    border-radius: 18px;
    background: var(--c-surface);
    color: var(--c-ink);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .5em;
    text-align: center;
    text-indent: .5em;
}

.code-input:focus {
    border-color: var(--c-sun);
    outline: none;
    box-shadow: 0 0 0 5px rgba(255, 194, 60, .45);
}

.code-input::placeholder {
    color: #c8c3dc;
    letter-spacing: .5em;
}

/* Étapes « comment ça marche » et cartes de fonctionnalités */
.step-card,
.feature-card {
    height: 100%;
    padding: 1.5rem;
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    background: var(--c-surface);
    box-shadow: var(--sh-sm);
}

.step-card .step-num {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: .75rem;
    border-radius: 50%;
    background: var(--tone-soft);
    color: var(--tone-ink);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
}

.step-card .step-emoji,
.feature-card .feature-emoji {
    float: right;
    font-size: 2rem;
    line-height: 1;
}

.step-card h3,
.feature-card h3 {
    margin-bottom: .35rem;
    font-size: 1.25rem;
    font-weight: 800;
}

.step-card p,
.feature-card p {
    margin: 0;
    color: var(--c-muted);
    font-weight: 600;
}

.feature-card .feature-emoji {
    display: grid;
    float: none;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: .9rem;
    border-radius: 18px;
    background: var(--tone-soft);
}

/* ================= Accueil élève ================= */
.welcome-card {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    overflow: hidden;
    padding: 1.5rem;
    border-radius: var(--r-xl);
    background: linear-gradient(135deg, #ffffff 0%, var(--tone-soft, var(--c-primary-100)) 100%);
    border: 1px solid var(--c-line);
    box-shadow: var(--sh-md);
}

@media (min-width: 768px) {
    .welcome-card {
        flex-wrap: nowrap;
        padding: 2rem 2.25rem;
    }
}

.welcome-card .welcome-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.welcome-card h1 {
    margin-bottom: .25rem;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
}

.welcome-card .welcome-class {
    color: var(--c-muted);
    font-weight: 700;
}

.welcome-card .mascot {
    width: 120px;
    margin-left: auto;
}

@media (max-width: 575.98px) {
    .welcome-card .mascot {
        display: none;
    }
}

/* Carte « continuer / commencer » */
.next-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border: 3px solid var(--tone, var(--c-primary));
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: 0 6px 0 var(--tone-soft, var(--c-primary-100)), var(--sh-md);
}

.next-card .next-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 24px;
    background: var(--tone-soft, var(--c-primary-100));
    font-size: 2.4rem;
}

.next-card .next-body {
    flex: 1 1 14rem;
    min-width: 0;
}

.next-card .next-kicker {
    color: var(--tone-ink, var(--c-primary-800));
    font-size: .85rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.next-card h2 {
    margin: .1rem 0 .25rem;
    font-size: 1.5rem;
    font-weight: 800;
}

@media (max-width: 575.98px) {
    .next-card .btn {
        width: 100%;
    }
}

/* Cartes matières */
.subject-card {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    height: 100%;
    padding: 1.25rem;
    border: 2px solid var(--c-line);
    border-bottom: 6px solid var(--tone);
    border-radius: var(--r-lg);
    background: var(--c-surface);
    color: var(--c-ink);
    text-decoration: none;
    transition: transform .2s var(--ease-bounce), box-shadow .2s ease, border-color .2s ease;
}

.subject-card:hover {
    border-color: var(--tone);
    color: var(--c-ink);
    box-shadow: var(--sh-lg);
    transform: translateY(-4px);
}

.subject-card .subject-icon {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--tone-soft);
    font-size: 2rem;
}

.subject-card .subject-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}

.subject-card .subject-meta {
    color: var(--c-muted);
    font-size: .9rem;
    font-weight: 700;
}

.mini-progress {
    height: 10px;
    overflow: hidden;
    border-radius: var(--r-pill);
    background: var(--tone-soft, var(--c-primary-100));
}

.mini-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--tone, var(--c-primary));
    transition: width .6s ease;
}

/* ================= Cartes quiz ================= */
.quiz-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 1.4rem 1.4rem 1.25rem;
    border: 2px solid var(--c-line);
    border-radius: var(--r-lg);
    background: var(--c-surface);
    box-shadow: var(--sh-sm);
    transition: transform .2s var(--ease-bounce), box-shadow .2s ease, border-color .2s ease;
}

.quiz-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 8px;
    background: var(--tone, var(--c-primary));
    content: '';
}

.quiz-card:hover {
    border-color: var(--tone, var(--c-primary));
    box-shadow: var(--sh-lg);
    transform: translateY(-4px);
}

.quiz-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}

.quiz-card .subject-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--tone-soft);
    font-size: 1.7rem;
}

.quiz-card-title {
    margin-bottom: .35rem;
    font-size: 1.3rem;
    font-weight: 800;
}

.quiz-card-desc {
    flex-grow: 1;
    margin-bottom: .9rem;
    color: var(--c-muted);
    font-size: .95rem;
    font-weight: 600;
}

.quiz-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.quiz-meta li {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .65rem;
    border-radius: var(--r-pill);
    background: #f4f2fb;
    color: var(--c-ink-soft);
    font-size: .85rem;
    font-weight: 800;
}

.status-new {
    background: var(--c-warning-soft);
    color: var(--c-warning);
}

.status-progress {
    background: var(--c-info-soft);
    color: var(--c-info);
}

/* ================= Écran de présentation d'un quiz ================= */
.quiz-stage {
    max-width: 780px;
    margin: 0 auto;
}

.intro-card {
    overflow: hidden;
    border: 2px solid var(--c-line);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--sh-md);
    text-align: center;
}

.intro-card .intro-head {
    padding: 2rem 1.5rem 1.5rem;
    background: linear-gradient(180deg, var(--tone-soft, var(--c-primary-100)), #fff);
}

.intro-card .intro-icon {
    display: inline-grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin-bottom: .75rem;
    border-radius: 28px;
    background: var(--c-surface);
    box-shadow: 0 6px 0 var(--tone, var(--c-primary)), var(--sh-md);
    font-size: 2.8rem;
}

.intro-card h1 {
    margin: .5rem 0;
    font-size: clamp(1.7rem, 5vw, 2.4rem);
    font-weight: 800;
}

.intro-card .intro-body {
    padding: 0 1.5rem 2rem;
}

.rule-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    margin: 1.5rem 0;
}

.rule-tile {
    padding: 1rem .75rem;
    border-radius: var(--r-md);
    background: #f7f5ff;
    font-weight: 700;
}

.rule-tile .rule-emoji {
    display: block;
    margin-bottom: .25rem;
    font-size: 1.8rem;
}

.rule-tile strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
}

/* ================= Passage du quiz ================= */
.play-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.play-progress .progress-count {
    flex: 0 0 auto;
    padding: .3rem .8rem;
    border-radius: var(--r-pill);
    background: var(--c-primary-100);
    color: var(--c-primary-800);
    font-weight: 900;
}

.progress-track {
    position: relative;
    flex: 1 1 auto;
    height: 14px;
    border-radius: var(--r-pill);
    background: #ddd6ff;
    box-shadow: inset 0 1px 2px rgba(31, 27, 58, .12);
}

.progress-track .progress-fill {
    height: 100%;
    min-width: 14px;
    border-radius: inherit;
    background: linear-gradient(90deg, #8c74ff, var(--c-primary));
    transition: width .6s ease;
}

.progress-track .progress-rocket {
    position: absolute;
    top: 50%;
    font-size: 1.4rem;
    line-height: 1;
    transform: translate(-50%, -55%);
    transition: left .6s ease;
}

.question-card {
    padding: 1.5rem;
    border: 2px solid var(--c-line);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--sh-md);
}

@media (min-width: 768px) {
    .question-card {
        padding: 2.25rem;
    }
}

.question-text {
    margin-bottom: 1.25rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 700;
    line-height: 1.35;
}

.question-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--r-md);
}

/* Minuteur */
.timer {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.25rem;
    padding: .5rem .75rem;
    border-radius: var(--r-pill);
    background: #f7f5ff;
}

.timer .timer-label {
    min-width: 3.5rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
    text-align: right;
}

.timer-bar {
    flex: 1 1 auto;
    height: 12px;
    overflow: hidden;
    border-radius: var(--r-pill);
    background: var(--c-line);
}

.timer-bar > div {
    height: 100%;
    border-radius: inherit;
    background: var(--c-mint);
    transition: width 1s linear, background-color .3s ease;
}

.timer-bar.is-warning > div { background: var(--c-sun); }
.timer-bar.is-danger > div { background: var(--c-coral); }

.timer:has(.timer-bar.is-danger) .timer-emoji {
    animation: wiggle .5s ease-in-out infinite;
}

/* Réponses : grandes tuiles avec lettre */
.answer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .answer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.answer-option {
    display: flex;
    align-items: center;
    gap: .9rem;
    width: 100%;
    height: 100%;
    min-height: 68px;
    padding: .85rem 1rem;
    border: 3px solid var(--c-line);
    border-radius: 20px;
    background: var(--c-surface);
    box-shadow: 0 4px 0 var(--c-line);
    color: var(--c-ink);
    font: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: start;
    transition: transform .12s ease, border-color .15s ease, background .15s ease, box-shadow .12s ease, opacity .2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button.answer-option {
    cursor: pointer;
}

button.answer-option:hover:not(:disabled) {
    border-color: var(--c-primary-200);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--c-line);
}

button.answer-option:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--c-line);
}

button.answer-option:focus-visible {
    outline: 3px solid var(--c-primary);
    outline-offset: 3px;
}

.answer-letter {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--tone-soft);
    color: var(--tone-ink);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
}

.answer-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.answer-check {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 3px solid var(--c-line-strong);
    border-radius: 50%;
    color: transparent;
    font-size: .95rem;
    font-weight: 900;
    transition: all .15s ease;
}

/* Réponse touchée, en cours d'envoi : les autres sont verrouillées (answer-choice) */
.is-locked button.answer-option {
    pointer-events: none;
}

.answer-option.is-pending {
    border-color: var(--c-primary);
    background: var(--c-primary-50);
    box-shadow: 0 4px 0 var(--c-primary-200);
    animation: bounce-in .3s var(--ease-bounce);
}

.answer-option.is-pending .answer-letter,
.answer-option.is-pending .answer-check {
    border-color: var(--c-primary);
    background: var(--c-primary);
    color: #fff;
}

button.answer-option:disabled {
    opacity: .55;
}

/* Correction : bouton « Question suivante » toujours visible sur téléphone */
.play-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

@media (max-width: 767.98px) {
    .play-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 0 -1.5rem -1.5rem;
        padding: .9rem 1.5rem calc(.9rem + env(safe-area-inset-bottom));
        border-radius: 0 0 var(--r-xl) var(--r-xl);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 30%);
    }

    .play-actions .btn {
        width: 100%;
    }
}

.play-hint {
    margin: 0;
    min-height: 1.5em;
    color: var(--c-muted);
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
}

/* ================= Résultat ================= */
.result-card {
    position: relative;
    overflow: hidden;
    padding: 2rem 1.5rem;
    border: 2px solid var(--c-line);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--sh-md);
    text-align: center;
}

@media (min-width: 768px) {
    .result-card {
        padding: 2.75rem;
    }
}

.result-card .mascot {
    width: 130px;
    margin: 0 auto .5rem;
}

.result-card h1 {
    font-size: clamp(1.5rem, 4.5vw, 2rem);
    font-weight: 800;
}

.score-ring {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 1rem auto;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring .ring-track {
    fill: none;
    stroke: #efecf9;
    stroke-width: 14;
}

.score-ring .ring-value {
    fill: none;
    stroke: var(--ring-color, var(--c-primary));
    stroke-dasharray: 339.29;
    stroke-dashoffset: var(--ring-offset, 339.29);
    stroke-linecap: round;
    stroke-width: 14;
    animation: ring-fill 1.2s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes ring-fill {
    from { stroke-dashoffset: 339.29; }
}

.score-ring .ring-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    font-family: var(--font-display);
    line-height: 1;
}

.score-ring .ring-score {
    font-size: 3.2rem;
    font-weight: 800;
}

.score-ring .ring-sub {
    margin-top: .2rem;
    color: var(--c-muted);
    font-size: .95rem;
    font-weight: 700;
}

.score-tier-high { --ring-color: var(--c-mint); }
.score-tier-mid { --ring-color: var(--c-sun); }
.score-tier-low { --ring-color: var(--c-coral); }

.result-stars {
    font-size: 2.6rem;
}

.result-stars .star {
    display: inline-block;
    animation: pop-in .5s var(--ease-bounce) both;
}

.result-stars .star:nth-child(2) { animation-delay: .15s; }
.result-stars .star:nth-child(3) { animation-delay: .3s; }

.result-message {
    max-width: 30rem;
    margin: .75rem auto 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .75rem;
    margin-top: 1.75rem;
}

@media (max-width: 575.98px) {
    .result-actions .btn,
    .result-actions form {
        width: 100%;
    }

    .result-actions form .btn {
        width: 100%;
    }
}

/* Confettis (contrôleur Stimulus « confetti ») */
.confetti-layer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow: hidden;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 3px;
    opacity: .95;
    animation: confetti-fall var(--dur, 2.8s) cubic-bezier(.25, .6, .4, 1) var(--delay, 0s) forwards;
}

@keyframes confetti-fall {
    to {
        transform: translate3d(var(--dx, 0), 105vh, 0) rotate(var(--rot, 540deg));
        opacity: .9;
    }
}

/* ================= Historique des scores ================= */
.score-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border: 2px solid var(--c-line);
    border-left: 6px solid var(--tone);
    border-radius: var(--r-md);
    background: var(--c-surface);
}

.score-row .subject-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--tone-soft);
    font-size: 1.5rem;
}

.score-row .score-row-body {
    flex: 1 1 auto;
    min-width: 0;
}

.score-row .score-row-title {
    display: block;
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-row .score-row-meta {
    color: var(--c-muted);
    font-size: .85rem;
    font-weight: 700;
}

.score-row .score-row-score {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: .25rem;
}

@media (max-width: 400px) {
    .score-row .subject-icon {
        display: none;
    }
}

/* ================= Choix du profil ================= */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    gap: 1.25rem;
    max-width: 920px;
    margin: 0 auto;
}

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: 1.75rem 1rem 1.5rem;
    border: 3px solid var(--c-line);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: 0 6px 0 var(--c-line);
    color: var(--c-ink);
    cursor: pointer;
    transition: transform .2s var(--ease-bounce), border-color .2s ease, box-shadow .2s ease;
}

.profile-card:hover,
.profile-card:focus-visible {
    border-color: var(--tone);
    box-shadow: 0 8px 0 var(--tone-soft), var(--sh-lg);
    transform: translateY(-6px);
}

.profile-card:active {
    transform: translateY(2px);
}

.profile-card.is-current {
    border-color: var(--tone);
}

.profile-card .profile-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
}

.profile-card .profile-class {
    padding: .2rem .75rem;
    border-radius: var(--r-pill);
    background: var(--tone-soft);
    color: var(--tone-ink);
    font-weight: 800;
}

/* ================= Pages de connexion ================= */
.auth-shell {
    display: grid;
    max-width: 1040px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--c-line);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    box-shadow: var(--sh-lg);
}

@media (min-width: 992px) {
    .auth-shell {
        grid-template-columns: 1fr 1fr;
        min-height: 560px;
    }
}

.auth-art {
    position: relative;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
    padding: 3rem;
    background: linear-gradient(150deg, #7b61ff, var(--c-primary) 55%, var(--c-primary-800));
    color: #fff;
}

@media (min-width: 992px) {
    .auth-art {
        display: flex;
    }
}

.auth-art h2 {
    color: #fff;
    font-size: 2.1rem;
    font-weight: 800;
}

.auth-art p {
    margin: 0;
    color: #e9e4ff;
    font-size: 1.1rem;
    font-weight: 600;
}

.auth-art .mascot {
    width: 190px;
    padding: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 30px rgba(31, 27, 58, .25);
}

.auth-art .auth-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.auth-art .auth-badges span {
    padding: .35rem .8rem;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-weight: 800;
}

.auth-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.5rem;
}

@media (min-width: 576px) {
    .auth-form {
        padding: 2.75rem 3rem;
    }
}

.auth-form .auth-mascot {
    width: 92px;
    margin: 0 auto .5rem;
}

@media (min-width: 992px) {
    .auth-form .auth-mascot {
        display: none;
    }
}

.auth-form h1 {
    font-size: 2rem;
    font-weight: 800;
}

.auth-narrow {
    max-width: 480px;
    margin: 0 auto;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0 1rem;
    color: var(--c-muted);
    font-size: .9rem;
    font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: var(--c-line);
    content: '';
}

/* ================= Pages d'erreur ================= */
.error-page {
    max-width: 560px;
    margin: 2rem auto;
    text-align: center;
}

.error-page .error-code {
    color: var(--c-primary);
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
}

.mascot-sm {
    width: 110px;
}

/* Tuiles de statistiques compactes en 3 colonnes sur téléphone (accueil, scores) */
@media (max-width: 575.98px) {
    .stat-row-compact .stat-tile {
        flex-direction: column;
        gap: .4rem;
        padding: .9rem .5rem;
        text-align: center;
    }

    .stat-row-compact .stat-tile .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }

    .stat-row-compact .stat-tile .stat-value {
        font-size: 1.45rem;
    }

    .stat-row-compact .stat-tile .stat-label {
        font-size: .78rem;
        line-height: 1.2;
    }
}

@media (max-width: 575.98px) {
    .rule-tile {
        padding: .75rem .35rem;
        font-size: .8rem;
        line-height: 1.25;
    }

    .rule-tile .rule-emoji {
        font-size: 1.4rem;
    }

    .rule-tile strong {
        font-size: 1.05rem;
    }

    .intro-body .btn-xl {
        width: 100%;
    }

    .intro-body form {
        width: 100%;
    }
}

/* Tablette (768–991 px) : menu élève sur une ligne */
.kid-nav-link {
    white-space: nowrap;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .kid-nav {
        gap: .15rem;
    }

    .kid-nav-link {
        padding: .5rem .75rem;
    }

    .kid-avatar-chip {
        padding-right: .5rem;
    }

    .kid-avatar-chip .chip-name {
        display: none !important;
    }
}

.play-topbar .play-title[dir="auto"] {
    text-align: left;
}

/* ================= Correction immédiate (décision client 2026-10-09) =================
 * Réponse choisie en vert si elle est juste, en rouge si elle est fausse ; la bonne réponse
 * n'est jamais révélée (les autres propositions restent neutres). */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.feedback-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--r-lg);
    background: #f4f2fb;
}

.feedback-banner .feedback-emoji {
    flex: none;
    font-size: 2.6rem;
    line-height: 1;
}

.feedback-banner .feedback-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 4vw, 1.6rem);
    font-weight: 800;
    line-height: 1.2;
}

.feedback-banner .feedback-text {
    margin: .2rem 0 0;
    font-weight: 700;
}

.feedback-card.is-correct {
    border-color: var(--c-mint);
}

.feedback-card.is-correct .feedback-banner {
    background: var(--c-success-soft);
    color: var(--c-success-700);
}

.feedback-card.is-correct .feedback-emoji {
    animation: pop-in .6s var(--ease-bounce) both;
}

.feedback-card.is-wrong {
    border-color: #f6b3b5;
}

.feedback-card.is-wrong .feedback-banner {
    background: var(--c-danger-soft);
    color: #9e1f23;
}

.feedback-card.is-timeout .feedback-banner {
    background: var(--c-warning-soft);
    color: var(--c-warning);
}

.answer-option.is-other {
    box-shadow: none;
    opacity: .55;
}

.answer-option.is-chosen-correct {
    border-color: var(--c-mint);
    background: var(--c-success-soft);
    box-shadow: 0 4px 0 #a8e2cf;
    color: var(--c-success-700);
    animation: bounce-in .5s var(--ease-bounce);
}

.answer-option.is-chosen-wrong {
    border-color: var(--c-coral);
    background: var(--c-danger-soft);
    box-shadow: 0 4px 0 #f6b3b5;
    color: #9e1f23;
    animation: shake .45s ease-in-out;
}

.answer-option.is-chosen-correct .answer-letter,
.answer-option.is-chosen-correct .answer-check {
    border-color: var(--c-success);
    background: var(--c-success);
    color: #fff;
}

.answer-option.is-chosen-wrong .answer-letter,
.answer-option.is-chosen-wrong .answer-check {
    border-color: var(--c-danger);
    background: var(--c-danger);
    color: #fff;
}

.answer-option.is-other .answer-check {
    visibility: hidden;
}

/* Chrono arrêté pendant la lecture de la correction (même hauteur que le chrono) */
.timer.is-paused {
    color: var(--c-muted);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
}

.feedback-actions .feedback-banner {
    width: 100%;
    margin: 0 0 .25rem;
    animation: pop-in .4s var(--ease-bounce) both;
}

@media (max-width: 767.98px) {
    .feedback-actions .feedback-banner {
        gap: .75rem;
        padding: .65rem .9rem;
    }

    .feedback-actions .feedback-emoji {
        font-size: 2rem;
    }

    .feedback-actions .feedback-text {
        font-size: .9rem;
    }
}

/* Résultat final : nombre de bonnes réponses sur le total, bien visible */
.result-tally {
    display: inline-flex;
    align-items: baseline;
    gap: .5rem;
    margin-top: .75rem;
    padding: .55rem 1.25rem;
    border-radius: var(--r-pill);
    background: var(--c-success-soft);
    color: var(--c-success-700);
    font-weight: 800;
}

.result-tally strong {
    font-family: var(--font-display);
    font-size: 1.9rem;
    line-height: 1;
}
