:root {
  --fond: #f6f5f1;
  --surface: #ffffff;
  --champ: #eeede8;
  --champ-survol: #e6e5df;
  --encre: #1b1d1c;
  --encre-2: #555a58;
  --encre-3: #80868a;
  --marque: #0b7a6b;
  --marque-fort: #086356;
  --marque-teinte: #dcefea;
  --marque-choix: #b2ddd1;
  --sur-marque: #ffffff;
  --oui: #18794e;
  --oui-teinte: #ddf1e6;
  --moitie: #9a5b00;
  --moitie-teinte: #fbecd2;
  --non: #b4322e;
  --non-teinte: #f9e0de;
  --code-fond: #f1f0eb;
  --ombre: 0 1px 2px rgba(20, 24, 22, .04), 0 8px 28px rgba(20, 24, 22, .06);
  --rayon: 16px;
  --police: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --fond: #121413;
  --surface: #1b1e1d;
  --champ: #252928;
  --champ-survol: #2d3230;
  --encre: #ecefed;
  --encre-2: #a9b0ad;
  --encre-3: #7d8582;
  --marque: #3cc0aa;
  --marque-fort: #5fd3bf;
  --marque-teinte: #173a34;
  --marque-choix: #215a50;
  --sur-marque: #08201c;
  --oui: #5fd39a;
  --oui-teinte: #173527;
  --moitie: #f0b860;
  --moitie-teinte: #3a2c14;
  --non: #f2847f;
  --non-teinte: #3d1d1c;
  --code-fond: #232725;
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 17px/1.65 var(--police);
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.barre {
  max-width: 44rem;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.marque {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--encre);
  text-decoration: none;
}
.pastille {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--marque);
  color: var(--sur-marque);
  font-size: 16px;
}
.theme {
  width: 40px; height: 40px;
  border: 0; border-radius: 12px;
  background: transparent;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--encre-2);
}
.theme:hover { background: var(--champ); color: var(--encre); }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .lune { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .lune, :root[data-theme="light"] .soleil { display: none; }

main { max-width: 44rem; margin: 0 auto; padding: 0 16px 80px; }
.vue { padding-top: 12vh; }
#quiz.vue { padding-top: 6vh; }
h1 {
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.chapo { color: var(--encre-2); margin: 0 0 28px; font-size: 18px; }

.saisie { display: flex; gap: 10px; }
.saisie input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--ombre);
  padding: 16px 18px;
  font-size: 18px;
  outline: none;
}
.saisie input:focus-visible { box-shadow: var(--ombre), 0 0 0 3px var(--marque-teinte); }
.saisie input::placeholder { color: var(--encre-3); }

.principal, .secondaire, .discret, .exemple, .auto button {
  border: 0;
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .1s;
}
.principal:active, .secondaire:active, .auto button:active { transform: scale(.98); }
.principal {
  background: var(--marque);
  color: var(--sur-marque);
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 600;
}
.principal:hover { background: var(--marque-fort); }
.principal:disabled { opacity: .55; cursor: default; }
.secondaire {
  background: var(--champ);
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 600;
}
.secondaire:hover { background: var(--champ-survol); }
.discret {
  background: transparent;
  color: var(--encre-2);
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 500;
}
.discret:hover { background: var(--champ); color: var(--encre); }
:focus-visible { outline: 3px solid var(--marque-teinte); outline-offset: 2px; }

