:root {
  --bg: #040408;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #fff;
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  overscroll-behavior: none;
  /* No text selection, magnifier, callouts or tap flashes for little fingers */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  /* Pin the document so iOS can't rubber-band or scroll it */
  position: fixed;
  inset: 0;
}

/* Horizontal pager: the only scrolling allowed is swiping between effects */
#pager {
  position: fixed;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: none;
  touch-action: pan-x;
  scrollbar-width: none;
}

#pager.single {
  overflow-x: hidden;
  touch-action: none;
}

#pager::-webkit-scrollbar {
  display: none;
}

.page {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

.page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Low-resolution 8-bit canvases: scale up with hard pixel edges */
.page canvas.pixelated {
  position: absolute;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Page indicator, kept clear of the home indicator */
#dots {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

#dots span {
  width: 6px;
  height: 6px;
  background: #fff;
  opacity: 0.25;
}

#dots span.on {
  opacity: 0.7;
}

/* Start overlay: needed for the iOS motion permission prompt and wake lock */
#start {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  border: 0;
  padding: 0;
  background: rgba(4, 4, 8, 0.7);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#start.gone {
  opacity: 0;
  pointer-events: none;
}

/* A pixel-art ball doing a two-frame 8-bit bounce */
#start .orb {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  animation: hop 0.8s steps(1) infinite;
}

#start .label {
  font: 700 22px/1 ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.2em;
  animation: blink 1.2s steps(1) infinite;
}

@keyframes hop {
  50% {
    translate: 0 -16px;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

#debug {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 4px);
  left: calc(env(safe-area-inset-left, 0px) + 8px);
  margin: 0;
  font: 11px/1.3 ui-monospace, monospace;
  color: #9f9;
  pointer-events: none;
  white-space: pre;
}
