/* ==========================================================================
   [MARQUE] — site.css
   Direction : « papier et encre ». Le produit final est une feuille imprimée;
   l'écran en est l'atelier. Fond papier chaud, encre profonde, et UN seul
   geste coloré : le trait de surligneur qui reste sur les mots trouvés.
   Marque volontairement DISTINCTE du nonogramme (indigo/sashiko).
   Mobile-first · clair/sombre · CLS = 0 · impression noir et blanc pure.
   ========================================================================== */

/* ---------------------------------------------------------------- Jetons -- */
:root {
  color-scheme: light dark;

  --bg: #FAF6EE;
  --surface: #FFFFFF;
  --surface-2: #F2EBDF;
  --rule: #E0D7C8;
  --rule-strong: #C9BCA6;
  --ink: #17181C;
  --ink-soft: #4B5162;
  --ink-muted: #5C6375;
  --accent: #1D4E89;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EFF8;
  --ok: #1B6B4A;

  /* Surligneurs — un ton par mot trouvé, en rotation */
  --hl-1: #FFD84D;
  --hl-2: #7FE3C0;
  --hl-3: #9CC9FF;
  --hl-4: #FFB088;
  --hl-5: #D9B8FF;
  --hl-6: #B6E06A;
  --hl-blend: multiply;
  --hl-alpha: 0.85;
  --hl-live: #1D4E89;
  --sel-ink: #1D4E89;   /* lettre d'une case en cours de sélection */

  --font-body: 'Atkinson Hyperlegible', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-grid: 'Atkinson Hyperlegible', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --r: 10px;
  --r-sm: 6px;
  --spring: cubic-bezier(0.3, 1.6, 0.5, 1);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --wrap: 62rem;
  --shadow: 0 1px 2px rgba(23, 24, 28, 0.06), 0 6px 18px rgba(23, 24, 28, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14161A;
    --surface: #1C1F25;
    --surface-2: #23272F;
    --rule: #303642;
    --rule-strong: #454C5C;
    --ink: #ECE8E0;
    --ink-soft: #B4BBC9;
    --ink-muted: #A2AAB9;
    --accent: #8FB6EA;
    --accent-ink: #10131A;
    --accent-soft: #1E2733;
    --ok: #6FD3A5;
    --hl-1: #6A5A14;
    --hl-2: #14574A;
    --hl-3: #1C4470;
    --hl-4: #6B3A22;
    --hl-5: #4A3570;
    --hl-6: #3D5A18;
    --hl-blend: screen;
    --hl-alpha: 0.95;
    --hl-live: #8FB6EA;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme='dark'] {
  --bg: #14161A;
  --surface: #1C1F25;
  --surface-2: #23272F;
  --rule: #303642;
  --rule-strong: #454C5C;
  --ink: #ECE8E0;
  --ink-soft: #B4BBC9;
  --ink-muted: #A2AAB9;
  --accent: #8FB6EA;
  --accent-ink: #10131A;
  --accent-soft: #1E2733;
  --ok: #6FD3A5;
  --hl-1: #6A5A14;
  --hl-2: #14574A;
  --hl-3: #1C4470;
  --hl-4: #6B3A22;
  --hl-5: #4A3570;
  --hl-6: #3D5A18;
  --hl-blend: screen;
  --hl-alpha: 0.95;
  --hl-live: #8FB6EA;
  /* En sombre, le trait de prévisualisation éclaircit le fond : la lettre
     reprend l'encre claire, sinon le contraste tombe sous 4.5:1. */
  --sel-ink: #ECE8E0;
}

/* ---------------------------------------------------------------- Polices - */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/assets/fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/assets/fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ----------------------------------------------------------------- Base -- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--r) 0; font-weight: 700;
}
.skip:focus { left: 0; }

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

/* --------------------------------------------------------------- En-tête -- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.site-header .inner {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 12px 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.brand .mark {
  display: grid; grid-template-columns: repeat(3, 6px); grid-auto-rows: 6px; gap: 2px;
}
.brand .mark i { background: var(--rule-strong); border-radius: 1px; }
.brand .mark i.on { background: var(--accent); }
/* Mobile : ligne 1 = marque + outils (son, langue), ligne 2 = navigation qui
   défile horizontalement. La grille reste ainsi haut dans l'écran. */
