/* ─────────────────────────────────────────────
   Cosy paper palette — warm linen tones.
   ───────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg:        #CFC0A6;
  --bg-2:      #C3B498;
  --surface:   #F4EAD6;
  --surface-2: #EBE0CB;
  --surface-3: #D8CBAF;

  /* toolbar */
  --bar-bg:     #BFB09A;
  --bar-border: #A49070;
  --bar-div:    rgba(80,58,30,.22);
  --bar-muted:  rgba(42,33,23,.50);

  /* ink */
  --text:      #2A2117;
  --text-soft: #4A3E2E;
  --muted:     #7A6A52;

  /* lines */
  --border:    #C8B895;
  --border-2:  #B5A278;

  /* accents */
  --accent:    #3C7762;
  --accent-2:  #2E5C4C;
  --accent-ink:#F4EAD6;
  --warm:      #C46A3A;
  --honey:     #E9C56A;

  /* game */
  --block:     #2A2117;
  --cell:      var(--surface);
  --cell-edge: #D9CCAE;
  --correct:   #3C7762;
  --wrong:     #B05230;
  --highlight: #F2E2B0;
  --active:    #E9C56A;

  /* shape & motion */
  --radius:    16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 0 rgba(60,40,20,.05), 0 1px 2px rgba(60,40,20,.08);
  --shadow:    0 1px 0 rgba(60,40,20,.05), 0 6px 18px -8px rgba(60,40,20,.22);
  --shadow-lg: 0 1px 0 rgba(60,40,20,.05), 0 24px 48px -22px rgba(60,40,20,.35);
  --cell-size: clamp(32px, 3.8vw, 54px);

  /* type */
  --font-ui:    'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-serif: 'Fraunces', 'Source Serif 4', ui-serif, Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
html, body { background: var(--bg); }

body {
  color: var(--text);
  font: 16px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  max-width: 1000px;
  margin-inline: auto;
  width: 100%;
  background:
    radial-gradient(900px 500px at 88% -10%, rgba(60,119,98,.09), transparent 60%),
    radial-gradient(800px 460px at -10% 8%, rgba(233,197,106,.13), transparent 65%),
    var(--bg);
}

::selection { background: var(--honey); color: var(--text); }

a { color: var(--accent-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

kbd {
  font: 600 .82em var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: .05em .42em;
  color: var(--text-soft);
}

/* ── toolbar — editorial strip ─────────── */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bar-bg);
  border-bottom: 1.5px solid var(--bar-border);
  padding-top: max(0px, env(safe-area-inset-top));
}
.bar-inner {
  display: flex; align-items: stretch;
  height: 3.5rem;
}
.bar-group { display: flex; align-items: stretch; }
.bar-right {
  margin-left: auto;
  border-left: 1px solid var(--bar-div);
}

/* field — stacked micro-label + select value */
.field {
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 1rem;
  border-right: 1px solid var(--bar-div);
  gap: .12rem;
  cursor: pointer;
  transition: background .12s;
  min-width: 0;
}
.field:hover  { background: rgba(0,0,0,.06); }
.field:focus-within { background: rgba(0,0,0,.09); outline: none; }

.field > span {
  font: 700 .58rem/1 var(--font-ui);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(42,33,23,.72);   /* plus foncé qu'avant — lisible */
  pointer-events: none;
  white-space: nowrap;
  margin-top: .15rem;            /* descend légèrement du haut */
}
.field select {
  appearance: none; -webkit-appearance: none;
  background: transparent; color: var(--text);
  border: 0; outline: none; cursor: pointer;
  font: 600 .9rem/1.2 var(--font-ui);
  padding: 0 1.25rem 0 0;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 10px) 55%, calc(100% - 4px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  opacity: .88;
}
.field select:focus { opacity: 1; outline: none; }
.field select option { background: var(--surface); color: var(--text); }

/* base button (outside bar: ghost actions, dialog) */
button {
  font: 600 .92rem var(--font-ui);
  color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  padding: 0 1.05rem; height: 2.4rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .08s, color .15s, box-shadow .2s;
  white-space: nowrap;
}
button:hover { border-color: var(--border-2); background: var(--surface-2); }
button:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent); border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: transparent; font-weight: 700;
  box-shadow: 0 8px 18px -10px color-mix(in oklab, var(--accent) 70%, transparent), 0 1px 0 rgba(0,0,0,.04);
}
button.primary:hover { background: var(--accent-2); color: var(--accent-ink); }
button.ghost { background: transparent; box-shadow: none; }
button.ghost:hover { background: var(--surface); }
button.ghost.danger { color: var(--warm); border-color: color-mix(in oklab, var(--warm) 35%, var(--border)); }
button.ghost.danger:hover { background: color-mix(in oklab, var(--warm) 10%, transparent); }

