/* ===========================================================
   DÉS COQUINS — table de velours, bougies et dés 3D
   =========================================================== */
body.des {
  --theme: #d81f4f;
  --theme-2: #ff6a7d;
  --or: #f2c46b;
  --panneau: rgba(40, 8, 20, 0.85);
  background: radial-gradient(900px 600px at 50% 30%, #3b0a1c, #12040a 70%), #0d0307;
}
.ambiance { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambiance span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: 0.35; animation: lueur 7s ease-in-out infinite alternate; }
.ambiance span:first-child { background: #ff7a2e; left: -30vmax; top: -20vmax; }
.ambiance span:last-child { background: #b0123f; right: -30vmax; bottom: -25vmax; animation-delay: -3s; }
@keyframes lueur { to { opacity: 0.18; transform: scale(1.1); } }

/* ---------- Logo des réglages ---------- */
.des-logo { position: relative; width: 120px; height: 84px; margin: 0 auto; }
.mini-de { position: absolute; width: 60px; height: 60px; border-radius: 14px; background: linear-gradient(145deg, #fffaf0, #e9dcc6); box-shadow: inset -4px -6px 10px rgba(0, 0, 0, 0.18), 0 10px 24px rgba(0, 0, 0, 0.5); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; }
.mini-de i { width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff4a6e, #a3002a); place-self: center; }
.mini-de.r1 { left: 0; top: 14px; transform: rotate(-14deg); animation: mini 3s ease-in-out infinite; }
.mini-de.r1 i:nth-child(1) { grid-area: 1 / 1; } .mini-de.r1 i:nth-child(2) { grid-area: 1 / 3; } .mini-de.r1 i:nth-child(3) { grid-area: 2 / 2; } .mini-de.r1 i:nth-child(4) { grid-area: 3 / 1; } .mini-de.r1 i:nth-child(5) { grid-area: 3 / 3; }
.mini-de.r2 { right: 0; top: 0; transform: rotate(16deg); background: linear-gradient(145deg, #ffe7a1, #c99227); animation: mini 3s ease-in-out -1.5s infinite; }
.mini-de.r2 i { background: radial-gradient(circle at 35% 35%, #7a1430, #3b0614); }
.mini-de.r2 i:nth-child(1) { grid-area: 1 / 3; } .mini-de.r2 i:nth-child(2) { grid-area: 3 / 1; }
@keyframes mini { 50% { translate: 0 -6px; } }

/* ---------- Écran de jeu ---------- */
.table-ecran { gap: 10px; }
.infos { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--or); }
.chaleur { padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; color: #fff; background: #8f7bff; letter-spacing: 0.1em; }
.chaleur.n2 { background: #e0436b; }
.chaleur.n3 { background: linear-gradient(90deg, #ff3d3d, #ff9a2e); box-shadow: 0 0 14px rgba(255, 90, 40, 0.7); }

/* La table : velours, bord en bois verni, liseré doré */
.table {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 30px;
  overflow: hidden;
  cursor: pointer;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 40%, #9b1b3d 0%, #6a0d27 45%, #3a0514 100%);
  box-shadow:
    inset 0 0 0 9px #3b1a0e,
    inset 0 0 0 11px var(--or),
    inset 0 0 0 13px #2a1008,
    inset 0 0 60px 20px rgba(0, 0, 0, 0.6),
    0 20px 50px rgba(0, 0, 0, 0.6);
  -webkit-tap-highlight-color: transparent;
}
.table.occupee { cursor: default; }

/* Bougies */
.bougie { position: absolute; top: 20px; width: 18px; height: 44px; pointer-events: none; z-index: 1; }
.b-gauche { left: 24px; }
.b-droite { right: 24px; }
.bougie .cire { position: absolute; left: 0; bottom: 0; width: 18px; height: 30px; border-radius: 4px 4px 3px 3px; background: linear-gradient(90deg, #e9dcc6, #fffaf0 40%, #d3c3a6); box-shadow: 0 6px 10px rgba(0, 0, 0, 0.5); }
.bougie .flamme { position: absolute; left: 4px; bottom: 28px; width: 10px; height: 18px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 75%, #fff 0 15%, #ffd36b 35%, #ff7a1a 70%, transparent 72%); transform-origin: 50% 100%; animation: flamme 0.18s ease-in-out infinite alternate; filter: blur(0.3px); }
.bougie .halo { position: absolute; left: 50%; bottom: 20px; width: 170px; height: 170px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(255, 170, 70, 0.35), transparent 65%); animation: halo 2.4s ease-in-out infinite alternate; }
@keyframes flamme { from { transform: rotate(-3deg) scaleY(1); } to { transform: rotate(3deg) scaleY(1.12); } }
@keyframes halo { to { opacity: 0.6; transform: translateX(-50%) scale(0.92); } }

/* Pétales de rose */
.petale { position: absolute; left: var(--x); top: var(--y); width: 22px; height: 14px; border-radius: 80% 0 80% 0; background: radial-gradient(circle at 30% 30%, #ff6b88, #9c0f30); transform: rotate(var(--r)); opacity: 0.85; box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4); pointer-events: none; }

.consigne { position: absolute; top: 24px; left: 0; right: 0; margin: 0; padding: 0 52px; text-align: center; font-family: var(--serif); font-style: italic; font-size: clamp(0.95rem, 4.2vw, 1.1rem); line-height: 1.2; color: rgba(255, 230, 210, 0.7); pointer-events: none; transition: opacity 0.3s; z-index: 2; }
.table.occupee .consigne { opacity: 0; }

/* ---------- Dés 3D ---------- */
.piste {
  --s: min(27vw, 14dvh, 112px);
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, var(--s));
  gap: calc(var(--s) * 0.32) calc(var(--s) * 0.42);
  transition: transform 0.6s cubic-bezier(.3, 1.2, .4, 1);
}
.piste { transform-origin: 50% 0; }
.de-boite { position: relative; width: var(--s); height: var(--s); perspective: 700px; }
.de-boite[hidden] { display: block !important; visibility: hidden; }
.cube { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-18deg) rotateY(24deg); }
.face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8%;
  border-radius: 18%;
  text-align: center;
  font-weight: 800;
  font-size: calc(var(--s) * 0.15);
  line-height: 1.1;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: linear-gradient(145deg, #fffaf0, #eadfcb);
  color: #9c0f30;
  box-shadow: inset 0 0 calc(var(--s) * 0.1) rgba(120, 80, 40, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.face:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.face:nth-child(2) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.face:nth-child(3) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.face:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.face:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.face:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
/* Le noyau évite de voir à travers les coins arrondis */
.cube::before { content: ''; position: absolute; inset: 4%; background: #d9c9ad; transform: translateZ(0); border-radius: 10%; }
.de-boite[data-de="zone"] .face { background: linear-gradient(145deg, #2a0d18, #12050a); color: var(--or); box-shadow: inset 0 0 calc(var(--s) * 0.12) rgba(242, 196, 107, 0.25), inset 0 0 0 1px rgba(242, 196, 107, 0.4); }
.de-boite[data-de="zone"] .cube::before { background: #12050a; }
.de-boite[data-de="duree"] .face { background: linear-gradient(145deg, #ff8fab, #d81f4f); color: #fff; font-size: calc(var(--s) * 0.24); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); box-shadow: inset 0 0 calc(var(--s) * 0.12) rgba(80, 0, 20, 0.4); }
.de-boite[data-de="duree"] .cube::before { background: #d81f4f; }
.de-boite.or .face { background: linear-gradient(145deg, #ffe7a1, #c99227); box-shadow: inset 0 0 calc(var(--s) * 0.12) rgba(110, 60, 0, 0.45); }
.de-boite.or .cube::before { background: #c99227; }
.de-boite.or .face { grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 16%; }
.point { width: calc(var(--s) * 0.15); height: calc(var(--s) * 0.15); border-radius: 50%; place-self: center; background: radial-gradient(circle at 35% 35%, #9c1a3c, #3b0614); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.ombre { position: absolute; left: 6%; right: 6%; bottom: -12%; height: 20%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent); }
.nom-de { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 220, 200, 0.55); white-space: nowrap; }
.table.avec-resultat .nom-de { opacity: 0; }
.de-boite.gagnant .face:first-child { box-shadow: 0 0 0 3px var(--or), 0 0 30px var(--or); }
.de-boite.eteint { opacity: 0.35; filter: grayscale(0.6); }

/* ---------- Résultat ---------- */
.resultat {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px 10px;
  border-radius: 22px;
  text-align: center;
  cursor: default;
  background: linear-gradient(180deg, rgba(30, 6, 14, 0.94), rgba(18, 4, 9, 0.97));
  border: 1px solid rgba(242, 196, 107, 0.45);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5), 0 0 40px -10px var(--or);
  animation: monte 0.5s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes monte { from { transform: translateY(40px); opacity: 0; } }
.sens { margin: 0; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--or); }
.phrase { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(1.35rem, min(6.4vw, 3.6dvh), 1.9rem); line-height: 1.15; overflow-wrap: anywhere; }
.pastilles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pastilles span { font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: #ffd9e2; }
.pastilles span.bonus { background: linear-gradient(90deg, #ffe7a1, #c99227); color: #3b1a05; }
.pastilles span.chaud { background: linear-gradient(90deg, #ff3d3d, #ff9a2e); color: #fff; animation: battement 0.8s ease infinite; }
@keyframes battement { 50% { transform: scale(1.08); } }
.r-actions { display: flex; justify-content: center; width: 100%; margin-top: 4px; }
.r-actions .chrono-btn { min-width: 60%; }
.r-actions .btn { padding: 11px 8px; font-size: 0.92rem; }
.chrono-btn { gap: 6px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.18); color: var(--text); }
.chrono-btn svg { width: 22px; height: 22px; transform: rotate(-90deg); flex: none; }
.chrono-btn circle { fill: none; stroke-width: 5; }
.chrono-btn .piste-c { stroke: rgba(255, 255, 255, 0.15); }
.chrono-btn .reste { stroke: var(--or); stroke-dasharray: 100 100; stroke-linecap: round; }
.chrono-btn.fini { border-color: #3ee07f; color: #3ee07f; }
.r-actions .btn.primary { background: linear-gradient(180deg, #4cf08d, #12a24c); color: #04210f; box-shadow: 0 4px 0 #0b6b31; }
.r-petits { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.lien { background: none; border: 0; padding: 4px; color: var(--muted); font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.lien:disabled { opacity: 0.35; cursor: default; }

/* ---------- Joueurs ---------- */
.joueurs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; flex: none; }
.joueur { --c: var(--p0); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 6px; border-radius: 16px; border: 1px solid transparent; transition: all 0.3s; min-width: 0; }
.joueur.p1 { --c: var(--p1); }
.joueur .perso { width: clamp(46px, 9dvh, 70px); aspect-ratio: 100 / 130; filter: brightness(0.75); transition: filter 0.3s; }
.joueur .nom { font-size: 0.8rem; font-weight: 700; color: var(--c); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.joueur .relances { font-size: 0.66rem; color: var(--muted); }
.joueur.actif { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); box-shadow: 0 0 24px -8px var(--c); }
.joueur.actif .perso { filter: none; }
.fleche { font-size: 1.6rem; color: var(--or); align-self: center; transition: transform 0.4s; }
.fleche.retour { transform: scaleX(-1); }
#lancer { flex: none; }
#lancer.fait { background: linear-gradient(180deg, #4cf08d, #12a24c); color: #04210f; box-shadow: 0 6px 0 #0b6b31, 0 14px 30px rgba(18, 162, 76, 0.35); }

/* ---------- Fin ---------- */
.fin .eyebrow { color: var(--or); border-color: rgba(242, 196, 107, 0.4); }
.fin-persos { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: clamp(120px, 26dvh, 200px); }
.fin-persos .perso { height: 100%; aspect-ratio: 100 / 130; }
.coeur-fin { font-size: 2.6rem; color: #ff4f86; text-shadow: 0 0 24px #ff4f86; align-self: center; animation: battement 0.9s ease infinite; }

@media (max-height: 640px) {
  .table-ecran { gap: 7px; }
  .resultat { padding: 12px 10px 6px; gap: 6px; left: 10px; right: 10px; bottom: 10px; }
  .r-actions .btn { padding: 8px 6px; font-size: 0.86rem; }
  .r-petits { gap: 8px; }
  .lien { font-size: 0.74rem; padding: 2px; }
  .pastilles span { font-size: 0.72rem; padding: 3px 8px; }
  .bougie { top: 14px; }
  .btn.gros { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .bougie .flamme, .bougie .halo, .ambiance span, .mini-de { animation: none; }
}
