/* ============================================================
   Blackjack Chaos — thème "casino nocturne & chaos électrique"
   ============================================================ */

:root {
  --ink: #0A0E0B;
  --ink-2: #0F1611;
  --panel: rgba(13, 22, 16, 0.72);
  --felt: #0F3D2A;
  --felt-2: #0A2A1B;
  --felt-3: #1B5C3E;
  --ivory: #F3EDDD;
  --ivory-dim: #A8A08C;
  --gold: #E6BC54;
  --gold-2: #9A7424;
  --chaos: #FF5FA8;
  --chaos-2: #9C2A6B;
  --danger: #FF5A4E;
  --good: #6FE3A0;
  --blue: #62B8FF;
  --violet: #B28CFF;

  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ivory);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 640px at 50% -12%, rgba(38, 92, 64, 0.4), transparent 62%),
    radial-gradient(900px 520px at 88% 112%, rgba(130, 42, 96, 0.16), transparent 60%),
    linear-gradient(180deg, #0D140F 0%, #080C09 100%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

::selection { background: rgba(255, 95, 168, 0.35); }

button { font-family: var(--font-body); cursor: pointer; border: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* poussière dorée en arrière-plan */
.motes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.motes span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 188, 84, 0.9), rgba(230, 188, 84, 0) 70%);
  animation: moteFloat 12s ease-in-out infinite alternate;
}
@keyframes moteFloat {
  from { transform: translateY(0) translateX(0); }
  to   { transform: translateY(-46px) translateX(14px); }
}

/* ============================================================
   ECRAN ACCUEIL
   ============================================================ */
#screen-home {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1;
}

.home-deco { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); width: 520px; height: 320px; pointer-events: none; z-index: 0; }
.deco-card {
  position: absolute;
  width: 72px;
  height: 102px;
  border-radius: 11px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  animation: decoFloat 7s ease-in-out infinite alternate;
}
.deco-card.d1 {
  left: 10px; top: 74px;
  rotate: -14deg;
  background: linear-gradient(150deg, #FBF7EC, #E9DFC6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: var(--ink);
}
.deco-card.d1 b { font-family: var(--font-mono); font-size: 1.5rem; line-height: 1; }
.deco-card.d1 i { font-style: normal; font-size: 1.1rem; }
.deco-card.d2, .deco-card.d3 {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 12px, rgba(230, 188, 84, 0.28) 13px 14px, transparent 15px),
    repeating-linear-gradient(45deg, #7A2C55 0 8px, #932F64 8px 16px);
  border: 1px solid rgba(230, 188, 84, 0.55);
}
.deco-card.d2 { right: 26px; top: 56px; rotate: 12deg; }
.deco-card.d3 { right: 96px; top: 178px; rotate: 24deg; width: 56px; height: 80px; opacity: 0.75; }
@keyframes decoFloat {
  from { translate: 0 0; }
  to   { translate: 0 -12px; }
}

.home-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  background: linear-gradient(180deg, rgba(19, 32, 24, 0.82), rgba(10, 18, 13, 0.88));
  border: 1px solid rgba(230, 188, 84, 0.28);
  border-radius: 22px;
  padding: 38px 34px 26px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(243, 237, 221, 0.08);
}

.brand {
  font-family: var(--font-display);
  font-size: 3.3rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--ivory);
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.brand-chaos {
  background: linear-gradient(100deg, #FF8AC0, var(--chaos) 45%, #C25BFF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 95, 168, 0.55));
  animation: chaosFlicker 5s ease-in-out infinite;
}
@keyframes chaosFlicker {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(255, 95, 168, 0.55)); }
  92%      { filter: drop-shadow(0 0 4px rgba(255, 95, 168, 0.3)); }
  94%      { filter: drop-shadow(0 0 22px rgba(255, 95, 168, 0.8)); }
  96%      { filter: drop-shadow(0 0 6px rgba(255, 95, 168, 0.35)); }
}

.tagline {
  text-align: center;
  color: var(--ivory-dim);
  font-size: 0.9rem;
  margin: 6px 0 18px;
  line-height: 1.5;
}