.site-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.site-nav {
  order: 3; width: 100%; margin-top: 2px;
  display: flex; align-items: center; gap: 2px;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { white-space: nowrap; }
@media (min-width: 52rem) {
  .site-nav { order: 0; width: auto; margin: 0 0 0 auto; overflow: visible; flex-wrap: wrap; }
  .site-tools { margin-left: 10px; }
}
.site-nav a {
  display: inline-flex; align-items: center;
  min-height: 44px;                       /* cible tactile confortable */
  color: var(--ink-soft); text-decoration: none;
  font-size: 0.92rem; font-weight: 700;
  padding: 8px 10px; border-radius: var(--r-sm);
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current='page'] { color: var(--accent); border-bottom-color: var(--accent); }
.lang-switch, .sound-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px;
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 0.85rem; font-weight: 700; text-decoration: none;
  cursor: pointer;
}
.sound-toggle { min-width: 44px; justify-content: center; }
.sound-toggle .ico-off { display: none; }
.sound-toggle[aria-pressed='false'] .ico-on { display: none; }
.sound-toggle[aria-pressed='false'] .ico-off { display: inline; }

/* --------------------------------------------------------------- Contenu -- */
.page { max-width: var(--wrap); margin: 0 auto; padding: 6px 18px 56px; }
.page.narrow { max-width: 46rem; }

.breadcrumbs { font-size: 0.82rem; color: var(--ink-muted); margin: 14px 0 6px; }
.breadcrumbs a { color: var(--ink-muted); font-weight: 700; }
.breadcrumbs span[aria-current] { color: var(--ink-soft); }

h1 {
  font-size: clamp(1.6rem, 5.2vw, 2.3rem); line-height: 1.16;
  letter-spacing: -0.02em; margin: 12px 0 8px; text-wrap: balance;
}
h2 { font-size: clamp(1.15rem, 3.4vw, 1.4rem); line-height: 1.25; margin: 34px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 1.02rem; margin: 20px 0 6px; }
p { margin: 10px 0; }
.lead { font-size: 1.06rem; color: var(--ink-soft); margin-bottom: 14px; text-wrap: pretty; }
.prose p { max-width: 42rem; }

.tip {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: 12px 14px; margin: 16px 0;
  font-size: 0.95rem; max-width: 42rem;
}
.tip svg { flex: none; margin-top: 3px; }

/* --------------------------------------------------------------- Boutons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  font: inherit; font-weight: 700; font-size: 0.95rem;
  border: 1.5px solid transparent; border-radius: var(--r);
  cursor: pointer; text-decoration: none; touch-action: manipulation;
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform 0.16s var(--spring), background-color 0.16s var(--ease); }
  .btn:active { transform: scale(0.97); }
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  min-height: 44px;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ----------------------------------------------------------------- Carte -- */
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 16px; margin: 16px 0;
}
@media (min-width: 40rem) { .card { padding: 20px 22px; } }

