/* Étagère à jeux : direction « Reliure » de l'Étagère, en boîtes (maquette validée par Olivier le 25/11/2026). Jetons : docs/DESIGN_BRIEF.md */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/polices/newsreader-latin.woff2") format("woff2"); }
:root {
  --encre: #15110e; --encre-2: #211a15; --encre-3: #2e251e;
  --papier: #f3e9d8; --papier-2: #cdbfa8; --papier-3: #a29079; --trait: #7f6d58;
  --or: #e5ae57; --sur-or: #1c140a; --rouge: #e7765b;
  --feuille: #efe4d0; --feuille-texte: #1c1510; --feuille-bande: #9b3a2c;
  --bois-1: #7a4f30; --bois-2: #4a2e1a; --bois-3: #2b1b10;
  --rayon: 10px; --serif: "Newsreader", Georgia, serif; --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--encre); color: var(--papier); font: 16px/1.5 var(--sans); }
body { min-height: 100dvh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
a { color: var(--or); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sr:focus { position: fixed; z-index: 50; width: auto; height: auto; clip-path: none; padding: 10px 16px; background: var(--papier); color: var(--encre); }
main { max-width: 1100px; margin: 0 auto; padding: 22px 18px 24px; }
main:focus { outline: 0; }
ul { list-style: none; margin: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--encre-3); margin: 18px 0 8px; }

.tete h1 { font: 600 2rem/1.1 var(--serif); margin: 0; }
.tete p { color: var(--papier-3); margin: 2px 0 0; }
h2 { font: 600 1.25rem/1.2 var(--serif); margin: 24px 0 10px; }
.etagere h2 { padding-bottom: 5px; border-bottom: 3px double #6b5228; }
.etagere h2 span { color: var(--papier-3); }
h2.petit { font: 600 .95rem var(--sans); color: var(--papier-2); margin: 22px 0 8px; }
.mois::first-letter { text-transform: uppercase; }
.aide, .sous, .meta { color: var(--papier-3); font-size: .9rem; margin: 8px 0 0; }
.centre { text-align: center; }
.vide { text-align: center; color: var(--papier-2); padding: 44px 12px; }
.vide strong { display: block; font: 600 1.35rem var(--serif); color: var(--papier); }

/* Champs, boutons, puces */
input:not([type="checkbox"]), select, textarea { background: var(--encre-2); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 10px 14px; width: 100%; min-height: 46px; min-width: 0; }
input::placeholder { color: var(--papier-3); opacity: 1; }
.champ { display: grid; gap: 5px; margin: 14px 0; align-content: start; }
.champ > span { font-size: .9rem; color: var(--papier-2); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ligne { display: flex; gap: 10px; margin: 12px 0; }
.case { display: flex; gap: 12px; align-items: center; min-height: 44px; margin: 10px 0; color: var(--papier-2); cursor: pointer; }
.case input { width: 22px; height: 22px; accent-color: var(--or); flex: none; }
.bouton { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 46px; border: 1px solid var(--papier); border-radius: var(--rayon); padding: 9px 18px; background: var(--papier); color: var(--sur-or); font-weight: 600; text-decoration: none; cursor: pointer; }
.bouton:hover { background: #fff8ea; }
.bouton.discret { background: transparent; color: var(--papier); border-color: var(--trait); }
.bouton.discret:hover { background: var(--encre-3); }
.bouton.or { background: var(--or); border-color: var(--or); color: var(--sur-or); }
.bouton.or:hover { background: #f1c172; }
.bouton.danger { background: transparent; color: var(--rouge); border-color: var(--rouge); }
.bouton:active, .puce:active { transform: translateY(1px); }
.bouton:disabled { opacity: .55; cursor: default; }
.large { width: 100%; margin-top: 22px; }
.rond { flex: none; width: 44px; height: 44px; border: 1px solid var(--trait); border-radius: var(--rayon); background: transparent; color: var(--papier-2); display: grid; place-items: center; cursor: pointer; }
.rond svg { width: 20px; height: 20px; }
.lien { display: inline-flex; align-items: center; min-height: 44px; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.puce { min-height: 44px; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 7px 13px; background: transparent; color: var(--papier-2); cursor: pointer; }
.puce:hover { background: var(--encre-3); }
.puce[aria-pressed="true"] { background: var(--papier); color: var(--sur-or); border-color: var(--papier); font-weight: 600; }
.outils { display: flex; gap: 10px; margin-top: 14px; }
.vues { display: flex; flex: none; }
.vues .puce:first-child { border-radius: var(--rayon) 0 0 var(--rayon); }
.vues .puce:last-child { border-radius: 0 var(--rayon) var(--rayon) 0; border-left: 0; }
.nombre { display: flex; gap: 7px; }
.nombre .puce { flex: 1; padding: 8px 0; font: 600 1.35rem var(--serif); }

/* La boîte : couvercle carré, tranche avec joueurs et durée */
.boite { --t: 30; position: relative; display: block; width: 100%; background: hsl(var(--t) 32% 20%); border-radius: 3px; box-shadow: 0 3px 8px #0008; }
.couv { display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 1; padding: 10px; overflow: hidden; border-radius: 3px 3px 0 0; border-bottom: 2px solid hsl(var(--t) 40% 14%); background: radial-gradient(circle at 75% 20%, hsl(var(--t) 50% 40%), hsl(var(--t) 48% 26%) 70%); }
.couv:has(img) { padding: 0; }
.couv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.couv b { font: 600 .95rem/1.12 var(--serif); letter-spacing: -.01em; color: #fff; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.couv i { font: 400 .75rem var(--sans); color: #fff; background: #0009; align-self: flex-start; padding: 1px 6px; border-radius: 3px; }
.infos { display: flex; justify-content: space-between; gap: 4px; padding: 5px 8px 6px; }
.infos em { font: 600 .78rem var(--sans); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.infos svg, .tranche svg { width: 11px; height: 14px; }
.boite:not(.grande) .couv i { display: none; } /* la planche porte déjà le genre */
.etiquette { position: absolute; right: -4px; top: 58%; max-width: 94%; background: var(--papier); color: var(--sur-or); font: 600 .75rem/1.3 var(--sans); padding: 3px 7px; border-radius: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etiquette.or { background: var(--or); }
.grande { width: 132px; flex: none; }
.grande .couv b { font-size: 1.3rem; }
.lien-boite { display: block; color: inherit; text-decoration: none; transition: transform .16s cubic-bezier(.2, .8, .3, 1); }
.lien-boite:hover { transform: translateY(-4px); }

/* Étagère : une planche sous chaque rangée */
.rangee { --ecart: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px var(--ecart); align-items: end; padding: 6px calc(var(--ecart) / 2) 8px; margin: 0 calc(var(--ecart) / -2); overflow: hidden; }
.rangee > li { min-width: 0; }
.planche { display: block; height: 9px; margin: 0 calc(var(--ecart, 14px) / -2); background: linear-gradient(var(--bois-1), var(--bois-2) 60%, var(--bois-3)); box-shadow: 0 5px 10px #0008; }
.rangee > li:last-child .planche { margin-right: -1200px; }
.pile { max-width: 620px; margin: 20px auto 0; }
.tranche { --t: 30; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--h, 46px); padding: 4px 14px; border-radius: 2px; color: #fff; text-decoration: none; background: linear-gradient(hsl(var(--t) 42% 33%), hsl(var(--t) 42% 22%)); border-bottom: 2px solid #0007; transition: transform .16s cubic-bezier(.2, .8, .3, 1); }
.tranche:hover { transform: translateX(8px); }
.tranche b { font: 600 1.1rem/1.15 var(--serif); min-width: 0; }
.tranche em { font: 500 .82rem var(--sans); display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }

/* Fiche */
.fiche { max-width: 720px; margin: 0 auto; }
.retour-ligne { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.retour { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; color: var(--papier-2); text-decoration: none; }
.retour svg { width: 20px; height: 20px; }
.ouverture { display: flex; gap: 18px; align-items: center; }
.ouverture > div { min-width: 0; }
.ouverture h1 { font: 600 clamp(1.6rem, 7vw, 2.5rem)/1.05 var(--serif); margin: 0; overflow-wrap: break-word; }
.genre { color: var(--or); font-size: .9rem; margin: 0 0 4px; }
.prete { color: var(--papier); }
.pions { display: flex; gap: 6px; }
.pions > span { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; border: 1px solid var(--encre-3); border-radius: 8px; color: var(--papier-3); }
.pions svg { width: 18px; height: 22px; }
.pions .oui { background: var(--encre-3); border-color: var(--papier-2); color: var(--papier); }
.pions .ext { border: 1px dashed var(--or); color: var(--or); }
.trois { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-block: 1px solid var(--encre-3); }
.trois div { padding: 10px 8px; border-left: 1px solid var(--encre-3); }
.trois div:first-child { border: 0; padding-left: 0; }
.trois b { display: block; font: 600 1.35rem var(--serif); }
.trois span { font-size: .82rem; color: var(--papier-3); }
.bts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.bts .bouton { flex: 1; }
.bts .plein { flex: 1.6; white-space: nowrap; }
.note { white-space: pre-line; padding: 12px 16px; background: var(--encre-2); border-radius: var(--rayon); color: var(--papier-2); }
.lignes li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; min-height: 46px; padding: 8px 0; border-bottom: 1px solid var(--encre-3); font-size: .95rem; }
.lignes li a { color: var(--papier); display: inline-flex; align-items: center; min-height: 44px; }
.lignes em { font-style: normal; color: var(--papier-3); margin-left: auto; }
.credit { margin-top: 28px; font-size: .82rem; color: var(--papier-3); }

/* Ajouter */
.resultats { margin-top: 6px; }
.resultats > li > .bouton { width: 100%; margin-top: 10px; }
.resultat { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 58px; padding: 8px 4px; background: transparent; border: 0; border-bottom: 1px solid var(--encre-3); text-align: left; cursor: pointer; }
.resultat:hover { background: var(--encre-2); }
.resultat b { display: block; font: 600 1.1rem/1.25 var(--serif); }
.resultat small { color: var(--papier-3); font-size: .85rem; }
.resultat em { flex: none; font: 600 .85rem var(--sans); color: var(--or); }

/* Ce soir */
.tire { display: grid; grid-template-columns: 132px 1fr; gap: 8px 16px; align-items: center; margin-top: 22px; padding: 16px; background: var(--encre-2); border-radius: 14px; animation: sort .26s cubic-bezier(.2, .9, .3, 1.15); }
.tire > p { grid-column: 1 / -1; margin: 0; color: var(--papier-2); }
.tire h2 { font-size: 1.65rem; margin: 0; overflow-wrap: break-word; }
.tire div p { margin: 4px 0 0; }
@keyframes sort { from { transform: translateY(16px); opacity: 0; } }

/* Parties */
.colonnes { display: grid; gap: 0 48px; }
.partie { display: flex; gap: 14px; align-items: center; width: 100%; min-height: 64px; padding: 6px 0; background: transparent; border: 0; text-align: left; cursor: pointer; }
.partie:hover { background: var(--encre-2); }
.partie > span:last-child { min-width: 0; }
.partie small { display: block; color: var(--papier-3); font-size: .9rem; }
.feuillet { flex: none; width: 48px; background: var(--feuille); color: var(--feuille-texte); border-radius: 4px; overflow: hidden; text-align: center; }
.feuillet i { display: block; background: var(--feuille-bande); color: var(--papier); font: 400 .78rem var(--sans); }
.feuillet b { font: 600 1.4rem/1.3 var(--serif); }
.mini { --t: 30; flex: none; width: 44px; height: 44px; border-radius: 3px; overflow: hidden; background: radial-gradient(circle at 75% 20%, hsl(var(--t) 50% 40%), hsl(var(--t) 48% 26%) 70%); border-bottom: 5px solid hsl(var(--t) 32% 20%); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.gagne li { display: grid; grid-template-columns: minmax(64px, 6.5em) 1fr auto 4.2em; gap: 10px; align-items: center; min-height: 34px; }
.gagne b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gagne i { display: block; height: 10px; width: calc(var(--p) * 100%); background: var(--papier-3); border-radius: 0 4px 4px 0; }
.gagne em { font-style: normal; font-weight: 600; }
.gagne small { color: var(--papier-3); font-size: .85rem; }
.participants li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--encre-3); }
.participants b { flex: 1 1 90px; min-width: 0; overflow-wrap: anywhere; }
.participants .score { width: 92px; flex: none; }

/* Plus */
.plus { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.plus .photo { display: grid; }
.plus .tete { margin-bottom: 8px; }
.sources p { margin: 4px 0 0; }

/* Ruban, bandeau, message, feuille */
.ruban { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--or); border-radius: var(--rayon); }
.ruban span { flex: 1 1 220px; }
.ruban .bouton { flex: 1 1 90px; min-height: 44px; }
.bandeau { position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 15; max-width: 640px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 12px 14px; background: var(--encre-3); border-radius: var(--rayon); box-shadow: 0 8px 24px #000a; font-size: .92rem; }
.bandeau span { flex: 1 1 180px; }
.bandeau a { display: inline-flex; align-items: center; min-height: 44px; }
.message { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); padding: 10px 18px; background: var(--papier); color: var(--sur-or); border-radius: var(--rayon); font-weight: 600; box-shadow: 0 8px 24px #000a; }
.message button { flex: none; min-height: 44px; border: 0; border-radius: 8px; padding: 0 14px; background: var(--encre); color: var(--papier); cursor: pointer; }
.voile { position: fixed; inset: 0; z-index: 25; background: #0009; }
.feuille { position: fixed; inset: auto 0 0; z-index: 30; max-width: 560px; max-height: 90dvh; margin: 0 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px calc(20px + env(safe-area-inset-bottom)); background: var(--encre-2); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px #000a; }
.feuille input:not([type="checkbox"]), .feuille select, .feuille textarea { background: var(--encre); }
.feuille-tete { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; background: var(--encre-2); }
.feuille-tete h2 { margin: 0; }
.feuille-corps .bouton, .feuille-corps .photo { width: 100%; margin-top: 10px; }
.feuille-corps .photo { display: block; }
.feuille-corps .photo .bouton { margin: 0; }

/* Barre du bas */
.bas { position: fixed; inset: auto 0 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0 max(0px, calc((100% - 600px) / 2)) env(safe-area-inset-bottom); background: var(--encre-2); border-top: 1px solid var(--encre-3); font-size: .8rem; text-align: center; }
.bas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 74px; border-top: 2px solid transparent; color: var(--papier-2); text-decoration: none; }
.bas a[aria-current] { color: var(--or); border-color: var(--or); }
.bas svg { width: 23px; height: 23px; }
.scan-bouton { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; align-self: center; height: 62px; margin: 0 2px; padding: 0; border: 0; border-radius: 16px; background: var(--or); color: var(--sur-or); font-weight: 600; box-shadow: 0 0 18px #e5ae5759; cursor: pointer; }

/* Scanner */
.scan { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: 1fr auto; background: #000; }
.scan > div:first-child { position: relative; overflow: hidden; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.viseur { position: absolute; inset: 34% 10% 42%; border: 2px solid var(--or); border-radius: 12px; box-shadow: 0 0 0 100vmax #0009; }
.scan.sans-camera video, .scan.sans-camera .viseur { display: none; }
.scan-fermer { position: absolute; z-index: 2; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: var(--encre); }
.scan-panneau { position: relative; width: 100%; max-width: 560px; margin: 0 auto; padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); background: var(--encre); border-radius: 16px 16px 0 0; }

/* Connexion, pages légales */
.connexion { min-height: calc(100dvh - 100px); display: grid; place-items: center; }
.connexion form { width: 100%; max-width: 360px; }
.connexion h1 { font: 600 2.6rem/1 var(--serif); margin: 0; }
.erreur { color: var(--rouge); min-height: 1.5em; margin: 0; }
.pied { text-align: center; font-size: .85rem; color: var(--papier-3); margin: 28px 0 8px; }
.pied a { color: var(--papier-2); display: inline-flex; align-items: center; min-height: 44px; }
.legal { max-width: 760px; }
.legal h1 { font: 600 2rem var(--serif); }
.legal p, .legal li { color: var(--papier-2); max-width: 70ch; }
.legal ul { list-style: disc; padding-left: 20px; }

@media (max-width: 559px) {
  .rangee { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .couv { padding: 8px; }
  .infos { padding: 5px 6px 6px; }
  .etiquette { font-size: .72rem; padding: 3px 5px; }
}
@media (max-width: 379px) {
  .rangee { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ouverture .grande, .tire .grande { width: 104px; }
  .tire { grid-template-columns: 104px 1fr; }
  .vues .puce { padding-inline: 9px; }
}
@media (min-width: 900px) {
  .colonnes { grid-template-columns: 1fr 1fr; }
  .tire { max-width: 640px; }
  .nombre { max-width: 560px; }
  .large { max-width: 320px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
