/* Polices auto-hébergées — sous-ensemble latin uniquement (suffisant pour le
   français). Fraunces et Space Grotesk, sous licence SIL Open Font License.

   Pourquoi les auto-héberger : cela supprime deux connexions tierces
   (fonts.googleapis.com puis fonts.gstatic.com) avant le premier affichage, et
   surtout cela permet de PRÉCHARGER les fichiers. C'est ce préchargement qui
   élimine le décalage de mise en page dû à la bascule police système ->
   police finale, qui pesait à lui seul 0,10 de CLS sur la page d'accueil. */

@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/fraunces-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/fraunces-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================
   Tokens & fondations
   ============================================ */
:root {
  --bg: #F6EFDC;
  --bg-2: #EDE3C8;
  --paper: #FFFBF0;
  --ink: #161210;
  --ink-2: #4A4338;
  --ink-3: #8A8170;
  --accent: #E63946;
  --accent-2: #B82B36;
  --gold: #F4C20D;
  --gold-2: #C99C00;
  --green: #2A9D8F;
  --line: #DDD2B6;
  --line-soft: #E8DFC6;
  --shadow-sm: 0 2px 8px rgba(22, 18, 16, 0.06);
  --shadow: 0 10px 32px rgba(22, 18, 16, 0.08);
  --shadow-lg: 0 28px 64px rgba(22, 18, 16, 0.14);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --container: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::selection { background: var(--accent); color: #fff; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Texture subtile de fond — rappelle le papier */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(230, 57, 70, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(244, 194, 13, 0.06) 0%, transparent 50%);
  z-index: 0;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ============================================
   Typographie
   ============================================ */
.display {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-variation-settings: 'opsz' 144, 'SOFT' 50;
  letter-spacing: -0.02em;
  line-height: 1.02;
}

.section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.section-title em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

.section-sub {
  font-size: 1.125rem;
  color: var(--ink-2);
  max-width: 560px;
  margin-bottom: 56px;
}

/* ============================================
   Header
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 239, 220, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.site-header.scrolled {
  border-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: var(--container);
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.logo-tile {
  display: inline-flex;
  width: 34px;
  height: 34px;
  background: var(--ink);
  color: var(--gold);
  border-radius: 7px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 2px 0 #000, inset 0 0 0 1px rgba(255,255,255,0.05);
  transform: rotate(-4deg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover .logo-tile { transform: rotate(4deg) scale(1.05); }

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav a {
  font-size: 0.95rem;
  color: var(--ink-2);
  font-weight: 500;
  position: relative;
  transition: color 0.2s;
}

.nav a:hover { color: var(--ink); }

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s;
}

.nav a:hover::after { width: 100%; }

.nav-cta {
  background: var(--ink);
  color: var(--paper) !important;
  padding: 10px 18px;
  border-radius: 100px;
  font-weight: 600 !important;
  transition: transform 0.2s, background 0.2s;
}

.nav-cta:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.nav-cta::after { display: none; }

.menu-btn { display: none; }

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  padding: 80px 0 100px;
  overflow: hidden;
}

/* Grille mots-croisés en fond */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

/* Tuiles flottantes décoratives */
.float-tile {
  position: absolute;
  width: 62px;
  height: 62px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.8rem;
  box-shadow: 0 4px 0 var(--gold-2), 0 8px 20px rgba(22, 18, 16, 0.12);
  pointer-events: none;
  z-index: 1;
  animation: floatTile 9s ease-in-out infinite;
  opacity: 0.92;
}

.float-tile:nth-child(1) { top: 18%; left: 6%; transform: rotate(-8deg); animation-delay: 0s; }
.float-tile:nth-child(2) { top: 65%; left: 4%; transform: rotate(6deg); animation-delay: -2s; width: 48px; height: 48px; font-size: 1.4rem; }
.float-tile:nth-child(3) { top: 25%; right: 8%; transform: rotate(8deg); animation-delay: -4s; background: var(--accent); color: var(--paper); box-shadow: 0 4px 0 var(--accent-2), 0 8px 20px rgba(230,57,70,0.25); }
.float-tile:nth-child(4) { top: 72%; right: 6%; transform: rotate(-5deg); animation-delay: -1s; width: 54px; height: 54px; font-size: 1.6rem; }
.float-tile:nth-child(5) { top: 45%; right: 14%; transform: rotate(12deg); animation-delay: -3s; width: 44px; height: 44px; font-size: 1.3rem; background: var(--green); color: var(--paper); box-shadow: 0 4px 0 #1F7A6F, 0 8px 20px rgba(42,157,143,0.25); }
.float-tile:nth-child(6) { top: 12%; left: 18%; transform: rotate(4deg); animation-delay: -5s; width: 40px; height: 40px; font-size: 1.2rem; opacity: 0.7; }

@keyframes floatTile {
  0%, 100% { transform: translateY(0) rotate(var(--rot, -4deg)); }
  50% { transform: translateY(-18px) rotate(calc(var(--rot, -4deg) + 6deg)); }
}

.hero-content {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.hero-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-variation-settings: 'opsz' 144, 'SOFT' 50;
  font-size: clamp(2.5rem, 6.5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero-title em {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
  color: var(--accent);
}

.hero-title .underline {
  position: relative;
  display: inline-block;
}

.hero-title .underline::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 14px;
  background: var(--gold);
  z-index: -1;
  border-radius: 2px;
  transform: skewX(-4deg);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--ink-2);
  max-width: 620px;
  margin: 0 auto 40px;
  line-height: 1.55;
}

/* Formulaire anagramme */
.anagram-form {
  max-width: 720px;
  margin: 0 auto;
}

.form-row {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 100px;
  box-shadow: var(--shadow);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.form-row:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow), 0 0 0 4px rgba(22, 18, 16, 0.06);
}

#letters-input,
#letters-input-2 {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 22px;
  font-size: 1.1rem;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

#letters-input::placeholder,
#letters-input-2::placeholder {
  color: var(--ink-3);
  font-style: italic;
  font-weight: 400;
}

.btn-primary {
  background: var(--accent);
  color: var(--paper);
  padding: 14px 26px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.98rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 0 var(--accent-2);
}

.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--accent-2);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent-2);
}

