/* Farver – skift dem her for at ændre hele sidens udseende */
:root {
  --bg: #f6f1e6;
  --text: #2b2118;
  --muted: #6b5d4f;
  --accent: #8b1e2d;
  --gold: #d4a017;
  --paper: #fbf7ee;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714;
    --text: #efe6d6;
    --muted: #b3a58f;
    --accent: #c43a4f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 9rem;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.75rem);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 28rem;
}

a { color: var(--accent); }

/* Tegningen i midten */
.drawing {
  display: block;
  width: min(70vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
}

.drawing[hidden] { display: none; }

.drawing.pop { animation: pop 0.45s cubic-bezier(.3, 1.6, .5, 1); }

@keyframes pop {
  from { transform: scale(0.3) rotate(-10deg); opacity: 0; }
}

.result {
  margin: 0;
  min-height: 3em;
  font-size: 1.15rem;
  color: var(--muted);
}

.result strong {
  display: block;
  font-size: 2.5rem;
  line-height: 1.1;
  color: var(--accent);
}

/* Terningen nederst i midten */
.d20 {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  width: 84px;
  height: 84px;
  margin-left: -42px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.d20 svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 4px rgb(0 0 0 / 0.3));
}

.d20:hover svg { transform: rotate(-8deg); }

.d20.rolling svg { animation: roll 0.9s cubic-bezier(.3, .6, .4, 1); }

@keyframes roll {
  30% { transform: translateY(-70px) rotate(400deg) scale(1.1); }
  60% { transform: translateY(0) rotate(620deg); }
  75% { transform: translateY(-15px) rotate(690deg); }
  100% { transform: rotate(720deg); }
}

.d20 .body { fill: var(--accent); }

.d20 .body, .d20 .edges {
  stroke: rgb(255 255 255 / 0.35);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.d20 .edges { fill: none; }

.d20 text {
  fill: #fff;
  font: bold 24px Georgia, serif;
  text-anchor: middle;
  dominant-baseline: middle;
}

.d20.nat20 text { fill: var(--gold); }
.d20.nat1 .body { fill: #555; }

.d20:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
  border-radius: 50%;
}