/* bar button override — flat block, no pill */
.bar button {
  appearance: none;
  background: transparent;
  color: var(--text);
  border: 0;
  border-left: 1.5px solid var(--bar-div);
  border-radius: 0;
  padding: 0 1.5rem;
  height: 100%;
  box-shadow: none;
  font: 700 .88rem/1 var(--font-ui);
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background .15s;
}
.bar button:hover  { background: transparent; transform: none; }
.bar .field:hover  { background: rgba(0,0,0,.07); }
.bar #new-game { background: var(--accent); color: var(--accent-ink); border-left-color: rgba(0,0,0,.15); }
.bar #new-game:hover { background: var(--accent-2); }
.bar button:active { opacity: .82; transform: none; }
.bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; box-shadow: none; }

/* ── custom dropdown panel ────────────── */
.field { position: relative; }

.dd-trig {
  display: flex; align-items: center;
  flex: 1; width: 100%;
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  color: var(--text); cursor: pointer;
  font: 600 .9rem/1.2 var(--font-ui);
  padding: 0; text-align: left;
  white-space: nowrap; overflow: hidden;
  transition: none;
}
.dd-trig:hover { background: transparent; border-color: transparent; transform: none; }
.dd-trig:focus-visible { outline: none; }
.bar .dd-trig { padding: 0; border-left: 0; background: transparent; height: 100%; font: 600 .88rem/1 var(--font-ui); letter-spacing: 0; }
.dd-val { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dd-caret {
  flex-shrink: 0; display: inline-block;
  margin-left: .38rem; margin-right: 2px;
  width: 0; height: 0;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 5.5px solid currentColor;
  opacity: .55;
  transition: transform .15s;
}
.field.dd-open .dd-caret { transform: rotate(180deg); }
/* open state: fill the whole field cell with accent color */
.bar .field.dd-open { background: var(--accent); color: var(--accent-ink); }
.bar .field.dd-open .dd-trig { color: var(--accent-ink); }
.bar .field.dd-open > span { color: var(--accent-ink); opacity: .75; }

.dd-panel {
  position: absolute;
  top: 100%; left: 0;
  min-width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--bar-border);
  border-top: 0;
  border-radius: 0;
  box-shadow: 0 8px 24px -6px rgba(60,40,20,.18);
  z-index: 100;
  overflow: hidden;
  display: none;
}
.field.dd-open .dd-panel { display: block; }

.dd-item {
  display: block; width: 100%;
  padding: 1.4rem 1.1rem;
  text-align: left;
  font: 500 .9rem/1 var(--font-ui);
  color: var(--text-soft);
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  cursor: pointer; white-space: nowrap;
  transition: background .08s, color .08s;
}
.dd-item:hover   { background: var(--bg-2); color: var(--text); transform: none; }
.dd-item.dd-cur  { color: var(--accent); font-weight: 700; }
.dd-item:focus-visible { outline: none; background: var(--bg-2); color: var(--text); }
.dd-item:active  { transform: none; }
.dd-item + .dd-item { border-top: 1px solid var(--border); }

/* override .bar button dark style for panel items */
.bar .dd-panel { background: var(--surface); border-color: var(--bar-border); }
.bar-right .dd-panel { left: auto; right: 0; }
.bar .dd-item  { background: transparent; color: var(--text-soft); border: 0; border-radius: 0; box-shadow: none; height: auto; padding: 1.4rem 1.1rem; font: 500 .9rem/1 var(--font-ui); letter-spacing: 0; }
.bar .dd-item:hover { background: var(--bg-2); color: var(--text); }
.bar .dd-item.dd-cur { color: var(--accent); font-weight: 700; background: transparent; }
.bar .dd-item + .dd-item { border-top: 1px solid var(--border); border-radius: 0; }

/* ── game section: SEO always below fold ─ */
.game {
  min-height: calc(100vh - 3.5rem - 2.4rem - 2.5rem); /* bar + meta + page-top-padding */
}

