:root {
  color-scheme: light dark;
  --fond: #f3f6fb; --carte: #ffffff; --texte: #13213a; --doux: #5b6b85; --bleu: #1a5db4; --bleu-nuit: #0a2a5a;
  --ambre: #f4b942; --ok: #1b7f4b; --erreur: #b3261e; --bord: #d9e2f1;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #0f1626; --carte: #182238; --texte: #e8edf5; --doux: #9aa7bc; --bord: #2a3752; --ok: #4fc182; --erreur: #f0665c; }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--fond); color: var(--texte); font: 16px/1.5 Roboto, "Segoe UI", system-ui, sans-serif; padding-bottom: 24px; }
.bandeau { background: var(--bleu-nuit); color: #fff; font-size: 12.5px; text-align: center; padding: 8px 14px; letter-spacing: .2px; }
.ecran { max-width: 520px; margin: 0 auto; padding: 22px 20px 10px; display: flex; flex-direction: column; align-items: stretch; }
[hidden] { display: none !important; }
h1 { font-size: 24px; line-height: 1.2; margin: 14px 0 6px; letter-spacing: -.2px; }
h2 { font-size: 19px; margin: 12px 0 6px; }
.texte { color: var(--doux); margin: 0 0 14px; }
.petit { color: var(--doux); font-size: 13px; margin: 6px 0; }
.surtitre { margin: 10px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--doux); }
.etapes { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; }
.etapes li { display: flex; align-items: center; gap: 12px; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 10px 12px; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--bleu); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.prerequis { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.prerequis li { display: flex; gap: 12px; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 12px; }
.prerequis .ico { font-size: 22px; line-height: 1; flex: none; margin-top: 2px; }
.prerequis b { display: block; margin-bottom: 2px; }
.prerequis p { margin: 0; color: var(--doux); font-size: 14px; }
.conseils { list-style: none; padding: 0; margin: 0 0 18px; color: var(--doux); font-size: 14.5px; display: grid; gap: 6px; }
.etat-module { text-align: center; min-height: 20px; margin: 0 0 4px; }
.btn { width: 100%; min-height: 54px; border: 0; border-radius: 16px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; margin-top: 8px; }
.btn.principal { background: var(--bleu); color: #fff; }
.btn.secondaire { background: var(--carte); color: var(--texte); border: 1px solid var(--bord); font-weight: 600; }
.btn.lien { background: transparent; color: var(--bleu); font-weight: 600; min-height: 44px; }
.btn:disabled { opacity: .55; }
.illustration { display: flex; justify-content: center; padding: 10px 0 4px; }
.illustration.petite .cadre-visage { width: 110px; height: 140px; }
.cadre-visage { position: relative; width: 150px; height: 190px; border-radius: 50% / 45%; border: 3px solid var(--bleu); overflow: hidden; background: radial-gradient(circle at 50% 40%, rgba(26,93,180,.14), transparent 70%); }
.visage { position: absolute; left: 50%; top: 52%; width: 70px; height: 92px; margin: -46px 0 0 -35px; border-radius: 50% 50% 46% 46%; background: linear-gradient(180deg, var(--ambre), #e3a428); opacity: .9; }
.balayage { position: absolute; left: -10%; right: -10%; height: 3px; background: var(--bleu); box-shadow: 0 0 12px var(--bleu); animation: balayer 2.2s ease-in-out infinite; }
@keyframes balayer { 0% { top: 8%; } 50% { top: 88%; } 100% { top: 8%; } }
.phase { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 30px; }
.rond-attente { width: 84px; height: 84px; border-radius: 50%; background: var(--carte); border: 1px solid var(--bord); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--bord); border-top-color: var(--bleu); border-radius: 50%; animation: tourner .9s linear infinite; }
@keyframes tourner { to { transform: rotate(360deg); } }
.rond-resultat { width: 92px; height: 92px; margin: 26px auto 8px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 48px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rond-resultat.refuse, .rond-resultat.erreur { background: var(--erreur); }
.rond-resultat.neutre { background: var(--bleu); }
#ecranResultat, #ecranErreur { text-align: center; }
.repli { margin-top: 10px; padding: 12px; border: 1px dashed var(--bord); border-radius: 14px; text-align: left; }
.retour { margin: 10px 0 4px; padding: 12px 14px; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; text-align: left; }
.retour .surtitre { margin-top: 0; }
.ident { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--bord); }
.ident:first-child { border-top: 0; }
.ident .cle { grid-column: 1; font-size: 12px; color: var(--doux); }
.ident .val { grid-column: 1; font-family: ui-monospace, Consolas, "Roboto Mono", monospace; font-size: 14.5px; word-break: break-all; user-select: all; -webkit-user-select: all; }
.ident .btn.mini { grid-column: 2; grid-row: 1 / span 2; width: auto; min-height: 38px; padding: 0 14px; margin: 0; font-size: 13px; background: var(--bleu); color: #fff; border-radius: 10px; }
.btn.mini:disabled { opacity: 1; background: var(--ok); }
.folder { display: block; margin: 4px 0 2px; padding: 12px 14px; background: var(--fond); border: 1px dashed var(--bleu); border-radius: 12px; font-family: ui-monospace, Consolas, "Roboto Mono", monospace; font-size: 16px; font-weight: 700; text-align: center; word-break: break-all; user-select: all; -webkit-user-select: all; color: var(--texte); }
#btnCopierFolder:disabled { opacity: 1; background: var(--ok); }
.echanges { font-family: ui-monospace, Consolas, "Roboto Mono", monospace; font-size: 11.5px; color: var(--texte); display: grid; gap: 4px; margin: 4px 0 10px; }
.echange { padding: 6px 8px; background: var(--fond); border-radius: 8px; word-break: break-all; }
.details-json { margin-top: 8px; font-size: 13px; color: var(--doux); }
.details-json summary { cursor: pointer; }
.details-json pre { margin: 6px 0 0; padding: 10px; background: var(--fond); border-radius: 10px; font-size: 12px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: var(--texte); }
#ecranVerdict { text-align: center; }
.jeton { margin: 4px 0 12px; padding: 12px 14px; border: 1px solid var(--bord); border-radius: 14px; background: var(--carte); text-align: left; }
.jeton[open] { border-color: var(--bleu); }
.jeton-titre { cursor: pointer; font-size: 14px; font-weight: 650; color: var(--bleu); list-style: none; }
.jeton-titre::-webkit-details-marker { display: none; }
.jeton-titre::before { content: "＋ "; font-weight: 700; }
.jeton[open] .jeton-titre::before { content: "－ "; }
.jeton textarea { width: 100%; margin: 8px 0 6px; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; background: var(--fond); color: var(--texte); font-family: ui-monospace, Consolas, "Roboto Mono", monospace; font-size: 12.5px; resize: vertical; box-sizing: border-box; }
.jeton-actions { display: flex; gap: 8px; }
.btn.secondaire.petit, .btn.lien.petit { width: auto; min-height: 40px; padding: 0 14px; margin: 0; font-size: 14px; }
.jeton-ok { color: var(--ok); }
.jeton-ko { color: var(--erreur); }
