/* OpenQCM : feuille de style unique, sans dépendance externe (aucune requête tierce pour les élèves) */

/* ---------- Thème ---------- */

:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --topbar: rgb(245 246 250 / .82);
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e2e5ee;
  --border-strong: #cbd0dd;
  --text: #121826;
  --text-2: #424a5c;
  --muted: #646d82;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --accent: #4338ca;
  --accent-soft: #eef0ff;
  --accent-line: #c9cdfb;
  --success: #15803d;
  --success-soft: #e8f7ed;
  --success-line: #b5e2c2;
  --danger: #b42318;
  --danger-soft: #fdeeec;
  --danger-line: #f4c4be;
  --warning: #9a5b06;
  --warning-soft: #fef5e4;
  --warning-line: #f1d9a6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / .05);
  --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 6px 20px -8px rgb(16 24 40 / .10);
  --focus: 0 0 0 3px rgb(79 70 229 / .32);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1117;
    --topbar: rgb(13 17 23 / .82);
    --surface: #151b26;
    --surface-2: #1b2230;
    --border: #262f41;
    --border-strong: #354055;
    --text: #e8ebf2;
    --text-2: #bdc4d2;
    --muted: #8e98ac;
    --primary: #5b54e8;
    --primary-hover: #6c66f0;
    --accent: #a8b0ff;
    --accent-soft: rgb(99 102 241 / .15);
    --accent-line: rgb(129 140 248 / .38);
    --success: #5ad48a;
    --success-soft: rgb(34 197 94 / .13);
    --success-line: rgb(74 222 128 / .32);
    --danger: #ff8a80;
    --danger-soft: rgb(239 68 68 / .13);
    --danger-line: rgb(248 113 113 / .34);
    --warning: #f5c04e;
    --warning-soft: rgb(245 158 11 / .12);
    --warning-line: rgb(251 191 36 / .32);
    --shadow-sm: none;
    --shadow: 0 1px 2px rgb(0 0 0 / .35);
    --focus: 0 0 0 3px rgb(129 140 248 / .45);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
  scroll-padding-bottom: 100px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 1.25rem + 1.5vw, 2.2rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
p { margin: 0 0 1rem; }

code {
  font-family: var(--mono);
  font-size: .88em;
  padding: .05em .35em;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  padding: .5rem 1rem; border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.skip:focus { left: 16px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

.main { padding-top: 32px; padding-bottom: 64px; }
.has-sticky .main { padding-bottom: 128px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; justify-content: center; }

.eyebrow {
  display: inline-block;
  margin-bottom: .35rem;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.lead { font-size: 1.07rem; color: var(--text-2); }

[hidden] { display: none !important; }

/* ---------- En-tête / pied de page ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px;
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: 1.15rem; font-weight: 750; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
}
.brand .icon { width: 28px; height: 28px; color: var(--primary); }

.clock {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.clock .icon { color: var(--accent); }
.clock-tz { font-weight: 650; color: var(--muted); font-size: .78rem; }
@media (max-width: 480px) { .clock-date { display: none; } }

.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  font-size: .875rem;
  color: var(--muted);
}

.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px;
}

.footer a {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--text-2); text-decoration: none;
}
.footer a:hover { color: var(--accent); }

/* ---------- Cartes, boutons, champs ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 640px) { .card { padding: 24px; } }

.card-title {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1rem;
  font-size: 1.05rem; font-weight: 650;
}
.card-title .icon { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px;
  padding: .55rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit; font-size: .95rem; font-weight: 600; line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 2px rgb(16 24 40 / .18), inset 0 1px 0 rgb(255 255 255 / .12);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { min-height: 34px; padding: .35rem .7rem; font-size: .875rem; border-radius: 8px; }
.btn-lg { min-height: 50px; padding: .7rem 1.4rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn.is-done { color: var(--success); border-color: var(--success-line); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.input {
  width: 100%;
  min-height: 44px;
  padding: .6rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input::placeholder { color: var(--muted); opacity: .85; }
textarea.input { resize: vertical; line-height: 1.6; }

.code { font-family: var(--mono); font-size: .9rem; tab-size: 4; }

.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }

.field-label {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 600; color: var(--text-2);
}
.field-label .icon { color: var(--muted); }

.hint { margin: 0; font-size: .85rem; color: var(--muted); }

/* ---------- Alertes, badges ---------- */

.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}
.alert > .icon { margin-top: .15em; color: var(--accent); }
.alert p { margin: 0; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-line); }
.alert-danger > .icon { color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-line); }
.alert-warning > .icon { color: var(--warning); }
.alert-success { background: var(--success-soft); border-color: var(--success-line); }
.alert-success > .icon { color: var(--success); }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .8rem; font-weight: 600; letter-spacing: 0;
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.badge-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.badge-warning { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.badge-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.badge-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}

