body {
  background: #8fd17a;
}

#board {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#hud {
  position: fixed;
  z-index: 40;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  pointer-events: none;
}

#hud span {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: #14213d;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

#result {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 33, 61, 0.5);
  animation: fade 0.25s ease-out;
}

#result[hidden] {
  display: none;
}

#result .card {
  width: min(520px, 100%);
  padding: clamp(18px, 4vmin, 32px);
  border-radius: 36px;
  border: 6px solid #fff;
  background: linear-gradient(160deg, #fff7d6, #ffe5d9);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.15), 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

#stars {
  font-size: clamp(56px, 13vmin, 96px);
  line-height: 1.1;
  letter-spacing: 0.1em;
}

#stars .off {
  filter: grayscale(1);
  opacity: 0.3;
}

#tally {
  margin-top: 8px;
  color: #14213d;
  font-size: clamp(24px, 5vmin, 36px);
  font-weight: 800;
}

#result .buttons {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 4vmin, 32px);
  margin-top: clamp(16px, 4vmin, 28px);
}

#result button {
  width: clamp(80px, 17vmin, 120px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid #fff;
  background: #118ab2;
  color: #fff;
  font-size: clamp(36px, 8vmin, 56px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}

#result button:active {
  transform: translateY(6px) scale(0.95);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

#result #again { background: #ffd166; }
#result #next { background: #06d6a0; }

#result button[hidden] {
  display: none;
}

@keyframes fade { from { opacity: 0; } }

@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