/* --------------------------------------------------- Bandeau de faits ----- */
.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--r-sm); overflow: hidden; margin: 14px 0 6px;
  font-size: 0.85rem;
}
@media (min-width: 34rem) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.facts div { background: var(--surface); padding: 8px 12px; }
.facts dt { color: var(--ink-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { font-weight: 700; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; font-weight: 700; color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  border-radius: 999px; padding: 4px 11px; margin: 10px 0 0;
}

/* ============================================================ LA GRILLE === */
.ws { margin: 14px 0 0; }
/* Empilé sur mobile; grille et liste côte à côte dès qu'il y a la place —
   la liste reste visible pendant qu'on cherche, sans faire défiler. */
.ws-layout { display: grid; gap: 16px; margin-top: 14px; }
@media (min-width: 62rem) {
  .ws-layout { grid-template-columns: minmax(0, 32rem) 1fr; gap: 26px; align-items: start; }
  .ws-side { padding-top: 2px; }
  .ws-words { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
}
.ws-board {
  position: relative;
  container-type: inline-size;
  width: min(100%, 34rem);
  margin: 0 auto;
  aspect-ratio: 1 / 1;            /* réserve la place : CLS = 0 */
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  touch-action: none;
}
/* Aucun `gap` : les cases pavent exactement le plateau, donc le centre de la
   case (c+0.5, r+0.5) correspond au pixel près au repère du SVG de surlignage.
   La trame est dessinée en ombre intérieure. */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  gap: 0;
  height: 100%;
}
.ws-row { display: contents; }
.ws-cell {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--ink);
  box-shadow: inset -1px -1px 0 var(--rule);
  font-family: var(--font-grid); font-weight: 700; line-height: 1;
  text-transform: uppercase; user-select: none; -webkit-user-select: none;
  font-size: clamp(0.6rem, calc(52vw / var(--n)), 1.55rem);
  cursor: pointer;
}
@supports (width: 1cqw) {
  .ws-cell { font-size: clamp(0.6rem, calc(58cqw / var(--n)), 1.55rem); }
}
/* L'aplat pâle seul ne porte que 1,16:1 contre une case normale : l'état est
   donc aussi tracé par un liseré dans la couleur d'accent (8,4:1 en clair,
   7,9:1 en sombre), conforme au 1.4.11 pour un indicateur d'état. */
.ws-cell[aria-selected='true'] {
  background: var(--accent-soft);
  color: var(--sel-ink);
  box-shadow: inset 0 0 0 2px var(--accent);
}
/* Le curseur clavier ne se montre que quand la grille a réellement le focus :
   à la souris, il n'y a rien à expliquer. */
.ws-grid:focus-within .ws-cell.cursor { box-shadow: inset 0 0 0 2.5px var(--accent); }
.ws-cell:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 4; }
.ws-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; mix-blend-mode: var(--hl-blend);
}
.ws-overlay line { stroke-linecap: round; stroke-opacity: var(--hl-alpha); }
.ws-overlay line.live { stroke: var(--hl-live); stroke-opacity: 0.32; }
@media (prefers-reduced-motion: no-preference) {
  .ws-overlay line.found { animation: hl-draw 0.32s var(--ease) both; }
}
@keyframes hl-draw {
  from { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
  to { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: 0; }
}
/* Repli sans SVG (contrastes forcés, impression) : le mot trouvé reste lisible */
/* Contrastes forcés : le SVG teinté et les box-shadow disparaissent. Tout
   l'état du jeu doit alors passer par des propriétés que ce mode conserve
   (outline, text-decoration), sinon la sélection en cours devient invisible. */
@media (forced-colors: active) {
  .ws-overlay { display: none; }
  .ws-cell.found { text-decoration: underline; text-decoration-thickness: 2px; }
  .ws-cell[aria-selected='true'] { outline: 2px solid Highlight; outline-offset: -2px; }
  .ws-grid:focus-within .ws-cell.cursor { outline: 3px solid Highlight; outline-offset: -3px; }
}
/* Le trait de surligneur est volontairement léger (c'est un surligneur). L'état
   « trouvé » reste porté en clair par la liste (mot rayé + coche + compteur);
   pour qui demande plus de contraste, on cerne aussi les cases. */
@media (prefers-contrast: more) {
  .ws-cell.found { box-shadow: inset 0 0 0 2px var(--ink); }
}

.ws-status {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 12px 0 0; min-height: 1.6em;
}
.ws-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.ws-live { color: var(--ok); font-weight: 700; min-height: 1.6em; }

.ws-words {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 2px 12px;
}
.ws-words li {
  font-size: 0.95rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 0; color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px;
}
.ws-words li .tick { opacity: 0; flex: none; color: var(--ok); }
.ws-words li.found { color: var(--ink-muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.ws-words li.found .tick { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .ws-words li { transition: color 0.2s var(--ease); }
  .ws-words li.found .tick { animation: tick-pop 0.34s var(--spring) both; }
}
@keyframes tick-pop { from { transform: scale(0.2); opacity: 0; } 60% { transform: scale(1.3); opacity: 1; } to { transform: scale(1); opacity: 1; } }

.ws-win {
  display: none; align-items: center; gap: 10px;
  margin: 14px 0 0; padding: 12px 14px;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--ok) 45%, var(--surface));
  border-radius: var(--r); color: var(--ok); font-weight: 700;
}
.ws-win.show { display: flex; }
.kbd-help { font-size: 0.82rem; color: var(--ink-muted); margin-top: 10px; }

/* ------------------------------------------------------- Maillage / hubs -- */
.link-grid { list-style: none; display: grid; gap: 10px; margin: 12px 0; padding: 0; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.link-grid a {
  display: block; height: 100%;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 12px 14px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 0.95rem;
}
.link-grid a:hover { border-color: var(--accent); }
.link-grid a small { display: block; color: var(--ink-muted); font-weight: 400; font-size: 0.82rem; }
.rel-block { margin-top: 8px; }
.rel-block h3 { font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); margin: 18px 0 6px; }

.theme-cards { list-style: none; display: grid; gap: 12px; padding: 0; margin: 14px 0; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.theme-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 16px;
}
.theme-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.theme-card h3 a { color: var(--ink); text-decoration: none; }
.theme-card h3 a:hover { color: var(--accent); }
.theme-card .levels { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.theme-card .levels a {
  font-size: 0.82rem; font-weight: 700; text-decoration: none;
  border: 1.5px solid var(--rule-strong); border-radius: 999px; padding: 4px 11px; color: var(--ink-soft);
}
.theme-card .levels a:hover { border-color: var(--accent); color: var(--accent); }
.theme-card .peek { font-size: 0.82rem; color: var(--ink-muted); }

/* Index bilingue de la page racine */
.root-index { width: 100%; max-width: 40rem; border-collapse: collapse; margin: 12px 0; font-size: 0.95rem; }
.root-index th, .root-index td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); }
.root-index thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.root-index tbody th { font-weight: 700; }
.root-index a { text-decoration: none; font-weight: 700; }
.root-index a:hover { text-decoration: underline; }