.feature-pills { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.feature-pills span {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 30px;
  border: 1px solid rgba(243, 237, 221, 0.18);
  background: rgba(243, 237, 221, 0.05);
  color: var(--ivory-dim);
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 0.78rem; color: var(--ivory-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.field input {
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(243, 237, 221, 0.18);
  background: rgba(4, 10, 7, 0.6);
  color: var(--ivory);
  letter-spacing: 0.05em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  border-color: rgba(230, 188, 84, 0.6);
  box-shadow: 0 0 0 3px rgba(230, 188, 84, 0.12);
}

.divider { display: flex; align-items: center; text-align: center; color: var(--ivory-dim); font-size: 0.72rem; text-transform: uppercase; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(243, 237, 221, 0.13); }
.divider span { padding: 0 10px; }

/* ---------- boutons ---------- */
.btn {
  width: 100%;
  padding: 13px 18px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn:active { transform: translateY(0); filter: brightness(0.97); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, #C99A35 55%, var(--gold-2) 100%);
  color: #231A05;
  box-shadow: 0 6px 18px rgba(216, 178, 76, 0.22), inset 0 1px 0 rgba(255, 245, 210, 0.65);
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.4) 50%, transparent 58%);
  transform: translateX(-130%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.btn-primary:hover::before { transform: translateX(130%); }

.btn-secondary {
  background: rgba(243, 237, 221, 0.07);
  color: var(--ivory);
  border: 1px solid rgba(243, 237, 221, 0.22);
}
.btn-outline {
  background: transparent;
  color: var(--ivory-dim);
  border: 1px solid rgba(243, 237, 221, 0.22);
}
.btn-small { width: auto; padding: 9px 16px; font-size: 0.85rem; }
.btn-mini {
  background: rgba(243, 237, 221, 0.07);
  color: var(--ivory);
  border: 1px solid rgba(243, 237, 221, 0.18);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.78rem;
  transition: background 0.15s ease, transform 0.12s ease;
}
.btn-mini:hover { background: rgba(243, 237, 221, 0.14); transform: translateY(-1px); }

.error-text { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; text-align: center; margin: 12px 0 0; }
.build-note { text-align: center; color: rgba(168, 160, 140, 0.6); font-size: 0.66rem; margin: 14px 0 0; letter-spacing: 0.02em; }

/* ============================================================
   ECRAN ROOM
   ============================================================ */
#screen-room {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(8, 14, 10, 0.9), rgba(8, 14, 10, 0.72));
  border-bottom: 1px solid rgba(230, 188, 84, 0.22);
  backdrop-filter: blur(8px);
}
.room-code-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.room-label { font-size: 0.68rem; text-transform: uppercase; color: var(--ivory-dim); letter-spacing: 0.1em; }
.room-code { font-family: var(--font-mono); font-size: 1.25rem; letter-spacing: 0.16em; color: var(--gold); text-shadow: 0 0 14px rgba(230, 188, 84, 0.4); }
#lobby-controls { display: flex; gap: 8px; margin-left: auto; }

.table-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 20px 22px;
}
@media (max-width: 900px) { .table-wrap { grid-template-columns: 1fr; } }

/* ---------- table ---------- */
.felt-table {
  position: relative;
  overflow: hidden;
  border-radius: 220px / 92px;
  background: radial-gradient(ellipse at 50% 38%, var(--felt-3) 0%, var(--felt) 58%, var(--felt-2) 100%);
  border: 2px solid rgba(230, 188, 84, 0.32);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.55), 0 24px 60px rgba(0, 0, 0, 0.4);
  padding: 30px 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 480px;
}
@media (max-width: 900px) { .felt-table { border-radius: 34px; } }

/* grain du feutre */
.felt-table::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(243, 237, 221, 0.05) 1px, transparent 1.6px);
  background-size: 7px 7px;
  opacity: 0.55;
  pointer-events: none;
}
/* vignette interne */
.felt-table::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
  pointer-events: none;
}

