/* Sacrament RPG: the numbers that rise off the dice and off a blow, shared by the solo game and the table (tally.js draws them; 2026-11-10, table 2026-11-11).
   The page sets --tally-z and --float-z when its dice sit higher than these defaults. Colours are the dark plates' own, so they read over any picture. */

/* a number that rises from where a blow landed and fades */
.float{position:absolute;z-index:var(--float-z,4);transform:translate(-50%,0);font:700 1.7rem/1 var(--display);pointer-events:none;white-space:nowrap;text-shadow:0 2px 0 #000,0 0 8px #000;animation:tally-float 1.2s ease-out forwards}
.float.dmg{color:#ffe2a0}
.float.hurt{color:#ff8f7e}
.float.heal{color:#bfe8a4}
@keyframes tally-float{0%{opacity:0;transform:translate(-50%,8px) scale(.7)}15%{opacity:1;transform:translate(-50%,0) scale(1.15)}100%{opacity:0;transform:translate(-50%,-34px) scale(1)}}

/* the modifiers, one by one beside the die, then the total over it */
.tally{position:absolute;z-index:var(--tally-z,7);width:0;height:0;pointer-events:none;transition:opacity .4s}
.tally.gone{opacity:0}
.tally-part,.tally-total{position:absolute;left:0;top:0;white-space:nowrap;text-shadow:0 2px 0 #000,0 0 6px #000,0 0 12px #000}
.tally-part{left:calc(var(--half,0px) + 10px);padding:3px 10px;border-radius:8px;background:#120f0be6;box-shadow:0 0 0 1px #b8955a99,0 4px 12px #000a;font:700 1.15rem/1.1 var(--label);text-shadow:none;transform:translate(0,-50%);animation:tally-rise 1.6s ease-out forwards}
.tally-part.plus{color:#bfe8a4}
.tally-part.minus{color:#ff9d8c}
.tally-total{display:flex;flex-direction:column;align-items:center;transform:translate(-50%,-50%);animation:tally-pop .35s cubic-bezier(.2,.8,.3,1.4) both}
.tally-total b{min-width:1.4em;padding:4px 10px 2px;border-radius:10px;background:#120f0bf2;box-shadow:0 0 0 2px #b8955a,0 6px 18px #000c;text-align:center;font:700 2.6rem/1 var(--display);color:#ffe2a0}
.tally-total.bad b{box-shadow:0 0 0 2px #c4786a,0 6px 18px #000c}
.tally-total.bad b{color:#ff9d8c}
.tally-total small{margin-top:2px;padding:1px 8px;border-radius:9px;background:#120f0bd9;font:600 .78rem var(--label);letter-spacing:.08em;text-transform:uppercase;color:#f1e3c2;text-shadow:none}
@keyframes tally-rise{0%{opacity:0;transform:translate(-14px,-50%) scale(.7)}12%{opacity:1;transform:translate(0,-50%) scale(1.08)}22%{transform:translate(0,-50%) scale(1)}70%{opacity:1}100%{opacity:0;transform:translate(0,-230%)}}
@keyframes tally-pop{from{opacity:0;transform:translate(-50%,-50%) scale(.4)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
@keyframes tally-still{0%{opacity:0}15%,75%{opacity:1}100%{opacity:0}}
@media (max-width:600px){.tally-part{font-size:1rem}.tally-total b{font-size:2.1rem}}
/* without movement: each number shows in place, above the die, and fades; nothing travels */
@media (prefers-reduced-motion:reduce){
  .float{animation:tally-still 1.2s linear forwards}
  .tally-part{animation:tally-still 1.6s linear forwards;transform:translate(0,calc(-50% - var(--k,0) * 1.8em))}
  .tally-total{animation:none}
  .tally{transition:none}
}

/* The result card, for the solo game and the table alike (15 Nov 2026): room under the die for the total and its words, so they never cover the verdict;
   the verdict pops in once the total has shown; the sum stays on the card; a natural 20 glows and a natural 1 shudders. Transforms only, run once. */
.reveal-result .reveal-dice{margin-bottom:12px}
/* over a result card the total's words ("against Target 12") are on the card itself, so the total shows only its number and never covers the verdict */
:has(.reveal-result)>.tally .tally-total small{display:none}
.reveal-result .reveal-outcome.in{animation:reveal-verdict .32s cubic-bezier(.2,.8,.3,1.3) both}
.reveal-result .reveal-margin{margin:0;padding:2px 10px;border-radius:9px;background:#120f0b;box-shadow:0 0 0 1px #b8955a99;font:600 .85rem var(--label);letter-spacing:.06em;text-transform:uppercase;color:#f1e3c2}
.reveal-result.failure .reveal-margin{box-shadow:0 0 0 1px #c4786a99}
.reveal-result .reveal-margin[hidden]{display:none}
.reveal-result.nat20{animation:reveal-glow 1.4s ease-out 1}
.reveal-result.nat1{animation:reveal-shudder .45s ease-in-out 1}
@keyframes reveal-verdict{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}
@keyframes reveal-glow{0%{box-shadow:0 8px 35px #000b}30%{box-shadow:0 0 0 3px #e0c27a,0 0 38px #e0c27acc}100%{box-shadow:0 8px 35px #000b}}
@keyframes reveal-shudder{0%,100%{transform:translate(0)}20%{transform:translate(-6px)}40%{transform:translate(5px)}60%{transform:translate(-3px)}80%{transform:translate(2px)}}
@media (prefers-reduced-motion:reduce){.reveal-result .reveal-outcome.in,.reveal-result.nat20,.reveal-result.nat1{animation:none}}