.niveaux { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.niveaux-titre { font-size: 14px; font-weight: 600; color: var(--encre-2); margin-right: 4px; }
.niveaux-titre span { font-weight: 400; color: var(--encre-3); }
.niveau {
  border: 0;
  cursor: pointer;
  background: var(--champ);
  color: var(--encre-2);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 15px;
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.niveau:hover { background: var(--champ-survol); color: var(--encre); }
.niveau[aria-pressed="true"] { background: var(--marque-choix); color: var(--marque-fort); font-weight: 600; }
.exemples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.exemple {
  background: var(--champ);
  color: var(--encre-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 15px;
}
.exemple:hover { background: var(--champ-survol); color: var(--encre); }

.entete-quiz { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.contexte { margin: 0; color: var(--encre-2); font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contexte .sep { margin: 0 8px; color: var(--encre-3); }
#titre-sujet { font-weight: 600; color: var(--encre); }

.carte {
  background: var(--surface);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 28px;
  animation: entree .25s ease-out;
}
@keyframes entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.question { font-size: 20px; font-weight: 600; line-height: 1.5; margin-bottom: 22px; }
.question p { margin: 0 0 10px; }
.question p:last-child { margin-bottom: 0; }

.etiquette { display: block; font-size: 14px; font-weight: 600; color: var(--encre-2); margin-bottom: 6px; }
.etiquette span { font-weight: 400; color: var(--encre-3); }
textarea {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--champ);
  padding: 12px 14px;
  resize: vertical;
  min-height: 84px;
  outline: none;
  font-size: 16px;
}
textarea:focus-visible { box-shadow: 0 0 0 3px var(--marque-teinte); outline: none; }
textarea::placeholder { color: var(--encre-3); }
textarea:disabled { opacity: .8; }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.raccourci { font-size: 13px; color: var(--encre-3); }

#solution { margin-top: 22px; animation: entree .25s ease-out; }
.titre-bloc { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-3); margin: 0 0 8px; }
.reponse { background: var(--code-fond); border-radius: 12px; padding: 16px 18px; margin-bottom: 22px; }
.reponse .titre-bloc { color: var(--marque-fort); }
#reponse p { margin: 0 0 10px; }
#reponse p:last-child { margin-bottom: 0; }
.avertissement { margin: 12px 0 0; font-size: 14px; color: var(--moitie); font-weight: 500; }

.correction { border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; background: var(--champ); }
.correction.juste { background: var(--oui-teinte); }
.correction.partiel { background: var(--moitie-teinte); }
.correction.faux { background: var(--non-teinte); }
.verdict { font-weight: 700; margin-right: 6px; }
.correction.juste .verdict { color: var(--oui); }
.correction.partiel .verdict { color: var(--moitie); }
.correction.faux .verdict { color: var(--non); }
.correction.attente { color: var(--encre-2); }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--code-fond);
  padding: .1em .35em;
  border-radius: 6px;
}
.reponse code { background: var(--champ-survol); }
.correction code { background: rgba(127, 127, 127, .14); }
pre {
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--code-fond);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
  font-weight: 400;
}
.reponse pre { background: var(--surface); }
pre code { background: none; padding: 0; font-size: inherit; }

.auto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.auto button {
  background: var(--champ);
  border-radius: 12px;
  padding: 12px 8px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auto button[data-note="2"]:hover, .auto button[data-note="2"].suggere { background: var(--oui-teinte); color: var(--oui); }
.auto button[data-note="1"]:hover, .auto button[data-note="1"].suggere { background: var(--moitie-teinte); color: var(--moitie); }
.auto button[data-note="0"]:hover, .auto button[data-note="0"].suggere { background: var(--non-teinte); color: var(--non); }
kbd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--encre-3);
  background: var(--surface);
  border-radius: 5px;
  padding: 0 6px;
}

.attente { display: flex; align-items: center; gap: 12px; color: var(--encre-2); padding: 40px 4px; }
.points { display: inline-flex; gap: 5px; }
.points i { width: 7px; height: 7px; border-radius: 50%; background: var(--marque); animation: rebond 1s infinite ease-in-out; }
.points i:nth-child(2) { animation-delay: .15s; }
.points i:nth-child(3) { animation-delay: .3s; }
@keyframes rebond { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.erreur { color: var(--non); margin-top: 16px; font-weight: 500; }

.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 28px; }
.chiffre { border-radius: 14px; padding: 16px; display: flex; flex-direction: column; }
.chiffre strong { font-size: 32px; line-height: 1.1; font-weight: 700; }
.chiffre span { font-size: 15px; font-weight: 500; }
.chiffre.oui { background: var(--oui-teinte); color: var(--oui); }
.chiffre.moitie { background: var(--moitie-teinte); color: var(--moitie); }
.chiffre.non { background: var(--non-teinte); color: var(--non); }

.revoir-liste { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.revoir-liste details { background: var(--surface); border-radius: 14px; box-shadow: var(--ombre); padding: 14px 18px; }
.revoir-liste summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 10px; }
.revoir-liste summary::-webkit-details-marker { display: none; }
.revoir-liste summary::before { content: "›"; color: var(--encre-3); transition: transform .15s; display: inline-block; }
.revoir-liste details[open] summary::before { transform: rotate(90deg); }
.revoir-liste summary p { margin: 0; }
.revoir-liste .corps { margin-top: 10px; color: var(--encre-2); }
.revoir-liste .corps p { margin: 0 0 8px; }
.actions-bilan { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .vue { padding-top: 7vh; }
  .saisie { flex-direction: column; }
  .niveaux-titre { width: 100%; }
  .carte { padding: 20px 18px; }
  .question { font-size: 18.5px; }
  .raccourci, kbd { display: none; }
  .actions .principal, .actions-bilan button { width: 100%; }
  .chiffre { padding: 12px; }
  .chiffre strong { font-size: 26px; }
}
.katex { font-size: 1.05em; }
.katex-display { margin: 10px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
