/* lesjeuxauburo — feuille de style unique. Mobile-first, thème clair/sombre.
   Palette « bureau chaleureux » : crème, terracotta, sauge. */

/* ---------- Reset léger ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  background: transparent;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
/* Décor « open space » en filigrane : tasses, imprimante, trombones… */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../assets/office-pattern.svg") repeat;
  background-size: 300px 300px;
  opacity: var(--doodle-opacity);
  pointer-events: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; font-weight: 800; }

/* ---------- Thème : clair par défaut ---------- */
:root {
  --bg: #e9edf3;
  --surface: #fbfcfe;
  --surface-2: #dde4ee;
  --text: #222834;
  --muted: #5a6675;
  --border: #ccd6e2;
  --primary: #4f6f9e;
  --primary-ink: #ffffff;
  --accent: #5f9e8a;
  --coffee: #8a5228;

  --mot-correct: #cf4b52;
  --mot-present: #e0a52f;
  --mot-absent: #9aa6b4;
  --tile-ink: #ffffff;
  --key-bg: #d5deea;
  --key-ink: #222834;

  --shadow: 0 1px 2px rgba(40, 55, 75, .09), 0 4px 16px rgba(40, 55, 75, .07);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 560px;
  --doodle-opacity: .05;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151a21;
    --surface: #1d232c;
    --surface-2: #28303b;
    --text: #e7ecf3;
    --muted: #97a3b3;
    --border: #313a47;
    --primary: #6c92c6;
    --primary-ink: #11151b;
    --accent: #6cae9a;
    --coffee: #cf9163;

    --mot-correct: #d1495b;
    --mot-present: #d99a2b;
    --mot-absent: #454f5c;
    --tile-ink: #f4f7fb;
    --key-bg: #2c3541;
    --key-ink: #e7ecf3;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    --doodle-opacity: .06;
  }
}
:root[data-theme="dark"] {
  --bg: #151a21;
  --surface: #1d232c;
  --surface-2: #28303b;
  --text: #e7ecf3;
  --muted: #97a3b3;
  --border: #313a47;
  --primary: #6c92c6;
  --primary-ink: #11151b;
  --accent: #6cae9a;
  --coffee: #cf9163;
  --mot-correct: #d1495b;
  --mot-present: #d99a2b;
  --mot-absent: #454f5c;
  --tile-ink: #f4f7fb;
  --key-bg: #2c3541;
  --key-ink: #e7ecf3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  --doodle-opacity: .06;
}

/* ---------- Accessibilité ---------- */
.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-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--primary-ink);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .55rem max(.9rem, env(safe-area-inset-left));
  padding-top: calc(.55rem + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand {
  background: none; border: 0; font-weight: 800; font-size: 1.02rem;
  letter-spacing: -.01em; padding: .3rem .2rem; color: var(--text);
}
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 1.1rem; box-shadow: var(--shadow);
}
.iconbtn:hover { background: var(--surface-2); }

/* ---------- Conteneur ---------- */
.view {
  max-width: var(--maxw); margin: 0 auto;
  padding: 1rem max(.9rem, env(safe-area-inset-left)) 3rem;
  outline: none;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .7rem 1.1rem; border-radius: var(--radius-sm); font-weight: 700;
  box-shadow: var(--shadow); transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn--ghost { background: var(--surface); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6em; height: 1.6em; border-radius: 6px; font-weight: 800; color: var(--tile-ink);
}
.chip--correct { background: var(--mot-correct); }
.chip--present { background: var(--mot-present); border-radius: 50%; }
.chip--absent { background: var(--mot-absent); }

/* ---------- Hub ---------- */
.hub__hero { text-align: center; padding: 1.2rem 0 .5rem; }
.hub__brand { font-size: 1.9rem; letter-spacing: -.02em; }
.hub__brand-emoji { font-size: 1.6rem; }
.hub__tagline { color: var(--muted); margin-top: .3rem; font-size: .95rem; }
.hub__date { margin-top: .7rem; font-weight: 700; font-size: .9rem; }
.hub__countdown {
  margin-top: .25rem; color: var(--muted); font-size: .85rem;
  font-variant-numeric: tabular-nums;
}
.countdown__value { color: var(--coffee); font-variant-numeric: tabular-nums; font-weight: 800; }

.hub__section { font-size: 1.05rem; margin: 1.3rem .2rem .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }

.tournee-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem; margin-top: 1rem;
}
.tournee-card__grade { display: flex; align-items: center; gap: .8rem; }
.tournee-card__emoji { font-size: 2rem; }
.tournee-card__label { font-weight: 800; font-size: 1.15rem; }
.tournee-card__meta { color: var(--muted); font-size: .85rem; }
.tournee-card__bar {
  height: 8px; background: var(--surface-2); border-radius: 99px; margin: .8rem 0 0; overflow: hidden;
}
.tournee-card__fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 99px; transition: width .4s ease;
}

