/* Quizz SSI - charte CREPS : bleu #0e77bd, orange #f15a29, Arial. */
:root {
    --bleu: #0e77bd;
    --bleu-fonce: #0a5a8f;
    --bleu-nuit: #094c79;
    --orange: #f15a29;
    --vert: #1a7f37;
    --rouge: #b3261e;
    --encre: #1b1f24;
    --gris: #55606b;
    --fond: #eef3f7;
    --trait: #d3dbe3;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--encre);
    background: var(--fond);
    display: flex;
    flex-direction: column;
}
button, a { font: inherit; }
button { cursor: pointer; }
a { color: var(--bleu-fonce); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- en-tête (quizz et page de suivi) ----------
   Le bandeau commun aux applications du CREPS (astreinte+, scrutin+, AED...) : bleu nuit,
   filet orange, logo blanc, semis d'hexagones à droite. Sur une ligne : la marque,
   les actions de jeu, la progression, les outils. */
.barre {
    position: relative;
    z-index: 2;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 10px 20px;
    background: var(--bleu-nuit);
    color: #fff;
    border-bottom: 3px solid var(--orange);
}
.barre::before, .barre::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
    background: url("images/hexagones-bandeau.svg") no-repeat right center / auto 100%;
}
.barre::after { right: 0; width: min(70%, 640px); opacity: 0.55; }
.barre::before { left: 0; width: min(25%, 260px); transform: scaleX(-1); opacity: 0.14; }
.barre > * { position: relative; z-index: 1; }      /* par-dessus les hexagones */
.barre :focus-visible { outline-color: #fff; }       /* l'orange ne ressort pas assez sur le bleu nuit */
.barre > img { display: block; width: auto; height: 42px; }
.barre .titre { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.35); line-height: 1.25; white-space: nowrap; }
.barre h1 { margin: 0; font-size: 1.1rem; letter-spacing: -0.02em; }
.barre .titre p { margin: 0; font-size: 0.79rem; color: rgba(255, 255, 255, 0.82); }