.table-emblem {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 2px dashed rgba(230, 188, 84, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  pointer-events: none;
}
.table-emblem::before {
  content: '♠';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.2rem;
  color: rgba(243, 237, 221, 0.05);
  transform: rotate(-14deg);
}
.table-emblem span { font-family: var(--font-display); font-size: 2rem; letter-spacing: 0.32em; color: rgba(243, 237, 221, 0.07); text-indent: 0.32em; }

.dealer-zone, .seats { position: relative; z-index: 1; }
.dealer-zone { text-align: center; }

.zone-label {
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  color: var(--gold);
  font-size: 1.05rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.dealer-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(230, 188, 84, 0.9);
  animation: dotPulse 2.2s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hand { display: flex; gap: 6px; justify-content: center; min-height: 78px; flex-wrap: wrap; perspective: 500px; }
.hand-value { font-family: var(--font-mono); color: var(--ivory-dim); margin-top: 6px; min-height: 1.1em; font-size: 0.85rem; }

/* ---------- cartes ---------- */
.playing-card {
  position: relative;
  width: 54px;
  height: 76px;
  border-radius: 8px;
  background: linear-gradient(150deg, #FBF7EC 0%, #EDE3CB 100%);
  color: var(--ink);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.playing-card.red { color: var(--danger); }
.playing-card .pc-corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--font-mono); font-weight: 700; }
.playing-card .pc-corner b { font-size: 0.82rem; }
.playing-card .pc-corner i { font-style: normal; font-size: 0.64rem; }
.playing-card .pc-tl { top: 4px; left: 5px; }
.playing-card .pc-br { bottom: 4px; right: 5px; transform: rotate(180deg); }
.playing-card .pc-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.playing-card .pc-face-letter { font-family: Georgia, 'Times New Roman', serif; font-size: 1.85rem; font-style: italic; transform: rotate(-6deg); }

.playing-card.hidden-card {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 11px, rgba(230, 188, 84, 0.3) 12px 13px, transparent 14px),
    repeating-linear-gradient(45deg, #6E274B 0 7px, #8B2F5C 7px 14px);
  border: 1px solid rgba(230, 188, 84, 0.55);
}
.playing-card.ghost {
  background: linear-gradient(160deg, #A13375 0%, var(--chaos-2) 60%, #6A1E4E 100%);
  color: #FFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 10px rgba(255, 95, 168, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.playing-card.ghost .pc-face { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700; text-shadow: 0 0 12px rgba(255, 255, 255, 0.6); }

/* apparition des cartes */
.card-new { animation: cardDeal 0.34s cubic-bezier(0.2, 0.8, 0.3, 1.15) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes cardDeal {
  from { opacity: 0; transform: translateY(-30px) rotateY(80deg) scale(0.7); }
  to   { opacity: 1; transform: none; }
}
.card-reveal { animation: cardReveal 0.5s ease both; }
@keyframes cardReveal { from { transform: rotateY(92deg); } to { transform: none; } }

/* ---------- sièges ---------- */
.seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; }

.seat {
  position: relative;
  width: 168px;
  max-width: 100%;
  background: linear-gradient(180deg, rgba(10, 20, 14, 0.62), rgba(7, 14, 10, 0.6));
  border: 1px solid rgba(243, 237, 221, 0.13);
  border-radius: 14px;
  padding: 11px 12px 10px;
  text-align: center;
  transition: border-color 0.15s ease;
  overflow: hidden;
}
.seat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--pc, var(--gold)), transparent);
  opacity: 0.55;
}
.seat.active-turn {
  border-color: var(--pc, var(--gold));
  background: linear-gradient(180deg, rgba(16, 30, 21, 0.72), rgba(9, 17, 12, 0.68));
}
.seat.active-turn::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 2px solid var(--pc, var(--gold));
  pointer-events: none;
  animation: ringPulse 1.5s ease-out infinite;
}
@keyframes ringPulse {
  0%   { opacity: 0.9; box-shadow: 0 0 0 0 color-mix(in srgb, var(--pc, var(--gold)) 55%, transparent); }
  100% { opacity: 0.15; box-shadow: 0 0 0 12px transparent; }
}
.seat.is-me { border-color: rgba(255, 95, 168, 0.45); }
.seat.is-me::before { background: linear-gradient(90deg, transparent, var(--chaos), transparent); opacity: 0.9; }
.seat.eliminated { opacity: 0.4; filter: grayscale(1); }