.hub__grid { display: grid; grid-template-columns: 1fr; gap: .7rem; }
@media (min-width: 460px) { .hub__grid { grid-template-columns: 1fr 1fr; } }

.gamecard {
  display: flex; align-items: center; gap: .8rem; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 5px solid var(--game-color, var(--primary));
  border-radius: var(--radius); padding: .85rem; box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .15s ease;
}
.gamecard:hover { transform: translateY(-2px); }
/* Vignette du jeu : l'illustration générée, la même que dans l'app iOS */
.gamecard__art {
  width: 52px; height: 52px; flex: none; border-radius: 13px;
  display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--game-color, var(--primary)) 16%, var(--surface));
}
.gamecard__art img { width: 84%; height: 84%; object-fit: contain; display: block; }
.gamecard__emoji { font-size: 1.6rem; line-height: 1; }
.gamecard__body { flex: 1; min-width: 0; }
.gamecard__name { font-weight: 800; }
.gamecard__tag { color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.gamecard__stats { display: flex; gap: .5rem; margin-top: .35rem; font-size: .8rem; font-weight: 700; min-height: 1em; }
.gamecard__streak { color: var(--coffee); }
.gamecard__score { color: var(--muted); }
.gamecard__state { display: flex; flex-direction: column; align-items: center; gap: .1rem; flex: none; width: 56px; text-align: center; }
.gamecard__badge { font-size: 1.3rem; }
.gamecard__badge-label { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.1; }

.gamecard--soon { opacity: .72; cursor: default; }
.gamecard--soon .gamecard__art { filter: grayscale(.5); opacity: .8; }
.gamecard__soon {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); color: var(--muted); padding: .25rem .5rem; border-radius: 99px; flex: none;
}

.hub__footer { text-align: center; margin-top: 1.6rem; }
.hub__stats-link { font-weight: 700; text-decoration: none; font-size: .9rem; }
.hub__links { margin-top: .9rem; font-size: .8rem; color: var(--muted); }
.hub__links a { color: var(--muted); text-decoration: underline; }

/* ---------- Pages annexes (aide, confidentialité) ---------- */
.page { max-width: 40rem; line-height: 1.65; }
.page__title { font-size: 1.7rem; margin: .6rem 0 .2rem; }
.page__date { color: var(--muted); font-size: .85rem; margin-bottom: 1.2rem; }
.page h2 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
.page h3 { font-size: .98rem; margin: 1.2rem 0 .3rem; }
.page p, .page li { color: var(--text); }
.page ul { margin: .4rem 0 .8rem 1.2rem; }
.page li { margin-bottom: .3rem; }
.page__card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.page__card h2 { margin-top: 0; }
.page__list dt { font-weight: 800; margin-top: .9rem; }
.page__list dd { margin: .2rem 0 0 0; color: var(--muted); }
.page__back { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .9rem; }

/* ---------- En-tête de jeu ---------- */
.game-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .6rem; margin: .4rem 0 1rem;
}
.game-title { font-size: 1.5rem; letter-spacing: -.01em; }
.game-sub { color: var(--muted); font-size: .85rem; margin-top: .1rem; }
.howto-btn { font-weight: 800; }

