/* Full-screen mobile shell; desktop gets the same viewport-sized layout. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  overscroll-behavior: none; /* only works from the root: kills pull-to-refresh */
  touch-action: manipulation; /* no double-tap or pinch zoom anywhere */
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh; /* 100vh alone hides the bottom behind the mobile address bar */
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(120% 90% at 50% 0%, #20143a 0%, #0a0712 70%);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* taps and drags feed the game, never scroll the page */
}

/* Overlays routed by GAME.setScreen(); only tappables catch taps — text and
   wrappers let them through to the canvas. */
.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem;
  gap: 0.75rem;
}
.screen, .screen * { pointer-events: none; }
.screen :is(button, a, input, [data-action]) { pointer-events: auto; }
.screen[hidden] { display: none; } /* display: grid above would defeat [hidden] */

/* Play layout: HUD up top, ingredients anchored to the bottom, the bowl of
   slime sits in the open middle (clicks there steer the slime's eyes). */
.screen[data-screen="play"] {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
}

#hud {
  padding: calc(env(safe-area-inset-top) + 14px) 16px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
#hud .stats { text-align: left; line-height: 1.25; }
#hud .stats b { font-size: 1.05rem; }
#hud .stats span { color: #cdbfff; font-size: 0.92rem; }
#hud .actions { display: flex; gap: 8px; }

#hud button, #tray button {
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
  padding: 0.5rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(124,108,255,0.92);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#hud button:active, #tray button:active { transform: scale(0.96); }
#hud button.ghost { background: rgba(255,255,255,0.16); }

#tray-container {
  position: fixed;
  left: 0; right: 0;
  bottom: env(safe-area-inset-bottom);
  margin: 0;
  padding: 4px 8px calc(env(safe-area-inset-bottom) + 4px);
  background: linear-gradient(0deg, rgba(10,7,18,0.98) 75%, rgba(10,7,18,0));
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 48vh;
}

.tray-tabs {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 0.68rem;
  font-weight: bold;
  color: #a395d6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tray-tabs .secret-tab { color: #f9a826; }

#tray {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 38vh;
  padding: 2px;
}

#tray button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 40px;
  min-width: 0;
  padding: 0.22rem 0.25rem;
  font-size: 0.62rem;
  line-height: 1.1;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tray button .emoji { font-size: 1.25rem; line-height: 1; }
#tray button:disabled { opacity: 0.38; }
#tray button:disabled:active { transform: none; }

button.start-main {
  font: inherit;
  font-size: 1.15rem;
  min-height: 48px;
  padding: 0.7rem 2.4rem;
  border: 0;
  border-radius: 999px;
  background: #7c6cff;
  color: #fff;
  cursor: pointer;
  justify-self: center;
}
button.start-main:active { transform: scale(0.96); }

h1 { margin: 0; font-size: 2.4rem; }
#tagline { margin: 0 0 1rem; color: #8f8ba8; max-width: 22rem; }
#resume-note { margin: 0; color: #8f8ba8; font-size: 0.95rem; }
