.tool-workbench.dice-roller-mounted {
  width: min(1280px, calc(100vw - 72px)) !important;
  max-width: 1280px !important;
}

.dice-roller-page {
  overflow: auto !important;
}

.dice-roller-mounted,
.dice-roller-mounted * {
  box-sizing: border-box;
}

#diceRollerMount {
  color: #081631;
}

.dice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  margin-top: 18px;
}

.dice-stage-card,
.dice-control-card,
.dice-guide article {
  border: 1px solid rgba(188, 207, 242, 0.82);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 58px rgba(35, 75, 145, 0.1);
}

.dice-stage-card {
  padding: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 183, 65, 0.16), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(105, 93, 255, 0.16), transparent 30%),
    rgba(255, 255, 255, 0.96);
}

.dice-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.dice-presets button,
.dice-roll-actions button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.dice-presets button {
  min-height: 36px;
  border-radius: 12px;
  padding: 0 15px;
  color: #49648e;
  background: #f0f5ff;
  font-size: 13px;
  font-weight: 780;
}

.dice-presets button.active {
  color: #fff;
  background: linear-gradient(135deg, #176dff, #7464ff);
  box-shadow: 0 12px 26px rgba(42, 101, 232, 0.2);
}

.dice-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 18px;
  align-items: center;
  min-height: 330px;
  margin-top: 18px;
  border-radius: 24px;
  padding: 24px;
  background:
    linear-gradient(rgba(85, 126, 205, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85, 126, 205, 0.06) 1px, transparent 1px),
    linear-gradient(145deg, #f7fbff, #ffffff);
  background-size: 24px 24px, 24px 24px, auto;
}

.dice-cube {
  position: relative;
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  justify-self: center;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.64), transparent 22%),
    linear-gradient(145deg, #ffb43d, #ff6d4e 48%, #775fff);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    inset -10px -14px 24px rgba(17, 28, 60, 0.14),
    0 20px 34px rgba(66, 91, 170, 0.18);
  transform: rotate(-2deg);
}

.dice-cube:nth-child(2n) {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.6), transparent 22%),
    linear-gradient(145deg, #25d4a0, #1789ff 55%, #765cff);
  transform: rotate(3deg);
}

.dice-cube.rolling {
  animation: dice-roll 430ms cubic-bezier(.34, 1.56, .64, 1) var(--delay, 0ms) infinite;
}

@keyframes dice-roll {
  0% { transform: translateY(0) rotate(-6deg) scale(1); }
  48% { transform: translateY(-12px) rotate(10deg) scale(1.04); }
  100% { transform: translateY(0) rotate(-4deg) scale(1); }
}

.dice-cube strong {
  font-size: 48px;
  line-height: 1;
}

.dice-cube span {
  position: absolute;
  right: 12px;
  bottom: 10px;
  opacity: 0.82;
  font-size: 12px;
  font-weight: 800;
}

.dice-dots {
  display: grid;
  width: 72px;
  height: 72px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
}

.dice-dots i {
  display: block;
  border-radius: 999px;
}

.dice-dots i.on {
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.18);
}

.dice-roll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.dice-roll-actions button {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 18px;
  color: #31527f;
  background: #eef5ff;
  font-size: 13px;
  font-weight: 800;
}

.dice-roll-actions button:first-child {
  min-width: 128px;
  color: #fff;
  background: linear-gradient(135deg, #176dff, #705fff);
  box-shadow: 0 14px 30px rgba(42, 101, 232, 0.18);
}

.dice-roll-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.dice-roll-actions button:not(:disabled):hover,
.dice-presets button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(31, 76, 154, 0.13);
}

.dice-message {
  min-height: 22px;
  margin: 13px 0 0;
  color: #60749a;
  font-size: 14px;
  font-weight: 720;
}

.dice-control-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dice-total {
  min-height: 162px;
  border-radius: 22px;
  padding: 20px;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 171, 43, 0.24), transparent 32%),
    linear-gradient(145deg, #f8fbff, #fff);
}

.dice-total span,
.dice-summary span,
.dice-history div span,
.dice-fields span {
  color: #62749a;
  font-size: 12px;
  font-weight: 740;
}

.dice-total strong {
  display: block;
  margin-top: 8px;
  color: #081631;
  font-size: 58px;
  line-height: 1;
}

.dice-total small {
  display: block;
  margin-top: 12px;
  color: #6d7fa0;
  font-size: 13px;
  font-weight: 720;
}

.dice-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dice-fields label {
  display: grid;
  gap: 7px;
}

.dice-fields input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(60, 105, 205, 0.23);
  border-radius: 13px;
  padding: 0 12px;
  outline: none;
  color: #0b1737;
  background: #fff;
  font-size: 15px;
  font-weight: 780;
}

.dice-fields input:focus {
  border-color: #176fff;
  box-shadow: 0 0 0 4px rgba(23, 111, 255, 0.1);
}

.dice-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dice-summary article {
  min-height: 78px;
  border-radius: 18px;
  padding: 14px;
  background: #f5f8ff;
}

.dice-summary b {
  display: block;
  margin-top: 7px;
  color: #0c1938;
  font-size: 26px;
  line-height: 1;
}

.dice-history {
  border-radius: 20px;
  padding: 16px;
  background: #fbfdff;
}

.dice-history div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dice-history h2 {
  margin: 0;
  color: #081631;
  font-size: 18px;
}

.dice-history ol {
  display: grid;
  gap: 9px;
  max-height: 286px;
  margin: 14px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.dice-history li {
  display: grid;
  grid-template-columns: 64px 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-radius: 14px;
  padding: 10px;
  background: #f2f6ff;
  color: #526991;
  font-size: 12px;
  font-weight: 740;
}

.dice-history li.empty {
  display: block;
  text-align: center;
}

.dice-history li b {
  color: #0c1938;
  font-size: 20px;
  text-align: center;
}

.dice-history li small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dice-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.dice-guide article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.dice-guide b {
  color: #0b1737;
  font-size: 15px;
}

.dice-guide span {
  color: #667798;
  font-size: 13px;
  line-height: 1.65;
}

@media (max-width: 980px) {
  .tool-workbench.dice-roller-mounted {
    width: min(100% - 28px, 1280px) !important;
  }

  .dice-layout,
  .dice-guide {
    grid-template-columns: 1fr;
  }
}
