.dice-cup{display:inline-flex;align-items:center;justify-content:center;gap:.42em;touch-action:none;user-select:none;cursor:grab}
button.dice-cup::before,.held-dice-cup .cup-shell{
  background:url('/materials/terningebaeger.webp') center/contain no-repeat;
}
button.dice-cup::before{content:"";display:block;flex:none;width:clamp(29px,4.6vmin,48px);aspect-ratio:1;pointer-events:none}
.dice-cup.charging{cursor:grabbing}
.dice-cup.charging::before{opacity:.22}
.held-dice-cup{position:fixed;z-index:38;width:1px;height:1px;pointer-events:none}
.held-dice-cup .cup-shell{position:absolute;display:block;width:clamp(76px,12vmin,128px);aspect-ratio:1;bottom:0;left:0;translate:-50% 23%;transform-origin:50% 78%;filter:drop-shadow(2px 5px 4px #09130e55)}
.held-dice-cup.is-held .cup-shell{animation:cup-in-hand .48s ease-in-out infinite alternate}
.held-dice-cup.is-pouring .cup-shell{animation:tip-the-cup .46s cubic-bezier(.2,.7,.27,1) both}
.cup-tumble{position:absolute;left:0;bottom:28px;width:12px;height:12px;border-radius:26%;border:1px solid #c4bba9;box-shadow:inset -2px -2px #9c9076;
  background:radial-gradient(circle at 29% 29%,#3e3328 0 10%,transparent 12%),radial-gradient(circle at 69% 69%,#3e3328 0 10%,transparent 12%),linear-gradient(140deg,#fff5d7,#cbbd99);
  animation:from-cup .29s cubic-bezier(.42,.05,.78,.55) calc(.10s + var(--lag)) both}
@keyframes cup-in-hand{from{rotate:calc(var(--hold-angle,0deg) - 4deg)}to{rotate:calc(var(--hold-angle,0deg) + 4deg)}}
@keyframes tip-the-cup{0%{rotate:var(--hold-angle,0deg);opacity:1}42%,77%{rotate:var(--tip);opacity:1}100%{rotate:var(--tip);opacity:0}}
@keyframes from-cup{0%{opacity:0;transform:translate(0,-12px) scale(.75)}16%{opacity:1}79%{opacity:1}100%{opacity:0;transform:translate(var(--fall-x),37px) rotate(140deg)}}
html[data-graphics=low] .held-dice-cup *,html[data-graphics=low] .cup-tumble{animation:none}
@media(prefers-reduced-motion:reduce){.held-dice-cup .cup-shell,.cup-tumble{animation:none!important}.is-pouring .cup-shell{rotate:32deg}}
@media(max-height:480px){button.dice-cup::before{width:28px}}

:is(.tray-desk,.tool-dice-desk) .tray-fallback-cup {
  position:absolute; z-index:2; left:var(--cup-x,75%); top:var(--cup-y,24%); transform:translate(-50%,-50%) rotate(var(--cup-tilt,6deg));
  margin:0; padding:0; width:clamp(45px,16%,115px); aspect-ratio:1; min-height:0; border:0; border-radius:25%;
  background:transparent url('/materials/terningebaeger.webp') center / contain no-repeat;
  box-shadow:none; filter:drop-shadow(2px 4px 3px #15201785); cursor:grab; touch-action:none; user-select:none;
}
:is(.tray-desk,.tool-dice-desk) .tray-fallback-cup[data-lifted] { cursor:grabbing; filter:drop-shadow(3px 9px 5px #15181085); }
:is(.tray-desk,.tool-dice-desk) .tray-fallback-cup:disabled { opacity:1; cursor:default; }
:is(.tray-desk,.tool-dice-desk) :is(.tray-mount,.tool-surface):has(.game-visual[data-cup-3d]) > .tray-fallback-cup { display:none; }
:is(.tray-desk,.tool-dice-desk) .game-visual:not([data-cup-3d]) [data-tray-cup-hit] { visibility:hidden; pointer-events:none; }
:is(.tray-desk,.tool-dice-desk) [data-tray-cup-hit] { touch-action:none; user-select:none; cursor:grab; }
:is(.tray-desk,.tool-dice-desk) [data-tray-cup-hit]:disabled { cursor:default; }
:is(.tray-desk,.tool-dice-desk) [data-tray-cup-hit]:focus-visible,:is(.tray-desk,.tool-dice-desk) .tray-fallback-cup:focus-visible {
  outline:2px solid #f5d993; outline-offset:3px; border-radius:22%;
}
:is(.tray-desk,.tool-dice-desk)[data-cup-grip=local] :is([data-tray-cup-hit],[data-cup-fallback],.dice-cup) { cursor:grabbing; }
:is(.tray-desk,.tool-dice-desk) .tray-grip-feedback { display:none; align-items:center; justify-content:center; gap:8px; color:#f4e6bf; font-variant-numeric:tabular-nums; }
:is(.tray-desk,.tool-dice-desk)[data-cup-grip=local] .tray-hint-copy { display:none; }
:is(.tray-desk,.tool-dice-desk)[data-cup-grip=local] .tray-grip-feedback { display:inline-flex; }
:is(.tray-desk,.tool-dice-desk) .tray-grip-strength { width:clamp(50px,15vw,112px); height:6px; appearance:none; overflow:hidden; border:1px solid #71694f; border-radius:5px; background:#1a251d; vertical-align:middle; }
.tray-grip-strength::-webkit-progress-bar { background:#1a251d; }
.tray-grip-strength::-webkit-progress-value { background:#eac887; }
.tray-grip-strength::-moz-progress-bar { background:#eac887; }

.tool-dice-desk .tool-surface { position:relative }
.tool-dice-desk #local-total { margin:0;text-align:center;font-weight:650;color:#fae9bd }
.tool-dice-desk #local-total:empty { display:none }
.tool-dice-desk .dice-tray { flex-wrap:wrap;align-content:center;gap:10px }
.tool-dice-desk .dice-tray .flat-set-die { display:grid;place-items:center;min-width:48px;height:48px;padding:4px;border-radius:12px;background:var(--die-color,#ded0af);color:var(--die-ink,#23201d);box-shadow:inset 1px 2px 2px #ffffff88,inset -2px -3px 4px #0005,0 3px 8px #12191788;font:700 1.25rem/1.1 system-ui }
.tool-dice-desk .flat-set-die[data-material=gold] { --die-color:#d7ac53 }
.tool-dice-desk .flat-set-die[data-material=silver] { --die-color:#bbc8cf }
.tool-dice-desk .flat-set-die[data-material=jade] { --die-color:#206b58;--die-ink:#fff4d5 }
.tool-dice-desk .flat-set-die[data-material=noir] { --die-color:#293033;--die-ink:#fff4d5 }
