/**
 * assets/css/auth.css v1.1.0 — Korence Maths
 * Page de connexion, écran de schéma, barre de sécurité du portail.
 * Mêmes couleurs que l'espace parent (violet #7c3aed, héros bleu nuit).
 */
.kma-wrap, .kma-wrap *, .kma-modal, .kma-modal *, .kma-bar, .kma-bar *, .kma-welcome, .kma-welcome * { box-sizing: border-box; }

.kma-wrap {
    --kma-a: #0f0c29; --kma-b: #302b63; --kma-c: #24243e;
    --kma-p: #7c3aed; --kma-p2: #a855f7; --kma-text: #1e1b4b; --kma-mut: #64748b;
    --kma-line: #e2e8f0; --kma-err: #dc2626; --kma-ok: #059669;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 28px 16px calc(28px + env(safe-area-inset-bottom, 0px));
    background: radial-gradient(1200px 600px at 10% -10%, rgba(168,85,247,.35), transparent 60%),
                radial-gradient(900px 500px at 110% 110%, rgba(6,182,212,.25), transparent 60%),
                linear-gradient(135deg, var(--kma-a), var(--kma-b) 55%, var(--kma-c));
    color: var(--kma-text);
}
.kma-card {
    width: 100%; max-width: 440px;
    background: #fff; border-radius: 26px;
    padding: 28px 24px 22px;
    box-shadow: 0 24px 70px rgba(15,12,41,.45);
    position: relative;
}
.kma-brand { text-align: center; margin-bottom: 18px; }
.kma-logo, .kma-lock-ico {
    width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 24px;
    display: flex; align-items: center; justify-content: center; font-size: 40px;
    background: linear-gradient(135deg, #ede9fe, #e0f2fe);
    box-shadow: inset 0 -4px 0 rgba(124,58,237,.15);
}
.kma-title { margin: 0 0 4px; font-size: 1.45rem; font-weight: 900; color: var(--kma-text); text-align: center; line-height: 1.2; }
.kma-sub   { margin: 0; font-size: .95rem; color: var(--kma-mut); text-align: center; line-height: 1.45; }
.kma-text  { margin: 0 0 14px; font-size: .95rem; color: #334155; line-height: 1.45; }

/* ── Onglets ── */
.kma-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    background: #f1f5f9; border-radius: 16px; padding: 4px; margin-bottom: 18px;
}
.kma-tab {
    all: unset; box-sizing: border-box; text-align: center; cursor: pointer;
    padding: 11px 8px; border-radius: 12px;
    font: 800 .92rem/1.2 inherit; color: var(--kma-mut);
    transition: background .15s, color .15s, box-shadow .15s;
}
.kma-tab.on { background: #fff; color: var(--kma-p); box-shadow: 0 2px 10px rgba(15,12,41,.1); }
.kma-tab:focus-visible { outline: 3px solid rgba(124,58,237,.35); }

/* ── Champs ── */
.kma-pane[hidden] { display: none !important; }
.kma-field { display: block; margin-bottom: 14px; }
.kma-lbl { display: block; font-size: .85rem; font-weight: 800; color: #334155; margin-bottom: 6px; }
.kma-lbl em { font-style: normal; font-weight: 600; color: var(--kma-mut); }
.kma-field input[type=text], .kma-field input[type=email], .kma-field input[type=tel], .kma-field input[type=password] {
    width: 100%; height: 50px; padding: 0 14px;
    border: 2px solid var(--kma-line); border-radius: 14px; background: #f8fafc;
    font: 600 1rem inherit; color: var(--kma-text);
    transition: border-color .15s, background .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.kma-field input:focus { outline: none; border-color: var(--kma-p); background: #fff; box-shadow: 0 0 0 4px rgba(124,58,237,.12); }
.kma-help { display: block; margin-top: 5px; font-size: .78rem; color: var(--kma-mut); line-height: 1.35; }
.kma-pass { position: relative; display: block; }
.kma-pass input { padding-right: 52px !important; }
.kma-eye {
    all: unset; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; cursor: pointer; font-size: 1.1rem;
}
.kma-eye:hover { background: #eef2ff; }
.kma-check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: .85rem; color: #334155; line-height: 1.4; cursor: pointer; }
.kma-check input { width: 20px; height: 20px; flex: 0 0 20px; margin: 1px 0 0; accent-color: var(--kma-p); }
.kma-check-sm { font-size: .8rem; margin: 10px 0 0; text-align: left; }
.kma-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ── Boutons ── */
.kma-btn {
    all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 54px; padding: 12px 18px; border-radius: 16px;
    font: 900 1.02rem/1.2 inherit; text-align: center; cursor: pointer;
    transition: transform .08s, box-shadow .08s, opacity .15s;
}
.kma-btn-primary {
    color: #fff; background: linear-gradient(135deg, var(--kma-p, #7c3aed), var(--kma-p2, #a855f7));
    box-shadow: 0 5px 0 #5b21b6, 0 10px 24px rgba(124,58,237,.3);
}
.kma-btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 #5b21b6; }
.kma-btn:disabled, .kma-btn.kma-busy { opacity: .6; cursor: default; }
.kma-link {
    all: unset; display: block; margin: 14px auto 0; cursor: pointer; text-align: center;
    font: 800 .9rem inherit; color: var(--kma-p, #7c3aed);
}
.kma-link:hover { text-decoration: underline; }
a.kma-link { display: block; }

/* ── Messages ── */
.kma-alert { border-radius: 14px; padding: 11px 14px; margin-bottom: 14px; font-size: .88rem; font-weight: 700; line-height: 1.4; }
.kma-alert-err  { background: #fef2f2; color: #b91c1c; border: 2px solid #fecaca; }
.kma-alert-ok   { background: #ecfdf5; color: #047857; border: 2px solid #a7f3d0; }
.kma-alert-info { background: #eef2ff; color: #4338ca; border: 2px solid #c7d2fe; }

/* ════════════════════════════════════════════════════════════
   ÉCRAN DE SCHÉMA
════════════════════════════════════════════════════════════ */
.kma-lockcard { text-align: center; max-width: 400px; }
.kma-lock-stage { margin: 18px auto 6px; max-width: 290px; }
.kma-lock-msg { min-height: 1.5em; margin: 8px 0 0; font-size: .92rem; font-weight: 800; color: var(--kma-mut, #64748b); line-height: 1.35; }
.kma-msg-err  { color: #dc2626; }
.kma-msg-ok   { color: #059669; }
.kma-msg-info { color: #4338ca; }
.kma-lock-foot { margin-top: 4px; }
/* « Retour au menu des jeux » : gros bouton vert en relief, bien visible pour l'enfant.
   « important » partout : le thème WordPress ne doit pas pouvoir recolorer ni souligner ce lien. */
a.kma-link.kma-back {
    position: relative; box-sizing: border-box !important; overflow: hidden;
    display: flex !important; align-items: center; justify-content: center; gap: 10px;
    width: 100%; min-height: 62px; margin: 26px 0 8px !important; padding: 14px 20px;
    border: 0 !important; border-radius: 20px; cursor: pointer;
    font-family: inherit; font-size: 1.2rem !important; font-weight: 900 !important; line-height: 1.2; letter-spacing: .2px; text-align: center;
    color: #fff !important; text-decoration: none !important; text-shadow: 0 2px 0 rgba(6,78,59,.45);
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 48%, #16a34a 100%) !important;
    box-shadow: 0 8px 0 #166534, 0 14px 22px rgba(22,101,52,.38), inset 0 2px 0 rgba(255,255,255,.45) !important;
    transition: transform .1s, box-shadow .1s, filter .15s;
    -webkit-tap-highlight-color: transparent;
}
a.kma-link.kma-back::before {          /* reflet brillant sur le haut du bouton */
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 46%; pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0));
    border-radius: 20px 20px 60% 60%;
}
a.kma-link.kma-back:hover, a.kma-link.kma-back:focus-visible {
    color: #fff !important; text-decoration: none !important; filter: brightness(1.07); transform: translateY(-2px);
    box-shadow: 0 10px 0 #166534, 0 18px 26px rgba(22,101,52,.4), inset 0 2px 0 rgba(255,255,255,.45) !important;
}
a.kma-link.kma-back:focus-visible { outline: 4px solid rgba(34,197,94,.45); outline-offset: 3px; }
a.kma-link.kma-back:active {
    color: #fff !important; transform: translateY(6px);
    box-shadow: 0 2px 0 #166534, 0 4px 8px rgba(22,101,52,.3), inset 0 2px 0 rgba(255,255,255,.35) !important;
}
.kma-forgot { text-align: left; }
.kma-steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.kma-step { font-size: .75rem; font-weight: 800; padding: 5px 11px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; }
.kma-step.on   { background: #ede9fe; color: #6d28d9; }
.kma-step.done { background: #d1fae5; color: #047857; }

@keyframes kmaShake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(4px)} 30%,50%,70%{transform:translateX(-8px)} 40%,60%{transform:translateX(8px)} }
.kma-shake { animation: kmaShake .45s both; }

/* ── Grille 3×3 (pattern-lock.js) ── */
.kpl {
    position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 290px; margin: 0 auto;
    border-radius: 24px; background: linear-gradient(160deg, #1e1b4b, #312e81);
    box-shadow: inset 0 2px 12px rgba(0,0,0,.35), 0 10px 26px rgba(30,27,75,.25);
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    cursor: pointer;
}
.kpl-svg { display: block; width: 100%; height: 100%; }
.kpl-halo { fill: rgba(255,255,255,.06); transition: fill .15s, r .15s; }
.kpl-core { fill: #c7d2fe; transition: fill .15s, r .12s; }
.kpl-on .kpl-halo { fill: rgba(167,139,250,.28); }
.kpl-on .kpl-core { fill: #fff; r: 13px; }
.kpl-seg, .kpl-live { stroke: #a78bfa; stroke-width: 9; stroke-linecap: round; }
.kpl-live { stroke-opacity: .55; }
.kpl-error .kpl-seg, .kpl-error .kpl-live { stroke: #f87171; }
.kpl-error .kpl-on .kpl-core { fill: #fca5a5; }
.kpl-error .kpl-on .kpl-halo { fill: rgba(248,113,113,.3); }
.kpl-success .kpl-seg { stroke: #34d399; }
.kpl-success .kpl-on .kpl-core { fill: #6ee7b7; }
.kpl-success .kpl-on .kpl-halo { fill: rgba(52,211,153,.3); }
.kpl-shake { animation: kmaShake .45s both; }
.kpl-disabled { opacity: .45; pointer-events: none; }
/* Tracé masqué : on ne montre ni les traits ni les points touchés */
.kpl-hidden .kpl-seg, .kpl-hidden .kpl-live { stroke: transparent; }
.kpl-hidden .kpl-on .kpl-core { fill: #c7d2fe; r: 11px; }
.kpl-hidden .kpl-on .kpl-halo { fill: rgba(255,255,255,.06); }
.kpl-hidden.kpl-error .kpl-on .kpl-core { fill: #fca5a5; }

/* ── Pavé PIN ── */
.kpp { max-width: 280px; margin: 0 auto; }
.kpp-dots { display: flex; justify-content: center; gap: 12px; margin: 4px 0 16px; min-height: 18px; }
.kpp-dot { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #a5b4fc; transition: background .12s, transform .12s; }
.kpp-dot.kpp-on { background: #6d28d9; border-color: #6d28d9; transform: scale(1.1); }
.kpp-error .kpp-dots { animation: kmaShake .45s both; }
.kpp-error .kpp-dot.kpp-on { background: #ef4444; border-color: #ef4444; }
.kpp-success .kpp-dot.kpp-on { background: #10b981; border-color: #10b981; }
.kpp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpp-key {
    all: unset; box-sizing: border-box; height: 62px; border-radius: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font: 800 1.6rem inherit; color: #1e1b4b; background: #f1f5ff;
    box-shadow: 0 4px 0 #c7d2fe; -webkit-tap-highlight-color: transparent;
}
.kpp-key:active { transform: translateY(4px); box-shadow: 0 0 0 #c7d2fe; }
.kpp-del { background: #fff7ed; color: #c2410c; box-shadow: 0 4px 0 #fdba74; font-size: 1.35rem; }
.kpp-ok  { background: #16a34a; color: #fff; box-shadow: 0 4px 0 #15803d; }
.kpp-ok:disabled { opacity: .35; cursor: default; }
.kpp-disabled { opacity: .45; pointer-events: none; }

/* ════════════════════════════════════════════════════════════
   PORTAIL OUVERT : barre de sécurité, bienvenue, fenêtre, toast
════════════════════════════════════════════════════════════ */
.kma-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; background: #1e1b4b; color: #e0e7ff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: sticky; top: 0; z-index: 50;
}
.admin-bar .kma-bar { top: 32px; }
.kma-bar-state { font-size: .85rem; font-weight: 800; }
.kma-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.kma-bar-btn {
    all: unset; box-sizing: border-box; cursor: pointer; padding: 8px 12px; border-radius: 10px;
    font: 800 .82rem/1 inherit; color: #e0e7ff; background: rgba(255,255,255,.1);
    text-decoration: none !important;
}
.kma-bar-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.kma-bar-lock { background: #fbbf24; color: #1e1b4b; }
.kma-bar-lock:hover { background: #f59e0b; color: #1e1b4b; }

.kma-welcome {
    margin: 16px; padding: 18px; border-radius: 20px; background: #fff; border: 2px solid #ede9fe;
    box-shadow: 0 6px 22px rgba(15,12,41,.08); text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.kma-welcome p { margin: 0 0 14px; font-weight: 700; color: #334155; }
.kma-welcome .kma-btn { max-width: 320px; margin: 0 auto; }
.kma-bar + .kma-alert, .kma-welcome + .kma-alert { margin: 12px 16px; }

.kma-modal {
    position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15,12,41,.72); backdrop-filter: blur(3px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-y: auto;
}
.kma-close {
    all: unset; position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: #f1f5f9; color: #475569; font-weight: 900;
}
.kma-noscroll { overflow: hidden; }
.kma-toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 100001;
    transform: translate(-50%, 20px); opacity: 0; transition: .25s;
    background: #1e1b4b; color: #fff; padding: 12px 18px; border-radius: 14px; font: 800 .9rem sans-serif;
    box-shadow: 0 10px 30px rgba(15,12,41,.35);
}
.kma-toast.on { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 480px) {
    .kma-card { padding: 22px 16px 18px; border-radius: 22px; }
    .kma-bar-state { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    a.kma-link.kma-back { transition: none; }
    .kma-shake, .kpl-shake, .kpp-error .kpp-dots { animation: none; }
}
