@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #3a2418;
  --cream: #fffaf3;
  --moss: #2f6b4f;
  --moss-dark: #1e4634;
  --amber: #f2c14e;
  --fox: #c4521a;
  font-family: Nunito, ui-rounded, "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100dvh;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

body[data-game="beetle"] { background: #d7ecab; }
body[data-game="stars"] { background: #24385c; color: #fffaf3; }
body[data-game="drum"] { background: #f6e3b6; }

button, a { font: inherit; font-weight: 800; }
button { cursor: pointer; border: none; }

button:focus-visible, a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2rem);
  text-align: center;
}

.icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--moss);
  color: #fffaf3;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--moss-dark);
}

.icon svg { width: 26px; height: 26px; fill: currentColor; }

.say {
  margin: 14px auto 0;
  max-width: 28rem;
  min-height: 2.6em;
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 800;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 12px 0 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.choice, .num, .drum, .again, .replay {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 6px 0 rgba(90, 60, 40, 0.22);
}

.choice, .num {
  min-width: 108px;
  min-height: 108px;
  border-radius: 28px;
  padding: 8px;
}

.choice svg, .lead svg { width: 108px; height: auto; display: block; }
.lead svg { width: min(46vw, 180px); }

.choice.bad, .num.bad { animation: shake 0.35s ease; }
.choice.good, .num.good, .lead.good { animation: hop 0.45s ease; }

.num {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
}

.num b {
  font-size: 2.4rem;
  line-height: 1;
}

.pips { display: flex; gap: 4px; }
.pips i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.sky {
  position: relative;
  width: min(520px, 100%);
  height: min(42vh, 280px);
}

.star {
  position: absolute;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #f2c14e;
}

.star svg { width: 64px; height: 64px; display: block; filter: drop-shadow(0 0 6px rgba(242, 193, 78, 0.7)); }

.moon {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #f6d7b0;
  box-shadow: inset -12px -4px 0 #e7c49a;
}

.dots { display: flex; gap: 10px; min-height: 22px; }
.dots i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(90, 60, 40, 0.18);
}
.dots i.on { background: var(--fox); }
body[data-game="stars"] .dots i { background: rgba(255, 250, 243, 0.25); }
body[data-game="stars"] .dots i.on { background: var(--amber); }

.drum {
  width: min(54vw, 220px);
  height: min(54vw, 220px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #f4e2ba, #e7d3a4 46%, #c9a36a 47%, #8b5a34 72%);
  box-shadow: 0 10px 0 #6b4030;
}

.drum.hit { transform: scale(0.96); }
.drum:disabled { cursor: default; }

.again, .replay {
  min-height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 1.2rem;
}

.again { background: var(--moss); color: #fffaf3; box-shadow: 0 5px 0 var(--moss-dark); }

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes hop {
  40% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .choice.bad, .num.bad, .choice.good, .num.good, .lead.good { animation: none; }
}
