:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --die: #f4f6fb;
  --pip: #1a2233;
  --accent: #56dcff;
  --muted: #86a5ba;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: system-ui, -apple-system, sans-serif;
  color: #e8eef5;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 36px;
  background: var(--panel);
  border-radius: 18px;
}

.die {
  position: relative;
  width: 150px;
  height: 150px;
  background: var(--die);
  border-radius: 22px;
  transition: transform 0.15s ease;
}

.die.shaking {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-14deg) scale(1.05); }
  40%  { transform: rotate(12deg) scale(0.97); }
  60%  { transform: rotate(-8deg) scale(1.03); }
  80%  { transform: rotate(6deg) scale(0.99); }
  100% { transform: rotate(0deg) scale(1); }
}

.pip {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pip);
  opacity: 0;
}

.pip.visible { opacity: 1; }

/* grid positions: 3x3, cols at 22/50/78%, rows at 22/50/78% */
.pip[data-pos="1"] { left: 11%; top: 11%; }
.pip[data-pos="2"] { right: 11%; top: 11%; }
.pip[data-pos="3"] { left: 11%; bottom: 11%; }
.pip[data-pos="4"] { right: 11%; bottom: 11%; }
.pip[data-pos="5"] { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pip[data-pos="6"] { left: 11%; top: 50%; transform: translateY(-50%); }
.pip[data-pos="7"] { right: 11%; top: 50%; transform: translateY(-50%); }

.result {
  font-size: 28px;
  font-weight: 700;
  min-height: 34px;
}

.roll-btn {
  font-size: 20px;
  font-weight: 700;
  padding: 12px 44px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #06202c;
  cursor: pointer;
}

.roll-btn:hover { filter: brightness(1.1); }
.roll-btn:disabled { opacity: 0.5; cursor: default; }

.history {
  display: flex;
  gap: 8px;
  min-height: 26px;
  color: var(--muted);
  font-size: 16px;
}
