.lt-dice {
  --lt-dice-ink: var(--lt-text, #fff4d8);
  --lt-dice-muted: var(--lt-text-soft, #d3d5cb);
  --lt-dice-brass: var(--lt-brass-bright, #efc77e);
  --lt-dice-deep: color-mix(in srgb, var(--lt-sea-950, #050f11) 91%, transparent);
  --lt-dice-line: color-mix(in srgb, var(--lt-brass-bright, #efc77e) 34%, transparent);
  color: var(--lt-dice-ink);
  font-family: var(--lt-font-serif, "Noto Serif SC", "Songti SC", "STSong", Georgia, serif);
  font-size: 1rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.lt-dice *,
.lt-dice *::before,
.lt-dice *::after {
  box-sizing: inherit;
}

.lt-dice[hidden],
.lt-dice [hidden] {
  display: none !important;
}

.lt-dice--overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  overflow: hidden;
  pointer-events: none;
}

.lt-dice__veil {
  display: none;
}

.lt-dice__panel,
.lt-dice__stage {
  position: absolute;
  inset: 0;
  min-width: 0;
  overflow: hidden;
  pointer-events: none;
}

.lt-dice__panel {
  opacity: 0;
  transition: opacity var(--lt-motion-fast, 150ms) ease;
}

.lt-dice.is-open .lt-dice__panel {
  opacity: 1;
}

.lt-dice__heading {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lt-dice__header {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lt-dice__canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(1.08) contrast(1.03);
}

.lt-dice__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: clamp(0.75rem, 2.4vw, 1.5rem);
  padding: max(4.5rem, env(safe-area-inset-top)) 1.25rem max(6.75rem, env(safe-area-inset-bottom));
}

.lt-dice__fallback-die {
  display: grid;
  place-items: center;
  width: clamp(6rem, 13vw, 9rem);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 221, 157, 0.9);
  border-radius: 18%;
  background: rgba(45, 91, 96, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 228, 0.22),
    inset 0 -1.6rem 2.5rem rgba(3, 12, 14, 0.3),
    0 1.25rem 2.6rem rgba(0, 0, 0, 0.38),
    0 0 2.5rem rgba(89, 176, 181, 0.12);
  transform: rotate(0deg);
}

.lt-dice__fallback-die:nth-child(3n + 2) { background: rgba(124, 71, 60, 0.96); }
.lt-dice__fallback-die:nth-child(3n) { background: rgba(83, 92, 68, 0.96); }

.lt-dice__fallback-die.is-tumbling {
  animation: lt-dice-fallback-throw 850ms cubic-bezier(0.18, 0.72, 0.2, 1);
}

.lt-dice__fallback-die small {
  align-self: end;
  color: #f2ca81;
  font: 750 0.78rem/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.lt-dice__fallback-die strong {
  align-self: start;
  color: #fff8e4;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  line-height: 1.1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.lt-dice__readout {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(46rem, calc(100% - 1.5rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
  min-height: 3.25rem;
  padding: 0.38rem 0.42rem 0.38rem 0.85rem;
  border: 1px solid var(--lt-dice-line);
  border-radius: var(--lt-radius-md, 0.5rem);
  background: var(--lt-dice-deep);
  box-shadow: 0 0.85rem 2.4rem rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px) saturate(0.86);
  -webkit-backdrop-filter: blur(12px) saturate(0.86);
  pointer-events: auto;
  opacity: 0;
  transform: translate(-50%, 0.55rem);
  transition: opacity var(--lt-motion-fast, 150ms) ease, transform var(--lt-motion-page, 220ms) var(--lt-ease-out, ease), border-color var(--lt-motion-fast, 150ms) ease;
}

.lt-dice.is-open .lt-dice__readout {
  opacity: 1;
  transform: translate(-50%, 0);
}

.lt-dice.is-settled .lt-dice__readout {
  border-color: rgba(239, 199, 126, 0.56);
}

.lt-dice__status {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--lt-dice-muted);
  font-size: clamp(0.84rem, 1.6vw, 0.96rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.lt-dice.is-settled .lt-dice__status {
  color: var(--lt-dice-ink);
}

.lt-dice__controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
}

.lt-dice__control {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.52rem 0.68rem;
  border: 1px solid rgba(234, 217, 180, 0.28);
  border-radius: var(--lt-radius-sm, 0.25rem);
  background: rgba(255, 255, 255, 0.035);
  color: var(--lt-dice-ink);
  font: 650 0.875rem/1.15 var(--lt-font-sans, ui-sans-serif, system-ui, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}

.lt-dice__control:hover {
  border-color: rgba(239, 199, 126, 0.78);
  background: rgba(239, 199, 126, 0.1);
}

.lt-dice__control:focus-visible {
  outline: 3px solid #f5d597;
  outline-offset: 2px;
}

.lt-dice__control--skip {
  border-color: rgba(239, 199, 126, 0.42);
}

.lt-dice--inline {
  position: relative;
  display: block;
  min-height: 20rem;
  overflow: hidden;
}

.lt-dice--inline .lt-dice__panel,
.lt-dice--inline .lt-dice__stage {
  position: absolute;
}

.lt-dice--inline .lt-dice__readout {
  bottom: 0.5rem;
  width: calc(100% - 1rem);
}

@keyframes lt-dice-fallback-throw {
  0% { opacity: 0; transform: translate(-45vw, -3rem) rotate(-180deg) scale(0.72); }
  56% { opacity: 1; transform: translate(0.7rem, 0.45rem) rotate(24deg) scale(1.05); }
  78% { transform: translate(-0.25rem, -0.28rem) rotate(-7deg) scale(0.99); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}

@media (max-width: 37.5rem) {
  .lt-dice__fallback {
    gap: 0.65rem;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .lt-dice__fallback-die {
    width: clamp(4.6rem, 25vw, 6.5rem);
  }

  .lt-dice__readout {
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
    width: calc(100% - 1rem - env(safe-area-inset-left) - env(safe-area-inset-right));
    padding: 0.55rem;
  }

  .lt-dice__status {
    min-height: 1.25rem;
    padding: 0 0.15rem;
    font-size: 0.84rem;
  }

  .lt-dice__controls {
    width: 100%;
  }

  .lt-dice__control {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lt-dice__panel,
  .lt-dice__readout,
  .lt-dice__fallback-die {
    animation: none !important;
    transition: none !important;
  }
}
