/* Polices hébergées sur le site (aucun appel à Google Fonts : pas de transfert d'IP, conforme RGPD).
   Bangers et Comic Neue sont sous licence SIL Open Font License. */
@font-face {
  font-family: 'Bangers';
  src: url('fonts/bangers-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Reenie Beanie';
  src: url('fonts/reenie-beanie-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Comic Neue';
  src: url('fonts/comic-neue-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Comic Neue';
  src: url('fonts/comic-neue-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #fff6e5;
  --night: #1b2f63;
  --night-glow: #2f51a3;
  --night-deep: #111f45;
  --snow-text: #f4f7ff;
  --panel: #ffffff;
  --ink: #1d1a24;
  --muted: #6b6475;
  --line: #e6dccb;
  --red: #e23b3b;
  --green: #2e9e6a;
  --blue: #3a7bd5;
  --yellow: #ffd23f;
  --cream: #fff1c9;
  --ok: #23865a;
  --ok-bg: #e2f5ea;
  --ko: #c9302c;
  --ko-bg: #fde7e6;
  --warn: #b86e00;
  --warn-bg: #fff0d4;
  --stroke: 3px;
  --shadow: 5px 5px 0 var(--ink);
  --comic: 'Bangers', 'Impact', 'Arial Black', sans-serif;
  --body: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Pages du jeu : nuit de Noël avec trame de points de BD. L'administration garde un fond papier clair. */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--night);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.07) 1.3px, transparent 1.8px),
    radial-gradient(ellipse at 50% 0%, var(--night-glow) 0%, var(--night) 50%, var(--night-deep) 100%);
  background-size: 16px 16px, 100% 100%;
  background-attachment: fixed;
  font: 17px/1.5 var(--body);
  padding-top: 26px;
}
body.admin {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(226, 59, 59, 0.1) 1.3px, transparent 1.8px);
  background-size: 16px 16px;
}

/* Neige qui tombe derrière le contenu */
body:not(.admin)::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20px 30px, #fff 1.6px, transparent 2.2px),
    radial-gradient(circle at 90px 100px, rgba(255, 255, 255, 0.8) 1.4px, transparent 2px),
    radial-gradient(circle at 60px 160px, #fff 2.4px, transparent 3px),
    radial-gradient(circle at 150px 40px, rgba(255, 255, 255, 0.9) 2px, transparent 2.6px),
    radial-gradient(circle at 220px 210px, #fff 3px, transparent 3.6px),
    radial-gradient(circle at 80px 260px, rgba(255, 255, 255, 0.85) 3.4px, transparent 4px);
  background-size: 120px 120px, 120px 120px, 200px 200px, 200px 200px, 300px 300px, 300px 300px;
  animation: snow 28s linear infinite;
}
@keyframes snow {
  to { background-position: 120px 600px, -120px 600px, 200px 600px, -200px 600px, 300px 600px, 0 600px; }
}

/* Guirlande lumineuse en haut de page */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  pointer-events: none;
  background:
    linear-gradient(#245c3b, #245c3b) 0 5px / 100% 3px no-repeat,
    radial-gradient(circle at 12px 17px, var(--red) 0 6px, transparent 7px) 0 0 / 96px 30px repeat-x,
    radial-gradient(circle at 36px 17px, var(--yellow) 0 6px, transparent 7px) 0 0 / 96px 30px repeat-x,
    radial-gradient(circle at 60px 17px, var(--green) 0 6px, transparent 7px) 0 0 / 96px 30px repeat-x,
    radial-gradient(circle at 84px 17px, var(--blue) 0 6px, transparent 7px) 0 0 / 96px 30px repeat-x;
}

a { color: var(--ink); text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 2px; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.6em; }
h3 { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1.2em; }

.page {
  position: relative;
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
/* Le plateau prend toute la largeur, les textes restent sur une colonne confortable. */
.page > .card, .page > .foot, .page > .back-link { width: 100%; max-width: 780px; align-self: center; }

/* ---------- En-tête ---------- */

.hero { position: relative; text-align: center; }

/* Gros « ? » dessiné : les règles toujours à portée, sans descendre en bas de page */
.help {
  position: absolute;
  top: -4px;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.help-q {
  display: block;
  width: 58px;
  height: 58px;
  /* Le « ? » est un dessin centré (la police BD penche et décale le caractère) */
  font-size: 0;
  color: transparent;
  background: url('noel/question.svg') center / 68% no-repeat, var(--yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(10deg);
  animation: wobble 4s ease-in-out infinite;
}
.help:hover .help-q { animation: none; transform: rotate(-8deg) scale(1.08); }
.help-label {
  padding: 0 8px;
  font-family: var(--comic);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  transform: rotate(-3deg);
}
@keyframes wobble {
  0%, 80%, 100% { transform: rotate(10deg); }
  85% { transform: rotate(-8deg); }
  90% { transform: rotate(14deg); }
  95% { transform: rotate(4deg); }
}

/* Écrans moyens (tablette, fenêtre réduite) : le titre descend sous le « ? » pour ne pas le toucher */
@media (min-width: 561px) and (max-width: 1100px) {
  .hero .title { margin-top: 56px; }
}

.rules-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rules-list li { display: flex; gap: 10px; align-items: flex-start; }
.r-icon { flex: none; font-size: 1.3rem; line-height: 1.2; }
.rules-more { margin: 14px 0 0; font-weight: 700; }
.shop {
  display: inline-block;
  margin: 0;
  /* Même étiquette que les titres des cartes (« Librairie de l'Hôtel de Ville » en bas de page) */
  padding: 3px 12px;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  transform: rotate(-1deg);
}
.title {
  margin: 14px 0 0;
  font-family: var(--comic);
  font-weight: 400;
  font-size: clamp(2.7rem, 11vw, 4.8rem);
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--red), 7px 7px 0 var(--ink);
}
.title::after { content: ' ★'; color: var(--yellow); }
.admin .title { color: var(--red); text-shadow: 4px 4px 0 var(--ink); }
.title a { color: inherit; text-decoration: none; }
.hero-small .title { font-size: clamp(2rem, 8vw, 2.6rem); }

/* Bulle de dialogue : coins bien arrondis, ombre comme les cadres, petite pointe nette en bas à gauche */
.hello, .bubble {
  position: relative;
  display: inline-block;
  margin: 18px 0 14px;
  padding: 7px 18px;
  font-weight: 700;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
}
/* La pointe : un triangle noir (le contour), recouvert d'un triangle blanc qui « ouvre » le bord de la bulle */
.hello::before, .bubble::before,
.hello::after, .bubble::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
}
.hello::before, .bubble::before {
  left: 22px;
  bottom: -15px;
  border-width: 15px 15px 0 0;
  border-top-color: var(--ink);
}
.hello::after, .bubble::after {
  left: 25px;
  bottom: -8px;
  border-width: 8px 8px 0 0;
  border-top-color: var(--panel);
}

/* ---------- Cases de BD (cartes), formulaires, boutons ---------- */

.card {
  position: relative;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 26px 22px 22px;
}
/* Neige posée sur le haut des cadres, et une branche de houx dans le coin */
.card::before, .board::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: -12px;
  left: -2px;
  right: -2px;
  height: 20px;
  padding: 0 14px;
  box-sizing: border-box;
  pointer-events: none;
  /* Un bout arrondi qui retombe sur chaque coin, et entre les deux un nombre entier de bosses (« round »),
     pour que la neige ne soit jamais coupée net */
  background:
    url('noel/neige-gauche.svg') left top / 14px 20px no-repeat border-box,
    url('noel/neige-droite.svg') right top / 14px 20px no-repeat border-box,
    url('noel/neige.svg') 0 0 / 64px 20px content-box;
  background-repeat: no-repeat, no-repeat, round no-repeat;
}
.card::after {
  content: '';
  position: absolute;
  z-index: 3;
  top: -20px;
  right: -16px;
  width: 58px;
  height: 44px;
  pointer-events: none;
  background: url('noel/houx.svg') center / contain no-repeat;
  transform: rotate(14deg);
}
.board { position: relative; }
.card > :last-child { margin-bottom: 0; }
.card h2 {
  display: inline-block;
  padding: 3px 12px;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  transform: rotate(-1deg);
}

.lead { font-size: 1.15rem; font-weight: 700; margin-top: 0; }
.when { color: var(--red); font-weight: 700; }
.hint { color: var(--muted); font-size: 0.92rem; }
.hint.warn { color: var(--warn); font-weight: 700; }

.form { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 400px; width: 100%; margin: 0 auto; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
}
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--red); }
input[type='checkbox'] { width: 20px; height: 20px; flex: none; margin-top: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--yellow);
}
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
textarea { resize: vertical; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.between { justify-content: space-between; align-items: center; }

.btn {
  display: inline-block;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: var(--yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 7px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-big { padding: 10px 28px; font-size: 1.55rem; }
.btn-ghost { background: var(--panel); }
.btn-danger { background: var(--panel); color: var(--ko); }

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--red);
  cursor: pointer;
}
.link.danger { color: var(--ko); }

.msg { margin: 4px 0; padding: 10px 14px; border-radius: 10px; border: 2px solid; font-weight: 700; }
.msg.error { color: var(--ko); background: var(--ko-bg); }
.msg.info, .msg.ok { color: var(--ok); background: var(--ok-bg); }
.msg.warn { color: var(--warn); background: var(--warn-bg); }

/* ---------- Plateau : un calendrier de l'Avent de petits cadeaux ---------- */

.board-wrap { position: relative; display: flex; flex-direction: column; gap: 18px; align-items: center; }

.board {
  --gap: 3px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: var(--gap);
  width: 100%;
  padding: var(--gap);
  background: var(--panel);
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: 8px 8px 0 var(--ink);
  transition: gap 1s, padding 1s;
}
.board.complete { --gap: 0px; }

.cell { position: relative; perspective: 700px; }
.flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1.2);
}
.cell.open .flip { transform: rotateY(180deg); }
.front, .back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 3px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
/* Le dos des cases : de petites illustrations de Noël sur fond pastel */
.front {
  --bg: #cfe6ff;
  --icon: url('noel/pere-noel.svg');
  background:
    var(--icon) center / auto 80% no-repeat,
    radial-gradient(rgba(29, 26, 36, 0.08) 1px, transparent 1.5px) 0 0 / 6px 6px,
    var(--bg);
  box-shadow: inset 0 0 0 1.5px rgba(29, 26, 36, 0.3);
}
.bg-1 .front { --bg: #d3f1dc; }
.bg-2 .front { --bg: #ffe8a6; }
.bg-3 .front { --bg: #ffd9d6; }
.deco-1 .front { --icon: url('noel/bonhomme-de-neige.svg'); }
.deco-2 .front { --icon: url('noel/sapin.svg'); }
.deco-3 .front { --icon: url('noel/renne.svg'); }
.deco-4 .front { --icon: url('noel/pain-d-epices.svg'); }
.deco-5 .front { --icon: url('noel/chaussette.svg'); }
.back { transform: rotateY(180deg); background: var(--ink); }
.back img { display: block; width: 100%; height: 100%; object-fit: cover; }
.board.complete .front, .board.complete .back { border-radius: 0; }

/* Les cadeaux du jour se trémoussent en attendant d'être ouverts */
.cell.pending { z-index: 1; }
.cell.pending .front {
  animation: wiggle 0.9s ease-in-out infinite;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.3), 0 0 0 2px #fff, 0 0 10px 3px var(--yellow);
}
.cell.pending:nth-child(odd) .front { animation-delay: -0.45s; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-7deg) scale(1.06); }
  75% { transform: rotate(7deg) scale(1.06); }
}

