:root {
  --ink: #1a1c1d;
  --muted: rgba(26, 28, 29, 0.65);
  --bg: #f6efe6;
  --glow-1: #f3c7a6;
  --glow-2: #cfe6ea;
  --glow-3: #f0e3b1;
  --panel: rgba(255, 255, 255, 0.8);
  --shadow: rgba(22, 24, 26, 0.18);
}

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

body {
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, var(--glow-1), transparent 55%),
    radial-gradient(circle at 85% 5%, var(--glow-2), transparent 50%),
    radial-gradient(circle at 40% 95%, var(--glow-3), transparent 45%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

.scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.7;
  animation: drift 14s ease-in-out infinite;
}

.glow-a {
  background: radial-gradient(circle at 30% 30%, #f39b67, transparent 65%);
  top: -12vh;
  left: -6vw;
}

.glow-b {
  background: radial-gradient(circle at 30% 30%, #8cccd1, transparent 65%);
  top: 10vh;
  right: -8vw;
  animation-delay: -6s;
}

.glow-c {
  background: radial-gradient(circle at 30% 30%, #e4d58c, transparent 65%);
  bottom: -18vh;
  left: 15vw;
  animation-delay: -10s;
}

.grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.25'/></svg>");
  opacity: 0.09;
}

.page {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 2.5rem 6vw 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

.back-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  font-weight: 600;
  align-self: flex-start;
}

.back-link:hover {
  opacity: 0.8;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: rise 0.7s ease both;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28rem;
  font-size: 0.75rem;
  color: var(--muted);
}

h1 {
  font-family: "Unbounded", "Space Grotesk", sans-serif;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 1rem;
  color: var(--muted);
  max-width: 40rem;
}

.stage {
  background: var(--panel);
  border-radius: 26px;
  padding: clamp(1.8rem, 3vw, 3rem);
  box-shadow: 0 24px 60px var(--shadow);
  border: 1px solid rgba(26, 28, 29, 0.08);
  text-align: center;
  backdrop-filter: blur(12px);
  animation: rise 0.7s ease both;
  animation-delay: 0.1s;
}

.text-controls {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  text-align: left;
}

.input-label {
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.text-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(26, 28, 29, 0.2);
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 4px rgba(26, 28, 29, 0.08);
}

.text-input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.letters {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  row-gap: 0.2em;
  column-gap: clamp(0.7rem, 2.4vw, 2.6rem);
  min-height: 5rem;
  margin: 0.3rem 0 1.3rem;
}

.word {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  white-space: nowrap;
}

.letter {
  display: inline-block;
  font-size: clamp(2.8rem, 12vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-shadow: 0 12px 24px rgba(26, 28, 29, 0.18);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  animation: pop 0.6s ease forwards;
  animation-delay: var(--delay, 0s);
}

.hint {
  font-size: 0.95rem;
  color: var(--muted);
}

.actions {
  margin-top: 1.4rem;
}

.button {
  background: var(--ink);
  color: #f7f5f0;
  border: none;
  padding: 0.75rem 1.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(26, 28, 29, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(26, 28, 29, 0.25);
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0.04rem;
}

.button.secondary:hover {
  box-shadow: 0 12px 24px rgba(26, 28, 29, 0.12);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(26, 28, 29, 0.25);
}

.button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(12px, -14px, 0);
  }
}

@media (max-width: 720px) {
  .page {
    padding: 2.2rem 7vw 3rem;
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .button.secondary {
    width: 100%;
  }

  .letters {
    row-gap: 0.15em;
    column-gap: clamp(0.6rem, 2vw, 1.8rem);
  }

  .word {
    gap: 0.1em;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
