/* Decorative 2.5D dice: the server remains the source of the result. */
#checkDiceOverlay,#chatDiceOverlay{--die-ink:#173448;--die-edge:#7599a8;--die-face:#f4eedc;--die-side:#a9c0c0}
#battleDiceOverlay{--die-ink:#1d392d;--die-edge:#7c9d84;--die-face:#f3edd8;--die-side:#aec3ad}
.checkDiceFaces,.battleDiceFaces{perspective:500px;align-items:center;min-height:84px}
.checkDiceFaces>span,.battleDiceFaces:not(.damageDiceFaces)>span{position:relative;box-sizing:border-box;display:grid;place-items:center;border:0;width:76px;height:76px;color:var(--die-ink);font-size:29px;font-weight:800;line-height:1;clip-path:polygon(50% 1%,88% 18%,98% 58%,75% 94%,25% 94%,2% 58%,12% 18%);background:linear-gradient(150deg,#ffffffb8 0 22%,transparent 22% 70%,#1a33344d 70%),linear-gradient(35deg,var(--die-side) 0 23%,var(--die-face) 23% 76%,var(--die-edge) 76%);transform:perspective(320px) rotateX(12deg) rotateY(-13deg) rotateZ(-7deg);filter:drop-shadow(3px 6px 3px #0009);text-shadow:0 1px #fff}
.checkDiceFaces>span:nth-child(2),.battleDiceFaces:not(.damageDiceFaces)>span:nth-child(2){transform:perspective(320px) rotateX(12deg) rotateY(13deg) rotateZ(7deg)}
#checkDiceOverlay[data-dice-mode=percentile] .checkDiceFaces>span::after,.battleDiceFaces:not(.damageDiceFaces)>span::after{position:absolute;bottom:10px;font-size:8px;line-height:1;color:var(--die-ink);opacity:.75;font-weight:600;text-shadow:none}
#checkDiceOverlay[data-dice-mode=percentile] .checkDiceFaces>span:first-child::after,.battleDiceFaces:not(.damageDiceFaces)>span:first-child::after{content:'10の位'}
#checkDiceOverlay[data-dice-mode=percentile] .checkDiceFaces>span:nth-child(2)::after,.battleDiceFaces:not(.damageDiceFaces)>span:nth-child(2)::after{content:'1の位'}
.rollingCheckDice .checkDiceFaces>span{animation:checkDieTumble .42s ease-in-out infinite alternate}.rollingBattleDice .battleDiceFaces:not(.damageDiceFaces)>span{animation:battleDieTumble .42s ease-in-out infinite alternate}
.rollingCheckDice .checkDiceFaces>span:nth-child(2),.rollingBattleDice .battleDiceFaces:not(.damageDiceFaces)>span:nth-child(2){animation-direction:alternate-reverse;animation-duration:.36s}
.battleDiceFaces.damageDiceFaces .damageDie{background:linear-gradient(140deg,#ffffff 0%,var(--die-face) 46%,var(--die-side) 100%);color:var(--die-ink);box-shadow:3px 5px 0 #263e32,5px 8px 9px #0008;transform:perspective(320px) rotateX(8deg) rotateY(-9deg);clip-path:none}
.rollingBattleDice .battleDiceFaces.damageDiceFaces .damageDie:not(.damageDieFixed){animation:die25dDamage .48s ease-in-out infinite alternate}
@keyframes checkDieTumble{from{transform:perspective(320px) translateY(-5px) rotateX(24deg) rotateY(-28deg) rotateZ(-12deg)}to{transform:perspective(320px) translateY(4px) rotateX(-10deg) rotateY(28deg) rotateZ(12deg)}}
@keyframes battleDieTumble{from{transform:perspective(320px) translateY(-5px) rotateX(24deg) rotateY(-28deg) rotateZ(-12deg)}to{transform:perspective(320px) translateY(4px) rotateX(-10deg) rotateY(28deg) rotateZ(12deg)}}
@keyframes die25dDamage{from{transform:perspective(320px) translateY(-3px) rotateX(17deg) rotateY(-18deg)}to{transform:perspective(320px) translateY(2px) rotateX(-5deg) rotateY(15deg)}}
@media(prefers-reduced-motion:reduce){.rollingCheckDice .checkDiceFaces>span,.rollingBattleDice .battleDiceFaces>span{animation:none!important;transition:none!important}}
@media(max-width:600px){.checkDiceFaces,.battleDiceFaces{min-height:66px}.checkDiceFaces>span,.battleDiceFaces:not(.damageDiceFaces)>span{width:60px;height:60px;font-size:24px}#checkDiceOverlay[data-dice-mode=percentile] .checkDiceFaces>span::after,.battleDiceFaces:not(.damageDiceFaces)>span::after{bottom:8px;font-size:7px}}
#chatDiceOverlay{position:fixed;inset:64px 12px auto;z-index:1399;display:flex;justify-content:center;pointer-events:none}
#chatDiceOverlay[hidden]{display:none}
.chatDiceCard{box-sizing:border-box;width:min(420px,100%);border:1px solid #a8d1df;border-radius:12px;padding:10px 14px;background:#111e2af5;color:#edf4fa;box-shadow:0 8px 32px #0008}
.chatDiceHeading{display:flex;align-items:center;justify-content:space-between;gap:10px;overflow-wrap:anywhere}
.chatDiceHeading button{pointer-events:auto;flex:none;padding:3px 9px;font-size:12px}
#chatDiceOverlay .checkDiceFaces{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:8px 0;min-height:0}
#chatDiceOverlay .checkDiceFaces>span{width:clamp(38px,11vw,58px);height:clamp(38px,11vw,58px);font-size:clamp(16px,4vw,22px)}
#chatDiceOverlay [data-face-label]::after{position:absolute;bottom:5px;content:attr(data-face-label);font-size:7px;font-weight:600;text-shadow:none}
#chatDiceOverlay p{margin:6px 0 0;font-size:13px;overflow-wrap:anywhere;white-space:pre-line;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.diceTrayPresentation{margin:6px auto;width:min(100%,365px);pointer-events:auto}
#chatDiceOverlay>div:has(.diceTrayPresentation[data-many]:not([hidden])),#checkDiceOverlay>div:has(.diceTrayPresentation[data-many]:not([hidden])),#battleDiceOverlay>div:has(.diceTrayPresentation[data-many]:not([hidden])){width:min(680px,calc(100vw - 32px))}
.diceTrayPresentation[data-many]{width:min(100%,620px)}
.diceTrayPresentation canvas{display:block;width:100%;height:auto;border:1px solid #638073;border-radius:6px}
.diceTrayPresentation .diceTrayLegend{margin:0 0 4px;color:#d4ebdb;font-size:11px}
.diceTrayPresentation details{text-align:left;font-size:11px;margin:4px 0}
.diceTrayPresentation details p{max-height:90px;overflow:auto;overflow-wrap:anywhere}
.trayReplaced{display:none!important}
#chatDiceOverlay .diceTrayPresentation p{display:block}