.seat .seat-top { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 4px; }
.seat .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(6, 12, 8, 0.9);
  flex-shrink: 0;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.35);
}
.seat .seat-name { font-weight: 600; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .seat-name em { font-style: normal; color: var(--ivory-dim); font-weight: 400; font-size: 0.72rem; }
.seat .seat-chips { font-family: var(--font-mono); color: var(--gold); font-size: 0.78rem; margin-bottom: 6px; display: inline-flex; align-items: center; gap: 4px; }
.seat .seat-chips .mini-chip {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: radial-gradient(circle at 35% 30%, #FFE9B0, var(--gold) 60%, var(--gold-2));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 0 0 1.5px rgba(60, 40, 4, 0.35);
}
.seat .seat-chips.bump { animation: bump 0.45s ease; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.25); color: var(--good); } 100% { transform: scale(1); } }
.seat .seat-bet { font-family: var(--font-mono); color: var(--ivory-dim); font-size: 0.72rem; }
.seat .hand { margin-top: 4px; min-height: 64px; }

.seat .badges { display: flex; gap: 4px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(178, 140, 255, 0.16);
  color: var(--violet);
  border: 1px solid rgba(178, 140, 255, 0.38);
}
.badge.status-busted { background: rgba(255, 90, 78, 0.16); color: var(--danger); border-color: rgba(255, 90, 78, 0.4); }
.badge.status-blackjack { background: rgba(230, 188, 84, 0.16); color: var(--gold); border-color: rgba(230, 188, 84, 0.42); }
.badge.status-stood { background: rgba(243, 237, 221, 0.09); color: var(--ivory-dim); }
.badge.badge-role-allie { background: rgba(243, 237, 221, 0.12); color: var(--ivory); border-color: rgba(243, 237, 221, 0.35); }
.badge.badge-role-infiltre { background: rgba(10, 10, 14, 0.55); color: var(--ivory); border-color: rgba(243, 237, 221, 0.35); }

.energy-bar { height: 4px; border-radius: 2px; background: rgba(243, 237, 221, 0.13); margin-top: 8px; overflow: hidden; }
.energy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--chaos), #FF8AC0);
  box-shadow: 0 0 8px rgba(255, 95, 168, 0.65);
  transition: width 0.6s ease;
  width: 0%;
}

/* flashs de siège */
.seat.flash-bad { animation: flashBad 0.65s ease; }
@keyframes flashBad {
  0%, 100% { box-shadow: none; }
  30% { background: rgba(255, 90, 78, 0.3); box-shadow: 0 0 34px rgba(255, 90, 78, 0.55); }
}
.seat.flash-good { animation: flashGood 0.65s ease; }
@keyframes flashGood {
  0%, 100% { box-shadow: none; }
  30% { background: rgba(111, 227, 160, 0.24); box-shadow: 0 0 34px rgba(111, 227, 160, 0.5); }
}
.seat.shake { animation: seatShake 0.5s ease; }
@keyframes seatShake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---------- panneau latéral ---------- */
.side-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.log-panel {
  background: linear-gradient(180deg, rgba(11, 19, 14, 0.72), rgba(8, 14, 10, 0.6));
  border: 1px solid rgba(243, 237, 221, 0.1);
  border-radius: var(--radius);
  padding: 12px 14px;
  flex: 1;
  min-height: 260px;
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 188, 84, 0.3) transparent;
}
.log-panel h3 { font-family: var(--font-display); letter-spacing: 0.12em; color: var(--gold); font-size: 0.92rem; margin: 0 0 10px; font-weight: 400; }
#log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
#log-list li { font-size: 0.76rem; color: var(--ivory-dim); line-height: 1.35; }
#log-list li.log-new { animation: logIn 0.35s ease both; color: var(--ivory); }
@keyframes logIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid rgba(243, 237, 221, 0.18);
  background: rgba(6, 12, 8, 0.6);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.chat-form input:focus { border-color: rgba(230, 188, 84, 0.5); }

