/* Shared by the side-scrollers (Jungle Kid, Caveman): a 16:9 stage, and a
   pad of buttons — below the game on an upright phone, over its bottom
   corners when the phone is turned sideways. */

html, body { overscroll-behavior: none; }
.game {
  position: relative;
  width: min(calc(100vw - 16px), calc((100vh - 72px) * 16 / 9));
  width: min(calc(100vw - 16px), calc((100dvh - 72px) * 16 / 9));
  margin: 8px auto 0;
}
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 16px 40px rgba(0, 0, 0, 0.4);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
canvas { display: block; width: 100%; height: 100%; }
.overlay { background: rgba(10, 30, 15, 0.62) !important; padding: 14px; gap: 10px !important; }
.overlay h2 { font-size: clamp(24px, 5vw, 38px); letter-spacing: 0.06em; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.overlay p { max-width: 460px; margin: 0 auto; line-height: 1.4; font-size: clamp(12px, 2.4vw, 15px); }
.overlay p b { color: var(--ink); }
.kcard .big:not(.btn) { font-size: clamp(32px, 7vw, 52px); font-weight: 900; color: var(--ink); line-height: 1; }
.overlay .hint { font-size: 12px; }
.touch .keys { display: none; }
#pause {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.3); color: #fff; display: grid; place-items: center; z-index: 5;
}
#pause svg { width: 16px; height: 16px; }

.pad { display: none; justify-content: space-between; padding: 14px 4px 0; user-select: none; -webkit-user-select: none; touch-action: none; }
.touch .pad.show { display: flex; }
.pad .side { display: flex; gap: 14px; align-items: center; }
.pad button {
  width: 72px; height: 72px; border-radius: 50%; border: 0; font-size: 26px; font-weight: 900;
  color: #fff; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  touch-action: none; transition: transform 60ms, background 60ms;
}
.pad button.act { background: rgba(255, 176, 32, 0.45); }
.pad button.big { width: 84px; height: 84px; }
.pad button.on { transform: scale(0.9); background: rgba(255, 255, 255, 0.4); }

/* Phone on its side: the game fills the screen, buttons over its corners. */
@media (orientation: landscape) and (pointer: coarse) {
  .topbar { display: none; }
  .game { width: min(100vw, calc(100dvh * 16 / 9)); margin: 0 auto; }
  .stage { border-radius: 0; }
  .pad { position: absolute; left: 0; right: 0; bottom: 8px; padding: 0 14px; pointer-events: none; }
  .pad .side { pointer-events: auto; }
  .pad button { background: rgba(255, 255, 255, 0.12); }
}

/* The title's level buttons: Play on its own line, then the levels. */
#levels.modes { grid-template-columns: repeat(3, 1fr); max-width: 480px; margin: 0 auto; }
#levels .btn { --accent: #2bb048; --accent-ink: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
#levels .btn.quiet { --edge: color-mix(in srgb, var(--accent) 60%, #000); background: linear-gradient(color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); color: #fff; box-shadow: 0 4px 0 var(--edge), 0 7px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.4); }
#levels .btn:first-child { grid-column: 1 / -1; justify-self: center; width: 260px; --accent: #f6c020; --accent-ink: #4a2a00; text-shadow: none; font-size: 21px; padding: 11px 26px 13px; border-radius: 16px; }