/* ------------------------------------------------------------ Formulaire -- */
.field { display: block; margin: 14px 0; max-width: 42rem; }
.field > span { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 5px; }
.field .hint { display: block; font-weight: 400; font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 6px; }
textarea, input[type='text'], select {
  width: 100%; font: inherit; font-size: 1rem;
  padding: 10px 12px; min-height: 46px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
}
textarea { min-height: 11rem; resize: vertical; line-height: 1.5; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 10rem; margin-top: 0; }
.msg { margin: 12px 0; padding: 11px 14px; border-radius: var(--r-sm); font-size: 0.92rem; font-weight: 700; }
.msg:empty { display: none; }
.msg.error { background: color-mix(in srgb, #C2452F 12%, var(--surface)); color: #A33A26; border: 1px solid color-mix(in srgb, #C2452F 35%, var(--surface)); }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--surface)); }
.msg.info { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--rule); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .msg.error { color: #FF9C86; } }
:root[data-theme='dark'] .msg.error { color: #FF9C86; }

/* ======================================================== Couche compte === */

.account-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px;
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none; font-size: 0.85rem; font-weight: 700;
}
.account-link:hover { border-color: var(--accent); color: var(--accent); }

.plan-badge, .pro-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--rule);
}
.plan-badge[data-value='pro'], .pro-badge {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--surface));
}
.btn .pro-badge { margin-left: 7px; }
.sub-state { font-size: 0.9rem; color: var(--ink-muted); margin: 8px 0 0; }
.hint { font-size: 0.85rem; color: var(--ink-muted); }

/* Une option réservée reste VISIBLE : on montre ce qu'on vend, un clic
   explique. La masquer donnerait un produit qui a l'air incomplet. */
.pro-options {
  border: 1.5px dashed var(--rule-strong); border-radius: var(--r);
  padding: 12px 16px 4px; margin: 16px 0; max-width: 42rem;
}
.pro-options legend { font-weight: 700; font-size: 0.9rem; padding: 0 6px; }
.pro-options .field { margin-top: 4px; }
/* Une option réservée est signalée par le badge « Pro » de la légende, PAS en
   atténuant son texte : l'opacité faisait tomber le libellé à 3,84:1, sous le
   seuil AA. Un état ne doit jamais se payer en lisibilité. */