.form-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.form-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-meta .check {
  color: var(--green);
  font-weight: 700;
}

.options-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: all 0.2s;
}

.options-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.options-toggle svg {
  transition: transform 0.3s;
}

.options-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.options-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
  max-width: 720px;
  margin: 0 auto;
}

.options-panel.open {
  grid-template-rows: 1fr;
  margin-top: 14px;
}

.options-panel > div {
  overflow: hidden;
}

.options-inner {
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  text-align: left;
}

.opt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.opt-field label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.opt-field input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg);
  transition: border-color 0.2s;
}

.opt-field input:focus {
  outline: none;
  border-color: var(--ink);
}

.opt-hint {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--ink-3);
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  line-height: 1.5;
}

.opt-hint code {
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--accent);
}

/* Démo animée */
.hero-demo {
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.demo-label {
  font-size: 0.85rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.demo-arrow {
  color: var(--ink-3);
  font-size: 1.4rem;
}

.demo-tiles {
  display: inline-flex;
  gap: 6px;
  perspective: 600px;
  min-height: 56px;
  align-items: center;
}

.demo-tile {
  display: inline-flex;
  width: 44px;
  height: 44px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.4rem;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 var(--ink);
  animation: tileFlip 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tileFlip {
  0% { transform: rotateX(90deg) translateY(-10px); opacity: 0; }
  100% { transform: rotateX(0) translateY(0); opacity: 1; }
}

/* ============================================
   Résultats
   ============================================ */
/* Pas de hauteur plafonnée : les résultats s'étirent avec la page.
   L'ouverture est animée en fondu plutôt qu'en hauteur, sinon une longue
   liste serait coupée par le conteneur. */
.results-section {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  display: none;
}

.results-section.visible {
  display: block;
  margin: 0 auto 80px;
  animation: resultsIn 0.4s ease both;
}

@keyframes resultsIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

.results-inner {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--line);
}

.results-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.results-meta {
  font-size: 0.9rem;
  color: var(--ink-2);
}

.results-meta strong { color: var(--accent); }

.results-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.results-close:hover {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(90deg);
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  margin-bottom: 24px;
  font-size: 0.88rem;
}

.results-toolbar button {
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg);
  color: var(--ink-2);
  font-weight: 500;
  border: 1px solid var(--line);
  transition: all 0.2s;
}

.results-toolbar button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.results-toolbar button.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.results-groups {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.result-group h4 {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  color: var(--ink-3);
  margin-bottom: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-group h4::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-tile {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.word-tile::before {
  content: attr(data-len);
  font-size: 0.65rem;
  color: var(--ink-3);
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.word-tile:hover {
  background: var(--gold);
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 3px 0 var(--ink);
}

.word-tile:hover::before {
  background: rgba(0,0,0,0.1);
  color: var(--ink);
}

.word-tile.copied {
  background: var(--green);
  color: var(--paper);
  border-color: var(--green);
}

.word-tile.copied::before { background: rgba(255,255,255,0.2); color: var(--paper); }

/* Bouton « + N autres » : même gabarit, sans les pastilles */
.word-more {
  border-style: dashed;
  color: var(--ink-2);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
}

.word-more::before, .word-more::after { content: none; }

/* Points Scrabble, à droite de chaque mot */
.word-tile::after {
  content: attr(data-points);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gold-2);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Space Grotesk', sans-serif;
}

.word-tile:hover::after { background: rgba(0,0,0,0.08); border-color: transparent; color: var(--ink); }
.word-tile.copied::after { background: rgba(255,255,255,0.2); border-color: transparent; color: var(--paper); }

/* Portion de mot correspondant au filtre ou au motif */
.word-tile mark { background: var(--gold); color: inherit; padding: 0 1px; border-radius: 2px; }
.word-tile:hover mark { background: rgba(0,0,0,0.12); }

/* Tuile + bouton de vérification accolé */
.word-item {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  transition: transform 0.18s, box-shadow 0.18s;
}

.word-item:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--ink); }
.word-item .word-tile:hover { transform: none; box-shadow: none; }
.word-item .word-tile { border-radius: 8px 0 0 8px; }

/* Lien vers la définition — même comportement que le bouton de vérification,
   mais au milieu du groupe, donc sans arrondi. */
.word-define {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  border: 1px solid var(--line);
  border-left: none;
  background: var(--bg);
  color: var(--ink-3);
  text-decoration: none;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 700;
  transition: width 0.18s, opacity 0.18s;
}

.word-item:hover .word-define,
.word-item:focus-within .word-define { width: 26px; opacity: 1; }
.word-define:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.word-verify {
  width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--bg);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 0.85rem;
  transition: width 0.18s, opacity 0.18s;
}

.word-item:hover .word-verify,
.word-item:focus-within .word-verify { width: 30px; opacity: 1; }
.word-verify:hover { background: var(--green); color: var(--paper); border-color: var(--green); }

/* Sans survol (tactile), le bouton reste visible */
@media (hover: none) {
  .word-verify { width: 30px; opacity: 1; }
  .word-define { width: 26px; opacity: 1; }
}

/* Tuiles du tirage saisi */
.rack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}

