/**
 * assets/css/guest.css v1.0.0 — Korence Maths
 * Accès sans compte : bouton « Essayer », fenêtre prénom/classe, écrans de limite, bandeau du menu,
 * espace parent réduit. Mêmes couleurs que le reste du plugin (violet #7c3aed, bleu nuit #1e1b4b).
 */
.kmg-start, .kmg-start *, .kmg-wall, .kmg-wall *, .kmg-modal, .kmg-modal *, .kmg-space, .kmg-space *,
.kmg-toast, .kmg-toast *, .kmg-banner, .kmg-banner * { box-sizing: border-box; }

html.kmg-lock { overflow: hidden; }

/* ── Boutons et liens ── */
.kmg-btn {
    all: unset; box-sizing: border-box; cursor: pointer; text-align: center;
    display: block; width: 100%; padding: 15px 22px; border-radius: 999px;
    font: 800 1.05rem/1.2 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff; text-decoration: none;
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.kmg-btn-go  { background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 6px 0 rgba(76,29,149,.35); }
.kmg-btn-alt { background: linear-gradient(135deg, #0ea5e9, #38bdf8); box-shadow: 0 6px 0 rgba(3,105,161,.3); }
.kmg-btn:hover { filter: brightness(1.06); }
.kmg-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.kmg-btn:focus-visible, .kmg-link:focus-visible { outline: 4px solid rgba(124,58,237,.4); outline-offset: 3px; }
.kmg-btn[disabled], .kmg-btn.kmg-busy { opacity: .65; pointer-events: none; }
.kmg-btn[hidden], .kmg-link[hidden] { display: none !important; }
.kmg-sm { padding: 10px 16px; font-size: .92rem; display: inline-block; width: auto; }
.kmg-link {
    all: unset; box-sizing: border-box; cursor: pointer; display: inline-block; text-align: center;
    color: #6d28d9; font: 700 .95rem/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-decoration: underline; text-underline-offset: 3px; padding: 6px 4px;
}
.kmg-fine { margin: 6px 0 0; font-size: .8rem; line-height: 1.4; color: #64748b; }
.kmg-err  { margin: 6px 0 0; min-height: 1px; font-size: .9rem; font-weight: 700; color: #dc2626; line-height: 1.4; }
.kmg-err:empty { display: none; }
.kmg-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Bloc d'entrée ── */
.kmg-start { display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: center; margin-top: 8px; }
.kmg-start .kmg-fine { text-align: center; }

/* ── Fenêtre (prénom / classe, écrans de limite) ── */
.kmg-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.kmg-modal[hidden] { display: none !important; }
.kmg-modal-bg { position: absolute; inset: 0; background: rgba(15,12,41,.62); }
.kmg-panel {
    position: relative; width: 100%; max-width: 400px; max-height: 92vh; max-height: 92dvh; overflow: auto;
    background: #fff; color: #1e1b4b; border-radius: 28px; padding: 26px 22px 20px;
    display: flex; flex-direction: column; gap: 10px; text-align: center;
    box-shadow: 0 24px 70px rgba(15,12,41,.5); animation: kmg-pop .28s cubic-bezier(.34,1.56,.64,1) both;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.kmg-panel-ico { font-size: 3rem; line-height: 1; }
.kmg-h  { margin: 0; font: 800 1.4rem/1.2 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1e1b4b; }
.kmg-p  { margin: 0; font-size: .98rem; line-height: 1.5; color: #475569; }

/* ── Champs ── */
.kmg-field { display: block; text-align: left; margin: 0; }
.kmg-lbl { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 800; color: #334155; }
.kmg-lbl em { font-style: normal; font-weight: 600; color: #64748b; }
.kmg-help { display: block; margin-top: 5px; font-size: .78rem; line-height: 1.35; color: #64748b; }
.kmg-field input[type=text], .kmg-field input[type=email], .kmg-field input[type=tel], .kmg-field input[type=password], .kmg-field select {
    width: 100%; height: 50px; padding: 0 14px; margin: 0; display: block;
    border: 2px solid #e2e8f0; border-radius: 14px; background: #f8fafc; color: #1e1b4b;
    font: 600 1rem/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-appearance: none; appearance: none;
}
.kmg-field select {
    background-image: linear-gradient(45deg, transparent 50%, #7c3aed 50%), linear-gradient(135deg, #7c3aed 50%, transparent 50%);
    background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
.kmg-field input:focus, .kmg-field select:focus { outline: 0; border-color: #7c3aed; box-shadow: 0 0 0 4px rgba(124,58,237,.18); background: #fff; }
.kmg-pass { position: relative; display: block; }
.kmg-pass input { padding-right: 52px !important; }
.kmg-eye { all: unset; cursor: pointer; position: absolute; right: 6px; top: 6px; width: 38px; height: 38px; text-align: center; line-height: 38px; font-size: 1.1rem; border-radius: 10px; }
.kmg-check { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: .84rem; line-height: 1.4; color: #475569; margin: 4px 0 8px; }
.kmg-check input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: #7c3aed; }

/* ── Écran plein page (limite, entrée sur une page de jeu) ── */
.kmg-wall {
    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, #0f0c29, #302b63 55%, #24243e);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.kmg-wall-card {
    width: 100%; max-width: 420px; background: #fff; border-radius: 28px; padding: 30px 24px 22px;
    display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 24px 70px rgba(15,12,41,.45);
}
.kmg-wall-ico { font-size: 3.4rem; line-height: 1; }
.kmg-wall-card .kmg-link { align-self: center; }

/* ── Petit message en bas d'écran ── */
.kmg-toast {
    position: fixed; z-index: 99990; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    width: calc(100% - 24px); max-width: 440px; padding: 14px 16px; border-radius: 20px;
    background: #1e1b4b; color: #fff; box-shadow: 0 14px 40px rgba(15,12,41,.5);
    animation: kmg-up .3s cubic-bezier(.34,1.3,.64,1) both;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.kmg-toast-txt { margin: 0 0 10px; font-size: .92rem; line-height: 1.45; }
.kmg-toast-row { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.kmg-toast .kmg-link { color: #c4b5fd; }

/* ── Bandeau du menu ── */
.kmg-banner {
    position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; text-decoration: none;
    max-width: 560px; margin: 4px auto 14px; padding: 11px 14px; border-radius: 20px;
    background: rgba(255,255,255,.94); color: #3b2f63; box-shadow: 0 6px 0 rgba(0,0,0,.12);
    font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.kmg-banner-ico { flex: none; font-size: 1.6rem; }
.kmg-banner-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.kmg-banner-txt b { font-size: .98rem; }
.kmg-banner-txt small { font-size: .78rem; color: #6b5f93; }
.kmg-banner-go { flex: none; padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, #7c3aed, #a855f7); white-space: nowrap; }
.kmg-banner:hover .kmg-banner-go { filter: brightness(1.08); }

/* ── Espace parent réduit ── */
.kmg-space {
    --kmg-p: #7c3aed; --kmg-text: #1e1b4b; --kmg-mut: #64748b;
    max-width: 640px; margin: 0 auto; padding: 18px 14px calc(40px + env(safe-area-inset-bottom, 0px));
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--kmg-text);
}
.kmg-hero {
    display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; margin-bottom: 14px; padding: 18px;
    border-radius: 24px; color: #fff; background: linear-gradient(135deg, #0f0c29, #302b63 60%, #4c1d95);
}
.kmg-hero-av { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; background: rgba(255,255,255,.14); }
.kmg-hero .kmg-p { color: rgba(255,255,255,.82); }
.kmg-h1 { margin: 0 0 2px; font-size: 1.3rem; font-weight: 900; color: #fff; line-height: 1.2; }
.kmg-tag { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 3px 9px; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: #fbbf24; color: #422006; }
.kmg-back { grid-column: 1 / -1; justify-self: start; margin-top: 6px; color: #ddd6fe; font-weight: 700; font-size: .9rem; text-decoration: none; }
.kmg-card { margin-bottom: 14px; padding: 18px 16px; border-radius: 22px; background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 4px 18px rgba(15,12,41,.06); }
.kmg-h2 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 900; color: var(--kmg-text); }
.kmg-card .kmg-p { margin-bottom: 12px; }
.kmg-card .kmg-btn { margin-top: 6px; }
.kmg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.kmg-row .kmg-btn, .kmg-row .kmg-err { grid-column: 1 / -1; }
.kmg-form { display: flex; flex-direction: column; gap: 14px; }

.kmg-range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 999px; margin: 14px 0 4px; background: linear-gradient(90deg, #4ade80, #facc15 55%, #f87171); outline: 0; }
.kmg-range::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 5px solid var(--kmg-p); box-shadow: 0 3px 10px rgba(15,12,41,.3); cursor: pointer; }
.kmg-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 5px solid var(--kmg-p); box-shadow: 0 3px 10px rgba(15,12,41,.3); cursor: pointer; }
.kmg-range:focus-visible { box-shadow: 0 0 0 4px rgba(124,58,237,.3); }
.kmg-ticks { display: flex; justify-content: space-between; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--kmg-mut); }
.kmg-ticks span { flex: 1; text-align: center; }
.kmg-ticks span:first-child { text-align: left; }
.kmg-ticks span:last-child  { text-align: right; }
.kmg-lvl { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: #f5f3ff; }
.kmg-lvl-tag { margin: 0 0 6px; font-weight: 800; color: #4c1d95; }
.kmg-lvl-lines { margin: 0; padding-left: 18px; font-size: .88rem; line-height: 1.5; color: #475569; }
.kmg-status { margin: 8px 0 0; min-height: 1.2em; font-size: .85rem; font-weight: 700; color: #059669; }

.kmg-perks { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.kmg-perks li { position: relative; padding-left: 28px; font-size: .93rem; line-height: 1.45; color: #334155; }
.kmg-perks li::before { content: '✔'; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; text-align: center; line-height: 20px; font-size: .75rem; font-weight: 900; color: #fff; background: #10b981; }
.kmg-claim { border: 2px solid #c4b5fd; background: linear-gradient(180deg, #faf5ff, #fff 40%); }
.kmg-claim .kmg-fine { margin-top: 12px; text-align: center; }
.kmg-claim .kmg-fine a { color: #6d28d9; font-weight: 700; }
.kmg-bar { height: 12px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin: 6px 0 10px; }
.kmg-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c3aed, #a855f7); }

@keyframes kmg-pop { from { opacity: 0; transform: scale(.9) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes kmg-up  { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .kmg-panel, .kmg-toast { animation: none; } .kmg-btn { transition: none; } }
@media (max-width: 420px) { .kmg-row { grid-template-columns: 1fr; } }