.pts {
  flex: none;
  display: inline-flex; align-items: center;
  padding: .12rem .55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .8rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pts-pos { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.pts-neg { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.pts-zero { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

/* ---------- Accueil / éditeur ---------- */

.hero { max-width: 780px; margin: 4px auto 32px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.85rem); letter-spacing: -.03em; }
.hero .lead { max-width: 620px; margin: 0 auto 24px; }

.steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-width: 780px; margin: 0 auto; padding: 0;
  list-style: none; text-align: left;
}
.steps li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.steps strong { display: block; font-size: .95rem; }
.steps .step-text span { font-size: .85rem; color: var(--muted); }
.step-num {
  flex: none;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: .85rem; font-weight: 700;
}
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

.layout-editor {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) { .layout-editor { grid-template-columns: minmax(0, 1fr) 340px; } }

.editor { padding: 0; overflow: hidden; }

.editor-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem;
  border: 0; border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.examples { display: flex; align-items: center; gap: 4px; }

.editor-body { padding: 16px; }
@media (min-width: 640px) { .editor-body { padding: 20px; } }

.dates {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 14px;
}
.dates .hint { grid-column: 1 / -1; }
@media (max-width: 520px) { .dates { grid-template-columns: minmax(0, 1fr); } }

.editor textarea { min-height: 460px; }

.editor-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 28px;
  font-size: .875rem; color: var(--text-2);
}
.summary.is-loading { opacity: .6; }

.issue-list { display: grid; gap: 6px; margin: -4px 16px 16px; padding: 0; list-style: none; }
.issue-list:empty { display: none; }
@media (min-width: 640px) { .issue-list { margin: -4px 20px 20px; } }
.issue {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--warning-line);
  background: var(--warning-soft);
  font-size: .875rem;
  overflow-wrap: anywhere;
}
.issue .icon { margin-top: .15em; color: var(--warning); }
.issue.is-error { border-color: var(--danger-line); background: var(--danger-soft); }
.issue.is-error .icon { color: var(--danger); }

.preview { display: grid; gap: 14px; }
.preview .question { box-shadow: none; }
.preview-meta { margin: 0; font-size: .875rem; color: var(--muted); }
.preview-empty { padding: 56px 16px; text-align: center; color: var(--muted); }
.preview-empty .icon { width: 32px; height: 32px; margin-bottom: 8px; color: var(--border-strong); }
.preview .option { cursor: default; }
.preview .option-text { flex: 1; }

.side { display: grid; gap: 20px; }

.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 14px;
  padding: 22px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
  font-size: .9rem;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--accent-soft); }
.dropzone:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.dropzone > .icon { width: 28px; height: 28px; color: var(--accent); }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-file { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

.snippet {
  margin: 0 0 14px;
  padding: 12px;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono); font-size: .8rem; line-height: 1.65;
}
.snippet .c { color: var(--muted); }
.snippet .n { color: var(--accent); font-weight: 700; }

.help-list { display: grid; gap: 8px; margin: 0; padding-left: 1.1rem; font-size: .875rem; color: var(--text-2); }

.note { display: flex; align-items: flex-start; gap: .5rem; margin: 0; font-size: .85rem; color: var(--muted); }
.note .icon { margin-top: .1em; }

/* ---------- Questions (QCM élève, aperçu) ---------- */

.quiz { display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }

.quiz-head { display: grid; gap: 18px; }
.quiz-head-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quiz-head h1 { margin-bottom: .2rem; }
.quiz-head p { margin: 0; }
.pseudo { max-width: 320px; }

fieldset.question { min-width: 0; margin: 0; }

.question-num {
  float: left; width: 100%;
  margin-bottom: 10px; padding: 0;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.question-num + * { clear: both; }
.question-num span { color: var(--muted); }

.question-label {
  margin-bottom: 14px;
  font-size: 1.07rem; font-weight: 600; line-height: 1.5;
  overflow-wrap: anywhere;
}

.question-label img, .option-text img {
  display: block;
  width: auto; max-width: min(100%, 560px); max-height: 420px;
  margin: 12px auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.options { display: grid; gap: 8px; }
.question-hint { margin-top: 10px; }

.option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.option:hover { border-color: var(--primary); }
.option input {
  flex: none;
  width: 1.15rem; height: 1.15rem;
  margin: .2em 0 0;
  accent-color: var(--primary);
  cursor: inherit;
}
.option.is-checked { border-color: var(--primary); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.option:focus-within { box-shadow: var(--focus); }
.option-text { min-width: 0; overflow-wrap: anywhere; }

.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--topbar);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}
.sticky-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 808px; }