.rack-tile {
  position: relative;
  width: 38px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--ink);
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.rack-tile.joker { background: var(--paper); color: var(--ink-3); }

.rack-tile span {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.75;
}

/* Bascule anagrammes / mots croisés */
.mode-switch {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.mode-switch button {
  border: none;
  background: none;
  padding: 7px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.18s;
}

.mode-switch button.active { background: var(--ink); color: var(--paper); }

/* Bandeau de statistiques des résultats */
.stats-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.stat {
  flex: 1;
  min-width: 120px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}

.stat-val {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.15;
  color: var(--ink);
  word-break: break-all;
}

.stat-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-3);
  margin-top: 2px;
}

/* Fenêtre de vérification FFSC */
.verify-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 18, 16, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 20px;
}

.verify-overlay.open { display: flex; }

.verify-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 24px;
  width: min(420px, 100%);
  text-align: center;
}

.verify-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.05rem;
  color: var(--ink-3);
  cursor: pointer;
}

.verify-word-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}

.verify-sub { font-size: 0.75rem; color: var(--ink-3); margin-bottom: 16px; }
.verify-icon { font-size: 2rem; }

.verify-spinner {
  width: 28px;
  height: 28px;
  margin: 14px auto 0;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: verifySpin 0.8s linear infinite;
}

