/*
 * Omnyscio — feuille de style (mobile-first, responsive).
 *
 * Design system par variables CSS (« tokens ») décliné en DEUX MODES :
 * sombre et clair, commutés par l'attribut data-theme sur <html> (posé avant
 * le premier rendu par le mini-script inline de index.html, géré ensuite par
 * src/ui/theme.js : préférence auto / clair / sombre persistée).
 * Règle : AUCUNE couleur en dur dans les sélecteurs — tout dérive des tokens
 * (sauf les voiles noirs des ::backdrop, corrects dans les deux modes).
 */

/* ====================== Tokens partagés (hors couleur) ===================== */
:root {
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --maxw: 720px;
  --speed: 0.15s; /* durée des transitions d'état (hover, focus…) */
}

/* ============================ Mode SOMBRE (défaut) ========================= */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --on-accent: #04243a;   /* texte posé SUR un fond accent */
  --accent-soft: rgba(56, 189, 248, 0.14);
  --ok: #22c55e;
  --on-ok: #042f1c;
  --ok-soft: rgba(34, 197, 94, 0.15);
  --ko: #ef4444;
  --on-ko: #450a0a;
  --ko-soft: rgba(239, 68, 68, 0.15);
  /* Repère des colonnes identifiantes (#nature = identifier/key) — ambre. */
  --id: #fbbf24;
  --id-soft: rgba(251, 191, 36, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-strong: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* =============================== Mode CLAIR ================================ */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --border: #d6deea;
  --text: #1e293b;
  --muted: #5b6b80;
  --accent: #0369a1;
  --on-accent: #ffffff;
  --accent-soft: rgba(3, 105, 161, 0.10);
  --ok: #15803d;
  --on-ok: #ffffff;
  --ok-soft: rgba(21, 128, 61, 0.12);
  --ko: #b91c1c;
  --on-ko: #ffffff;
  --ko-soft: rgba(185, 28, 28, 0.10);
  --id: #b45309;
  --id-soft: rgba(180, 83, 9, 0.12);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 6px 24px rgba(15, 23, 42, 0.25);
}

* { box-sizing: border-box; }

/* L'attribut hidden doit gagner sur les display des classes de layout
   (.stack/.row en flex le neutralisaient silencieusement). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Bascule de thème adoucie (désactivée si l'utilisateur réduit le mouvement). */
body, .card, button, input, select, dialog {
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 32px;
  min-height: 100dvh;
}

h1, h2, h3 { line-height: 1.2; }

/* Logo applicatif (accueil, mentions) : vignette arrondie alignée au titre. */
.app-title { display: flex; align-items: center; gap: 12px; }
.app-logo { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--on-accent); }

/* Anneau de focus clavier homogène (jamais au simple clic souris). */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  min-height: 44px; /* cible tactile confortable sur mobile */
  transition: border-color var(--speed), background-color var(--speed),
              color var(--speed), transform var(--speed), box-shadow var(--speed);
}
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
/* Survols réservés aux appareils qui survolent VRAIMENT (souris/trackpad) :
   au doigt, :hover « colle » après le tap — on ne le déclenche jamais. */
@media (hover: hover) {
  button:hover { border-color: var(--accent); }
  button.primary:hover { box-shadow: var(--shadow); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
  box-shadow: var(--shadow);
}

.muted { color: var(--muted); }

.app-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
  text-align: center;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.app-footer a { color: var(--accent); text-decoration: none; }
.grow { flex: 1; }
.center { text-align: center; align-items: center; }

/* Commutateur de thème (pied de page) : discret, sur la ligne des liens. */
.theme-toggle {
  min-height: 26px; padding: 2px 10px; font-size: 0.8rem;
  border-radius: 999px; background: transparent; border-color: var(--border);
  color: var(--muted); vertical-align: middle;
}
@media (hover: hover) { .theme-toggle:hover { color: var(--text); } }

/* Layout utilitaires */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap, .wrap { flex-wrap: wrap; }

.card + .card, #app > div > .card { margin-top: var(--gap); }

/* Réglages : thème visuel de la base (sélecteur compact, SPECS §9) */
.palette-row .field { flex-direction: row; align-items: center; gap: 8px; }
.palette-row select { max-width: 240px; }

/* Réglages : rôles et champs */
.colrow { padding: 6px 0; border-bottom: 1px solid var(--border); }
.roles { display: flex; gap: 12px; flex-wrap: wrap; }
.role { font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.field select, .preset-bar select, .field input, .answer-input, input[type="text"], input[type="number"] {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 40px;
}
.field select:focus, .field input:focus, .answer-input:focus,
input[type="text"]:focus, input[type="number"]:focus { border-color: var(--accent); outline: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
  padding: 6px 10px; border-radius: 999px; font-size: 0.85rem; }

/* Tableau des rôles de colonnes */
.table-wrap { overflow-x: auto; }
.roles-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.roles-table th, .roles-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.roles-table thead th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-align: center; }
.roles-table thead th:first-child { text-align: left; }
.roles-table .rc { text-align: center; width: 1%; white-space: nowrap; }
.roles-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.roles-table .colname { text-align: left; }
.roles-table .ctype { display: block; font-size: 0.72rem; }
.roles-table tr.master td { border-top: 2px solid var(--border); border-bottom: none; }
.mini { min-height: 28px; padding: 2px 10px; font-size: 0.95rem; line-height: 1; background: var(--surface); border-color: var(--border); }

/* Configuration avancée (panneau repliable des réglages de session) */
details.advanced > summary {
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  list-style-position: inside;
}
details.advanced[open] > summary { margin-bottom: var(--gap); }
/* Sections par intention (h3) et réglages (h4) — SPECS §6.2. */
details.advanced h3 {
  margin: 8px 0 0; font-size: 1rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent);
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
details.advanced h4 { margin: 0; font-size: 0.95rem; }

/* Badge des types de question concernés par un réglage (QCU/QCM/QRC/FlashCard). */
.qtype-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 999px; font-size: 0.68rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  vertical-align: middle; text-transform: none; letter-spacing: normal;
}