/* ---------- Le Mot ---------- */
.mot-board { display: grid; gap: 6px; justify-content: center; margin: 0 auto 1.1rem; }
.mot-row { display: grid; grid-auto-flow: column; gap: 6px; justify-content: center; }
.tile {
  --size: clamp(40px, 13vw, 58px);
  width: var(--size); height: var(--size); position: relative;
  display: grid; place-items: center; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface);
  font-size: calc(var(--size) * .48); font-weight: 800; text-transform: uppercase;
  color: var(--text);
}
.tile[data-state="filled"] { border-color: var(--muted); }
.tile[data-state="empty"] { background: var(--surface); }
.tile--given { border-style: dashed; border-color: var(--primary); color: var(--primary); }
.tile[data-state="correct"] { background: var(--mot-correct); border-color: var(--mot-correct); color: var(--tile-ink); border-radius: 10px; }
.tile[data-state="present"] { background: var(--mot-present); border-color: var(--mot-present); color: var(--tile-ink); border-radius: 50%; }
.tile[data-state="absent"] { background: var(--mot-absent); border-color: var(--mot-absent); color: var(--tile-ink); }
.tile__mark {
  position: absolute; bottom: 3px; right: 5px; font-size: calc(var(--size) * .2); line-height: 1; opacity: .9;
}
.tile--reveal { animation: flip .55s ease both; }
@keyframes flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}
.mot-row--shake { animation: shake .4s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* La Suite : 8 cases, plus compactes */
.suite-board .tile { --size: clamp(30px, 10.2vw, 46px); border-radius: 8px; }
.suite-board .tile[data-state="present"] { border-radius: 50%; }
.keyboard--suite { max-width: 420px; }
.key--suite { font-size: 1.15rem; }

/* ---------- Clavier ---------- */
.keyboard { display: grid; gap: 6px; margin: 0 auto; max-width: 500px; }
.keyboard__row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1; min-width: 0; height: 52px; border-radius: 8px; border: 0;
  background: var(--key-bg); color: var(--key-ink); font-weight: 700; font-size: 1rem;
  display: grid; place-items: center; transition: transform .05s ease, background .1s;
  text-transform: uppercase;
}
.key:active { transform: translateY(1px); }
.key--wide { flex: 1.6; font-size: .8rem; }
.key[data-state="correct"] { background: var(--mot-correct); color: var(--tile-ink); }
.key[data-state="present"] { background: var(--mot-present); color: var(--tile-ink); }
.key[data-state="absent"] { background: var(--mot-absent); color: var(--tile-ink); opacity: .85; }
.key:disabled { opacity: .55; }

