/* =====================================================================
   PUZZLE LOESEN (app/puzzle-hud.js, puzzle-overlay.js, puzzle-celebrate.js).
   Brett links, rechts eine ruhige Spalte: Aufgaben-Karte (#puzzleTopHud),
   drei Knoepfe (#puzzleBar), darunter die Figurenkarte nur bei gewaehlter
   Figur. Am Handy und Tablet hochkant: Aufgabe ueber, Knoepfe unter dem Brett.
   Nach dem Matt bleibt das Brett sichtbar: der Koenig kippt, ein Rauten-Ring
   laeuft von ihm weg, "Schachmatt" schlaegt kurz ein; erst dann baut sich
   die Spalte zur Ergebnis-Karte um. Vokabular wie die Puzzle-Seite:
   Gold = dran, Teal = geschafft, dunkel = offen.
   ===================================================================== */

/* ── Grundgeruest ── */
.puzzleRail { display: none; }
.puzzleTopHud[hidden],
.puzzleBar[hidden],
.puzzleLiveCard[hidden] { display: none !important; }
body.puzzle-active .puzzleRail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  color: var(--mp-bone);
}
/* Kein Gegner, keine Uhr: die Gegner-Leiste faellt im Puzzle weg, die eigene
   bleibt nur fuer Faehigkeits-Puzzles (dort IST ihr Chip der Ausloeser). */
body.puzzle-active #effectBarEnemy,
body.puzzle-active:not(.puzzle-has-abilities) #effectBar { display: none !important; }
body.puzzle-active .puzzleRail > #effectBar { width: 100%; min-width: 0; margin: 0; }
body.puzzle-active .puzzleLiveCard { width: 100%; min-width: 0; }

/* ── Desktop und Tablet quer: Brett | Spalte, als Gruppe mittig ── */
@media (min-width: 1001px) {
  body.mode-demo.puzzle-active,
  body.mode-demo.puzzle-active.puzzle-has-abilities {
    --pz-rail: 264px;
    /* Hoehen-Reserve wie im Spiel (main-06): main-Padding + boardWrap-Huelle. */
    --board-size: max(340px, calc(min(
        calc(100dvh - 96px),
        calc(100vw - var(--side-nav-width) - var(--pz-rail) - 84px)
      ) * 0.98));
  }
  body.mode-demo.puzzle-active main {
    display: grid;
    grid-template-columns: minmax(0, auto) var(--pz-rail);
    grid-template-areas: "board right";
    align-content: center;
    justify-content: center;
    align-items: start;
    column-gap: 24px;
  }
  body.puzzle-active #boardStage { display: contents; }
  body.puzzle-active #boardWrap { grid-area: board; }
  body.puzzle-active .puzzleRail { grid-area: right; width: var(--pz-rail); }
}
@media (min-width: 1367px) {
  body.mode-demo.puzzle-active,
  body.mode-demo.puzzle-active.puzzle-has-abilities { --pz-rail: 296px; }
}

/* ── Schmal (Tablet hochkant): Aufgabe ueber dem Brett, Knoepfe darunter ── */
@media (max-width: 1000px) {
  body.puzzle-active .puzzleRail { display: contents; }
  body.puzzle-active #puzzleTopHud { order: -1; }
  body.puzzle-active #puzzleTopHud,
  body.puzzle-active #puzzleBar,
  body.puzzle-active .puzzleRail > #effectBar {
    width: min(calc(var(--board-size) + 12px), calc(100vw - 16px));
    margin-inline: auto;
  }
}

/* Einzug einmal je Puzzle */
.puzzleRail.reveal .pzq,
.puzzleRail.reveal .pzq-actions,
.puzzleRail.reveal > #effectBar { animation: pzqIn .55s cubic-bezier(.2, .8, .3, 1) backwards; }
.puzzleRail.reveal .pzq-actions { animation-delay: .1s; }
@keyframes pzqIn { from { opacity: 0; translate: 0 10px; } }

