/* Thiercelieux — direction artistique « carnet du meneur dans la foret ».
   Encre de foret (vert-noir) + clair de lune + lanterne ambree. Les couleurs de camp portent du sens.
   Toujours sombre (on joue dans la penombre) : le jour passe a un brun de chaumiere, jamais au blanc. */
:root {
  --bg: #0e1a19;        /* encre de foret */
  --bg-deep: #08100f;
  --surface: #152321;   /* lichen sombre */
  --surface2: #1c2e2b;
  --line: #2a403c;
  --fg: #ebe6d6;        /* clair de lune */
  --muted: #9fb0aa;     /* brume */
  --accent: #e2a948;    /* lanterne */
  --accent-ink: #1a1206;
  --accent-soft: rgba(226, 169, 72, .14);
  --danger: #e07a6c; --danger-bg: #3b1f1f;
  --ok: #94c08c; --ok-bg: #1a3324;
  --warn: #e9bf6b; --warn-bg: #3a2f1a;
  --wolf: #d4695c;      /* sang seche */
  --village: #94c08c;   /* mousse */
  --solo: #b29ce0;      /* amethyste */
  --ambigu: #d9a35e;
  --display: "IM Fell English SC", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px; --r-s: 10px; --gut: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
body.is-day {
  --bg: #1b1712; --bg-deep: #120f0b; --surface: #252019; --surface2: #2f2920; --line: #463d30;
  --muted: #b6a993; --accent-soft: rgba(226, 169, 72, .16);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; color: var(--fg); font: 17px/1.55 var(--body); -webkit-text-size-adjust: 100%;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 70% -10%, rgba(235, 230, 214, .07), transparent 60%), linear-gradient(var(--bg), var(--bg-deep));
  background-attachment: fixed;
  transition: background-color .6s ease, color .6s ease;
}
#app { max-width: 720px; margin: 0 auto; padding: 0 var(--gut) calc(104px + env(safe-area-inset-bottom, 0px)); }
h1, h2 { font-family: var(--display); font-weight: 400; text-wrap: balance; letter-spacing: .01em; color: var(--fg); }
h1 { font-size: clamp(2.3rem, 7vw, 3.4rem); line-height: 1.02; margin: .15em 0; }
h2 { font-size: clamp(1.6rem, 4.6vw, 2.1rem); line-height: 1.08; margin: .35em 0 .25em; }
h3 { font-family: var(--display); font-weight: 400; font-size: 1.12rem; color: var(--accent); margin: 0 0 .5em; letter-spacing: .02em; }
h3 small { font-family: var(--body); color: var(--muted); font-size: .85rem; margin-left: .4em; }
p { margin: .45em 0; }
.lead { color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .url { word-break: break-all; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 50px; padding: 10px 20px; border-radius: var(--r-s); border: 1px solid var(--accent);
  background: linear-gradient(180deg, #ecb75a, var(--accent)); color: var(--accent-ink); font-weight: 700;
  text-align: center; text-decoration: none; letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 18px rgba(226, 169, 72, .18);
  transition: transform .12s ease, filter .2s ease, background-color .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn small { font-weight: 400; opacity: .85; font-size: .82rem; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); font-weight: 400; box-shadow: none; }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #1c0c0a; box-shadow: none; }
.btn.big { min-height: 60px; font-size: 1.12rem; width: 100%; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
a.btn { text-decoration: none; }
.ic { width: 42px; height: 42px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; font-size: 1.05rem; }
.ic:active { background: var(--surface2); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.linkbtn { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.bottom, .actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: center;
  padding: 18px var(--gut) calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, var(--bg) 38%);
}
.bottom .btn { flex: 1; max-width: 340px; }
.actions .btn { max-width: 688px; width: 100%; }

/* ---------- Barre « Précédent » ---------- */
.topnav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4; padding: 10px 0 6px; margin: 0 calc(-1 * var(--gut)); padding-inline: var(--gut); background: linear-gradient(var(--bg) 75%, transparent); }
.topnav .btn { min-height: 40px; }

/* ---------- Accueil ---------- */
.home { position: relative; padding-top: 4vh; }
.hero { position: relative; margin: 0 calc(50% - 50vw); height: min(46vh, 340px); overflow: hidden; }
.hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(transparent, var(--bg)); }
html, body { overflow-x: clip; }
.hero .glow { position: absolute; width: 120px; height: 120px; right: max(16%, calc(50% - 300px)); top: 14%; border-radius: 50%; background: radial-gradient(circle at 40% 38%, #fbf3dc, #e7cf98 55%, #b9965a); box-shadow: 0 0 90px 30px rgba(235, 220, 170, .18); }
.home .title { margin-top: -54px; position: relative; }
.home h1 { font-size: clamp(3rem, 12vw, 4.6rem); letter-spacing: .02em; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.home .lead { font-size: 1.05rem; }
.home .stack { max-width: 460px; }
.firsttime { margin-top: 22px; padding: 14px 16px; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-s) var(--r-s) 0; max-width: 460px; }
.firsttime p { margin: .2em 0; }
.moon { display: none; }

/* Liens secondaires de l'accueil : trois portes, chacune avec son embleme */
.homelinks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 26px; max-width: 560px; }
.hl { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-s); border: 1px solid var(--line); background: rgba(8, 16, 15, .55); color: var(--fg); text-decoration: none; text-align: left; font-weight: 700; }
.hl:hover { border-color: var(--accent); }
.hl .emb { width: 30px; height: 30px; color: var(--accent); flex: none; }
.hl span { display: flex; flex-direction: column; line-height: 1.2; }
.hl small { font-weight: 400; color: var(--muted); font-size: .82rem; }

/* Ecran « Rejoindre » : la rosace du dos des cartes accueille le joueur */
.joinpage { text-align: center; padding-top: 6vh; }
.joinpage .lead { margin-inline: auto; }
.joinmark .emb { width: 76px; height: 76px; color: var(--accent); opacity: .9; filter: drop-shadow(0 0 18px rgba(226, 169, 72, .25)); }

/* ---------- Pages de preparation ---------- */
.page { padding-top: 6px; }
.narrow { max-width: 480px; margin: 0 auto; }
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 6px 0 4px; font-size: .86rem; color: var(--muted); counter-reset: st; }
.stepper li { counter-increment: st; border-top: 2px solid var(--line); padding-top: 7px; }
.stepper li::before { content: counter(st) ". "; }
.stepper li.on { border-color: var(--accent); color: var(--fg); font-weight: 700; } .stepper li.done { border-color: var(--muted); }
.addrow { display: flex; gap: 8px; margin: 14px 0; }
.addrow input, textarea, select { flex: 1; min-width: 0; min-height: 50px; padding: 10px 14px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--bg-deep); color: var(--fg); font: inherit; }
.addrow input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.codein { text-transform: uppercase; letter-spacing: .32em; font-size: 1.6rem; text-align: center; font-family: var(--display); }
.plist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; background: var(--surface); border: 1px solid transparent; border-radius: var(--r-s); }
.plist .num { width: 26px; color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1.1rem; }
.plist .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; font-weight: 700; }
.plist .nm small { color: var(--ok); font-size: .76rem; font-weight: 400; }
.plist li.off .nm, .plist li.off .num { opacity: .5; } .plist li.off .nm { text-decoration: line-through; font-weight: 400; }
.tog { min-width: 78px; min-height: 42px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: .92rem; color: var(--muted); }
.tog.on { background: var(--ok-bg); color: var(--ok); border-color: rgba(148, 192, 140, .55); font-weight: 700; }
.tog.gm { background: var(--accent-soft); color: var(--accent); border-color: rgba(226, 169, 72, .6); font-weight: 700; }
.plist li.gm { border-color: rgba(226, 169, 72, .35); } .plist li.gm .num { color: var(--accent); }
.gmblock { border-left: 2px solid var(--accent); }
.ic.gmon { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.count2 { margin: 12px 0; font-variant-numeric: tabular-nums; } .count2 b { font-family: var(--display); font-size: 1.4rem; font-weight: 400; color: var(--accent); }
.h3s { margin-top: 26px; }
.h2s { margin-top: 30px; }
.paste { margin-top: 14px; } .paste summary { cursor: pointer; color: var(--muted); padding: 8px 0; } .paste .btn { margin-top: 8px; }
.block { background: var(--surface); border: 1px solid rgba(255, 255, 255, .03); border-radius: var(--r); padding: 16px; margin: 14px 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-height: 46px; padding: 8px 12px; border-radius: var(--r-s); border: 1px solid var(--line); background: transparent; color: var(--fg); }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.totals { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 12px 0; font-variant-numeric: tabular-nums; }
.tot { padding: 7px 14px; border-radius: 999px; background: var(--surface2); }
.tot.over { background: var(--danger); color: #1c0c0a; font-weight: 700; }
.tot.under { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.tot.ok { background: var(--ok-bg); color: var(--ok); }
.modes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.mode { text-align: left; padding: 14px 16px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--bg-deep); display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--fg); position: relative; }
.mode b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.mode span { font-size: .92rem; color: var(--muted); }
.mode.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode.on::after { content: ""; position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dlist { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.dlist li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dlist select { flex: 0 1 60%; min-height: 42px; padding: 6px 34px 6px 10px; }
.okmark { color: var(--ok); font-size: .92rem; }
.warn { padding: 10px 14px; border-radius: var(--r-s); margin: 6px 0; font-size: .95rem; }
.warn.block { background: var(--danger-bg); color: var(--danger); border: 0; } .warn.warn { background: var(--surface2); }
.opts { display: grid; gap: 16px; }
.opt > span { display: block; margin-bottom: 6px; font-weight: 700; }
.toggle { display: flex; gap: 12px; align-items: flex-start; } .toggle input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.howto { padding-left: 1.3em; } .howto li { margin: 8px 0; } .howto li::marker { color: var(--accent); font-family: var(--display); }
.joinbox { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr { background: #f3ecdb; padding: 10px; border-radius: var(--r-s); line-height: 0; box-shadow: var(--shadow); } .qr:empty { display: none; }
.code { font-family: var(--display); font-size: 2.8rem; letter-spacing: .16em; margin: 0; color: var(--accent); line-height: 1.1; }
.preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin: 8px 0 4px; border-radius: var(--r-s); border: 1px dashed var(--accent); font-size: .92rem; }
.demotag { font-style: normal; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .78rem; }
.demohint { margin: 8px 0 0; padding: 9px 13px; border-radius: var(--r-s); background: var(--accent-soft); color: var(--accent); font-size: .95rem; }
.ctr { display: flex; align-items: center; gap: 6px; } .ctr b { width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1.35rem; font-weight: 400; }
.ctr.big b { font-size: 2rem; width: 54px; }

/* ---------- Emblemes et cartes de roles (l'element signature) ---------- */
.emb { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; }
.camp-loups { --campc: var(--wolf); } .camp-village { --campc: var(--village); } .camp-solo { --campc: var(--solo); } .camp-ambigu { --campc: var(--ambigu); }
.camps { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.camp { min-width: 0; }
.camp > h3 { color: var(--campc, var(--accent)); display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.camp > h3::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.rrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rrow .rico { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--campc); border: 1px solid color-mix(in srgb, var(--campc) 45%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--campc) 14%, transparent), transparent 70%); }
.rrow .rico .emb { width: 26px; height: 26px; }
.rrow:not(.has) .rico { opacity: .45; }
.rrow.has .rname { color: var(--fg); font-weight: 700; }
.rname { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; color: var(--muted); display: flex; flex-direction: column; }
.rname small { font-weight: 400; font-size: .8rem; color: var(--muted); }
.rname.full { width: 100%; color: var(--fg); border-bottom: 1px solid var(--line); padding: 10px 0; }

/* Carte : proportions de carte a jouer, double filet grave, embleme dans un medaillon a la couleur du camp. */
.rcard {
  --campc: var(--accent);
  position: relative; aspect-ratio: 63 / 88; width: 100%; border-radius: 12px; padding: 9%;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--campc) 16%, transparent), transparent 60%), linear-gradient(170deg, #1d2d2a, #101b1a 70%);
  border: 1px solid color-mix(in srgb, var(--campc) 55%, #000);
  box-shadow: 0 0 0 3px #0b1413, 0 0 0 4px color-mix(in srgb, var(--campc) 35%, transparent), var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; color: var(--fg);
}
.rcard::before { content: ""; position: absolute; inset: 6px; border: 1px solid color-mix(in srgb, var(--campc) 30%, transparent); border-radius: 8px; pointer-events: none; }
.rcard .medal { --emb-bg: #14221f; width: 80%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; color: var(--campc); border: 1px solid color-mix(in srgb, var(--campc) 50%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--campc) 18%, transparent), transparent 72%); margin-top: 6%; }
.rcard .medal .emb { width: 84%; height: 84%; }
.rcard .cname { font-family: var(--display); font-size: clamp(1rem, 4.4cqi, 1.6rem); line-height: 1.05; text-wrap: balance; }
.rcard .ccamp { font-size: .78rem; color: var(--campc); }
.rcard.loups { --campc: var(--wolf); } .rcard.village { --campc: var(--village); } .rcard.solo { --campc: var(--solo); } .rcard.ambigu { --campc: var(--ambigu); }
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px; }
.cardbtn { background: none; border: 0; padding: 0; text-align: inherit; container-type: inline-size; border-radius: 12px; transition: transform .18s ease; }
.cardbtn:hover .rcard { box-shadow: 0 0 0 3px #0b1413, 0 0 0 4px var(--campc), var(--shadow); }
.cardbtn:active { transform: scale(.98); }
.cardbtn.on .rcard { box-shadow: 0 0 0 3px #0b1413, 0 0 0 5px var(--accent), 0 0 30px rgba(226, 169, 72, .35); }
.cardbtn .rcard .cname { font-size: clamp(.95rem, 13cqi, 1.25rem); }
.fiche { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 20px; align-items: start; container-type: inline-size; }
.fiche .rcard .cname { font-size: 1.25rem; }
.fiche h2 { margin-top: 0; }
.fiche dl { margin: 0; } .fiche dt { font-family: var(--display); color: var(--accent); margin-top: 12px; font-size: 1.05rem; } .fiche dd { margin: 2px 0 0; }
@media (max-width: 520px) { .fiche { grid-template-columns: 1fr; } .fiche .cardcol { max-width: 170px; margin: 0 auto; } }

/* Retournement de carte a la revelation d'un mort */
.flip { perspective: 900px; width: 92px; flex: none; container-type: inline-size; }
.flip .inner { position: relative; transform-style: preserve-3d; animation: flipin .9s cubic-bezier(.3, .7, .2, 1) .15s both; }
.flip .face, .flip .back { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .back { position: absolute; inset: 0; transform: rotateY(180deg); }
.flip .back .rcard { --campc: var(--muted); }
.flip .rcard .cname { font-size: 13cqi; }
.flip .rcard .ccamp { display: none; }
@keyframes flipin { from { transform: rotateY(180deg); } to { transform: rotateY(0); } }

/* ---------- Partie ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0 8px; margin: 0 calc(-1 * var(--gut)); padding-inline: var(--gut); background: linear-gradient(var(--bg) 80%, transparent); }
.phase { display: flex; align-items: center; gap: 10px; min-width: 0; }
.phase .moonph { width: 30px; height: 30px; color: #e8ddb8; flex: none; filter: drop-shadow(0 0 8px rgba(232, 221, 184, .35)); }
body.is-day .phase .moonph { color: var(--accent); }
.phase > div { display: flex; flex-direction: column; min-width: 0; }
.phase b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1.05; }
.phase span { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.baract { display: flex; gap: 6px; }
.prog { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; } .prog i { display: block; height: 100%; background: var(--accent); transition: width .35s ease; box-shadow: 0 0 8px var(--accent); }
.step { padding-top: 10px; animation: stepin .28s ease both; }
@keyframes stepin { from { opacity: 0; transform: translateY(6px); } }
.steptitle { display: flex; align-items: center; gap: 12px; }
.steptitle .rico { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--campc, var(--accent)); border: 1px solid color-mix(in srgb, var(--campc, var(--accent)) 50%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--campc, var(--accent)) 16%, transparent), transparent 70%); }
.steptitle .rico .emb { width: 32px; height: 32px; }
.tag { display: inline-block; font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--muted); }
.script { position: relative; margin: 14px 0 18px; padding: 16px 18px 14px 20px; background: linear-gradient(90deg, var(--accent-soft), transparent 85%); border-left: 2px solid var(--accent); border-radius: 0 var(--r) var(--r) 0; font-size: 1.2rem; line-height: 1.5; }
.script .label { display: block; font-family: var(--display); font-size: .98rem; color: var(--accent); margin-bottom: 4px; }
.script p { margin: .2em 0; }
.who { font-size: 1.05rem; } .who.danger { color: var(--danger); font-weight: 700; }
.note { color: var(--muted); font-size: .94rem; } .note.strong { color: var(--fg); background: var(--surface2); padding: 10px 14px; border-radius: var(--r-s); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-deep); color: var(--fg); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; transition: background-color .15s ease, border-color .15s ease; }
.chip small { font-size: .72rem; color: var(--muted); }
.chip:not(:disabled):hover { border-color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; } .chip.on small { color: var(--accent-ink); }
.chip.danger.on { background: var(--danger); border-color: var(--danger); color: #1c0c0a; }
.chip.wolf.on { background: var(--wolf); border-color: var(--wolf); color: #1c0c0a; }
.chip.off { opacity: .5; } span.chip { cursor: default; }
.chip.ghost { background: transparent; }
.reveal { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--r); background: var(--surface2); margin: 12px 0; }
.reveal strong { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; }
.reveal em { font-style: normal; color: var(--muted); font-size: .94rem; }
.reveal.yes { background: var(--danger-bg); } .reveal.yes strong { color: var(--danger); }
.reveal.no { background: var(--ok-bg); } .reveal.no strong { color: var(--ok); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; color: var(--muted); margin-top: 6px; }
.fake { background: var(--surface); padding: 16px; border-radius: var(--r); border: 1px dashed var(--line); }
.count { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; } .count.ready { color: var(--ok); }
.dead { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px; margin: 10px 0; border-radius: var(--r); background: linear-gradient(100deg, var(--danger-bg), var(--surface) 80%); }
.dead > div:not(.flip) { display: flex; flex-direction: column; min-width: 0; flex: 1; } .dead small { color: var(--muted); }
.dead strong { font-family: var(--display); font-weight: 400; font-size: 1.5rem; }
.dead .field, .dead .note { flex-basis: 100%; }
.rolepill, .pill { padding: 4px 11px; border-radius: 999px; background: var(--surface2); font-size: .9rem; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sum { margin: 0; padding-left: 1.1em; }
.flash { color: var(--danger); font-weight: 700; padding: 10px 14px; background: var(--danger-bg); border-radius: var(--r-s); animation: shake .3s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.timer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px; background: var(--surface); border-radius: var(--r); }
#timer { font-family: var(--display); font-size: 3.2rem; line-height: 1; font-variant-numeric: tabular-nums; } #timer.over { color: var(--danger); }
.tally { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.tally li { position: relative; display: flex; justify-content: space-between; padding: 9px 12px; border-radius: var(--r-s); background: var(--bg-deep); overflow: hidden; }
.tally li span, .tally li b { position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.tally li i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--danger-bg); transition: width .3s ease; }

/* Registre du village (panneau lateral sur grand ecran) */
.gamegrid { display: block; }
.register { display: none; }
@media (min-width: 1000px) {
  #app.wide { max-width: 1120px; }
  .gamegrid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 34px; align-items: start; }
  .register { display: block; position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; background: var(--surface); border-radius: var(--r); padding: 16px; }
  .register h3 { display: flex; justify-content: space-between; }
  .actions .btn { max-width: 1052px; }
}
.reg { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.reg li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: .94rem; }
.reg li .rico { width: 26px; height: 26px; flex: none; display: grid; place-items: center; color: var(--campc, var(--muted)); }
.reg li .rico .emb { width: 20px; height: 20px; }
.reg li .n { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.reg li .r { color: var(--muted); font-size: .82rem; text-align: right; }
.reg li.gone .n { text-decoration: line-through; color: var(--muted); }
.reg li.gone { opacity: .65; }

/* ---------- Fiches, panneaux ---------- */
.ov { position: fixed; inset: 0; z-index: 10; background: rgba(4, 9, 8, .72); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; animation: fadein .2s ease both; }
.sheet { width: 100%; max-width: 680px; max-height: 90vh; overflow: auto; background: linear-gradient(var(--surface), var(--bg)); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 20px var(--gut) calc(20px + env(safe-area-inset-bottom, 0px)); animation: sheetup .28s cubic-bezier(.2, .8, .2, 1) both; box-shadow: 0 -20px 50px rgba(0, 0, 0, .5); }
@media (min-width: 760px) { .ov { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetup { from { transform: translateY(40px); opacity: 0; } }
.sheethead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vlist { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.vlist li { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: var(--surface); border-radius: var(--r-s); }
.vlist .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; } .vlist small { color: var(--muted); font-size: .8rem; font-weight: 400; }
.vlist select { flex: 0 1 46%; min-height: 42px; padding: 6px 30px 6px 10px; }
.vlist li.gone, .recap li.gone { opacity: .55; }
.plain { font-size: 1rem; color: var(--fg); font-weight: 400; }
.plain p { margin: .35em 0; }

/* ---------- Fin de partie ---------- */
.end h1 { margin-top: .5em; }
.recap { list-style: none; padding: 0; display: grid; gap: 6px; }
.recap li { display: grid; grid-template-columns: 30px 1fr 1.3fr auto; gap: 10px; padding: 9px 12px; background: var(--surface); border-radius: var(--r-s); align-items: center; }
.recap li .rico { color: var(--campc, var(--muted)); display: grid; place-items: center; } .recap li .rico .emb { width: 24px; height: 24px; }
.recap li.win { box-shadow: 0 0 0 1px var(--accent) inset; } .recap small { color: var(--muted); }
.log { font-size: .92rem; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); padding: 8px 0; }
.vote .chips { margin-top: 8px; }

/* ---------- Ecran joueur ---------- */
.pickgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 560px) { .pickgrid { grid-template-columns: repeat(4, 1fr); } }
/* Debutants : le nom d'abord, en gros et en gras, comme on le lit sur la carte physique */
.pickgrid .rcard { flex-direction: column-reverse; justify-content: space-between; padding: 8% 7%; }
.pickgrid .rcard .medal { width: 72%; margin: 0 0 4%; }
.pickgrid .rcard .cname { font-family: var(--body); font-weight: 700; font-size: clamp(.9rem, 13cqi, 1.15rem); line-height: 1.12; }
.pickgrid .rcard .ccamp { display: none; } /* debutants : seul le nom compte, exactement comme sur la carte */
.vote { background: var(--danger-bg); border-color: rgba(224, 122, 108, .35); }
.vote h3 { color: var(--danger); }
.tally .tright { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.tally .hand { width: 36px; height: 32px; font-size: .85rem; }

/* ---------- Tombee de la nuit (le seul mouvement orchestre) ---------- */
.nightfall { position: fixed; inset: 0; z-index: 20; pointer-events: none; background: radial-gradient(circle at 70% 30%, rgba(235, 228, 200, .14), transparent 30%), #050b0a; animation: night 1.9s ease forwards; display: grid; place-items: center; }
.nightfall .nm { font-family: var(--display); font-size: clamp(2rem, 8vw, 3.4rem); color: #e8ddb8; animation: nighttext 1.9s ease forwards; text-shadow: 0 0 30px rgba(232, 221, 184, .35); }
@keyframes night { 0% { opacity: 0; } 25% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes nighttext { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 480px) {
  .plist li { gap: 4px; padding-left: 8px; } .plist .num { width: 20px; } .plist .ic { width: 36px; height: 36px; font-size: .95rem; }
  .plist .tog { min-width: 62px; min-height: 36px; padding: 0 8px; font-size: .85rem; }
}
@media (max-width: 420px) {
  body { font-size: 16.5px; }
  .recap li { grid-template-columns: 26px 1fr 1fr; } .recap small { grid-column: 2 / -1; }
  .baract .btn.sm { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
  .nightfall { display: none; }
}

/* ---------- Accueil v1.7 : deux portes, joueur ou meneur ---------- */
.doorq { margin: 22px 0 10px; font-size: 1.3rem; }
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; }
.door { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 168px; padding: 18px 16px; border-radius: var(--r); border: 1.5px solid var(--line); background: rgba(8, 16, 15, .7); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.door .emb { width: 46px; height: 46px; color: var(--accent); }
.door b { font-family: var(--display); font-size: 1.7rem; font-weight: 400; line-height: 1.1; }
.door span { color: var(--muted); font-size: .92rem; line-height: 1.35; }
.door:first-child { border-color: var(--accent); background: linear-gradient(160deg, rgba(226, 169, 72, .16), rgba(8, 16, 15, .7) 70%); }
.door:hover, .door:focus-visible { border-color: var(--accent); }
.door:active { transform: scale(.98); }
@media (max-width: 360px) { .doors { grid-template-columns: 1fr; } .door { min-height: 0; } }
.joinform { display: grid; gap: 12px; margin: 18px auto 10px; max-width: 360px; }
.joinform .codein { min-height: 72px; font-size: 2.3rem; padding: 8px; border-radius: var(--r-s); border: 1.5px solid var(--accent); background: var(--bg-deep); color: var(--fg); width: 100%; }
.joinform .codein:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.give { margin: 12px 0; }
.give.wait { padding: 12px 14px; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-s) var(--r-s) 0; }
.okmsg { color: var(--ok); font-weight: 700; padding: 10px 14px; border: 1px solid var(--ok); border-radius: var(--r-s); }
.ver { margin-top: 18px; opacity: .6; }

/* v1.9 : vote sur telephone avec minuteur, corrections de carte, rappels de l'Ancien */
.linkbtn.fix { display: inline-block; margin-left: 6px; font-size: .9rem; min-height: 32px; }
.reveal .linkbtn.fix { margin-left: 0; align-self: flex-start; }
.note.ancien { border-left: 4px solid var(--accent); }
.tally .twho { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; }
.votebox .timer { padding: 0 0 12px; background: none; }
#vtimer, .vt { font-family: var(--display); font-variant-numeric: tabular-nums; }
#vtimer { font-size: 2.6rem; line-height: 1; }
#vtimer.over, .vt.over, .timer.extra #vtimer { color: var(--danger); }
.vote h3 .vt { float: right; font-size: 1.5rem; }
.vote.hurry { outline: 2px solid var(--danger); }
.vote .tally li b { position: relative; z-index: 1; }
.chip:disabled { opacity: .55; }
.vote.debate { outline: 0; } .vote.debate h3 { margin-bottom: 4px; }
