/* ---------- Décor ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.backdrop svg { width: 100%; height: 100%; display: block; }

.bg-rays path {
  transform-origin: 60px -60px;
  opacity: .8;
}

/* ---------- Scène du jeu ---------- */

.stage-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* Voile sombre par-dessus la scène (accueil, porte agrandie).
   Un simple fondu d'opacité : bien plus léger qu'un flou sur iPad. */
.stage-veil {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: radial-gradient(ellipse at 50% 50%, rgba(var(--veil-rgb), .55), rgba(var(--veil-deep-rgb), .85));
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}
/* Tableau de bord : fond neutre, le jeu n'apparaît pas derrière (seulement quand on l'ouvre) */
body.at-home .stage-veil { opacity: 1; background: radial-gradient(ellipse at 50% 40%, rgba(var(--veil-rgb), 1), rgb(var(--veil-deep-rgb))); }
body.at-home .stage-wrap,
body.at-home .backdrop { visibility: hidden; }
body.focusing .stage-veil { opacity: 1; }

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1500px;
  height: 1000px;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
}

body.focusing .live-status { opacity: 0; pointer-events: none; }

.plaza {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.doors { position: absolute; inset: 0; }


/* Titre au centre de l'arc */
.stage-title {
  position: absolute;
  left: 50%;
  top: 418px;
  width: 800px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  transition: opacity .6s ease;
}
.stage-title h2 {
  margin: 0;
  font: 600 calc(40px * var(--fs-game, 1))/1.12 var(--font-title);
  text-wrap: balance;
  color: var(--c-game, var(--gold-light));
  letter-spacing: .02em;
  text-shadow: 0 0 22px rgba(255, 196, 110, .55), 0 2px 4px rgba(0, 0, 0, .8);
}
.stage-title p {
  margin: 4px 0 0;
  font: italic 500 calc(31px * var(--fs-game, 1))/1.2 var(--font-text);
  color: var(--c-game, #f7ead0);
  text-shadow: 0 0 14px rgba(0, 0, 0, .9), 0 0 3px rgba(0, 0, 0, .9);
}
.stage-title .flourish { width: 420px; }
body.rolling .stage-title { opacity: .35; }

/* Dé */
.dice-canvas {
  position: absolute;
  left: 470px;
  top: 330px;
  width: 560px;
  height: 670px;
  pointer-events: none;
}
.dice-hit {
  position: absolute;
  left: 680px;
  top: 700px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 0;
  background: transparent;
}

.dice-number {
  position: absolute;
  left: 750px;
  top: 612px;
  transform: translate(-50%, -50%) scale(.4);
  font: 700 120px/1 var(--font-title);
  color: #fff3c4;
  text-shadow: 0 0 20px rgba(255, 200, 100, .95), 0 0 50px rgba(255, 150, 60, .7), 0 3px 4px rgba(60, 20, 0, .8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .6s cubic-bezier(.2, 1.6, .4, 1);
}
.dice-number.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.stage-actions {
  position: absolute;
  left: 50%;
  top: 902px;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
}
.btn-roll {
  min-width: 330px;
  font-size: 30px !important;
  padding: 16px 34px !important;
}

/* Panneaux du mode TikTok */
.live-panel {
  position: absolute;
  top: 610px;
  width: 300px;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--panel-a), var(--panel-b));
  border: 1px solid rgba(var(--accent-rgb), .45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 20px rgba(var(--accent-rgb), .08);
}
.live-players { left: 262px; }
.live-out { right: 262px; }
.live-panel h3 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 600 24px/1.2 var(--font-title);
  color: var(--gold-light);
}
.live-panel .count {
  min-width: 44px;
  padding: 2px 10px;
  border-radius: 99px;
  background: rgba(var(--accent-rgb), .18);
  text-align: center;
  font-size: 22px;
}
.live-out h3 { color: #f3a3a3; }
.live-out .count { background: rgba(240, 120, 120, .18); }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: none;
  font-size: 23px;
  line-height: 1.25;
}
.feed::-webkit-scrollbar { display: none; }
.feed li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(var(--accent-rgb), .12);
}
.feed li.new { animation: feed-in .45s ease; }
.feed li .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li .num { flex: none; font-family: var(--font-title); font-weight: 700; color: var(--gold); }
.feed.out li { color: #f0c2c2; }
.feed.out li .num { color: #e78b8b; font-size: .85em; }
.feed .empty { color: rgba(243, 233, 210, .55); font-style: italic; border: 0; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Porte agrandie ---------- */

.focus {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .55s ease;
}
.focus.closing { opacity: 0; }
.focus-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(60, 30, 80, .25), rgba(0, 0, 0, .55));
}

.focus-door {
  position: relative;
  transform-origin: 50% 50%;
  transition: transform 1.2s cubic-bezier(.45, .05, .2, 1);
}
.focus-door .door {
  left: 50%;
  top: 95.7%;
  width: 100%;
  --s: 1;
}
.focus-door.split { transform: translateX(calc(-1 * min(24vw, 30vh))); }

.focus-door .door-halo { left: -60%; right: -60%; top: -25%; bottom: -10%; }
.focus-door .door.open .door-halo {
  background: radial-gradient(closest-side, rgba(255, 236, 190, .75), rgba(255, 180, 90, .3) 45%, rgba(170, 90, 200, .12) 70%, transparent);
}

/* Particules (au-dessus de tout, sans bloquer les touchers) */
.fx {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}
