:root {
  color-scheme: light;
  --primary: #005ca9;
  --dark: #003b71;
  --blue: #1674c8;
  --light: #eaf3fc;
  --paper: #fff;
  --background: #f5f7fa;
  --muted: #526376;
  --ink: #182536;
  --line: #dce5ee;
  --green: #116249;
  --red: #9f2d37;
  --shadow: 0 5px 22px #1a3d620a;
  --radius: 14px;
  font: 16px/1.52 "Segoe UI", Inter, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
a { color: var(--primary); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: not-allowed; }
:focus-visible { outline: 3px solid #268bdd; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.16; letter-spacing: -.028em; }
h1 { font-size: clamp(1.95rem, 4vw, 3rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.65rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 14px; color: var(--muted); }
svg { flex: none; vertical-align: middle; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
legend { margin-bottom: 10px; color: var(--ink); font-weight: 650; }
.skip { position: fixed; z-index: 10; top: 10px; left: 10px; transform: translateY(-160%); padding: 10px; background: white; }
.skip:focus { transform: none; }
.muted { color: var(--muted); }
.block { display: block; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
  min-width: 0;
}
.stack, .grid { display: grid; gap: 18px; min-width: 0; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1px solid transparent; border-radius: 9px; padding: 9px 15px;
  text-decoration: none; font-weight: 700; transition: background .18s, box-shadow .18s, border-color .18s;
}
.button { justify-self: start; text-align: center; }
.primary { color: white; background: var(--primary); }
.primary:hover { background: var(--dark); box-shadow: 0 0 0 4px #1674c820; }
.secondary { color: var(--dark); background: #fff; border-color: #c9d9e8; }
.secondary:hover { background: var(--light); border-color: #a8c7e1; }
.danger { color: var(--red); background: #fff5f5; border-color: #f2c4c7; }
.icon-button { padding: 8px; color: var(--dark); background: var(--light); }
.text-link { font-weight: 650; text-underline-offset: 3px; }
.brand { display: inline-flex; text-decoration: none; align-items: center; gap: 12px; color: var(--ink); font-weight: 760; font-size: 1.2rem; line-height: 1.08; white-space: nowrap; }
.brand b { color: var(--primary); }
.brand small { display: block; color: var(--muted); margin-top: 5px; font-size: .81rem; font-weight: 560; }
.brand-mark, .badge-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--light); color: var(--primary); flex: none;
}
.brand-mark { background: var(--primary); color: white; }
.application { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 246px; padding: 25px 17px 18px; overflow: auto; display: flex; flex-direction: column;
  background: white; border-right: 1px solid var(--line); z-index: 5;
}
.sidebar .brand { margin: 0 7px 34px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 46px; width: 100%; color: var(--ink); font-weight: 630; padding: 9px 12px; border-radius: 9px; text-decoration: none; font-size: .93rem; }
.nav-item svg { color: var(--primary); }
.nav-item:hover, .nav-item[aria-current] { color: var(--dark); background: var(--light); }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.logout { border: 1px solid var(--line); background: white; }
.topbar {
  margin-left: 246px; padding: 11px clamp(16px,4vw,38px); min-height: 66px; background: white; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem;
}
.identity { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; min-width: 0; }
.identity > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: var(--light); color: var(--dark); flex: none; }
.menu-button { display: none; }
.main {
  margin-left: 246px; padding: 28px clamp(15px, 4vw, 42px) 60px; max-width: 1550px;
  display: grid; gap: 23px; align-content: start; min-width: 0;
}
.page-heading p, .section-line p { margin-bottom: 0; }
.welcome { display: grid; overflow: hidden; grid-template-columns: minmax(0,1.4fr) minmax(200px,1fr); padding: 0; background: #edf5fd; }
.welcome > div:first-child { padding: clamp(22px,3.3vw,36px); }
.welcome h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); max-width: 25ch; color: var(--dark); }
.welcome p { max-width: 47ch; }
.welcome-picture, .login-photo { background: url("../images/accueil-moto.webp") 77% 55% / cover no-repeat; min-height: 210px; }
.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--dark); font-size: .88rem; font-weight: 750; }
.section-line { display: flex; justify-content: space-between; align-items: center; gap: 12px 22px; flex-wrap: wrap; }
.section-line > strong { font-size: 1.45rem; color: var(--dark); }
.progress-card progress { margin-top: 16px; }
progress { display: block; width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; background: #e4edf6; appearance: none; }
progress::-webkit-progress-bar { background: #e4edf6; border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #005ca9, #2588da); border-radius: 999px; animation: fill .6s ease-out both; }
progress::-moz-progress-bar { background: var(--blue); border-radius: 999px; }
@keyframes fill { from { opacity: .45; } to { opacity: 1; } }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,143px),1fr)); gap: 12px; }
.metric { display: grid; align-content: start; gap: 7px; padding: 16px; border-radius: 11px; border: 1px solid var(--line); background: white; min-width: 0; }
.metric .badge-icon { width: 34px; height: 34px; }
.metric strong { color: var(--dark); font-size: 1.38rem; }
.metric > span:last-child { color: var(--muted); font-size: .9rem; }
.quick { grid-template-columns: repeat(auto-fit,minmax(min(100%,195px),1fr)); }
.topics { grid-template-columns: repeat(auto-fit,minmax(min(100%,245px),1fr)); }
.action-card, .topic-card { display: grid; align-content: start; gap: 9px; color: var(--ink); text-decoration: none; transition: transform .2s, border-color .2s, box-shadow .2s; }
.action-card:hover, .topic-card:hover { transform: translateY(-2px); border-color: #a5c5e0; box-shadow: 0 9px 20px #183a6a15; }
.action-card h3, .topic-card h2 { margin-bottom: 0; }
.action-card p, .topic-card span, .topic-card small { margin: 0; color: var(--muted); }
.topic-card .badge-icon { color: var(--primary); }
.topic-card h2 { font-size: 1.15rem; min-height: 2.35em; }
.facts { display: grid; grid-template-columns: minmax(140px,1fr) minmax(0,2fr); gap: 8px 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; }
.saved, .save-state { color: var(--green); font-size: .9rem; margin: 12px 0 0; }
.save-state { min-height: 1.4em; margin: 0; }
.save-state[data-state=error] { color: var(--red); }
.notice { border: 1px solid #c1d9ee; border-radius: 10px; background: var(--light); color: var(--dark); padding: 13px 16px; }
.notice.success { background: #e8f7f0; color: var(--green); border-color: #bfded1; }
.notice.error { background: #fff0f1; color: var(--red); border-color: #f4c4c9; }
.field { display: grid; gap: 6px; color: var(--ink); font-size: .93rem; font-weight: 650; min-width: 0; }
.field input, .field select, .field textarea {
  display: block; width: 100%; min-width: 0; min-height: 45px; border: 1px solid #bbccdc; border-radius: 8px;
  padding: 9px 11px; color: var(--ink); background: white; font-weight: 450;
}
.field textarea { resize: vertical; }
.field input[type=file] { padding: 7px; }
.password-field { position: relative; }
.password-field input { padding-right: 54px; }
.password-field .icon-button { position: absolute; right: 5px; bottom: 4px; min-height: 36px; }
.profile-card, .exam-intro { max-width: 820px; }
.exam-intro .badge-icon { margin-bottom: 12px; }
.filter-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) auto; gap: 12px; align-items: end; margin: 15px 0; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: 11px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .9rem; color: var(--dark); background: #f1f6fb; }
.chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--light); color: var(--dark); font-size: .84rem; font-weight: 700; white-space: nowrap; }
.green { background: #e4f5ed; color: var(--green); }
.red { background: #fdecef; color: var(--red); }
.question-list { padding-block: 8px; }
.lesson-notes { border-left: 4px solid var(--blue); }
.lesson-notes ul { margin: 12px 0 0; padding-left: 21px; display: grid; gap: 8px; color: var(--muted); }
.question-list a { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 11px 0; color: var(--ink); text-decoration: none; }
.question-list a:hover { color: var(--primary); }
.question-list a:last-child { border: 0; }
.question-number { display: grid; place-items: center; background: var(--light); color: var(--dark); min-width: 38px; min-height: 36px; border-radius: 7px; font-weight: 720; }
.question-head, .question-nav { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.question-nav { margin-top: 22px; }
.question-card {
  display: grid; gap: clamp(17px,2.5vw,28px); container-type: inline-size;
  animation: reveal .25s ease-out both;
}
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.question-heading { display: grid; gap: 13px; }
.question-heading .eyebrow { margin: 0; }
.question-heading progress { height: 7px; }
.question-card h1, .question-card h2 { font-size: clamp(1.32rem,2.35vw,2rem); line-height: 1.27; margin: 0; text-wrap: pretty; }
.question-body, .question-response { display: grid; gap: clamp(16px,2.3vw,24px); min-width: 0; align-content: start; }
@container (min-width: 780px) {
  .question-body.illustrated { grid-template-columns: minmax(0,1.32fr) minmax(275px,1fr); align-items: start; }
}
.question-card .question-nav { margin-top: 0; padding-top: 15px; border-top: 1px solid var(--line); }
.question-image {
  position: relative; overflow: hidden; margin: 0; align-self: start; isolation: isolate;
  border: 1px solid #d6e2ed; border-radius: 13px; background: #eaf0f6; box-shadow: 0 8px 22px #1436580c;
}
.question-image img { width: 100%; max-height: 480px; min-height: 130px; object-fit: contain; margin-inline: auto; }
.image-enlarge { position: absolute; right: 9px; bottom: 9px; width: 44px; padding: 0; background: white; border-color: #c7d8e6; box-shadow: 0 3px 12px #14283c25; }
.image-enlarge:hover { background: var(--light); }
.image-dialog { width: min(96vw,1320px); max-height: 94vh; padding: 10px; border: 1px solid #aec8de; border-radius: 14px; background: #f5f9fd; }
.image-dialog::backdrop { background: #0b1c31db; }
.image-dialog form { display: flex; justify-content: flex-end; margin-bottom: 7px; }
.image-dialog img { width: 100%; max-height: calc(94vh - 72px); object-fit: contain; }
.option-set { display: grid; gap: 11px; }
.option-set legend { margin-bottom: 12px; }
.option { display: grid; grid-template-columns: auto auto minmax(0,1fr); gap: 11px; align-items: center; padding: 11px 12px; min-height: 56px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: background .16s,border-color .16s,box-shadow .16s; }
.option:hover, .option:has(input:checked) { background: var(--light); border-color: #93bce0; }
.option:has(input:checked) { box-shadow: inset 3px 0 var(--primary); }
.option:focus-within { outline: 2px solid #268bdd; outline-offset: 2px; }
.option input, .check input { width: 17px; height: 17px; accent-color: var(--primary); }
.option-key { display: grid; place-content: center; width: 28px; height: 28px; background: #eef2f6; border-radius: 7px; font-size: .85rem; font-weight: 750; color: var(--dark); }
.correction { border: 1px solid var(--line); border-left: 4px solid; border-radius: 10px; padding: clamp(14px,2vw,20px); background: #fbfdff; animation: reveal .25s ease-out both; }
.correction.right { border-left-color: var(--green); }
.correction.wrong { border-left-color: var(--red); }
.correction h3 { display: flex; align-items: center; gap: 8px; }
.correction.right h3 { color: var(--green); }
.correction.wrong h3 { color: var(--red); }
.correction-options { display: grid; gap: 7px; list-style: none; margin: 10px 0 14px; padding: 0; }
.takeaway { display: flex; gap: 10px; align-items: start; background: var(--light); color: var(--dark); padding: 12px; border-radius: 8px; margin: 13px 0; }
.takeaway p { margin: 3px 0 0; }
.exam-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.exam-header h1 { font-size: clamp(1.4rem,3vw,2rem); margin-bottom: 0; }
.timer { display: flex; gap: 7px; align-items: center; white-space: nowrap; font-weight: 750; color: var(--dark); }
.timer[data-urgent] { color: var(--red); }
.exam-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(208px,263px); align-items: start; gap: 15px; }
.exam-nav { position: sticky; top: 16px; }
.question-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; margin-bottom: 16px; }
.question-grid a { display: grid; place-items: center; min-height: 44px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 650; }
.question-grid a.done { background: #e6f5ee; color: var(--green); }
.question-grid a[aria-current] { border: 2px solid var(--primary); color: var(--dark); }
.chart-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 10px; margin: 12px 0; font-size: .92rem; }
.chart-row progress { grid-column: 1/-1; height: 6px; }
.result-summary { display: flex; gap: 18px; justify-content: space-between; align-items: start; flex-wrap: wrap; }
.result-summary h2 { font-size: 2.8rem; color: var(--dark); margin-top: 8px; }
.result-summary progress { margin-bottom: 12px; }
.review-detail { border-bottom: 1px solid var(--line); padding: 8px 0; }
.review-detail summary { min-height: 44px; padding: 7px 0; cursor: pointer; font-weight: 675; }
.review-detail summary .chip { margin-left: 8px; }
.review-detail > p, .review-detail .correction, .review-detail .question-image { margin: 8px 0 13px; }
.simple-list { margin: 12px 0 0; padding: 0; list-style: none; }
.simple-list li { display: flex; justify-content: space-between; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.option-editor { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; }
.check { display: flex; min-height: 44px; align-items: center; gap: 6px; }
.delete-form { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth-main { width: min(1120px,calc(100% - 36px)); margin: clamp(24px,8vh,90px) auto; }
.auth-main > .notice { margin-bottom: 15px; }
.login-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.83fr); gap: clamp(18px,5vw,58px); align-items: center; }
.login-intro { display: grid; gap: 25px; }
.login-intro h1 { color: var(--dark); }
.login-photo { min-height: clamp(190px,32vw,340px); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-form { padding: clamp(22px,4vw,40px); }
.login-form > p:last-child { margin: 15px 0 0; font-size: .9rem; }
.login-form form .button { width: 100%; }
@media (max-width: 1060px) { .exam-layout { grid-template-columns: 1fr; } .exam-nav { position: static; } .exam-nav .question-grid { grid-template-columns: repeat(10,minmax(0,1fr)); } }
@media (max-width: 790px) {
  .sidebar { display: none; position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 17px; }
  .sidebar[data-open] { display: flex; }
  .sidebar .brand { margin: 0 0 12px; }
  .sidebar-bottom { padding-top: 12px; }
  .topbar, .main { margin-left: 0; }
  .menu-button { display: inline-flex; }
  .main { padding-top: 19px; }
  .three { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .welcome, .two, .three, .login-layout, .filter-row { grid-template-columns: 1fr; }
  .welcome-picture { min-height: 145px; }
  .login-photo { display: none; }
  .identity > span:last-child { display: none; }
  .question-list a { grid-template-columns: auto minmax(0,1fr); }
  .question-list .chip { grid-column: 2; justify-self: start; }
  .question-body { gap: 18px; }
  .question-heading { gap: 11px; }
  .question-card .question-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .question-card .question-nav .button { width: 100%; }
  .exam-nav .question-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .facts { grid-template-columns: minmax(102px,1fr) minmax(0,1.2fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
