/* Carnet du jeu — journal d'un jeu de famille aux personnages « haricot ».
   Mise en page : une colonne de lecture étroite ; le guide ajoute un sommaire à gauche. */
:root {
  --fond: #eef1f9;        /* le gris-bleu des fonds de rendu des minis */
  --surface: #ffffff;
  --encre: #1c2140;
  --doux: #5a6283;
  --trait: #d9deee;
  --orange: #f2622e;      /* couleur du haricot, accent principal */
  --orange-pale: #ffe6db;
  --bleu: #2f5fe0;
  --code-fond: #1c2140;
  --code-encre: #e9ecfa;
  --titre: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --texte: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --rayon: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #131729; --surface: #1d2238; --encre: #edf0fb; --doux: #a3abc9; --trait: #2f3654;
    --orange: #ff8a5b; --orange-pale: #3a2620; --bleu: #8aa6ff; --code-fond: #0c0f1d; --code-encre: #e9ecfa;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #131729; --surface: #1d2238; --encre: #edf0fb; --doux: #a3abc9; --trait: #2f3654;
  --orange: #ff8a5b; --orange-pale: #3a2620; --bleu: #8aa6ff; --code-fond: #0c0f1d; --code-encre: #e9ecfa;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 18px/1.6 var(--texte);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--bleu); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: var(--titre); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; font-weight: 800; }
h3 { font-size: 1.25rem; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--orange-pale); padding: 0.1em 0.35em; border-radius: 6px; overflow-wrap: anywhere; }

