/* Boop the Monster! — kid-friendly, thumb-sized, full-screen-first */
:root {
  --cream: #fdf3e3;
  --ink: #4a3b32;
  --pink: #f28cb1;
  --brown: #a9744f;
  --blue: #79b8e8;
  --yellow: #ffd66b;
  --green: #9bd48b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--cream) center / cover no-repeat;
  font-family: "Arial Rounded MT Bold", "Baloo 2", ui-rounded, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;   /* canvas handles its own gestures */
}

.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: transparent;
  overflow-y: auto;
}
#screen-menu, #screen-book, #screen-over, #screen-pause { background: rgba(253, 243, 227, 0.92); backdrop-filter: blur(2px); }

.menu-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }

#menu-duo {
  width: min(46vw, 220px); height: min(46vw, 220px);
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(74, 59, 50, 0.18));
  animation: pop-in 0.6s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.title {
  font-size: clamp(34px, 9vw, 56px);
  line-height: 0.95;
  letter-spacing: 1px;
  color: var(--ink);
  text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 6px 14px rgba(74,59,50,.25);
  max-width: 92vw;
}
.title-accent {
  color: var(--pink);
  -webkit-text-stroke: 2px var(--ink);
}
.byline { color: var(--brown); font-size: 15px; font-weight: 700; }
.bestline { color: var(--brown); font-size: 15px; font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 20px; font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff9ec3, #f2709e);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 14px 30px;
  min-width: 230px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 5px 0 var(--ink), 0 10px 18px rgba(74,59,50,.2);
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), 0 4px 10px rgba(74,59,50,.2); }
.btn-big { font-size: 26px; padding: 18px 40px; min-width: 280px; }
#btn-blitz { background: linear-gradient(180deg, #ffd66b, #f5a623); }
.btn-small { font-size: 16px; padding: 10px 18px; min-width: 0; }
.menu-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud .hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}
.hud-btn {
  pointer-events: auto;
  font-family: inherit; font-size: 22px; font-weight: 800;
  width: 54px; height: 54px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: rgba(255,255,255,.85);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(74,59,50,.35);
  cursor: pointer;
}
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(74,59,50,.35); }
.hud-btn svg { display: block; margin: 0 auto; pointer-events: none; }
.hud-scorebox { text-align: center; pointer-events: none; }
#hud-score {
  font-size: clamp(40px, 10vw, 64px);
  font-weight: 900;
  color: var(--ink);
  text-shadow: 0 3px 0 #fff, 0 7px 14px rgba(74,59,50,.25);
  line-height: 1;
}
#hud-combo {
  display: inline-block;
  margin-top: 6px;
  font-size: 20px; font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #9bd48b, #62b34f);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 16px;
  transform: rotate(-3deg);
}
#hud-fever {
  position: absolute; top: calc(84px + env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center;
  font-size: 28px; font-weight: 900; letter-spacing: 2px;
  color: #f5a623;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 0 0 18px rgba(255, 214, 107, .9);
  animation: fever-pulse .5s ease-in-out infinite alternate;
}
@keyframes fever-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
#hud-timer {
  position: absolute; top: calc(84px + env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center;
  font-size: clamp(24px, 6vw, 36px); font-weight: 900;
  color: var(--ink);
}

/* ---------- book ---------- */
.book-head { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 560px; }
.book-head h2 { font-size: 30px; }
.cards { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 560px; }
.card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 5px 0 rgba(74,59,50,.25);
  text-align: center;
}
.card-art { display: flex; gap: 12px; justify-content: center; align-items: center; }
.card-art img { width: 42%; max-width: 200px; border-radius: 14px; }
.card-art img:first-child { background: var(--cream); object-fit: cover; }
.card h3 { font-size: 22px; margin-top: 8px; }
.card p { color: var(--brown); font-weight: 700; font-size: 14px; }

/* ---------- game over ---------- */
#screen-over h2 { font-size: clamp(30px, 8vw, 44px); }
.big-score { font-size: clamp(64px, 20vw, 120px); font-weight: 900; line-height: 1; text-shadow: 0 4px 0 #fff; }
#screen-over .bestline { font-size: 18px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 16px; font-weight: 700;
  padding: 12px 20px; border-radius: 999px;
  z-index: 50;
  max-width: 88vw; text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.3);
}

button:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }
