/* Palette 5 couleurs, tirée du code couleur des manuels (SSIAP 1 rouge, 2 orange, 3 bleu) sur fond nuit. */
:root {
  --nuit: #101216; --creme: #f5efe4; --rouge: #d7262e; --orange: #f08a24; --bleu: #3b7be8;
  --nuit-2: #1a1d24; --nuit-3: #262a33; --gris: #a9adb8; --vert: #2fbf71;
  --r: 16px; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--nuit); color: var(--creme); font: 16px/1.55 Inter, system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: -20% -20% auto; height: 70vh; pointer-events: none; z-index: -1;
  background: radial-gradient(40% 50% at 20% 30%, #d7262e33, transparent 70%), radial-gradient(40% 50% at 85% 20%, #3b7be82a, transparent 70%); animation: halo 14s ease-in-out infinite alternate; }
@keyframes halo { to { transform: translate3d(4%, 6%, 0) scale(1.08); } }
h1, h2, h3, .marque, .chrono, .note b { font-family: "Space Grotesk", Inter, sans-serif; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 6vw, 3rem); line-height: 1.1; margin: .2em 0 .4em; }
a { color: var(--orange); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 6px; }
.sr, .sauter:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sauter:focus { position: fixed; top: 8px; left: 8px; z-index: 9; background: var(--creme); color: var(--nuit); padding: 8px 12px; }
main { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px 48px; flex: 1; }
[hidden] { display: none !important; }

.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px;
  background: #101216d9; backdrop-filter: blur(10px); border-bottom: 1px solid var(--nuit-3); }
.marque { color: var(--creme); text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.marque b { color: var(--rouge); }
.flamme { width: 14px; height: 20px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: linear-gradient(var(--orange), var(--rouge)); animation: flamme 1.6s ease-in-out infinite alternate; transform-origin: bottom; }
@keyframes flamme { 50% { transform: scaleY(1.15) rotate(-4deg); } to { transform: scaleY(.92) rotate(3deg); } }
#nav-compte { display: flex; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--nuit-3);
  background: var(--nuit-3); color: var(--creme); font: 600 1rem Inter, sans-serif; text-decoration: none; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s, background .25s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px #0007; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-feu { background: linear-gradient(120deg, var(--rouge), var(--orange)); border: 0; background-size: 160% 100%; }
.btn-feu:hover { background-position: 100% 0; box-shadow: 0 10px 30px #d7262e66; }
.btn-ghost { background: transparent; }
.btn-mini { white-space: nowrap; min-height: 40px; padding: 8px 14px; font-size: .9rem; }

.heros { padding: 40px 0 24px; animation: monte .7s var(--ease) both; }
.sur { color: var(--orange); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; margin: 0; }
.grad { background: linear-gradient(90deg, var(--rouge), var(--orange) 60%, var(--creme)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chapo { color: var(--gris); font-size: 1.05rem; max-width: 60ch; }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0; }
.chiffres div { background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--r); padding: 12px; text-align: center; transition: transform .3s var(--ease), border-color .3s; }
.chiffres div:hover { transform: translateY(-4px); border-color: var(--orange); }
.chiffres b { display: block; font: 700 1.5rem "Space Grotesk", sans-serif; }
.chiffres span { color: var(--gris); font-size: .8rem; }
.titre-sec { font-size: 1.3rem; margin: 36px 0 14px; }

.niveaux { display: grid; gap: 14px; }
.niveau { --c: var(--rouge); position: relative; overflow: hidden; background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--r); padding: 18px;
  transition: transform .35s var(--ease), border-color .35s, box-shadow .35s; animation: monte .6s var(--ease) both; }
.niveau.n2 { --c: var(--orange); animation-delay: .08s; } .niveau.n3 { --c: var(--bleu); animation-delay: .16s; }
.niveau::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c); transition: width .35s var(--ease); }
.niveau:hover { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 16px 40px #0008; }
.niveau:hover::before { width: 9px; }
.niveau h3 { margin: 0; font-size: 1.4rem; color: var(--c); }
.niveau header p, .fmt { margin: 2px 0; color: var(--gris); font-size: .92rem; }
.exams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.ex { position: relative; min-height: 64px; border-radius: 12px; border: 1px solid var(--nuit-3); background: var(--nuit); color: var(--creme); font: 600 .95rem Inter, sans-serif;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 4px; transition: transform .25s var(--ease), background .25s, border-color .25s; }
.ex:hover { transform: translateY(-3px) scale(1.03); border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--nuit)); }
.ex em { font-style: normal; font-size: .72rem; background: var(--vert); color: var(--nuit); border-radius: 99px; padding: 1px 8px; }
.ex small { color: var(--gris); font-size: .7rem; font-weight: 400; }
.ex.verrou { opacity: .7; }
.ex i { font-style: normal; font-size: .8rem; }
.lien-achat { font-size: .9rem; }

