/* =====================================================================
   3D dice: the full-screen layer the dice tumble across, the result
   that appears where they land, and the dice picker on the Account page.
   ===================================================================== */
.dice3d { position: fixed; inset: 0; z-index: 280; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
.dice3d.on { opacity: 1; transition-duration: .08s; }
.dice3d canvas { display: block; width: 100% !important; height: 100% !important; }

/* the result: a heavy number set on a dark token, like a chit pushed into the middle of the table */
.dice3d-cap { position: fixed; z-index: 281; left: 50%; bottom: max(1.4rem, env(safe-area-inset-bottom)); pointer-events: none;
  display: grid; justify-items: center; gap: .05rem; min-width: 9rem; padding: .55rem 1.3rem .65rem; text-align: center;
  color: #f6ecd6; background: radial-gradient(120% 140% at 50% 0%, #3a2c1fee, #140e09f2); border: 1px solid #e3c27e73; border-radius: 1.2rem;
  box-shadow: 0 18px 50px -12px #000c, inset 0 1px 0 #ffffff1f;
  opacity: 0; transform: translate(-50%, 14px) scale(.96); transition: opacity .25s ease, transform .35s cubic-bezier(.2, .9, .25, 1.2); }
.dice3d-cap.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.d3-who { font-weight: 700; font-size: .95rem; color: #e3c27e; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-label { font-size: .85rem; color: #cbbd9f; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-total { font-family: var(--head); font-size: 2.6rem; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; letter-spacing: .01em; }
.d3-flag { font-weight: 800; font-size: .8rem; padding: .1rem .55rem; border-radius: 99px; margin-top: .15rem; }
.dice3d-cap.crit { border-color: #f2cf6b; box-shadow: 0 0 0 3px #f2cf6b40, 0 0 46px -6px #f2cf6b, 0 18px 50px -12px #000c; }
.dice3d-cap.crit .d3-total { color: #ffe59a; text-shadow: 0 0 18px #f2cf6b99; }
.dice3d-cap.crit .d3-flag { background: #f2cf6b; color: #2a1c05; }
.dice3d-cap.fumble { border-color: #b8423a; }
.dice3d-cap.fumble .d3-total { color: #ff9b8f; }
.dice3d-cap.fumble .d3-flag { background: #b8423a; color: #fff3ef; }
[data-theme="future"] .dice3d-cap, [data-theme="wasteland"] .dice3d-cap { border-radius: 4px; }

/* ---- Account page picker ---- */
.dice-h { margin: 1.1rem 0 .1rem; font-size: 1.05rem; }
.dice-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr)); gap: .5rem; margin: .7rem 0 1rem; }
.dice-set { display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; font: inherit; font-size: .9rem; text-align: left; color: var(--ink);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--radius); cursor: pointer; }
.dice-set:hover { border-color: var(--line); }
.dice-set.on { border-color: var(--gilt, var(--accent)); box-shadow: inset 0 0 0 1px var(--gilt, var(--accent)); font-weight: 700; }
.dice-set > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* a little d20 silhouette in the set's colors */
.dice-gem { flex: none; width: 2rem; height: 2.15rem; display: grid; place-items: center; font: 800 .72rem/1 var(--body); padding-top: .2rem;
  clip-path: polygon(50% 0, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%); text-shadow: 0 1px 1px #0006; }

@media (prefers-reduced-motion: reduce) { .dice3d-cap { transition: opacity .2s; transform: translate(-50%, 0); } }
@media print { .dice3d, .dice3d-cap { display: none !important; } }

/* =====================================================================
   Dice page: a tray of dice on the left, the result and history on the right
   ===================================================================== */
.dt-target { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.dt-target select { width: auto; max-width: 22rem; }
.dt-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
@media (max-width: 900px) { .dt-grid { grid-template-columns: 1fr; } }

.dt-dice { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 560px) { .dt-dice { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.dt-die { position: relative; display: grid; justify-items: center; gap: .2rem; padding: .7rem .2rem .55rem; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--radius); transition: border-color .15s, transform .08s; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.dt-die:hover { border-color: var(--gilt, var(--accent)); }
.dt-die:active { transform: translateY(1px) scale(.97); }
.dt-die svg { width: 2.6rem; height: 2.6rem; fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; }
.dt-n { font-weight: 800; font-size: .95rem; }
.dt-count { position: absolute; top: .3rem; right: .3rem; min-width: 1.45rem; height: 1.45rem; padding: 0 .3rem; border-radius: 99px; display: grid; place-items: center;
  font-weight: 800; font-size: .8rem; background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 6px #0003; }

.dt-build { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; margin-top: 1rem; align-items: center; }
.dt-mod { display: flex; align-items: center; gap: .3rem; }
.dt-mod .btn { width: 2.4rem; padding-inline: 0; justify-content: center; font-size: 1.15rem; }
.dt-mod output { min-width: 2.8rem; text-align: center; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.dt-text { font-family: var(--mono, ui-monospace, monospace); font-size: 1.05rem; }
.dt-label { grid-column: 1 / -1; }
.dt-go { grid-column: 1 / -1; display: flex; gap: .6rem; }
.dt-roll { flex: 1; font-size: 1.1rem; padding-block: .75rem; justify-content: center; }
.dt-quick { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line2); }
.chipbtn { font: inherit; font-weight: 700; font-size: .9rem; padding: .35rem .8rem; border-radius: 99px; cursor: pointer; color: var(--ink);
  background: var(--panel2); border: 1px solid var(--line2); }
.chipbtn:hover { border-color: var(--gilt, var(--accent)); }

.dt-last { min-height: 11rem; display: grid; align-content: center; justify-items: center; text-align: center; gap: .3rem; padding: .6rem 0 1rem;
  border-bottom: 1px solid var(--line2); margin-bottom: .6rem; }
.dt-empty { max-width: 28ch; }
.dt-cap { font-weight: 700; }
.dt-total { font-family: var(--head); font-size: clamp(3.2rem, 9vw, 4.6rem); line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.dt-last.crit .dt-total { color: var(--gilt, #c99a2e); }
.dt-last.fumble .dt-total { color: var(--bad, #a33); }
.dt-flag { margin: .1rem 0 0; font-weight: 800; }
.dt-parts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .3rem; }
.dt-v { min-width: 1.9rem; height: 1.9rem; padding: 0 .35rem; display: inline-grid; place-items: center; border-radius: var(--r-sm); font-weight: 800;
  background: var(--panel2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.dt-v.drop { opacity: .45; text-decoration: line-through; border-style: dashed; }
.dt-v.max { border-color: var(--gilt, #c99a2e); color: var(--gilt, #c99a2e); }
.dt-v.min { border-color: var(--bad, #a33); color: var(--bad, #a33); }
.dt-op, .dt-flat { font-weight: 700; color: var(--muted); }
.dt-where { font-size: .85rem; color: var(--muted); }
.dt-stats { display: grid; grid-template-columns: repeat(6, auto); gap: .45rem; }
.dt-stat strong { display: grid; place-items: center; width: 2.9rem; height: 3.2rem; font-family: var(--head); font-size: 1.6rem; border-radius: var(--r-sm);
  background: var(--panel2); border: 1px solid var(--line); }
.dt-h { font-size: 1.05rem; margin: 0; }
.dt-hist { list-style: none; margin: .4rem 0 0; padding: 0; max-height: 26rem; overflow: auto; }
.dt-hist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .6rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line2); }
.dt-hist li:first-child { border-top: 0; }
.dt-hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-ht { font-weight: 800; font-variant-numeric: tabular-nums; }