/* ── page ─────────────────────────────── */
.page {
  flex: 1; width: 100%;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(.75rem, 3vw, 1.5rem) 4rem;
  display: flex; flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* ── sub-meta bar ─────────────────────── */
.meta {
  background: var(--bar-bg);
  border-bottom: 1.5px solid var(--bar-border);
  display: flex; align-items: stretch;
  height: 2.4rem;
}
.meta--hidden { display: none; }   /* desktop : barre meta supprimée, contenus migrés vers .bar */

.meta-inner {
  flex: 1; display: flex; align-items: stretch;
}

/* Quand timer / ABC / reset sont migrés dans .bar (desktop), on harmonise
   leur look avec celui des autres éléments de la barre : pleine hauteur,
   séparateurs verticaux, paddings cohérents, et le cluster ABC+Reset+Lang
   est poussé à droite via margin-left:auto sur le 1er élément du cluster. */
.bar-inner > .meta-time {
  height: 100%;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1.1rem;
  border-right: 1.5px solid var(--bar-div);
}
.bar-inner > .meta-validate-group {
  margin-left: 0;       /* override base .meta-validate-group { margin-left: auto } */
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1.5px solid var(--bar-div);
  padding: 0 .9rem;
  gap: .55rem;
}
.bar-inner > #reset {
  height: 100%;
  margin: 0;
  padding: 0 1.4rem;
  border: 0;
  border-left: 1.5px solid var(--bar-div);
  border-radius: 0;
  background: transparent;
  color: #8A3A12;            /* terracotta — action de réinit */
  font: 700 .88rem/1 var(--font-ui);
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s;
}
.bar-inner > #reset:hover { background: rgba(0,0,0,.06); }

/* Quand la lang field est précédée par margin-left:auto sur le validate-group,
   on supprime son auto pour qu'elle reste collée au reset. */
.bar-inner > .meta-validate-group ~ .bar-right {
  margin-left: 0;
}
.meta-time {
  display: flex; align-items: center; gap: .45rem;
  padding: 0 1.1rem;
  border-right: 1px solid var(--bar-div);
}
.meta-k {
  color: var(--bar-muted);
  font: 600 .63rem/1 var(--font-ui);
  text-transform: uppercase; letter-spacing: .12em;
}
/* Timer : style indépendant du parent (.meta sur mobile, .bar sur desktop)
   + largeur verrouillée pour éviter que les ticks fassent sauter le layout. */
#timer {
  color: var(--text);
  font: 700 .88rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 3.4em;        /* "00:00" = 5 chars en font-mono → ~3.4em */
  text-align: left;
}
.meta button {
  appearance: none; background: transparent;
  border: 0; border-left: 1px solid var(--bar-div); border-radius: 0;
  padding: 0 1.1rem; height: 100%;
  font: 600 .82rem/1 var(--font-ui); color: var(--warm);
  cursor: pointer; transition: background .12s, color .15s, opacity .15s;
}
.meta button:hover { background: rgba(0,0,0,.07); }
.meta-validate-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--bar-div);
  padding: 0 .75rem;
  gap: .3rem;
}
/* Bouton ABC : style indépendant du parent (.meta sur mobile, .bar sur desktop) */
#validate-toggle {
  border: 0;
  border-left: 0 !important;     /* annule la border-left héritée de .bar button */
  font: 700 .88rem/1 var(--font-mono);
  letter-spacing: .07em;
  background: var(--accent);
  color: var(--accent-ink);
  padding: .25rem .65rem;
  height: auto;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, color .15s;
}
#validate-toggle:hover { background: var(--accent-2); color: var(--accent-ink); }
#validate-toggle.off {
  background: transparent;
  color: var(--muted);
}
#validate-toggle.off:hover { background: rgba(0,0,0,.06); color: var(--muted); }

/* Bouton Indice 💡 — style indépendant du parent (mobile / desktop) */
#hint {
  border: 0;
  background: transparent;
  padding: .25rem .65rem;
  border-radius: var(--radius-sm);
  font: 700 1.15rem/1 var(--font-ui);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
#hint:hover { background: rgba(233,197,106,.4); transform: translateY(-1px); }
#hint:active { transform: none; }

/* Quand le hint est migré dans .bar (desktop), il prend la pleine hauteur
   et reçoit un séparateur gauche cohérent avec les autres éléments. */