.reveal-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.btn-reveal:disabled { opacity: 1; background: var(--cream); box-shadow: none; border-style: dashed; }
.btn-reveal:not(:disabled) {
  color: #fff;
  background: var(--red);
  text-shadow: 2px 2px 0 var(--ink);
  animation: bounce 1.6s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.next { margin: 0; font-weight: 700; color: var(--snow-text); }

/* Onomatopée « TADAAM ! » */
.pow {
  position: absolute;
  top: 38%;
  left: 50%;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(5px 5px 0 var(--ink));
  animation: pow 1.6s ease-out forwards;
}
.pow span {
  display: block;
  padding: 46px 58px;
  font-family: var(--comic);
  font-size: clamp(2rem, 8vw, 3.4rem);
  white-space: nowrap;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  background: var(--yellow);
  clip-path: polygon(50% 0%, 60% 17%, 79% 6%, 77% 28%, 100% 30%, 85% 48%, 99% 68%, 76% 70%, 72% 95%, 54% 80%, 36% 99%, 30% 75%, 4% 80%, 16% 57%, 0% 38%, 22% 30%, 16% 6%, 38% 18%);
}
@keyframes pow {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-25deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.15) rotate(-8deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); }
  80% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.1) rotate(-6deg); opacity: 0; }
}

