:root {
  --bg: #F3F6F2;
  --surface: #FFFFFF;
  --ink: #13261C;
  --muted: #5A6B60;
  --line: #D5DED7;
  --green: #0A7A4E;
  --green-soft: #E2F2E9;
  --yellow: #F2C230;
  --red: #C4262E;
  --red-soft: #FBE7E7;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A14; --surface: #172720; --ink: #E8F0EA; --muted: #9DB0A3;
    --line: #2A3D33; --green: #3CC48A; --green-soft: #183A2B; --red: #F06A70; --red-soft: #3A1E21;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body);
  font-size: 1.0625rem; line-height: 1.55; min-height: 100vh;
}
.flag { display: flex; height: 6px; }
.flag span:nth-child(1) { flex: 2; background: var(--green); }
.flag span:nth-child(2) { flex: 1; background: var(--yellow); }
.flag span:nth-child(3) { flex: 1; background: var(--red); }
main { max-width: 680px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.05; letter-spacing: -0.02em; margin: 1rem 0 0.75rem;
}
h2 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
p { margin: 0 0 1rem; }
.lead { color: var(--muted); max-width: 56ch; }
.hidden { display: none !important; }

fieldset { border: 0; padding: 0; margin: 1.5rem 0; }
legend { font-weight: 700; margin-bottom: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label {
  display: inline-block; padding: 0.4rem 0.85rem; border: 1.5px solid var(--line);
  border-radius: 999px; cursor: pointer; background: var(--surface); font-size: 0.95rem;
}
.chip input:checked + label { border-color: var(--green); background: var(--green-soft); color: var(--ink); }
.chip input:focus-visible + label { outline: 3px solid var(--yellow); outline-offset: 2px; }

button {
  font: inherit; cursor: pointer; border-radius: 10px; border: 0;
  padding: 0.8rem 1.4rem; font-weight: 700;
}
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.primary { background: var(--green); color: #fff; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.ghost:hover { border-color: var(--muted); }
.link { background: none; padding: 0; color: var(--green); text-decoration: underline; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.best { color: var(--muted); font-size: 0.95rem; }

.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.95rem; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 2rem; }
.bar > div { height: 100%; width: 0; background: var(--green); transition: width 0.3s ease; }
.theme-tag { display: inline-block; font-size: 0.9rem; color: var(--green); font-weight: 700; margin-bottom: 0.5rem; }
pre {
  font-family: var(--mono); font-size: 0.9rem; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--yellow); border-radius: 8px; padding: 0.9rem 1rem; overflow-x: auto; margin: 0 0 1.25rem;
}
.options { display: grid; gap: 0.6rem; }
.option {
  display: flex; gap: 0.85rem; align-items: flex-start; text-align: left; width: 100%;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); font-weight: 400;
}
.option:hover:not(:disabled) { border-color: var(--green); }
.option .key {
  flex: none; width: 1.8rem; height: 1.8rem; border-radius: 6px; display: grid; place-items: center;
  background: var(--bg); font-family: var(--mono); font-weight: 600; font-size: 0.85rem;
}
.option .txt { padding-top: 0.1rem; }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--green); background: var(--green-soft); }
.option.correct .key { background: var(--green); color: #fff; }
.option.wrong { border-color: var(--red); background: var(--red-soft); }
.option.wrong .key { background: var(--red); color: #fff; }
.hint { margin-top: 1rem; color: var(--muted); }
.feedback { margin-top: 1.25rem; padding: 1rem 1.1rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.feedback strong { display: block; margin-bottom: 0.25rem; }
.feedback.ok strong { color: var(--green); }
.feedback.ko strong { color: var(--red); }
.shortcuts { margin-top: 2rem; font-size: 0.85rem; color: var(--muted); }

.score { font-family: var(--display); font-weight: 800; font-size: clamp(3.5rem, 14vw, 6rem); line-height: 1; margin: 1rem 0 0.25rem; }
.score small { font-size: 0.4em; color: var(--muted); font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); }
td.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.meter { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 80px; }
.meter > div { height: 100%; background: var(--green); }
.meter.low > div { background: var(--red); }
.review { margin-top: 2rem; }
.review-item { padding: 1rem 0; border-top: 1px solid var(--line); }
.review-item p { margin: 0.25rem 0; }
.review-item .good { color: var(--green); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .bar > div { transition: none; } }
