.bz-tumbling { position: relative; perspective: 450px; }
.bz-tumbling > :is(.die-face,.fk-face) { visibility: hidden !important; }
.bz-roll-cube {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -50cqi;
  width: 100cqi;
  aspect-ratio: 1;
  transform-style: preserve-3d;
  pointer-events: none;
}
.die, .fk-dice button { container-type: inline-size; }
.bz-roll-side {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 17%;
  grid-template: repeat(3,1fr) / repeat(3,1fr);
  place-items: center;
  border-radius: 15%;
  background: linear-gradient(145deg,#fbffff,#b7c9ed);
  border: 1px solid #eafaff;
  box-shadow: inset -2px -2px 5px #496caa66;
  backface-visibility: hidden;
}
.bz-roll-side-0 { transform: translateZ(50cqi); }
.bz-roll-side-1 { transform: rotateY(90deg) translateZ(50cqi); background: #b6e3f4; }
.bz-roll-side-2 { transform: rotateY(180deg) translateZ(50cqi); background: #b3bce8; }
.bz-roll-side-3 { transform: rotateY(-90deg) translateZ(50cqi); background: #a6c4ed; }
.bz-roll-side-4 { transform: rotateX(90deg) translateZ(50cqi); }
.bz-roll-side-5 { transform: rotateX(-90deg) translateZ(50cqi); background: #8eafdb; }
.bz-roll-side i { width: 63%; aspect-ratio: 1; border-radius: 50%; background: #112147; box-shadow: inset 0 2px 3px #071025; }
.bz-roll-pip-0 { grid-area: 1 / 1; }
.bz-roll-pip-2 { grid-area: 1 / 3; }
.bz-roll-pip-3 { grid-area: 2 / 1; }
.bz-roll-pip-4 { grid-area: 2 / 2; }
.bz-roll-pip-5 { grid-area: 2 / 3; }
.bz-roll-pip-6 { grid-area: 3 / 1; }
.bz-roll-pip-8 { grid-area: 3 / 3; }

.hf-roll-sound[aria-pressed="false"] { opacity: .7; }
#finishDialog {
  --hf-result-accent: #90ffef;
  max-height: calc(100dvh - 2rem);
  border: 2px solid var(--hf-result-accent);
  background: radial-gradient(ellipse at top,#293b79,#0b1a35 74%);
  box-shadow: 0 0 42px #4578f779;
}
#finishDialog::backdrop { background: #070b20d9; }
#finishDialog[data-outcome="loss"] { --hf-result-accent: #ffc4d9; }
#finishDialog[data-outcome="tie"] { --hf-result-accent: #ffe69f; }
#finishDialog :is(#finishTitle,#finalScore) { color: var(--hf-result-accent); }
#finishDialog #finishTitle { font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.08; }
#finishDialog[data-outcome="loss"] .celebration, #finishDialog[data-outcome="tie"] .celebration { display: none; }
@media (min-width: 900px) {
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(275px, 32%);
    gap: 0 14px;
    align-items: start;
  }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel > :is(.roundbar,.hf-current,.status,.finished-banner) { grid-column: 1 / -1; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel > .dice-area { display: none; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel > .score-columns {
    grid-area: 3 / 1 / 5 / 2;
    max-height: max(16rem, calc(100dvh - 14rem));
    overflow: auto;
    padding-bottom: 2px;
    scrollbar-color: #5689b0 #0f2039;
  }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel > .selection-bar {
    grid-area: 3 / 2 / 4 / 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 0;
    position: sticky;
    top: 8px;
    align-self: start;
  }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .selection-bar > :is(.dice-tray,.hf-score-actions,div:not(.dice-tray):not(.hf-score-actions)) {
    grid-area: auto / 1;
  }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .play-panel > .grand-total {
    grid-area: 4 / 2 / 5 / 3;
    min-width: 0;
  }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .selection-bar .die { width: 100%; max-width: 54px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .selection-bar .dice { gap: clamp(4px, .8vw, 10px); }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .selection-bar .button { padding-inline: 6px; }
}
@media (min-width: 900px) and (max-height: 870px) {
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .topbar { min-height: 42px; padding-block: 3px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .game-nav { min-height: 32px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .game-nav a { padding-block: 4px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .hero { padding-block: 3px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .hero h1 { font-size: clamp(24px, 4vh, 34px); }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .score-row { min-height: 36px; padding-block: 2px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .score-value { padding-block: 1px; }
  html[data-bz-page="roll-riot"]:not(.hf-tabletop) .section-head { min-height: 30px; padding-block: 3px; }
}