[data-pro].is-locked { cursor: pointer; }
[data-pro].is-locked input { cursor: pointer; }

/* Le panneau d'offre : en ligne, sous la commande, jamais en modale. */
.upsell {
  border: 1.5px solid var(--accent); border-left-width: 4px;
  background: var(--accent-soft); border-radius: var(--r);
  padding: 14px 16px; margin: 16px 0; max-width: 42rem;
}
.upsell:focus { outline: none; }
.upsell-msg { font-weight: 700; margin: 0 0 4px; }
.upsell-keep { font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 10px; }

.plans { display: grid; gap: 16px; margin: 18px 0; grid-template-columns: 1fr; }
@media (min-width: 46rem) { .plans { grid-template-columns: 1fr 1fr; } }
.plan {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 18px 20px;
}
.plan-pro { border-color: var(--accent); border-width: 2px; }
.plan h2 { margin: 0 0 2px; font-size: 1.2rem; }
.plan-price { font-size: 1.5rem; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.02em; }
.plan-features { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 7px; }
.plan-features li { display: flex; gap: 9px; align-items: flex-start; font-size: 0.94rem; }
.plan-features svg { flex: none; margin-top: 3px; color: var(--ok); }

.saved-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.saved-list li {
  display: grid; gap: 4px; padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--bg);
}
.saved-list small { color: var(--ink-muted); font-size: 0.82rem; }
.saved-list .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.saved-list .row .btn { min-height: 40px; padding: 6px 12px; font-size: 0.85rem; }
.saved-list .empty { color: var(--ink-muted); border-style: dashed; }

.card.danger { border-color: color-mix(in srgb, #C2452F 45%, var(--rule)); }
.btn-danger { background: #A33A26; border-color: #A33A26; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .btn-danger { background: #8C3220; border-color: #8C3220; } }

.legal h2 { font-size: 1.08rem; margin: 26px 0 6px; }
.legal p { max-width: 40rem; }

/* Abonné : aucune publicité sur les pages du générateur (promesse du Pro). */
:root[data-plan='pro'] .ad-slot { display: none; }

/* ------------------------------------------------------------ Pub (CLS 0) - */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100px; margin: 26px 0;
  border: 1px dashed var(--rule); border-radius: var(--r-sm);
  color: var(--ink-muted); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; overflow: hidden;
}
@media (min-width: 48rem) { .ad-slot { height: 90px; } }

/* ----------------------------------------------------------------- Pied --- */
.site-footer {
  border-top: 1px solid var(--rule); background: var(--surface);
  margin-top: 40px;
}
.site-footer .inner {
  max-width: var(--wrap); margin: 0 auto; padding: 22px 18px 34px;
  color: var(--ink-muted); font-size: 0.85rem;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
}
.site-footer a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 4px 0;
  color: var(--ink-soft); font-weight: 700; text-decoration: none;
}
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer .spacer { margin-left: auto; }

/* ------------------------------------------------------ Juice (révélation) */
@media (prefers-reduced-motion: no-preference) {
  .rv-run { animation: rv 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
}
@keyframes rv { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.confetti-p {
  position: fixed; width: 9px; height: 9px; border-radius: 1px;
  pointer-events: none; z-index: 60; will-change: transform;
}
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 700;
  opacity: 0; pointer-events: none; z-index: 60; max-width: min(92vw, 30rem); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: no-preference) { #toast { transition: opacity 0.2s var(--ease), transform 0.24s var(--spring); } }

/* ============================================================ IMPRESSION == */
/* La feuille est produite par print.js dans #print-root : à l'impression, on
   masque l'application et on ne laisse que la feuille, en noir sur blanc. */
#print-root { display: none; }
@media print {
  body { background: #fff; }
  /* Le masquage n'a lieu QUE si une feuille a réellement été montée. Sans
     cette garde, un simple Ctrl+P sur n'importe quelle page imprimait une
     feuille blanche : tout était masqué et #print-root n'existait pas
     encore, puisqu'il n'est créé qu'au clic sur « Imprimer ». */
  .has-print-sheet body > *:not(#print-root) { display: none !important; }
  .has-print-sheet #print-root { display: block; }
}
