/* === LE JEU DES DIEUX — STYLE PARTAGÉ === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-0: #0a0705;
  --bg-1: #130d08;
  --bg-2: #1c140c;
  --bg-3: #2a1e12;
  --gold: #d4af37;
  --gold-bright: #f0c420;
  --gold-dim: #8a6d1f;
  --ivory: #f5eedc;
  --ivory-dim: #c9bfa7;
  --bordeaux: #8b1e1e;
  --bordeaux-bright: #c72c2c;
  --mal: #c72c2c;
  --mal-soft: rgba(199, 44, 44, 0.15);
  --bien: #6fb3d2;
  --bien-soft: rgba(111, 179, 210, 0.12);
  --neutre: #b07cc6;
  --border: rgba(212, 175, 55, 0.25);
  --border-strong: rgba(212, 175, 55, 0.5);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--ivory);
  line-height: 1.55;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 30, 30, 0.10) 0%, transparent 50%),
    linear-gradient(180deg, #0a0705 0%, #120b06 100%);
  background-attachment: fixed;
  padding: 12px;
  -webkit-font-smoothing: antialiased;
}
body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}
h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.02em;
}

.serif { font-family: 'Cormorant Garamond', serif; }
.muted { color: var(--ivory-dim); }
.gold { color: var(--gold); }
.mal { color: var(--mal); }
.bien { color: var(--bien); }

/* Hero card */
.hero-card {
  width: 100%;
  max-width: 540px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero-card .eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero-card h1 {
  font-size: clamp(36px, 8vw, 60px);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #f5eedc 0%, #d4af37 50%, #8a6d1f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-card .tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ivory-dim);
  font-size: 18px;
  margin-bottom: 28px;
}
.cta-stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.footnote { color: var(--ivory-dim); font-size: 13px; line-height: 1.5; opacity: 0.8; }

/* Boutons */
.btn {
  display: inline-block;
  padding: 14px 26px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 3px;
  transition: all 0.25s;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  width: 100%;
  user-select: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 50%, var(--gold-dim) 100%);
  color: var(--bg-0);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(212, 175, 55, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: transparent;
  color: var(--ivory);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: rgba(212, 175, 55, 0.06); border-color: var(--gold); color: var(--gold); }
.btn-danger {
  background: linear-gradient(135deg, var(--bordeaux-bright) 0%, var(--bordeaux) 100%);
  color: var(--ivory);
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-mal { background: var(--mal-soft); color: var(--mal); border: 1px solid var(--mal); }
.btn-bien { background: var(--bien-soft); color: var(--bien); border: 1px solid var(--bien); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 100px; }

/* Cards & sections */
.card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 14px 16px; }
.card h2 { font-size: 22px; color: var(--gold); margin-bottom: 10px; }
.card h3 { font-size: 16px; color: var(--gold); margin-bottom: 6px; letter-spacing: 0.05em; }

.kicker {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-0);
  color: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 16px;
  font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); }

/* Listes joueurs */
.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.player-chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.player-chip:hover { border-color: var(--gold); }
.player-chip.selected { background: rgba(212, 175, 55, 0.18); border-color: var(--gold); color: var(--gold); }
.player-chip.dead { opacity: 0.4; text-decoration: line-through; }
.player-chip .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gold);
  color: var(--bg-0);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

/* Code de room large */
.room-code {
  font-family: 'Cinzel', serif;
  font-size: clamp(48px, 12vw, 92px);
  letter-spacing: 0.15em;
  font-weight: 900;
  text-align: center;
  color: var(--gold);
  background: linear-gradient(180deg, #f5eedc 0%, #d4af37 50%, #8a6d1f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 18px 0;
}

/* Toasts */
#toast-stack {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  padding: 12px 18px;
  border-radius: 4px;
  color: var(--ivory);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease-out;
  max-width: 380px;
}
.toast.error { border-left-color: var(--mal); }
.toast.success { border-left-color: var(--bien); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Misc */
.hidden { display: none !important; }
.spacer { height: 14px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-3);
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-right: 4px;
}
.tag.mal { color: var(--mal); border-color: rgba(199,44,44,0.4); background: var(--mal-soft); }
.tag.bien { color: var(--bien); border-color: rgba(111,179,210,0.4); background: var(--bien-soft); }

/* Wake-up overlay (joueur) */
.wake-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(212,175,55,0.10), var(--bg-0) 70%);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  text-align: center;
}
.wake-overlay h1 {
  font-size: clamp(32px, 7vw, 56px);
  background: linear-gradient(180deg, #f5eedc 0%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 18px;
}
.wake-overlay p { color: var(--ivory-dim); font-size: 18px; max-width: 520px; margin-bottom: 20px; }

/* === ÉTAPES NUIT — joueur mort === */
.night-step.dead-step {
  opacity: 0.45;
  filter: grayscale(0.8);
  background: rgba(199, 44, 44, 0.05) !important;
  border-left: 3px solid var(--mal) !important;
}
.night-step.dead-step .role { text-decoration: line-through; }

/* === TABLE CIRCULAIRE === */
.circle-table-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  margin: 14px auto;
}
.circle-table-svg { width: 100%; height: 100%; display: block; }
.circle-seat {
  position: absolute;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 11px;
  text-align: center;
  padding: 4px;
  user-select: none;
}
.circle-seat:hover { transform: scale(1.08); box-shadow: 0 0 14px rgba(212,175,55,0.5); }
.circle-seat.taken { background: var(--bg-3); cursor: default; opacity: 0.7; }
.circle-seat.mine {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--bg-0);
  font-weight: 700;
  box-shadow: 0 0 18px rgba(212,175,55,0.6);
}
.circle-seat.dragging { cursor: grabbing; z-index: 100; }
.circle-seat .seat-num {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--gold);
  font-weight: 700;
}
.circle-seat.mine .seat-num { color: var(--bg-0); }
.circle-seat.taken .seat-num { color: var(--ivory-dim); }
.circle-seat .seat-name {
  font-size: 9px;
  line-height: 1.1;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.circle-table-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(212,175,55,0.15), rgba(20,12,8,0.8));
  border: 1px solid rgba(212,175,55,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-align: center;
  pointer-events: none;
}