/* ---------- Propositions ---------- */

.counter { margin: 0 0 6px; font-weight: 700; }
.counter strong { color: var(--red); font-size: 1.3em; }
.wait-25 { margin: 0 0 10px; }
.wait-25 strong { color: var(--red); }
.dots { display: flex; gap: 6px; margin-bottom: 14px; }
.dots span {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 1.5px var(--ink);
}
.dots span::before { content: '★'; }
.dots span.used { color: var(--line); -webkit-text-stroke-color: #b8ad9c; }

.guess-form { display: flex; gap: 10px; margin-bottom: 14px; }
.guess-form input { flex: 1; min-width: 0; font-size: 1.05rem; }

.guess-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guess-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 9px 14px;
  background: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
}
.guess-list li.ok { background: var(--ok-bg); }
.guess-list li.ko { background: var(--ko-bg); }
.g-text { font-weight: 700; overflow-wrap: anywhere; }
.g-meta { color: var(--muted); font-size: 0.88rem; }
.guess-list li.ok .g-meta { color: var(--ok); font-weight: 700; }
.guess-list li.ko .g-meta { color: var(--ko); }

/* ---------- Écran du 25 (à partir de la révélation finale) ---------- */

/* Grands titres jaunes cernés de noir. Le contour est fait d'ombres et pas de -webkit-text-stroke,
   qui donnait l'impression de lettres coupées sur certains écrans. */
.kicker, .bye .big {
  margin: 0 0 8px;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--yellow);
  text-shadow:
    -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink),
    0 -1.5px 0 var(--ink), 0 1.5px 0 var(--ink), -1.5px 0 0 var(--ink), 1.5px 0 0 var(--ink), 3.5px 3.5px 0 var(--ink);
}

.solution { text-align: center; }
.solution strong { color: var(--red); }

/* Médaille et place du gagnant */
.rank-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0 10px;
  padding: 10px 22px 8px;
  background: var(--yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-3deg);
}
/* Au-delà du podium : badge blanc, sinon l'étoile jaune disparaît sur le fond jaune */
.rank-badge.far { background: var(--panel); }
.rank-medal { font-size: 2.6rem; line-height: 1; }
.rank-place {
  font-family: var(--comic);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  color: var(--red);
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 2px 2px 0 var(--ink);
}
.rank-text { font-size: 1.05rem; }
.voucher {
  display: inline-block;
  padding: 6px 12px;
  font-weight: 700;
  background: var(--cream);
  border: 2.5px dashed var(--ink);
  border-radius: 10px;
}