.offres { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.offre { --c: var(--rouge); display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r); background: var(--nuit-2); border: 1px solid var(--nuit-3); color: var(--creme); text-decoration: none;
  transition: transform .3s var(--ease), border-color .3s; }
.offre.n2 { --c: var(--orange); } .offre.n3 { --c: var(--bleu); } .offre.pack { --c: var(--creme); }
.offre:hover { transform: translateY(-4px) rotate(-.5deg); border-color: var(--c); }
.offre b { font: 700 1.3rem "Space Grotesk", sans-serif; color: var(--c); }
.offre i { font-size: .75rem; color: var(--gris); }
.petit { font-size: .9rem; color: var(--gris); }

.carte { background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--r); padding: 20px; margin-top: 24px; animation: monte .5s var(--ease) both; }
.consignes { padding-left: 1.1em; } .consignes li { margin: 8px 0; }
.note-regle { border-left: 4px solid var(--orange); padding: 8px 12px; background: var(--nuit); border-radius: 8px; font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@keyframes monte { from { opacity: 0; transform: translateY(16px); } }

/* Examen */
body[data-vue="examen"] .barre { display: none; }
.exam-haut { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: var(--nuit); }
.chrono { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: 4px 12px; border-radius: 10px; background: var(--nuit-2); transition: color .3s, background .3s; }
.chrono.alerte { color: #fff; background: var(--rouge); }
.chrono.fin { animation: pouls 1s ease-in-out infinite; }
@keyframes pouls { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px #d7262e44; } }
.prog { flex: 1; font-size: .85rem; color: var(--gris); }
.jauge { height: 6px; border-radius: 9px; background: var(--nuit-3); margin-top: 4px; overflow: hidden; }
.jauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--rouge), var(--orange)); transition: width .4s var(--ease); }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; padding: 12px; background: var(--nuit-2); border-radius: var(--r); margin-bottom: 8px; }
.grille button { min-height: 44px; border-radius: 10px; border: 1px solid var(--nuit-3); background: var(--nuit); color: var(--creme); font: 600 .9rem Inter, sans-serif; cursor: pointer; transition: transform .2s; }
.grille button:hover { transform: scale(1.08); }
.grille .repondu { background: var(--bleu); border-color: var(--bleu); }
.grille [aria-current] { outline: 2px solid var(--orange); }
.question { margin-top: 8px; }
.question.entre { animation: glisse .35s var(--ease) both; }
@keyframes glisse { from { opacity: 0; transform: translateX(18px); } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 1.12rem; font-weight: 600; line-height: 1.45; padding: 0; }
legend .num { display: block; color: var(--orange); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.aide { color: var(--gris); font-size: .85rem; margin: 8px 0 12px; }
.choix { display: grid; gap: 10px; }
.choix-l { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 12px; border: 2px solid var(--nuit-3); background: var(--nuit); cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.choix-l:hover { border-color: var(--gris); transform: translateX(3px); }
.choix-l input { position: absolute; opacity: 0; }
.lettre { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--nuit-3); transition: background .2s, transform .2s; }
.choix-l:has(input:checked) { border-color: var(--bleu); background: color-mix(in srgb, var(--bleu) 16%, var(--nuit)); }
.choix-l:has(input:checked) .lettre { background: var(--bleu); transform: scale(1.1); }
.choix-l:has(input:focus-visible) { outline: 3px solid var(--orange); outline-offset: 2px; }
.exam-bas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn-rendre { width: 100%; margin-top: 14px; background: transparent; border: 2px solid var(--rouge); }
.btn-rendre:hover { background: var(--rouge); }
dialog { max-width: min(440px, calc(100vw - 32px)); border: 1px solid var(--nuit-3); border-radius: var(--r); background: var(--nuit-2); color: var(--creme); padding: 22px; }
dialog::backdrop { background: #000a; backdrop-filter: blur(3px); }
dialog[open] { animation: monte .3s var(--ease); }

/* Résultat */
.resultat { text-align: center; border-top: 5px solid var(--rouge); }
.resultat.admis { border-top-color: var(--vert); }
.note { font-size: 4.5rem; font-weight: 700; line-height: 1; margin: 14px 0 4px; }
.note span { font-size: 1.6rem; color: var(--gris); }
.verdict { display: inline-block; font: 700 1.2rem "Space Grotesk", sans-serif; padding: 4px 18px; border-radius: 99px; background: var(--rouge); animation: tampon .6s .5s var(--ease) both; }
.admis .verdict { background: var(--vert); color: var(--nuit); }
@keyframes tampon { from { opacity: 0; transform: scale(2) rotate(-8deg); } }
.resultat .actions { justify-content: center; }
.promo { margin-top: 20px; padding: 16px; border-radius: 12px; background: var(--nuit); border: 1px dashed var(--orange); }
.code-promo b { color: var(--orange); letter-spacing: .05em; }
.correction { list-style: none; padding: 0; display: grid; gap: 8px; }
.correction > li { border-radius: 12px; background: var(--nuit-2); border-left: 4px solid var(--rouge); }
.correction > li.ok { border-left-color: var(--vert); }
.correction summary { cursor: pointer; padding: 14px; list-style: none; }
.correction summary::-webkit-details-marker { display: none; }
.pastille { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; margin-right: 8px; border-radius: 99px; background: var(--rouge); }
.ok .pastille { background: var(--vert); color: var(--nuit); }
.correction ul { margin: 0 14px; padding-left: 1em; }
.correction .bonne { color: #7ee0a6; }
.correction .cochee:not(.bonne) { color: #ff8a8f; text-decoration: line-through; }
.expl { margin: 10px 14px 4px; } .ref { margin: 0 14px 14px; color: var(--gris); font-size: .82rem; }

/* Formulaires, compte */
.formulaire { max-width: 460px; margin-inline: auto; display: grid; gap: 12px; }
.formulaire label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
input:not([type=checkbox]), select { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--nuit-3); background: var(--nuit); color: var(--creme); font: 1rem Inter, sans-serif; transition: border-color .2s; }
input:focus, select:focus { border-color: var(--orange); }
.erreur { color: #ff8a8f; min-height: 1.2em; margin: 0; }
.histo { list-style: none; padding: 0; display: grid; gap: 8px; }
.histo li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 12px 14px; background: var(--nuit-2); border-radius: 12px; border-left: 4px solid var(--gris); transition: transform .25s var(--ease); }
.histo li:hover { transform: translateX(4px); }
.histo li.ok { border-left-color: var(--vert); } .histo li.ko { border-left-color: var(--rouge); }
.histo b { grid-row: span 2; font: 700 1.3rem "Space Grotesk", sans-serif; align-self: center; }
.histo time { color: var(--gris); font-size: .8rem; }
.pied { color: var(--gris); font-size: .78rem; text-align: center; padding: 24px 16px; border-top: 1px solid var(--nuit-3); }

@media (min-width: 720px) {
  .niveaux { grid-template-columns: repeat(3, 1fr); }
  .offres { grid-template-columns: repeat(4, 1fr); }
  .exams { grid-template-columns: 1fr; }
}
@media (max-width: 400px) { .marque { font-size: .85rem; } .barre .btn-mini { padding: 8px 10px; font-size: .8rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