/* === TIMELINE PREMIUM === */
.timeline-premium {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 12px 4px;
}
.timeline-verdict {
  position: relative;
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  background: radial-gradient(circle at center, rgba(212,175,55,0.15), var(--bg-1) 70%);
  border: 1px solid var(--gold);
  box-shadow: 0 6px 30px rgba(212,175,55,0.18);
}
.timeline-verdict .vsigil {
  font-size: 56px;
  filter: drop-shadow(0 0 18px rgba(212,175,55,0.55));
  margin-bottom: 6px;
}
.timeline-verdict.bien-win { background: radial-gradient(circle at center, rgba(111,179,210,0.18), var(--bg-1) 70%); border-color: var(--bien); }
.timeline-verdict.mal-win { background: radial-gradient(circle at center, rgba(199,44,44,0.18), var(--bg-1) 70%); border-color: var(--mal); }
.timeline-verdict h2 {
  font-family: 'Cinzel', serif;
  font-size: clamp(26px, 5vw, 42px);
  letter-spacing: 0.06em;
  margin: 4px 0 6px;
  background: linear-gradient(180deg, #f5eedc 0%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.timeline-verdict.bien-win h2 { background: linear-gradient(180deg, #f5eedc 0%, var(--bien) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.timeline-verdict.mal-win h2 { background: linear-gradient(180deg, #f5eedc 0%, var(--mal) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.timeline-verdict p { color: var(--ivory-dim); font-style: italic; font-family: 'Cormorant Garamond', serif; font-size: 17px; }

.timeline-chart {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 8px;
  padding: 16px 14px;
}
.timeline-chart .chart-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-align: center;
  margin-bottom: 10px;
}
.timeline-chart .chart-caption {
  color: var(--ivory-dim);
  text-align: center;
  font-style: italic;
  font-size: 12px;
  margin-top: 8px;
}

.timeline-thread {
  position: relative;
  padding-left: 32px;
}
.timeline-thread::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, rgba(212,175,55,0.2) 100%);
}
.tl-entry {
  position: relative;
  margin-bottom: 18px;
}
.tl-entry .tl-marker {
  position: absolute;
  left: -32px;
  top: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(212,175,55,0.4);
}
.tl-night .tl-marker { border-color: var(--gold); }
.tl-day .tl-marker { border-color: var(--ivory); }
.tl-card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 6px;
  padding: 14px 16px;
}
.tl-head { margin-bottom: 8px; }
.tl-head .tl-kind {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.22em;
}

.tl-actions { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.tl-action {
  font-size: 13px;
  background: var(--bg-3);
  padding: 6px 10px;
  border-radius: 3px;
  border-left: 2px solid var(--gold);
}
.tl-action .tl-icon { display: inline-block; width: 22px; }
.tl-action .tl-actor { color: var(--ivory-dim); font-size: 12px; }

.tl-deaths { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-skull { font-size: 16px; }
.tl-dead-chip {
  background: rgba(199,44,44,0.15);
  border: 1px solid var(--mal);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--ivory);
}
.tl-no-death { color: var(--ivory-dim); font-style: italic; font-size: 13px; margin-top: 8px; }

.tl-decisions {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(212,175,55,0.06);
  border-left: 3px solid var(--gold);
  border-radius: 0 4px 4px 0;
}
.tl-dec-head {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}
.tl-decision {
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.45;
}
.tl-decision.lie { background: rgba(199,44,44,0.10); border: 1px solid rgba(199,44,44,0.4); color: var(--ivory); }
.tl-decision.truth { background: rgba(111,179,210,0.08); border: 1px solid rgba(111,179,210,0.35); color: var(--ivory); }
.tl-dec-tag {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.tl-decision.lie .tl-dec-tag { background: var(--mal); color: #fff; }
.tl-decision.truth .tl-dec-tag { background: var(--bien); color: var(--bg-0); }
.tl-dec-body { font-style: italic; color: var(--ivory-dim); }

.tl-balance {
  margin-top: 10px;
  padding: 6px 10px;
  background: var(--bg-0);
  border-radius: 4px;
  font-style: italic;
  font-size: 12px;
  color: var(--ivory-dim);
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.tl-bal-score { font-family: 'Cinzel', serif; font-size: 16px; font-weight: 700; }

.tl-privates { margin-top: 10px; padding: 6px 10px; background: var(--bg-3); border-radius: 4px; font-size: 12px; }
.tl-privates summary { cursor: pointer; color: var(--gold); font-family: 'Cinzel', serif; letter-spacing: 0.1em; font-size: 11px; }
.tl-privates ul { list-style: none; padding: 8px 0 0 0; margin: 0; }
.tl-privates li { padding: 4px 0; color: var(--ivory-dim); border-bottom: 1px dashed rgba(212,175,55,0.15); }
.tl-privates li:last-child { border-bottom: 0; }

.tl-vote-result { font-size: 14px; }
.tl-vote-result.muted { color: var(--ivory-dim); font-style: italic; }

/* Responsive */
@media (max-width: 540px) {
  .hero-card { padding: 28px 18px; }
  .card { padding: 18px 16px; }
  .timeline-thread { padding-left: 28px; }
  .tl-entry .tl-marker { left: -28px; width: 26px; height: 26px; font-size: 12px; }
}
