.declaration-stage {
  position: fixed; inset: 0; z-index: 45; pointer-events: none; overflow: hidden;
  display: grid; place-items: center; isolation: isolate;
  --ink: #f6bc67;
}
.declaration-stage[hidden] { display: none; }
.declaration-stage[data-kind="ron"] { --ink: #ff644b; }
.declaration-stage[data-kind="tsumo"] { --ink: #50e9cc; }
.declaration-stamp {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: min(78vw, 82vh, 680px); aspect-ratio: 1.8;
  color: #fff1d5; font: 900 italic clamp(3.6rem, 13vmin, 9rem)/1.1 "Yu Mincho", "Hiragino Mincho ProN", serif;
  text-shadow: .04em .04em 0 #19110c, -.03em 0 0 #19110c, 0 0 .28em var(--ink);
  background: radial-gradient(ellipse, #101c18ed 13%, #101c18ba 50%, transparent 72%);
  animation: declaration-hit 540ms cubic-bezier(.16,.78,.24,1) both;
}
.declaration-stamp img {
  position: absolute; width: 116%; height: 122%; inset: -11% -8%;
  object-fit: contain; filter: drop-shadow(0 7px 12px #000b);
}
.declaration-burst {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 5%, var(--ink) 22%, transparent 45%),
    conic-gradient(from -25deg at center, transparent 8deg, #fff6 11deg, transparent 14deg 120deg,
    #fff8 122deg, transparent 125deg 235deg, #fff6 239deg, transparent 243deg);
  -webkit-mask-image: radial-gradient(ellipse, transparent 8%, #000 27%, transparent 65%);
  mask-image: radial-gradient(ellipse, transparent 8%, #000 27%, transparent 65%);
  animation: declaration-burst 480ms ease-out both;
}
[data-kind="riichi"] .declaration-stamp { animation: declaration-riichi 320ms ease-out both; }
[data-kind="riichi"] .declaration-burst { display: none; }
@keyframes declaration-hit {
  0% { transform: scale(.55) rotate(-5deg); opacity: 0; }
  14% { transform: scale(1.18) rotate(2deg); opacity: 1; }
  41% { transform: scale(.95) rotate(-1deg); }
  73% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes declaration-burst {
  from { transform: scale(.36); opacity: .72; }
  to { transform: scale(1.62); opacity: 0; }
}
@keyframes declaration-riichi {
  from { transform: scale(.93); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .declaration-stage .declaration-stamp { animation: none; }
  .declaration-burst { display: none; }
}

/* Unity draws the match clockwise in portrait mobile viewports. */
@media (orientation: portrait) {
  body[data-phone][data-playing] .declaration-stage {
    inset: auto;
    top: 50%;
    left: 50%;
    width: 100vh;
    width: 100dvh;
    height: 100vw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
  body[data-phone][data-playing] .declaration-stamp {
    width: min(78dvh, 82vw, 680px);
  }
}
