/* Snowtificator — feuille de style unique, thèmes clair et sombre. */
:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f0f4f3;
  --ink: #10242c;
  --muted: #5a6d75;
  --line: #dfe7e5;
  --brand: #0b7a57;
  --brand-strong: #086246;
  --brand-soft: #e2f4ec;
  --on-brand: #ffffff;
  --ok: #15803d;
  --ok-soft: #e3f6e9;
  --ko: #c0392b;
  --ko-soft: #fdecea;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --alt: #2563a8;
  --hero: #06303f;
  --shadow: 0 1px 2px rgba(16, 36, 44, 0.05), 0 4px 14px rgba(16, 36, 44, 0.05);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0a171c;
  --surface: #11242b;
  --surface-2: #172e36;
  --ink: #e7eff1;
  --muted: #93a8af;
  --line: #233c44;
  --brand: #3ecf8e;
  --brand-strong: #63dba6;
  --brand-soft: #123a30;
  --on-brand: #05241a;
  --ok: #4ade80;
  --ok-soft: #12351f;
  --ko: #f87171;
  --ko-soft: #40201e;
  --warn: #fbbf24;
  --warn-soft: #3a2c10;
  --alt: #6aa9ee;
  --hero: #06222c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); min-height: 100dvh; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.9rem); line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.08rem; line-height: 1.3; }
h3 { font-size: 1.02rem; line-height: 1.3; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.icon { display: inline-flex; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
kbd { font: 0.75rem var(--font); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; margin: 0 1px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--ko); color: #fff; }
:root[data-theme='dark'] .btn-danger { color: #2a0b09; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Structure ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; font-size: 1.08rem; letter-spacing: -0.02em; text-decoration: none !important; }
.logo-mark { display: inline-flex; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 0.94rem; text-decoration: none !important; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.on { background: var(--brand-soft); color: var(--brand-strong); }
.topbar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 0.9rem; text-decoration: none !important; }
.user-chip:hover, .user-chip.on { background: var(--surface-2); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: 0.85rem; }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.stack { display: grid; gap: 24px; }
.stack > * { min-width: 0; }
.stack-s { display: grid; gap: 12px; }
.narrow { max-width: 640px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
section > h2 { margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 0.92rem; color: var(--muted); width: fit-content; }
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; grid-column: 1 / -1; }
.empty-title { font-weight: 650; color: var(--ink); }

/* ---------- Badges, barres ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 650; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.ko { background: var(--ko-soft); color: var(--ko); }
.code { display: inline-block; font-size: 0.76rem; font-weight: 750; letter-spacing: 0.05em; color: var(--brand-strong); background: var(--brand-soft); padding: 2px 9px; border-radius: 6px; }
.pbar { display: flex; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pbar-fill { background: var(--brand); }
.pbar-fill.ok { background: var(--ok); }
.pbar-fill.mid { background: color-mix(in srgb, var(--ok) 40%, var(--surface-2)); }
.pbar-fill.ko { background: var(--ko); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); min-width: 0; }
.kpi-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-strong); flex: none; }
.kpi-value { font-size: 1.5rem; font-weight: 750; line-height: 1.15; letter-spacing: -0.02em; }
.kpi-label { font-weight: 600; font-size: 0.9rem; }
.kpi-sub { color: var(--muted); font-size: 0.8rem; }

/* ---------- Cartes de certification ---------- */
.exam-card { display: grid; gap: 8px; color: var(--ink); text-decoration: none !important; transition: border-color 0.15s, transform 0.15s; align-content: start; }
.exam-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.exam-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 24px; }
.exam-card p { font-size: 0.88rem; }
.exam-card-foot { color: var(--muted); font-size: 0.82rem !important; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; border: 0; background: transparent; height: 42px; outline: none; color: var(--ink); min-width: 0; }

/* ---------- Choix segmentés ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; max-width: 100%; }
.seg-item { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 34px; }
.seg-item:hover:not(:disabled) { color: var(--ink); }
.seg-item.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg-item:disabled { opacity: 0.45; cursor: not-allowed; }
.seg-count { font-size: 0.74rem; background: var(--surface-2); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.seg-item.on .seg-count { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- Fiche certification ---------- */
.exam-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.exam-head-main { display: grid; gap: 6px; justify-items: start; }
.exam-head-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.mode-card { display: grid; gap: 16px; align-content: start; }
.mode-head { display: flex; gap: 12px; align-items: flex-start; }
.mode-head p { font-size: 0.9rem; }
.opt { display: grid; gap: 6px; }
.opt-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.facts > div { background: var(--surface-2); border-radius: 11px; padding: 12px; display: grid; text-align: center; }
.facts strong { font-size: 1.2rem; letter-spacing: -0.01em; }
.facts span { font-size: 0.8rem; color: var(--muted); }
.custom summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--brand); width: fit-content; }
.custom-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 6px; }
.hardest { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 10px; }
.hardest li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; }

