:root {
  --paper: #fff4dc;
  --dot: #f0dcb4;
  --ink: #2b2140;
  --ground: #ffd166;
  --ground-edge: #2b2140;
  --button: #fffaf0;
  --font: ui-rounded, "Arial Rounded MT Bold", "Nunito", "Varela Round", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 2px, transparent 2.5px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
}

/* The title sits behind the canvas so blobs can bounce over it. */
.title {
  position: fixed;
  top: 0;
  left: 0;
  padding: 18px 22px;
  pointer-events: none;
  z-index: 0;
}

.title h1 {
  margin: 0;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  transform: rotate(-3deg);
  transform-origin: left center;
  text-shadow: 4px 4px 0 var(--ground);
}

.tagline {
  margin: 14px 0 0;
  font-size: clamp(0.85rem, 2.6vw, 1.05rem);
  opacity: 0.75;
  max-width: 60vw;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 12px 0 0;
  font-size: 0.8rem;
}

.stats span {
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--button);
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
  cursor: grab;
}

#stage.grabbing { cursor: grabbing; }

.controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

button {
  font: inherit;
  color: inherit;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--button);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--ink);
}

button:focus-visible {
  outline: 3px solid #ef476f;
  outline-offset: 3px;
}

.controls button {
  padding: 8px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* The tray doubles as the ground the blobs stand on. */
.tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: safe center;
  gap: 10px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-x: auto;
  background: var(--ground);
  border-top: 4px solid var(--ground-edge);
  scrollbar-width: none;
}

.tray::-webkit-scrollbar { display: none; }

.tray button {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

@media (hover: hover) {
  .tray button:hover { animation: wiggle 0.35s ease-in-out infinite; }
}

@keyframes wiggle {
  0%, 100% { rotate: -7deg; }
  50% { rotate: 7deg; }
}

@media (prefers-reduced-motion: reduce) {
  .tray button:hover { animation: none; }
}

@media (max-width: 520px) {
  .title { padding: 14px 16px; }
  .tagline { max-width: 100%; padding-right: 0; margin-top: 10px; }
  .controls { top: 12px; right: 12px; }
  .controls button { padding: 6px 9px; font-size: 0.8rem; }
  .tray { gap: 8px; }
  .tray button { width: 50px; height: 50px; font-size: 25px; }
}
