:root {
  --jeu-nuit: var(--term-bg);           
  --jeu-fond: var(--marine-dim);        
  --jeu-marine: var(--marine);
  --jeu-cream: var(--cream);
  --jeu-or: var(--brique);              
  --jeu-or-clair: var(--brique-light);
  --jeu-or-sombre: var(--brique-dark);
  --jeu-carmin: var(--carmin);          
  --jeu-carmin-clair: var(--carmin-clair);
  --jeu-bleu: var(--marine-mute);       

  --jeu-rose: var(--rose-etoile);
}

.pdj {
  --pdj-marge: 32px;
  position: relative;
  width: 100%;
  max-width: min(100%, calc((100dvh - var(--pdj-marge)) / 1.2));
  margin: 0 auto;
  font-family: var(--mono, 'IBM Plex Mono', ui-monospace, Menlo, monospace);
  color: var(--jeu-cream);
  -webkit-tap-highlight-color: transparent;
}
.pdj-plateau {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.2;
  overflow: hidden;
  border-radius: 20px;
  background: var(--jeu-fond);
  border: 1px solid color-mix(in srgb, var(--jeu-or) 18%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--jeu-cream) 6%, transparent) inset,
    0 24px 60px -28px color-mix(in srgb, var(--jeu-nuit) 90%, transparent);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
  container-type: inline-size;
  isolation: isolate;
}

.pdj-plateau:focus { outline: none; }
.pdj[data-clavier] .pdj-plateau:focus-visible { outline: 2px solid var(--jeu-or); outline-offset: 3px; }
.pdj[data-etoile] .pdj-plateau { border-color: color-mix(in srgb, var(--jeu-rose) 55%, transparent); }
.pdj-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: filter .25s ease; }
.pdj[data-etat="pause"] .pdj-canvas,
.pdj[data-etat="attente"] .pdj-canvas,
.pdj[data-etat="fin"] .pdj-canvas { filter: blur(7px) saturate(.8); }
.pdj-couche { position: absolute; inset: 0; pointer-events: none; }

.pdj:not([data-etat="jeu"]):not([data-etat="decompte"]) :is(.pdj-hud, .pdj-armes, .pdj-bonus, .pdj-msg, .pdj-bandeau, .pdj-boss, .pdj-etoile-lbl, .pdj-pause-btn) { visibility: hidden; }

.pdj-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: flex-start; gap: 3cqw;
  padding: 3.2cqw 3.6cqw 0;
  pointer-events: none;
}
.pdj-hud-g, .pdj-hud-d { min-width: 0; }
.pdj-hud-d { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.pdj-grand {
  display: block;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif);
  font-weight: 400; font-size: max(15px, 4.4cqw); line-height: 1; letter-spacing: -.02em;
  color: var(--jeu-cream); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pdj-grand i { font-style: normal; color: var(--jeu-or); }
.pdj-score { color: var(--jeu-or); }
.pdj-sous {
  display: block; margin-top: .9cqw;
  font-size: max(8px, 1.75cqw); letter-spacing: .16em; text-transform: uppercase;
  color: color-mix(in srgb, var(--jeu-cream) 55%, transparent); white-space: nowrap;
}

.pdj-mult {
  display: flex; align-items: center; gap: 1.4cqw; margin-top: 1.4cqw;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif);
  font-size: max(10px, 2.3cqw); color: color-mix(in srgb, var(--jeu-cream) 45%, transparent);
  transition: color .2s;
}
.pdj-mult[data-actif] { color: var(--jeu-or); }
.pdj-mult-piste { width: 12cqw; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--jeu-cream) 14%, transparent); overflow: hidden; }
.pdj-mult-piste i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--jeu-or); transition: width .18s ease; }
.pdj-mult.pdj-pulse { animation: pdj-pulse .45s cubic-bezier(.2,.8,.3,1); }
@keyframes pdj-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }

.pdj-bandeau {
  position: absolute; left: 0; right: 0; top: 15%; z-index: 3; text-align: center;
  font-size: max(9px, 1.9cqw); letter-spacing: .24em; text-transform: uppercase;
  color: color-mix(in srgb, var(--jeu-or) 85%, transparent);
  opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .35s; pointer-events: none;
}
.pdj-bandeau { display: flex; flex-direction: column; align-items: center; }
.pdj-bandeau-sous {
  margin-top: 1.2cqw; font-size: max(9px, 1.9cqw); letter-spacing: .04em; text-transform: none;
  color: color-mix(in srgb, var(--jeu-cream) 72%, transparent);
}
.pdj-bandeau-sous:empty { display: none; }
.pdj-bandeau-t::before, .pdj-bandeau-t::after {
  content: ''; display: inline-block; vertical-align: middle; width: 8cqw; height: 1px; margin: 0 2cqw;
  background: color-mix(in srgb, var(--jeu-or) 45%, transparent);
}
.pdj-bandeau[data-on] { opacity: 1; transform: none; }
.pdj-etoile-lbl {
  position: absolute; left: 0; right: 0; top: 10.5%; z-index: 3; text-align: center; display: none;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif);
  font-size: max(10px, 2.1cqw); letter-spacing: .16em; color: var(--jeu-rose); pointer-events: none;
}
.pdj[data-etoile] .pdj-etoile-lbl { display: block; }

.pdj-msg {
  position: absolute; left: 50%; bottom: 21%; z-index: 4; max-width: 86%;
  transform: translate(-50%, 8px); opacity: 0; transition: opacity .22s, transform .22s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 1.4cqw 3cqw; border-radius: 999px;
  background: color-mix(in srgb, var(--jeu-fond) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--jeu-or) 45%, transparent);
  font-size: max(9.5px, 1.95cqw); color: var(--jeu-cream); pointer-events: none;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pdj-msg[data-on] { opacity: 1; transform: translate(-50%, 0); }
.pdj-msg[data-ton="mal"] { border-color: color-mix(in srgb, var(--jeu-carmin-clair) 60%, transparent); }

.pdj-boss {
  position: absolute; left: 4%; right: 4%; top: 1.6%; z-index: 4; display: none; pointer-events: none;
}
.pdj[data-boss] .pdj-boss { display: block; }
.pdj[data-boss] .pdj-hud { opacity: 0; }
.pdj-boss-ligne { display: flex; align-items: center; gap: 2cqw; }
.pdj-boss-ligne .pdj-boss-piste { flex: 1; min-width: 0; }
.pdj-boss-nom { font-size: max(8.5px, 1.8cqw); letter-spacing: .2em; color: var(--jeu-carmin-clair); font-weight: 600; }
.pdj-boss-n { font-size: max(8.5px, 1.7cqw); color: color-mix(in srgb, var(--jeu-cream) 62%, transparent); white-space: nowrap; }
.pdj-boss-n:empty { display: none; }
.pdj-boss-phase { display: flex; gap: .8cqw; }
.pdj-boss-phase i { width: 1.2cqw; height: 1.2cqw; border-radius: 50%; border: 1px solid var(--jeu-carmin-clair); }
.pdj-boss-phase i[data-on] { background: var(--jeu-carmin-clair); }
.pdj-boss-pv { margin-left: auto; font-size: max(8.5px, 1.8cqw); color: color-mix(in srgb, var(--jeu-cream) 70%, transparent); font-variant-numeric: tabular-nums; }
.pdj-boss-piste { height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--jeu-cream) 12%, transparent); overflow: hidden; }
.pdj-boss-piste i { display: block; height: 100%; width: calc(var(--p, 1) * 100%); background: var(--jeu-or); transition: width .12s linear, background .3s; }
.pdj-boss[data-phase="2"] .pdj-boss-piste i { background: var(--jeu-or-sombre); }
.pdj-boss[data-phase="3"] .pdj-boss-piste i { background: var(--jeu-carmin-clair); }

.pdj-armes {
  position: absolute; left: 3.6cqw; bottom: 3.4cqw; z-index: 3; display: flex; flex-direction: column; gap: 1.1cqw;
  pointer-events: none;
}
.pdj-arme { display: flex; align-items: center; gap: 1.4cqw; color: var(--c); }
.pdj-arme b { width: 5.4cqw; font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400; font-size: max(8px, 1.65cqw); letter-spacing: .08em; }
.pdj-crans { display: flex; gap: .45cqw; }
.pdj-crans i { width: 1.35cqw; height: 1.35cqw; min-width: 5px; min-height: 5px; border-radius: 2px; background: color-mix(in srgb, var(--jeu-cream) 12%, transparent); }
.pdj-crans i[data-on] { background: var(--c); }
.pdj-arme span { font-size: max(8.5px, 1.75cqw); font-variant-numeric: tabular-nums; }
.pdj[data-etoile] .pdj-arme { --c: var(--jeu-rose) !important; }