/* ---------- Listes ---------- */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; border-radius: 8px; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row-main { display: grid; flex: 1; min-width: 0; font-size: 0.92rem; }
.row-main strong, .row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { font-size: 0.82rem; }
.row-score { flex: none; min-width: 52px; text-align: center; font-weight: 750; font-size: 0.9rem; padding: 4px 6px; border-radius: 8px; background: var(--surface-2); }
.row-score.ok { background: var(--ok-soft); color: var(--ok); }
.row-score.ko { background: var(--ko-soft); color: var(--ko); }
.resume { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: 12px 16px; flex-wrap: wrap; }
.resume-main { display: grid; flex: 1 1 200px; min-width: 0; }
.resume-main span { font-size: 0.86rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.table th { text-align: left; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table .cov { min-width: 150px; }
.table .cov .pbar { margin-bottom: 2px; }

/* ---------- Graphiques ---------- */
.ring { position: relative; flex: none; }
.ring-track { stroke: var(--surface-2); }
.ring-value { stroke: var(--brand); transition: stroke-dasharray 0.6s ease; }
.ring.ok .ring-value { stroke: var(--ok); }
.ring.ko .ring-value { stroke: var(--ko); }
.ring.alt .ring-value { stroke: var(--alt); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.ring-label strong { font-size: 1.15rem; letter-spacing: -0.02em; }
.ring-label span { font-size: 0.72rem; color: var(--muted); }
.result-head .ring-label strong { font-size: 2rem; }
.result-head .ring-label span { font-size: 0.9rem; }
.chart-svg { width: 100%; height: 150px; display: block; }
.chart-svg.tall { height: auto; }
.bar-ok { fill: var(--ok); }
.bar-ko { fill: var(--ko); }
.bar-empty { fill: var(--line); }
.bar:hover rect:first-child, .bar:focus rect:first-child { fill: var(--surface-2); }
.bar { outline: none; }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.chart-tip { color: var(--ink); font-weight: 600; }
.legend { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.dot:first-child { margin-left: 0; }
.dot.ok { background: var(--ok); }
.dot.ko { background: var(--ko); }
.dash { width: 16px; border-top: 2px dashed var(--muted); display: inline-block; margin-left: 6px; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; }
.pass-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 5; }
.score-line { stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.score-dot { stroke: var(--surface); stroke-width: 2; cursor: pointer; outline: none; }
.score-dot.ok { fill: var(--ok); }
.score-dot.ko { fill: var(--ko); }
.score-dot:hover, .score-dot:focus { r: 7; }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.9rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], select { width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
select { width: auto; height: 38px; font-size: 0.9rem; }
.form { display: grid; gap: 16px; justify-items: start; }
.form .field { width: 100%; }
.form-error { background: var(--ko-soft); color: var(--ko); padding: 10px 12px; border-radius: 10px; font-size: 0.92rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.danger-zone { border-color: color-mix(in srgb, var(--ko) 35%, var(--line)); }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; flex-wrap: wrap; }
.danger-row p { font-size: 0.88rem; }

/* ---------- Connexion ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero { background: var(--hero); color: #eaf4f1; padding: 48px clamp(24px, 6vw, 72px); display: grid; align-content: center; gap: 20px; background-image: radial-gradient(circle at 85% 12%, rgba(62, 207, 142, 0.28), transparent 45%), radial-gradient(circle at 10% 95%, rgba(62, 207, 142, 0.14), transparent 40%); }
.auth-hero .logo { color: #fff; margin-bottom: 20px; }
.auth-hero h2 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); line-height: 1.15; letter-spacing: -0.025em; max-width: 16em; text-wrap: balance; }
.auth-hero > p { color: #b9d2cc; max-width: 34em; }
.auth-features { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 16px; }
.auth-features li { display: flex; gap: 14px; align-items: flex-start; }
.auth-features .icon { color: #3ecf8e; margin-top: 2px; }
.auth-features strong { display: block; }
.auth-features span { color: #b9d2cc; font-size: 0.92rem; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-form { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.auth-form h1 { margin-bottom: -8px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 0.92rem; }

/* ---------- Lecteur de questions ---------- */
.player { min-height: 100dvh; }
.player-top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.player-top-in { max-width: 1120px; margin: 0 auto; height: 60px; padding: 0 12px; display: flex; align-items: center; gap: 10px; }
.player-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.player-title strong, .player-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-title span { font-size: 0.82rem; }
.timer-box { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 6px 12px; border-radius: 10px; }
.timer-box.low { background: var(--ko-soft); color: var(--ko); }
.player-progress { height: 4px; background: var(--surface-2); }
.player-progress span { display: block; height: 100%; background: var(--brand); transition: width 0.3s; }
.player-body { max-width: 1120px; margin: 0 auto; padding: 24px 20px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.player-main { display: grid; gap: 16px; min-width: 0; }
.player-side { position: sticky; top: 84px; display: grid; gap: 14px; max-height: calc(100dvh - 104px); overflow: auto; }
.player-side h2 { margin: 0; }
.only-narrow { display: none; }
.qcard { display: grid; gap: 16px; padding: 24px; }
.q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-num { font-weight: 750; }
.q-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 32px; }
.tool:hover { color: var(--ink); background: var(--surface-2); }
.tool.on.flag { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tool.on.star { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tool.on.star svg { fill: currentColor; }
.q-text { font-size: 1.06rem; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.q-img { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: #fff; cursor: zoom-in; overflow: hidden; width: fit-content; max-width: 100%; display: block; }
.q-img img { display: block; max-height: 320px; }
.lightbox-img { display: block; margin: 0 auto; max-height: 80dvh; background: #fff; border-radius: 8px; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color 0.12s, background 0.12s; color: var(--ink); }
.choice:hover:not(:disabled) { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.choice:disabled { cursor: default; opacity: 1; }
.choice-letter { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); font-weight: 700; font-size: 0.85rem; color: var(--muted); background: var(--surface); }
.choice-letter.square { border-radius: 8px; }
.choice-text { flex: 1; padding-top: 2px; overflow-wrap: anywhere; }
.choice-tag { font-size: 0.74rem; font-weight: 700; color: var(--muted); white-space: nowrap; padding-top: 4px; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice.on .choice-letter { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.choice.good { border-color: var(--ok); background: var(--ok-soft); }
.choice.good .choice-letter { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.choice.wrong { border-color: var(--ko); background: var(--ko-soft); }
.choice.wrong .choice-letter { background: var(--ko); border-color: var(--ko); color: var(--surface); }
.choice.locked:not(.good):not(.wrong) { opacity: 0.75; }
.verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; font-size: 0.96rem; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.ko { background: var(--ko-soft); color: var(--ko); }
.verdict.neutral { background: var(--surface-2); color: var(--muted); }
.verdict span:last-child { margin-left: auto; font-weight: 650; }
.correction { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.corr-block { display: grid; gap: 8px; }
.corr-block h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.corr-block .q-text { font-size: 0.95rem; }
.votes { display: grid; gap: 6px; max-width: 420px; }
.vote { display: grid; grid-template-columns: 56px 1fr 44px; gap: 10px; align-items: center; font-size: 0.86rem; }
.vote-key { font-weight: 700; }
.vote-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.vote-bar span { display: block; height: 100%; background: var(--muted); border-radius: 999px; }
.vote.official .vote-bar span { background: var(--ok); }
.vote.official .vote-key { color: var(--ok); }
.vote-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.vote-warn { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 10px; font-size: 0.86rem; font-weight: 600; }
.discussion summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--brand); display: inline-flex; align-items: center; gap: 6px; width: fit-content; }
.comment { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; display: grid; gap: 6px; justify-items: start; }
.discussion .comment { margin-top: 8px; }
.comment p { white-space: pre-line; overflow-wrap: anywhere; }
.comment .reply { border-left: 2px solid var(--line); padding-left: 10px; color: var(--muted); }
.player-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.player-nav > :nth-child(2) { justify-self: end; }
.kbd-hint { font-size: 0.78rem; color: var(--muted); text-align: center; }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; }
.navcell { height: 34px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); font-size: 0.8rem; font-weight: 650; color: var(--muted); cursor: pointer; position: relative; font-variant-numeric: tabular-nums; padding: 0; }
button.navcell:hover { border-color: var(--brand); }
.navcell.done { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.navcell.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.navcell.ko { background: var(--ko-soft); border-color: transparent; color: var(--ko); }
.navcell.flag::after { content: ''; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface); }
.navcell.cur { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); color: var(--ink); }
.navlegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.navlegend span { display: inline-flex; align-items: center; gap: 6px; }
.navlegend .navcell { width: 16px; height: 16px; border-radius: 5px; display: inline-block; cursor: default; }

/* ---------- Bilan ---------- */
.result-head { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.result-head.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.result-head.ko { border-color: color-mix(in srgb, var(--ko) 45%, var(--line)); }
.result-main { display: grid; gap: 10px; flex: 1 1 320px; justify-items: start; }
.result-main .facts { width: 100%; max-width: 460px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.review { padding: 0; }
.review summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--surface-2); color: var(--muted); }
.review.ok .review-mark { background: var(--ok-soft); color: var(--ok); }
.review.ko .review-mark { background: var(--ko-soft); color: var(--ko); }
.review-mark.star { background: var(--warn-soft); color: var(--warn); }
.review-title { flex: 1; min-width: 0; display: grid; font-size: 0.92rem; }
.review-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.review[open] .review-text { display: none; }
.review-ans { font-size: 0.82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.review-body { display: grid; gap: 14px; padding: 4px 16px 18px; justify-items: stretch; }
.review-body > .btn { justify-self: start; }

/* ---------- Modales et notifications ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(6, 20, 26, 0.55); display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
.modal { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 460px; max-height: 90dvh; overflow: auto; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal-wide { max-width: 1000px; }
.modal-title { font-size: 1.15rem; }
.modal-body { display: grid; gap: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 0.92rem; box-shadow: var(--shadow); animation: rise 0.2s; text-align: center; }
.toast-error { background: var(--ko); color: #fff; }
:root[data-theme='dark'] .toast-error { color: #2a0b09; }
.toast.out { opacity: 0; transition: opacity 0.25s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Mobile ---------- */
@media (max-width: 920px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .player-body { grid-template-columns: minmax(0, 1fr); }
  .player-side { display: none; }
  .only-narrow { display: inline-grid; }
  .kbd-hint { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { padding: 32px 24px; }
  .auth-features { display: none; }
  .auth-hero .logo { margin-bottom: 0; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .user-name { display: none; }
  .user-chip { padding: 4px; }
  .topbar-in { height: 54px; padding: 0 16px; }
  .page { padding: 20px 16px calc(88px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar .nav-link { flex-direction: column; gap: 2px; font-size: 0.68rem; padding: 8px 2px; border-radius: 0; background: none !important; }
  .card { padding: 16px; }
  .qcard { padding: 18px 16px; }
  .player-body { padding: 16px 12px 110px; }
  .player-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .tool span:last-child { display: none; }
  .tool { padding: 4px 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-icon { width: 34px; height: 34px; }
  .review-ans { display: none; }
  .result-head { justify-content: center; }
  .exam-head-stats { width: 100%; justify-content: space-around; }
  .choice-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