@keyframes verifySpin { to { transform: rotate(360deg); } }

.verify-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.verify-badge.valid { background: var(--green); color: var(--paper); }
.verify-badge.invalid { background: var(--accent); color: var(--paper); }
.verify-subtext { color: var(--ink-2); font-size: 0.86rem; margin-top: 10px; line-height: 1.5; }

.verify-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

.verify-actions button, .verify-actions a {
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.verify-actions button:hover, .verify-actions a:hover { background: var(--gold); }

.results-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-2);
}

.results-empty strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 8px;
}

/* ============================================
   Sections génériques
   ============================================ */
section { position: relative; z-index: 1; }

.section-pad {
  padding: 100px 0;
}

/* ============================================
   Comment ça marche
   ============================================ */
.how {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 56px;
}

.step {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 36px 28px;
  border: 1px solid var(--line);
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s;
}

.step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.step-num {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-style: italic;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 20px;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

.step h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.step p {
  color: var(--ink-2);
  font-size: 0.98rem;
  margin-bottom: 20px;
}

.step-visual {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--r-sm);
  border: 1px dashed var(--line);
}

.mini-tile {
  width: 32px;
  height: 32px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 0 var(--gold-2);
}

.mini-tile.empty {
  background: transparent;
  border: 1.5px dashed var(--ink-3);
  color: var(--ink-3);
  box-shadow: none;
}

.mini-tile.accent {
  background: var(--accent);
  color: var(--paper);
  box-shadow: 0 2px 0 var(--accent-2);
}

/* ============================================
   Features
   ============================================ */
.features .section-head {
  text-align: center;
  margin-bottom: 64px;
}

.features .section-sub {
  margin: 0 auto 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--ink-3);
}

.feature-card:hover::before { transform: scaleX(1); }

.feature-icon {
  width: 52px;
  height: 52px;
  background: var(--bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  transition: all 0.3s;
}

.feature-card:hover .feature-icon {
  background: var(--gold);
  border-color: var(--ink);
  transform: rotate(-6deg);
}

.feature-icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}

.feature-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--ink-2);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* ============================================
   Use cases
   ============================================ */
.use-cases {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  margin-top: 60px;
  padding: 100px 0 120px;
  position: relative;
  overflow: hidden;
}

.use-cases::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.use-cases .section-title { color: var(--paper); }
.use-cases .section-title em { color: var(--gold); }
.use-cases .section-sub { color: rgba(255, 251, 240, 0.7); }

.case-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 48px;
}

.case-card {
  background: rgba(255, 251, 240, 0.04);
  border: 1px solid rgba(255, 251, 240, 0.1);
  border-radius: var(--r);
  padding: 32px;
  display: flex;
  gap: 20px;
  transition: all 0.3s;
}

.case-card:hover {
  background: rgba(255, 251, 240, 0.07);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.case-emoji {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.6rem;
  box-shadow: 0 3px 0 var(--gold-2);
}

.case-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--paper);
}

.case-card p {
  color: rgba(255, 251, 240, 0.65);
  font-size: 0.93rem;
  line-height: 1.55;
}

/* ============================================
   FAQ
   ============================================ */