.pdj-bonus { position: absolute; right: 3.6cqw; bottom: 3.4cqw; z-index: 3; display: flex; gap: 1.6cqw; pointer-events: none; }
.pdj-bonus-p {
  position: relative; width: max(24px, 6.4cqw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  color: var(--jeu-or);
  background: conic-gradient(var(--jeu-or) calc(var(--p, 1) * 360deg), color-mix(in srgb, var(--jeu-cream) 12%, transparent) 0);
}
.pdj-bonus-p::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--jeu-fond); }
.pdj-bonus-p svg { position: relative; width: 55%; height: 55%; }
.pdj-bonus-p b { position: absolute; right: -3px; bottom: -3px; min-width: 14px; height: 14px; border-radius: 7px; background: var(--jeu-or); color: var(--jeu-marine); font-size: 9px; line-height: 14px; text-align: center; font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400; }

.pdj-decompte {
  position: absolute; inset: 0; z-index: 5; display: none; place-items: center; pointer-events: none;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-size: 22cqw; color: var(--jeu-cream);
}
.pdj-decompte span { animation: pdj-decompte .9s cubic-bezier(.2,.8,.3,1) both; }
.pdj-decompte span::after { content: '.'; color: var(--jeu-or); }
.pdj[data-etat="decompte"] .pdj-decompte { display: grid; }
@keyframes pdj-decompte { from { opacity: 0; transform: scale(1.5); } 30% { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.92); } }

.pdj-commandes {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: none;
  align-items: center; justify-content: center; gap: 2.4cqw; padding: 3cqw 3.6cqw;
  background: linear-gradient(transparent, color-mix(in srgb, var(--jeu-nuit) 75%, transparent));
}
.pdj-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 54px; min-height: 46px; padding: 0 14px; border: 0; border-radius: 14px;
  background: var(--jeu-or); color: var(--jeu-marine);
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400; font-size: 13px; letter-spacing: .06em;
  cursor: pointer; touch-action: none; transition: background .14s, transform .14s;
}
.pdj-btn svg { width: 16px; height: 16px; }
.pdj-btn:hover { background: var(--jeu-or-sombre); }
.pdj-btn:active, .pdj-btn[data-on] { transform: translateY(2px); background: var(--jeu-or-sombre); }
.pdj-btn:focus-visible { outline: 2px solid var(--jeu-cream); outline-offset: 2px; }
.pdj-btn.feu { min-width: 96px; }
.pdj-btn.discret { min-width: 46px; background: color-mix(in srgb, var(--jeu-or) 20%, transparent); color: var(--jeu-or); }
.pdj-btn.discret:hover { background: color-mix(in srgb, var(--jeu-or) 36%, transparent); }

.pdj-pause-btn {
  position: absolute; top: 2.6cqw; left: 50%; transform: translateX(-50%); z-index: 6;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--jeu-cream) 18%, transparent);
  background: color-mix(in srgb, var(--jeu-nuit) 55%, transparent); color: color-mix(in srgb, var(--jeu-cream) 75%, transparent);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.pdj-pause-btn:hover { background: color-mix(in srgb, var(--jeu-or) 22%, transparent); color: var(--jeu-or); }
.pdj-pause-btn:focus-visible { outline: 2px solid var(--jeu-or); outline-offset: 2px; }
.pdj-pause-btn svg { width: 12px; height: 12px; }
.pdj[data-etat="fin"] .pdj-pause-btn, .pdj[data-etat="attente"] .pdj-pause-btn, .pdj[data-boss] .pdj-pause-btn { display: none; }
@media (pointer: coarse) {
  .pdj[data-etat="jeu"] .pdj-commandes { display: flex; }
  .pdj[data-etat="jeu"] .pdj-armes, .pdj[data-etat="jeu"] .pdj-bonus { bottom: calc(3.4cqw + 70px); }
  .pdj[data-etat="jeu"] .pdj-msg { bottom: calc(3.4cqw + 150px); }
  .pdj-pause-btn { display: none; }
}

