html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #1a1520;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: -apple-system, system-ui, sans-serif;
}

#stage {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  cursor: grab;
}
#stage.dragging { cursor: grabbing; }

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#debug {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font: 12px/1.3 ui-monospace, Menlo, monospace;
  border-radius: 6px;
  pointer-events: none;
  white-space: pre;
  z-index: 5;
}

/* --- HUD bottom (targets panel) --- */
#hud-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20,15,25,0) 0%, rgba(20,15,25,0.55) 60%, rgba(20,15,25,0.75) 100%);
}

#counter {
  color: #fff;
  font: 700 15px/1 -apple-system, system-ui, sans-serif;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#counter-found { color: #7ee88f; }

#targets {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100vw;
  padding: 4px 8px;
  scrollbar-width: none;
}
#targets::-webkit-scrollbar { display: none; }

.target {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 250, 245, 0.92);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: transform 0.18s ease, opacity 0.25s ease, border-color 0.25s ease, filter 0.25s ease;
}
.target img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  /* silhouette: pure dark shape */
  filter: brightness(0) saturate(100%) opacity(0.78);
}
.target.found {
  border-color: #7ee88f;
  background: rgba(126, 232, 143, 0.18);
  transform: scale(0.92);
}
.target.found img {
  /* reveal actual sprite once found */
  filter: none;
  opacity: 0.9;
}
.target.found::after {
  content: '✓';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #7ee88f;
  color: #0e2c14;
  font: 800 14px/22px -apple-system, system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
.target.pulse {
  animation: target-pulse 0.55s ease;
}
@keyframes target-pulse {
  0%   { transform: scale(0.92); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(0.92); }
}
