/* Style « jeu de société » : papier crème, contours à l'encre, ombres franches décalées */
/* Polices hébergées sur le site (licence SIL OFL) : pas d'attente de Google Fonts au premier affichage */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-700-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-weight: 700; font-display: swap; src: url(/fonts/fraunces-var-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-weight: 700; font-display: swap; src: url(/fonts/fraunces-var-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-weight: 900; font-display: swap; src: url(/fonts/fraunces-var-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-weight: 900; font-display: swap; src: url(/fonts/fraunces-var-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --paper: #f3ead7; --card: #fffaf0; --ink: #26201a; --muted: #75685a; --line: #dccfb5;
  --red: #d64933; --yellow: #f2b632; --blue: #2f6690; --green: #3f8f5a;
  --display: "Fraunces", Georgia, serif;
  --shadow: var(--ink); --dots: #e4d8bf; --done: #fdf0c8; --wrong: #ecd3c9; --input: #fff;
  --backdrop: rgba(38, 32, 26, .55); --on-yellow: #26201a;
}
/* Mode sombre : même jeu de société, posé sur une table la nuit */
[data-theme="dark"] {
  --paper: #1c1814; --card: #29231d; --ink: #efe4cf; --muted: #a39482; --line: #463d33;
  --red: #e4644c; --blue: #3a78a8;
  --shadow: #000; --dots: #29231d; --done: #3b311f; --wrong: #4b2b25; --input: #1c1814;
  --backdrop: rgba(0, 0, 0, .6);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  background: var(--paper) radial-gradient(var(--dots) 1px, transparent 1.2px) 0 0 / 18px 18px;
  color: var(--ink);
  display: flex; justify-content: center; align-items: flex-start;
}
#app { width: 100%; max-width: 1200px; padding: 16px; }
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
h1 { margin: 0 auto 0 0; font-family: var(--display); font-weight: 900; font-size: 36px; letter-spacing: -.5px; }
h1 .q { display: inline-block; color: var(--red); transform: rotate(12deg); margin-left: 4px; }
#hud { display: flex; align-items: stretch; font-size: 17px; background: var(--card); border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 3px 3px 0 var(--shadow); }
#hud > span { padding: 7px 14px; }
#hud > span + span { border-left: 2px solid var(--ink); }
#hud b { font-family: var(--display); font-size: 19px; }
.heart { font-style: normal; font-size: 18px; line-height: 1; }
.heart.lost { filter: grayscale(1); opacity: .3; } /* vie perdue : le même cœur, éteint */
#main { display: flex; gap: 16px; margin-top: 14px; }
canvas { width: 100%; max-width: 900px; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 5px 5px 0 var(--shadow); background: #7ec8f0; display: block; touch-action: manipulation; }
#log {
  flex: 1; min-width: 220px; max-height: 426px; overflow-y: auto; padding: 12px 14px;
  background: var(--card);
  border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--shadow);
}
#log h2 { margin: 0 0 8px; font-family: var(--display); font-size: 22px; }
#clues { margin: 0; padding-left: 22px; }
#clues li { margin-bottom: 10px; line-height: 1.4; font-size: 15px; animation: pop .3s ease; }
#clues li::marker { font-family: var(--display); font-weight: 900; color: var(--red); }
#clues i { color: var(--muted); }
#clues .said { display: block; }
#clues .empty { list-style: none; margin-left: -22px; color: var(--muted); font-style: italic; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
#controls { display: flex; gap: 14px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
button, a.button {
  display: inline-block; text-decoration: none;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; color: var(--ink);
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 8px; padding: 10px 18px;
  box-shadow: 3px 3px 0 var(--shadow); transition: transform .08s, box-shadow .08s;
  touch-action: manipulation; /* pas de zoom au double-tap sur téléphone */
}
@media (hover: hover) { button:hover:not(:disabled), a.button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); } }
button:active:not(:disabled), a.button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.tipeee-widget { margin: 4px 0 6px; }
.tipeee-widget iframe { max-width: 100%; border: 0; }
a.button.tipeee { margin: 4px 0 6px; background: var(--yellow); color: var(--on-yellow); font-size: 19px; padding: 12px 24px; }
.supporters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 18px; padding: 0; list-style: none; }
.supporters li { background: var(--done); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.support-hint { color: var(--muted); font-size: 15px; }
.support-hint a { color: var(--ink); font-weight: 700; }
button:disabled { opacity: .4; cursor: default; box-shadow: none; }
#btnNext { background: var(--blue); color: #fff; }
#btnGuess { background: var(--red); color: #fff; }
#potential { font-weight: 700; }
#flash { color: var(--red); font-weight: 700; }
#modal { position: fixed; inset: 0; z-index: 5; background: var(--backdrop); display: flex; align-items: center; justify-content: center; }
#modal.hidden { display: none; }
/* Présentation sous le jeu (règles, catégories, FAQ) : même carte que le panneau des indices */
#about { margin-top: 32px; padding: 18px 24px 8px; line-height: 1.55; background: var(--card);
  border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--shadow); }
