/* La Veillée — direction artistique : veillée de village, nuit d'encre, accents rouge sang.
   Thème nuit (par défaut) et thème jour, basculés par data-theme sur <html>. */

:root {
  --bg: #0b0c12;
  --bg-2: #11131c;
  --surface: #161a26;
  --surface-2: #1d2232;
  --line: #2a3045;
  --ink: #ece6da;
  --ink-2: #b7b1a6;
  --muted: #8a8698;
  --accent: #c8323c;
  --accent-ink: #fff4ef;
  --accent-soft: rgba(200, 50, 60, 0.16);
  --gold: #e3c98f;
  --lamp: #e0a43a;
  --ok: #5fb27f;
  --wolf: #d4434b;
  --seer: #8d7cf0;
  --witch: #4fb59a;
  --villager: #d9b16c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

[data-theme='day'] {
  --bg: #efe6d6;
  --bg-2: #e6dbc6;
  --surface: #fbf6ec;
  --surface-2: #f3eadb;
  --line: #d9cbb1;
  --ink: #2a211c;
  --ink-2: #4b3f36;
  --muted: #7a6c5e;
  --accent: #b0262f;
  --accent-soft: rgba(176, 38, 47, 0.1);
  --gold: #9b6a1c;
  --shadow: 0 10px 26px rgba(80, 55, 25, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); transition: background-color 0.9s ease; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[data-theme='day'] body {
  background: radial-gradient(120% 60% at 50% -10%, rgba(255, 200, 120, 0.35), transparent 60%), var(--bg);
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; margin: 0; line-height: 1.15; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.kicker {
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.stack { display: grid; gap: 12px; }
.stack-tight { display: grid; gap: 4px; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* ───────── icônes ───────── */
.icon { display: inline-flex; width: 22px; height: 22px; flex: none; }
.icon svg, .emblem svg { width: 100%; height: 100%; display: block; }

.emblem { display: inline-block; flex: none; color: var(--villager); }
.emblem-werewolf { color: var(--wolf); }
.emblem-seer { color: var(--seer); }
.emblem-witch { color: var(--witch); }
.emblem-unknown { color: var(--muted); }
.emblem svg { stroke-width: 1.6; }
.emblem-xs { width: 18px; height: 18px; }
.emblem-sm { width: 28px; height: 28px; }
.emblem-md { width: 44px; height: 44px; }
.emblem-lg { width: 76px; height: 76px; }
.emblem-xl { width: 108px; height: 108px; }
.emblem-md, .emblem-lg, .emblem-xl {
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, currentColor 18%, transparent), transparent 70%);
}
.emblem-md { padding: 6px; }
.emblem-lg { padding: 12px; }
.emblem-xl { padding: 18px; }

/* ───────── boutons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; width: 100%; padding: 14px 20px;
  border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: 1.02rem; letter-spacing: 0.01em;
  cursor: pointer; user-select: none;
  transition: transform 0.12s ease, background-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-small { min-height: 44px; padding: 10px 16px; font-size: 0.95rem; width: auto; }
.btn .icon { width: 20px; height: 20px; }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.95); }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px; cursor: pointer; }

/* ───────── bandeaux ───────── */
.banner {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; background: #5a1d22; color: #ffe9e3; font-size: 0.9rem; font-weight: 600;
}
.banner .icon { width: 18px; height: 18px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%);
  z-index: 60; width: min(92vw, 460px); padding: 14px 18px; border-radius: 14px;
  background: #2b1316; color: #ffe2dc; border: 1px solid #7a2a31; box-shadow: var(--shadow);
  font-weight: 600; animation: rise 0.25s ease;
}
.toast-ok { background: #13281d; color: #d8f5e3; border-color: #2f6b47; }
.dead-banner {
  margin: 0 16px 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-soft); border: 1px dashed var(--accent); font-size: 0.92rem;
}

/* ───────── accueil ───────── */
.home { min-height: 100dvh; display: flex; flex-direction: column; padding: 0 20px calc(28px + var(--safe-b)); }
.scene { position: relative; width: calc(100% + 40px); margin: 0 -20px; height: 34vh; min-height: 200px; overflow: hidden; }
.scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-moon { fill: var(--gold); filter: drop-shadow(0 0 22px rgba(227, 201, 143, 0.5)); }
.scene-moon-shade { fill: var(--bg); }
.scene-hill2 { fill: #141827; }
.scene-trees { fill: #0f1220; }
.scene-houses, .scene-steeple { fill: #1b2031; }
.scene-window { fill: var(--lamp); animation: flicker 4s infinite; }
.scene-window:nth-of-type(2) { animation-delay: 1.3s; }
.scene-hill1 { fill: var(--bg); }
[data-theme='day'] .scene-moon { fill: #f6c56b; filter: drop-shadow(0 0 30px rgba(246, 197, 107, 0.8)); }
[data-theme='day'] .scene-moon-shade { display: none; }
[data-theme='day'] .scene-hill2 { fill: #d8c6a4; }
[data-theme='day'] .scene-trees { fill: #8c9a6a; }
[data-theme='day'] .scene-houses, [data-theme='day'] .scene-steeple { fill: #b79f7c; }
[data-theme='day'] .scene-window { fill: transparent; }
.brand { margin: 8px 0 28px; }
.brand h1 { font-size: clamp(2.6rem, 12vw, 3.6rem); margin: 10px 0 10px; }
.tagline { color: var(--ink-2); font-size: 1.05rem; max-width: 30ch; }
.home-actions { margin-bottom: 28px; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: how; color: var(--ink-2); font-size: 0.95rem; }
.how li { counter-increment: how; display: grid; grid-template-columns: 30px 1fr; align-items: baseline; }
.how li::before {
  content: counter(how); font: 600 0.85rem var(--serif); color: var(--accent);
  border: 1px solid var(--line); width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; align-self: start; margin-top: 1px;
}
.how li > * { grid-column: 2; }
.how strong { color: var(--ink); }

/* ───────── formulaires ───────── */
.form-screen { padding: 16px 20px 32px; display: grid; gap: 14px; }
.form-screen h1 { font-size: 2rem; margin-top: 8px; }
.back {
  justify-self: start; display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; color: var(--ink-2); padding: 8px 4px; cursor: pointer; font-weight: 600;
}
.field { display: grid; gap: 8px; }
.field > span { font-weight: 600; font-size: 0.92rem; color: var(--ink-2); }
.field input {
  width: 100%; min-height: 56px; padding: 12px 16px; font-size: 1.1rem;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-input { text-transform: uppercase; letter-spacing: 0.35em; font: 700 1.6rem/1 ui-monospace, 'SF Mono', Menlo, monospace !important; text-align: center; }
.field-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.field-row > span { font-size: 0.95rem; }
.field-row select, .field-row input[type='range'] { max-width: 58%; }
.field-row select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 42px; font-size: 0.9rem;
}
input[type='range'] { accent-color: var(--accent); width: 58%; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.toggle-text { flex: 1; display: grid; }
.toggle-text small { color: var(--muted); font-size: 0.82rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 50px; height: 30px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; transition: background 0.2s; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-2); transition: transform 0.2s, background 0.2s; }
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); background: #fff; }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--accent-soft); }
.toggle.is-disabled { cursor: default; opacity: 0.75; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.stepper button { width: 52px; height: 48px; border: 0; background: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }
.stepper button:disabled { opacity: 0.3; }
.stepper output { min-width: 40px; text-align: center; font: 700 1.25rem var(--serif); }

/* ───────── barre du haut ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.topbar-code { display: grid; line-height: 1.1; }
.topbar-code small { font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.topbar-code strong { font: 700 0.95rem ui-monospace, Menlo, monospace; letter-spacing: 0.12em; }
.topbar-title { text-align: center; font: 600 1.05rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 6px; }

/* ───────── cartes ───────── */
.card {
  margin: 0 16px 14px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card-title { font-size: 1.1rem; margin-bottom: 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title small { font: 500 0.78rem var(--sans); color: var(--muted); }
.card-sub { font-size: 0.9rem; margin: 14px 0 8px; color: var(--muted); }
details.card > summary { list-style: none; cursor: pointer; margin: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '▾'; color: var(--muted); margin-left: auto; transition: transform 0.2s; }
details.card[open] > summary::after { transform: rotate(180deg); }
details.card[open] > summary { margin-bottom: 8px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.92rem; }
.note.warn { border-color: var(--accent); background: var(--accent-soft); }

/* ───────── salon ───────── */
.lobby { padding-bottom: calc(110px + var(--safe-b)); }
.code-hero { text-align: center; padding: 22px 16px 18px; display: grid; gap: 12px; justify-items: center; }
.code-big { display: flex; gap: 6px; }
.code-big span {
  width: 44px; height: 58px; display: grid; place-items: center;
  font: 700 1.9rem ui-monospace, 'SF Mono', Menlo, monospace;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: inset 0 -3px 0 var(--accent-soft);
}
.player-list { list-style: none; margin: 0; padding: 0; display: grid; }
.player { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--line); }
.player:last-child { border-bottom: 0; }
.player.is-offline { opacity: 0.55; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); font: 700 0.95rem var(--serif); color: var(--gold);
}
.player-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag .icon { width: 13px; height: 13px; }
.tag-host { color: var(--gold); }
.tag.warn, .chip-tag.warn { color: var(--accent); border-color: var(--accent); }
.kick { min-width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0 8px; font-size: 0.8rem; font-weight: 700; }
.kick .icon { width: 16px; height: 16px; }
.kick.is-armed { color: var(--accent); border-color: var(--accent); }
.compo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.compo-row > span { display: grid; }
.compo-row small { color: var(--muted); font-size: 0.82rem; }
.compo-row output { font: 700 1.25rem var(--serif); padding-right: 18px; }

.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 15;
  width: min(100%, 520px); padding: 14px 16px calc(14px + var(--safe-b));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  display: grid; gap: 8px;
}
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; color: var(--ink-2); font-weight: 600; text-align: center; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; flex: none; }

/* ───────── sous-titres ───────── */
.game { padding-bottom: calc(150px + var(--safe-b)); min-height: 100dvh; }
.subtitle {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 14;
  bottom: calc(98px + var(--safe-b)); width: min(calc(100% - 32px), 488px);
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--ink-2);
  animation: rise 0.35s ease;
}
.subtitle-icon .icon { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.phase-day_announcement .subtitle, .phase-vote_resolution .subtitle, .phase-night_start .subtitle,
.phase-seer_turn .subtitle, .phase-werewolf_turn .subtitle, .phase-witch_turn .subtitle { bottom: calc(16px + var(--safe-b)); }

/* ───────── carte de rôle ───────── */
.reveal { padding: 16px; display: grid; gap: 18px; }
.rolecard {
  display: block; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh; margin: 0 auto;
  border: 0; padding: 0; background: none; cursor: pointer; perspective: 1200px;
}
.rolecard-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(.2,.7,.2,1); }
.rolecard.is-shown .rolecard-inner { transform: rotateY(180deg); }
.rolecard-back, .rolecard-front {
  position: absolute; inset: 0; border-radius: 22px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; align-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.rolecard-back {
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255, 255, 255, 0.02) 14px 15px),
    radial-gradient(circle at 50% 38%, #26171b, #120f16 70%);
  color: #e9dcc4;
  outline: 1px solid rgba(200, 50, 60, 0.35); outline-offset: -12px;
}
.rolecard-sigil { font-size: 4rem; color: var(--accent); line-height: 1; filter: drop-shadow(0 0 18px rgba(200, 50, 60, 0.45)); }
.rolecard-back small { color: #a39a8c; max-width: 24ch; }
.rolecard-front { transform: rotateY(180deg); background: radial-gradient(circle at 50% 30%, var(--surface-2), var(--surface) 70%); }
.rolecard-front h2 { font-size: 2.1rem; }
.rolecard-front p { color: var(--ink-2); max-width: 32ch; }
.rolecard-team { letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted); }
.rolecard-mates { font-weight: 700; color: var(--wolf) !important; }
.rolecard-hide { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.rolecard-hide .icon { width: 16px; height: 16px; }
.role-werewolf .rolecard-front { border-color: color-mix(in srgb, var(--wolf) 50%, var(--line)); }
.role-seer .rolecard-front { border-color: color-mix(in srgb, var(--seer) 50%, var(--line)); }
.role-witch .rolecard-front { border-color: color-mix(in srgb, var(--witch) 50%, var(--line)); }

/* ───────── nuit ───────── */
.sleep { min-height: 70dvh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 24px; position: relative; overflow: hidden; }
.sleep h2 { font-size: 2rem; z-index: 1; }
.sleep p { color: var(--muted); max-width: 28ch; z-index: 1; }
.moon { width: 92px; height: 92px; border-radius: 50%; box-shadow: -18px 8px 0 0 var(--gold); transform: rotate(-20deg); margin-bottom: 12px; filter: drop-shadow(0 0 20px rgba(227, 201, 143, 0.35)); animation: float 7s ease-in-out infinite; }
.stars {
  position: absolute; inset: -20%; opacity: 0.7; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 40% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 86% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 60%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 60% 70%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 80%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 8% 86%, #fff 50%, transparent 51%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
.host-quiet { display: flex; justify-content: center; padding: 18px 16px 0; z-index: 1; position: relative; }
.host-quiet .btn { opacity: 0.75; }

.action { padding: 16px; display: grid; gap: 14px; }
.action-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.action-head h2 { font-size: 1.4rem; }
.action-head p { font-size: 0.88rem; margin-top: 2px; }
.action-timer .countdown { font: 700 1.15rem ui-monospace, Menlo, monospace; }
.countdown.urgent { color: var(--accent); }
.timebar { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.timebar-fill { height: 100%; background: var(--accent); transform-origin: left; transition: transform 0.25s linear; }
.action.done { text-align: center; justify-items: center; padding-top: 12vh; }
.action.done h2 { font-size: 2rem; }
.vision { font: 600 1.5rem var(--serif); color: var(--ink-2); }
.action-seer.done.is-wolf .vision { color: var(--wolf); }

.targets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.target {
  position: relative; min-height: 76px; padding: 12px; border-radius: 16px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.target:active:not(:disabled) { transform: scale(0.97); }
.target-initial { grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font: 700 1.1rem var(--serif); color: var(--gold); }
.target-name { font-weight: 650; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-badges { font-size: 0.75rem; color: var(--wolf); font-weight: 600; grid-column: 2; }
.target-check { position: absolute; top: 8px; right: 8px; color: var(--accent); }
.target-check .icon { width: 18px; height: 18px; }
.target.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.target-danger.is-selected .target-initial { background: var(--accent); color: #fff; }

.victim-box { padding: 16px; border-radius: 16px; background: var(--accent-soft); border: 1px solid var(--accent); display: grid; text-align: center; gap: 2px; }
.victim-box small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; }
.victim-box strong { font: 600 1.5rem var(--serif); }
.victim-box.is-empty { background: var(--surface); border-color: var(--line); }
.victim-box.is-empty strong { font-size: 1.1rem; }
.potion {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left;
  width: 100%; min-height: 72px; padding: 14px 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.potion > span:nth-child(2) { display: grid; }
.potion small { color: var(--muted); font-size: 0.85rem; }
.potion:disabled, .potion.is-disabled { opacity: 0.45; cursor: default; }
.potion-flask { width: 28px; height: 34px; border-radius: 6px 6px 14px 14px; border: 2px solid currentColor; position: relative; }
.potion-flask::after { content: ''; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 50%; border-radius: 3px 3px 10px 10px; background: currentColor; opacity: 0.6; }
.potion-life { color: var(--witch); }
.potion-death { color: var(--wolf); cursor: default; }
.potion strong { color: var(--ink); }
.potion.is-on { border-color: currentColor; background: color-mix(in srgb, currentColor 12%, var(--surface)); }
.potion .icon { color: currentColor; }

/* ───────── jour ───────── */
.dawn, .verdict, .gameover { padding: 0 16px 16px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.dawn .scene { height: 24vh; min-height: 150px; margin: 0 -16px; width: calc(100% + 32px); }
.dawn h2, .verdict h2, .gameover h2 { font-size: 1.9rem; }
.verdict, .gameover { padding-top: 24px; }
.victims { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; width: 100%; }
.victim { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.victim .emblem { grid-row: span 2; }
.victim strong { font: 600 1.25rem var(--serif); }
.victim small { color: var(--muted); }
.dawn .timebar, .verdict .timebar { width: 60%; }
.day-hero { padding: 22px 16px 16px; text-align: center; display: grid; gap: 8px; }
.day-hero h2 { font-size: 2rem; }
.big-timer .countdown { font: 700 2.6rem ui-monospace, Menlo, monospace; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.92rem; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.chip-name { font-weight: 600; }
.chip-tag { font-size: 0.7rem; color: var(--muted); }
.chip-role { font-size: 0.75rem; color: var(--muted); }
.chip.is-dead { opacity: 0.6; }
.chip.is-dead .chip-name { text-decoration: line-through; }
.chip.is-offline .chip-dot { background: var(--muted); }

.voting { padding: 14px 16px; display: grid; gap: 16px; }
.voting h2 { font-size: 1.5rem; }
.progress { display: grid; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--ink-2); font-weight: 600; }
.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.voted { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 8vh 0 0; }
.voted-check { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border: 2px solid var(--accent); animation: pop 0.4s ease; }
.voted-check .icon { width: 42px; height: 42px; }
.voted h2 { font-size: 1.8rem; }

.tally { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; width: 100%; }
.tally li { display: grid; grid-template-columns: 7.5em 1fr 2em; gap: 10px; align-items: center; text-align: left; font-size: 0.95rem; }
.tally li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tally-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tally strong { text-align: right; }

.gameover .card { width: 100%; margin: 0; text-align: left; }
.final-roles { list-style: none; padding: 0; margin: 0; display: grid; }
.final-roles li { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.final-roles li:last-child { border-bottom: 0; }
.final-roles .emblem { grid-row: span 2; }
.final-roles li > span:nth-child(2) { font-weight: 650; }
.final-roles li > small:nth-child(3) { grid-column: 2; color: var(--muted); }
.final-roles .status { grid-column: 3; grid-row: 1 / span 2; color: var(--muted); }
.final-roles li.is-dead > span { text-decoration: line-through; opacity: 0.75; }
.winner-werewolves h2 { color: var(--wolf); }

.history { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; font-size: 0.92rem; }
.history small { color: var(--muted); }

/* ───────── feuille modale ───────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s; }
.sheet {
  width: min(100%, 520px); max-height: 90dvh; overflow: auto; padding: 8px 18px calc(22px + var(--safe-b));
  background: var(--bg-2); border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0;
  animation: slideup 0.28s cubic-bezier(.2,.7,.2,1);
}
.sheet-head { display: flex; justify-content: center; position: relative; height: 40px; align-items: center; }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--line); }
.sheet-close { position: absolute; right: -6px; top: 4px; }
.sheet-body h3 { font-size: 1.35rem; margin-bottom: 10px; }
.sheet .rolecard { max-height: 56vh; }

/* ───────── états ───────── */
.center-screen { min-height: 80dvh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0.4; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } }
@keyframes float { 50% { transform: rotate(-20deg) translateY(-8px); } }
@keyframes twinkle { to { opacity: 0.35; } }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: 0.75; } 50% { opacity: 0.95; } 52% { opacity: 0.6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 380px) { .code-big span { width: 48px; height: 62px; } }

/* ───────── v2 : rôles, QR, options, récit, palmarès ───────── */
:root { --solo: #d38b2c; }
.qr { width: 176px; height: 176px; border-radius: 16px; background: #f6efe2; padding: 6px; box-shadow: var(--shadow); }
.seat-tools { display: inline-flex; gap: 4px; align-items: center; }
.seat { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); cursor: pointer; font-size: 1rem; }
.seat:disabled { opacity: 0.3; }
.player-list { counter-reset: none; }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.preset { padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.preset.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.preset:disabled:not(.is-on) { opacity: 0.6; }
.chips-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.role-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.82rem; font-weight: 600; }
.role-group { margin-top: 6px; }
.role-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.role-chip { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); text-align: left; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.role-chip.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.role-chip small { color: var(--muted); }
.team-werewolves.role-pill, .role-chip.team-werewolves.is-on { border-color: var(--wolf); }
.team-solo.role-pill, .role-chip.team-solo.is-on { border-color: var(--solo); }
.compo .link { display: block; margin-top: 8px; padding-left: 0; }

.info-box { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; font-weight: 600; }
.options { display: grid; gap: 10px; }
.option { display: grid; gap: 2px; text-align: left; min-height: 60px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.option strong { font-size: 1.02rem; }
.option small { color: var(--muted); }
.option:active:not(:disabled) { transform: scale(0.98); }
.option-danger { border-color: color-mix(in srgb, var(--wolf) 55%, var(--line)); }
.option-danger strong { color: var(--wolf); }
.target-mark { font-size: 0.72rem; color: var(--gold); font-weight: 700; grid-column: 2; }
.mini-crown { display: inline-flex; width: 15px; height: 15px; color: var(--gold); margin-left: 4px; vertical-align: -2px; }
.mini-crown .icon { width: 15px; height: 15px; }
.chip-mark { font-size: 0.72rem; font-weight: 700; }
.mark-love { color: #e2557a; }
.mark-wolf { color: var(--wolf); }
.mark-charm { color: var(--solo); }
.rolecard-status { font-size: 0.88rem; font-weight: 600; color: var(--gold) !important; margin: 0; }
.team-solo .rolecard-front { border-color: color-mix(in srgb, var(--solo) 50%, var(--line)); }
.team-werewolves .rolecard-front { border-color: color-mix(in srgb, var(--wolf) 50%, var(--line)); }
.notes { margin-top: 8px; }
.action .vision { font-size: 1.25rem; }

.extras { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.extras li { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 0.95rem; }
.discussion .extras { padding: 0 16px 12px; }
.decision { min-height: 60dvh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; }
.decision h2 { font-size: 1.5rem; max-width: 26ch; }
.decision .timebar { width: 60%; }
.judge { display: flex; justify-content: center; }

.stats { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.stats th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.78rem; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stats td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.stats tr:last-child td { border-bottom: 0; }

.guide { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.guide-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.guide-item p { margin-top: 2px; color: var(--ink-2); font-size: 0.92rem; }
.guide-item small { color: var(--muted); }

.chronicle { width: 100%; margin: 0; text-align: left; }
.story { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.story > li > strong { font: 600 1rem var(--serif); color: var(--accent); }
.story ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 3px; color: var(--ink-2); font-size: 0.92rem; }
.final-roles li.is-winner > span { color: var(--gold); }
.winner-piper h2, .winner-white_wolf h2, .winner-angel h2, .winner-sectarian h2 { color: var(--solo); }
.winner-lovers h2 { color: #e2557a; }

/* Couleur des emblèmes par camp */
.emblem-big_bad_wolf, .emblem-infect_father { color: var(--wolf); }
.emblem-white_wolf { color: #d9dde8; }
.emblem-piper, .emblem-angel, .emblem-sectarian { color: var(--solo); }
.emblem-cupid { color: #e2557a; }
.emblem-savior, .emblem-gypsy { color: var(--seer); }
.emblem-captain { color: var(--gold); }
[data-theme='day'] .emblem-white_wolf { color: #6c7385; }

/* Sous-titre de narration : sous la barre du haut, toujours visible */
.subtitle { position: static; transform: none; width: auto; margin: 10px 16px 6px; animation: none; }
.phase-day_announcement .subtitle, .phase-vote_resolution .subtitle, .phase-night_start .subtitle, .phase-night_turn .subtitle { bottom: auto; }
