/* ==========================================================================
   Vocabulaire Voltaire — « La copie corrigée »
   Papier sur fond de pierre, encre bleu nuit, un seul stylo rouge.
   Formes pleines et angles droits : aucun filet, aucun dégradé, aucune ombre au repos.
   ========================================================================== */

@font-face { font-family: "Fraunces"; src: url("../../fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../../fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../../fonts/figtree-italic.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }

/* ---------- Jetons ---------- */
:root, :root[data-theme="light"] {
  --ground: #E6E4DE;      /* le bureau */
  --paper: #F9F8F4;       /* la feuille */
  --paper-2: #EFEDE7;     /* un cran en dessous de la feuille */
  --ink: #1A2140;
  --on-ink: #F9F8F4;
  --muted: #565D76;
  --pen: #C42A21;         /* le stylo rouge : corrections et erreurs */
  --pen-tint: #F4D8D3;
  --pen-ink: #8E1A13;
  --ok: #1B7A4B;
  --ok-tint: #D5EADB;
  --ok-ink: #0F5231;
  --sel: #D9DFEF;         /* sélection */
  --gold: #E3AA3A;        /* le signet */
  --gold-ink: #1A2140;
  --green: #1E4B39;
  --on-green: #F4F6F1;
  --focus: #1A2140;
  --scrim: rgba(18, 22, 40, .55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0E1322;
    --paper: #1A2138;
    --paper-2: #232B45;
    --ink: #ECEEF6;
    --on-ink: #10152A;
    --muted: #A5ADC6;
    --pen: #FF8B7F;
    --pen-tint: #46241F;
    --pen-ink: #FFB3AA;
    --ok: #6FD3A2;
    --ok-tint: #1B3A2D;
    --ok-ink: #9BE6C0;
    --sel: #2C3A63;
    --gold: #E9B650;
    --gold-ink: #10152A;
    --green: #1F4D3B;
    --on-green: #F1F5EF;
    --focus: #E9B650;
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0E1322;
  --paper: #1A2138;
  --paper-2: #232B45;
  --ink: #ECEEF6;
  --on-ink: #10152A;
  --muted: #A5ADC6;
  --pen: #FF8B7F;
  --pen-tint: #46241F;
  --pen-ink: #FFB3AA;
  --ok: #6FD3A2;
  --ok-tint: #1B3A2D;
  --ok-ink: #9BE6C0;
  --sel: #2C3A63;
  --gold: #E9B650;
  --gold-ink: #10152A;
  --green: #1F4D3B;
  --on-green: #F1F5EF;
  --focus: #E9B650;
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

:root {
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --page: 1240px;
  --gap: clamp(12px, 1.6vw, 20px);
  --section: clamp(72px, 11vw, 160px);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Cinq tailles : titre, h2, chapeau, texte, détail */
  --t-display: clamp(3.1rem, 8.2vw, 7.25rem);
  --t-h2: clamp(2rem, 4.6vw, 3.6rem);
  --t-lead: clamp(1.15rem, 1.9vw, 1.4rem);
  --t-body: 1.0625rem;
  --t-small: .9rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100svh;
  background: var(--ground); color: var(--ink);
  font-family: var(--sans); font-size: var(--t-body); line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: inherit; }
::selection { background: var(--gold); color: var(--gold-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.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: var(--gutter); top: -80px; z-index: 100; background: var(--ink); color: var(--on-ink); padding: .7rem 1.1rem; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Barre du site ---------- */
.site-bar {
  max-width: var(--page); margin: 0 auto; padding: 14px var(--gutter);
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; color: var(--ink); min-height: 44px; }
.brand-mark { width: 34px; height: 34px; color: var(--ink); flex: none; }
.brand:hover .brand-pen { animation: pen-wiggle .6s var(--ease); }
@keyframes pen-wiggle { 0% { transform: translateX(0); } 40% { transform: translateX(-3px); } 100% { transform: translateX(0); } }
.theme-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; background: var(--paper); color: var(--ink); font-weight: 600; font-size: var(--t-small); transition: background .2s, transform .15s; }
.theme-btn:hover { background: var(--paper-2); }
.theme-btn:active { transform: scale(.97); }
.theme-btn .ic { display: none; }
.theme-btn[data-mode="auto"] .ic-auto, .theme-btn[data-mode="light"] .ic-light, .theme-btn[data-mode="dark"] .ic-dark { display: block; }

/* ---------- Cadre ---------- */
.app { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter) clamp(48px, 8vw, 96px); outline: none; }
.screen { padding-top: clamp(8px, 2vw, 24px); }

/* ---------- Titres ---------- */
.display, .h2, .question-word, .result-score, .tile-title, .entry-word, .big-count strong, .card-word, .foot-mark, .rulebox h3, .board-rank {
  font-family: var(--serif); font-weight: 600; font-variation-settings: "opsz" 144; letter-spacing: -.03em;
}
.display { font-size: var(--t-display); line-height: .94; font-weight: 650; letter-spacing: -.045em; }
.display span { display: block; }
.h2 { font-size: var(--t-h2); line-height: 1; letter-spacing: -.035em; }
.lead { font-size: var(--t-lead); line-height: 1.45; max-width: 36ch; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .75rem 1.4rem; font-weight: 650; text-align: center; line-height: 1.2;
  background: var(--paper); color: var(--ink);
  transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--pen); color: #fff; }
:root[data-theme="dark"] .btn-primary:hover:not(:disabled) { color: #2A0F0B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary:hover:not(:disabled) { color: #2A0F0B; } }
.btn-ghost { background: var(--paper); }
.btn-ghost:hover:not(:disabled) { background: var(--sel); }
.btn-quiet { background: transparent; padding-left: 0; padding-right: 0; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.btn-quiet:hover:not(:disabled) { text-decoration-color: var(--pen); }
.btn-lg { min-height: 56px; padding: .9rem 1.8rem; font-size: 1.05rem; }
.btn-lg.btn-quiet { padding-left: .2rem; padding-right: .2rem; }
.btn-small { min-height: 40px; padding: .45rem 1rem; font-size: var(--t-small); }
.btn-small.btn-quiet { padding-left: 0; padding-right: 0; }
.btn-ok { background: var(--ok-tint); color: var(--ok-ink); }
.btn-ok:hover:not(:disabled) { background: var(--ok); color: var(--paper); }
.btn-ko { background: var(--pen-tint); color: var(--pen-ink); }
.btn-ko:hover:not(:disabled) { background: var(--pen); color: var(--paper); }
.btn-danger { background: var(--pen); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2A0F0B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #2A0F0B; } }
.btn-danger:hover:not(:disabled) { background: var(--pen-ink); color: var(--paper); }
.link-btn { color: var(--ink); font-weight: 650; font-size: var(--t-small); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--muted); min-height: 32px; transition: text-decoration-color .2s; }
.link-btn:hover { text-decoration-color: var(--pen); }

/* ---------- Entrées en scène ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.015); } 100% { transform: scale(1); } }
.stagger > *, .screen:not([hidden]) .enter, .options > *, .review li, .board > li {
  animation: rise .7s var(--ease) both;
}
.stagger > :nth-child(2), .options > :nth-child(2), .board > li:nth-child(2) { animation-delay: .07s; }
.stagger > :nth-child(3), .options > :nth-child(3), .board > li:nth-child(3) { animation-delay: .14s; }
.stagger > :nth-child(4), .options > :nth-child(4), .board > li:nth-child(4) { animation-delay: .21s; }
.board > li:nth-child(n+5) { animation-delay: .26s; }
.review li:nth-child(2) { animation-delay: .05s; } .review li:nth-child(3) { animation-delay: .1s; } .review li:nth-child(n+4) { animation-delay: .15s; }
.entry { animation: rise .8s .2s var(--ease) both; }
/* Révélation au défilement : seulement si le script tourne (classe .js posée dans <head>) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .tile.reveal { transition: translate .25s var(--ease), background .25s var(--ease), opacity .8s var(--ease), transform .8s var(--ease); }
}

/* ---------- Barre de contexte (retour, état, minuteur) ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; min-height: 48px; margin-bottom: clamp(20px, 3vw, 40px); }
.topbar-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.back-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1.1rem 0 .7rem; background: var(--paper); font-weight: 650; transition: background .2s, transform .15s; }
.back-btn:hover { background: var(--sel); }
.back-btn:active { transform: scale(.97); }
.topbar-info { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--t-small); font-weight: 500; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: .45rem 1rem; background: var(--ink); color: var(--on-ink); font-size: 1.1rem; }
.timer.low { background: var(--pen); color: #fff; animation: pulse 1s steps(2, jump-none) infinite; }
:root[data-theme="dark"] .timer.low { color: #2A0F0B; }
@keyframes pulse { 50% { opacity: .75; } }

/* ==========================================================================
   ACCUEIL
   ========================================================================== */
.hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: end; padding: clamp(8px, 3vw, 32px) 0 clamp(40px, 6vw, 80px); }
.hero-main { grid-column: 1 / span 7; display: flex; flex-direction: column; gap: clamp(20px, 2.4vw, 32px); align-self: center; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; }

/* La fiche du dictionnaire */
.entry { grid-column: 8 / span 5; position: relative; container-type: inline-size; background: var(--paper); padding: clamp(28px, 3.4vw, 48px); padding-top: clamp(36px, 4vw, 56px); display: flex; flex-direction: column; gap: .5rem; min-height: 360px; }
.ribbon { position: absolute; right: clamp(20px, 3vw, 36px); top: 0; width: 26px; height: 56px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); transition: height .3s var(--ease); }
.entry:hover .ribbon { height: 68px; }
.entry-head { padding-right: 36px; }
.entry-word { display: inline; font-size: clamp(1.9rem, calc((100cqw - 36px) / (var(--len, 8) * .56)), 3.6rem); line-height: 1.02; overflow-wrap: anywhere; }
.entry-type { font-style: italic; color: var(--muted); font-size: 1.05rem; margin-left: .35rem; white-space: nowrap; }
.pen-line { width: 100%; height: 12px; margin: .1rem 0 .6rem; overflow: visible; }
.pen-line path { fill: none; stroke: var(--pen); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; vector-effect: non-scaling-stroke; }
.pen-line.drawing path { animation: draw .9s .1s var(--ease) both; }
.entry-def { font-size: 1.2rem; line-height: 1.4; }
.entry-ex { color: var(--muted); font-style: italic; }
.entry-foot { margin-top: auto; padding-top: 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; color: var(--muted); font-size: var(--t-small); }

/* Compte */
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; flex-wrap: wrap; background: var(--paper-2); padding: 1rem clamp(16px, 2vw, 28px); margin-bottom: var(--gap); }
.account-bar p { color: var(--muted); }
.account-bar strong { color: var(--ink); }
.account-actions { display: flex; gap: .5rem 1rem; align-items: center; flex-wrap: wrap; }
.account-rank { display: block; font-size: var(--t-small); margin-top: .1rem; }

/* Les modes : une mosaïque de plages de couleur */
.modes { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: .5rem; min-height: 220px;
  padding: clamp(20px, 2.4vw, 32px);
  background: var(--paper); color: var(--ink);
  transition: translate .25s var(--ease), background .25s var(--ease), opacity .8s var(--ease), transform .8s var(--ease);
  overflow: hidden;
}
.tile::after { content: "→"; content: "→" / ""; position: absolute; right: clamp(18px, 2vw, 30px); top: clamp(12px, 1.6vw, 22px); font-size: 2rem; line-height: 1; font-weight: 500; transition: transform .3s var(--ease); }
.tile-title { font-size: clamp(1.45rem, 2.3vw, 2rem); line-height: 1.08; margin-top: auto; max-width: 22ch; }
.tile-desc { font-size: 1rem; line-height: 1.45; max-width: 38ch; opacity: .92; }
.tile:hover:not(:disabled) { translate: 0 -4px; }
.tile:hover:not(:disabled)::after { transform: translateX(6px); }
.tile:active:not(:disabled) { translate: 0 -1px; }
.tile:disabled { opacity: .5; }
.t-quiz { grid-column: span 7; min-height: 300px; background: var(--ink); color: var(--on-ink); }
.t-quiz .tile-title { font-size: clamp(2rem, 4vw, 3.4rem); max-width: 12ch; }
.t-quiz .tile-desc { font-size: 1.1rem; }
.t-quiz:hover:not(:disabled) { background: var(--ink); }
.t-exam { grid-column: span 5; min-height: 300px; }
.t-cards, .t-inverse, .t-revision { grid-column: span 4; }
.t-revision { background: var(--pen-tint); color: var(--pen-ink); }
.t-revision:disabled { background: var(--paper); color: var(--muted); }
.t-regles { grid-column: span 8; background: var(--green); color: var(--on-green); }
.t-regles .tile-desc { max-width: 52ch; }
.t-board { grid-column: span 4; background: var(--gold); color: var(--gold-ink); }
.modes:has(#board-btn[hidden]) .t-regles { grid-column: span 12; }

/* Progression */
.panel { margin-top: var(--section); }
.panel > .h2 { margin-bottom: clamp(24px, 4vw, 48px); }
.progress-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.progress-main { grid-column: 1 / span 6; background: var(--paper); padding: clamp(24px, 3vw, 44px); display: flex; flex-direction: column; gap: 1.25rem; }
.progress-side { grid-column: 7 / span 6; background: var(--paper-2); padding: clamp(24px, 3vw, 44px); }
.big-count { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; line-height: .8; }
.big-count strong { font-size: clamp(5rem, 11vw, 9rem); font-weight: 650; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.big-count span { font-size: 1.1rem; color: var(--muted); line-height: 1.3; }
.mastery-bar { height: 16px; background: var(--paper-2); overflow: hidden; }
.mastery-bar div { height: 100%; width: 0; background: var(--ok); transition: width .9s var(--ease); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); padding: 0; margin: 0; list-style: none; }
.stats li { display: flex; flex-direction: column; color: var(--muted); font-size: var(--t-small); line-height: 1.3; }
.stats strong { font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.side-title { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; letter-spacing: -.025em; margin-bottom: 1rem; }
#history-box .btn { margin-top: 1.25rem; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.history li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .75rem 1rem; background: var(--paper); font-size: var(--t-small); }
.history .h-mode { font-weight: 650; }
.history .h-date { color: var(--muted); }
.history .h-score { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); font-size: 1.05rem; max-width: 30ch; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: var(--gap); font-size: var(--t-small); color: var(--muted); }

/* Pied de page */
.site-foot { margin-top: var(--section); background: var(--ink); color: var(--on-ink); padding: clamp(28px, 4vw, 56px) clamp(20px, 3vw, 48px) clamp(24px, 3vw, 40px); overflow: hidden; }
.foot-mark { font-size: clamp(2.6rem, 10.4vw, 9.4rem); line-height: .9; letter-spacing: -.05em; font-weight: 650; white-space: nowrap; margin-bottom: clamp(28px, 4vw, 56px); margin-left: -.04em; }
.foot-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; }
.site-foot .link-btn { color: var(--on-ink); text-decoration-color: currentColor; }
.site-foot .link-btn:hover { text-decoration-color: var(--gold); }
.site-foot .btn-ghost { background: var(--on-ink); color: var(--ink); }
.site-foot :focus-visible { outline-color: var(--gold); }
.install-hint { font-size: var(--t-small); max-width: 44ch; }

/* ==========================================================================
   QUIZ
   ========================================================================== */
.progress-track { height: 12px; background: var(--paper); margin-bottom: clamp(28px, 5vw, 64px); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--ink); transition: width .5s var(--ease); }
.qa { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.qa-left { grid-column: 1 / span 5; display: flex; flex-direction: column; gap: 1.1rem; position: sticky; top: 24px; container-type: inline-size; }
.qa-right { grid-column: 6 / span 7; display: flex; flex-direction: column; gap: 1rem; }
.question-word { font-size: clamp(2.6rem, 6.2vw, 5.4rem); line-height: .98; letter-spacing: -.04em; font-weight: 650; overflow-wrap: anywhere; hyphens: auto; }
.question-word:not(.def) { font-size: clamp(2rem, calc(100cqw / (var(--len, 8) * .56)), 5.4rem); }
.question-word.def { font-size: clamp(1.6rem, 3.2vw, 2.5rem); font-weight: 600; line-height: 1.12; letter-spacing: -.025em; }
.question-hint { color: var(--muted); font-size: 1.1rem; font-family: var(--sans); font-weight: 500; letter-spacing: 0; }
.answer-ex { color: var(--ink); font-style: italic; background: var(--paper); padding: 1rem 1.2rem; max-width: 46ch; }
.answer-ex:empty { display: none; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; min-height: 72px;
  background: var(--paper); padding: .9rem 1.1rem .9rem .9rem; line-height: 1.35; font-size: 1.1rem;
  transition: background .2s var(--ease), transform .2s var(--ease), color .2s var(--ease);
}
.option.word { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.option:hover:not(:disabled) { background: var(--sel); transform: translateX(4px); }
.option:active:not(:disabled) { transform: translateX(4px) scale(.99); }
.option:disabled { cursor: default; }
.option-key { flex: none; width: 44px; height: 44px; display: grid; place-items: center; background: var(--paper-2); font-family: var(--serif); font-weight: 650; font-size: 1.3rem; transition: background .2s, color .2s; }
.option:hover:not(:disabled) .option-key { background: var(--ink); color: var(--on-ink); }
.option-key svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.option-key path { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw .45s var(--ease) both; }
.option.correct { background: var(--ok-tint); color: var(--ok-ink); animation: pop .4s var(--ease); }
.option.correct .option-key { background: var(--ok); color: var(--paper); }
.option.wrong { background: var(--pen-tint); color: var(--pen-ink); }
.option.wrong .option-key { background: var(--pen); color: var(--paper); }
.option.wrong .opt-text { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--pen); }
.option.picked { background: var(--sel); }
.option.picked .option-key { background: var(--ink); color: var(--on-ink); }
.option.dimmed { opacity: .5; }
:root[data-theme="dark"] .option.correct .option-key, :root[data-theme="dark"] .option.wrong .option-key { color: #10152A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .option.correct .option-key, :root:not([data-theme="light"]) .option.wrong .option-key { color: #10152A; } }

.feedback { min-height: 1.6rem; font-weight: 700; font-size: 1.1rem; }
.feedback.ok { color: var(--ok); }
.feedback.ko { color: var(--pen); }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }

/* ---------- Résultats ---------- */
.result-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; margin-bottom: var(--section); }
.result-card { grid-column: 1 / span 7; background: var(--ink); color: var(--on-ink); padding: clamp(28px, 4vw, 64px); display: flex; flex-direction: column; gap: .5rem; min-height: 360px; justify-content: flex-end; }
.result-mode { font-weight: 650; opacity: .85; margin-bottom: auto; }
.result-score { font-size: clamp(5.5rem, 17vw, 13rem); line-height: .82; font-weight: 650; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.result-score small { font-size: .32em; letter-spacing: -.02em; opacity: .65; font-weight: 600; }
.result-pct { font-size: 1.3rem; font-weight: 650; margin-top: 1.25rem; }
.result-side { grid-column: 8 / span 5; display: flex; flex-direction: column; gap: 1.5rem; justify-content: flex-end; }
.result-extra { color: var(--muted); }
.result-extra:empty { display: none; }

.review h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -.03em; margin: 0 0 1.25rem; }
.review ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review li { background: var(--paper); padding: 1.1rem 1.3rem 1.2rem; position: relative; }
.review li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--pen); }
.review strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.review .yours { display: block; color: var(--pen-ink); font-size: var(--t-small); font-weight: 600; margin-top: .35rem; }
.review li .link-btn { display: block; margin-top: .6rem; }