/* ---------- barre de contrôle ---------- */
.control-bar {
  padding: 14px 22px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  background: linear-gradient(0deg, rgba(7, 12, 9, 0.9), rgba(7, 12, 9, 0.7));
  border-top: 1px solid rgba(230, 188, 84, 0.2);
  backdrop-filter: blur(8px);
}
#bet-controls, #turn-controls, #resolution-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctrl-label { font-size: 0.74rem; text-transform: uppercase; color: var(--ivory-dim); letter-spacing: 0.07em; }
.turn-hint { color: var(--chaos); font-weight: 600; animation: hintPulse 1.6s ease-in-out infinite; }
@keyframes hintPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

#bet-amount {
  width: 92px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid rgba(243, 237, 221, 0.18);
  background: rgba(6, 12, 8, 0.6);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.chip-picks { display: flex; gap: 8px; }
.chip-pick {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chip-pick:hover { transform: translateY(-2px) scale(1.07); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); }
.chip-pick[data-bet="10"]  { background: radial-gradient(circle at 35% 30%, #7FDB9A, #3FA36B 65%); border: 3px dashed rgba(10, 40, 24, 0.6); color: #0B2B1A; }
.chip-pick[data-bet="50"]  { background: radial-gradient(circle at 35% 30%, #9CC6FF, #3B7DD8 65%); border: 3px dashed rgba(8, 28, 62, 0.6); color: #0B2244; }
.chip-pick[data-bet="100"] { background: radial-gradient(circle at 35% 30%, #6A7686, #232A33 65%); border: 3px dashed rgba(0, 0, 0, 0.55); color: var(--ivory); }
.chip-pick[data-bet="250"] { background: radial-gradient(circle at 35% 30%, #FF8AC0, #B23A77 65%); border: 3px dashed rgba(70, 8, 40, 0.6); color: #3A0A22; }

/* ---------- main Chaos ---------- */
.chaos-hand { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.chaos-card {
  width: 116px;
  border-radius: 12px;
  padding: 9px 10px 9px 13px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cc, var(--chaos)) 14%, transparent), rgba(8, 14, 10, 0.4));
  border: 1px solid color-mix(in srgb, var(--cc, var(--chaos)) 55%, transparent);
  cursor: pointer;
  position: relative;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.chaos-card::before {
  content: '';
  position: absolute;
  left: 4px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--cc, var(--chaos));
  box-shadow: 0 0 8px color-mix(in srgb, var(--cc, var(--chaos)) 80%, transparent);
}
.chaos-card:hover { transform: translateY(-4px); box-shadow: 0 10px 22px color-mix(in srgb, var(--cc, var(--chaos)) 40%, transparent); }
.chaos-card.disabled { opacity: 0.38; cursor: not-allowed; }
.chaos-card.disabled:hover { transform: none; box-shadow: none; }
.chaos-card.card-pop { animation: cardPop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.3) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes cardPop {
  from { opacity: 0; transform: translateY(16px) scale(0.82); }
  to   { opacity: 1; transform: none; }
}
.chaos-card .cc-family { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--cc, var(--chaos)); margin-bottom: 3px; font-weight: 700; }
.chaos-card .cc-name { font-weight: 700; font-size: 0.75rem; color: var(--ivory); margin-bottom: 3px; }
.chaos-card .cc-desc { font-size: 0.62rem; color: var(--ivory-dim); line-height: 1.3; }

/* ============================================================
   BANNIÈRES
   ============================================================ */
.role-banner, .gameover-banner {
  margin: 10px 22px 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  text-align: center;
  position: relative;
  z-index: 5;
}
.role-banner {
  background: rgba(255, 95, 168, 0.12);
  border: 1px solid rgba(255, 95, 168, 0.45);
  color: #FFA6CF;
  box-shadow: 0 0 24px rgba(255, 95, 168, 0.15);
}
.role-banner.pop { animation: bannerPop 0.6s ease both; }
@keyframes bannerPop {
  0%   { opacity: 0; transform: scale(0.92) translateY(-6px); }
  55%  { transform: scale(1.02); }
  100% { opacity: 1; transform: none; }
}
.gameover-banner {
  background: linear-gradient(90deg, rgba(230, 188, 84, 0.14), rgba(255, 95, 168, 0.14), rgba(230, 188, 84, 0.14));
  border: 1px solid rgba(230, 188, 84, 0.5);
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.25rem;
  box-shadow: 0 0 30px rgba(230, 188, 84, 0.18);
}
.gameover-banner.pop { animation: bannerPop 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }

/* ============================================================
   OVERLAYS
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 7, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: overlayIn 0.18s ease both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.overlay-box {
  background: linear-gradient(180deg, rgba(19, 32, 24, 0.96), rgba(10, 18, 13, 0.97));
  border: 1px solid rgba(230, 188, 84, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
  animation: boxIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
@keyframes boxIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
.overlay-box h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.08em; color: var(--gold); margin-top: 0; font-size: 1.4rem; }
.overlay-sub { font-size: 0.75rem; color: var(--ivory-dim); margin: 14px 0 6px; }

.target-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.target-list button { position: relative; }
.target-list button {
  position: relative;
  background: rgba(243, 237, 221, 0.07);
  border: 1px solid rgba(243, 237, 221, 0.18);
  color: var(--ivory);
  padding: 10px;
  border-radius: 9px;
  font-size: 0.85rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.target-list button .target-chips {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
}
.target-list button:hover { border-color: var(--chaos); background: rgba(255, 95, 168, 0.08); }
.value-picker { margin-bottom: 14px; font-size: 0.78rem; color: var(--ivory-dim); }
#value-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
#value-buttons button {
  width: 36px; height: 36px;
  border-radius: 7px;
  background: rgba(243, 237, 221, 0.07);
  border: 1px solid rgba(243, 237, 221, 0.18);
  color: var(--ivory);
  font-family: var(--font-mono);
  transition: background 0.12s ease, transform 0.12s ease;
}
#value-buttons button:hover { transform: translateY(-1px); }
#value-buttons button.selected { background: var(--chaos); border-color: var(--chaos); color: #2A0B1C; }

.overlay-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* ---------- paramètres ---------- */
.overlay-box-wide { max-width: 660px; text-align: left; max-height: 85vh; overflow-y: auto; }
.overlay-box-wide h3, .overlay-box-wide h4 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.06em; color: var(--gold); }
.overlay-box-wide h4 { margin: 22px 0 10px; font-size: 1.05rem; }
.settings-modes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--ivory-dim);
  cursor: pointer;
}
.toggle-row input {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 22px;
  background: rgba(243, 237, 221, 0.14);
  border: 1px solid rgba(243, 237, 221, 0.22);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.toggle-row input::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: left 0.2s ease, background 0.2s ease;
}
.toggle-row input:checked { background: var(--chaos); border-color: var(--chaos); }
.toggle-row input:checked::after { left: 20px; background: #fff; }

.cards-settings-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.cards-family-group h5 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 8px;
  color: var(--chaos);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cards-family-group h5::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cc, var(--chaos)); box-shadow: 0 0 8px color-mix(in srgb, var(--cc, var(--chaos)) 80%, transparent); }
.cards-family-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .cards-family-grid { grid-template-columns: 1fr; } }
.card-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(243, 237, 221, 0.04);
  border: 1px solid rgba(243, 237, 221, 0.09);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.74rem;
  color: var(--ivory-dim);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.card-toggle:hover { border-color: rgba(255, 95, 168, 0.4); }
