/* Global reset + base page setup, shared by every chapter. */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 400;
  overflow: hidden; /* each chapter owns a full-viewport scene */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* every touch should feel intentional: no grey tap flashes, and no
     long-press text-selection popping up mid-experience */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* the name inputs still need normal text behavior */
input {
  -webkit-user-select: text;
  user-select: text;
}

#app {
  position: relative;
  width: 100vw;
  height: 100dvh;
}

.chapter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The native [hidden] display rule loses to any author display rule by
   specificity (bit us on #chapter2 before, and again when resume-hiding
   #chapter1) — a hidden chapter must never render OR intercept taps. */
.chapter[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input {
  font-family: inherit;
  color: inherit;
}

/* ---- global sound toggle (visible across every chapter) ---- */
.sound-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-text-dim);
  opacity: 0.55;
  transition: opacity 0.25s var(--ease-soft), color 0.25s var(--ease-soft);
}

.sound-toggle:hover {
  opacity: 1;
  color: var(--color-mint);
}

.sound-toggle .sound-mute-line {
  opacity: 0;
  transition: opacity 0.2s var(--ease-soft);
}

.sound-toggle.is-muted .sound-wave {
  opacity: 0;
}

.sound-toggle.is-muted .sound-mute-line {
  opacity: 1;
}

@media (max-width: 480px) {
  .sound-toggle {
    top: 1rem;
    right: 1rem;
  }
}

/* Respect users who prefer minimal motion: collapse animation durations
   instead of removing them outright, so state transitions still make sense. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