.bar-inner > #hint {
  height: 100%;
  margin: 0;
  padding: 0 1rem;
  border-radius: 0;
  border-left: 1.5px solid var(--bar-div);
  display: flex;
  align-items: center;
  font-size: 1.2rem;
}

/* Bouton Recommencer : label texte en desktop, icône poubelle en mobile */
.reset-icon { display: none; font-size: 1.2rem; line-height: 1; }
@media (max-width: 1024px) {
  .reset-label { display: none; }
  .reset-icon { display: inline-block; }
}
.meta-info {
  display: flex; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  border: 1.5px solid var(--bar-div);
  cursor: help;
  color: var(--muted);
  font: 700 .72rem/1 var(--font-ui);
  position: relative;
  user-select: none;
  flex-shrink: 0;
}
.meta-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px); /* SOUS la barre */
  right: 0;
  width: min(240px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1.5px solid var(--bar-border);
  border-radius: 10px;
  padding: .7rem .9rem;
  font: 400 .82rem/1.45 var(--font-ui);
  color: var(--text-soft);
  box-shadow: var(--shadow);
  z-index: 200;
  white-space: normal;
  pointer-events: none;
}
.meta-info:hover .meta-tip,
.meta-info:focus .meta-tip { display: block; }
.meta #reset {
  margin-left: 0;
  color: #8A3A12; /* terracotta foncé — lisible sur le bar taupe */
  font-weight: 700;
}
.meta #reset:hover { color: #6B2A0C; }

/* ── board ────────────────────────────── */
.board {
  display: flex;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: flex-start;
  justify-content: center;
}
.board .grid { flex: 0 0 auto; }

/* classic crossword — airy: only word cells, sharp edges, no gap */
.grid {
  display: grid;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  width: fit-content; max-width: 100%;
  margin-inline: auto;
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid transparent;
  border-top-color: var(--text);
  border-left-color: var(--text);
  border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
  container-type: size;
  --shadow-r: 0 0 0 0 transparent;
  --shadow-b: 0 0 0 0 transparent;
  --shadow-c: 0 0 0 0 transparent;
  box-shadow: var(--shadow-r), var(--shadow-b), var(--shadow-c);
}
.cell.r-end { --shadow-r: 1px 0 0 0 var(--text); }
.cell.b-end { --shadow-b: 0 1px 0 0 var(--text); }
.cell.r-end.b-end { --shadow-c: 1px 1px 0 0 var(--text); }
.cell.block {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.cell .num {
  position: absolute; top: 4%; left: 8%;
  font-size: 28cqmin;
  color: var(--muted); font-weight: 700;
  font-family: var(--font-ui);
  pointer-events: none;
  line-height: 1;
}
.cell input {
  width: 100%; height: 100%;
  border: 0; background: transparent;
  text-align: center;
  font: 700 60cqmin / 1 var(--font-mono);
  color: var(--text);
  text-transform: uppercase;
  caret-color: transparent;
  border-radius: 0;
  outline: none;
  padding: 0;
  cursor: pointer;
}
.cell.highlight { background: var(--highlight); border-color: color-mix(in oklab, var(--highlight) 60%, var(--border-2)); }
.cell.active   { background: var(--active); border-color: color-mix(in oklab, var(--active) 50%, var(--text-soft)); }
.cell.correct input { color: var(--correct); }
.cell.wrong input { color: var(--wrong); }

/* clues */
.clues {
  display: flex; flex-direction: column; gap: 1.1rem;
  flex: 0 1 360px; min-width: 180px;
}
.clues h2 {
  font-family: var(--font-ui);
  font-size: .68rem; font-weight: 700;
  color: var(--muted);
  margin: 0 0 .3rem;
  text-transform: uppercase; letter-spacing: .1em;
}
.clues ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0;
  max-height: 55vh; overflow: auto;
  scrollbar-width: thin;
}
.clues li {
  padding: .3rem .55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem; line-height: 1.35;
  display: flex; gap: .5rem;
  border: 1px solid transparent;
  color: var(--text-soft);
  transition: background .12s, color .12s, border-color .12s;
}
.clues li:hover { background: var(--surface); color: var(--text); }
.clues li.active {
  background: var(--surface);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.clues li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--muted) 50%, transparent); }
.clues li b { color: var(--accent); font-weight: 700; min-width: 1.2rem; text-align: right; font-variant-numeric: tabular-nums; font-size: .8rem; }

