:root {
  color-scheme: dark;
  --bg: #0f1118;
  --panel: #171b27;
  --accent: #7c5cff;
  --accent-2: #3ed3c2;
  --text: #ecf0ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 50% -20%, #2d2f57 0%, var(--bg) 45%);
  color: var(--text);
  font: 16px/1.4 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.app {
  min-height: 100dvh;
  padding: 24px;
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 14px;
}
h1 { margin: 0; font-size: 28px; }
.sub { opacity: 0.8; margin: 0 0 8px; }

.dice-wrap {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  margin: 8px auto;
  border: none;
  background: transparent;
  cursor: pointer;
}
.dice {
  width: 150px;
  aspect-ratio: 1;
  clip-path: polygon(50% 0%, 85% 12%, 100% 45%, 94% 80%, 65% 100%, 35% 100%, 6% 80%, 0% 45%, 15% 12%);
  background: linear-gradient(155deg, #ffd37a 0%, #fda53d 55%, #c96b1b 100%);
  box-shadow: 0 14px 35px rgba(0,0,0,.45), inset 0 2px 8px rgba(255,255,255,.35);
  color: #2b1d0f;
  font-weight: 900;
  font-size: 44px;
  display: grid;
  place-items: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
  transform-style: preserve-3d;
}
.dice.rolling {
  animation: tumble 900ms cubic-bezier(.2,.8,.2,1);
}
@keyframes tumble {
  0% { transform: rotateX(0) rotateY(0) scale(1); }
  30% { transform: rotateX(220deg) rotateY(250deg) scale(1.03); }
  60% { transform: rotateX(520deg) rotateY(440deg) scale(.98); }
  100% { transform: rotateX(720deg) rotateY(720deg) scale(1); }
}
.result {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 20px;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
button {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), #5b79ff);
}
button:disabled { opacity: .45; }
button#copyBtn { background: linear-gradient(135deg, var(--accent-2), #238fbe); }
.payload {
  background: var(--panel);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  overflow: auto;
}
