/* ===== Podium du raid de ville (js/podium.js, podiumCheck / podiumShow dans game.js) =====
   Même habillage que la visite de Melina (css/melina.css) : nuit sur l'illustration du raid, lucioles (canvas), projecteurs,
   titre, phrase tapée, marches 4e · 2e · 1er · 3e · 5e, couronne, carte crème unie arrondie sans contour. */
dialog#podium-dialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; box-sizing: border-box;
  border: 0; background: none; color: #3a2412; overflow: hidden; cursor: default; }
dialog#podium-dialog[open] { display: flex; flex-direction: column; align-items: center; }
dialog#podium-dialog::backdrop { background: rgba(4, 6, 12, .6); }
#podium-dialog.pd-load > :not(.pd-sky) { visibility: hidden; }

.pd-sky { position: fixed; inset: 0; opacity: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 22% 26% at 82% 12%, rgba(220, 232, 255, .34), transparent 70%),
    radial-gradient(ellipse 60% 34% at 50% 104%, rgba(255, 200, 110, .3), transparent 72%),
    linear-gradient(180deg, rgba(8, 14, 36, .82) 0%, rgba(16, 26, 52, .7) 45%, rgba(10, 14, 22, .9) 100%),
    url("../img/fond/raid_montagne.jpg") center / cover no-repeat; }
.pd-sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(0, 0, 0, .6) 100%); }
#podium-dialog canvas { position: fixed; left: 0; top: 0; pointer-events: none; }
.pd-back { z-index: 1; }
.pd-front { z-index: 7; }

/* Projecteurs : deux faisceaux partis des coins hauts, un halo doré sur le 1er */
.pd-beams { position: fixed; inset: 0; z-index: 2; opacity: 0; pointer-events: none; overflow: hidden; }
.pd-beam { position: absolute; top: -6vh; width: 26vw; height: 120vh; mix-blend-mode: screen;
  background: linear-gradient(180deg, rgba(255, 238, 190, .42), rgba(255, 230, 170, .08) 70%, transparent);
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%); }
.pd-beam-l { left: 6vw; transform-origin: 50% 0; }
.pd-beam-r { right: 6vw; transform-origin: 50% 0; }
.pd-halo { position: absolute; left: 50%; bottom: 0; width: 46vw; height: 70vh; transform: translateX(-50%); opacity: 0;
  background: radial-gradient(ellipse 50% 60% at 50% 70%, rgba(255, 214, 120, .34), transparent 70%); }

