/* parot.css : styles communs du site parot.corsica (mobile d'abord) */

:root {
    --parot-primaire: #4f46e5;
    --parot-primaire-clair: #eef2ff;
    --parot-texte: #1e293b;
    --parot-doux: #64748b;
    --parot-bord: #e2e8f0;
    --parot-fond: #f4f6fb;
    --parot-ok: #10b981;
    --parot-alerte: #f59e0b;
    --parot-clavier-h: 0px;
}

html.parot, html.parot body {
    overscroll-behavior: none;          /* pas de « tirer pour actualiser » */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
html.parot body {
    touch-action: manipulation;         /* pas de zoom au double tap */
    -webkit-touch-callout: none;        /* pas de menu à l'appui long */
    -webkit-user-select: none;
    user-select: none;
    max-width: 100vw;
    overflow-x: hidden;
}
html.parot [data-clavier="natif"],
html.parot [data-clavier="natif"] * {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}
html.parot img { -webkit-user-drag: none; }

/* Place réservée sous la page quand le clavier visuel est ouvert */
body.parot-clavier-ouvert { padding-bottom: calc(var(--parot-clavier-h) + 8px) !important; }

/* Champs pilotés par le clavier visuel */
.parot-champ { caret-color: transparent; cursor: pointer; }
.parot-champ.parot-focus {
    outline: 3px solid var(--parot-primaire) !important;
    outline-offset: 1px;
}

/* ------------------------------------------------------------ clavier visuel */
.parot-clavier {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
    background: #d1d5db;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .18);
    transform: translateY(110%);
    transition: transform .18s ease-out;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.parot-clavier.visible { transform: translateY(0); }
.parot-clavier:not(.visible) .parot-masquer { display: none; }
.parot-rangee { display: flex; gap: 4px; margin-bottom: 5px; justify-content: center; }
.parot-rangee:last-of-type { margin-bottom: 0; }
.parot-touche {
    flex: 1 1 0; min-width: 0; max-width: 64px; height: 44px;
    border: none; border-radius: 7px; background: #fff; color: #111827;
    font-size: 20px; font-weight: 600; line-height: 1;
    box-shadow: 0 1px 0 #9ca3af;
    touch-action: manipulation; cursor: pointer; padding: 0;
}
.parot-touche:active { background: #c7d2fe; transform: translateY(1px); }
.parot-touche.fonction { background: #e5e7eb; font-size: 16px; }
.parot-touche.actif { background: var(--parot-primaire); color: #fff; }
.parot-touche.large { flex: 4 1 0; max-width: none; font-size: 15px; color: #6b7280; }
.parot-touche.ok { flex: 1.6 1 0; max-width: 110px; background: var(--parot-ok); color: #fff; font-size: 17px; }
.parot-masquer {
    position: absolute; top: -26px; right: 8px; width: 44px; height: 26px;
    border: none; border-radius: 8px 8px 0 0; background: #d1d5db; color: #374151;
    font-size: 16px; cursor: pointer;
}
@media (min-width: 700px) {
    .parot-clavier { padding-left: calc(50vw - 330px); padding-right: calc(50vw - 330px); }
}

/* ------------------------------------------------------------ fenêtres */
.parot-overlay {
    position: fixed; inset: 0; z-index: 9500;
    background: rgba(15, 23, 42, .62);
    display: flex; align-items: center; justify-content: center;
    padding: 12px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.parot-boite {
    width: 100%; max-width: 380px; max-height: 92vh; overflow-y: auto;
    background: #fff; border-radius: 22px; padding: 18px 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3); text-align: center;
    color: var(--parot-texte);
}
.parot-boite.parot-large { max-width: 560px; text-align: left; }
.parot-titre { margin: 0 0 14px; font-size: 21px; font-weight: 800; text-align: center; }
.parot-enfants { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.parot-enfant {
    border: 3px solid #c7d2fe; background: #fff; color: var(--parot-primaire);
    border-radius: 18px; padding: 16px 4px 10px; cursor: pointer;
    font-size: 28px; font-weight: 900; line-height: 1;
}
.parot-enfant small { display: block; font-size: 13px; color: #b45309; margin-top: 8px; font-weight: 700; }
.parot-enfant.actif { background: var(--parot-primaire); color: #fff; border-color: var(--parot-primaire); }
.parot-enfant.actif small { color: #e0e7ff; }
.parot-test {
    width: 100%; border: 2px dashed #cbd5e1; background: #f8fafc; color: var(--parot-doux);
    border-radius: 14px; padding: 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.parot-menu { display: flex; flex-direction: column; gap: 8px; }
.parot-menu-btn {
    width: 100%; border: 1px solid var(--parot-bord); background: #f8fafc; color: var(--parot-texte);
    border-radius: 14px; padding: 13px 14px; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.parot-menu-btn:active { background: var(--parot-primaire-clair); }
.parot-fermer { margin-top: 12px; text-align: center; }
.parot-onglets { display: flex; gap: 6px; margin-bottom: 10px; }
.parot-onglets button {
    flex: 1; border: 2px solid #c7d2fe; background: #fff; color: var(--parot-primaire);
    border-radius: 12px; padding: 8px; font-weight: 800; font-size: 16px; cursor: pointer;
}
.parot-onglets button.actif { background: var(--parot-primaire); color: #fff; }
.parot-liste { font-size: 14px; }
.parot-total { font-weight: 800; margin: 4px 0 10px; }
.parot-vide { color: var(--parot-doux); text-align: center; padding: 18px 0; }
.parot-ligne {
    display: flex; justify-content: space-between; gap: 10px;
    border-bottom: 1px solid var(--parot-bord); padding: 8px 2px;
}
.parot-ligne small { display: block; color: var(--parot-doux); font-size: 12px; margin-top: 2px; }
.parot-revoir { color: #b45309; font-size: 12px; margin-top: 3px; }
.parot-score { text-align: right; font-weight: 800; white-space: nowrap; font-size: 13px; }

/* Verrou plein écran */
.parot-verrou { background: rgba(30, 27, 75, .94); cursor: pointer; }
.parot-verrou-contenu { color: #fff; text-align: center; font-size: 22px; font-weight: 800; }
.parot-verrou-icone { font-size: 64px; margin-bottom: 12px; animation: parot-pulse 1.2s infinite; }
@keyframes parot-pulse { 50% { transform: scale(1.15); } }

/* Toast */
.parot-toast {
    position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); z-index: 9800;
    transform: translate(-50%, -150%); transition: transform .25s ease;
    background: #1e1b4b; color: #fff; padding: 10px 16px; border-radius: 999px;
    font: 700 15px system-ui, -apple-system, sans-serif; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    max-width: 92vw; text-align: center; pointer-events: none;
}
.parot-toast.visible { transform: translate(-50%, 0); }

/* Badge enfant pour un exercice ouvert hors du portail */
.parot-badge-flottant {
    position: fixed; top: calc(6px + env(safe-area-inset-top)); right: 6px; z-index: 8000;
    border: none; background: rgba(79, 70, 229, .92); color: #fff;
    border-radius: 999px; padding: 5px 10px; font: 800 13px system-ui, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2); cursor: pointer;
}
.parot-appui { animation: parot-appui 1.5s linear; }
@keyframes parot-appui { from { box-shadow: 0 0 0 0 rgba(245, 158, 11, .9); } to { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); } }