/* Bloc de réglage dont aucun type concerné n'est coché : REPLIÉ ET GRISÉ —
   le titre (1er enfant) reste visible (découvrabilité si on ajoute un type
   plus tard), le contenu disparaît. Les valeurs ne sont jamais effacées. */
.qtype-off > :first-child { opacity: 0.45; }
.qtype-off > :first-child::after {
  content: ' — type de question non coché';
  font-size: 0.72rem; font-weight: normal; font-style: italic;
  color: var(--muted); text-transform: none; letter-spacing: normal;
}
.qtype-off > :not(:first-child) { display: none !important; }

/* Pastille d'état sur le résumé d'un panneau replié (réglages/filtres actifs). */
.active-badge { background: var(--accent); color: var(--on-accent); }
.typo-tolerance select { max-width: 320px; }

/* Bloc « Types de question » (sessions mixtes) : case + poids par type. */
.qtype-row { justify-content: space-between; }
.qtype-row .chip { flex: 1; }
.qtype-row input[type="number"] { width: 80px; }
.qtypes input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.weight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.weight-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.weight-row input { width: 80px; }
.choice-count { max-width: 220px; }

/* Préréglages nommés */
.preset-bar select { flex: 1; min-width: 140px; }
.preset-status { margin: 8px 0; font-size: 0.9rem; }
.preset-status strong { color: var(--accent); }
.preset-dirty { color: var(--ko); }
.preset-description { margin: 0 0 8px; font-size: 0.85rem; font-style: italic; }
.preset-manage { margin-top: 6px; }

/* Bouton à appui long (remise à plat) */
.hold-btn { position: relative; overflow: hidden; }
.hold-btn::before {
  content: ''; position: absolute; inset: 0; width: 0;
  background: rgba(239, 68, 68, 0.55); /* repli si color-mix absent */
  background: color-mix(in srgb, var(--ko) 55%, transparent);
  pointer-events: none;
}
.hold-btn.holding::before { width: 100%; transition: width var(--hold-ms, 1500ms) linear; }

/* Bannière « nouvelle version disponible » */
.update-banner {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  max-width: calc(100% - 32px);
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 10px 14px;
  box-shadow: var(--shadow-strong);
  z-index: 100;
}

/* Session / questions */
.stage { min-height: 50dvh; }
.prompt { margin: 0; }

/* Rappel des raccourcis clavier (desktop uniquement) */
.kbd-hint { font-size: 0.8rem; margin: 2px 0 0; }
@media (max-width: 700px), (pointer: coarse) { .kbd-hint { display: none; } }

/* Relecture des questions précédentes (barre au-dessus de la scène) */
.review-nav { margin: 6px 0; }
.review-nav .review-pos { flex: 1; text-align: center; font-size: 0.9rem; }
.review { opacity: 0.92; }

/* Accompagnement (contexte / indices) */
.extras { display: flex; flex-direction: column; gap: 8px; }
.extras:empty { display: none; }
.extra { margin: 0; }
/* Cellule à tags : une puce par tag (cf. extras-view.js). */
.extra-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.extra-label { margin: 0; font-size: 0.85rem; }
.hints .row { margin: 0; }
.hint-btn { align-self: flex-start; }
.choices { display: grid; gap: 10px; }
.choice { text-align: left; }
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.choice.correct { background: var(--ok); color: var(--on-ok); border-color: var(--ok); }
.choice.incorrect { background: var(--ko); color: var(--on-ko); border-color: var(--ko); }
.answer-input { flex: 1; }
.feedback { font-weight: 600; min-height: 1.4em; margin: 4px 0 0; }
.feedback.ok { color: var(--ok); }
.feedback.ko { color: var(--ko); }