/* Titre et phrase */
.pd-head { position: relative; z-index: 3; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 24px 0; pointer-events: none; text-align: center; }
.pd-title { margin: 0; color: #ffe7a6; font: normal clamp(34px, 4.4vw, 56px)/1.05 var(--font-title); letter-spacing: .02em; opacity: 0;
  text-shadow: 0 3px 0 #7a4a12, 0 6px 18px rgba(0, 0, 0, .65), 0 0 30px rgba(255, 210, 120, .5); }
.pd-say { margin: 0; max-width: min(720px, 80vw); padding: 10px 22px; border-radius: 18px; background: #fdf3d6; color: #3a2412;
  font: normal 20px/1.3 var(--font-title); box-shadow: 0 8px 18px rgba(0, 0, 0, .5), inset 0 -3px 0 rgba(150, 105, 50, .3);
  opacity: 0; transform: scale(.6); transition: opacity .2s, transform .35s cubic-bezier(.2, .9, .3, 1.5); }
.pd-say.on { opacity: 1; transform: none; }
.pd-hidden { color: transparent; }

/* Scène : le podium puis la carte */
.pd-stage { position: relative; z-index: 3; flex: 1 1 auto; min-height: 0; width: 100%; box-sizing: border-box; padding: 16px 24px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 14px; pointer-events: none; }
.pd-podium { --maxh: min(20vh, 260px); --bw: clamp(130px, 14vw, 196px); display: flex; align-items: flex-end; justify-content: center; gap: 12px; flex: none;
  padding-top: 52px; clip-path: inset(-100vh -50vw 0 -50vw); /* les marches sortent du sol : rien ne dépasse sous la ligne */ }
.pd-step { width: var(--bw); display: flex; flex-direction: column; align-items: center; gap: 10px; visibility: hidden;
  transform: translateY(calc((1 - var(--rise, 0)) * 110%)); will-change: transform; }
.pd-step.on { visibility: visible; }
.pd-block { position: relative; width: 100%; height: calc(var(--maxh) * var(--h)); min-height: 64px; border-radius: 12px 12px 0 0;
  display: flex; justify-content: center; padding-top: 10px; box-sizing: border-box;
  background: linear-gradient(180deg, var(--c1), var(--c2)); box-shadow: inset 0 6px 0 rgba(255, 255, 255, .35), inset 0 -18px 30px rgba(0, 0, 0, .3), 0 14px 30px rgba(0, 0, 0, .5); }
.pd-num { font: normal clamp(36px, 4vw, 60px)/1 var(--font-title); color: #fff8e6; text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 16px rgba(255, 255, 255, .25); }
.pd-r1 { --c1: #ffe08a; --c2: #c98a1c; }
.pd-r2 { --c1: #eef1f6; --c2: #8e9aab; }
.pd-r3 { --c1: #f0b98a; --c2: #9a5a2a; }
.pd-r4, .pd-r5 { --c1: #b9a68a; --c2: #6e5a42; }
.pd-r4 .pd-num, .pd-r5 .pd-num { font-size: clamp(30px, 3vw, 44px); }

/* Plaque du boutiquier au-dessus de sa marche */
.pd-who { position: relative; width: 100%; box-sizing: border-box; padding: 10px 10px 8px; border-radius: 16px; background: #fbf0d8; box-shadow: 0 10px 24px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; opacity: 0; transform-origin: 50% 100%; }
.pd-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: normal 20px/1.15 var(--font-title); color: #3a2412; }
.pd-r1 .pd-name { font-size: 24px; color: #8a5a00; }
.pd-name.pd-long { font-size: 16px; } /* pseudo long (12 à 16 caractères) : tient sur la plaque */
.pd-ore { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; font-weight: 700; color: #4b3420; font-variant-numeric: tabular-nums; }
.pd-ore img { width: 22px; height: 22px; object-fit: contain; }
.pd-gains .rw-gains { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 14px; }
.pd-gains .rw-gains img { width: 22px; height: 22px; vertical-align: middle; }
.pd-step.me .pd-who { background: #fff6d8; box-shadow: 0 0 0 3px #ffd36b, 0 0 26px rgba(255, 211, 107, .85), 0 10px 24px rgba(0, 0, 0, .55); }
.pd-you { padding: 3px 12px 2px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(180deg, #6cc35a, #2f6a2a); color: #fff8e6; font: normal 15px/1.1 var(--font-title); box-shadow: 0 4px 10px rgba(0, 0, 0, .4); }

/* Portrait choisi dans le profil (players.chat_avatar), en médaillon qui déborde du haut de la plaque */
.pd-face { --fs: 64px; width: var(--fs); height: var(--fs); margin: calc(var(--fs) * -.62) 0 2px; flex: none; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #fff6dd, var(--c1) 70%, var(--c2)); box-shadow: 0 0 0 3px var(--c1), 0 6px 14px rgba(0, 0, 0, .5); }
.pd-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-r1 .pd-face { --fs: 78px; }
.pd-step.me .pd-face { box-shadow: 0 0 0 3px #ffd36b, 0 0 18px rgba(255, 211, 107, .9), 0 6px 14px rgba(0, 0, 0, .5); }
/* Place libre (moins de 5 contributeurs) : la marche reste, plaque estompée sans portrait */
.pd-step.empty .pd-who { background: rgba(251, 240, 216, .6); }
.pd-step.empty .pd-face { background: rgba(255, 246, 221, .35); box-shadow: 0 6px 14px rgba(0, 0, 0, .35); }
.pd-step.empty .pd-name { font-size: 16px; color: #6b5238; }

/* Thomas (pantin WebGL, à gauche) et Melina (portrait, à droite) viennent féliciter */
.pd-thomas, .pd-mel { position: fixed; z-index: 4; left: 0; top: 0; opacity: 0; pointer-events: none; will-change: transform; }
.pd-thomas { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); }
.pd-mel { height: auto; transform-origin: 50% 100%; filter: drop-shadow(0 0 26px rgba(255, 214, 140, .28)) drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); }
.pd-bub { position: fixed; z-index: 8; left: -999px; top: 0; width: 240px; box-sizing: border-box; padding: 12px 16px; border-radius: 18px;
  background: #fdf3d6; color: #3a2412; font: normal 19px/1.3 var(--font-title); pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .5), inset 0 -3px 0 rgba(150, 105, 50, .3);
  opacity: 0; transform: scale(.5); transform-origin: var(--tail, 50%) 100%; transition: opacity .2s, transform .35s cubic-bezier(.2, .9, .3, 1.5); }
.pd-bub.on { opacity: 1; transform: none; }
.pd-bub::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -13px; margin-left: -10px; border: 10px solid transparent; border-bottom: 0; border-top: 14px solid #fdf3d6; }
.pd-bh { color: transparent; }

/* Couronne qui tombe sur le vainqueur */
.pd-crown { position: fixed; z-index: 6; left: 0; top: 0; width: clamp(54px, 5vw, 76px); height: auto; opacity: 0; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 0 14px rgba(255, 214, 120, .8)) drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }

/* Carte finale */
.pd-card { width: min(560px, calc(100vw - 48px)); box-sizing: border-box; padding: 16px 22px 14px; border-radius: 20px; flex: none;
  background: #fbf0d8; box-shadow: 0 18px 40px rgba(0, 0, 0, .6); font-size: 16px; line-height: 1.45;
  opacity: 0; transform: translateY(18px); transition: opacity .35s, transform .45s cubic-bezier(.2, .9, .3, 1.2); }
.pd-card.on { opacity: 1; transform: none; pointer-events: auto; }
.pd-card h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font: normal 24px/1.15 var(--font-title); color: #2f6a2a; }
.pd-card h3 img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.pd-body p { margin: 0 0 6px; }
.pd-body .pd-inline { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.pd-body .pd-inline img { width: 20px; height: 20px; object-fit: contain; }
.pd-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.pd-skip { position: fixed; z-index: 9; right: 24px; top: 20px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.pd-skip[hidden] { display: none; }

/* Sans animation (fenêtre étroite, images absentes) : tout en place, défilement si besoin */
#podium-dialog.pd-still canvas, #podium-dialog.pd-still .pd-beams, #podium-dialog.pd-still .pd-skip, #podium-dialog.pd-still .pd-crown,
#podium-dialog.pd-still .pd-mel, #podium-dialog.pd-still .pd-bub { display: none; }
#podium-dialog.pd-still { overflow-y: auto; }
#podium-dialog.pd-still .pd-sky { opacity: 1; }
#podium-dialog.pd-still .pd-title { opacity: 1; }
#podium-dialog.pd-still .pd-who { opacity: 1; }
#podium-dialog.pd-still .pd-podium { --maxh: 140px; --bw: clamp(96px, 18vw, 150px); }
#podium-dialog.pd-still .pd-card, #podium-dialog.pd-still .pd-say { transition: none; }
@media (prefers-reduced-motion: reduce) {
  #podium-dialog .pd-say, #podium-dialog .pd-card, #podium-dialog .pd-bub { transition: none !important; }
}
html.dark-win #podium-dialog .pd-card, html.dark-win #podium-dialog .pd-who, html.dark-win #podium-dialog .pd-say, html.dark-win #podium-dialog .pd-bub { background: var(--dw-bg); color: var(--dw-ink); color-scheme: dark; }
html.dark-win #podium-dialog .pd-name, html.dark-win #podium-dialog .pd-ore { color: var(--dw-ink); }
html.dark-win #podium-dialog .pd-r1 .pd-name { color: #ffd36b; }
html.dark-win #podium-dialog .pd-card h3 { color: #9fd98f; }
html.dark-win #podium-dialog .pd-bub::after { border-top-color: var(--dw-bg); }