/* ── Aufgaben-Karte ── */
.pzq {
  position: relative;
  padding: 18px 18px 16px;
  border: 1px solid rgba(216, 177, 90, .18);
  background: linear-gradient(180deg, rgba(20, 23, 31, .76), rgba(9, 11, 15, .9));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .36);
}
.pzq::before,
.pzq::after,
.pzr-head::before,
.pzr-head::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--mp-gold-1);
  pointer-events: none;
}
.pzq::before, .pzr-head::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.pzq::after, .pzr-head::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.pzq-head { display: flex; align-items: center; gap: 14px; }
.pzq-king {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}
.pzq-king::before {
  content: "";
  position: absolute;
  inset: 6px;
  rotate: 45deg;
  border: 1px solid var(--mp-gold-1);
  background: linear-gradient(135deg, #1d222c, #0b0d12);
  box-shadow: 0 0 0 3px #0b0d12, 0 0 0 4px rgba(216, 177, 90, .3), 0 4px 14px rgba(0, 0, 0, .6);
}
.pzq-king.side-b::before,
.pzh-king.side-b::before { background: linear-gradient(135deg, #e6dcc2, #9d9277); }
.pzq-king img { position: relative; width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); }
.pzq-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pzq-turn {
  margin: 0;
  white-space: nowrap;
  font-family: var(--mp-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--mp-bone);
}
.pzq-goal {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--mp-serif-body, Georgia, serif);
  font-style: italic;
  font-size: 15px;
  color: var(--mp-teal-1);
}

/* Rauten je eigenem Zug */
.pzq-steps { display: inline-flex; gap: 7px; }
.pzq-step {
  width: 7px;
  height: 7px;
  rotate: 45deg;
  border: 1px solid rgba(216, 177, 90, .4);
  background: #0b0d12;
}
.pzq-step.is-done {
  border-color: #8ef0e2;
  background: var(--mp-teal-2, #4dd0c4);
  box-shadow: 0 0 8px rgba(77, 208, 196, .55);
  animation: pzqStepDone .5s cubic-bezier(.2, .8, .3, 1);
}
.pzq-step.is-now {
  border-color: #f3dca0;
  background: var(--mp-gold-1);
  animation: pzqStepNow 3.4s ease-in-out infinite;
  animation-delay: var(--mp-t, 0s);
}
@keyframes pzqStepNow {
  0%, 100% { box-shadow: 0 0 3px rgba(216, 177, 90, .3); }
  50% { box-shadow: 0 0 11px rgba(216, 177, 90, .75); }
}
@keyframes pzqStepDone { from { scale: 1.8; } }
/* Fehlversuch: die aktuelle Raute zuckt einmal rot */
.pzq.is-miss .pzq-step.is-now { animation: pzqMiss .62s ease-out; }
.pzq.is-miss .pzq-steps { animation: pzqMissShake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes pzqMiss {
  0% { background: #e0564f; border-color: #ffb3a8; box-shadow: 0 0 14px rgba(224, 86, 79, .9); scale: 1.5; }
  100% { box-shadow: 0 0 3px rgba(216, 177, 90, .3); scale: 1; }
}
@keyframes pzqMissShake {
  0%, 100% { translate: 0; }
  20% { translate: -4px 0; }
  45% { translate: 3px 0; }
  70% { translate: -2px 0; }
}

/* Puzzle, du, Serie */
.pzq-duel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 177, 90, .1);
}
.pzq-r { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.pzq-r + .pzq-r { border-left: 1px solid rgba(216, 177, 90, .1); }
.pzq-r .k { font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--mp-ink-dim); }
.pzq-r b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mp-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  color: var(--mp-bone);
  font-variant-numeric: tabular-nums;
}
.pzq-r.is-you b { color: var(--mp-gold-1); }
.pzq-r.is-streak svg { color: var(--mp-ink-dim); }
.pzq-r.is-streak.is-hot svg { color: #f2a15a; filter: drop-shadow(0 0 6px rgba(216, 120, 60, .6)); }

/* ── Drei Knoepfe ── */
.pzq-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pzq-act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 66px;
  padding: 10px 4px;
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--mp-ink, #aea58c);
  border: 1px solid rgba(216, 177, 90, .16);
  background: linear-gradient(180deg, rgba(20, 23, 31, .62), rgba(9, 11, 15, .84));
  cursor: var(--mp-cur-pointer);
  transition: color .18s ease, border-color .18s ease, translate .18s ease, background .18s ease;
}
.pzq-act svg { color: var(--mp-gold-1); transition: translate .2s cubic-bezier(.22, .8, .24, 1); }
.pzq-act.is-exit svg { color: var(--mp-ink-dim); }
.pzq-act:hover:not(:disabled) { color: var(--mp-bone); border-color: rgba(216, 177, 90, .5); translate: 0 -1px; }
.pzq-act:hover:not(:disabled) svg { translate: 0 -2px; }
.pzq-act:active:not(:disabled) { translate: 0; transition-duration: 80ms; }
.pzq-act:disabled { opacity: .38; cursor: var(--mp-cur-default, default); }
.pzq-act:focus-visible { outline: 1px solid var(--mp-gold-1); outline-offset: 2px; }
/* Zwei Punkte = zwei Hinweise */
.pzq-pips { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.pzq-pips i { width: 5px; height: 5px; rotate: 45deg; border: 1px solid rgba(216, 177, 90, .4); }
.pzq-pips i.on { background: var(--mp-gold-1); border-color: #f3dca0; box-shadow: 0 0 6px rgba(216, 177, 90, .5); }
/* Nach drei Fehlversuchen laedt der Hinweis sanft ein */
.pzq-act.is-invite {
  color: var(--mp-bone);
  border-color: rgba(216, 177, 90, .55);
  animation: pzqInvite 2.6s ease-in-out infinite;
  animation-delay: var(--mp-t, 0s);
}
@keyframes pzqInvite {
  0%, 100% { box-shadow: inset 0 0 0 rgba(216, 177, 90, 0), 0 0 0 rgba(216, 177, 90, 0); }
  50% { box-shadow: inset 0 0 16px rgba(216, 177, 90, .16), 0 0 16px rgba(216, 177, 90, .22); }
}

/* ── Ergebnis: Kopf (Siegel, Titel, Rating) ── */
.pzr-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 18px 22px;
  border: 1px solid rgba(216, 177, 90, .26);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(216, 177, 90, .12), transparent 62%),
    linear-gradient(180deg, rgba(20, 23, 31, .82), rgba(9, 11, 15, .94));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
}
.pzr-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin-bottom: 14px;
}
.pzr-seal::before {
  content: "";
  position: absolute;
  inset: 10px;
  rotate: 45deg;
  border: 1px solid #f3dca0;
  background: radial-gradient(circle at 35% 30%, #f6e1a4, #c89a3e 70%, #8a6a25);
  box-shadow: 0 0 0 4px #0b0d12, 0 0 0 5px rgba(216, 177, 90, .4), 0 0 28px rgba(216, 177, 90, .35);
}
/* Der gefallene Koenig liegt schraeg im Siegel */
.pzr-seal img {
  position: relative;
  width: 70%;
  height: 70%;
  object-fit: contain;
  rotate: -24deg;
  translate: -1px 3px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .7));
}
.pzr-seal.is-fail { color: var(--mp-teal-1); }
.pzr-seal.is-fail::before {
  border-color: rgba(77, 208, 196, .6);
  background: linear-gradient(135deg, #18222a, #0b0d12);
  box-shadow: 0 0 0 4px #0b0d12, 0 0 0 5px rgba(77, 208, 196, .25);
}
.pzr-seal.is-fail svg { position: relative; width: 24px; height: 24px; }
.pzr-title {
  margin: 0;
  font-family: var(--mp-serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f6e1a4 0%, #d8b15a 55%, #a07a2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pzr-head.is-fail .pzr-title { font-size: 22px; background: none; color: var(--mp-bone); }
.pzr-sub {
  margin: 6px 0 0;
  font-family: var(--mp-serif-body, Georgia, serif);
  font-style: italic;
  font-size: 14px;
  color: var(--mp-ink, #aea58c);
}
.pzr-rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(216, 177, 90, .12);
  font-family: var(--mp-serif);
  font-variant-numeric: tabular-nums;
}
.pzr-rating .from { font-size: 18px; color: var(--mp-ink-dim); }
.pzr-rating .arrow { display: grid; color: var(--mp-ink-dim); }
.pzr-rating .to { font-size: 34px; font-weight: 700; line-height: 1; color: var(--mp-gold-1); }
.pzr-rating .delta {
  padding: 3px 7px;
  font-family: var(--mp-mono);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid currentColor;
  opacity: 0;
  scale: .6;
}
.pzr-rating .delta.is-up { color: var(--mp-teal-1); background: rgba(77, 208, 196, .08); }
.pzr-rating .delta.is-down { color: #e98a7e; background: rgba(224, 86, 79, .08); }
.pzr-rating .delta.is-flat { color: var(--mp-ink-dim); }
.pzr-rating .delta.is-pop { animation: pzrPop .5s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes pzrPop { 0% { opacity: 0; scale: .6; } 100% { opacity: 1; scale: 1; } }

/* ── Ergebnis: EXP, Serie, Weiter ── */
.pzr-body { display: flex; flex-direction: column; gap: 10px; }
.pzr-pods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pzr-pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px 13px;
  border: 1px solid rgba(216, 177, 90, .14);
  background: linear-gradient(180deg, rgba(20, 23, 31, .6), rgba(9, 11, 15, .82));
}
.pzr-pod .k { font-size: 9px; font-weight: 700; letter-spacing: 2.2px; text-transform: uppercase; color: var(--mp-ink-dim); }
.pzr-pod .v {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mp-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pzr-pod.is-exp .v { color: #f0a6c6; }
.pzr-pod.is-streak .v { color: var(--mp-bone); }
.pzr-pod.is-streak .v svg { color: #f2a15a; filter: drop-shadow(0 0 6px rgba(216, 120, 60, .55)); }
.pzr-pod.is-milestone { border-color: rgba(242, 161, 90, .45); }
.pzr-pod.is-pop { animation: pzrPodPop .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pzrPodPop { 0% { scale: 1; } 40% { scale: 1.07; } 100% { scale: 1; } }
.pzr-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pzr-badge {
  padding: 5px 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 1px solid rgba(216, 177, 90, .3);
  color: var(--mp-gold-1);
}
.pzr-badge.is-practice { color: var(--mp-ink-dim); border-color: rgba(174, 165, 140, .25); }
.pzr-actions { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; }
/* Weiter — goldener Knopf wie LOESEN auf der Puzzle-Seite */
.pzr-next {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 14px;
  font-family: var(--mp-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.2px;
  white-space: nowrap;
  text-transform: uppercase;
  color: #0c0e13;
  background: linear-gradient(180deg, #f3d88a 0%, #d8b15a 42%, #ad8230 100%);
  border: 1px solid #f0d27a;
  overflow: hidden;
  cursor: var(--mp-cur-pointer);
  box-shadow: 0 0 0 1px rgba(216, 177, 90, .25), 0 8px 28px rgba(216, 177, 90, .26), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform 220ms cubic-bezier(.22, .8, .24, 1), box-shadow 260ms ease;
}
.pzr-next::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 38%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0));
  pointer-events: none;
  animation: pzhSheen 7s linear infinite;
}
.pzr-next svg { position: relative; transition: transform 200ms cubic-bezier(.22, .8, .24, 1); }
.pzr-next:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(216, 177, 90, .45), 0 12px 40px rgba(216, 177, 90, .44), inset 0 1px 0 rgba(255, 255, 255, .55); }
.pzr-next:hover svg { transform: translateX(4px); }
.pzr-next:active { transform: translateY(0) scale(.985); transition-duration: 90ms; }
.pzr-retry {
  display: grid;
  place-items: center;
  font: inherit;
  color: var(--mp-gold-1);
  border: 1px solid rgba(216, 177, 90, .3);
  background: linear-gradient(180deg, rgba(20, 23, 31, .62), rgba(9, 11, 15, .84));
  cursor: var(--mp-cur-pointer);
  transition: border-color .18s ease, color .18s ease;
}
.pzr-retry svg { transition: rotate .45s cubic-bezier(.22, .8, .24, 1); }
.pzr-retry:hover { color: #f3dca0; border-color: var(--mp-gold-1); }
.pzr-retry:hover svg { rotate: -200deg; }
.pzr-next:focus-visible,
.pzr-retry:focus-visible { outline: 1px solid #f3dca0; outline-offset: 2px; }

/* Auftritt: nach dem Matt erst, wenn der Koenig gefallen ist
   (RESULT_AT_MS in puzzle-celebrate.js); Loesung zeigen sofort. */
.pzr { animation: pzrIn .6s cubic-bezier(.2, .8, .3, 1) .1s backwards; }
.puzzleRail.is-mate .pzr-head { animation-delay: 1.08s; }
.puzzleRail.is-mate .pzr-body { animation-delay: 1.2s; }
@keyframes pzrIn { from { opacity: 0; translate: 0 12px; } }
.puzzleRail.is-mate .pzr-seal img { animation: pzrSealKing .8s cubic-bezier(.3, .1, .3, 1) 1.2s backwards; }
@keyframes pzrSealKing { from { rotate: 0deg; translate: 0 0; } }

/* ── Matt-Moment auf dem Brett ── */
.pzMateLayer {
  /* Koenigsfeld (Mitte, Kantenlaenge) setzt puzzle-celebrate.js */
  --kx: 50%;
  --ky: 50%;
  --ks: 80px;
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  overflow: hidden;
}
.pzMateLayer[hidden] { display: none; }
.pzm { position: absolute; inset: 0; }
/* Das Brett tritt leicht zurueck, der Koenig bleibt im Licht. */
.pzm-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--kx) var(--ky),
    rgba(5, 7, 10, 0) calc(var(--ks) * .75),
    rgba(5, 7, 10, .34) calc(var(--ks) * 2.6),
    rgba(5, 7, 10, .46));
  opacity: 0;
}
.pzm.is-go .pzm-veil { animation: pzmVeil 2.4s ease forwards; }
@keyframes pzmVeil { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: .6; } }
/* Rauten-Ringe laufen vom Koenig weg: erst rot, dann gold. */
.pzm-ring {
  position: absolute;
  left: var(--kx);
  top: var(--ky);
  width: calc(var(--ks) * .78);
  height: calc(var(--ks) * .78);
  translate: -50% -50%;
  rotate: 45deg;
  border: 2px solid rgba(232, 96, 86, .95);
  box-shadow: 0 0 18px rgba(224, 86, 79, .6), inset 0 0 12px rgba(224, 86, 79, .4);
  opacity: 0;
}
.pzm-ring.is-late { border-width: 1px; border-color: rgba(243, 220, 160, .9); box-shadow: 0 0 16px rgba(216, 177, 90, .5); }
.pzm.is-go .pzm-ring { animation: pzmRing 1.1s cubic-bezier(.15, .7, .3, 1) forwards; }
.pzm.is-go .pzm-ring.is-late { animation-duration: 1.4s; animation-delay: .16s; }
@keyframes pzmRing { 0% { opacity: 1; scale: .7; } 100% { opacity: 0; scale: 3.4; } }
/* "Schachmatt" schlaegt in die Brettmitte ein und tritt wieder ab. */
.pzm-word {
  position: absolute;
  left: 50%;
  top: var(--wy, 50%);
  translate: -50% -50%;
  display: flex;
  align-items: center;
  gap: 18px;
}
.pzm-word::before,
.pzm-word::after {
  content: "";
  width: calc(var(--board-size, 600px) * .09);
  height: 1px;
  background: linear-gradient(90deg, transparent, #f3dca0);
  opacity: 0;
  scale: 0 1;
}
.pzm-word::before { transform-origin: right; }
.pzm-word::after { transform-origin: left; background: linear-gradient(90deg, #f3dca0, transparent); }
.pzm-word > span {
  display: block;
  font-family: var(--mp-serif);
  font-size: clamp(26px, calc(var(--board-size, 600px) * .082), 62px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  background: linear-gradient(180deg, #fbecc1 0%, #d8b15a 55%, #a07a2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .95)) drop-shadow(0 0 24px rgba(216, 177, 90, .3));
  opacity: 0;
}
.pzm.is-go .pzm-word > span { animation: pzmWord 2s cubic-bezier(.2, .8, .3, 1) .06s forwards; }
.pzm.is-go .pzm-word::before,
.pzm.is-go .pzm-word::after { animation: pzmRule 2s cubic-bezier(.2, .8, .3, 1) .16s forwards; }
@keyframes pzmWord {
  0% { opacity: 0; scale: 1.5; letter-spacing: .3em; }
  14% { opacity: 1; scale: 1; letter-spacing: .14em; }
  72% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: .97; }
}
@keyframes pzmRule {
  0% { opacity: 0; scale: 0 1; }
  20% { opacity: 1; scale: 1 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
/* Der Koenig kippt einmal; --mate-t (render/anim-clock.js, am Chip) haelt
   die Animation bei jedem Neuaufbau des Bretts an ihrer Stelle. */
body.pz-mated #board .sq.kingMated .chip {
  transform-origin: 50% 86%;
  animation: pzmTopple 1.05s cubic-bezier(.3, .1, .3, 1) both;
  animation-delay: var(--mate-t, 0ms);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .62)) drop-shadow(0 0 14px rgba(226, 86, 86, .75)) saturate(.75);
}
@keyframes pzmTopple {
  0% { rotate: 0deg; translate: 0 0; }
  18% { rotate: 7deg; }
  36% { rotate: -5deg; }
  100% { rotate: -24deg; translate: -7% 4%; }
}

/* ── Handy und Tablet hochkant: Aufgabe und Ergebnis als flache Streifen
   ueber dem Brett, Knoepfe darunter. Die Hoehen sind fuer den groesseren
   Zustand reserviert, damit das Brett beim Matt nicht springt. ── */
@media (max-width: 1000px) {
  body.puzzle-active #puzzleTopHud { display: flex; flex-direction: column; justify-content: flex-end; min-height: 84px; }
  body.puzzle-active #puzzleBar { min-height: 92px; }
  .pzq { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
  .pzq-head { flex: 1; min-width: 0; gap: 12px; }
  .pzq-king { width: 42px; height: 42px; }
  .pzq-turn { font-size: 11.5px; letter-spacing: 1.5px; white-space: nowrap; }
  .pzq-goal { font-size: 14px; }
  .pzq-duel { flex-shrink: 0; margin: 0; padding: 0; border-top: 0; }
  .pzq-r { padding: 2px 14px; border-left: 1px solid rgba(216, 177, 90, .12); }
  .pzq-r b { font-size: 18px; }
  body.mp-phone .pzq-r { padding: 2px 0 2px 12px; }
  body.mp-phone .pzq-r + .pzq-r { border-left: 0; }
  body.mp-phone .pzq-r .k { letter-spacing: 1.5px; }
  body.mp-phone .pzq-r.is-streak { display: none; }
  body.mp-phone .pzq-duel { grid-template-columns: auto auto; }
  .pzq-act { flex-direction: row; min-height: 46px; gap: 8px; letter-spacing: 1.4px; }
  .pzq-pips { position: static; }
  .pzr-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "seal title rating" "seal sub rating";
    align-items: center;
    column-gap: 12px;
    padding: 12px 14px;
    text-align: left;
  }
  .pzr-seal { grid-area: seal; width: 50px; height: 50px; margin: 0; }
  .pzr-seal::before { inset: 8px; }
  .pzr-title { grid-area: title; align-self: end; font-size: 20px; }
  .pzr-head.is-fail .pzr-title { font-size: 16px; }
  .pzr-sub { grid-area: sub; align-self: start; margin-top: 3px; font-size: 12.5px; }
  .pzr-rating {
    grid-area: rating;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin: 0;
    padding: 2px 0 2px 12px;
    border-top: 0;
    border-left: 1px solid rgba(216, 177, 90, .12);
  }
  .pzr-rating .from,
  .pzr-rating .arrow { display: none; }
  .pzr-rating .to { font-size: 26px; }
  .pzr-rating .delta { padding: 2px 6px; font-size: 11px; }
  .pzr-body { gap: 8px; }
  .pzr-pod { flex-direction: row; justify-content: center; gap: 10px; padding: 7px 8px; }
  .pzr-pod .v { font-size: 18px; }
  .pzr-next { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .puzzleRail.reveal .pzq,
  .puzzleRail.reveal .pzq-actions,
  .puzzleRail.reveal > #effectBar,
  .pzr,
  .puzzleRail.is-mate .pzr-seal img,
  .pzq-step,
  .pzq.is-miss .pzq-steps,
  .pzq-act.is-invite,
  .pzr-next::after { animation: none !important; }
  .pzr-rating .delta { opacity: 1; scale: 1; }
  .pzm-veil,
  .pzm-ring,
  .pzm-word > span,
  .pzm-word::before,
  .pzm-word::after { animation: none !important; }
  .pzm.is-go .pzm-veil { opacity: .6; }
  body.pz-mated #board .sq.kingMated .chip { animation: none; rotate: -24deg; translate: -7% 4%; }
}