/* Guide intégré (#/guide) et aide contextuelle ⓘ */
.help-btn { min-height: 22px; padding: 0 7px; font-size: 0.85rem; border-radius: 999px; vertical-align: middle; }
dialog.help-dialog {
  border: none; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-strong);
  max-width: min(440px, 92vw); padding: 16px;
}
dialog.help-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.help-dialog h3 { margin: 0 0 8px; }
dialog.help-dialog p { margin: 0 0 12px; }
dialog.help-dialog .help-points { margin: 0 0 12px; padding-left: 1.2em; font-size: 0.92rem; }
dialog.help-dialog .help-points li { margin: 4px 0; }
.guide .tab-active { border-color: var(--accent); font-weight: 600; }
.md h1, .md h2, .md h3 { scroll-margin-top: 12px; }
.md h2 { margin-top: 22px; }
.md table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.md th, .md td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.md th { color: var(--muted); font-weight: 500; }
.md blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md code { background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.md li { margin: 3px 0; }

/* Tableau de bord de progression (📊) */
.stats-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.stats-tile {
  flex: 1 1 110px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  text-align: center;
}
.stats-tile strong { font-size: 1.3rem; }
.stats-tile span { font-size: 0.8rem; }
.stats-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.stats-table th, .stats-table td { text-align: left; padding: 4px 8px; }
.stats-table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.stats-table tbody tr:nth-child(odd) { background: var(--surface-2); }
.stats-history p { margin: 4px 0; }

/* Explorer la base (#/browse) : table triable, en-têtes cliquables. */
.browse-table th { cursor: pointer; white-space: nowrap; user-select: none; }
.browse-table th .ctype { display: block; font-size: 0.72rem; font-weight: normal; }
.browse-table td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.browse input[type="search"] {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 40px;
}

/* Calendrier de révision (heatmap) : colonnes = semaines, rangées = jours. */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap {
  display: inline-grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
}
.heatmap i {
  display: block; width: 12px; height: 12px; border-radius: 3px;
  background: var(--surface-2);
}
.heatmap i.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--surface-2)); }
.heatmap i.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.heatmap i.l3 { background: color-mix(in srgb, var(--accent) 75%, var(--surface-2)); }
.heatmap i.l4 { background: var(--accent); }
.heatmap-legend { font-size: 0.8rem; display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
.heatmap-legend .heatmap { grid-template-rows: 12px; }

/* Fin de session */
.summary { max-width: 420px; margin: 0 auto; }
.summary .row { width: 100%; }
.summary h3 { margin: 4px 0 0; }
.summary-stats p { margin: 0; }
.summary-errors {
  margin: 0; padding-left: 1.2em; text-align: left;
  max-height: 40dvh; overflow-y: auto; width: 100%;
  font-size: 0.9rem;
}
.summary-errors li { margin-bottom: 6px; }
/* Réponse média ratée : vignettes compactes (l'attribution reste lisible). */
.summary-media { margin-top: 4px; gap: 8px; align-items: flex-start; }
.summary-media img.media { max-height: 90px; border-radius: 6px; }
.summary-media audio.media { width: 220px; }
.summary-media .media-attribution, .summary-media .media-source { font-size: 0.68rem; }
.summary select {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 44px;
}

/* FlashCard */
.flashcard .answer { text-align: center; }
/* Compléments au verso : alignés à gauche sous la réponse, séparés d'un filet. */
.flashcard .answer .reveals {
  text-align: left;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Carte groupée : auto-évaluation par élément au verso */
.groupcard .answer.verso { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.verso-element { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.verso-element .extra { flex: 1; }
.grade-toggle { min-width: 96px; flex-shrink: 0; }
.grade-toggle.ok { background: var(--ok); color: var(--on-ok); border-color: var(--ok); }
.grade-toggle.ko { background: var(--ko); color: var(--on-ko); border-color: var(--ko); }

/* Éditeur de cartes groupées (config avancée) : puce cyclant Recto → Verso → exclue */
.group-editor { padding: 12px; }
.group-editor input[type="text"] { flex: 1; min-width: 0; }
.side-chip { border-radius: 999px; font-size: 0.85rem; min-height: 32px; padding: 4px 12px; }
.side-chip.recto { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.side-chip.verso { background: var(--ok); color: var(--on-ok); border-color: var(--ok); font-weight: 600; }
.answer-value { font-size: 1.6rem; font-weight: 700; }
.answer-list { margin: 0; padding-left: 1.2em; text-align: left; }
.answer-list li { font-size: 1.1rem; font-weight: 600; }
.ok-btn { background: var(--ok); color: var(--on-ok); }
.ko-btn { background: var(--ko); color: var(--on-ko); }

/* Média */
.media { max-width: 100%; border-radius: 8px; }
/* Lisibilité : une image d'énoncé/d'accompagnement ne mange pas l'écran. */
img.media { max-height: 38dvh; width: auto; object-fit: contain; display: block; }
img.media.zoomable { cursor: zoom-in; }
.media-attribution { font-size: 0.75rem; margin: 4px 0 0; }
.media-attribution a { color: inherit; }
.media-source { font-size: 0.75rem; margin: 2px 0 0; }

/* Propositions MÉDIA (réponse média, SPECS §5.2) : grille de cartes. */
.choices.media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: start; }
/* La carte est un div (les commandes audio doivent rester cliquables) :
   on lui donne l'apparence des boutons de choix. */
.choice.media-choice {
  cursor: pointer;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
}
@media (hover: hover) { .choice.media-choice:hover:not(.locked) { border-color: var(--accent); } }
.choice.media-choice img.media { max-height: 160px; margin: 0 auto; }
.choice.media-choice audio.media { width: 100%; }
.choice.media-choice .media-attribution,
.choice.media-choice .media-source { font-size: 0.68rem; }
.choice.media-choice.locked { cursor: default; }

/* Lightbox : agrandissement plein écran d'une image (clic pour fermer). */
dialog.lightbox { border: none; background: transparent; padding: 0; max-width: 96vw; max-height: 96dvh; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.75); }
dialog.lightbox img { max-width: 96vw; max-height: 96dvh; object-fit: contain; cursor: zoom-out; border-radius: 8px; }

/* Hors-ligne par thème */
button.danger { background: var(--ko); color: var(--on-ko); font-weight: 600; }
button.offline-on { background: var(--ok); color: var(--on-ok); border-color: var(--ok); }
.offline-panel { margin-top: 8px; }

/* Réglages : éditeur de source média d'une colonne (⚙ dans la table des rôles) */
.msrc-panel { margin: 4px 0; padding: 6px 8px; background: var(--surface); border-radius: 8px; }
.msrc-panel .chip { white-space: nowrap; }
.msrc-note { margin: 4px 0 0; font-size: 0.85rem; }

/* Accueil : entrée du catalogue non installée (bases intégrées) */
.catalog-entry { padding: 6px 0; }
.catalog-entry .catalog-desc { margin: 2px 0 0; font-size: 0.9rem; }

/* Cartes dues (répétition espacée) : pastille sur le bouton du thème.
   Voile noir translucide : lisible sur le fond accent dans les deux modes. */
.due-chip {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  font-weight: 600;
}
.offline-cols { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.offline-col { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.offline-col input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.offline-storage { margin-top: 8px; }
.offline-badge { color: var(--ok); font-weight: 600; }
.progress {
  height: 10px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; margin: 8px 0;
}
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

@media (min-width: 600px) {
  .choices { grid-template-columns: 1fr 1fr; }
}

/* ====================== Interactions adaptatives (SPECS §9) ================
   Adaptation par CAPACITÉS : (pointer: coarse) = doigt, (hover: hover) =
   souris — voir aussi les gardes hover plus haut et src/ui/touch.js. */

/* Indice de balayage (flashcard révélée) : tactile uniquement. */
.swipe-hint { display: none; font-size: 0.8rem; text-align: center; margin: 0; }

/* Bouton « Installer l'application » (accueil — visible si le navigateur
   propose l'installation, cf. src/ui/install.js). */
.install-btn { margin: 0 0 4px; }

/* Objectif quotidien (accueil) */
.goal-card summary { cursor: pointer; }
.goal-card input[type="number"] { max-width: 120px; }
.goal-card h2 { margin: 0; }
.goal-card .progress { margin-top: 4px; }
.goal-card p { margin: 4px 0 0; }

@media (pointer: coarse) {
  /* Cibles plus généreuses au doigt. */
  button { min-height: 48px; }
  .mini { min-height: 36px; }
  .help-btn { min-height: 30px; min-width: 30px; }
  .theme-toggle { min-height: 32px; }
  .roles-table input[type="checkbox"], .qtypes input[type="checkbox"],
  .offline-col input[type="checkbox"] { width: 22px; height: 22px; }

  .swipe-hint { display: block; }

  /* La rangée d'action principale (Valider / suivante / notation) reste à
     portée de pouce : collante en bas de l'écran quand la question déborde. */
  .stage .actions {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 5;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.12);
  }
}

/* Aide contextuelle en « bottom sheet » sur petit écran tactile : pleine
   largeur, collée en bas, plus naturelle au pouce qu'une boîte centrée. */
@media (max-width: 600px) and (pointer: coarse) {
  dialog.help-dialog {
    margin: auto 0 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}
