:root {
  --violet: #5b3a8c;
  --violet-clair: #ece5f5;
  --violet-fonce: #3d2563;
  --fond: #f7f5fa;
  --carte: #ffffff;
  --texte: #2a2433;
  --doux: #6d6578;
  --bord: #ddd5e8;
  --juste: #2f7a4f;
  --juste-fond: #e6f3eb;
  --faux: #a8452f;
  --faux-fond: #fbebe6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --violet: #b394e0;
    --violet-clair: #2e2540;
    --violet-fonce: #d6c4f2;
    --fond: #17141d;
    --carte: #221e2a;
    --texte: #ece8f2;
    --doux: #a59cb3;
    --bord: #3a3347;
    --juste: #7fcf9f;
    --juste-fond: #1e3327;
    --faux: #f0a08c;
    --faux-fond: #3a2420;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; color: var(--violet-fonce); }
h1 { font-size: 1.9rem; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 .6rem; border-bottom: 1px solid var(--bord); padding-bottom: .3rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
a { color: var(--violet); }

.bandeau {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1rem; background: var(--violet); color: #fff;
}
@media (prefers-color-scheme: dark) { .bandeau { background: #2e2540; } }
.marque { color: #fff; text-decoration: none; font-family: Georgia, serif; font-size: 1.15rem; }
.kanji { font-size: 1.3rem; margin-right: .2rem; }
.qui { font-size: .9rem; opacity: .85; }

main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
main:has(.large) { max-width: 1200px; }
.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: 14px;
  padding: 1.6rem 1.4rem;
}
.centre { text-align: center; }
.intro { color: var(--doux); font-size: 1.05rem; }
.cache { display: none !important; }

input, textarea, button { font: inherit; }
input:not([type=radio]), textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--bord); border-radius: 8px;
  background: var(--fond); color: var(--texte);
}
input:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
button, .bouton-lien {
  display: inline-block; padding: .65rem 1.3rem; border: none; border-radius: 999px;
  background: var(--violet); color: #fff; cursor: pointer; text-decoration: none;
}
@media (prefers-color-scheme: dark) { button, .bouton-lien { color: #17141d; } }
button:hover, .bouton-lien:hover { filter: brightness(1.1); }
button.lien { background: none; color: var(--doux); padding: 0; text-decoration: underline; font-size: .9rem; }
.ligne { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 1rem; }
.ligne input { flex: 1 1 220px; width: auto; }
.discret { margin-top: 1.5rem; text-align: center; }

.portes { display: grid; gap: .9rem; margin-top: 1.2rem; }
.porte {
  display: grid; grid-template-columns: 2.4rem 1fr; gap: .1rem .8rem; align-items: center;
  padding: 1rem 1.1rem; border: 1px solid var(--bord); border-radius: 12px;
  text-decoration: none; color: var(--texte); transition: border-color .15s, background .15s;
}
.porte:hover { border-color: var(--violet); background: var(--violet-clair); }
.porte .num { grid-row: span 2; }
.porte span:last-child { color: var(--doux); font-size: .95rem; }
.num {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--violet-clair); color: var(--violet); font-weight: 600; font-size: .95rem;
}

.question { margin: 1.3rem 0; border: none; padding: 0; }
.question > label, .question > legend { display: block; margin-bottom: .45rem; font-weight: 500; }
.pourquoi { margin-top: .35rem; font-size: .92rem; }
.option {
  display: block; padding: .55rem .8rem; margin: .35rem 0; border: 1px solid var(--bord);
  border-radius: 8px; cursor: pointer;
}
.option:has(input:checked) { border-color: var(--violet); background: var(--violet-clair); }
.choix-ligne { display: flex; gap: .5rem; flex-wrap: wrap; }
.pastille {
  padding: .4rem .9rem; border: 1px solid var(--bord); border-radius: 999px; cursor: pointer;
}
.pastille:has(input:checked) { border-color: var(--violet); background: var(--violet-clair); }

.chrono {
  position: sticky; top: .5rem; z-index: 2; float: right;
  font: 600 1.6rem/1 ui-monospace, Menlo, monospace; color: var(--violet);
  background: var(--carte); border: 2px solid var(--violet); border-radius: 10px; padding: .4rem .7rem;
}
.chrono.urgent { color: var(--faux); border-color: var(--faux); animation: pouls 1s infinite; }
@keyframes pouls { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .chrono.urgent { animation: none; } }

.score { font: 3.2rem/1 Georgia, serif; color: var(--violet); text-align: center; }
.score small { font-size: 1.3rem; color: var(--doux); }
.sens { font-size: 1.15rem; text-align: center; margin: .8rem 0 1.4rem; }
.relance { font-style: italic; color: var(--violet-fonce); }
.corrige { padding-left: 1.4rem; }
.corrige li { margin: .8rem 0; padding: .7rem .9rem; border-radius: 10px; }
.corrige li.juste { background: var(--juste-fond); }
.corrige li.faux { background: var(--faux-fond); }
.corrige .q { font-weight: 500; }
.corrige .r { color: var(--doux); font-size: .92rem; }
.corrige .c { margin-top: .25rem; }
.merci { text-align: center; font-size: 1.1rem; }

/* Espace formateur */
.barre { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; }
.barre .ligne { margin: 0; }
.alerte { background: var(--faux-fond); color: var(--faux); padding: .6rem .9rem; border-radius: 8px; }
.vide, .aide { color: var(--doux); }
.defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border: 1px solid var(--bord); padding: .4rem .55rem; text-align: left; vertical-align: top; }
th { background: var(--violet-clair); font-weight: 600; white-space: nowrap; }
td.juste { background: var(--juste-fond); }
td.faux { background: var(--faux-fond); }
.pq { color: var(--doux); font-style: italic; font-size: .85rem; margin-top: .2rem; }
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.tE { background: #f3e3c4; color: #6b4a10; }
.tA { background: #d8e4f5; color: #234a7d; }
.tP { background: #e3e3e3; color: #3d3d3d; }
.tF { background: #d6efdd; color: #22603a; }
.tC { background: #ead9f2; color: #5b2f78; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .carte { padding: 1.2rem 1rem; }
  .chrono { font-size: 1.3rem; }
}