.card-toggle input { margin-top: 3px; accent-color: var(--chaos); cursor: pointer; }
.card-toggle strong { color: var(--ivory); display: block; font-size: 0.78rem; }

/* ============================================================
   COUCHE D'EFFETS
   ============================================================ */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }

.float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  animation: floatUp 1.15s ease-out forwards;
}
.float.good    { color: var(--good); }
.float.bad     { color: var(--danger); }
.float.gold    { color: var(--gold); }
.float.neutral { color: var(--ivory-dim); }
.float.small   { font-size: 0.74rem; font-weight: 600; }
.float.big     { font-size: 1.45rem; font-family: var(--font-display); letter-spacing: 0.06em; }
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(0.8); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -165%) scale(1); }
}

.particle {
  position: absolute;
  border-radius: 2px;
  animation: particleFly 0.9s cubic-bezier(0.16, 0.8, 0.3, 1) forwards;
}
@keyframes particleFly {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 0)) rotate(240deg); }
}

/* toast carte Chaos */
.chaos-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 95;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(16, 26, 19, 0.92), rgba(9, 15, 11, 0.94));
  border: 1px solid color-mix(in srgb, var(--cc, var(--chaos)) 65%, transparent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55), 0 0 24px color-mix(in srgb, var(--cc, var(--chaos)) 25%, transparent);
  opacity: 0;
}
.chaos-toast .ct-family {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cc, var(--chaos));
  font-weight: 700;
  border-right: 1px solid rgba(243, 237, 221, 0.15);
  padding-right: 10px;
}
.chaos-toast .ct-name { font-weight: 700; font-size: 0.9rem; color: var(--ivory); }
.chaos-toast.show { animation: toastLife 1.6s ease forwards; }
@keyframes toastLife {
  0%   { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.92); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.02); }
  18%  { transform: translateX(-50%) translateY(0) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(1); }
}

