:root {
  --bg-1: #050509;
  --bg-2: #0a1020;
  --bg-3: #11142a;
  --text: #f6f7fb;
  --muted: rgba(246, 247, 251, 0.72);
  --glow: rgba(125, 92, 255, 0.28);
  --glow-2: rgba(39, 221, 245, 0.12);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100%;
  overflow: hidden;
  font-family: "Geist", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 18%, var(--glow), transparent 34rem),
    radial-gradient(circle at 78% 76%, var(--glow-2), transparent 32rem),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3));
}

body::before {
  content: "";
  position: fixed;
  inset: -30%;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black, transparent 68%);
  animation: drift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 0, rgba(0,0,0,.42) 100%);
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(24px, 6vw, 96px);
}

.phrase-wrap {
  width: min(1180px, 92vw);
  text-align: center;
  margin-inline: auto;
}

.phrase {
  position: relative;
  display: inline-block;
  min-height: 1em;
  margin: 0;
  text-align: center;
  font-size: clamp(1.5rem, 5.4vw, 5.1rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.06em;
  color: var(--text);
  text-wrap: balance;
  text-shadow: 0 0 42px rgba(255,255,255,.08);
  opacity: 1;
  transition: opacity 420ms ease;
}

.phrase::after {
  content: "";
  position: absolute;
  left: 0.05em;
  right: 0.03em;
  bottom: -0.2em;
  height: 0.045em;
  min-height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(246,247,251,.3), rgba(246,247,251,.76));
  box-shadow: 0 0 18px rgba(255,255,255,.1);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition:
    transform var(--underline-transition-duration, 280ms) var(--underline-transition-ease, cubic-bezier(.22,1,.36,1)),
    opacity 180ms ease;
}

.hidden { opacity: 0; }

.phrase.has-underline::after {
  opacity: .56;
  --underline-transition-duration: var(--underline-load-duration, 4100ms);
  --underline-transition-ease: cubic-bezier(.25,.1,.25,1);
}

.phrase.is-loading::after {
  transform: scaleX(1);
}

.phrase.is-retracting::after {
  opacity: .4;
  transform: scaleX(0);
  transform-origin: center;
  --underline-transition-duration: 280ms;
  --underline-transition-ease: cubic-bezier(.22,1,.36,1);
}

.error {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(24px, 6vw, 96px);
  text-align: center;
}

.error-content {
  width: min(900px, 92vw);
}

.error-title {
  margin: 0;
  font-size: clamp(1.5rem, 5.4vw, 5.1rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.06em;
  color: var(--text);
  text-wrap: balance;
  text-shadow: 0 0 42px rgba(255,255,255,.08);
}

.error-subtitle {
  margin: clamp(18px, 2.5vw, 28px) 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.6vw, 1.25rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.error-link {
  display: inline-block;
  margin-top: clamp(22px, 3vw, 34px);
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(246,247,251,.35);
  padding-bottom: 4px;
  transition: opacity 200ms ease, border-color 200ms ease;
}

.error-link:hover {
  opacity: .72;
  border-color: rgba(246,247,251,.12);
}

@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to { transform: translate3d(72px,72px,0); }
}


@media (max-width: 768px) {
  .phrase {
    font-size: clamp(2.2rem, 8vw, 4rem);
    line-height: 1.05;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }

  .phrase,
  .phrase::after {
    transition: none;
    animation: none;
  }

  .phrase.has-underline::after {
    transform: scaleX(1);
  }
}