.barre nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.barre nav:only-of-type { margin-left: auto; }
.barre nav button, .barre nav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 13px;
    background: transparent;
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-size: 0.89rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}
.barre nav button:hover, .barre nav a:hover { background: rgba(255, 255, 255, 0.18); }
/* Une seule action mise en avant, la séance express : la pastille blanche des autres applications. */
.barre nav .vedette { margin-right: 4px; padding: 0 16px; background: #fff; color: var(--bleu-nuit); }
.barre nav .vedette:hover { background: #dcebf6; }
.jeu { margin-left: 8px; }
/* Les outils sont regroupés sur un fond plein : ils restent lisibles par-dessus les hexagones. */
.outils { padding: 3px; background: rgba(9, 76, 121, 0.88); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; }
.barre .outils button, .barre .outils a { min-height: 34px; font-weight: 400; }

.reserve { position: absolute; width: 0; height: 0; }
.icone { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Compteur d'un bouton : bleu en cours, vert quand tout est trouvé, orange s'il reste des erreurs à revoir. */
.pastille {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e7f1f9;
    color: var(--bleu-fonce);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.pastille.fait { background: #e6f4ea; color: var(--vert); }
.pastille.alerte { background: #ffe9df; color: #a83a12; }
.pastille.vide { background: #f0f2f4; color: var(--gris); }

/* La jauge de sécurité du bureau, qui ouvre « Ma progression ». */
.avancement {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 12px;
    align-items: baseline;
    width: 210px;
    margin-left: auto;
    padding: 6px 12px 8px;
    background: rgba(9, 76, 121, 0.88);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
    transition: border-color 0.15s, background-color 0.15s;
}
.avancement:hover { border-color: #fff; background: var(--bleu); }
.avancement output { font-variant-numeric: tabular-nums; }
.avancement progress { grid-column: 1 / -1; width: 100%; height: 6px; }
.avancement progress, .avancement progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.3); }
.avancement progress::-webkit-progress-value { background: #fff; }
.avancement progress::-moz-progress-bar { background: #fff; }

progress {
    appearance: none;
    height: 10px;
    border: 0;
    border-radius: 999px;
    background: #dfe7ee;
    overflow: hidden;
}
progress::-webkit-progress-bar { background: #dfe7ee; }
progress::-webkit-progress-value { background: var(--vert); }
progress::-moz-progress-bar { background: var(--vert); }

/* ---------- le bureau ---------- */
#bureau {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(#d6e8f5, #f4f7fa);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#etiquettes { position: absolute; inset: 0; pointer-events: none; }

.etiquette {
    position: absolute;
    transform: translate(-50%, calc(-100% - 8px));
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: var(--bleu-fonce);
    border: 2px solid var(--bleu);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
.etiquette::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--bleu);
}
.etiquette small { font-weight: 400; color: var(--gris); }
.etoiles { color: var(--orange); letter-spacing: 1px; }
.etiquette.maitrise { border-color: var(--vert); color: var(--vert); }
.etiquette.maitrise::after { border-top-color: var(--vert); }
.etiquette:hover, .etiquette:focus-visible { background: var(--bleu); color: #fff; z-index: 1; }
.etiquette:hover small, .etiquette:focus-visible small,
.etiquette:hover .etoiles, .etiquette:focus-visible .etoiles { color: #fff; }
/* Thème sans objet dans la scène : son étiquette reste accessible, en haut à gauche. */
.etiquette.hors-scene { position: static; transform: none; margin: 10px; display: inline-flex; }
.etiquette.hors-scene::after { display: none; }

#aide {
    position: absolute;
    left: 12px;
    bottom: 12px;
    max-width: 430px;
    margin: 0;
    background: rgba(255, 255, 255, 0.93);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.aide-liste { display: none; }
#vues { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
#vues button {
    background: #fff;
    color: var(--bleu-fonce);
    border: 2px solid var(--bleu);
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 0.85rem;
}
#bulle {
    position: absolute;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    margin: 0;
    max-width: min(540px, 90%);
    background: var(--encre);
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
#alerte {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    margin: 0;
    z-index: 10;
    background: var(--rouge);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
}

/* ---------- vue liste (sans 3D, ou au choix de l'agent) ---------- */
.liste #scene, .liste #vues, .liste .aide-3d { display: none; }
.liste .aide-liste { display: inline; }
.liste #bureau { overflow: auto; }
.liste #etiquettes {
    position: static;
    pointer-events: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}
.liste .etiquette, .liste .etiquette[hidden] {
    position: static !important;
    transform: none;
    display: flex !important;
    justify-content: space-between;
    margin: 0;
    border-radius: 12px;
    padding: 18px 16px;
    font-size: 1rem;
    white-space: normal;
}
.liste .etiquette::after { display: none; }
.liste #aide { position: static; max-width: 960px; margin: 20px auto 0; }
.sans-3d #b-vue { display: none; }

/* ---------- panneau (questions, mails, progression) ---------- */
dialog {
    border: 0;
    border-radius: 16px;
    padding: 0;
    width: min(700px, 94vw);
    max-height: 92vh;
    color: var(--encre);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(10, 30, 50, 0.55); }
dialog > header {
    background: var(--bleu);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}
dialog h2 { flex: 1; margin: 0; font-size: 1.1rem; }
dialog h3 { margin: 18px 0 8px; font-size: 1rem; }
.fermer {
    width: 36px;
    height: 36px;
    background: transparent;
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 1.2rem;
}
.fermer:hover { background: rgba(255, 255, 255, 0.2); }
.corps { position: relative; overflow: auto; padding: 18px 20px 22px; line-height: 1.45; }
.corps p { margin: 0 0 10px; }

.compteur { color: var(--gris); font-size: 0.88rem; }
.question { font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.intro { font-size: 1.05rem; }
.options { display: grid; gap: 8px; }
.option {
    text-align: left;
    background: #fff;
    color: var(--encre);
    border: 2px solid var(--trait);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.35;
}
.option:hover:not(:disabled) { border-color: var(--bleu); background: #f2f8fc; }
.option:disabled { cursor: default; color: var(--encre); }
.option.juste { border-color: var(--vert); background: #e6f4ea; font-weight: 700; }
.option.juste::before { content: "✓ "; color: var(--vert); }
.option.faux { border-color: var(--rouge); background: #fdecea; }
.option.faux::before { content: "✗ "; color: var(--rouge); }

.retour { margin-top: 16px; }
.retour:empty { display: none; }
.verdict { font-size: 1.05rem; font-weight: 700; }
.verdict.ok { color: var(--vert); }
.verdict.ko { color: var(--rouge); }
.pirate {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f3f1ee;
    border-radius: 12px;
    padding: 8px 12px;
    font-style: italic;
}
.pirate .tete { font-size: 1.7rem; font-style: normal; }
.pirate b { font-style: normal; }
.retenir {
    background: #fff4ee;
    border-left: 4px solid var(--orange);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.principal, .secondaire { border-radius: 10px; padding: 11px 18px; font-size: 1rem; font-weight: 700; }
.principal { background: var(--bleu); color: #fff; border: 2px solid var(--bleu); }
.principal:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); }
.secondaire { background: #fff; color: var(--bleu-fonce); border: 2px solid var(--bleu); }
.secondaire:hover { background: #f2f8fc; }
.source { margin-top: 18px; color: var(--gris); font-size: 0.9rem; }
.score { font-size: 2.6rem; font-weight: 700; color: var(--bleu); line-height: 1.1; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin: 12px 0; }
.chiffres p { margin: 0; background: var(--fond); border-radius: 10px; padding: 10px 8px; text-align: center; color: var(--gris); font-size: 0.85rem; }
.chiffres b { display: block; font-size: 1.3rem; color: var(--bleu); }
.regles { padding-left: 20px; }
.regles li { margin-bottom: 8px; }

.ligne { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--trait); }
.ligne progress { grid-column: 1 / -1; width: 100%; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.badges li { background: #fff4ee; border: 1px solid var(--orange); border-radius: 999px; padding: 5px 12px; font-size: 0.9rem; font-weight: 700; }
.badges li.verrou { background: #f0f2f4; border-color: var(--trait); color: var(--gris); font-weight: 400; }
.failles { list-style: none; margin: 0; padding: 0; }
.failles li { padding: 10px 0; border-bottom: 1px solid var(--trait); }
.failles .trouvee b { color: var(--vert); }
.failles summary { cursor: pointer; }

/* ---------- faux mails ---------- */
.boite { list-style: none; margin: 0; padding: 0; border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; }
.ligne-mail {
    display: grid;
    grid-template-columns: 22px minmax(0, 170px) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    text-align: left;
    background: #fff;
    color: var(--encre);
    border: 0;
    border-bottom: 1px solid var(--trait);
    padding: 11px 12px;
}
.ligne-mail:hover { background: #f2f8fc; }
.ligne-mail span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-mail .de { font-weight: 700; }
.ligne-mail .ok { color: var(--vert); }
.ligne-mail .ko { color: var(--rouge); }
.contexte { background: var(--fond); border-radius: 8px; padding: 8px 12px; font-size: 0.93rem; }
.mail { border: 1px solid var(--trait); border-radius: 10px; padding: 6px; margin-bottom: 12px; }
.entete-mail { border-bottom: 1px solid var(--trait); margin-bottom: 6px; padding-bottom: 4px; }
.zone {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--encre);
    border: 1px dashed transparent;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.98rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.zone:hover { border-color: var(--bleu); background: #f2f8fc; }
.zone.lien { color: #0b57d0; text-decoration: underline; }
.zone.pj::before { content: "📎 "; }
.zone.suspect { background: #fff0e8; border: 1px solid var(--orange); }
.zone.ras { background: #f0f2f4; border: 1px solid var(--trait); }
.corps .pourquoi { margin: 3px 8px 8px; color: var(--gris); font-size: 0.88rem; overflow-wrap: anywhere; }

/* ---------- confettis d'un sans-faute ---------- */
.confettis { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confettis i { position: absolute; top: -14px; width: 8px; height: 14px; animation: chute 2.6s linear forwards; }
@keyframes chute { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confettis { display: none; } }

/* ---------- page de connexion ---------- */
.page-connexion { background: var(--bleu); align-items: center; justify-content: center; padding: 20px; }
.carte-connexion {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 16px;
    padding: 44px 36px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.carte-connexion .logo { height: 80px; }
.carte-connexion h1 { margin: 16px 0 6px; font-size: 2rem; }
.sous-titre { color: var(--gris); margin: 0 0 30px; }
.bouton-connexion {
    display: block;
    background: var(--orange);
    color: #fff;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 1.2rem; /* 19 px gras = « grand texte » RGAA : contraste 3:1 suffisant sur l'orange */
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(241, 90, 41, 0.3);
}
.bouton-connexion:hover { background: #d94f22; }
.infos { margin-top: 30px; padding-top: 24px; border-top: 1px solid #eee; color: var(--gris); font-size: 0.88rem; line-height: 1.45; }

/* ---------- page de suivi ---------- */
.page-suivi { display: block; }
.suivi { max-width: 1100px; margin: 0 auto; padding: 20px; }
.suivi h2 { margin: 28px 0 10px; font-size: 1.15rem; color: var(--bleu-fonce); }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tuiles p { margin: 0; background: #fff; border-radius: 12px; padding: 16px; color: var(--gris); }
.tuiles b { display: block; font-size: 2rem; color: var(--bleu); }
.suivi table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.suivi th, .suivi td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--trait); }
.suivi th { background: #e3ecf3; font-size: 0.88rem; }
.suivi small, .note { color: var(--gris); font-size: 0.9rem; }
.suivi meter { width: 110px; vertical-align: middle; }
.suivi details ul { margin: 6px 0 0; padding-left: 18px; }
.suivi table.etroit { width: auto; min-width: min(420px, 100%); }
.bouton {
    display: inline-block;
    background: var(--bleu);
    color: #fff;
    border-radius: 10px;
    padding: 9px 16px;
    margin: 0 8px 8px 0;
    font-weight: 700;
    text-decoration: none;
}
.bouton:hover { background: var(--bleu-fonce); }
svg.activite { display: block; width: 100%; background: #fff; border-radius: 12px; padding: 12px; }
.activite rect { fill: var(--bleu); }
.activite rect:hover { fill: var(--orange); }
.activite line { stroke: var(--trait); }
details.tout { margin-top: 28px; }
details.tout > summary { cursor: pointer; margin-bottom: 10px; font-size: 1.15rem; font-weight: 700; color: var(--bleu-fonce); }

/* Écran moyen : les outils se réduisent à leur pictogramme. Le libellé reste lu
   par les lecteurs d'écran, et s'affiche au survol. */
@media (max-width: 1500px) {
    .outils span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .barre { gap: 8px 12px; }
    .barre nav button, .barre nav a { padding: 0 9px; }
    .barre nav .vedette { padding: 0 13px; }
    .jeu { margin-left: 0; }
    .avancement { width: 170px; }
}
/* Écran étroit : les actions de jeu passent sur une seconde ligne. */
@media (max-width: 1240px) {
    .jeu { order: 1; flex-basis: 100%; margin: 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.25); }
}
@media (max-width: 720px) {
    .barre { padding: 8px 12px; }
    .barre > img { height: 32px; }
    .barre .titre { padding-left: 10px; }
    .avancement { flex: 1; width: auto; min-width: 150px; }
    .ligne-mail { grid-template-columns: 22px minmax(0, 1fr); }
    .ligne-mail .objet { grid-column: 2; }
    #aide { right: 12px; max-width: none; bottom: 52px; }
}
