:root {
  --bg: #12101a;
  --card: #1d1a2b;
  --accent: #ffcf4d;
  --text: #e8e6f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: radial-gradient(circle at 50% 0%, #221d33, var(--bg));
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

main {
  width: 100%;
  max-width: 640px;
}

h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  margin: 0 0 28px;
  letter-spacing: 0.05em;
}

.dice {
  display: flex;
  gap: clamp(12px, 4vw, 28px);
  justify-content: center;
  margin-bottom: 32px;
}

.die {
  position: relative;
  flex: 1 1 0;
  max-width: 260px;
  aspect-ratio: 3 / 4;
  background: var(--card);
  border: 2px solid #34304a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.die img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.die .pip {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  min-width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Shake while rolling */
.die.rolling {
  animation: shake 0.18s infinite;
}
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-2px, 1px) rotate(-1.5deg); }
  50% { transform: translate(2px, -1px) rotate(1.5deg); }
  75% { transform: translate(-1px, 2px) rotate(-1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

button#roll {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 16px 48px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  box-shadow: 0 8px 22px rgba(255, 207, 77, 0.3);
}
button#roll:hover {
  filter: brightness(1.08);
}
button#roll:active {
  transform: translateY(2px);
}
button#roll:disabled {
  filter: grayscale(0.6) brightness(0.8);
  cursor: default;
}

.result {
  margin-top: 28px;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 700;
  min-height: 1.4em;
  color: var(--accent);
}
