/* style.css — Thème nuit / bois, mobile-first (complète Tailwind CSS) */
:root {
  --bg: #120e0b;
  --bg2: #1b140f;
  --panel: #241a13;
  --panel2: #30231a;
  --line: #4a3626;
  --text: #f0e6d4;
  --muted: #a8967c;
  --gold: #e0a84a;
  --gold-d: #b9822a;
  --blood: #b32a2e;
  --moon: #aebfda;
  --ok: #5fae6b;
  --r: 16px;
}
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.4;
  background: radial-gradient(120% 60% at 50% -10%, #2c1f15 0%, var(--bg) 60%) fixed;
  overscroll-behavior-y: contain;
}
h1, h2, h3, .serif { font-family: Georgia, 'Times New Roman', serif; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: linear-gradient(var(--bg) 70%, transparent);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.topbar h1 { margin: 0; font-size: 1.15rem; color: var(--gold); letter-spacing: .02em; }
.topbar .sub { font-size: .8rem; color: var(--muted); }
.content { padding: 4px 14px 210px; }

/* ---- Cartes et boutons ---- */
.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.card h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--gold); }
.muted { color: var(--muted); font-size: .88rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 1rem;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  width: 100%; cursor: pointer; user-select: none; touch-action: manipulation;
}
.btn:active { transform: scale(.98); filter: brightness(1.15); }
.btn[disabled], .btn.off { opacity: .4; pointer-events: none; }
.btn-gold { background: linear-gradient(var(--gold), var(--gold-d)); color: #1a1208; border-color: #f3c677; }
.btn-blood { background: linear-gradient(#c9353a, #8e1f23); border-color: #e0585c; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 44px; padding: 8px 12px; font-size: .92rem; width: auto; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

input[type=text], input[type=number], textarea, select {
  width: 100%; min-height: 50px; padding: 10px 12px; border-radius: 12px;
  background: #160f0a; border: 1px solid var(--line); color: var(--text); font-size: 16px; font-family: inherit;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* ---- Compteurs ---- */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .num { flex: 1; text-align: center; font-size: 1.7rem; font-weight: 800; min-width: 52px; }
.stepper input { text-align: center; font-size: 1.5rem; font-weight: 800; }
.round {
  width: 58px; height: 58px; border-radius: 50%; flex: none; border: 1px solid var(--line);
  background: var(--panel2); color: var(--gold); font-size: 1.9rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.round:active { transform: scale(.94); }
.counter-card { display: flex; align-items: center; gap: 10px; }
.counter-card .big { font-size: 2rem; }
.counter-card .info { flex: 1; min-width: 0; }
.counter-card .name { font-weight: 700; }

.total { padding: 8px 12px; border-radius: 12px; font-weight: 700; text-align: center; margin: 10px 0; }
.total.ok { background: rgba(95,174,107,.15); color: var(--ok); border: 1px solid rgba(95,174,107,.4); }
.total.bad { background: rgba(179,42,46,.15); color: #ff8b8e; border: 1px solid rgba(179,42,46,.5); }

/* ---- Grille de rôles ---- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tilewrap { position: relative; }
.tile {
  width: 100%; min-height: 104px; border-radius: 14px; border: 2px solid var(--line);
  background: linear-gradient(180deg, #2a1e15, #1c140e); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px;
  cursor: pointer; touch-action: manipulation; position: relative;
}
.tile .e { font-size: 2rem; line-height: 1; }
.tile .n { font-size: .74rem; text-align: center; font-weight: 600; line-height: 1.15; }
.tile.on { border-color: var(--gold); background: linear-gradient(180deg, #4a3519, #2e2110); box-shadow: 0 0 14px rgba(224,168,74,.35); }
.tile.on::after { content: '✓'; position: absolute; top: 4px; left: 8px; color: var(--gold); font-weight: 900; }
.tile .badge2 { position: absolute; bottom: 4px; right: 6px; font-size: .68rem; color: var(--moon); font-style: normal; }
.tile .needs { position: absolute; bottom: 4px; left: 6px; font-size: .6rem; color: var(--muted); font-style: normal; }
.infobtn {
  position: absolute; top: 2px; right: 2px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.35); color: var(--moon); border: none; font-size: .9rem; cursor: pointer;
}
.group-title { margin: 14px 4px 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* ---- Pastilles de camp ---- */
.campbadge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.camp-loup { background: rgba(179,42,46,.25); color: #ff9a9d; }
.camp-village { background: rgba(95,174,107,.2); color: #8fd69a; }
.camp-ambigu { background: rgba(224,168,74,.2); color: var(--gold); }
.camp-solitaire { background: rgba(174,191,218,.2); color: var(--moon); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; background: rgba(255,255,255,.08); color: var(--text); margin: 2px 4px 2px 0; }
.chip.gold { background: rgba(224,168,74,.22); color: var(--gold); }
.chip.red { background: rgba(179,42,46,.3); color: #ffa3a6; }
.chip.blue { background: rgba(174,191,218,.2); color: var(--moon); }

/* ---- Nuit ---- */
.progress { height: 6px; border-radius: 999px; background: #000; overflow: hidden; margin: 2px 2px 12px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-d), var(--gold)); }
.rolecard { position: relative; text-align: center; padding: 44px 16px 18px;
  background: radial-gradient(90% 70% at 50% 0%, #3a2a1c, #1c140e); }
.rolecard .emoji { font-size: 5rem; line-height: 1.05; filter: drop-shadow(0 6px 12px rgba(0,0,0,.6)); }
.rolecard h2 { font-size: 1.5rem; margin: 6px 0 6px; color: var(--text); }
.rolecard .desc { text-align: left; margin-top: 12px; font-size: .95rem; color: #ddd0b8; }
.corner {
  position: absolute; top: 8px; display: flex; flex-direction: column; align-items: center; gap: 0;
  min-width: 64px; min-height: 44px; padding: 4px 8px; border-radius: 12px; border: 1px solid transparent;
  background: rgba(0,0,0,.28); color: var(--muted); font-size: .66rem; cursor: pointer; max-width: 40%;
}
.corner .e { font-size: 1.2rem; line-height: 1.1; }
.corner span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.corner-l { left: 8px; } .corner-r { right: 8px; }
.corner.none { visibility: hidden; }

.navbar {
  position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 30;
  padding: 10px 12px; background: linear-gradient(transparent, var(--bg) 35%);
}
.navbar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.navbar .btn { min-height: 62px; font-size: 1.1rem; }
.navbar .prev { flex: 1; } .navbar .next { flex: 2; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #0c0907; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { max-width: 560px; margin: 0 auto; display: flex; }
.tab { flex: 1; min-height: 66px; background: none; border: none; color: var(--muted); font-size: .78rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.tab .e { font-size: 1.4rem; }
.tab.on { color: var(--gold); }

/* ---- Joueurs ---- */
.pblock { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.pblock:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.pcard {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); cursor: pointer; min-height: 70px; touch-action: manipulation;
}
.pcard .pe { font-size: 2rem; }
.pcard .pi { flex: 1; min-width: 0; }
.pcard .pn { font-weight: 800; font-size: 1.05rem; }
.pcard .pr { color: var(--muted); font-size: .85rem; }
.pcard .pnote { color: #cdbd9f; font-size: .8rem; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.dead { opacity: .55; background: #150f0b; }
.pcard.dead .pn { text-decoration: line-through; }
.status { font-size: 1.5rem; }

.alert { border-left: 4px solid var(--gold); background: rgba(224,168,74,.1); padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: .93rem; }
.alert.secret { border-color: var(--moon); background: rgba(174,191,218,.08); color: var(--moon); }
.alert.win { border-color: var(--ok); background: rgba(95,174,107,.12); }
.deathrow { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(179,42,46,.14); border: 1px solid rgba(179,42,46,.45); margin-bottom: 8px; }
.deathrow.cancelled { opacity: .45; text-decoration: line-through; }
.deathrow .pe { font-size: 2.2rem; }

.target { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }

/* ---- Journal ---- */
.hgroup { margin: 14px 4px 6px; font-weight: 800; color: var(--gold); font-family: Georgia, serif; }
.hitem { padding: 10px 12px; border-left: 3px solid var(--line); background: rgba(255,255,255,.03); border-radius: 0 10px 10px 0; margin-bottom: 6px; font-size: .92rem; }
.hitem.death { border-color: var(--blood); } .hitem.night { border-color: var(--moon); }
.hitem.secret { border-color: #6b7fa0; color: var(--moon); }
.hitem time { display: block; color: var(--muted); font-size: .72rem; }

/* ---- Feuille modale ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; max-height: 88dvh; overflow-y: auto;
  background: var(--panel); border-radius: 22px 22px 0 0; border-top: 2px solid var(--gold);
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 10px; color: var(--gold); font-size: 1.15rem; }
.pickbtn { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 14px; margin-bottom: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-size: 1.05rem; font-weight: 700; text-align: left; cursor: pointer; }
.pickbtn.sel { border-color: var(--gold); background: #4a3519; }
.pickbtn[disabled] { opacity: .35; }
.pickbtn small { display: block; color: var(--muted); font-weight: 500; font-size: .75rem; }
.flaggrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flagbtn { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 700; font-size: .9rem; cursor: pointer; }
.flagbtn.on { border-color: var(--gold); background: #4a3519; color: var(--gold); }

#toast-root { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 14px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: #000; border: 1px solid var(--gold); color: var(--text); padding: 10px 16px; border-radius: 14px; font-weight: 600; max-width: 90%; animation: up .15s ease-out; }