/* ---- Barre du haut */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.barre { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--trait); }
.barre-int {
  max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.marque { display: flex; align-items: center; gap: 10px; font: 800 1.35rem/1 var(--titre); color: var(--encre); text-decoration: none; }
.haricot { width: 18px; height: 26px; border-radius: 9px; background: var(--orange); position: relative; transform: rotate(-8deg); }
.haricot::before, .haricot::after { content: ""; position: absolute; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--surface); }
.haricot::before { left: 4px; } .haricot::after { right: 4px; }
.menu { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.menu a, .menu .lien { padding: 6px 12px; border-radius: 999px; color: var(--encre); text-decoration: none; font-weight: 700; font-size: 0.95rem; }
.menu a:hover { background: var(--fond); }
.menu a[aria-current="page"] { background: var(--encre); color: var(--surface); }
.menu form { margin: 0; }

/* ---- Contenu */
.contenu {
  max-width: 1100px; margin: 0 auto;
  padding-block: 32px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.colonne { max-width: 68ch; margin: 0 auto; display: grid; gap: 20px; }
.colonne.large { max-width: 900px; }
.etiquette { font: 700 0.78rem/1.2 var(--texte); text-transform: uppercase; letter-spacing: 0.08em; color: var(--orange); margin: 0; }
.petit { font-size: 0.9rem; color: var(--doux); margin: 0; }
.message { max-width: 900px; margin: 0 auto 20px; padding: 12px 16px; border-radius: var(--rayon); background: var(--orange-pale); font-weight: 700; }
.alerte { margin: 0; padding: 12px 16px; border-radius: var(--rayon); background: var(--orange-pale); border-left: 4px solid var(--orange); }

.entete-liste { display: grid; gap: 10px; }
.entete-liste p { margin: 0; color: var(--doux); font-size: 1.1rem; max-width: 60ch; }

/* ---- Liste d'articles */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.carte {
  display: grid; grid-template-columns: 1fr; gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  color: var(--encre); text-decoration: none; transition: transform .15s ease, border-color .15s ease;
}
.carte:hover { transform: translateY(-2px); border-color: var(--orange); }
.vignette { width: 100%; aspect-ratio: 7 / 3; object-fit: cover; object-position: top; max-width: 100%; }
.carte-texte { display: grid; gap: 6px; padding: 18px 20px 20px; min-width: 0; }
.carte-titre { font: 800 1.45rem/1.2 var(--titre); }
.extrait { color: var(--doux); }
.compte { font-size: 0.88rem; font-weight: 700; color: var(--doux); }
.liste.guide { counter-reset: etape; }
.liste.guide .carte { grid-template-columns: 64px 1fr; align-items: center; }
.liste.guide .carte::before {
  counter-increment: etape; content: counter(etape);
  font: 800 2rem/1 var(--titre); color: var(--orange); text-align: center; align-self: stretch;
  display: grid; place-items: center; background: var(--orange-pale);
}

/* ---- Article */
.article-cadre { display: grid; gap: 32px; }
.article-cadre.avec-sommaire { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.sommaire { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); display: grid; gap: 10px; }
.sommaire ol { margin: 0; padding: 0 0 0 1.3em; display: grid; gap: 6px; font-size: 0.95rem; }
.sommaire a { color: var(--encre); text-decoration: none; }
.sommaire a[aria-current="page"] { color: var(--orange); font-weight: 700; }
.lecture { margin: 0; min-width: 0; }
.illustration { margin: 0; border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--trait); }
.texte { display: grid; gap: 16px; }
.texte > * { margin: 0; }
.texte h2 { margin-top: 16px; }
.texte ul, .texte ol { padding-left: 1.4em; display: grid; gap: 6px; }
.note { padding: 14px 18px; border-radius: var(--rayon); background: var(--orange-pale); font-weight: 700; }
.code { position: relative; background: var(--code-fond); border-radius: var(--rayon); }
.code pre { margin: 0; padding: 16px 18px; padding-right: 88px; overflow-x: auto; color: var(--code-encre); font: 0.9rem/1.6 var(--mono); }
.code code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.copier {
  position: absolute; top: 10px; right: 10px; border: 0; border-radius: 999px; padding: 4px 12px;
  background: var(--orange); color: #fff; font: 700 0.8rem/1.4 var(--texte); cursor: pointer;
}
.tableau { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--trait); }
th { font-weight: 700; color: var(--doux); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
td:first-child { font-weight: 700; white-space: nowrap; }
.suivant {
  display: grid; gap: 4px; padding: 16px 20px; border-radius: var(--rayon);
  background: var(--encre); color: var(--surface); text-decoration: none; font: 800 1.2rem/1.25 var(--titre);
}

/* ---- Commentaires */
.commentaires { display: grid; gap: 18px; margin-top: 24px; padding-top: 28px; border-top: 2px dashed var(--trait); }
.com { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
.avatar {
  width: 44px; height: 56px; border-radius: 22px; display: grid; place-items: center;
  background: hsl(var(--teinte) 75% 62%); color: #1c2140; font: 800 1.2rem/1 var(--titre);
}
.com-corps { background: var(--surface); border: 1px solid var(--trait); border-radius: 4px var(--rayon) var(--rayon) var(--rayon); padding: 10px 14px; }
.com-tete, .com-texte { margin: 0; }
.quand { color: var(--doux); font-size: 0.85rem; margin-left: 6px; }
.com-texte { overflow-wrap: anywhere; }
.com-action { margin: 4px 0 0; }

/* ---- Formulaires */
.formulaire { display: grid; gap: 8px; }
.formulaire label { font-weight: 700; margin-top: 6px; }
input, textarea, select {
  font: inherit; color: var(--encre); background: var(--surface);
  border: 2px solid var(--trait); border-radius: 10px; padding: 10px 12px; width: 100%; max-width: 100%;
}
textarea { resize: vertical; }
.formulaire .case { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.formulaire .case input { width: auto; }
.ligne { display: flex; flex-wrap: wrap; gap: 8px; }
.ligne input { flex: 1 1 200px; width: auto; }
.bouton {
  justify-self: start; border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  background: var(--orange); color: #fff; font: 800 1.05rem/1.2 var(--titre); text-decoration: none; display: inline-block;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--orange) 60%, #000);
}
.bouton:active { transform: translateY(2px); box-shadow: none; }
.bouton.secondaire { background: var(--encre); color: var(--surface); box-shadow: none; }
.lien { background: none; border: 0; padding: 0; color: var(--bleu); font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lien.danger { color: #c4321b; }
.zone-danger { margin-top: 8px; }

/* ---- Membres */
.fiche-acces { background: var(--surface); border: 2px solid var(--orange); border-radius: var(--rayon); padding: 18px 20px; display: grid; gap: 10px; }
.fiche-acces dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.fiche-acces dt { color: var(--doux); }
.fiche-acces dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.fiche-acces code { font-size: 1.05em; }
.membres .nombre { font-variant-numeric: tabular-nums; }
.membres .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.membres .actions form { margin: 0; }
.membres tr.inactif td { opacity: 0.5; }
.pastille { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; background: var(--encre); color: var(--surface); padding: 2px 8px; border-radius: 999px; vertical-align: middle; }

/* ---- Page de connexion */
.page-porte .contenu { min-height: 100%; display: grid; place-items: center; }
.porte { max-width: 460px; width: 100%; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; padding: 24px; }
.porte p { margin: 0; }
.porte-image { border-radius: var(--rayon); aspect-ratio: 7 / 4; object-fit: cover; object-position: center 20%; width: 100%; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .article-cadre.avec-sommaire { grid-template-columns: 1fr; }
  .sommaire { position: static; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 16px; }
  .liste.guide .carte { grid-template-columns: 48px 1fr; }
  .menu a, .menu .lien { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Planche « qui est qui » */
.qui-entete p { margin: 0; max-width: 70ch; }
.qui-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px 16px; }
.qui-barre label { font-weight: 700; }
.qui-barre input { flex: 1 1 200px; width: auto; }
.qui-compte { margin-left: auto; font-variant-numeric: tabular-nums; }
.qui-grille { list-style: none; margin: 24px auto 0; padding: 0; max-width: 1100px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.qui-carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; display: grid; scroll-margin-top: 90px; }
.qui-carte.rempli { border-color: color-mix(in srgb, var(--orange) 45%, var(--trait)); }
.qui-images { position: relative; display: grid; grid-template-columns: 3fr 4fr; background: var(--fond); }
.qui-images img { width: 100%; height: 100%; aspect-ratio: 3 / 4; object-fit: cover; max-width: 100%; }
.qui-images .qui-mini { object-fit: contain; aspect-ratio: auto; }
.qui-num { position: absolute; top: 8px; left: 8px; min-width: 36px; padding: 2px 10px; border-radius: 10px; background: var(--orange); color: #fff; font: 800 1.2rem/1.5 var(--titre); text-align: center; }
.qui-form { display: grid; gap: 10px; padding: 12px 14px 14px; }
.qui-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qui-champs label { display: grid; gap: 2px; font-size: 0.85rem; font-weight: 700; color: var(--doux); }
.qui-champs label.large { grid-column: 1 / -1; }
.qui-champs input { padding: 7px 10px; font-size: 1rem; }
.qui-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.petit-bouton { padding: 8px 18px; font-size: 0.95rem; }
.lien-partage code { font-size: 0.95rem; background: var(--fond); display: inline-block; padding: 6px 10px; }
.fiche-acces .ligne form { margin: 0; display: flex; align-items: center; }
.qui-noms {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4;
  max-width: 1100px; margin: 20px auto 0; padding: 12px 14px; display: grid; gap: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: 0 6px 18px -12px rgba(0,0,0,.35);
}
.puces { display: flex; flex-wrap: wrap; gap: 6px; max-height: 9.5rem; overflow-y: auto; }
.puce {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; cursor: grab;
  padding: 4px 12px; border-radius: 12px; border: 2px solid var(--orange); background: var(--orange-pale); color: var(--encre);
  font: 700 0.95rem/1.2 var(--texte); touch-action: manipulation;
}
.puce-date { font-weight: 400; font-size: 0.75rem; color: var(--doux); font-variant-numeric: tabular-nums; }
.puce.pris { opacity: 0.45; text-decoration: line-through; border-style: dashed; }
.puce.choisi { background: var(--orange); color: #fff; }
.puce.choisi .puce-date { color: #fff; }
.qui-carte.survol { outline: 3px dashed var(--orange); outline-offset: 2px; }
.qui-carte.a-enregistrer .bouton { animation: appel 1.2s ease-in-out 2; }
@keyframes appel { 50% { transform: scale(1.06); } }
@media (max-width: 760px) { .puces { max-height: 6.5rem; } }
body:has(.barre) .qui-noms { top: calc(env(safe-area-inset-top, 0px) + 58px); }
.qui-choix select { font: inherit; font-size: 1rem; color: var(--encre); background: var(--orange-pale); border: 2px solid var(--orange); border-radius: 10px; padding: 8px 10px; width: 100%; }
