/* =========================================================
   Jeux de tête — V2 « Formes pures » : thème commun
   Chargé après style.css par les pages de jeu, les anecdotes et
   les pages légales (l'accueil a sa propre feuille, css/v2.css).
   Cercles, carrés, triangles ; aplats jaune / rouge / bleu / noir.
   Aucune ombre, aucun dégradé, aucun arrondi décoratif.
   ========================================================= */

:root {
  --ground: #111111;
  --ink: #f7f5ee;
  --on-ink: #111111;
  --r: #e3170a;
  --b: #0b3bd9;
  --y: #ffd400;
  --w: #ffffff;
  --third: var(--y);
  --on-third: #111111;
  --fourth: var(--w);
  --on-fourth: #111111;
  --flood: #0b3bd9;           /* écran de fin de partie */

  --font-geo: Futura, "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --glide: cubic-bezier(0.16, 1, 0.3, 1);
  --rule: 4px;

  /* les variables de style.css, que chaque jeu utilise déjà */
  --bg: var(--ground);
  --bg-elevated: #1c1c1c;
  --text: var(--ink);
  --text-muted: #b9b6ad;
  --accent: var(--y);
  --accent-hover: #ffe04d;
  --accent-2: var(--r);
  --accent-contrast: #111111;
  --border: #6a6860;
  --border-soft: #3a3a3a;
  --border-strong: var(--ink);
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.18);
  --danger: #ff6b5e;
  --danger-bg: rgba(255, 107, 94, 0.2);
  --cell-bg: #1e1e1e;
  --cell-alt: #2c2c2c;
  --user-value-color: var(--y);
  --shadow: 0 0 0 0 transparent;
  --shadow-sm: 0 0 0 0 transparent;
  --shadow-lg: 0 0 0 0 transparent;
  --radius: 0px;
  --radius-lg: 0px;
  --font-main: var(--font-geo);
  --font-ui: var(--font-geo);
}
:root[data-theme="light"] {
  --ground: #ffd400;
  --ink: #111111;
  --on-ink: #ffd400;
  --third: var(--w);
  --on-third: #111111;
  --fourth: #111111;
  --on-fourth: #ffd400;
  --flood: #e3170a;

  --bg: var(--ground);
  --bg-elevated: #ffffff;
  --text: var(--ink);
  --text-muted: #3d3820;
  --accent: var(--b);
  --accent-hover: #0a31b3;
  --accent-2: var(--r);
  --accent-contrast: #ffffff;
  --border: #111111;
  --border-soft: #c9a700;
  --border-strong: #111111;
  --success: #0a7a35;
  --success-bg: #c9f2d5;
  --danger: #c41408;
  --danger-bg: #ffd9d4;
  --cell-bg: #ffffff;
  --cell-alt: #fff0a8;
  --user-value-color: var(--b);
  --shadow: 0 0 0 0 transparent;
  --shadow-sm: 0 0 0 0 transparent;
  --shadow-lg: 0 0 0 0 transparent;
}