.progress-wrap {
  flex: 1; min-width: 0;
  display: grid; gap: 6px;
  font-size: .85rem; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--accent-soft); }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
@media (max-width: 480px) { .sticky-inner .btn-label-long { display: none; } }

/* ---------- Résultats élève ---------- */

.narrow { display: grid; gap: 20px; max-width: 760px; margin: 0 auto; }

.score-card { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 20px; }
@media (min-width: 720px) { .score-card { grid-template-columns: minmax(0, 1fr) auto; } }
.score-card h1 { overflow-wrap: anywhere; }
.score-card p { margin: 0; }

.score-figure { display: grid; gap: 8px; min-width: 240px; }
.score-value { font-size: 3.25rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.score-value small { font-size: 1.35rem; font-weight: 600; letter-spacing: 0; color: var(--muted); }

.meter { height: 10px; overflow: hidden; border-radius: 999px; background: var(--accent-soft); }
.meter-fill { height: 100%; border-radius: inherit; background: var(--primary); }

.section-title { margin: 12px 0 0; font-size: 1.15rem; }

.correction { display: grid; gap: 14px; }
.corr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.corr-head .question-num { float: none; width: auto; margin: 0; }
.corr-caption {
  margin: 14px 0 8px;
  font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
}
.corr-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.corr-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.corr-item.is-chosen { border-color: var(--accent-line); background: var(--accent-soft); font-weight: 600; }
.corr-list.is-muted .corr-item { background: var(--surface-2); color: var(--text-2); }
.corr-empty { margin: 0; font-size: .9rem; color: var(--muted); }
.corr-note { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- Création / partage ---------- */

.success-hero { padding: 32px 20px; text-align: center; }
.success-hero p { margin-bottom: 0; }
.success-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 1px solid var(--success-line);
  background: var(--success-soft);
  color: var(--success);
}
.success-icon .icon { width: 28px; height: 28px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.copy-field { display: flex; gap: 8px; }
.copy-field .input { min-width: 0; background: var(--surface-2); font-family: var(--mono); font-size: .85rem; }
.copy-field .btn { flex: none; }

.qr-block { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.qr-block p { margin: 0; }
.qr { flex: none; width: 136px; height: 136px; padding: 6px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }

.secret {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  font-size: .9rem;
  color: var(--text-2);
}
.secret code { padding: 0; border: 0; background: none; color: var(--text); font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; }

/* ---------- Espace professeur ---------- */

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: .35rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stat { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.stat-label { font-size: .85rem; font-weight: 500; color: var(--muted); }
.stat-value { margin-top: 4px; font-size: 1.75rem; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; }
.stat-value small { font-size: .9rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }

.stack { display: grid; gap: 20px; }

.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th {
  background: var(--surface-2);
  font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }

.sort-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  cursor: pointer;
}
.sort-btn .icon { width: .95em; height: .95em; opacity: .45; }
th[aria-sort] .sort-btn { color: var(--text); }
th[aria-sort] .sort-btn .icon { opacity: 1; color: var(--accent); }

.score-cell { display: flex; align-items: center; gap: 10px; }
.score-cell > span:first-child { min-width: 3.2em; font-weight: 600; text-align: right; }
.minibar { width: 96px; height: 6px; overflow: hidden; border-radius: 999px; background: var(--accent-soft); }
.minibar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

.empty { padding: 44px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; margin-bottom: 8px; color: var(--border-strong); }
.empty p { margin: 0; }

.details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.details summary::-webkit-details-marker { display: none; }
.details summary > span { display: inline-flex; align-items: center; gap: .5rem; }
.details summary > span .icon { color: var(--accent); }
.details summary::after {
  content: "";
  width: 9px; height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
.details[open] summary::after { transform: rotate(-135deg); }
.details[open] summary { margin-bottom: 16px; }

/* ---------- Pages de message ---------- */

.message { max-width: 560px; margin: 24px auto; padding: 40px 24px; text-align: center; }
.message p { color: var(--text-2); }
.message-icon {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}
.message-icon .icon { width: 28px; height: 28px; }
.message.is-danger .message-icon { background: var(--danger-soft); color: var(--danger); }
.message.is-success .message-icon { background: var(--success-soft); color: var(--success); }

.countdown {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-bottom: 20px;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.countdown:empty { display: none; }

/* ---------- Divers ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .footer, .sticky-bar, .btn, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .stat { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .copy-field .input { border: 0; padding: 0; background: none; }
}
