/* La Table — dark-arcane design system. Tokens centralized for reuse. */

/* Tokens : voir play/tokens.css (source unique, spec §5).
   Aucun :root ici — ces fichiers consomment les tokens, ils ne les definissent plus. */

* { box-sizing: border-box; }

[v-cloak] { display: none; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Warm vignette over everything (table-under-torchlight focus) + faint film grain. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at center, transparent 52%, rgba(5, 6, 12, 0.78) 100%);
  z-index: 1;
}

/* ---------- ambient background layer ---------- */
#ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#ambient canvas { display: block; position: absolute; inset: 0; }

/* Fond « autour du feu » : noirs CHAUDS (brun/ambré), plus de zénith indigo.
   La lune et les météores restent (décision 2026-09-10) : ce sont les signatures
   de calme, mais elles sont réaccordées chaud. Le canvas WebGL se pose dessus. */
.ambient-fallback {
  background:
    radial-gradient(110% 70% at 50% -10%, #2a2018 0%, transparent 60%),
    radial-gradient(120% 90% at 50% 0%, #1e1710 0%, var(--base-2) 55%, var(--base) 100%),
    radial-gradient(70% 60% at 12% 10%, rgba(255, 122, 61, 0.09) 0%, transparent 60%),
    var(--base);
}

/* Voiles dérivant lentement, très flous : deux braises (ambre + or) au lieu du
   duo cyan/violet — un seul accent lumineux à la fois. */
.aurora {
  position: absolute;
  width: 72vmax;
  height: 34vmax;
  filter: blur(60px);
  will-change: transform;
}
.aurora-a {
  left: -18%;
  top: -14%;
  background: radial-gradient(closest-side, rgba(255, 140, 70, 0.18), transparent 70%);
  animation: drift-a 47s ease-in-out infinite alternate;
}
.aurora-b {
  right: -20%;
  top: -10%;
  background: radial-gradient(closest-side, rgba(246, 201, 106, 0.14), transparent 70%);
  animation: drift-b 61s ease-in-out infinite alternate;
}
@keyframes drift-a {
  from { transform: translate(0, 0) scale(1) rotate(-4deg); }
  to { transform: translate(9vw, 5vh) scale(1.14) rotate(3deg); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) scale(1.1) rotate(3deg); }
  to { transform: translate(-8vw, 6vh) scale(0.96) rotate(-3deg); }
}

/* Hearth glow along the bottom edge with an irregular torch flicker. */
.hearth {
  position: absolute;
  left: 50%;
  bottom: -24vmin;
  width: 130vmin;
  height: 52vmin;
  transform: translateX(-50%);
  background:
    radial-gradient(50% 50% at 50% 50%, rgba(255, 150, 60, 0.20) 0%, rgba(232, 163, 61, 0.12) 45%, transparent 72%),
    radial-gradient(22% 40% at 82% 55%, rgba(255, 122, 61, 0.12) 0%, transparent 70%);
  animation: hearth-flicker 4.2s ease-in-out infinite;
}
@keyframes hearth-flicker {
  0%, 100% { opacity: 0.9; transform: translateX(-50%) scale(1); }
  18% { opacity: 1; transform: translateX(-50%) scale(1.015); }
  37% { opacity: 0.82; transform: translateX(-50%) scale(0.998); }
  55% { opacity: 0.96; transform: translateX(-50%) scale(1.008); }
  74% { opacity: 0.86; transform: translateX(-50%) scale(1.002); }
}

/* Giant faint arcane circle behind the table: two counter-rotating
   rune rings, masked so only thin dashed bands show. */
.runes {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(112vmin, 920px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0.34;
  background: repeating-conic-gradient(from 0deg, rgba(232, 163, 61, 0.30) 0 0.55deg, transparent 0.55deg 6deg);
  -webkit-mask: radial-gradient(closest-side, transparent 78.5%, #000 79%, #000 82%, transparent 82.6%);
  mask: radial-gradient(closest-side, transparent 78.5%, #000 79%, #000 82%, transparent 82.6%);
  animation: spin-slow 240s linear infinite;
}
.runes::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 4deg, rgba(232, 190, 140, 0.18) 0 0.4deg, transparent 0.4deg 9deg);
  -webkit-mask: radial-gradient(closest-side, transparent 63.5%, #000 64%, #000 65%, transparent 65.6%);
  mask: radial-gradient(closest-side, transparent 63.5%, #000 64%, #000 65%, transparent 65.6%);
  animation: spin-rev 180s linear infinite;
}
.runes::after {
  content: "";
  position: absolute;
  inset: 9.5%;
  border-radius: 50%;
  border: 1px solid rgba(232, 163, 61, 0.14);
  box-shadow: 0 0 60px rgba(232, 163, 61, 0.06), inset 0 0 60px rgba(232, 163, 61, 0.05);
}
@keyframes spin-slow { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }

/* Occasional shooting stars: thin bright streaks crossing the upper sky. */
.meteor {
  position: absolute;
  top: 6%;
  width: 2px;
  height: 130px;
  border-radius: 2px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(160, 200, 255, 0.25) 60%, transparent);
  filter: drop-shadow(0 0 6px rgba(180, 210, 255, 0.8));
  transform: rotate(24deg);
  opacity: 0;
}
.meteor.m1 { right: 18%; animation: meteor-fall 11s ease-in 2.5s infinite; }
.meteor.m2 { right: 42%; animation: meteor-fall 17s ease-in 8s infinite; }
@keyframes meteor-fall {
  0% { opacity: 0; transform: rotate(24deg) translateY(-12vh); }
  3% { opacity: 1; }
  9% { opacity: 0; transform: rotate(24deg) translateY(30vh); }
  100% { opacity: 0; transform: rotate(24deg) translateY(30vh); }
}

/* Ember specks: a few soft dots that drift upward and flicker. */
#ambient::before {
  content: "";
  position: absolute;
  inset: -20% 0;
  background-image:
    radial-gradient(2px 2px at 12% 80%, rgba(255, 170, 90, 0.9), transparent 100%),
    radial-gradient(1.5px 1.5px at 28% 55%, rgba(232, 163, 61, 0.8), transparent 100%),
    radial-gradient(2.5px 2.5px at 44% 88%, rgba(255, 122, 61, 0.7), transparent 100%),
    radial-gradient(1.5px 1.5px at 61% 40%, rgba(255, 190, 120, 0.8), transparent 100%),
    radial-gradient(2px 2px at 76% 72%, rgba(232, 163, 61, 0.75), transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 30%, rgba(255, 140, 80, 0.8), transparent 100%);
  background-size: 340px 340px;
  background-repeat: repeat;
  opacity: 0.5;
  animation: embers 26s linear infinite;
}
@keyframes embers {
  from { transform: translateY(12%); opacity: 0.35; }
  50% { opacity: 0.6; }
  to { transform: translateY(-8%); opacity: 0.35; }
}

/* ---------- surfaces ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg), inset 0 0 44px rgba(232, 163, 61, 0.04);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--ember); font-size: 26px; text-shadow: 0 0 18px var(--ember-glow); }

.title {
  font-family: var(--serif);
  font-size: 44px;
  margin: 0;
  color: var(--amber);
  letter-spacing: 0.5px;
  text-shadow: 0 0 24px var(--ember-glow);
}
.subtitle { color: var(--muted); margin: 6px 0 20px; font-style: italic; }

/* ---------- setup ---------- */
.setup-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.setup-panel { width: min(480px, 100%); padding: 32px 34px; }
.setup-panel label { display: block; margin: 18px 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.setup-panel select, .setup-panel input { width: 100%; }
.inline { display: flex; gap: 8px; margin-top: 8px; }
.inline input, .inline select { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.foot { margin-top: 26px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--amber); }

/* ---------- game screen ---------- */
.game-screen {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 12px 14px;
}

.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.campaign { font-family: var(--serif); font-size: 22px; color: var(--amber); }
.spacer { flex: 1; }
.btn.icon.quit { color: var(--ember); border-color: transparent; background: transparent; font-size: 18px; }
.btn.icon.quit:hover { color: var(--hp); background: rgba(217, 79, 61, 0.1); box-shadow: none; }

/* vitals strip (avatars + bars) */
.vitals { display: flex; gap: 12px; padding: 10px 12px; flex-wrap: wrap; }
.vital {
  display: flex; gap: 10px; align-items: center;
  min-width: 190px; flex: 1;
  padding: 6px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--ease), box-shadow var(--ease);
}
.vital:hover { background: rgba(232, 163, 61, 0.07); }
.vital.active { background: rgba(232, 163, 61, 0.12); box-shadow: 0 0 0 1px var(--border-strong), var(--glow-amber); }
.vital.down { opacity: 0.65; }
.vital.down .name { color: var(--muted); text-decoration: line-through; }
.vital-body { flex: 1; min-width: 0; }
.vital .name { font-weight: 600; font-size: 14px; }
.flag { font-size: 11px; color: var(--ember); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- avatars ---------- */
.avatar {
  position: relative;
  flex: none;
  width: 46px; height: 46px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 6px 14px rgba(0, 0, 0, 0.45);
  background: linear-gradient(150deg, #1a1f2e, #0d1019);
  display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar > span {
  font-family: var(--serif);
  font-size: 20px; font-weight: 600;
  color: var(--amber);
  text-shadow: 0 0 10px var(--ember-glow);
}
.avatar.small { width: 28px; height: 28px; border-radius: 8px; }
.avatar.small > span { font-size: 13px; }
.avatar.tiny { width: 20px; height: 20px; border-radius: 6px; box-shadow: none; }
.avatar.tiny > span { font-size: 11px; }
.avatar.large {
  width: 168px; height: 168px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg), var(--glow-amber);
}
.avatar.large > span { font-size: 64px; }
.avatar.no-img::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(232, 163, 61, 0.18), transparent 60%);
  pointer-events: none;
}

/* ---------- chat log ---------- */
.log {
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0; /* allow the grid item to shrink so it scrolls internally */
}
.history-hint { text-align: center; color: var(--muted); font-size: 12px; padding: 4px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.player { flex-direction: row-reverse; }
.msg-body {
  max-width: min(680px, 78%);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.msg.player .msg-body {
  background: rgba(232, 163, 61, 0.10);
  border-color: var(--border-strong);
  text-align: right;
}
.msg-avatar { align-self: flex-start; }
.gm-avatar {
  background: radial-gradient(circle at 35% 30%, #3a2b18, #1a1206);
  color: var(--amber);
  font-size: 20px;
}
.msg-meta { margin-bottom: 2px; }
.msg-name { font-family: var(--serif); font-size: 15px; color: var(--amber); }
.msg.player .msg-name { color: var(--ember); }
.meta { margin-bottom: 6px; }
.msg-text {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  margin: 0;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-text.typing { color: var(--muted); font-style: italic; }
/* Carte t_2936a2e5 — l'ancien « … » animé (animation `dots` sur la largeur) est
   retiré : theme.css le neutralise déjà (`content: none`) et le libellé de
   chargement ne doit plus rien déplacer. */
.msg-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.msg.player .msg-actions { justify-content: flex-end; }
/* Carte t_70629031 — narration : la barre de lecture est remplacée par une
   icône (haut-parleur au repos, pause pendant la lecture). L'état vient de
   l'élément audio, pas du clic : seul l'éclairage change, rien ne bouge. */
.speak { line-height: 1; }
.speak.playing {
  background: rgba(232, 163, 61, 0.3);
  border-color: var(--amber);
  color: var(--gold);
}
.scene-img {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}
.msg.player .scene-img { margin-left: auto; }
.scene-pending {
  margin-top: 10px;
  padding: 18px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: linear-gradient(100deg, rgba(232, 163, 61, 0.04) 25%, rgba(232, 163, 61, 0.12) 50%, rgba(232, 163, 61, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- FAB « revenir au dernier message » ----------
   Spec : docs/design-fab-scroll-to-bottom.md (valeurs contractuelles §13).
   Le FAB vit dans `.log-wrap` (non scrollant) et NON dans `.log`, qui est le
   conteneur de scroll : un enfant absolu y défilerait avec les messages. */
.log-wrap {
  position: relative;
  min-height: 0; /* rangée 1fr de .game-screen : se laisse comprimer */
  min-width: 0;  /* verrou anti-débordement (colonne auto de .game-screen) */
  display: flex;
}
.log-wrap > .log {
  flex: 1 1 auto;
  min-width: 0;
}

.log-jump {
  position: absolute;
  bottom: 12px;        /* 22 px au-dessus de la saisie (gap de grille 10 px) */
  left: 50%;
  margin-left: -22px;  /* centrage SANS transform : la transform sert à l'animation */
  z-index: var(--z-content);
  width: 44px;
  height: 44px;        /* cible tactile 44×44 (plancher maison) */
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: var(--shadow-1);
  color: var(--amber);
  cursor: pointer;
  transition:
    color var(--ease),
    background-color var(--ease),
    border-color var(--ease),
    box-shadow var(--ease),
    transform var(--dur-1) var(--ease-out);
}
.log-jump-icon { width: 20px; height: 20px; }
/* Convention maison (cf. `.msg-speak`) : hover = lumière, SANS mouvement. */
.log-jump:hover {
  color: var(--gold);
  border-color: var(--amber);
  box-shadow: var(--shadow-1), var(--glow-amber);
}
.log-jump:active {
  background: var(--amber-soft);
  color: var(--gold);
  border-color: var(--amber);
  transform: scale(0.94);
}
.log-jump:disabled {
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

/* Badge de messages non lus (spec §9) : pastille 18 px, « 9+ » au-delà de 9.
   `:key` dans le gabarit recrée l'élément à chaque incrément : la pop
   rejoue une seule fois par message — le FAB lui ne bouge jamais. */
.log-jump-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--ember);
  color: #14100b;
  border: 2px solid #14100b;
  font: 600 11px var(--display);
  line-height: 18px;
  text-align: center;
  animation: log-jump-badge-pop var(--dur-1) var(--spring);
}
@keyframes log-jump-badge-pop {
  from { transform: scale(0.6); }
  to   { transform: scale(1); }
}

/* Animation d'entrée / sortie du FAB (spec §6) : il monte sous le doigt et
   retombe vers le fil — le sens de la flèche. */
.jump-enter-active {
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.jump-leave-active {
  transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.jump-enter-from { opacity: 0; transform: translateY(8px); }
.jump-leave-to   { opacity: 0; transform: translateY(4px); }
@media (prefers-reduced-motion: reduce) {
  .jump-enter-from, .jump-leave-to { transform: none; }
}

/* action bar */
.actionbar { display: flex; gap: 8px; padding: 10px 12px; align-items: center; }
.actionbar input { flex: 1; font-size: 16px; }

/* ---------- controls ---------- */
input, select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 15px;
  font-family: var(--sans);
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder { color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ember-glow); }
input:disabled, select:disabled { opacity: 0.5; cursor: default; }

.btn {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 15px;
  font-family: var(--sans);
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { background: rgba(232, 163, 61, 0.22); box-shadow: 0 6px 18px var(--ember-glow); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, #e8a33d, #ff7a3d); color: #1a1206; border-color: transparent; font-weight: 600; }
.btn.primary:hover { box-shadow: 0 8px 22px var(--ember-glow); }
.btn.wide { width: 100%; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 9px 12px; }
.btn.danger {
  background: rgba(217, 79, 61, 0.12);
  border-color: rgba(217, 79, 61, 0.5);
  color: #ff9d8a;
}
.btn.danger:hover { background: rgba(217, 79, 61, 0.25); box-shadow: 0 6px 18px rgba(217, 79, 61, 0.35); }
.delete-confirm {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 79, 61, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(217, 79, 61, 0.08);
}
.delete-confirm span { display: block; font-size: 14px; margin-bottom: 8px; }
.delete-confirm .inline { margin-top: 0; }
.btn.mic.recording { background: var(--ember); color: #1a0c06; box-shadow: 0 0 18px var(--ember-glow); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 8px var(--ember-glow); } 50% { box-shadow: 0 0 22px var(--ember); } }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--amber-soft);
  border: 1px solid var(--border);
  color: var(--amber);
}
.chip b { color: var(--text); }

.muted { color: var(--muted); font-size: 13px; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(400px, 92vw);
  transform: translateX(105%);
  transition: transform 260ms ease-out;
  z-index: 3;
  border-radius: 0;
  overflow-y: auto;
  padding: 18px 20px;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.drawer h2 { font-family: var(--serif); color: var(--amber); margin: 0; font-size: 24px; }
.drawer h3 { color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; margin: 20px 0 8px; }
.order { margin: 0; padding-left: 20px; }
.order li.current { color: var(--amber); font-weight: 600; }
.drawer-img { width: 100%; border-radius: 10px; margin-top: 10px; border: 1px solid var(--border); }
.session-log { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; }
.session-log li { padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 13px; }

/* ---------- réglage « jets de dés » / « lecture du texte » (tiroir) ---------- */
.rolls-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  user-select: none;
}
.rolls-switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--amber);
  cursor: pointer;
}
.rolls-switch input:disabled { cursor: progress; opacity: 0.6; }
.rolls-mode p, .read-aloud p { margin: 8px 0 0; }
.rolls-mode h3 { margin-top: 0; }

/* ---------- character sheet ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: rgba(5, 6, 12, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 180ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
  background: var(--surface-2);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { font-family: var(--serif); color: var(--amber); margin: 0; font-size: 28px; }
.sheet-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sheet-grid { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.sheet-portrait { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sheet-portrait input { width: 100%; }
.race { margin: 0; color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 17px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.attrs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.attr {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}
.attr label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.attr span { font-family: var(--serif); font-size: 26px; color: var(--amber); }

/* Barres segmentées (barre de points du créateur, PV/PF de la fiche).
   Le socle `.bar` / `.bar .fill` / `.bar span` avait été retiré par erreur dans
   44499aa (les règles étaient considérées « mortes » alors que `.bars` est
   toujours utilisé dans la fiche) : sans `position: relative`, le pseudo-élément
   `.bar::after` de theme.css (séparateurs tous les 10 %) s'ancrait sur le panneau
   `.sheet` — qui est un bloc conteneur via son `backdrop-filter` — et y dessinait
   des lignes verticales noires sur toute la hauteur (bug « lignes noires »). */
.bars { margin-top: 4px; display: grid; gap: 3px; }
.bar { position: relative; height: 14px; border-radius: 7px; background: rgba(0, 0, 0, 0.4); overflow: hidden; }
.bar .fill { position: absolute; inset: 0; border-radius: 7px; transition: width var(--ease); }
.bar.hp .fill { background: linear-gradient(90deg, #a83426, var(--hp)); }
.bar.fp .fill { background: linear-gradient(90deg, #2c4a66, var(--fp)); }
.bar span { position: relative; z-index: 1; display: block; text-align: center; font-size: 10px; line-height: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.sheet-bars .bar { height: 16px; border-radius: 8px; }
.sheet-bars .bar span { font-size: 11px; line-height: 16px; }
.sheet-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
}
.stat label { color: var(--muted); margin-right: 6px; }
.skills h3 { color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; margin: 0 0 8px; }
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* banner */
.banner {
  position: fixed;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(720px, 92vw);
  padding: 10px 16px;
  background: #3a1f22;
  border: 1px solid var(--ember);
  border-radius: 8px;
  color: #ffd9d9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.banner span { font-size: 14px; }

/* ---------- lightbox (full-size image viewer) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(5, 6, 12, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: zoom-out;
  animation: fadeIn 160ms ease-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  cursor: default;
}
.lightbox-close { position: absolute; top: 18px; right: 18px; font-size: 16px; }

/* zoomable images */
.scene-img, .drawer-img { cursor: zoom-in; }
.avatar img { cursor: zoom-in; }



/* ---------- campaign creator (chat with the GM) ---------- */
.creator-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(5, 6, 12, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 180ms ease-out;
}
.creator {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
}
.creator-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.creator-head h2 { font-family: var(--serif); color: var(--amber); margin: 0; font-size: 28px; }
.creator-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 4px 2px 8px;
}
.creator-text { font-size: 18px; }
.pitch {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(232, 163, 61, 0.08);
  box-shadow: var(--glow-amber);
}
.pitch-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pitch-head strong { font-family: var(--serif); font-size: 20px; color: var(--amber); }
.pitch p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--text); }
.creator-bar { display: flex; gap: 8px; margin: 12px 0; }
.creator-bar input { flex: 1; font-size: 16px; }
.creator-done h3 { font-family: var(--serif); color: var(--amber); margin: 0 0 12px; font-size: 26px; }
.creator-done .cover {
  display: block;
  width: 100%;
  max-height: 44vh;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  margin-bottom: 12px;
}

/* ---------- character creator (chat + live sheet) ---------- */
.creator-split { width: min(1060px, 100%); }
.char-creator-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.char-creator-chat { display: flex; flex-direction: column; min-width: 0; }
.char-sheet-live {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
  max-height: 62vh;
  overflow-y: auto;
}
.char-sheet-live .race { color: var(--text-dim); margin: 2px 0 10px; font-style: italic; }
.points { margin-bottom: 12px; }
.points-bar { height: 18px; border-radius: 9px; }
.points-bar span { font-size: 12px; line-height: 18px; }
.points .fill { background: linear-gradient(90deg, #7fb069, #a7c957); }
.points.over .fill { background: linear-gradient(90deg, #c1666b, #e07a5f); }
.points-detail { font-size: 13px; color: var(--text-dim); margin: 6px 0 0; }
.points-warn { font-size: 13px; color: #e07a5f; margin: 4px 0 0; font-weight: bold; }
.chip.adv { border-color: #7fb069; }
.chip.disav { border-color: #c1666b; }

@media (max-width: 900px) {
  .char-creator-grid { grid-template-columns: 1fr; }
  .char-sheet-live { max-height: none; }
}

/* ---------- motion ---------- */
/* Carte t_2936a2e5 — aucun texte ni image ne bouge ; le fond seul bouge, à
   peine (parallaxe ±2 px de `.log.has-scene`), et tout s'arrête ici. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 720px) {
  .msg-text { font-size: 19px; }
  .msg-body { max-width: 90%; }
  .vital { min-width: 150px; }
  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-portrait { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .avatar.large { width: 100px; height: 100px; }
}

/* ---------- comptes : écran de connexion, profil ---------- */
/* docs/authentification.md — la connexion est un mur : rien de la partie
   n'est lisible tant qu'aucun profil n'est connecté (aucun état n'est
   cloisonné par compte, mais l'accès à l'API l'est). */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.9));
  backdrop-filter: blur(6px);
}
.login-panel { width: min(420px, 100%); padding: 32px 34px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.login-form label {
  display: block;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.login-form input { width: 100%; }
.login-code {
  text-align: center;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}
.login-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.login-error { margin: 14px 0 0; color: var(--hp); font-size: 14px; }
.login-dev { margin: 12px 0 0; color: var(--amber); font-size: 13px; }
.profile-card { width: min(440px, 100%); }
.profile-logout { margin-top: 22px; }
.account-btn { font-family: var(--serif); font-size: 17px; }

/* ---------- mode multi : grille des héros, bandeau, verrou, couleurs (docs/mode-multi.md §7) ---------- */

/* §7.3.1 — bandeau de table : « vous » + initiale du joueur + absence grisée. */
.vital-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vital-name-row .vital-name { flex: 1; min-width: 0; width: auto; }
.seat-you {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--amber);
  color: #20160a;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.seat-initial {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--seat-accent, var(--border-strong));
  color: var(--seat-accent, var(--amber));
  background: rgba(0, 0, 0, 0.35);
  font-size: 10px;
  font-weight: 600;
}
.seat-free {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.vital.away { opacity: 0.55; }

/* §7.4 — bulles de joueur : accent stable par siège (--seat-accent posé par app.js). */
.msg.player .msg-name { color: var(--seat-accent, var(--ember)); }
.msg.player .msg-body {
  border-color: var(--seat-accent, var(--border-strong));
  box-shadow: inset 3px 0 0 var(--seat-accent, transparent), 0 8px 22px rgba(0, 0, 0, 0.35);
}
.msg.player .avatar { border-color: var(--seat-accent, var(--border-strong)); }

/* §7.3.3 — verrou visible : un autre joueur réfléchit. */
.turn-busy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(232, 163, 61, 0.08);
  color: var(--amber);
  font-size: 13px;
  white-space: nowrap;
}
.turn-busy .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: badge-dot-pulse 1.8s ease-in-out infinite;
}

/* §6.4 — annonce « Kael doit lancer le dé » chez les autres joueurs. */
.roll-notice {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(232, 163, 61, 0.06);
  color: var(--text);
  font-size: 14px;
}
.roll-notice-name { color: var(--amber); font-family: var(--serif); }
.roll-notice-reason { color: var(--muted); font-style: italic; font-size: 12px; }
