:root {
  --bg: #0d0f14;
  --felt: #12321f;
  --felt2: #0b2416;
  --panel: #171b24;
  --panel2: #1f2531;
  --line: #2c3444;
  --text: #f2efe6;
  --muted: #9aa3b5;
  --red: #ff4d4d;
  --green: #4ee07a;
  --gold: #ffd34f;
  --blue: #4fc3ff;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .title { font-family: 'Cinzel', 'Cormorant Garamond', system-ui, sans-serif; font-weight: 400; letter-spacing: .02em; }
button { font: inherit; color: inherit; cursor: pointer; }
.offline::after {
  content: 'Connexion perdue… reconnexion'; position: fixed; left: 50%; top: 12px; transform: translateX(-50%);
  background: var(--red); color: #fff; padding: 8px 14px; border-radius: 99px; font-weight: 700; z-index: 99;
}

/* ---------- dés ---------- */
.dice { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 14px 0; min-height: 64px; }
.die {
  --s: 64px;
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * .2);
  background: linear-gradient(145deg, #fffdf6, #e4ddcb);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.45);
  display: grid; padding: calc(var(--s) * .14);
  grid-template-areas: "p1 p2 p3" "p4 p5 p6" "p7 p8 p9";
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  position: relative; transition: transform .15s, box-shadow .15s, opacity .15s;
  user-select: none;
}
.die i { width: 70%; height: 70%; margin: auto; border-radius: 50%; background: #1a1a1a; }
.die b { grid-area: 1 / 1 / 4 / 4; margin: auto; color: #8a8478; font-size: calc(var(--s) * .45); font-family: 'Cinzel', sans-serif; }
.die.pick { cursor: pointer; }
.die.sel { transform: translateY(-10px); box-shadow: 0 0 0 4px var(--gold), 0 14px 20px rgba(0,0,0,.5); }
.die.locked { background: linear-gradient(145deg, #ffe08a, #d9b347); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2), 0 4px 10px rgba(0,0,0,.4); }
.die.locked::after { content: '🔒'; position: absolute; top: -10px; right: -8px; font-size: 16px; }
.die.rolling { animation: shake .14s infinite; }
.die.hit { background: linear-gradient(145deg, #ffb1b1, #ff5d5d); }
.die.hit i { background: #3b0000; }
.die.miss { opacity: .45; }
.die.atk { --s: 56px; background: linear-gradient(145deg, #ff7a7a, #c81e1e); }
.die.atk i { background: #fff; }
.dice.small .die { --s: 50px; }
.die.tiny { --s: 30px; box-shadow: none; }
@keyframes shake {
  0% { transform: rotate(-12deg) translate(-2px, 1px); }
  50% { transform: rotate(10deg) translate(2px, -2px); }
  100% { transform: rotate(-6deg) translate(-1px, 2px); }
}

/* ---------- jauge ---------- */
.gauge { display: grid; grid-template-columns: repeat(26, 1fr); gap: 2px; margin: 12px 0 4px; }
.g { height: 38px; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; position: relative; }
.g small { font-size: 8px; font-weight: 500; opacity: .7; }
.g.atk { background: #6a1717; color: #ffc4c4; }
.g.regen { background: #145c2c; color: #b8ffcb; }
.g.miss { background: #2a2f3b; color: #8b93a5; }
.g.out { opacity: .25; }
.g.now { outline: 3px solid var(--gold); outline-offset: 1px; z-index: 1; }

/* ---------- panneau du tour ---------- */
.turn {
  background: radial-gradient(ellipse at top, var(--felt), var(--felt2));
  border: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
  border-radius: 22px; padding: 18px; text-align: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 18px 40px rgba(0,0,0,.4);
}
.turn.mine { box-shadow: 0 0 0 3px var(--c), 0 0 40px color-mix(in srgb, var(--c) 40%, transparent); }
.who { font-family: 'Cinzel', sans-serif; font-size: 22px; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.round { font-family: 'Cormorant Garamond', sans-serif; font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 99px; }
.hint { color: var(--muted); margin: 8px 0; }
.hint.strong { color: var(--text); font-weight: 700; }
.sum { font-size: 20px; margin: 4px 0; }
.o { margin-left: 8px; padding: 3px 10px; border-radius: 99px; font-size: 15px; font-weight: 700; }
.o.atk { background: #6a1717; color: #ffd0d0; }
.o.regen { background: #145c2c; color: #c4ffd4; }
.o.miss { background: #2a2f3b; color: #c2c8d4; }
.atkline { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 20px; margin: 10px 0; flex-wrap: wrap; }
.atkline em, .banner em { color: var(--gold); font-style: normal; font-weight: 800; }
.aside { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; color: var(--muted); }
.aside b { color: var(--text); font-size: 18px; margin-left: 6px; }
.banner { margin: 12px auto 4px; padding: 12px 16px; border-radius: 14px; font-weight: 800; font-size: 20px; max-width: 520px; animation: pop .3s ease-out; }
.banner.good { background: #145c2c; }
.banner.bad { background: #5c1414; }
.banner.atk { background: #6a1717; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c) 25%, transparent); border: 1px solid var(--c); color: var(--text); font-family: 'Cormorant Garamond', sans-serif; font-weight: 800; font-size: .9em; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; align-items: center; }
button.big {
  width: 100%; max-width: 420px; padding: 18px; border: 0; border-radius: 16px;
  background: var(--gold); color: #1b1400; font-weight: 900; font-size: 20px;
  box-shadow: 0 5px 0 #a8861f; transition: transform .08s;
}
button.big:active { transform: translateY(4px); box-shadow: 0 1px 0 #a8861f; }
button.big.danger { background: var(--red); color: #fff; box-shadow: 0 5px 0 #9c2222; }
button.big.good { background: var(--green); color: #032010; box-shadow: 0 5px 0 #23934a; }
button.big:disabled { opacity: .35; }
button.ghost { background: transparent; border: 2px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 14px; font-weight: 700; width: 100%; max-width: 420px; }
button.mini { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: 12px; }

.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 8px; }
button.target {
  padding: 16px 10px; border-radius: 14px; border: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 18%, var(--panel)); display: flex; flex-direction: column; gap: 4px; align-items: center;
}
button.target span { font-weight: 900; font-size: 18px; }
button.target.random { border-style: dashed; grid-column: 1 / -1; }
button.target b { color: var(--muted); font-weight: 600; }

/* ---------- plateau ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pcard {
  background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--c);
  border-radius: 14px; padding: 10px 12px; position: relative; transition: transform .2s, box-shadow .2s;
}
.pcard.current { box-shadow: 0 0 0 2px var(--c), 0 0 24px color-mix(in srgb, var(--c) 35%, transparent); transform: scale(1.02); }
.pcard.current::before { content: '🎲'; position: absolute; right: 10px; top: 8px; }
.pcard.is-me { background: var(--panel2); }
.pcard.is-dead { background: #121419; border-left-color: #4a4f58; }
.pcard.is-dead > :not(.fx-tomb):not(.fx-dust):not(.fx-hand):not(.fx-layer) { opacity: .45; filter: grayscale(1); }
.pname { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
.pname small { color: var(--muted); font-weight: 500; }
.php { font-family: 'Cinzel', sans-serif; font-size: 34px; line-height: 1.1; margin-top: 4px; }
.php small { font-family: 'Cormorant Garamond', sans-serif; font-size: 13px; color: var(--muted); margin-left: 4px; }
.php.neg { color: var(--red); }
.hpbar { height: 5px; background: #0b0d12; border-radius: 9px; overflow: hidden; margin: 6px 0; }
.hpbar div { height: 100%; background: var(--c); transition: width .4s; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; min-height: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--panel2); }
.badge.dead { background: #333; }
.badge.neg { background: #5c1414; color: #ffc4c4; }
.badge.term { background: #22344f; color: #bfe1ff; }
.badge.bot { background: #2b2440; color: #d9ccff; }
.badge.off { background: #3a3320; color: #ffe39a; }
.badge.win { background: var(--gold); color: #1b1400; }

/* ---------- journal ---------- */
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log li { padding: 8px 10px; border-radius: 10px; background: var(--panel); font-size: 14px; border-left: 4px solid var(--line); }
.log li.attack { border-color: var(--red); }
.log li.good { border-color: var(--green); }
.log li.bad { border-color: #b35a5a; }
.log li.death { border-color: #888; background: #1a1a1a; }
.log li.legend { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.log li.system { border-color: var(--blue); }

/* ---------- options ---------- */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-align: left; }
.opt input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.opt b { display: block; }
.opt small { color: var(--muted); }
.opt.off { opacity: .55; }

.rules h3 { font-size: 15px; margin: 14px 0 4px; color: var(--gold); }
.rules p, .rules li { color: #d6d9e0; line-height: 1.45; margin: 4px 0; }
.rules ul { padding-left: 18px; margin: 4px 0; }

/* ---------- zombies ---------- */
.badge.zombie { background: #24401a; color: #c6ff9e; }
.pcard.is-zombie { background: linear-gradient(160deg, #1d2a16, var(--panel)); }
.pcard.is-zombie .php { color: #9dff6a; }
button.big.zombie { background: #7ccf3f; color: #102204; box-shadow: 0 5px 0 #4b8a1f; }
.banner.zombie { background: #2d5a14; }
.die.zomb { background: linear-gradient(145deg, #c6ff9e, #6fbf3a); }
.log li.zombie { border-color: #7ccf3f; color: #c6ff9e; }

/* ---------- effets : dégâts, soins, morts, zombies ---------- */
.fx-layer { position: absolute; inset: -2px; border-radius: 14px; pointer-events: none; z-index: 2; animation-duration: 1.6s; animation-fill-mode: both; animation-timing-function: ease-out; }
.fx-card-hit { animation-name: fx-hit; }
.fx-card-heal { animation-name: fx-heal; }
.fx-card-death { animation-name: fx-death; }
.fx-card-zombie { animation-name: fx-zomb; }
@keyframes fx-hit {
  0% { background: rgba(255, 40, 40, .55); box-shadow: 0 0 0 3px #ff4d4d, 0 0 30px #ff4d4d; transform: translateX(0); }
  8% { transform: translateX(-8px) rotate(-1.5deg); }
  16% { transform: translateX(7px) rotate(1.5deg); }
  24% { transform: translateX(-5px); }
  32% { transform: translateX(4px); }
  40% { transform: translateX(0); }
  100% { background: rgba(255, 40, 40, 0); box-shadow: 0 0 0 0 transparent; }
}
@keyframes fx-heal {
  0% { background: rgba(78, 224, 122, .45); box-shadow: 0 0 0 3px #4ee07a, 0 0 34px #4ee07a; }
  30% { background: rgba(78, 224, 122, .25); box-shadow: 0 0 0 6px rgba(78, 224, 122, .5), 0 0 40px #4ee07a; }
  100% { background: rgba(78, 224, 122, 0); box-shadow: 0 0 0 0 transparent; }
}
@keyframes fx-death {
  0% { background: rgba(0, 0, 0, 0); }
  20% { background: rgba(0, 0, 0, .7); box-shadow: 0 0 0 3px #888; }
  100% { background: rgba(0, 0, 0, 0); }
}
@keyframes fx-zomb {
  0% { background: rgba(124, 207, 63, .6); box-shadow: 0 0 0 3px #7ccf3f, 0 0 40px #7ccf3f; }
  100% { background: rgba(124, 207, 63, 0); box-shadow: 0 0 0 0 transparent; }
}
.fx-float {
  position: absolute; left: 50%; top: 30%; z-index: 3; pointer-events: none;
  font-family: 'Cinzel', sans-serif; font-size: 34px; text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 18px rgba(0,0,0,.6);
  animation: fx-up 1.6s ease-out both;
}
.fx-float.fx-hit { color: #ff5252; }
.fx-float.fx-heal { color: #6dff98; }
.fx-float.fx-death { font-family: inherit; font-size: 52px; animation-name: fx-drop; }
.fx-float.fx-zombie { font-family: inherit; font-size: 52px; animation-name: fx-rise; }
@keyframes fx-up {
  0% { transform: translate(-50%, 10px) scale(.4); opacity: 0; }
  15% { transform: translate(-50%, -10px) scale(1.35); opacity: 1; }
  30% { transform: translate(-50%, -18px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60px) scale(1); opacity: 0; }
}
@keyframes fx-drop {
  0% { transform: translate(-50%, -70px) scale(1.6) rotate(-20deg); opacity: 0; }
  25% { transform: translate(-50%, -10px) scale(1) rotate(8deg); opacity: 1; }
  35% { transform: translate(-50%, -18px) rotate(-4deg); }
  45% { transform: translate(-50%, -10px) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -10px); opacity: 0; }
}
@keyframes fx-rise {
  0% { transform: translate(-50%, 40px) scale(.3); opacity: 0; }
  30% { transform: translate(-50%, -20px) scale(1.3); opacity: 1; }
  45% { transform: translate(-50%, -10px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -30px); opacity: 0; }
}
.fx-heart {
  position: absolute; bottom: 10px; z-index: 3; pointer-events: none; color: #6dff98; font-size: 20px;
  animation: fx-heart 1.6s ease-out both;
}
.fx-heart:nth-of-type(odd) { font-size: 16px; }
@keyframes fx-heart {
  0% { transform: translateY(0) scale(.5); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-70px) scale(1.2); opacity: 0; }
}
.fx-flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; animation: fx-flash .7s ease-out both;
  background: radial-gradient(ellipse at center, rgba(255, 30, 30, 0) 40%, rgba(255, 30, 30, .55) 100%); }
@keyframes fx-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .fx-layer, .fx-float, .fx-heart, .fx-flash { animation: none !important; display: none; }
}

/* ---------- élixir de vie pendant le soin ---------- */
.fx-potion { position: absolute; right: 8px; top: -46px; width: 62px; z-index: 4; pointer-events: none;
  transform-origin: 50% 80%; animation: fx-potion 1.6s ease-in-out both; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.fx-potion svg { display: block; width: 100%; height: auto; }
@keyframes fx-potion {
  0% { transform: translateY(-20px) scale(.3) rotate(0); opacity: 0; }
  15% { transform: translateY(0) scale(1.1) rotate(0); opacity: 1; }
  25% { transform: scale(1) rotate(0); }
  45% { transform: translate(-6px, 4px) rotate(-55deg); }
  75% { transform: translate(-6px, 4px) rotate(-55deg); opacity: 1; }
  100% { transform: translate(-2px, -10px) rotate(-10deg) scale(.6); opacity: 0; }
}
.fx-drop { position: absolute; right: 52px; top: 8px; width: 7px; height: 10px; z-index: 3; pointer-events: none;
  background: #f0479e; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; box-shadow: 0 0 8px #ff9fd4;
  opacity: 0; animation: fx-drop 1.6s ease-in both; }
.fx-drop:nth-of-type(3n+1) { right: 46px; } .fx-drop:nth-of-type(3n+2) { right: 58px; }
@keyframes fx-drop {
  0%, 42% { transform: translateY(0); opacity: 0; }
  48% { opacity: 1; }
  80% { transform: translateY(46px); opacity: 1; }
  90%, 100% { transform: translateY(54px) scaleY(.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fx-potion, .fx-drop { display: none; } }

/* ---------- épée, éclair, tombe, main de zombie ---------- */
.fx-sword, .fx-bolt, .fx-tomb, .fx-hand { position: absolute; z-index: 4; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.55)); }
.fx-sword svg, .fx-bolt svg, .fx-tomb svg, .fx-hand svg { display: block; width: 100%; height: auto; }

.fx-sword { width: 70px; left: 50%; top: 50%; margin: -35px 0 0 -35px; transform-origin: 80% 85%; animation: fx-sword 1.6s ease-out both; }
@keyframes fx-sword {
  0% { transform: translate(60px, -60px) rotate(-70deg); opacity: 0; }
  10% { transform: translate(40px, -40px) rotate(-70deg); opacity: 1; }
  24% { transform: translate(-10px, 10px) rotate(40deg); opacity: 1; }
  40% { transform: translate(-14px, 12px) rotate(46deg); opacity: 1; }
  70% { opacity: 0; }
  100% { transform: translate(-14px, 12px) rotate(46deg); opacity: 0; }
}
.fx-slash { position: absolute; left: 10%; right: 10%; top: 48%; height: 6px; z-index: 3; pointer-events: none; border-radius: 6px;
  background: linear-gradient(90deg, transparent, #fff 30%, #ff5252 70%, transparent); transform: rotate(-28deg) scaleX(0);
  box-shadow: 0 0 12px #ff5252; animation: fx-slash 1.6s ease-out both; }
@keyframes fx-slash {
  0%, 16% { transform: rotate(-28deg) scaleX(0); opacity: 1; }
  26% { transform: rotate(-28deg) scaleX(1); opacity: 1; }
  55% { transform: rotate(-28deg) scaleX(1.05); opacity: 0; }
  100% { opacity: 0; }
}

.fx-bolt { width: 50px; left: 18%; top: -18px; margin-left: -25px; animation: fx-bolt 1.6s ease-out both; }
@keyframes fx-bolt {
  0% { transform: translateY(-40px) scaleY(.4); opacity: 0; }
  8% { transform: translateY(10px) scaleY(1.2); opacity: 1; }
  12% { opacity: .3; } 16% { opacity: 1; } 20% { opacity: .4; } 26% { opacity: 1; }
  60% { transform: translateY(10px); opacity: 1; }
  100% { transform: translateY(10px); opacity: 0; }
}

.fx-tomb { width: 64px; left: 50%; top: 50%; margin: -40px 0 0 -32px; transform-origin: 50% 100%; animation: fx-tomb 1.6s cubic-bezier(.3, 1.4, .6, 1) both; }
@keyframes fx-tomb {
  0% { transform: translateY(-120px) rotate(-12deg); opacity: 0; }
  30% { transform: translateY(0) rotate(0) scaleY(.85); opacity: 1; }
  40% { transform: translateY(-6px) scaleY(1.05); }
  50% { transform: translateY(0) scaleY(1); opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
.fx-dust { position: absolute; left: 20%; right: 20%; top: 74%; height: 14px; z-index: 3; pointer-events: none; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(200, 190, 170, .8), transparent 70%); opacity: 0; animation: fx-dust 1.6s ease-out both; }
@keyframes fx-dust { 0%, 28% { opacity: 0; transform: scaleX(.3); } 34% { opacity: 1; } 70% { opacity: 0; transform: scaleX(1.6); } 100% { opacity: 0; } }

.fx-hand { width: 64px; left: 50%; bottom: 0; margin-left: -32px; animation: fx-hand 1.6s ease-out both; }
@keyframes fx-hand {
  0% { transform: translateY(40px) scaleY(.2); opacity: 0; }
  25% { transform: translateY(-6px) scaleY(1.1); opacity: 1; }
  35% { transform: translateY(0) rotate(-6deg); }
  48% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); opacity: 1; }
  100% { transform: translateY(10px) rotate(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fx-sword, .fx-slash, .fx-bolt, .fx-tomb, .fx-dust, .fx-hand { display: none; } }

/* ---------- difficulté ---------- */
.modes { display: flex; flex-direction: column; gap: 8px; }
button.mode { text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
button.mode b { display: block; }
button.mode small { color: var(--muted); }
button.mode.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--panel)); }
.mode-badge { font-family: 'Cormorant Garamond', sans-serif; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.mode-badge.mode-hard { border-color: #ff9a4f; }
.mode-badge.mode-hardcore { border-color: #ff4d4d; }
.mode-badge.mode-pgm { border-color: #c88bff; background: #2b2440; }
/* dé gardé en mode PGM : face cachée */
.die.hidden { background: linear-gradient(145deg, #3a2f52, #1f1830); box-shadow: inset 0 -4px 0 rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.4); }
.die.hidden b { color: #c88bff; }

/* ---------- dé du logo ---------- */
.logo-die {
  --s: .68em;
  /* boîte fixe : overflow hidden => son bas sert de ligne d'appui, quelle que soit la face.
     Bungee : capitales hautes de 0,725 em, centre à 0,36 em ; dé de 0,68 em => bas à 0,02 em. */
  display: inline-block; overflow: hidden; vertical-align: .02em; margin-left: .18em; cursor: pointer;
  width: var(--s); height: var(--s); border-radius: 22%; padding: .07em; flex: none;
  will-change: transform;
  background: linear-gradient(145deg, #fffdf6, #e4ddcb);
  box-shadow: inset 0 -0.08em 0 rgba(0,0,0,.18), 0 .08em .2em rgba(0,0,0,.45);
  transform: rotate(-12deg);
}
.logo-die .pips {
  display: grid; width: 100%; height: 100%;
  grid-template-areas: "p1 p2 p3" "p4 p5 p6" "p7 p8 p9";
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.logo-die i { width: 70%; height: 70%; margin: auto; border-radius: 50%; background: #1a1a1a; }
/* le 1 rouge est à peine plus gros que les autres points : le dé ne semble pas changer de taille */
.logo-die.one i { width: 84%; height: 84%; background: radial-gradient(circle at 35% 35%, #ff7b7b, #d81b1b 60%, #8f0d0d); }
/* une rotation continue qui ralentit, et un petit saut séparé : jamais de grossissement */
.logo-die.rolling { animation: logo-spin 1.1s cubic-bezier(.15, .7, .25, 1) both, logo-hop 1.1s ease-out both; }
@keyframes logo-spin { from { transform: rotate(-12deg); } to { transform: rotate(708deg); } }
@keyframes logo-hop {
  0% { translate: 0 0; }
  22% { translate: 0 -.28em; }
  55% { translate: 0 0; }
  70% { translate: 0 -.07em; }
  85%, 100% { translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) { .logo-die.rolling { animation: none; } }

/* ---------- barre d'outils (son, plein écran) ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; }
.sound-btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 16px; line-height: 1; }
.sound-btn:hover { border-color: var(--gold); }

/* ---------- ordre de passage ---------- */
.badge.next { background: #1d3a52; color: #bfe6ff; }
.when { margin: -6px 0 12px; padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 700; text-align: center; }
.when.soon { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); animation: when-pulse 1.6s ease-in-out infinite; }
.when.dead { color: #9aa3b5; }
@keyframes when-pulse { 50% { background: color-mix(in srgb, var(--gold) 12%, var(--panel)); } }

/* ---------- bilan de fin de partie ---------- */
.recap { display: flex; flex-direction: column; gap: 16px; text-align: left; max-width: 1000px; margin: 0 auto; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.award { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 12px; padding: 10px 12px; }
.aw-icon { font-size: 28px; }
.award small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.award b { display: block; font-size: 16px; }
.award em { font-style: normal; color: var(--gold); font-size: 13px; font-weight: 700; }
table.stats { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.stats th:first-child, table.stats td:first-child { text-align: left; }
table.stats tr.me td { background: var(--panel2); font-weight: 800; }
.dotc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; }

/* ---------- arène ---------- */
.arena { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(ellipse 80% 60% at 50% 100%, #3a2a1a 0%, #1c1510 45%, #0d0f14 100%); }
.arena::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 200, 120, .12), transparent 70%); }
.arena-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  background: linear-gradient(180deg, #2a1f16, #1a130d); border-top: 2px solid #3e2e20; }
.arena-stage { position: absolute; inset: 0 2% 6% 2%; display: flex; align-items: flex-end; justify-content: space-evenly; gap: 1%; }
.arena.shake { animation: arena-shake .5s ease-out; }
@keyframes arena-shake { 10%, 50% { transform: translate(-8px, 3px); } 30%, 70% { transform: translate(8px, -3px); } 90% { transform: translate(-3px, 1px); } }

.hero { --dir: 1; position: relative; flex: 0 1 calc(min(240px, 96% / var(--n, 4))); height: 86%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; transition: transform .35s ease, opacity .3s; }
.hero .body { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; transform-origin: 50% 100%; }
.hero .fig { width: 100%; max-height: 100%; aspect-ratio: 100 / 142; display: flex; align-items: flex-end; transform-origin: 50% 100%;
  animation: hero-idle 2.6s ease-in-out infinite; }
.hero:nth-child(2n) .fig { animation-delay: -1.3s; }
.hero:nth-child(3n) .fig { animation-duration: 2.9s; }
.hero .hero-svg { width: 100%; height: auto; overflow: visible; }
@keyframes hero-idle { 50% { transform: translateY(-2.5%) scaleY(1.015); } }
.hero .hname { margin-top: 4px; font-weight: 800; font-size: clamp(11px, 1.1vw, 16px); color: var(--c); text-shadow: 0 2px 4px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hero .spot { position: absolute; bottom: 14px; left: 50%; width: 120%; height: 30px; transform: translateX(-50%); border-radius: 50%; opacity: 0;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--c) 70%, transparent), transparent 70%); transition: opacity .3s; }
.hero .reticle { position: absolute; top: 0; left: 50%; transform: translate(-50%, -30%); font-size: clamp(20px, 2.2vw, 34px); opacity: 0; transition: opacity .2s; }

/* joueur dont c'est le tour : il s'avance, lumière à ses pieds */
.hero.active { transform: translateY(-4%) scale(1.08); z-index: 2; }
.hero.active .spot { opacity: 1; }
/* il vise : arme levée, il se penche vers la cible */
.hero.aiming .body { transform: rotate(calc(var(--dir) * 5deg)); transition: transform .3s; }
/* il est visé : cible au-dessus de la tête, il tremble un peu */
.hero.targeted .reticle { opacity: 1; animation: reticle 1s ease-in-out infinite; }
.hero.targeted .body { animation: scared .35s ease-in-out infinite; }
@keyframes reticle { 50% { transform: translate(-50%, -30%) scale(1.25); } }
@keyframes scared { 25% { transform: translateX(-1.5%); } 75% { transform: translateX(1.5%); } }

/* l'attaquant frappe à chaque lancer */
.hero.strike .body { animation: strike .5s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes strike {
  30% { transform: translateX(calc(var(--dir) * -10%)) rotate(calc(var(--dir) * -8deg)); }
  55% { transform: translateX(calc(var(--dir) * 38%)) rotate(calc(var(--dir) * 14deg)); }
  100% { transform: none; }
}
/* coups reçus */
.hero.hurt .body { animation: hurt .8s ease-out; }
.hero.hurt-big .body { animation: hurt-big .9s ease-out; }
@keyframes hurt {
  0% { filter: brightness(2.2) sepia(1) hue-rotate(-40deg) saturate(6); transform: translateX(0); }
  15% { transform: translateX(-9%) rotate(-6deg); }
  35% { transform: translateX(6%) rotate(3deg); filter: none; }
  55% { transform: translateX(-3%); }
  100% { transform: none; }
}
@keyframes hurt-big {
  0% { filter: brightness(2.6) sepia(1) hue-rotate(-40deg) saturate(8); }
  12% { transform: translate(-22%, -8%) rotate(-24deg); }
  30% { transform: translate(-10%, 0) rotate(-10deg); filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(5); }
  50% { transform: translate(4%, 0) rotate(4deg); filter: none; }
  100% { transform: none; }
}
/* soin : halo vert et étincelles */
.hero.healed .body { animation: healed 1.2s ease-out; }
.hero.healed::after { content: '✦ ✧ ✦'; position: absolute; left: 50%; bottom: 40%; transform: translateX(-50%); color: #7dff9e; font-size: clamp(16px, 1.8vw, 26px); letter-spacing: .3em; animation: sparkle 1.2s ease-out forwards; pointer-events: none; }
@keyframes healed { 0% { filter: drop-shadow(0 0 0 #4ee07a); } 30% { filter: drop-shadow(0 0 18px #4ee07a) brightness(1.25); transform: translateY(-4%); } 100% { filter: none; transform: none; } }
@keyframes sparkle { 0% { opacity: 0; transform: translate(-50%, 20px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60px); } }
/* au bord de la mort : à genoux */
.hero.kneel .fig { animation: none; transform: translateY(6%) scaleY(.88) rotate(-6deg); filter: saturate(.7); }
/* mort : il tombe, puis la tombe surgit */
.hero.falling .body { animation: fall .85s ease-in forwards; }
@keyframes fall { 0% { transform: none; } 40% { transform: rotate(-12deg); } 100% { transform: rotate(-88deg) translateX(-10%); opacity: .2; filter: grayscale(1); } }
.hero.buried .fig { animation: buried .8s cubic-bezier(.3, 1.4, .6, 1); }
@keyframes buried { 0% { transform: translateY(-60%); opacity: 0; } 60% { transform: translateY(4%); opacity: 1; } 100% { transform: none; } }
.hero.dead .fig { animation: none; }
.hero.dead .hname { color: #777; text-decoration: line-through; }
.hero .tomb { width: 70%; margin: 0 auto; }
.hero .tomb svg { width: 100%; height: auto; display: block; }
/* zombie : il sort de terre et titube */
.hero.zombie .fig { animation: zombie-sway 1.8s ease-in-out infinite; }
@keyframes zombie-sway { 25% { transform: rotate(-4deg) translateX(-2%); } 75% { transform: rotate(4deg) translateX(2%); } }
.hero.rising .body { animation: rise 1s ease-out; }
@keyframes rise { 0% { transform: translateY(70%) scaleY(.4); opacity: 0; } 60% { transform: translateY(-6%); opacity: 1; } 100% { transform: none; } }

/* chiffres qui s'envolent au-dessus du héros */
.afloat { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font-family: 'Cinzel', sans-serif; font-size: clamp(22px, 2.6vw, 44px);
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 16px rgba(0,0,0,.7); pointer-events: none; animation: afloat 1.4s ease-out forwards; z-index: 5; }
.afloat.hit { color: #ff5252; }
.afloat.heal { color: #6dff98; }
@keyframes afloat { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.3); } 30% { transform: translate(-50%, -12px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70px); } }

@media (prefers-reduced-motion: reduce) {
  .hero .fig, .hero.targeted .body, .hero.zombie .fig { animation: none; }
}

/* ---------- téléphone : choix du personnage ---------- */
.hero-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hp-btn { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hp-btn svg { width: 64px; height: auto; display: block; }
.hp-btn span { font-size: 13px; font-weight: 800; }
.hp-btn.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--panel)); }

/* ---------- scènes de combat ---------- */
.arena-stage { transition: opacity .35s ease; }
.arena.in-scene .arena-stage { opacity: 0; }
.arena-scene { position: absolute; inset: 0; pointer-events: none; }
/* min-width: 0 : la largeur suit uniquement la hauteur (aspect-ratio), jamais la longueur du nom (sinon un long pseudo grossit le héros) */
.shero { position: absolute; bottom: 7%; height: 80%; aspect-ratio: 100 / 152; min-width: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; animation: shero-in .35s ease-out; }
.arena-scene.crowd .shero { height: 60%; }
.shero .body { width: 100%; flex: 1; display: flex; align-items: flex-end; justify-content: center; transform-origin: 50% 100%; }
.shero .fig { width: 100%; animation: hero-idle 2.4s ease-in-out infinite; }
.shero .hero-svg { width: 100%; height: auto; display: block; overflow: visible; }
.shero.mirrored .hero-svg { transform: scaleX(-1); }
.shero .tomb { width: 70%; margin: 0 auto; }
.shero .tomb svg { width: 100%; height: auto; display: block; }
.shero .ring { position: absolute; bottom: 4.5%; left: 50%; width: 92%; height: 7%; transform: translateX(-50%); border-radius: 50%;
  border: 3px solid var(--c); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 60%, transparent); opacity: .85; }
.arena-scene.crowd .shero .hname { font-size: clamp(11px, 1vw, 16px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.shero .hname { font-weight: 900; font-size: clamp(14px, 1.5vw, 22px); color: var(--c); text-shadow: 0 2px 4px #000; margin-top: 4px; white-space: nowrap; }
.shero.healed .body { animation: healed 1.2s ease-out; }
@keyframes shero-in { from { opacity: 0; transform: translateX(-50%) translateY(8%) scale(.92); } to { opacity: 1; transform: translateX(-50%); } }
.arena-scene.heal-scene { background: radial-gradient(ellipse 40% 60% at 50% 70%, rgba(78, 224, 122, .14), transparent 70%); }
.afx { position: absolute; pointer-events: none; z-index: 6; }
.afx svg { width: 100%; height: 100%; display: block; overflow: visible; }
.afx.potion svg { height: auto; }
.afx.proj.spell { filter: drop-shadow(0 0 12px #7fd8ff); }
.afloat.big { font-size: clamp(30px, 3.4vw, 60px); }
.afloat.touch { color: #ffd34f; font-size: clamp(16px, 1.6vw, 26px); top: 6%; }
.afloat.dodge { color: #bfe6ff; font-size: clamp(16px, 1.6vw, 26px); top: 6%; }

/* ---------- bandeau de tour ---------- */
.turn-banner { position: absolute; left: 0; right: 0; top: 50%; z-index: 20; display: flex; align-items: center; justify-content: center; gap: 2%;
  padding: 1.2% 0; transform: translateY(-50%); pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 35%, #0d0f14) 20%, color-mix(in srgb, var(--c) 35%, #0d0f14) 80%, transparent);
  border-top: 3px solid var(--c); border-bottom: 3px solid var(--c); animation: tb 2s cubic-bezier(.2, .8, .2, 1) forwards; }
.tb-hero { width: clamp(70px, 9vw, 140px); }
.tb-hero svg { width: 100%; height: auto; display: block; }
.tb-text small { display: block; color: var(--muted); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: clamp(12px, 1.1vw, 18px); }
.tb-text b { font-family: 'Cinzel', sans-serif; font-weight: 400; font-size: clamp(26px, 3.4vw, 60px); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
@keyframes tb {
  0% { transform: translate(-110%, -50%) skewX(-12deg); opacity: 0; }
  14% { transform: translate(0, -50%) skewX(0); opacity: 1; }
  80% { transform: translate(0, -50%); opacity: 1; }
  100% { transform: translate(110%, -50%) skewX(12deg); opacity: 0; }
}

/* ---------- podium ---------- */
.podium { position: relative; height: clamp(260px, 42vh, 460px); max-width: 1100px; margin: 0 auto 10px; overflow: hidden;
  border-radius: 22px; background: radial-gradient(ellipse 60% 70% at 50% 100%, #3a2a1a, #120e0a 70%); border: 1px solid var(--line); }
.pd-row { position: absolute; left: 0; right: 0; bottom: 6%; display: flex; justify-content: space-between; padding: 0 3%; gap: 2%; }
.pd-hero { display: flex; flex-direction: column; align-items: center; }
.pd-side { flex: 1; display: flex; justify-content: space-evenly; align-items: flex-end; gap: 2%; }
.pd-gap { flex: 0 0 30%; }
.pd-hero.loser { width: clamp(60px, 22%, 120px); opacity: .85; }
.pd-hero.loser .pd-fig { filter: saturate(.75) brightness(.85); }
.pd-fig { width: 100%; }
.pd-fig svg { width: 100%; height: auto; display: block; }
.pd-name { font-weight: 900; color: var(--c); text-shadow: 0 2px 4px #000; font-size: clamp(12px, 1.2vw, 18px); white-space: nowrap; }
.pd-winner { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: clamp(150px, 22%, 260px); display: flex; flex-direction: column; align-items: center; z-index: 2; }
.pd-hero.winner { width: 100%; animation: pd-jump 1.1s ease-in-out infinite; }
.pd-hero.winner .pd-name { font-size: clamp(16px, 1.8vw, 28px); }
.pd-step { width: 120%; height: clamp(40px, 7vh, 80px); background: linear-gradient(180deg, #ffd34f, #b8901f); border-radius: 10px 10px 0 0;
  display: flex; align-items: center; justify-content: center; font-family: 'Cinzel', sans-serif; font-size: clamp(22px, 3vw, 44px); color: #3a2a00; box-shadow: 0 -4px 30px rgba(255, 211, 79, .35); }
@keyframes pd-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12%); } 55% { transform: translateY(0) scaleY(.94); } }
@keyframes pd-arm { 0%, 100% { transform: rotate(-150deg); } 40% { transform: rotate(-170deg); } }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 9px; height: 15px; background: var(--k); transform: rotate(var(--r));
  animation: confetti 3.2s linear var(--d) infinite; opacity: .9; }
@keyframes confetti { to { transform: translateY(520px) rotate(calc(var(--r) + 540deg)); } }
.podium.nobody .pd-row { justify-content: center; gap: 4%; }
.winner-hero { width: 110px; margin: 0 auto; }
.winner-hero svg { width: 100%; height: auto; display: block; }
@media (prefers-reduced-motion: reduce) { .turn-banner, .pd-hero.winner, .confetti i { animation: none; } }

/* un nom long ne doit jamais élargir la page : les cartes peuvent rétrécir */
.pcard { min-width: 0; }
.chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
button.target { min-width: 0; }
button.target span { max-width: 100%; overflow-wrap: anywhere; }
.targets { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); }
table.stats { table-layout: fixed; }
table.stats th:first-child, table.stats td:first-child { width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award { min-width: 0; }
.award b { overflow-wrap: anywhere; }
/* un pseudo très long (ou sans espace) coupe plutôt que de déborder */
h1, h2, h3, .who, .banner, .msg, .hname, .pd-name, .tb-text b, .log li { overflow-wrap: anywhere; }

/* bouton son : clignote tant que le navigateur attend un premier clic pour autoriser le son */
.sound-btn.needs-unlock { animation: needs-unlock 1s ease-in-out infinite; border-color: var(--gold); }
@keyframes needs-unlock { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 45%, transparent); } }

/* le nom déborde du cadre du héros, centré, sans l'élargir */
.shero .hname { width: max-content; max-width: none; overflow: visible; }