/* ── SEO content card ─────────────────── */
.seo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: var(--shadow);
  max-width: 75ch;
  margin-inline: auto;
}
.seo h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin: 0 0 .5rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.seo .lede { color: var(--text-soft); margin: 0 0 1.75rem; font-size: 1.05rem; max-width: 60ch; }
.seo h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.18rem;
  margin: 1.75rem 0 .5rem;
  letter-spacing: -.01em;
  color: var(--text);
}
.seo p { color: var(--text-soft); margin: .4rem 0; }
.seo strong { color: var(--text); font-weight: 600; }

.seo details {
  border-top: 1px solid var(--border);
  padding: .9rem 0;
}
.seo details:last-of-type { border-bottom: 1px solid var(--border); }
.seo details summary {
  cursor: pointer; list-style: none;
  font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.seo details summary::-webkit-details-marker { display: none; }
.seo details summary::after {
  content: "+"; color: var(--muted); font-size: 1.2em; font-weight: 400; line-height: 1;
}
.seo details[open] summary::after { content: "−"; }
.seo details p { margin-top: .55rem; color: var(--text-soft); }

/* ── footer ───────────────────────────── */
.foot {
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  color: var(--muted); font-size: .85rem;
}
.foot a { color: var(--text-soft); margin: 0 .25rem; text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ── bouton PWA "Installer" (apparaît seulement quand Chrome le propose) ── */
#pwa-install-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  right: 1rem;
  z-index: 60;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius-pill);
  padding: .75rem 1.1rem;
  font: 600 .9rem/1 var(--font-ui);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
#pwa-install-btn:hover { background: var(--accent-2); transform: translateY(-1px); }
#pwa-install-btn:disabled { opacity: .6; cursor: wait; }
@media (max-width: 1024px) {
  /* sur mobile, le bandeau d'indices est en bas — on remonte au-dessus */
  #pwa-install-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.75rem);
  }
}

/* ── publicités (Google AdSense) ─────────────────────────
   Espace réservé pour éviter les sauts de layout (CLS):
   on fixe min-height côté conteneur ET côté <ins>. */
.ad-below-game {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;       /* réserve la place de la pub responsive */
  width: 100%;
  overflow: hidden;
}
.ad-below-game ins.adsbygoogle {
  display: block;
  min-height: 100px;
  width: 100%;
}

.ad-sidebar { display: none; }   /* masqué par défaut, activé sur grand écran */

/* .page-inner est toujours un flex-column — identique à .page avant le sidebar */
.page-inner {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  width: 100%;
}

@media (min-width: 1300px) {
  body { max-width: 1000px; }     /* reste cohérent avec la zone de jeu */

  .page {
    flex-direction: row;
    align-items: flex-start;
  }

  .page-inner {
    flex: 1;
    min-width: 0;
    width: auto; /* laisse flex: 1 gérer la largeur */
  }

  .ad-sidebar {
    display: block;
    flex: 0 0 300px;
    position: sticky;
    top: calc(3.5rem + 2.4rem + 1.5rem); /* bar + meta + marge */
    min-height: 600px;     /* réserve la place du wide skyscraper 300x600 */
    width: 300px;
  }
  .ad-sidebar ins.adsbygoogle {
    display: inline-block;
    width: 300px;
    height: 600px;
  }
  /* Cache le sidebar tant que la pub n'est pas effectivement remplie :
     - <ins> vide = AdSense pas encore chargé OU désactivé
     - data-ad-status="unfilled" = AdSense a tenté mais aucune pub servie
     Dans les 2 cas, on ne réserve pas la place vide → le contenu reste centré. */
  .ad-sidebar:has(> ins:not([data-adsbygoogle-status="done"])),
  .ad-sidebar:has(> ins[data-ad-status="unfilled"]) {
    display: none;
  }
}

/* Idem pour le slot sous-grille : invisible tant qu'aucune pub n'est servie */
.ad-below-game:has(> ins:not([data-adsbygoogle-status="done"])),
.ad-below-game:has(> ins[data-ad-status="unfilled"]) {
  min-height: 0;
  display: none;
}

/* ── dialog ───────────────────────────── */
.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 1.75rem; min-width: min(360px, 92vw);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
}
.dialog::backdrop { background: rgba(40,30,20,.45); backdrop-filter: blur(3px); }
.dialog h2 { font-family: var(--font-serif); margin: 0 0 .5rem; font-weight: 600; font-size: 1.4rem; }
.dialog form { margin-top: 1.25rem; display: flex; justify-content: flex-end; }

