* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --cream: #FDF3E3;
  --ink: #3E3428;
  --coral: #FF5D5D;
  --sun: #FFC838;
  --leaf: #4ECB71;
  --card: #FFFBF2;
}

html, body { height: 100%; }
body {
  background: #EFE2C8;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  justify-content: center;
}

#stage {
  position: relative;
  width: min(100vw, 520px);
  height: 100dvh;
  max-height: 100dvh;
  background: var(--cream);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(62, 52, 40, .18);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  pointer-events: none;
  z-index: 5;
}
#hud .badge {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 17px;
  background: var(--card);
  border: 2px solid rgba(62,52,40,.12);
  border-radius: 999px;
  padding: 5px 14px;
  box-shadow: 0 3px 0 rgba(62,52,40,.10);
}
.hud-right { display: flex; gap: 8px; }
.iconbtn {
  pointer-events: auto;
  font-size: 19px;
  line-height: 1;
  width: 40px; height: 40px;
  border: 2px solid rgba(62,52,40,.12);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(62,52,40,.10);
  cursor: pointer;
}
.iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(62,52,40,.10); }
.iconbtn.off { opacity: .45; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: var(--cream);
}
#win, #lose { background: rgba(62, 52, 40, .45); }

.logo { width: min(42vw, 190px); filter: drop-shadow(0 8px 0 rgba(62,52,40,.10)); }
.wordmark {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: clamp(44px, 13vw, 64px);
  margin-top: 14px;
  color: var(--coral);
  text-shadow: 0 4px 0 rgba(62,52,40,.12);
}
.tagline { font-weight: 800; font-size: 17px; margin: 8px 0 26px; opacity: .75; }
.hint { margin-top: 26px; font-weight: 600; font-size: 14px; opacity: .55; line-height: 1.5; }

.bigbtn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 24px;
  color: #fff;
  background: var(--leaf);
  border: none;
  border-radius: 18px;
  padding: 14px 52px;
  box-shadow: 0 6px 0 #379A54;
  cursor: pointer;
}
.bigbtn:active { transform: translateY(4px); box-shadow: 0 2px 0 #379A54; }

.ocard {
  background: var(--card);
  border-radius: 24px;
  padding: 30px 26px;
  width: min(86vw, 340px);
  box-shadow: 0 10px 0 rgba(62,52,40,.18);
}
.ocard h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 27px;
  margin-bottom: 8px;
}
.ocard p { font-weight: 600; opacity: .65; margin-bottom: 20px; }
#lose .ocard h2 { color: var(--coral); }
#win .ocard h2 { color: var(--leaf); }