/* la couleur et la forme de la zone du jeu (attribut data-zone sur <body>) */
body { --zone: var(--ink); --on-zone: var(--on-ink); }
body[data-zone="Logique"] { --zone: var(--b); --on-zone: #fff; }
body[data-zone="Mémoire"] { --zone: var(--r); --on-zone: #fff; }
body[data-zone="Vocabulaire"] { --zone: var(--third); --on-zone: var(--on-third); }
body[data-zone="Réflexes"] { --zone: var(--fourth); --on-zone: var(--on-fourth); }

body::before,
:root[data-theme="light"] body::before { background-image: none; }
body { font-family: var(--font-geo); }
:focus-visible { outline: 4px solid var(--b); outline-offset: 3px; }
:root:not([data-theme="light"]) :focus-visible { outline-color: var(--y); }
a { color: var(--ink); }

/* ---------- En-tête, pied de page ---------- */
.site-header {
  position: static;
  background: var(--ground);
  border-bottom: var(--rule) solid var(--ink);
  padding: 10px clamp(16px, 4vw, 48px);
}
.site-header .brand {
  font-family: var(--font-geo);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
/* ---------- Logo du bandeau : une variante par thème ---------- */
.site-header .brand { display: flex; align-items: center; gap: 0; }
.brand-logo { display: block; height: 44px; width: auto; transition: scale 0.4s var(--spring); }
.site-header .brand:hover .brand-logo { scale: 1.05; }
.brand-logo-light { display: none; }                         /* texte noir, pour le fond jaune */
:root[data-theme="light"] .brand-logo-light { display: block; }
:root[data-theme="light"] .brand-logo-dark { display: none; }
@media (max-width: 520px) { .brand-logo { height: 36px; } }
.lang-switch select {
  border: 3px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-geo);
}
.icon-btn,
.icon-btn:hover {
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: none;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-geo);
}
/* bouton de thème : toujours un disque noir, pour que la lune jaune
   reste visible sur le fond jaune du mode jour */
.theme-toggle,
.theme-toggle:hover { background: #111111; }
.icon-btn { transition: rotate 0.5s var(--spring); }
.icon-btn:hover { rotate: 180deg; }

.site-footer {
  padding: 28px clamp(16px, 4vw, 48px);
  border-top: var(--rule) solid var(--ink);
  background: var(--ground);
  color: var(--ink);
  text-align: left;
}
.site-footer-extra { justify-content: flex-start; gap: 8px 28px; font-size: 0.92rem; opacity: 1; }
.site-footer-extra a { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.site-footer-extra a:hover { background: var(--ink); color: var(--on-ink); text-decoration: none; }

/* ---------- Page de jeu : titre, aide, commandes ---------- */
main { padding: clamp(18px, 3vw, 36px) clamp(16px, 4vw, 48px) 64px; }
.back-link { color: var(--ink); font-weight: 700; }
.back-link:hover { color: var(--ink); text-decoration: underline 3px; }

.game-header { margin: clamp(14px, 2.4vw, 28px) 0 22px; }
.game-title {
  font-family: var(--font-geo);
  font-weight: 700;
  font-size: clamp(2.1rem, 5.4vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  gap: 0.28em;
  flex-wrap: wrap;
}
/* la forme de la zone, devant le titre */
.game-title::before {
  content: "";
  flex: none;
  width: 0.62em;
  height: 0.62em;
  background: var(--zone);
  animation: zone-in 0.7s var(--spring) both;
}
body[data-zone="Mémoire"] .game-title::before { border-radius: 50%; }
body[data-zone="Vocabulaire"] .game-title::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
body[data-zone="Réflexes"] .game-title::before { height: 0.31em; border-radius: 0.62em 0.62em 0 0; }
body:not([data-zone]) .game-title::before { content: none; }
@keyframes zone-in { from { scale: 0; rotate: -120deg; } }

.game-sub { max-width: 56ch; font-size: 1rem; line-height: 1.6; color: var(--ink); }
.help-btn {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ink);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-geo);
  font-size: 1.05rem;
  letter-spacing: 0;
  transition: rotate 0.5s var(--spring), background 0.15s, color 0.15s;
}
.help-btn:hover { background: var(--ink); color: var(--on-ink); rotate: 360deg; }

.btn {
  border: 3px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-geo);
  font-weight: 700;
  transition: background 0.15s, color 0.15s, scale 0.2s var(--spring);
}
.btn:hover { transform: none; box-shadow: none; background: var(--ink); color: var(--on-ink); }
.btn:active { transform: none; scale: 0.96; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--r); border-color: var(--r); color: #fff; }
.btn:disabled { box-shadow: none; }
.btn:disabled:hover { background: var(--ground); color: var(--ink); }

select, .select {
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-geo);
  font-weight: 700;
}
.select select { border: 0; padding: 2px 4px; }

.stat-row { gap: 10px 28px; }
.stat {
  min-width: 0;
  padding: 0 0 0 12px;
  border-left: var(--rule) solid var(--zone);
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}
.stat .label { font-size: 0.8rem; font-weight: 400; letter-spacing: 0.01em; text-transform: none; color: var(--ink); }
.stat .value { font-family: var(--font-geo); font-size: 1.7rem; line-height: 1.15; color: var(--ink); }

.panel { border: 3px solid var(--ink); border-radius: 0; box-shadow: none; }

.anecdotes-ad { padding: 16px; text-align: center; font-size: 0.8rem; }
.ad-slot.ingame-ad,
.anecdotes-ad {
  border: 3px dashed var(--ink);
  border-radius: 0;
  font-family: var(--font-geo);
  color: var(--ink);
}