#about h2 { margin: 22px 0 8px; font-family: var(--display); font-size: 24px; }
#about h2:first-child { margin-top: 4px; }
#about .cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; padding: 0; list-style: none; }
#about .cats li { background: var(--done); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; font-size: 15px; font-weight: 700; }
#about details { border-top: 2px solid var(--line); padding: 10px 0; margin: 0; font-size: 16px; }
#about summary { font-weight: 700; cursor: pointer; }
#about details p { margin: 8px 0 0; color: var(--muted); }
/* Pied de page : contact, mentions légales, confidentialité */
#about .legal { border-top: 2px solid var(--line); margin-top: 6px; padding: 12px 0 8px; text-align: center; font-size: 14px; color: var(--muted); }
#about .legal a { color: inherit; }
button.link { all: unset; cursor: pointer; text-decoration: underline; color: inherit; font: inherit; }
button.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.box.legal-text { text-align: left; }
.box.legal-text h3 { margin: 14px 0 4px; }
.box.legal-text p, .box.legal-text li { font-size: 15px; }
.box.legal-text a { color: inherit; font-weight: 700; }
.noscript { margin-top: 16px; font-weight: 700; color: var(--red); }
/* Bandeau réseau coupé : au-dessus de tout, même d'une fenêtre ouverte */
#offline { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; padding: 10px 14px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--shadow); }
#offline.hidden { display: none; }
.box {
  background: var(--card); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 7px 7px 0 var(--shadow);
  padding: 24px 28px; max-width: 480px; width: 92%; text-align: center; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
}
.box > button { margin-top: 6px; }
.box > button:not(.secondary) { background: var(--yellow); color: var(--on-yellow); } /* l'action principale de chaque fenêtre */
.box > button + button { margin-left: 10px; }
.box.wide { max-width: 760px; }
/* Petite croix de fermeture : reste dans le coin même quand on fait défiler la fenêtre */
.box > button.close-x { position: sticky; top: 0; float: right; z-index: 1; width: 40px; height: 40px; margin: -10px -14px 0 8px;
  padding: 0; font-size: 20px; line-height: 1; }
.box h2 { margin-top: 0; font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: -.3px; }
.box h3 { margin: 24px 0 10px; text-align: left; font-family: var(--display); font-size: 20px; }
.box h3 small { font-family: inherit; color: var(--muted); font-weight: 400; font-size: 15px; }
.box p { line-height: 1.5; }
.tools { display: flex; gap: 10px; }
#btnTheme, #btnEncyclo { padding: 10px 12px; line-height: 1; }
/* Encyclopédie */
.newfiche { background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; padding: 10px 14px; margin: 4px 0 8px; text-align: left; }
.newfiche small { display: block; font-weight: 700; color: var(--red); }
.newfiche p { margin: 6px 0 0; font-size: 15px; }
.fsearch { width: 100%; font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 8px; border: 2.5px solid var(--ink); background: var(--input); color: var(--ink); outline: none; }
.fsearch:focus { box-shadow: 3px 3px 0 var(--yellow); }
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; text-align: left; }
.fcard { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; box-shadow: 2px 2px 0 var(--shadow); line-height: 1.2; text-align: left; }
.fcard span { font-size: 22px; }
.fcard.locked { border: 2px dashed var(--line); border-radius: 8px; color: var(--muted); font-weight: 400; box-shadow: none; }
.fcard.locked span { opacity: .5; }
.fcard[hidden], .fcat[hidden] { display: none; }
.fiche-cat { color: var(--muted); font-weight: 700; margin-top: -6px; }
.fiche-bio { text-align: left; font-size: 17px; }
/* Menu d'accueil : posé sur la scène, un bouton par mode ; le compteur du haut attend qu'un mode soit choisi */
#stage { position: relative; width: 100%; max-width: 900px; }
#menu { display: none; position: absolute; inset: 0; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
  padding: 16px; border-radius: 10px; background: rgba(20, 16, 12, .35); }
