@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Oswald:wght@500;600;700&display=swap");

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

/* Keep browser scrolling/pull-to-refresh outside the game. Content scrolls in .app. */
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
  overscroll-behavior: none;
}

body.is-opening .app { overflow: hidden; }

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 48% 38% at 8% -8%, rgba(139, 44, 255, 0.22), transparent 58%),
    radial-gradient(ellipse 36% 28% at 92% 0%, rgba(61, 8, 124, 0.35), transparent 52%),
    radial-gradient(ellipse 50% 40% at 50% 110%, rgba(139, 44, 255, 0.08), transparent 62%),
    linear-gradient(rgba(139, 44, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 44, 255, 0.045) 1px, transparent 1px),
    var(--bg-primary);
  background-size: auto, auto, auto, 56px 56px, 56px 56px, auto;
}

.ambient-bg::before {
  content: "";
  position: absolute;
  width: 42vw;
  height: 42vw;
  left: 18%;
  top: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 76, 255, 0.16), transparent 68%);
  filter: blur(40px);
  animation: ambient-drift 18s ease-in-out infinite;
}

.ambient-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes ambient-drift {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
  50% { transform: translate(8%, 12%) scale(1.12); opacity: 1; }
}

.app { position: relative; z-index: 1; }

/* Nothing on the game page should become a browser text selection. */
html,
body,
body *,
body *::before,
body *::after {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none;
}
body img,
body a {
  -webkit-user-drag: none;
}
.app button,
.app a {
  touch-action: manipulation;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; border-radius: 0; }
h1, h2, h3, h4, p { margin: 0; }

.display {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-purple-light);
  outline-offset: 2px;
  outline-style: solid;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal-up 0.7s var(--ease-out) forwards;
}

.reveal-d1 { animation-delay: 0.08s; }
.reveal-d2 { animation-delay: 0.16s; }
.reveal-d3 { animation-delay: 0.24s; }
.reveal-d4 { animation-delay: 0.32s; }

@keyframes reveal-up {
  to { opacity: 1; transform: translateY(0); }
}
