.pplg-graph {
  --pplg-ink: #322018;
  --pplg-green: #126454;
  width: var(--pplg-viewport, 100%);
  max-width: none;
  margin: 1rem calc((100% - var(--pplg-viewport, 100%)) / 2);
  padding: clamp(8px, 1.25vw, 18px);
  color: var(--pplg-ink);
  background:
    radial-gradient(ellipse at 19% 0%, #fff1cd65, transparent 59%),
    linear-gradient(145deg, transparent 52%, #60321938),
    #c49560 url("bois-fond.jpg") center top / cover;
  border: 1px solid #784423;
  box-shadow: inset 0 3px 4px #ffe7ba, inset 0 -7px 10px #71422160, 0 8px 18px #4c2d2345;
  border-radius: 0;
  font-family: system-ui, sans-serif;
  box-sizing: border-box;
}
.pplg-graph [hidden] { display: none !important; }
.pplg-graph h2 { margin: 0 0 18px; color: var(--pplg-ink); font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.05; }
.pplg-controls, .pplg-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pplg-graph label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 650; }
.pplg-graph button, .pplg-graph select {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #91aca4;
  border-radius: 12px;
  background: #fff;
  color: var(--pplg-ink);
  font: inherit;
  line-height: 1.2;
}
.pplg-graph button { cursor: pointer; font-weight: 700; }
.pplg-graph :focus-visible { outline: 3px solid #a05000; outline-offset: 2px; }
.pplg-play { margin-top: 16px; overflow-anchor: none; }
.pplg-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.pplg-stack {
  position: absolute;
  z-index: 1;
  top: 5%;
  left: 3%;
  width: 17%;
  aspect-ratio: 1;
  transform: rotate(-5deg);
  pointer-events: none;
}
.pplg-stack canvas, .pplg-stack-sheets span {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid #ccab82;
  border-radius: 9%;
  background: #fff9ed;
  box-shadow: 1px 3px 0 #d5ba99, 2px 5px 7px #522a2657;
  transform: translateY(calc(-1 * var(--lift, 0px))) rotate(var(--tilt, 0deg));
}
.pplg-stack canvas { display: block; object-fit: contain; padding: 0; }
.pplg-count { text-align: center; font-weight: 650; margin: 0; }
.pplg-work { min-width: 0; text-align: center; }
.pplg-status { margin: 8px 0; min-height: 1.3em; line-height: 1.3; }
.pplg-slate {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  aspect-ratio: 297 / 210;
  padding: clamp(9px, 2vw, 32px);
  border: 2px solid #78421d;
  border-radius: clamp(14px, 2vw, 31px);
  background:
    radial-gradient(ellipse at 25% 0%, #fff0bfad, transparent 58%),
    linear-gradient(147deg, #fff2c536, transparent 44%, #51260d79),
    #cc9d65 url("bois-ardoise.jpg") center / cover;
  box-shadow: inset 0 5px 5px #fff0bfaa, inset 3px 0 5px #f4bd7b,
    inset -5px -7px 6px #62321788, 0 8px 0 #783e20, 3px 14px 17px #522b1f73;
}
.pplg-slate-surface {
  container-type: size;
  --pplg-tray-button: clamp(60px, 14cqw, 124px);
  --pplg-tray-height: max(48px, calc((96cqw - 2 * var(--pplg-tray-button) - 6px) * 240 / 1188));
  position: relative;
  overflow: hidden;
  border: 2px solid #492719;
  border-radius: clamp(8px, 1.1vw, 18px);
  background:
    radial-gradient(ellipse at 22% 15%, #ffffff13, transparent 63%),
    repeating-linear-gradient(125deg, transparent 0 6px, #ffffff0a 7px, transparent 8px 13px) 0 0 / 100% 100%,
    linear-gradient(155deg, #343a3c, #17191b 80%);
  background-blend-mode: normal, overlay, normal;
  box-shadow: inset 0 4px 11px #000d, 0 2px 2px #ffdf9fbb;
}
.pplg-slate [data-slate] {
  position: absolute;
  display: block;
  width: 77%;
  width: min(77%, calc((100cqh - var(--pplg-tray-height) - 8px) * 360 / 280));
  height: auto;
  aspect-ratio: 360 / 280;
  right: 2%;
  top: calc((100% - var(--pplg-tray-height) - 4px) / 2);
  transform: translateY(-50%);
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}
.pplg-slate-actions {
  position: absolute;
  inset: auto 2% 2px;
  display: grid;
  grid-template-columns: var(--pplg-tray-button) minmax(0, 1fr) var(--pplg-tray-button);
  align-items: center;
  gap: 3px;
  min-height: var(--pplg-tray-height);
  pointer-events: none;
}
.pplg-slate-miniatures {
  display: block;
  justify-self: center;
  width: 100%;
  height: auto;
}
.pplg-graph .pplg-slate-actions button {
  pointer-events: auto;
  touch-action: manipulation;
  border: 1px dashed #fff5dc80;
  border-radius: 9px 7px 10px 8px;
  padding: 2px 3px;
  overflow-wrap: anywhere;
  color: #fff6df;
  background: #22282b;
  font-family: "Chalkboard SE", "Chalkboard", "Comic Sans MS", cursive;
  font-size: clamp(12px, 3.1vw, 20px);
  letter-spacing: .025em;
  text-shadow: .5px .5px 0 #fff6df70;
}
.pplg-graph .pplg-slate-actions button:disabled { opacity: .55; cursor: default; }
.pplg-actions { justify-content: center; margin-top: 10px; }
.pplg-stars {
  min-height: 1.5em;
  display: flex;
  justify-content: center;
  gap: 4px;
  color: #3e2719;
  font-family: system-ui, sans-serif;
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  line-height: 1.2;
}
.pplg-stars .pplg-star-earned { color: #ffdf67; text-shadow: 0 1px 2px #54340a, 0 2px 0 #6a4316; animation: pplg-pop 420ms ease-out both; }
.pplg-graph .pplg-finale {
  box-sizing: border-box;
  width: min(620px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  margin: auto;
  padding: clamp(14px, 4vw, 30px);
  text-align: center;
  color: var(--pplg-ink);
  background: #fff9ed;
  border: 2px solid #eac389;
  border-radius: 24px;
  box-shadow: 0 16px 50px #22191066;
}
.pplg-finale::backdrop { background: #20160fc2; }
.pplg-finale[open] { animation: pplg-pop 380ms ease-out both; }
.pplg-graph .pplg-finale h3 {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 3.2rem);
  line-height: 1.12;
  color: var(--pplg-green);
  text-align: center;
}
.pplg-graph .pplg-finale .pplg-score {
  margin: 6px 0 12px;
  font-weight: 700;
  text-align: center;
}
.pplg-celebration {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1.6vw, 12px);
}
.pplg-celebration span {
  display: block;
  width: clamp(24px, 8vw, 48px);
  aspect-ratio: 1;
  background: linear-gradient(155deg, #fff5a8 6%, #ffd348 42%, #ef9c10 94%);
  clip-path: polygon(50% 2%, 64% 34%, 99% 37%, 72% 61%, 80% 97%, 50% 78%, 20% 97%, 28% 61%, 1% 37%, 36% 34%);
}
.pplg-finale[open] .pplg-celebration span {
  animation: pplg-cheer 650ms var(--pplg-star-delay) ease-out both;
}
.pplg-palmares-sheet {
  padding: clamp(4px, 1.15vw, 8px);
  background: repeating-linear-gradient(135deg,
    #f7d6ae 0 13px, #f4cfe1 13px 26px, #e5d6f3 26px 39px,
    #d2e8db 39px 52px, #d8e7f8 52px 65px);
  border: 1px solid #e6cbb4;
  border-radius: 16px;
  box-shadow: 0 3px 0 #ecd7bd, 0 6px 12px #6e4a3024;
}
.pplg-palmares-content {
  padding-top: clamp(12px, 3vw, 22px);
  background: #fffefa;
  border: 1px solid #fff;
  border-radius: 10px;
  text-align: center;
}
.pplg-miniatures {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
}
@keyframes pplg-cheer {
  0% { opacity: 0; transform: translateY(12px) scale(.45); }
  55% { opacity: 1; transform: translateY(-8px) rotate(12deg) scale(1.22); }
  100% { opacity: 1; transform: none; }
}
.pplg-graph button.pplg-replay { background: var(--pplg-green); color: white; position: relative; }
@keyframes pplg-pop {
  0% { transform: scale(.65); opacity: 0; }
  60% { transform: scale(1.16); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}


.pplg-graph .pplg-actions { margin-top: 20px; }
.pplg-graph .pplg-status { font-weight: 650; margin: 7px 0 12px; }
.pplg-graph .pplg-controls select { max-width: 100%; }
.pplg-graph .pplg-motif { margin: 0; font-size: clamp(1.22rem, 4vw, 1.65rem); color: inherit; }
.pplg-graph .pplg-stars { margin: 4px 0 0; }
@media (min-width: 601px) {
  .pplg-slate {
    width: calc(100% - clamp(48px, 12vw, 180px));
    margin-inline: auto;
  }
}
@media (max-width: 600px) {
  .pplg-graph .pplg-stars { line-height: 1; }
  .pplg-graph .pplg-status { min-height: 2.6em; }
}
@media (prefers-reduced-motion: reduce) {
  .pplg-graph .pplg-stars .pplg-star-earned,
  .pplg-finale[open], .pplg-finale[open] .pplg-celebration span { animation: none; }
}