/* Prix spécial décerné par la librairie */
.award {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 18px;
  text-align: left;
  font-weight: 700;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(2deg);
}
.award-icon { font-size: 2.2rem; line-height: 1; }
.award-title { font-family: var(--comic); font-weight: 400; font-size: 1.3rem; letter-spacing: 0.04em; color: var(--blue); }
select.has-award { background: var(--yellow); font-weight: 700; }
.award-note { display: block; width: 100%; min-width: 200px; margin-top: 6px; font-size: 0.85rem; }
.award-note[hidden], .award-save[hidden] { display: none; }
.award-save { margin-top: 6px; }
.award-text { min-width: 0; }
@media (max-width: 400px) {
  .award { gap: 8px; padding: 10px 12px; }
  .award-icon { font-size: 1.6rem; }
}
.award-msg { display: block; margin: 4px 0 0; font-weight: 400; white-space: pre-line; }

/* Les plus rapides */
.podium { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.podium li {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  align-items: center;
  gap: 0 8px;
  padding: 6px 10px;
  font-weight: 700;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
}
.podium .pos { font-family: var(--comic); font-weight: 400; font-size: 1.25rem; line-height: 1; text-align: center; }
.podium .who { overflow-wrap: anywhere; }
.podium .when { font-size: 0.85rem; font-weight: 400; color: var(--muted); text-align: right; white-space: nowrap; }
.podium li.top { background: var(--cream); }
.podium li.top .pos { font-size: 1.6rem; }
.podium li.me { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); transform: rotate(-1deg); }
.podium li.me .when { color: var(--ink); }
.podium .you { margin-left: 6px; padding: 0 7px; font-size: 0.75rem; color: #fff; background: var(--red); border: 2px solid var(--ink); border-radius: 999px; }
.podium-more { margin: 10px 0 0; font-weight: 700; text-align: center; }

/* L'image mystère entière et « Pourquoi cette photo ? » */
.page > .card.final-image { max-width: 1000px; }
.reveal-answer { margin: 4px 0 14px; font-size: 1.1rem; text-align: center; }
.reveal-answer strong {
  display: block;
  margin-top: 2px;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 2.3rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--red);
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 2.5px 2.5px 0 var(--ink);
}
.reveal-grid { display: grid; gap: 18px; }
/* Simple texte (sans cadre ni fond), entre la réponse et l'image */
.why h3 { margin: 0 0 6px; font-family: var(--comic); font-weight: 400; font-size: 1.35rem; letter-spacing: 0.04em; text-transform: none; color: var(--blue); }
.why p { margin: 0 0 8px; white-space: pre-line; }
.why p:last-child { margin: 0; }
.reveal-grid .why { order: -1; }
/* L'affiche du jeu (fenêtre des règles et écran du 25) */
.poster { display: block; }
.poster img { display: block; width: 100%; height: auto; border: var(--stroke) solid var(--ink); border-radius: 10px; box-shadow: 4px 4px 0 var(--ink); }
.rules-poster { width: min(100%, 260px); margin: 16px auto 4px; }
.final-poster { width: min(100%, 340px); margin: 0 auto; }
/* Sur ordinateur, l'affiche est à côté de l'image ; le texte reste au-dessus, sur toute la largeur */
@media (min-width: 700px) {
  .reveal-grid { grid-template-columns: 1.5fr 1fr; align-items: start; }
  .reveal-grid .why { grid-column: 1 / -1; }
  .final-poster { width: 100%; margin: 0; }
}

/* Le mot de la fin */
.bye { text-align: center; }
.bye p { font-size: 1.05rem; }
.bye .see-you { margin: 14px 0 0; font-family: 'Reenie Beanie', var(--body); font-size: 1.9rem; line-height: 1; color: var(--red); transform: rotate(-3deg); }

