/* ========== Kogitas Role Chooser — WoodMart adapted ========== */

.kg-chooser-subtitle {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 18px;
}

/* SVG icon sizing */
.kg-svg-icon {
    width: 100%;
    height: 100%;
}

/* Type chooser cards */
.kg-type-chooser {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.kg-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px 22px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}

.kg-type-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: 14px;
}

.kg-type-btn--teacher::before {
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(124,58,237,0.06));
}

.kg-type-btn--student::before {
    background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(239,68,68,0.06));
}

.kg-type-btn:hover::before {
    opacity: 1;
}

.kg-type-btn--teacher:hover {
    border-color: #7c3aed;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
}

.kg-type-btn--student:hover {
    border-color: #f59e0b;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15);
}

.kg-type-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.kg-type-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kg-type-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
}

.kg-type-desc {
    font-size: 0.78rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.35;
}

/* Login link */
.kg-login-link {
    text-align: center;
    margin-top: 6px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.kg-login-link a {
    color: #6b7280;
    font-size: 0.88rem;
    text-decoration: none;
    transition: color 0.2s;
}

.kg-login-link a:hover {
    color: #7c3aed;
}

.kg-login-link a strong {
    color: #7c3aed;
    font-weight: 700;
}

/* Niveaux de classe (inscription enseignant) : cases a cocher en pastilles */
.kg-levels-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.kg-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kg-level {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.kg-level input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.kg-level span {
    padding: 7px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.kg-level:hover span {
    border-color: #7c3aed;
}

.kg-level input:checked + span {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #fff;
}

.kg-level input:focus-visible + span {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Error message */
.kg-auth-error {
    display: none;
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 14px;
    border: 1px solid #fecaca;
}

/* Back link */
.kg-back-link {
    text-align: center;
    margin-top: 10px;
}

.kg-back-link a {
    color: #7c3aed;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.kg-back-link a:hover {
    text-decoration: underline;
}

/* Success box */
.kg-success-box {
    text-align: center;
    padding: 30px 20px;
}

.kg-success-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.kg-success-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 6px;
}

.kg-success-box p {
    font-size: 0.9rem;
    color: #666;
}

/* ========== Sidebar specific ========== */
.kg-sidebar-register {
    padding: 20px 20px;
}

.kg-sidebar-register .kg-type-chooser {
    flex-direction: column;
    gap: 12px;
}

.kg-sidebar-register .kg-type-btn {
    flex-direction: row;
    padding: 16px 18px;
    gap: 14px;
    align-items: center;
}

.kg-sidebar-register .kg-type-icon {
    width: 44px;
    height: 44px;
}

.kg-sidebar-register .kg-type-text {
    align-items: flex-start;
}

.kg-sidebar-register .kg-type-desc {
    text-align: left;
}

.kg-sidebar-register .kg-chooser-subtitle {
    text-align: left;
    font-size: 1rem;
    margin-bottom: 14px;
}

.kg-side-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kg-side-title .kg-svg-icon {
    width: 24px;
    height: 24px;
}

.kg-side-submit {
    width: 100%;
}

/* ========== Mascot Student Code Box ========== */

.kg-mascot-box {
    background: linear-gradient(160deg, #1a1040 0%, #2d1b69 40%, #1e1145 100%);
    border-radius: 20px;
    padding: 20px 16px 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(139,92,246,0.25);
    box-shadow: 0 8px 32px rgba(99,102,241,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Subtle sparkle bg */
.kg-mascot-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(139,92,246,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(99,102,241,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.kg-mascot-scene {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

/* ---- Mascot character ---- */
.kg-mascot {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    position: relative;
}

.kg-mascot-body {
    width: 64px;
    height: 64px;
    background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 100%);
    border-radius: 50%;
    position: relative;
    margin: 8px auto 0;
    box-shadow: 0 4px 16px rgba(124,58,237,0.35);
    animation: kg-mascot-bob 3s ease-in-out infinite;
}

@keyframes kg-mascot-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Ears */
.kg-mascot-ears {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    display: flex;
    justify-content: space-between;
}

.kg-mascot-ear {
    width: 14px;
    height: 20px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: linear-gradient(145deg, #c4b5fd, #8b5cf6);
}

.kg-mascot-ear.left { transform: rotate(-15deg); }
.kg-mascot-ear.right { transform: rotate(15deg); }

/* Face */
.kg-mascot-face {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
}

/* Eyes */
.kg-mascot-eyes {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.kg-mascot-eye {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.kg-mascot-pupil {
    width: 8px;
    height: 8px;
    background: #1e1145;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.15s ease;
}

.kg-mascot-pupil::after {
    content: '';
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    right: 1px;
}

/* Mouth states */
.kg-mascot-mouth {
    width: 12px;
    height: 7px;
    margin: 0 auto;
    border-radius: 0 0 10px 10px;
    background: #4c1d95;
    transition: all 0.3s ease;
}

.kg-mascot-mouth.talking {
    animation: kg-mouth-talk 0.4s ease-in-out infinite;
}

@keyframes kg-mouth-talk {
    0%, 100% { height: 7px; width: 12px; border-radius: 0 0 10px 10px; }
    50% { height: 10px; width: 14px; border-radius: 50%; }
}

.kg-mascot-mouth.happy {
    width: 18px;
    height: 9px;
    border-radius: 0 0 12px 12px;
    background: #4c1d95;
}

.kg-mascot-mouth.wow {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4c1d95;
}

.kg-mascot-mouth.sad {
    width: 14px;
    height: 5px;
    border-radius: 10px 10px 0 0;
    background: #4c1d95;
    margin-top: 3px;
}

/* Cheeks */
.kg-mascot-cheeks {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 2px;
}

.kg-mascot-cheek {
    width: 8px;
    height: 5px;
    background: rgba(251,146,191,0.4);
    border-radius: 50%;
}

/* Eye blink */
@keyframes kg-blink {
    0%, 94%, 100% { transform: scaleY(1); }
    97% { transform: scaleY(0.1); }
}

.kg-mascot-eye {
    animation: kg-blink 4s ease-in-out infinite;
}

.kg-mascot-eye.right {
    animation-delay: 0.1s;
}

/* ---- Speech bubble ---- */
.kg-mascot-bubble {
    flex: 1;
    background: rgba(255,255,255,0.95);
    color: #1e1145;
    border-radius: 16px 16px 16px 4px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    min-height: 44px;
    display: flex;
    align-items: center;
    animation: kg-bubble-in 0.3s ease-out;
}

@keyframes kg-bubble-in {
    from { opacity: 0; transform: scale(0.9) translateX(-8px); }
    to { opacity: 1; transform: scale(1) translateX(0); }
}

.kg-mascot-bubble.error {
    background: rgba(254,202,202,0.95);
    color: #991b1b;
}

.kg-mascot-bubble.success {
    background: rgba(187,247,208,0.95);
    color: #166534;
}

.kg-mascot-bubble.loading {
    background: rgba(224,231,255,0.95);
    color: #3730a3;
}

/* ---- Floating stars ---- */
.kg-mascot-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.kg-mascot-star {
    position: absolute;
    font-size: 10px;
    opacity: 0.25;
    animation: kg-star-float 6s ease-in-out infinite;
}

.kg-mascot-star.s1 { top: 12%; right: 12%; animation-delay: 0s; }
.kg-mascot-star.s2 { top: 60%; right: 8%; animation-delay: 2s; font-size: 8px; }
.kg-mascot-star.s3 { bottom: 15%; left: 10%; animation-delay: 4s; font-size: 7px; }

@keyframes kg-star-float {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.2; }
    50% { transform: translateY(-6px) rotate(20deg); opacity: 0.5; }
}

/* ---- Input area ---- */
.kg-mascot-input-area {
    position: relative;
    z-index: 1;
}

.kg-mascot-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.kg-mascot-input {
    flex: 1;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(167,139,250,0.35);
    border-radius: 14px;
    padding: 12px 14px;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.kg-mascot-input::placeholder {
    color: rgba(167,139,250,0.5);
    font-weight: 600;
    letter-spacing: 3px;
    font-size: 14px;
}

.kg-mascot-input:focus {
    border-color: #a78bfa;
    background: rgba(255,255,255,0.18);
    box-shadow: 0 0 0 3px rgba(167,139,250,0.15);
}

.kg-mascot-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border: none;
    border-radius: 14px;
    padding: 10px 18px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
    white-space: nowrap;
    min-width: 80px;
}

.kg-mascot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245,158,11,0.4);
}

.kg-mascot-btn:active {
    transform: translateY(0);
}

.kg-mascot-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.kg-mascot-btn-text {
    font-size: 11px;
    line-height: 1;
}

.kg-mascot-btn-icon {
    font-size: 20px;
    line-height: 1;
}

/* Success explosion */
.kg-mascot-box.success-state {
    animation: kg-success-pulse 0.6s ease;
}

@keyframes kg-success-pulse {
    0% { box-shadow: 0 8px 32px rgba(99,102,241,0.2); }
    50% { box-shadow: 0 0 40px rgba(34,197,94,0.4), 0 0 80px rgba(34,197,94,0.15); }
    100% { box-shadow: 0 8px 32px rgba(34,197,94,0.25); }
}

/* Responsive */
@media (max-width: 480px) {
    .kg-type-chooser {
        flex-direction: column;
        gap: 10px;
    }

    .kg-type-btn {
        flex-direction: row;
        padding: 16px 14px;
        gap: 12px;
    }

    .kg-type-icon {
        width: 40px;
        height: 40px;
    }

    .kg-type-desc {
        text-align: left;
    }
}

/* Le bandeau « Lis tes livres hors connexion » (plugin lecteur) passait au-dessus
   du panneau latéral sur mobile et masquait le bouton « C'est parti ! ». */
#kog-app-banner { z-index: 499 !important; }

/* ── Modale élève : programme par jeu (repli) et titres ── */
.kgsm-game-block { margin-bottom: 18px; }
.kgsm-game-title { display: flex; align-items: center; gap: 8px; color: #f1f5f9; font-weight: 800; font-size: 1.05em; margin: 0 0 8px; }
.kgsm-game-title small { color: #94a3b8; font-weight: 600; font-size: 12px; }
.kgsm-theme { color: #a5b4fc; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 6px; }
.kgsm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kgsm-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 7px 10px; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #e2e8f0; cursor: pointer; transition: transform .12s, border-color .12s; }
.kgsm-chip:hover { transform: translateY(-2px); border-color: #a78bfa; }
.kgsm-chip--done { border-color: rgba(74,222,128,0.5); background: rgba(74,222,128,0.08); }
.kgsm-chip--perfect { border-color: #fbbf24; background: rgba(251,191,36,0.1); }
.kgsm-chip--next { border-color: #f97316; box-shadow: 0 0 0 3px rgba(249,115,22,0.25); }
.kgsm-chip-num { font-weight: 800; font-size: 15px; }
.kgsm-chip-stars { font-size: 9px; letter-spacing: 1px; }
.kgsm-chip-title { font-size: 10px; color: #94a3b8; max-width: 92px; text-align: center; line-height: 1.2; }
.kgsm-resume { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 14px; }
.kgsm-resume-btn { background: linear-gradient(135deg,#f97316,#ef4444); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 6px 18px rgba(249,115,22,0.35); }
.kgsm-resume-btn:hover { transform: translateY(-1px); }
.kgsm-seq-sub { display: block; font-size: 11px; color: #94a3b8; font-weight: 500; }
/* Les boutons du thème (fond blanc, capitales) écrasaient le style des pastilles :
   on fixe explicitement l'apparence sombre et les états. */
.kgsm-chip, .kgsm-chip:hover { background: rgba(255,255,255,0.07) !important; color: #e2e8f0 !important; border: 1px solid rgba(255,255,255,0.14) !important; text-transform: none !important; box-shadow: none !important; }
.kgsm-chip--done, .kgsm-chip--done:hover { border-color: rgba(74,222,128,0.6) !important; background: rgba(74,222,128,0.1) !important; }
.kgsm-chip--perfect, .kgsm-chip--perfect:hover { border-color: #fbbf24 !important; background: rgba(251,191,36,0.12) !important; }
.kgsm-chip--next, .kgsm-chip--next:hover { border-color: #f97316 !important; box-shadow: 0 0 0 3px rgba(249,115,22,0.3) !important; }
.kgsm-chip-title { text-transform: none !important; color: #94a3b8 !important; }
.kgsm-chip-num { color: #f1f5f9 !important; }

/* Formulaire parent (panneau et page Mon compte) : prénom et nom côte à côte,
   consentement ; masqués quand un code de groupe est saisi (kg-register.js). */
.kg-reg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.kg-reg-two[hidden],
.kg-reg-consent[hidden] { display: none; }
@media (max-width: 380px) { .kg-reg-two { grid-template-columns: 1fr; } }
.kg-reg-consent { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; font-size: 13px; line-height: 1.45; cursor: pointer; }
.kg-reg-consent input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: #f97316; }
.kg-reg-consent a { text-decoration: underline; }