/* ── micro-motion ─────────────────────── */
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.cell.correct input { animation: pop .25s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── clue banner (mobile bottom strip) ─────── */
.clue-banner { display: none; } /* hidden on desktop */

/* nav buttons: override pill-shaped base button styles */
.cbn-nav {
  background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
  padding: 0;
  flex: 0 0 2.85rem; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 300; letter-spacing: 0;
  color: var(--text); opacity: .5;
  cursor: pointer;
  transition: opacity .12s;
  white-space: nowrap;
}
.cbn-nav:hover  { background: rgba(0,0,0,.07); opacity: 1; border-color: transparent; }
.cbn-nav:active { opacity: .25; transform: none; }
.cbn-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; }

/* ─────────────────────────────────────────────
   MOBILE — optimised single-screen game UX
   ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --cell-size: clamp(26px, 6vw, 44px); }

  /* ── bar: single line — 3 selects + lang flag + + button ── */
  .bar-inner {
    display: flex; align-items: stretch;
    height: 2.75rem;
  }
  .bar-group:first-child {
    display: flex; align-items: stretch;
    flex: 1; min-width: 0;
  }
  .bar-group:first-child .field {
    flex: 1; min-width: 0;
    padding: 0 .5rem;
  }
  /* no right border on last select field — lang divider handles it */
  .bar-group:first-child > label:last-of-type { border-right: 0; }

  /* language selector — compact flag-only display on mobile */
  .bar-right {
    display: flex; align-items: stretch;
    flex: 0 0 3.5rem; min-width: 0;
    border-left: 1px solid var(--bar-div);
    margin-left: 0;
  }
  .bar-right .field {
    flex: 1; min-width: 0; border-right: 0;
    padding: 0;
    justify-content: center;
    align-items: center;
  }
  .bar-right .field select {
    /* enlève la flèche dropdown (le "point") sur mobile */
    background-image: none;
    padding: 0;
    text-align: center;
    text-align-last: center;
    font-size: 1.15rem;          /* emoji drapeau en gros */
    line-height: 1;
    width: 100%;
  }

  /* hide micro-labels on mobile */
  .field > span { display: none; }

  /* compact ↺ button */
  .bar #new-game {
    flex: 0 0 2.75rem; padding: 0;
    font-size: 0; letter-spacing: 0;
  }
  .bar #new-game::after {
    content: "↺";
    font: 700 1.6rem/1 var(--font-ui);
    color: var(--surface);
  }

  /* game section height on mobile */
  .game { min-height: calc(100svh - 2.75rem - 2.4rem - 1.75rem); }

  /* ── bottom clue banner ── */
  .clue-banner {
    display: flex; align-items: stretch;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--bar-bg);
    border-top: 1.5px solid var(--bar-border);
    min-height: 3.25rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .cbn-nav:first-child { border-right: 1px solid var(--bar-div); }
  .cbn-nav:last-child  { border-left:  1px solid var(--bar-div); }
  .cbn-body {
    flex: 1; min-width: 0;
    display: flex; align-items: center;
    padding: .55rem .85rem;
    gap: .55rem;
  }
  .cbn-label {
    font: 700 1.15rem/1 var(--font-mono);
    color: var(--accent);
    flex-shrink: 0;       /* numéro garde sa taille */
    white-space: nowrap;
  }
  .cbn-text {
    font: 400 .92rem/1.25 var(--font-ui);
    color: var(--text);
    flex: 1; min-width: 0;
    /* wrap naturel jusqu'à 2 lignes, ellipsis ensuite */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
  }

  /* clue list hidden on mobile — banner is the primary clue UX */
  .clues { display: none; }

  /* extra bottom padding so content isn't hidden behind the banner */
  .page {
    padding: .85rem .85rem calc(3.25rem + env(safe-area-inset-bottom, 0px) + .75rem);
    gap: 1.25rem;
  }

  /* footer aussi : doit rester visible au-dessus du bandeau d'indices */
  .foot {
    padding-bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px) + 1.5rem);
  }

  .seo { padding: 1.5rem 1.25rem; border-radius: 14px; }
  .seo h1 { font-size: 1.55rem; }
  .seo h2 { font-size: 1.05rem; margin-top: 1.25rem; }
}