/* Résumé des questions de l'année */
.recap { width: 100%; margin-top: 6px; border-collapse: separate; border-spacing: 0; border: 2.5px solid var(--ink); border-radius: 12px; overflow: hidden; font-size: 0.95rem; }
.recap th { padding: 6px 10px; text-align: left; font-family: var(--comic); font-weight: 400; font-size: 1.05rem; letter-spacing: 0.05em; color: #fff; background: var(--ink); }
.recap td { padding: 7px 10px; vertical-align: top; border-top: 1.5px solid var(--line); }
.recap tbody tr:nth-child(even) td { background: #fbf6ec; }
.recap td.d { white-space: nowrap; font-family: var(--comic); font-size: 1.1rem; letter-spacing: 0.03em; color: var(--red); }
.recap td.a { font-weight: 700; color: var(--ok); }
.recap-more { display: block; margin: 10px auto 0; font-weight: 700; }
/* Sur téléphone, chaque question devient une petite fiche (le jour à gauche, la réponse sous la question) */
@media (max-width: 560px) {
  .podium li { grid-template-columns: 2.2em 1fr; padding: 5px 10px; }
  .podium .pos { grid-row: span 2; }
  .podium .when { grid-column: 2; text-align: left; font-size: 0.8rem; }
  .kicker, .bye .big { font-size: 1.9rem; }
  .recap thead { display: none; }
  .recap, .recap tbody { display: block; }
  .recap tr { display: grid; grid-template-columns: 3.4em 1fr; column-gap: 8px; padding: 8px 10px; border-top: 1.5px solid var(--line); }
  .recap tr:first-child { border-top: 0; }
  .recap tr[hidden] { display: none; }
  .recap tbody tr:nth-child(even) { background: #fbf6ec; }
  .recap td { display: block; padding: 0; border: 0; background: none !important; }
  .recap td.d { grid-row: span 2; font-size: 1.05rem; }
  .recap td.a::before { content: '→ '; color: var(--muted); }
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  font-size: 0.9rem;
}
.foot { flex-direction: column; align-items: center; gap: 22px; }
.made-by { max-width: 460px; margin: 0; font-style: italic; text-align: center; color: var(--snow-text); }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.foot-links a, .foot-links .link, .back-link a { color: var(--snow-text); text-decoration-color: var(--yellow); }

/* Carte de visite de la librairie */
.shop-info { width: 100%; max-width: 460px; text-align: center; padding-top: 22px; }
.shop-info h2 { margin-bottom: 10px; }
.shop-info ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 1rem; font-weight: 700; }
.shop-info li::before { display: inline-block; width: 1.6em; }
.ci-address::before { content: '📍'; }
.ci-phone::before { content: '☎️'; }
.ci-email::before { content: '✉️'; }
.flag { display: block; width: 78px; height: 52px; filter: drop-shadow(3px 3px 0 var(--ink)); transform: rotate(-4deg); }
.counter .month { color: var(--red); text-decoration: underline wavy var(--red); text-underline-offset: 3px; }

/* Panneau du mode test, rayé comme un ruban de chantier pour ne pas l'oublier */
.test-panel {
  width: 100%;
  max-width: 780px;
  align-self: center;
  padding: 24px 18px 12px;
  background:
    repeating-linear-gradient(-45deg, var(--yellow) 0 12px, var(--ink) 12px 24px) top / 100% 10px no-repeat,
    var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.test-panel p { margin: 0 0 8px; }
.test-panel .hint { margin: 0; font-size: 0.82rem; }
.test-title { font-family: var(--comic); font-size: 1.3rem; letter-spacing: 0.04em; }
.test-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.test-row input { flex: 1 1 0; min-width: 0; padding: 6px 10px; }
.test-row .btn { flex: none; font-size: 1.05rem; padding: 4px 14px; box-shadow: 3px 3px 0 var(--ink); }
.test-row .btn-arrow { padding: 4px 12px; }

/* Fenêtre de confirmation en bulle de BD */
.modal {
  width: min(460px, calc(100% - 32px));
  padding: 26px 24px 22px;
  color: var(--ink);
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--ink);
  animation: popin 0.25s ease-out;
}
.modal::backdrop { background: rgba(17, 31, 69, 0.7); }
/* Barre de hauteur nulle et collante : la croix suit le défilement sans pousser le titre */
.modal-close-bar { position: sticky; top: 0; z-index: 2; height: 0; display: flex; justify-content: flex-end; }
.modal-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -14px -12px 0 0;
  padding: 0;
  font: 700 1.15rem/1 var(--body);
  color: var(--ink);
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.modal-close:hover { background: var(--yellow); }
.modal-close:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.modal h2:focus { outline: none; }
.modal h2 {
  display: inline-block;
  padding: 3px 12px;
  font-family: var(--comic);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--red);
  border: 2.5px solid var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
  transform: rotate(-2deg);
}
.modal-guess {
  margin: 6px 0 14px;
  text-align: center;
  font-family: var(--comic);
  font-size: 1.8rem;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  color: var(--blue);
}
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.btn-go { color: #fff; background: var(--green); text-shadow: 2px 2px 0 var(--ink); }
@keyframes popin {
  from { transform: scale(0.85) rotate(-3deg); opacity: 0; }
}

/* ---------- Pages texte ---------- */

.prose h1 { font-family: var(--comic); font-weight: 400; font-size: 2.2rem; letter-spacing: 0.03em; color: var(--red); }
.prose h2 { margin-top: 1.2em; }
.prose ul { padding-left: 1.2em; }
.prose code { background: var(--cream); padding: 1px 6px; border-radius: 4px; }
.back-link { margin: 0; text-align: center; font-weight: 700; }

/* ---------- Administration ---------- */

.admin-shell { position: relative; max-width: 1320px; margin: 0 auto; padding: 12px 16px 80px; }
.admin-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.admin-top .title { font-size: 2rem; margin-top: 8px; }
.admin-links { display: flex; gap: 16px; font-size: 0.95rem; font-weight: 700; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--panel); border: var(--stroke) solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); }
.tabs button {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 6px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.tabs button.active { background: var(--yellow); }
.tab { display: none; }
.tab.active { display: block; }

.status {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 18px;
  font-weight: 700;
  border: var(--stroke) solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
}
.status:empty { display: none; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.error { background: var(--ko-bg); color: var(--ko); }

#banner { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 10px 16px;
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
}
.kpis strong { font-size: 1.15em; color: var(--red); }
.kpi-phase { font-weight: 700; }

.planning { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .planning { grid-template-columns: 1fr; } }

.admin-board { touch-action: none; user-select: none; }
.acell { position: relative; overflow: hidden; cursor: crosshair; background: #c9bfae; border-radius: 2px; }
.acell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.acell.final img { filter: brightness(0.25) grayscale(0.7); }
.acell.scheduled img { filter: brightness(0.55) saturate(0.7); }
.acell::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.acell.revealed::before { box-shadow: inset 0 0 0 3px var(--green); }
.acell.forced::before { box-shadow: inset 0 0 0 3px #ff9d00; }
.acell.sel::before { box-shadow: inset 0 0 0 3px var(--yellow); background: rgba(255, 210, 63, 0.25); }
.acell.painting::before { background: rgba(255, 210, 63, 0.7); }
.acell .label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-family: var(--comic);
  color: var(--yellow);
  -webkit-text-stroke: 1px var(--ink);
  paint-order: stroke fill;
  font-size: clamp(9px, calc(32vw / var(--cols)), 20px);
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; font-size: 0.9rem; }
.lg { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; border-radius: 3px; }
.lg-revealed { background: #8fb8a0; box-shadow: inset 0 0 0 3px var(--green); }
.lg-scheduled { background: #8a8172; }
.lg-final { background: #2c2a30; }
.lg-forced { background: #8fb8a0; box-shadow: inset 0 0 0 3px #ff9d00; }

.planning-side h2 { margin-bottom: 4px; }
.planning-side .btn { font-size: 1.05rem; padding: 5px 14px; }
.modes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.modes label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
label.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 400; }
label.inline input { width: 80px; }
.summary { color: var(--muted); font-size: 0.92rem; margin-top: 14px; }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.15;
}
.day .d-w { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }
.day .d-n { font-family: var(--comic); font-size: 1.25rem; }
.day .d-c { font-size: 0.72rem; font-weight: 700; color: var(--red); }
.day.past { opacity: 0.5; }
.day.today { box-shadow: 0 0 0 3px var(--red); }
.day.active { background: var(--yellow); opacity: 1; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.settings { max-width: 820px; }
.settings h2 { margin: 14px 0 0; align-self: flex-start; }

.table-wrap { overflow-x: auto; }
table.players { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.players th, .players td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 2px solid var(--line); }
.players th { color: var(--muted); }
.players tr.found { background: var(--ok-bg); }
.players .rank { font-family: var(--comic); font-size: 1.3rem; color: var(--ok); }
.mini-guesses { margin: 0; padding-left: 18px; }
.mini-guesses li.ok { color: var(--ok); font-weight: 700; }
.mini-guesses small { color: var(--muted); font-weight: 400; }
.mini-guesses li + li { margin-top: 4px; }
.g-manual { display: inline-block; white-space: nowrap; margin-left: 6px; padding: 0 7px; font-size: 0.75rem; font-weight: 700; color: var(--warn); background: var(--warn-bg); border: 1.5px solid var(--warn); border-radius: 999px; }
.g-actions { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 0.82rem; font-weight: 400; }
.badge { margin-left: 8px; padding: 1px 8px; font-size: 0.78rem; font-weight: 700; color: var(--warn); background: var(--warn-bg); border: 1.5px solid var(--warn); border-radius: 999px; }

/* Téléphones : en-tête plus compact pour voir la grille sans défiler, boutons sur une ligne */
@media (max-width: 560px) {
  body { padding-top: 22px; }
  .page { gap: 24px; padding-top: 14px; }
  .shop { font-size: 1.25rem; }
  .title { margin-top: 10px; font-size: clamp(2rem, 9.4vw, 3rem); text-shadow: 3px 3px 0 var(--red), 5px 5px 0 var(--ink); }
  .hello { margin: 12px 0 10px; padding: 5px 14px; font-size: 0.95rem; }
  .card { padding: 22px 16px 16px; }
  .card::after { right: -8px; width: 46px; height: 36px; }
  .card h2 { font-size: 1.25rem; }
  .board { box-shadow: 5px 5px 0 var(--ink); border-width: 3px; }
  .btn-big { font-size: 1.3rem; padding: 9px 18px; }
  .guess-form { flex-direction: column; }
  .modal { padding: 22px 18px 18px; }
  .modal-actions .btn { flex: 1 1 auto; }
  .modal-guess { font-size: 1.5rem; }
  .pow span { padding: 34px 38px; font-size: 1.75rem; }
  .help {
    position: static;
    display: inline-flex;
    flex-direction: row;
    gap: 6px;
    margin: 12px 0 0 10px;
    vertical-align: middle;
  }
  .help-q { width: 46px; height: 46px; }
  .help-label { font-size: 0.9rem; }
  .hello { vertical-align: middle; }
}
/* Très petits téléphones : l'étiquette ne doit pas toucher le bouton musique en haut à gauche */
@media (max-width: 370px) {
  .shop { font-size: 1.05rem; padding: 2px 10px; }
}
/* Le houx et la neige débordent volontairement des cadres : on évite tout défilement horizontal. */
html, body { overflow-x: hidden; }
a, button, input, label { -webkit-tap-highlight-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .flip, .board, .btn { transition: none; }
  .cell.pending .front, .btn-reveal:not(:disabled), body:not(.admin)::after, .modal, .help-q { animation: none; }
  .pow { animation-duration: 0.01s; }
}

/* Statistiques : barre proportionnelle aux joueurs connectés */
.stats td { white-space: nowrap; }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.bar-n { width: 2.5em; text-align: right; font-weight: 700; }
.bar-track { flex: 1; height: 12px; background: var(--cream); border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--green); }
#stats-totals { margin-bottom: 14px; }

/* ---------- Questions du jour : calendrier de l'Avent ---------- */
.advent { display: flex; flex-direction: column; gap: 12px; }
.days-strip {
  /* Téléphone : les 24 jours d'un coup d'œil, en calendrier de 6 colonnes (rien ne défile) */
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px 8px;
  padding: 4px 2px; /* place pour le cadre rouge du jour choisi */
}
/* Grand écran : les 24 jours tiennent sur deux lignes */
@media (min-width: 700px) {
  .days-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
}
.todo-count { margin: 0; font-weight: 700; }
.dball {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 52px;
  padding: 0;
  font-family: var(--comic);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink);
  background: var(--panel);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.dball small { margin-top: 2px; font-family: var(--body); font-size: 0.62rem; font-weight: 700; }
.dball.todo { background: var(--yellow); }
.dball.todo small { color: var(--red); }
.dball.solved { background: var(--ok-bg); }
.dball.solved small { color: var(--ok); }
.dball.free { background: var(--cream); }
.dball.future { color: #a59e92; background: #ece7de; border-color: #bdb5a8; box-shadow: none; cursor: default; }
.dball.sel { outline: 3px solid var(--red); outline-offset: 2px; transform: translateY(-2px); }
/* Les jours à faire se dandinent sur grand écran ; sur téléphone, 20 cases qui bougent, c'est trop */
@media (min-width: 700px) {
  .dball.todo:not(.sel) { animation: wobble 4s ease-in-out infinite; }
}

.q-panel { display: flex; flex-direction: column; gap: 10px; }
.q-label {
  align-self: flex-start;
  padding: 1px 10px;
  font-family: var(--comic);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  transform: rotate(-1.5deg);
}
.q-text { margin: 0; font-size: 1.15rem; font-weight: 700; }
.hint-btn {
  align-self: flex-start;
  min-height: 40px;
  padding: 4px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: #fff7d6;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.hint-btn:active { transform: translate(2px, 2px); box-shadow: none; }
/* Sur ordinateur, le bouton d'indice se range à droite, sous la question */
@media (min-width: 700px) {
  .hint-btn { align-self: flex-end; }
}
.hint-bubble {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 4px 8px 12px;
  background: #fff7d6;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  animation: popin 0.2s ease-out;
}
.hint-bubble p { flex: 1; margin: 0; }
.hint-bubble p::before { content: '💡 '; }
/* Croix pour refermer l'indice, assez grande pour le pouce */
.hint-close {
  flex: none;
  width: 36px;
  height: 36px;
  margin: -6px 0 -6px;
  padding: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.hint-close:hover { background: rgba(0, 0, 0, 0.06); }
.answer-row { display: flex; gap: 8px; }
.answer-row input { flex: 1; min-width: 0; font-size: 1.05rem; }
.q-meta { margin: 0; font-size: 0.92rem; color: var(--muted); }
.q-meta.q-wrong { color: var(--ko); font-weight: 700; }
.q-ok { margin: 0; padding: 8px 12px; font-weight: 700; color: var(--ok); background: var(--ok-bg); border: 2.5px solid var(--ink); border-radius: 12px; }
.q-panel .link { align-self: flex-start; font-weight: 700; }
.shake { animation: shake 0.4s; border-color: var(--ko); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.btn-locked { background: var(--panel); border-style: dashed; }

@media (max-width: 560px) {
  .q-text { font-size: 1.05rem; }
  .dball { width: auto; height: 50px; font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dball.todo:not(.sel), .shake, .hint-bubble { animation: none; }
}

/* Admin : fiches des questions du jour */
.q-tools { align-items: flex-end; justify-content: space-between; }
.q-file { display: flex; gap: 10px; flex-wrap: wrap; }
.q-file .btn { font-size: 1.05rem; padding: 5px 14px; cursor: pointer; }
.q-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 22px; margin-top: 22px; }
.q-day { display: flex; flex-direction: column; gap: 10px; padding-top: 22px; }
.q-day::after { display: none; }
.q-day.has-q { background: #fbfff9; }
.q-day.dirty { box-shadow: 5px 5px 0 var(--red); }
.q-day-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.q-day-head strong { margin-right: auto; font-size: 1.05rem; }
.chip { padding: 1px 8px; font-size: 0.78rem; font-weight: 700; text-transform: none; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 999px; }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.q-try { display: flex; gap: 8px; align-items: center; }
.q-try input { flex: 1; min-width: 0; }
.q-try .btn { font-size: 1rem; padding: 4px 12px; box-shadow: 2px 2px 0 var(--ink); }
.q-try-result { min-width: 6.5em; font-weight: 700; font-size: 0.9rem; }
.q-try-result.ok { color: var(--ok); }
.q-try-result.ko { color: var(--ko); }
.q-day-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q-day-foot .btn { font-size: 1.05rem; padding: 5px 16px; }
#q-import-result ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }

/* ---------- Outils sous l'image : agrandir, montrer les nouvelles cases ---------- */
.board { cursor: zoom-in; }
.board.busy { cursor: default; }
.board-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.btn-small { padding: 4px 14px; font-size: 1.05rem; }

/* Les cases du dernier jour s'allument, les autres s'estompent */
.board.spotlight .cell { transition: opacity 0.3s; }
.board.spotlight .cell:not(.spot) { opacity: 0.3; }
.cell.spot { z-index: 2; }
.cell.spot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border: 3px solid var(--yellow);
  border-radius: 4px;
  box-shadow: 0 0 10px 3px var(--yellow);
  pointer-events: none;
  animation: spot 0.9s ease-in-out 3;
}
@keyframes spot {
  50% { box-shadow: 0 0 2px 0 var(--yellow); }
}

/* L'image en plein écran */
.zoom {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--night-deep);
}
.zoom[open] { display: flex; flex-direction: column; }
.zoom::backdrop { background: var(--night-deep); }
.zoom-view { flex: 1; display: flex; min-height: 0; overflow: auto; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
.zoom-grid {
  flex: none;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  margin: auto;
  user-select: none;
}
.zoom-grid img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.zoom-hidden { background: repeating-linear-gradient(45deg, #24396f 0 6px, #1f3264 6px 12px); outline: 1px solid rgba(255, 255, 255, 0.08); }
.zoom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--night);
  border-top: var(--stroke) solid var(--ink);
}
.zoom-bar .btn-arrow { width: 46px; padding: 4px 0; font-size: 1.5rem; }
.zoom-tip { flex: 1; font-size: 0.9rem; color: var(--snow-text); text-align: center; }

/* Mot d'accueil d'un joueur qui retrouve sa partie */
.welcome { padding-right: 48px; background: var(--ok-bg); }
.welcome p { margin: 0 0 6px; }
.welcome .close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: 0;
  cursor: pointer;
}

@media (max-width: 560px) {
  .zoom-tip { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.spot::after { animation: none; }
}

/* Bouton de la musique, en haut à gauche (en face du « ? ») ; sur téléphone, à côté des règles */
.music {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  font-size: 1.5rem;
  background: var(--panel);
  border: var(--stroke) solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.music-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
/* Musique coupée : la note est barrée */
.music:not(.on) .music-icon { opacity: 0.45; }
.music:not(.on)::after {
  content: '';
  position: absolute;
  width: 34px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  transform: rotate(-45deg);
}
.music.on { background: var(--yellow); }
.music.on .music-icon { animation: sway 1.2s ease-in-out infinite; }
.music.waiting { outline: 3px dashed var(--yellow); outline-offset: 3px; }
@keyframes sway {
  50% { transform: rotate(-12deg) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .music.on .music-icon { animation: none; }
}

/* Écran « Bientôt disponible » et rappel de l'aperçu réservé à l'admin */
.soon { text-align: center; }
.preview-banner {
  margin: 0;
  padding: 8px 14px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  border: 2.5px dashed var(--ink);
  border-radius: 12px;
}

/* Téléphone : la musique se range dans le coin en haut à gauche, et le bouton d'indice grandit pour le pouce
   (placé en fin de fichier pour passer après les styles de base de ces boutons) */
@media (max-width: 560px) {
  .music { top: -10px; left: -4px; width: 42px; height: 42px; font-size: 1.2rem; }
  .music:not(.on)::after { width: 28px; }
}

/* Admin : réponses du jour, joueur par joueur */
.a-days { margin: 14px 0 18px; }
.a-panel h3 { margin: 0 0 4px; }
.a-question { margin: 0 0 4px; font-size: 1.1rem; font-weight: 700; }
.a-panel .kpis { margin: 12px 0 6px; }
.a-tries { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.a-tries li { padding: 2px 10px; border: 1.5px solid currentColor; border-radius: 999px; font-size: 0.9rem; }
.a-tries li.ko { color: var(--ko); background: var(--ko-bg); }
.a-tries li.ok { color: var(--ok); background: var(--panel); font-weight: 700; }
.a-tries small { margin-left: 6px; color: var(--muted); font-weight: 400; }
.a-hint, .a-ok { white-space: nowrap; }
.a-ok { color: var(--ok); font-weight: 700; }
.a-ok small, .a-hint small { color: var(--muted); font-weight: 400; }
/* Sur téléphone, une fiche par joueur au lieu d'un tableau trop large */
@media (max-width: 560px) {
  .a-table thead { display: none; }
  .a-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 8px; border-bottom: 2px solid var(--line); }
  .a-table td { padding: 0; border: 0; }
  .a-table td:nth-child(-n+2) { grid-column: 1 / -1; }
  .a-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); }
  .a-table .a-ok br { display: none; }
  .a-table .a-ok small { margin-left: 6px; }
}

/* Admin : confirmation des suppressions (mot à taper) et sauvegardes */
.danger-modal h2 { margin-top: 0; color: var(--ko); }
.danger-modal label { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-weight: 700; }
.danger-modal .btn:disabled { opacity: 0.4; cursor: not-allowed; }
.backups { margin-top: 24px; max-width: 820px; }
.backup-actions { display: flex; gap: 14px; white-space: nowrap; }