.faq-list {
  max-width: 760px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.faq-item:first-child { border-top: 1px solid var(--line); }

.faq-item summary {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 500;
  padding: 22px 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: color 0.2s;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; }

.faq-item summary:hover { color: var(--accent); }

.faq-item summary::after {
  content: '';
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-radius: 50%;
  position: relative;
  transition: transform 0.3s, background 0.2s;
  background-image:
    linear-gradient(var(--ink) 0, var(--ink) 100%),
    linear-gradient(var(--ink) 0, var(--ink) 100%);
  background-size: 12px 2px, 2px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.faq-item[open] summary::after {
  transform: rotate(135deg);
  background: var(--accent);
  background-image:
    linear-gradient(var(--paper) 0, var(--paper) 100%),
    linear-gradient(var(--paper) 0, var(--paper) 100%);
  background-size: 12px 2px, 2px 12px;
}

.faq-item p {
  color: var(--ink-2);
  padding: 0 0 22px;
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 680px;
}

/* ============================================
   Final CTA
   ============================================ */
.final-cta {
  padding: 100px 0 120px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.final-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 50%, rgba(230, 57, 70, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 70% 50%, rgba(244, 194, 13, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.final-cta-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.final-cta h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.final-cta h2 em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

.final-cta p {
  font-size: 1.1rem;
  color: var(--ink-2);
  margin-bottom: 36px;
}

.anagram-form-compact {
  max-width: 580px;
  margin: 0 auto;
}

/* ============================================
   À propos
   ============================================ */
.about {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}

.about-inner { max-width: 720px; }

.about .section-title { margin-bottom: 28px; }

.about p {
  font-size: 1.06rem;
  line-height: 1.75;
  color: var(--ink-2);
}

.about p + p { margin-top: 20px; }

.about strong { color: var(--ink); font-weight: 600; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: 60px 0 30px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
  margin-bottom: 40px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.footer-brand .logo-tile {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--gold-2);
}

.footer-tagline {
  color: rgba(255, 251, 240, 0.6);
  font-size: 0.92rem;
  max-width: 320px;
}

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: rgba(255, 251, 240, 0.7);
  font-size: 0.92rem;
  transition: color 0.2s;
}

.footer-nav a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(255, 251, 240, 0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: rgba(255, 251, 240, 0.5);
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast::before {
  content: '✓';
  background: var(--green);
  color: var(--paper);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ============================================
   Reveal animations
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 980px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; gap: 20px; }
  .case-grid { grid-template-columns: 1fr; }
  .float-tile:nth-child(5),
  .float-tile:nth-child(6) { display: none; }
}

@media (max-width: 720px) {
  .container { padding: 0 18px; }
  .header-inner { padding: 14px 18px; }
  .nav { gap: 18px; }
  .nav a:not(.nav-cta) { display: none; }
  .nav-cta { padding: 8px 14px; font-size: 0.88rem; }
  .hero { padding: 50px 0 70px; }
  .hero-demo { gap: 10px; }
  .demo-tile { width: 36px; height: 36px; font-size: 1.1rem; }
  .form-row { flex-direction: column; border-radius: var(--r); padding: 10px; gap: 8px; }
  .form-row button { width: 100%; justify-content: center; padding: 14px; }
  #letters-input { padding: 10px 14px; }
  .results-section.visible { margin-bottom: 60px; }
  .results-inner { padding: 22px 18px; }
  .results-header { flex-direction: column; gap: 12px; }
  .feature-grid { grid-template-columns: 1fr; }
  .case-card { flex-direction: column; gap: 14px; padding: 24px; }
  .footer-inner { grid-template-columns: 1fr; }
  .section-pad { padding: 70px 0; }
  .use-cases { padding: 70px 0 80px; }
  .final-cta { padding: 70px 0 80px; }
  .float-tile { display: none; }
  .float-tile:nth-child(1),
  .float-tile:nth-child(3) { display: flex; opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .float-tile { animation: none; }
  .reveal { opacity: 1; transform: none; }
}