/* ---------- Connexions ---------- */
.cnx-solved { display: grid; gap: .5rem; margin-bottom: .5rem; }
.cnx-group { border-radius: 12px; padding: .6rem .7rem; text-align: center; color: #2b2622; animation: rise .3s ease both; }
.cnx-group[data-level="0"] { background: #e9c65a; }
.cnx-group[data-level="1"] { background: #8ec3a8; }
.cnx-group[data-level="2"] { background: #7ea1d4; }
.cnx-group[data-level="3"] { background: #b18ed6; }
.cnx-group__label { font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .02em; }
.cnx-group__words { font-weight: 600; font-size: .92rem; margin-top: .1rem; }

.cnx-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .8rem; }
.cnx-tile {
  aspect-ratio: 1 / 1; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: clamp(.62rem, 2.8vw, .85rem); line-height: 1.05;
  display: grid; place-items: center; padding: .2rem; text-align: center; hyphens: auto;
  overflow: hidden; word-break: break-word; transition: transform .06s ease, background .12s ease;
}
.cnx-tile[data-selected="1"] { background: var(--text); color: var(--bg); transform: scale(.97); }
.cnx-tile:active { transform: scale(.94); }
.cnx-tile--shake { animation: shake .4s ease; }

.cnx-mistakes { text-align: center; font-size: .9rem; color: var(--muted); margin-bottom: .7rem; display: flex; gap: .4rem; align-items: center; justify-content: center; }
.cnx-mistakes__dots { display: inline-flex; gap: .35rem; }
.cnx-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--primary); }
.cnx-dot[data-used="1"] { background: transparent; border: 2px solid var(--muted); opacity: .5; }
.cnx-controls { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.cnx-controls .btn { flex: 1; min-width: 30%; }

/* ---------- L'Intrus ---------- */
.intrus-instruction { text-align: center; font-weight: 700; margin: .2rem 0 .5rem; min-height: 1.4em; }
.intrus-tries { display: flex; gap: .4rem; justify-content: center; margin-bottom: .8rem; }
.intrus-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent); }
.intrus-dot[data-used="1"] { background: transparent; border-color: var(--muted); opacity: .5; }
.intrus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 460px; margin: 0 auto; }
.intrus-tile {
  position: relative; aspect-ratio: 5 / 3; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); font-weight: 800; font-size: clamp(.85rem, 3.6vw, 1.05rem);
  display: grid; place-items: center; padding: .3rem; text-align: center; box-shadow: var(--shadow);
  transition: transform .08s ease, background .15s ease; color: var(--text);
}
.intrus-tile:not(:disabled):hover { transform: translateY(-2px); border-color: var(--accent); }
.intrus-tile:disabled { cursor: default; }
.intrus-tile[data-state="wrong"] { background: var(--surface-2); color: var(--muted); border-color: var(--mot-absent); text-decoration: line-through; opacity: .7; }
.intrus-tile[data-state="intruder"] { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); border-color: var(--accent); }
.intrus-tile__mark { position: absolute; top: 4px; right: 6px; font-size: .8rem; }
.intrus-form { display: flex; gap: .5rem; max-width: 460px; margin: 1rem auto 0; }
.intrus-input {
  flex: 1; min-width: 0; padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.intrus-input:focus { border-color: var(--primary); outline: none; }
.intrus-theme__tries { text-align: center; color: var(--muted); font-size: .82rem; margin-top: .5rem; }
.intrus-reveal { text-align: left; background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .9rem; margin: .2rem 0 .6rem; }
.intrus-reveal p { margin-bottom: .35rem; }
.intrus-reveal__explain { color: var(--muted); font-size: .9rem; }
.intrus-reveal__theme { font-weight: 700; }

/* ---------- L'Évasion ---------- */
.evasion-goalhint { text-align: center; font-weight: 700; color: var(--text); margin: .2rem 0 .9rem; }
.evasion-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.evasion-board {
  --cell: clamp(50px, 16.5vw, 70px);
  position: relative;
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 16px;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  box-shadow: var(--shadow);
}
.evasion-block {
  position: absolute; width: var(--cell); height: var(--cell); box-sizing: border-box;
  background: repeating-linear-gradient(45deg, var(--border), var(--border) 5px, transparent 5px, transparent 10px);
  background-color: color-mix(in srgb, var(--muted) 26%, var(--surface-2));
  z-index: 0;
}
/* Zone d'arrivée : un rectangle vert unifié, bien visible */
.evasion-zone {
  position: absolute; box-sizing: border-box; z-index: 0;
  background: #3fa06a; border-radius: 12px;
  box-shadow: inset 0 0 0 3px #2f8a58, inset 0 0 22px rgba(255, 255, 255, .18);
  display: grid; place-items: center;
  animation: zonePulse 2.4s ease-in-out infinite;
}
.evasion-zone__label {
  color: #eafaf0; font-weight: 800; font-size: calc(var(--cell) * .22);
  letter-spacing: .12em; text-transform: uppercase; opacity: .85; user-select: none;
}
@keyframes zonePulse { 0%, 100% { box-shadow: inset 0 0 0 3px #2f8a58, inset 0 0 22px rgba(255,255,255,.14); } 50% { box-shadow: inset 0 0 0 3px #57c98a, inset 0 0 26px rgba(255,255,255,.30); } }

/* Bloc = une pièce unifiée (contour SVG du polyomino) portant un objet de bureau */
.evasion-piece {
  position: absolute; z-index: 1; overflow: visible; cursor: pointer; touch-action: none;
  transition: left .14s ease, top .14s ease;
  filter: drop-shadow(0 2px 3px rgba(20, 30, 45, .28));
}
.evasion-piece[data-target] { z-index: 2; }
.evasion-piece.is-dragging { transition: none !important; z-index: 4; }
.evasion-obj.is-dragging { transition: none !important; z-index: 6; }
.evasion-path {
  stroke: var(--surface-2); stroke-width: .16; stroke-linejoin: round; stroke-linecap: round;
  transition: stroke .1s ease;
}
.evasion-piece[data-selected="1"] { z-index: 3; }
.evasion-piece[data-selected="1"] .evasion-path { stroke: var(--primary); stroke-width: .26; }
.evasion-piece:focus-visible { outline: none; }
.evasion-piece:focus-visible .evasion-path { stroke: var(--primary); stroke-width: .26; }
.evasion-obj {
  position: absolute; z-index: 5; width: calc(var(--cell) * .78); height: calc(var(--cell) * .78);
  object-fit: contain; user-select: none;
  pointer-events: none; transform: translate(-50%, -50%);
  transition: left .14s ease, top .14s ease;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .3));
}
.evasion-obj[data-target] { width: calc(var(--cell) * 1.15); height: calc(var(--cell) * 1.15); }
.evasion-obj[data-selected="1"] { transform: translate(-50%, -50%) scale(1.08); }
/* Le café ressort : halo chaud autour du bloc */
.evasion-piece[data-target] { filter: drop-shadow(0 0 7px rgba(239, 125, 58, .55)) drop-shadow(0 2px 3px rgba(20, 30, 45, .28)); }

.evasion-counter { text-align: center; color: var(--muted); font-weight: 600; margin-bottom: .8rem; min-height: 1.4em; }
.evasion-dpad {
  display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px);
  gap: 6px; justify-content: center; margin: 0 auto 1rem;
  grid-template-areas: ". up ." "left . right" ". down .";
}
.evasion-arrow {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  font-size: 1.1rem; box-shadow: var(--shadow); color: var(--text);
}
.evasion-arrow:active { transform: translateY(1px); }
.evasion-arrow.up { grid-area: up; } .evasion-arrow.down { grid-area: down; }
.evasion-arrow.left { grid-area: left; } .evasion-arrow.right { grid-area: right; }