.pdj-voile {
  position: absolute; inset: 0; z-index: 8; display: none; flex-direction: column;
  background: color-mix(in srgb, var(--jeu-nuit) 78%, transparent);
  overflow: auto; cursor: default;
}
.pdj-voile[data-on] { display: flex; animation: pdj-voile .28s ease both; }
@keyframes pdj-voile { from { opacity: 0; } to { opacity: 1; } }
.pdj-voile-centre { margin: auto; width: 100%; max-width: 360px; padding: 28px 24px; box-sizing: border-box; text-align: center; }
.pdj-surtitre { display: block; font-size: 9px; letter-spacing: .22em; text-transform: uppercase; color: color-mix(in srgb, var(--jeu-cream) 55%, transparent); }
.pdj-titre {
  display: block; margin-top: 11px;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400;
  font-size: 22px; line-height: 1.2; letter-spacing: -.02em; color: var(--jeu-cream);
}
.pdj-titre i { font-style: normal; color: var(--jeu-or); }
.pdj-texte { display: block; margin-top: 11px; font-size: 11px; line-height: 1.65; color: color-mix(in srgb, var(--jeu-cream) 75%, transparent); }
.pdj-texte:empty { display: none; }
.pdj-or {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; margin-top: 22px;
  padding: 0 22px; border: 0; border-radius: 999px; background: var(--jeu-or); color: var(--jeu-marine);
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400; font-size: 12.5px;
  cursor: pointer; transition: background .18s, transform .18s;
}
.pdj-or:hover { background: var(--jeu-or-sombre); transform: translateY(-2px); }
.pdj-or:focus-visible { outline: 2px solid var(--jeu-cream); outline-offset: 3px; }

.pdj-voile-fin { background: color-mix(in srgb, var(--jeu-nuit) 94%, transparent); }
.pdj-fin-tete { flex: none; padding: 22px 22px 18px; border-bottom: 1px solid color-mix(in srgb, var(--jeu-cream) 14%, transparent); }
.pdj-fin-ligne { display: flex; align-items: flex-end; gap: 14px; }
.pdj-fin-ligne > span { flex: 1; min-width: 0; }
.pdj-fin-ligne .pdj-titre { font-size: 19px; margin-top: 8px; }
.pdj-fin-score { flex: none; text-align: right; }
.pdj-fin-score b {
  display: block; font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-weight: 400;
  font-size: 34px; line-height: 1; color: var(--jeu-or); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.pdj-fin-score span { display: block; margin-top: 4px; font-size: 8.5px; letter-spacing: .16em; color: color-mix(in srgb, var(--jeu-cream) 50%, transparent); }
.pdj-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0 22px; }
.pdj-stat { min-width: 0; padding: 12px 0 12px 10px; border-left: 1px solid color-mix(in srgb, var(--jeu-cream) 10%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--jeu-cream) 10%, transparent); }
.pdj-stat:nth-child(4n + 1) { border-left: 0; padding-left: 0; }
.pdj-stat dt { font-size: 8px; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--jeu-cream) 45%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdj-stat dt em { font-style: normal; color: var(--jeu-or); margin-right: 5px; }
.pdj-stat dd { margin: 5px 0 0; font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-size: 15px; line-height: 1.1; color: var(--jeu-cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pdj-stat dd small { font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 9px; color: color-mix(in srgb, var(--jeu-cream) 50%, transparent); margin-left: 2px; }
@container (max-width: 420px) {
  .pdj-stat dt { letter-spacing: .04em; font-size: 7.5px; }
  .pdj-stat dt em { margin-right: 3px; }
  .pdj-stat dd { font-size: 14px; }
}
.pdj-fin-zone { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; }
.pdj-fin-zone:empty { display: none; }

.pdj-rejeu { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-width: 0; }
.pdj-rejeu .pdj-btn { min-height: 34px; min-width: 38px; padding: 0 10px; border-radius: 10px; font-size: 11px; }
.pdj-rail { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: color-mix(in srgb, var(--jeu-marine) 12%, transparent); }
.pdj-rail button {
  min-width: 34px; min-height: 28px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif); font-size: 11px; color: var(--jeu-marine);
}
.pdj-rail button[aria-pressed="true"] { background: var(--jeu-marine); color: var(--jeu-cream); }
.pdj-rail button:focus-visible { outline: 2px solid var(--jeu-or); outline-offset: 1px; }
.pdj-progres { flex: 1; min-width: 40px; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--jeu-marine) 16%, transparent); overflow: hidden; }
.pdj-progres i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--jeu-or); }
.pdj-temps { flex: none; font-size: 11px; color: var(--jeu-marine); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .pdj *, .pdj *::before, .pdj *::after { animation: none !important; transition: none !important; }
}