/* ============================================================
   DUEL — deux survivants en mode Élimination
   ============================================================ */
.duel-badge {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  pointer-events: none;
  padding: 7px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(120, 20, 60, 0.92), rgba(58, 8, 32, 0.94));
  border: 1px solid rgba(255, 95, 168, 0.7);
  color: #FFC2DE;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(255, 95, 168, 0.45), 0 8px 22px rgba(0, 0, 0, 0.5);
  animation: duelBadgePulse 1.4s ease-in-out infinite;
}
@keyframes duelBadgePulse {
  0%, 100% { box-shadow: 0 0 16px rgba(255, 95, 168, 0.32), 0 8px 22px rgba(0, 0, 0, 0.5); }
  50%      { box-shadow: 0 0 34px rgba(255, 95, 168, 0.75), 0 8px 22px rgba(0, 0, 0, 0.5); }
}

.duel-splash {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.duel-splash.play { animation: duelSplashLife 3.2s cubic-bezier(0.16, 0.8, 0.3, 1) forwards; }
@keyframes duelSplashLife {
  0%   { opacity: 0; }
  7%   { opacity: 1; }
  78%  { opacity: 1; }
  100% { opacity: 0; }
}

.duel-burst {
  position: absolute;
  width: 640px;
  height: 640px;
  max-width: 96vmin;
  max-height: 96vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 95, 168, 0.3) 0%, rgba(255, 95, 168, 0.08) 45%, transparent 70%);
  transform: scale(0.2);
}
.duel-splash.play .duel-burst { animation: duelBurst 0.9s cubic-bezier(0.16, 0.9, 0.3, 1) 0.05s both; }
@keyframes duelBurst {
  from { transform: scale(0.2); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.duel-words {
  position: relative;
  display: flex;
  gap: clamp(6px, 2vw, 22px);
  font-family: var(--font-display);
  font-size: clamp(5rem, 20vw, 13rem);
  line-height: 1;
  letter-spacing: 0.02em;
  animation: duelFlicker 1.6s linear infinite;
}
.duel-words span {
  display: inline-block;
  background: linear-gradient(180deg, #FFE9F4 0%, var(--chaos) 55%, #C25BFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 95, 168, 0.65));
}
.duel-splash.play .duel-words span { animation: duelLetter 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.duel-splash.play .duel-words span:nth-child(1) { animation-delay: 0.10s; }
.duel-splash.play .duel-words span:nth-child(2) { animation-delay: 0.22s; }
.duel-splash.play .duel-words span:nth-child(3) { animation-delay: 0.34s; }
.duel-splash.play .duel-words span:nth-child(4) { animation-delay: 0.46s; }
@keyframes duelLetter {
  0%   { opacity: 0; transform: translateY(-60px) rotate(-14deg) scale(1.6); }
  60%  { opacity: 1; transform: translateY(6px) rotate(3deg) scale(0.96); }
  100% { opacity: 1; transform: none; }
}
@keyframes duelFlicker {
  0%, 91%  { filter: none; }
  92% { filter: brightness(1.7) drop-shadow(0 0 14px rgba(255, 95, 168, 0.95)); }
  93% { filter: none; }
  96% { filter: brightness(1.35); }
  97% { filter: none; }
  100% { filter: none; }
}

.duel-names {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: clamp(14px, 3vh, 30px);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3.4vw, 2rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
}
.duel-names span { color: var(--pc, var(--chaos)); text-shadow: 0 0 18px color-mix(in srgb, var(--pc, var(--chaos)) 70%, transparent); }
.duel-names i { font-style: normal; color: var(--gold); font-size: 0.7em; animation: duelVs 1s ease-in-out infinite; }
.duel-splash.play .duel-names { animation: duelNamesIn 0.6s ease 0.7s both; }
@keyframes duelNamesIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes duelVs { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.4; } }

.duel-sub {
  position: relative;
  margin-top: 10px;
  font-size: clamp(0.7rem, 1.6vw, 0.95rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  opacity: 0;
}
.duel-splash.play .duel-sub { animation: duelNamesIn 0.6s ease 0.9s both; }

/* ============================================================
   BARRE DU HAUT : audio & sortie de room
   ============================================================ */
.topbar-right { display: flex; align-items: center; gap: 8px; }
.vol-wrap { position: relative; }
.volume-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  z-index: 60;
  background: linear-gradient(180deg, #111A14, #0A0F0C);
  border: 1px solid rgba(230, 188, 84, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 0 26px rgba(230, 188, 84, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: volIn 0.18s ease both;
}
@keyframes volIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.vol-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-align: center;
}
.vol-row { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--ivory); font-weight: 600; }
.vol-row input[type="range"] { width: 100%; accent-color: var(--chaos); cursor: pointer; }

.btn-danger {
  background: rgba(255, 90, 78, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 90, 78, 0.45);
}
.btn-danger:hover { background: rgba(255, 90, 78, 0.18); filter: brightness(1.05); }

/* bannière spectateur */
.spectator-banner {
  margin: 10px 22px 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  text-align: center;
  position: relative;
  z-index: 5;
  background: rgba(98, 184, 255, 0.1);
  border: 1px dashed rgba(98, 184, 255, 0.5);
  color: #A9D6FF;
}

/* siège spectateur */
.seat.spectator {
  opacity: 0.6;
  border-style: dashed;
  border-color: rgba(98, 184, 255, 0.35);
}
.seat.spectator::before { background: linear-gradient(90deg, transparent, #62B8FF, transparent); opacity: 0.4; }
.seat.spectator .avatar { filter: saturate(0.55) brightness(0.9); }
.badge.badge-spectator {
  background: rgba(98, 184, 255, 0.14);
  color: #A9D6FF;
  border-color: rgba(98, 184, 255, 0.45);
}

/* ---------- réglage du nombre de refills ---------- */
.refill-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(243, 237, 221, 0.04);
  border: 1px solid rgba(243, 237, 221, 0.09);
  border-radius: 9px;
  font-size: 0.78rem;
  color: var(--ivory-dim);
  transition: opacity 0.15s ease;
}
.refill-count-row.disabled { opacity: 0.4; pointer-events: none; }
.refill-count-label { font-weight: 600; color: var(--ivory); }
.refill-count-row select {
  background: rgba(243, 237, 221, 0.07);
  color: var(--ivory);
  border: 1px solid rgba(243, 237, 221, 0.25);
  border-radius: 7px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
}
.refill-count-hint { margin-left: auto; font-size: 0.68rem; opacity: 0.75; }

/* ---------- timer de tour (anti-AFK) ---------- */
.turn-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pc, var(--gold)), var(--pc, var(--gold)));
  box-shadow: 0 0 8px color-mix(in srgb, var(--pc, var(--gold)) 70%, transparent);
  opacity: 0;
  transform-origin: left;
  transition: opacity 0.2s ease;
}
.turn-timer.show { opacity: 1; }
.turn-timer.run { animation: turnTimerRun 30s linear forwards; }
@keyframes turnTimerRun {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ---------- bouton d'expulsion (hôte, lobby) ---------- */
.kick-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 90, 78, 0.5);
  background: rgba(255, 90, 78, 0.12);
  color: var(--danger);
  font-size: 0.62rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
  padding: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}
.kick-btn:hover { background: rgba(255, 90, 78, 0.28); transform: scale(1.15); }
.kick-btn.hidden { display: none; }