/* ---------- Les Allumettes ---------- */
:root { --stick: #c98a3f; --stick-head: #c0392b; --slot: #b9c4d1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --stick: #d3a154; --stick-head: #d1544a; --slot: #3a4350; }
}
:root[data-theme="dark"] { --stick: #d3a154; --stick-head: #d1544a; --slot: #3a4350; }
.allu-instruction { text-align: center; font-weight: 700; margin: .2rem 0 1rem; }
.allu-board {
  display: flex; align-items: center; justify-content: center; gap: .25rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem .8rem; margin-bottom: 1rem; min-height: 120px;
}
.allu-cell { height: clamp(74px, 21vw, 104px); width: auto; }
.allu-cell--digit { aspect-ratio: 50 / 92; }
.allu-cell--op, .allu-cell--eq { aspect-ratio: 40 / 92; }
.allu-stick { transition: fill .12s ease; }
.allu-stick.is-on { fill: var(--stick); }
.allu-stick.is-off { fill: transparent; stroke: var(--slot); stroke-width: 1.4; stroke-dasharray: 3 3; }
.allu-stick[role="button"] { cursor: pointer; pointer-events: all; }
.allu-stick.is-off[role="button"]:hover { fill: color-mix(in srgb, var(--stick) 30%, transparent); }
.allu-stick.is-on[role="button"]:hover { fill: color-mix(in srgb, var(--stick) 70%, var(--surface)); }
.allu-stick:focus-visible { outline: none; stroke: var(--primary); stroke-width: 2.6; stroke-dasharray: none; }
.allu-head { fill: var(--stick-head); pointer-events: none; }
.allu-status { text-align: center; color: var(--muted); min-height: 1.4em; margin-bottom: 1rem; font-weight: 600; }
.allu-controls { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Le Pays ---------- */
.pays-silhouette {
  display: grid; place-items: center; padding: .8rem; margin: 0 auto 1rem; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.pays-svg { width: 100%; height: auto; max-height: 46vh; }
.pays-shape { fill: var(--primary); stroke: color-mix(in srgb, var(--primary) 60%, #000); stroke-width: .5; }
.pays-form { display: flex; gap: .5rem; max-width: 460px; margin: 0 auto; }
.pays-input {
  flex: 1; min-width: 0; padding: .8rem .9rem; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.pays-input:focus { border-color: var(--primary); outline: none; }
.pays-count { text-align: center; color: var(--muted); font-size: .82rem; margin: .5rem 0 .8rem; }
.pays-guesses { max-width: 460px; margin: 0 auto; display: grid; gap: .4rem; }
.pays-guess {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: .6rem; align-items: center;
  padding: .55rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700;
}
.pays-guess[data-correct="1"] { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); border-color: var(--accent); }
.pays-guess--empty { justify-content: center; color: var(--muted); background: var(--surface-2); opacity: .5; grid-template-columns: 1fr; text-align: center; }
.pays-guess__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pays-guess__dist { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.pays-guess__dir { font-size: 1.1rem; }
.pays-guess__pct { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }

/* ---------- Chaud-Froid ---------- */
.cf-form { display: flex; gap: .5rem; max-width: 460px; margin: 0 auto; }
.cf-input {
  flex: 1; min-width: 0; padding: .8rem .9rem; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.cf-input:focus { border-color: var(--primary); outline: none; }
.cf-count { text-align: center; color: var(--muted); font-size: .82rem; margin-top: .5rem; }
.cf-giveup { display: block; margin: .3rem auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: .85rem; }
.cf-last { max-width: 500px; margin: 1rem auto 0; }
.cf-last__label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; }
.cf-history__title { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 1.3rem .2rem .5rem; }
.cf-history { max-width: 500px; margin: 0 auto; display: grid; gap: .4rem; }
.cf-entry { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.cf-entry[data-hi="1"] { box-shadow: 0 0 0 2px var(--primary); }
.cf-entry__bar { position: absolute; inset: 0; }
.cf-entry__fill { height: 100%; opacity: .18; }
.cf-entry__fill[data-band="brulant"] { background: #d1495b; }
.cf-entry__fill[data-band="chaud"] { background: #e8833a; }
.cf-entry__fill[data-band="tiede"] { background: #e0a52f; }
.cf-entry__fill[data-band="froid"] { background: #5b8fd1; }
.cf-entry__row { position: relative; display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; }
.cf-entry__word { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cf-entry__band { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.cf-entry__rank { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Panneau de fin ---------- */
.end-slot { margin-top: 1.2rem; }
.endpanel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.2rem; text-align: center;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.endpanel__badge {
  font-size: 1.25rem; font-weight: 800; display: inline-flex; gap: .3rem; align-items: center;
  padding: .3rem .8rem; border-radius: 99px; margin-bottom: .5rem;
}
.endpanel__badge[data-state="win"] { background: color-mix(in srgb, var(--accent) 25%, var(--surface)); }
.endpanel__badge[data-state="lose"] { background: color-mix(in srgb, var(--mot-correct) 18%, var(--surface)); }
.mot-reveal { font-size: 1.05rem; margin: .3rem 0 .6rem; }
.mot-reveal strong { color: var(--primary); letter-spacing: .05em; }
.endpanel__msg { color: var(--text); margin: .4rem 0 .8rem; }
.endpanel__hint { color: var(--muted); font-size: .85rem; margin-bottom: .6rem; }
.endpanel__actions { display: flex; flex-direction: column; gap: .5rem; }
.endpanel__countdown {
  margin-top: 1rem; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums;
}

/* ---------- Statistiques ---------- */
.stats__head { margin: .4rem 0 1rem; }
.stats__back { font-weight: 700; text-decoration: none; font-size: .9rem; }
.stats__title { font-size: 1.5rem; margin-top: .5rem; }
.stats__section { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 1.3rem .2rem .6rem; }
.stats-global { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem .5rem; text-align: center; }
.stat-tile__value { font-size: 1.5rem; font-weight: 800; }
.stat-tile__label { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.stats-games { display: grid; gap: .8rem; }
.stats-card { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--game-color); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem; }
.stats-card__head { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.stats-card__art {
  width: 34px; height: 34px; flex: none; border-radius: 9px; overflow: hidden;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--game-color, var(--primary)) 16%, var(--surface));
}
.stats-card__art img { width: 84%; height: 84%; object-fit: contain; }
.stats-card__name { font-weight: 800; font-size: 1.05rem; }
.stats-card__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-bottom: .8rem; }
.mini-stat { text-align: center; }
.mini-stat__value { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mini-stat__label { font-size: .68rem; color: var(--muted); }
.stats-card__empty { color: var(--muted); font-size: .9rem; text-align: center; }
.dist-chart { display: grid; gap: .3rem; }
.dist-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .5rem; align-items: center; }
.dist-row__key { font-size: .8rem; color: var(--muted); text-align: right; }
.dist-row__bar { background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.dist-row__fill { background: var(--game-color, var(--primary)); min-width: 1.4rem; padding: .12rem .4rem; text-align: right; border-radius: 6px; }
.dist-row__fill[data-fail="1"] { background: var(--mot-absent); }
.dist-row__count { font-size: .78rem; font-weight: 800; color: #fff; }
.stats__reset { text-align: center; margin-top: 1.6rem; }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(20, 14, 8, .5); padding: 1rem;
  opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.is-open { opacity: 1; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); width: 100%; max-width: 440px; max-height: 88dvh; overflow: auto;
  transform: translateY(12px) scale(.98); transition: transform .18s ease;
}
.modal-overlay.is-open .modal { transform: none; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1rem .3rem; }
.modal__title { font-size: 1.2rem; }
.modal__close { background: none; border: 0; font-size: 1.1rem; color: var(--muted); width: 34px; height: 34px; border-radius: 50%; }
.modal__close:hover { background: var(--surface-2); }
.modal__body { padding: .3rem 1rem 1rem; }
.modal__body p { margin-bottom: .6rem; }
.modal__body ul { margin: .4rem 0 .8rem 0; padding-left: 0; list-style: none; }
.modal__actions { display: flex; gap: .5rem; padding: 0 1rem 1rem; justify-content: flex-end; }
.howto-legend li { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
body.modal-open { overflow: hidden; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(1.4rem + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); z-index: 60;
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 99px;
  font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 90vw; text-align: center;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Confettis ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px; width: 9px; height: 14px; opacity: .9;
  animation-name: fall; animation-timing-function: ease-in; animation-fill-mode: both;
}
@keyframes fall {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  100% { transform: translateY(104vh) rotate(540deg); opacity: .9; }
}

.error-note { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ---------- Réduction de mouvement ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Sauvegarde de la progression (sans compte) ---------- */
.backup__warn {
  background: color-mix(in srgb, var(--coffee) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--coffee) 35%, var(--border));
  border-radius: var(--radius-sm); padding: .8rem .9rem; margin-bottom: .9rem;
}
.backup__warn p { font-size: .85rem; color: var(--text); margin-top: .3rem; }
.backup__intro { font-size: .87rem; color: var(--muted); margin-bottom: .8rem; }
.backup__actions { display: flex; flex-direction: column; gap: .5rem; }
.backup__field {
  width: 100%; font: inherit; font-size: .8rem; font-family: ui-monospace, monospace;
  padding: .7rem; margin-top: .6rem; resize: vertical;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: var(--surface); color: var(--text);
}
.backup__field:focus { border-color: var(--primary); outline: none; }
.backup__feedback { font-size: .85rem; font-weight: 700; margin-top: .5rem; min-height: 1.2em; }
.backup__feedback[data-state="ok"] { color: var(--accent); }
.backup__feedback[data-state="error"] { color: var(--mot-correct); }