/* ==========================================================================
   RÈGLES
   ========================================================================== */
.page-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem var(--gap); margin-bottom: clamp(28px, 4vw, 48px); align-items: end; }
.page-head .h2 { grid-column: 1 / span 7; }
.page-head .lead { grid-column: 8 / span 5; max-width: 34ch; }
.regles-actions { grid-column: 1 / -1; }
.display-2 { font-size: clamp(2.8rem, 8vw, 6.5rem); line-height: .92; font-weight: 650; letter-spacing: -.045em; }
.regles-tools { display: flex; flex-wrap: wrap; gap: 12px var(--gap); align-items: center; margin-bottom: 1rem; }
.field-search { position: relative; flex: 1 1 320px; max-width: 520px; }
.field-search .ic { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field-search input { width: 100%; min-height: 52px; padding: .7rem 1rem .7rem 3rem; background: var(--paper); border: 0; border-radius: 0; }
.field-search input::placeholder { color: var(--muted); opacity: 1; }
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; flex: 1 1 auto; }
.cat-tabs button { flex: none; min-height: 44px; padding: 0 1.1rem; background: var(--paper); font-weight: 650; font-size: var(--t-small); color: var(--muted); transition: background .2s, color .2s; }
.cat-tabs button:hover { background: var(--sel); color: var(--ink); }
.cat-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.regles-meta { color: var(--muted); font-size: var(--t-small); margin: 0 0 1.25rem; }
#regles-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.rule { background: var(--paper); min-width: 0; }
.rule[open] { grid-column: 1 / -1; background: var(--paper); }
.rule summary { list-style: none; cursor: pointer; padding: 1.1rem 1.2rem; display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; line-height: 1.3; font-weight: 650; transition: background .2s; min-height: 64px; }
.rule summary:hover { background: var(--sel); }
.rule summary::-webkit-details-marker { display: none; }
.rule summary::after { content: "+"; font-family: var(--serif); font-size: 1.7rem; line-height: .9; color: var(--muted); flex: none; transition: transform .25s var(--ease); }
.rule[open] summary::after { content: "–"; }
.r-head { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.r-cat { font-size: var(--t-small); font-weight: 500; color: var(--muted); }
.r-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.rule-body { padding: .25rem 1.2rem 1.4rem; display: grid; gap: .9rem; max-width: 74ch; }
.rule-body p { margin: 0; }
.astuce { background: var(--paper-2); padding: .85rem 1.1rem; border-left: 5px solid var(--gold); }
.astuce strong { color: var(--ink); }
.r-example { color: var(--muted); font-style: italic; }
.r-example strong { color: var(--pen); font-style: normal; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.rchip { font-size: .8rem; font-weight: 650; padding: .15rem .6rem; background: var(--paper-2); color: var(--muted); white-space: nowrap; flex: none; }
.rchip.revoir { background: var(--pen-tint); color: var(--pen-ink); }
.rchip.maitrisee { background: var(--ok-tint); color: var(--ok-ink); }
.rule-body .btn { justify-self: start; }
.source-link { color: var(--muted); font-size: var(--t-small); margin-top: 2rem; }
.source-link a { font-weight: 650; color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 2px; }

/* ---------- Trouve la faute ---------- */
#screen-practice .question-hint { max-width: 60ch; margin-bottom: clamp(16px, 3vw, 32px); }
.sentence { font-family: var(--serif); font-weight: 500; font-variation-settings: "opsz" 48; font-size: clamp(1.5rem, 3.3vw, 2.6rem); line-height: 2.5; letter-spacing: -.015em; margin: 0 0 clamp(20px, 3vw, 40px); background: var(--paper); padding: clamp(20px, 3.4vw, 52px) clamp(18px, 3.4vw, 52px) clamp(28px, 3.4vw, 56px); }
.sentence.q-sentence { line-height: 1.35; font-size: clamp(1.5rem, 3vw, 2.4rem); }
.tok { background: none; border: 0; padding: .05rem .25rem; margin: 0 .02rem; font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; transition: background .15s; }
button.tok:hover:not(:disabled) { background: var(--sel); }
.tok.plain { cursor: default; padding: .05rem .1rem; }
.tok.slot { position: relative; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: .22em; text-decoration-color: var(--ink); }
.tok.slot::after { content: attr(data-letter); position: absolute; left: 50%; transform: translateX(-50%); bottom: -1.05em; font-family: var(--sans); font-size: .42em; line-height: 1; font-weight: 750; color: var(--muted); }
.tok.slot.sel { background: var(--sel); text-decoration-color: var(--pen); }
.tok.slot.bad { text-decoration-line: line-through; text-decoration-color: var(--pen); color: var(--pen); }
.tok.slot.oublie { background: var(--pen-tint); }
.tok:disabled { cursor: default; }
.tok.bad { color: var(--pen); text-decoration: line-through; text-decoration-thickness: 3px; }
.tok.good { color: var(--ok); font-weight: 700; }
.tok.miss { background: var(--pen-tint); }
.tok-fix { color: var(--ok); font-weight: 700; margin: 0 .35rem 0 .15rem; animation: rise .5s var(--ease) both; }
.rulebox { background: var(--paper); border-left: 8px solid var(--gold); padding: clamp(18px, 2.4vw, 32px); margin: 0 0 1.5rem; display: grid; gap: .6rem; }
.rulebox h3 { font-size: 1.5rem; line-height: 1.1; }
.rulebox p { margin: 0; }
.rulebox .r-text { max-width: 70ch; }
.correction { text-align: center; margin: 0 0 1rem; font-size: 1.1rem; }
.correction:empty { display: none; }
#screen-practice .feedback { text-align: center; margin: 1rem 0 .5rem; }
#screen-practice .options { margin-bottom: 1rem; }
#prac-play .actions { margin-top: 1rem; }

/* ==========================================================================
   CLASSEMENT
   ========================================================================== */
.board-wrap { max-width: 860px; }
.board-wrap > .h2 { margin-bottom: clamp(20px, 3vw, 36px); }
.tabs { display: flex; gap: 6px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs button { flex: 1 1 auto; min-height: 48px; padding: 0 1rem; background: var(--paper); font-weight: 650; color: var(--muted); text-align: center; transition: background .2s, color .2s; }
.tabs button:hover { background: var(--sel); color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.note { font-size: var(--t-small); color: var(--muted); margin: 0 0 1.25rem; max-width: 70ch; }
.board { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: .75rem 1rem; padding: .7rem 1.3rem .7rem .7rem; background: var(--paper); }
.board li.me { background: var(--sel); }
.b-rank { display: grid; place-items: center; width: 48px; height: 48px; background: var(--paper-2); font-family: var(--serif); font-weight: 650; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.b-rank.r1 { background: var(--gold); color: var(--gold-ink); }
.b-rank.r2 { background: var(--muted); color: var(--paper); }
.b-rank.r3 { background: var(--pen); color: var(--paper); }
:root[data-theme="dark"] .b-rank.r3 { color: #2A0F0B; } :root[data-theme="dark"] .b-rank.r2 { color: #10152A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-rank.r3 { color: #2A0F0B; } :root:not([data-theme="light"]) .b-rank.r2 { color: #10152A; } }
.b-name { font-weight: 650; overflow-wrap: anywhere; font-size: 1.1rem; }
.b-name small { font-weight: 500; color: var(--muted); }
.b-value { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.b-value strong { font-family: var(--serif); font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; }
.b-value span { display: block; font-size: var(--t-small); color: var(--muted); }
.board-msg { background: var(--paper); padding: 2rem; color: var(--muted); margin-bottom: 1rem; font-size: 1.1rem; }

/* ==========================================================================
   CARTES MÉMOIRE
   ========================================================================== */
.cards-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.cards-side { grid-column: 1 / span 4; display: flex; flex-direction: column; gap: 1rem; }
.cards-main { grid-column: 5 / span 8; display: flex; flex-direction: column; gap: 1rem; }
.search { position: relative; max-width: none; flex: none; }
.suggest { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: .35rem; list-style: none; background: var(--paper); box-shadow: 0 16px 40px rgba(10, 14, 30, .25); /* taste-skill-ignore : menu flottant */ }
.suggest button { width: 100%; text-align: left; padding: .65rem .8rem; }
.suggest button:hover, .suggest button.active { background: var(--sel); }
.suggest .s-def { color: var(--muted); font-size: var(--t-small); }
.segmented { display: flex; gap: 6px; }
.segmented button { flex: 1; min-height: 46px; padding: 0 .6rem; background: var(--paper); font-size: var(--t-small); font-weight: 650; color: var(--muted); text-align: center; transition: background .2s, color .2s; }
.segmented button:hover { background: var(--sel); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.letters button { height: 44px; background: var(--paper); font-family: var(--serif); font-weight: 650; font-size: 1.1rem; text-align: center; transition: background .2s, color .2s; }
.letters button:hover { background: var(--sel); }
.letters button.current { background: var(--ink); color: var(--on-ink); }

.scene { perspective: 1600px; }
.card { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; min-height: 300px; padding: 0; transform-style: preserve-3d; transition: transform .7s var(--ease); }
.card.flipped { transform: rotateY(180deg); }
.card.no-anim { transition: none; }
.face { container-type: inline-size; position: absolute; inset: 0; background: var(--paper); backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 2rem; text-align: center; overflow: hidden; }
.face .ribbon { right: auto; left: clamp(20px, 3vw, 36px); }
.face-back { transform: rotateY(180deg); background: var(--sel); }
.chip { position: absolute; top: 1.2rem; right: 1.4rem; font-size: .85rem; font-weight: 650; padding: .2rem .7rem; background: var(--paper-2); color: var(--muted); }
.chip.revoir { background: var(--pen-tint); color: var(--pen-ink); }
.chip.maitrise { background: var(--ok-tint); color: var(--ok-ink); }
.card-word { font-size: clamp(1.9rem, calc(100cqw / (var(--len, 8) * .6)), 4.8rem); line-height: 1; overflow-wrap: anywhere; font-weight: 650; letter-spacing: -.04em; }
.card-tip { position: absolute; bottom: 1.2rem; left: 0; right: 0; font-size: var(--t-small); color: var(--muted); }
.card-word-small { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: var(--muted); margin-bottom: .8rem; letter-spacing: -.02em; }
.card-def { font-size: clamp(1.25rem, 2.6vw, 1.8rem); line-height: 1.35; max-width: 30ch; font-weight: 500; }
.card-ex { margin-top: 1rem; font-style: italic; color: var(--muted); max-width: 44ch; }
.card-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; }
.card-nav .btn:first-child { justify-self: start; }
.card-nav .btn:last-child { justify-self: end; }
.card-count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; text-align: center; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade .btn { min-height: 56px; font-size: 1.05rem; }
.card-foot { display: flex; justify-content: center; }
.keys { text-align: center; color: var(--muted); font-size: var(--t-small); }
kbd { font-family: var(--sans); background: var(--paper); padding: .1rem .5rem; font-size: .85em; font-weight: 650; }

/* ==========================================================================
   FENÊTRES
   ========================================================================== */
dialog { border: 0; padding: 0; width: min(540px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 14, 30, .4); /* taste-skill-ignore : fenêtre flottante */ }
dialog[open] { animation: rise .4s var(--ease) both; }
dialog::backdrop { background: var(--scrim); }
.dialog-body { padding: clamp(22px, 4vw, 36px); }
.dialog-body h2 { font-family: var(--serif); font-weight: 650; font-size: 1.9rem; line-height: 1.05; letter-spacing: -.035em; margin: 0 0 .75rem; }
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field label { font-weight: 650; font-size: var(--t-small); }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: .7rem .9rem; border: 0; border-radius: 0; background: var(--paper-2); border-bottom: 3px solid var(--muted); transition: border-color .2s; }
.field input:focus, .field select:focus, .field textarea:focus { border-bottom-color: var(--pen); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.field textarea { min-height: 120px; resize: vertical; }
.field-search input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.form-status { min-height: 1.5rem; font-weight: 650; margin: 0 0 .75rem; }
.form-status.ok { color: var(--ok); }
.form-status.ko { color: var(--pen); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
dialog .tabs button { min-height: 44px; }

/* ==========================================================================
   Tablette et téléphone
   ========================================================================== */
@media (max-width: 980px) {
  .hero-main { grid-column: 1 / -1; }
  .entry { grid-column: 1 / -1; min-height: 0; }
  .t-quiz { grid-column: span 7; }
  .t-exam { grid-column: span 5; }
  .t-cards, .t-inverse, .t-revision, .t-board { grid-column: span 6; }
  .t-regles { grid-column: span 12; order: 6; }
  .t-board { order: 5; }
  .modes:has(#board-btn[hidden]) .t-revision { grid-column: span 12; }
  .progress-main, .progress-side { grid-column: 1 / -1; }
  .qa-left { grid-column: 1 / -1; position: static; }
  .qa-right { grid-column: 1 / -1; }
  .result-card, .result-side { grid-column: 1 / -1; }
  .result-card { min-height: 300px; }
  .page-head .h2, .page-head .lead { grid-column: 1 / -1; }
  #regles-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-side, .cards-main { grid-column: 1 / -1; }
  .letters { display: flex; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .letters button { flex: none; width: 44px; }
  .review ul { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand-name { font-size: 1.02rem; }
  .theme-label { display: none; }
  .theme-btn { padding: 0; width: 44px; justify-content: center; }
  .modes { grid-template-columns: 1fr; }
  .t-quiz, .t-exam, .t-cards, .t-inverse, .t-revision, .t-regles, .t-board, .modes:has(#board-btn[hidden]) .t-revision { grid-column: 1 / -1; min-height: 190px; }
  .t-regles, .t-board { order: 0; }
  .tile-title { max-width: none; }
  .stats { grid-template-columns: repeat(3, auto); justify-content: space-between; }
  #regles-list { grid-template-columns: 1fr; }
  .btn-label { display: none; }
  .keys { display: none; }
  .seg-long { display: none; }
  .card { aspect-ratio: 4 / 5; min-height: 320px; }
  .card-nav { grid-template-columns: auto 1fr auto; }
  .board li { grid-template-columns: 52px 1fr auto; padding-right: 1rem; }
  .b-rank { width: 40px; height: 40px; font-size: 1.1rem; }
  .hero-actions .btn-primary { width: 100%; }
  .panel-foot { align-items: flex-start; }
  .actions .btn { flex: 1 1 100%; }
  .actions.center .btn { flex: 1 1 100%; }
  .site-foot { margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); }
  .tabs button { flex: 1 1 0; min-width: 0; padding: .4rem .35rem; font-size: .88rem; line-height: 1.15; }
}

/* ==========================================================================
   Préférences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .tile:hover:not(:disabled) { translate: none; }
  .option:hover:not(:disabled) { transform: none; }
}
@media (forced-colors: active) {
  .btn, .tile, .option, .rule, .face, .entry { border: 1px solid CanvasText; /* taste-skill-ignore : mode contraste forcé */ }
  .ribbon { forced-color-adjust: none; }
}
@media print {
  .site-bar, .topbar, .site-foot, .actions, dialog { display: none !important; }
  body { background: #fff; color: #000; }
}