#app.idle #menu { display: flex; }
#app.idle #hud, #app.idle #controls { visibility: hidden; }
#menu button { width: min(360px, 100%); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 18px; }
#menu button b { font-family: var(--display); font-size: 21px; }
#menu button small { font-weight: 400; font-size: 14px; color: var(--muted); }
#btnStart { background: var(--yellow); color: var(--on-yellow); }
#menu #btnStart small { color: inherit; opacity: .8; }
#btnDaily:not(.ready) { display: none; } /* tant que le numéro du défi n'est pas connu */
.daily-grid { font-size: 30px; letter-spacing: 3px; margin: 6px 0; }
/* Profil */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; padding: 12px 6px; }
.tile b { display: block; font-family: var(--display); font-size: 30px; }
.tile b small { font-size: 15px; color: var(--muted); }
.tile span { font-size: 13px; color: var(--muted); }
.discbar { height: 12px; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; margin-top: 10px; overflow: hidden; }
.discbar div { height: 100%; background: var(--yellow); }
.chart { position: relative; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .line { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--red); stroke: var(--card); stroke-width: 2; }
.chart .dot.lost { fill: var(--card); stroke: var(--red); }
.chart .dot.active { r: 6; }
.chart .cross { stroke: var(--ink); stroke-width: 1; opacity: .35; }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 700; }
#chartHit { touch-action: pan-y; } /* glisser le doigt le long de la courbe sans faire défiler */
.tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); background: var(--card); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 2px 2px 0 var(--shadow); padding: 6px 10px; font-size: 13px; line-height: 1.4; pointer-events: none; white-space: nowrap; }
.tip small { color: var(--muted); margin-left: 4px; }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
details { text-align: left; margin-top: 8px; font-size: 13px; }
details summary { cursor: pointer; color: var(--muted); }
details table { width: 100%; border-collapse: collapse; margin-top: 6px; }
details th, details td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; text-align: left; }
.ach { display: flex; flex-direction: column; gap: 2px; background: var(--paper); border: 2px dashed var(--line); border-radius: 8px; padding: 10px; opacity: .6; filter: grayscale(1); }
.ach.done { opacity: 1; filter: none; background: var(--done); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--shadow); }
.ach .icon { font-size: 26px; }
.ach b { font-size: 14px; }
.ach small { font-size: 12px; color: var(--muted); }
.ach .prog { height: 5px; background: var(--line); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.ach .prog div { height: 100%; background: var(--muted); }
#toasts { position: fixed; top: 16px; right: 16px; z-index: 10; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--card); border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--shadow); padding: 10px 16px; line-height: 1.4; animation: toastIn .35s ease; transition: opacity .5s, transform .5s; }
.toast small { color: var(--muted); }
.toast.out { opacity: 0; transform: translateX(30px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.choices button.wrong { background: var(--wrong); text-decoration: line-through; }
.big { font-size: 64px; margin: 8px 0; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.modes button { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 14px 8px; }
.modes b { font-family: var(--display); font-size: 21px; }
.modes small { font-weight: 400; color: var(--muted); font-size: 13px; }
.modes span { color: var(--red); }
.cash { display: flex; gap: 10px; margin: 16px 0 4px; }
.cash input { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 8px; border: 2.5px solid var(--ink); background: var(--input); color: var(--ink); outline: none; }
.cash input:focus { box-shadow: 3px 3px 0 var(--yellow); }
.cash button { background: var(--yellow); color: var(--on-yellow); }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.scorebar { position: relative; height: 26px; margin: 40px 4px 14px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 6px; }
.scorebar .fill { height: 100%; width: 0; border-radius: 3px; }
.scorebar .mark { position: absolute; top: -32px; transform: translateX(-50%); font-size: 20px; }
.scorebar .mark::after { content: ""; position: absolute; left: 50%; top: 30px; width: 2px; height: 28px; background: var(--ink); opacity: .35; }
.pop { display: inline-block; animation: medalPop .45s ease; }
@keyframes medalPop { 50% { transform: scale(1.5) rotate(-8deg); } }
.rating { border-top: 2px dashed var(--line); margin: 16px 0 14px; padding-top: 6px; }
.rating p { margin: 6px 0 10px; color: var(--muted); }
.rates { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rates button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; box-shadow: 2px 2px 0 var(--shadow); }
.rates button span { font-size: 24px; }
.rates button small { font-size: 11px; font-weight: 400; }
.rates button.selected { background: var(--yellow); color: var(--on-yellow); }
#rateComment { width: 100%; margin-top: 12px; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--ink); background: var(--input); color: var(--ink); }
.secondary { background: var(--card); }
kbd { border: 1.5px solid currentColor; border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: inherit; opacity: .8; margin-left: 4px; }
@media (max-width: 800px) { #main { flex-direction: column; } #log { max-height: 200px; } }
/* Téléphone : la scène, puis les boutons juste dessous, puis les indices ; tout à taille de doigt */
@media (max-width: 640px) {
  #app { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
  #main { display: contents; }
  #stage { order: 1; }
  canvas { box-shadow: 3px 3px 0 var(--shadow); }
  #menu { gap: 8px; padding: 10px; }
  #menu button { padding: 9px 14px; }
  #menu button b { font-size: 18px; }
  #menu button small { font-size: 12.5px; }
  #app.idle #controls, #app.idle #hud { display: none; }
  #controls { order: 2; margin-top: 4px; gap: 10px; align-items: stretch; }
  #log { order: 3; flex: none; min-width: 0; max-height: none; box-shadow: 3px 3px 0 var(--shadow); }
  #about { order: 4; margin-top: 18px; padding: 14px 16px 4px; box-shadow: 3px 3px 0 var(--shadow); }
  #about h2 { font-size: 21px; }
  .noscript { order: 5; }
  h1 { font-size: 26px; }
  .tools { gap: 8px; }
  .tools button { font-size: 14px; padding: 7px 10px; }
  #hud { order: 2; width: 100%; font-size: 14px; }
  #hud > span { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
  #hud > span { padding: 6px 9px; }
  #hud b { font-size: 16px; }
  #btnNext, #btnGuess { flex: 1 1 140px; padding: 14px 10px; }
  #potential, #flash { width: 100%; font-size: 14px; text-align: center; }
  /* En partie : tout tient dans l'écran, sans faire défiler la page. La scène, les indices juste dessous
     (la liste défile seule jusqu'au dernier), et les boutons en bas, sous le pouce */
  #app:not(.idle) { height: 100vh; height: var(--view-h, 100dvh); overflow: hidden; }
  #app:not(.idle) h1, #app:not(.idle) #btnSupport, #app:not(.idle) #about { display: none; }
  #app:not(.idle) #log { order: 2; flex: 1 1 0; min-height: 60px; overflow-y: auto; padding: 8px 12px; }
  #app:not(.idle) #log h2 { font-size: 17px; margin-bottom: 4px; }
  #app:not(.idle) #controls { order: 3; margin-top: 0; }
  #clues li { font-size: 14px; margin-bottom: 7px; }
  .box { padding: 20px 16px; width: 94%; box-shadow: 4px 4px 0 var(--shadow); }
  .box h2 { font-size: 26px; }
  .box > button { width: 100%; margin: 10px 0 0; }
  .box > button + button { margin-left: 0; }
  .modes { grid-template-columns: 1fr; }
  .modes button { flex-direction: row; justify-content: space-between; padding: 12px 14px; }
  .tiles, .achs { grid-template-columns: 1fr 1fr; }
  .legend { flex-wrap: wrap; gap: 4px 12px; }
  #rateComment { font-size: 16px; } /* sous 16 px, l'iPhone zoome quand on touche le champ */
  #toasts { left: 10px; right: 10px; top: 10px; }
  .big { font-size: 52px; }
}
/* Écran tactile : pas de clavier, donc pas de raccourcis affichés */
@media (hover: none) { kbd { display: none; } }
/* Salon entre amis (salon.js) */
#app:not(.salon) .salon-only { display: none; }
#app.salon #btnNext, #app.salon #btnGuess, #app.salon #lives { display: none; }
#salonForm { flex: 1 1 320px; margin: 0; }
/* Chrono et messages sur leur propre ligne, de hauteur fixe : en changeant de largeur chaque seconde, ils faisaient bouger les boutons */
#app.salon #potential, #app.salon #flash { flex: 1 0 100%; min-height: 1.4em; font-variant-numeric: tabular-nums; }
#app.salon #controls { row-gap: 6px; }
/* Salon au téléphone, façon messagerie : les joueurs en haut, la scène en bandeau (le chemin et les passants),
   les indices en bulles de conversation, le dernier juste au-dessus du champ de réponse */
@media (max-width: 640px) {
  #app.salon:not(.idle) { padding: 8px 10px; gap: 8px; }
  #app.salon:not(.idle) header { display: none; }
  #app.salon:not(.idle) .players { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #app.salon:not(.idle) .players li { flex: none; }
  /* Bandeau : la scène fait 420 × 320, on n'en montre que la bande de 145 à 305 (marge négative en % de la largeur) */
  #app.salon:not(.idle) #stage { flex: none; aspect-ratio: 420 / 160; overflow: hidden; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 3px 3px 0 var(--shadow); }
  #app.salon:not(.idle) canvas { margin-top: calc(-100% * 145 / 420); border: 0; border-radius: 0; box-shadow: none; }
  #app.salon:not(.idle) #log { min-height: 0; padding: 2px 4px 2px 2px; background: none; border: 0; box-shadow: none; display: flex; flex-direction: column; }
  #app.salon:not(.idle) #clues { margin-top: auto; } /* peu d'indices : collés en bas, près du champ, comme une conversation */
  #app.salon:not(.idle) #log h2 { display: none; }
  #app.salon:not(.idle) #clues { padding: 0; list-style: none; }
  #app.salon:not(.idle) #clues li { margin-bottom: 10px; }
  #app.salon:not(.idle) #clues .empty { margin-left: 0; }
  #app.salon:not(.idle) #clues .who { display: block; font-size: 13px; margin: 0 0 3px 6px; }
  #app.salon:not(.idle) #clues .said { display: inline-block; max-width: 92%; padding: 8px 12px; font-size: 16px; line-height: 1.35; font-style: normal; color: var(--ink);
    background: var(--card); border: 2px solid var(--ink); border-radius: 4px 16px 16px 16px; box-shadow: 2px 2px 0 var(--shadow); }
  #app.salon:not(.idle) #clues li:last-child .said { background: var(--yellow); color: var(--on-yellow); } /* le dernier arrivé */
  #app.salon:not(.idle) #potential, #app.salon:not(.idle) #flash { order: -1; } /* le chrono juste au-dessus du champ */
  #app.salon:not(.idle) #flash:empty { display: none; }
  #app.salon:not(.idle) #btnSalonShare, #app.salon:not(.idle) #btnSalonLeave { font-size: 14px; padding: 6px 10px; }
  /* Pendant la saisie, Inviter et Quitter laissent leur place */
  #app.salon.typing #btnSalonShare, #app.salon.typing #btnSalonLeave { display: none; }
}
#salonAnswer:disabled { opacity: .55; }
/* Classement du salon : une bande de pastilles au-dessus de la scène, du premier au dernier */
#salonPlayers { margin-top: 14px; }
.players { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; font-size: 15px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--shadow); }
.players li .name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players li b { font-family: var(--display); background: var(--paper); border-radius: 999px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.players li.found { border-color: var(--green); }
.players li.new, .lobby-players li.new { animation: pop .3s ease; } /* seulement le joueur qui arrive */
.players li.me { background: var(--done); }
.players li.away, .lobby-players li.away { opacity: .45; }
.salon-cat { margin: 4px 0 10px; }
.rounds-pick { display: flex; gap: 6px; }
.rounds-pick button { flex: 1; margin: 0; padding: 8px 0; }
.rounds-pick button.on { background: var(--yellow); color: var(--on-yellow); transform: translate(3px, 3px); box-shadow: none; }
.salon-cat-title { margin: 0 0 4px; font-weight: 700; }
.cat-drop { position: relative; text-align: left; }
.cat-drop summary { list-style: none; cursor: pointer; padding: 8px 34px 8px 12px; border: 3px solid var(--ink); border-radius: 12px; background: var(--input); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.cat-drop summary::-webkit-details-marker { display: none; }
.cat-drop summary::after { content: "▾"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.cat-drop[open] summary::after { content: "▴"; }
#salonCatList { border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 12px 12px; background: var(--input); max-height: 260px; overflow-y: auto; padding: 4px 0; }
.cat-drop[open] summary { border-radius: 12px 12px 0 0; }
#salonCatList label { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; }
#salonCatList label:hover { background: var(--done); }
#salonCatList small { color: var(--muted); margin-left: auto; }
.lobby-players small { color: var(--muted); }
.salon-form label { display: block; text-align: left; font-weight: 700; margin-bottom: 12px; }
.salon-form label input, .cash input#salonCode { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 18px; padding: 10px 12px;
  border-radius: 8px; border: 2.5px solid var(--ink); background: var(--input); color: var(--ink); }
.cash input#salonCode { margin-top: 0; text-transform: uppercase; letter-spacing: 2px; }
.cash input#salonCode::placeholder { text-transform: none; letter-spacing: 0; }
.cash button.secondary { background: var(--card); color: var(--ink); }
.salon-form > button { background: var(--yellow); color: var(--on-yellow); }
.salon-or { color: var(--muted); margin: 16px 0 0; }
.salon-code, .salon-code-inline { font-family: var(--display); font-weight: 900; letter-spacing: 6px; }
.salon-code { font-size: 48px; margin: 4px 0 10px; }
.lobby-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 0 0 8px; padding: 0; }
.lobby-players li { background: var(--done); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.salon-name { font-family: var(--display); font-weight: 900; font-size: 32px; line-height: 1.1; margin: 0 0 12px; }
.salon-name small { display: block; font-family: "Atkinson Hyperlegible", sans-serif; font-weight: 400; font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.salon-last { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; padding: 10px 14px; text-align: left;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; }
.salon-last > span { font-size: 48px; line-height: 1; }
.salon-last small { display: block; color: var(--muted); font-size: 14px; }
.salon-last b { font-family: var(--display); font-weight: 900; font-size: 26px; line-height: 1.15; }
.salon-results { list-style: none; padding: 0; margin: 8px 0; text-align: left; }
.salon-results li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.podium { list-style: none; padding: 0; margin: 8px 0 14px; text-align: left; }
.podium li { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 18px; border-bottom: 2px solid var(--line); }
.podium li:first-child { font-size: 22px; font-weight: 700; }
.podium li.me { background: var(--done); border-radius: 6px; }
.box details { text-align: left; margin: 0 0 12px; }
.box details summary { cursor: pointer; font-weight: 700; }
@media (max-width: 640px) {
  #salonForm { flex-basis: 100%; }
  #salonPlayers { order: 1; margin-top: 0; }
  .players { gap: 6px; }
  .players li { font-size: 14px; padding: 3px 5px 3px 10px; }
  #salonAnswer, .salon-form label input, .cash input#salonCode { font-size: 16px; } /* sous 16 px, l'iPhone zoome */
  #btnSalonShare, #btnSalonLeave { flex: 1; }
  .salon-code { font-size: 40px; }
  .salon-name { font-size: 27px; }
  .salon-last b { font-size: 22px; }
}
