/* 3D Dice Roller. The tray canvas fills the stage; the result floats on top. */

.dc { overflow: hidden; }
.dc-host { background: #246b4f; }
.dc-host .t-canvas { cursor: pointer; }

.dc-result {
  position: absolute; top: clamp(8px, 3cqmin, 30px); left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: .5em; max-width: 94%;
  padding: .3em .9em; border-radius: 999px; white-space: nowrap; overflow: hidden;
  font: 650 clamp(16px, 5.6cqmin, 72px)/1.2 var(--font-display); font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .92); color: #14202e; box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
  transition: opacity .2s;
}
.dc.is-rolling .dc-result { opacity: 0; }
.dc-vals { display: inline-flex; align-items: baseline; gap: .3em; overflow: hidden; text-overflow: ellipsis; }
.dc-vals i { font-style: normal; color: #7a8796; font-weight: 500; }
.dc-vals .is-held { color: #b7791f; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .15em; }
.dc-total { font-size: 1.25em; color: var(--cat); }
.dc-vals[hidden] + .dc-total { font-size: 1.5em; color: #14202e; min-width: 1.2em; text-align: center; }

.dc-hint {
  position: absolute; left: 50%; bottom: calc(clamp(36px, 8.4cqmin, 84px) + clamp(16px, 5.2cqmin, 56px));
  transform: translateX(-50%); z-index: 4; pointer-events: none;
  padding: .3em .8em; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff;
  font-size: clamp(11px, 2.6cqmin, 22px); white-space: nowrap;
}
.dc-count { background: rgba(255, 255, 255, .92); color: #14202e; border-color: transparent; min-width: 5.2em; justify-content: center; }
.dc .t-controls .t-btn:not(.t-btn-primary) { background: rgba(255, 255, 255, .92); color: #14202e; border-color: transparent; }

.dc-history { margin: 0; padding: 0 0 0 1.4em; max-height: 220px; overflow: auto; font-variant-numeric: tabular-nums; }
.dc-history li { padding: 2px 0; }
.dc-history li.is-empty { list-style: none; margin-left: -1.4em; color: var(--muted); }

/* ---- flat dice, when there is no WebGL ---- */
.dc-host.is-flat { display: grid; place-items: center; padding: 16cqmin 4cqmin 20cqmin; }
.dc-host[data-table="navy"] { background: #24456e; }
.dc-host[data-table="burgundy"] { background: #6e2232; }
.dc-host[data-table="slate"] { background: #3a3f47; }
.dc-host[data-table="walnut"] { background: #8a5a36; }
.dc-flat { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 4cqmin; max-width: 100%; }
.dc-die {
  --die: #e03131;
  width: 18cqmin; height: 18cqmin; min-width: 44px; min-height: 44px; border-radius: 18%;
  display: grid; place-items: center; border: 0; padding: 0;
  background: linear-gradient(145deg, color-mix(in srgb, var(--die) 80%, white), var(--die) 60%, color-mix(in srgb, var(--die) 80%, black));
  color: #fff; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 1.4cqmin 2.4cqmin rgba(0, 0, 0, .35);
  font: 700 9cqmin/1 var(--font-display);
}
.dc-die.is-light { color: #1d1d22; }
.dc-die.is-pips { grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; }
.dc-die.is-pips i { width: 62%; aspect-ratio: 1; border-radius: 50%; place-self: center; }
.dc-die.is-pips i.on { background: currentColor; }
.dc-die.is-held { outline: .8cqmin solid #f5c04a; outline-offset: .8cqmin; }
.dc-die.is-rolling { animation: dc-shake .14s linear infinite; }
@keyframes dc-shake { 0% { transform: rotate(-9deg) translateY(-3%); } 50% { transform: rotate(8deg) translateY(2%); } 100% { transform: rotate(-9deg) translateY(-3%); } }

@container (max-height: 300px) {
  .dc-hint { display: none; }
}
@container (max-width: 380px) {
  .dc-count { display: none; }
}