/* ---------- Fin de partie : l'aplat envahit l'écran ---------- */
.overlay { background: var(--flood); padding: 0; justify-content: flex-start; overflow: auto; }
.overlay.open { animation: flood-in 0.9s var(--glide) both; }
@keyframes flood-in {
  from { clip-path: circle(0% at 50% 50%); }
  to { clip-path: circle(150% at 50% 50%); }
}
.modal {
  --text: #fff;
  --text-muted: #fff;
  max-width: none;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 6vw;
  color: #fff;
  text-align: left;
}
.modal h2 {
  margin: 0;
  font-family: var(--font-geo);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: #fff;
  transition: letter-spacing 0.7s var(--glide);
}
.modal h2:hover { letter-spacing: 0.05em; }
.modal p { margin: 22px 0 28px; max-width: 44ch; font-size: 1.1rem; line-height: 1.6; color: #fff; }
.modal .modal-actions { justify-content: flex-start; }
.modal .btn { background: #fff; border-color: #fff; color: #111; }
.modal .btn + .btn { background: transparent; color: #fff; }
.modal .btn:hover { background: #ffd400; border-color: #ffd400; color: #111; }

/* ---------- Anecdote du jour, sous le jeu : un aplat bleu, un disque rouge dessus ---------- */
.anecdote-wrap {
  position: relative;
  max-width: 760px;
  margin: clamp(64px, 8vw, 110px) 0 0 auto;
}
.anecdote-wrap.is-collapsed { display: flex; justify-content: flex-end; margin-top: clamp(40px, 5vw, 64px); }
.anecdote-of-day[hidden] { display: none; }
/* bouton réduire : un petit carré dans le coin du bloc ;
   réduit, il devient une étiquette « Anecdote du jour + » */
.anecdote-toggle {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: #fff;
  font-family: var(--font-geo);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.anecdote-toggle:hover { background: #fff; color: #111; }
.anecdote-toggle-label { display: none; }
.anecdote-toggle-sign { font-size: 1.5rem; line-height: 1; }
.is-collapsed .anecdote-toggle {
  position: static;
  padding: 0 14px 0 10px;
  border: 3px solid var(--ink);
  background: var(--ground);
  color: var(--ink);
}
.is-collapsed .anecdote-toggle:hover { background: var(--ink); color: var(--on-ink); }
.is-collapsed .anecdote-toggle-label { display: inline; }
.is-collapsed .anecdote-toggle::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--r);
}

.anecdote-of-day {
  position: relative;
  display: block;
  margin: 0;
  padding: clamp(22px, 3vw, 36px);
  padding-top: clamp(34px, 4vw, 48px);
  border: 0;
  border-radius: 0;
  background: var(--b);
  color: #fff;
  text-decoration: none;
  transition: none;
}
.anecdote-of-day:hover { transform: none; box-shadow: none; }
.anecdote-of-day-icon {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--r);
  font-size: 0;
  transition: scale 0.6s var(--spring);
}
.anecdote-of-day:hover .anecdote-of-day-icon { scale: 1.35; }
.anecdote-of-day-label {
  margin-bottom: 10px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.anecdote-of-day-text {
  margin-bottom: 20px;
  max-width: 44ch;
  color: #fff;
  font-size: clamp(1.15rem, 1.9vw, 1.55rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.anecdote-of-day-link {
  padding: 10px 14px;
  background: #fff;
  color: #111;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.15s, letter-spacing 0.4s var(--glide);
}
.anecdote-of-day:hover .anecdote-of-day-link { text-decoration: none; background: var(--y); letter-spacing: 0.05em; }
@media (max-width: 700px) {
  .anecdote-wrap { margin-left: 22px; }
}

/* ---------- Bandeau de consentement ---------- */
.ad-consent-banner {
  background: var(--ground);
  border-top: var(--rule) solid var(--ink);
  box-shadow: none;
}

/* ---------- Anecdotes, pages légales ---------- */
.anecdotes-page h1,
.legal-page h1 {
  font-family: var(--font-geo);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.anecdotes-intro { color: var(--ink); font-size: 1.05rem; line-height: 1.6; }
.anecdote-grid { gap: 0; border-top: var(--rule) solid var(--ink); border-left: var(--rule) solid var(--ink); }
.anecdote-card {
  border: 0;
  border-right: var(--rule) solid var(--ink);
  border-bottom: var(--rule) solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  background: var(--ground);
  transition: background 0.2s, color 0.2s;
}
.anecdote-card:hover { background: var(--ink); }
.anecdote-card:hover p,
.anecdote-card:hover .anecdote-card-num { color: var(--on-ink); }
.anecdote-card-num { font-family: var(--font-geo); font-size: 1.5rem; letter-spacing: -0.02em; color: var(--ink); }
.anecdote-card p { font-size: 0.98rem; line-height: 1.55; }
.legal-page h2 { font-family: var(--font-geo); font-weight: 700; text-transform: uppercase; letter-spacing: -0.01em; }
.legal-page code { border-radius: 0; }
.legal-todo,
.legal-todo * { color: #111111; }
.legal-todo { background: #ffffff; border: 3px dashed #111111; border-radius: 0; }

@media (prefers-reduced-motion: reduce) {
  .game-title::before, .overlay.open { animation: none; }
  .icon-btn, .help-btn, .btn, .modal h2, .anecdote-card, .anecdote-of-day-icon, .anecdote-of-day-link, .anecdote-toggle { transition: none; }
}
