:root {
  --background: #1e1e2e;
  --surface: #313244;
  --foreground: #cdd6f4;
  --muted: #a6adc8;
  --accent: #cba6f7;
  --accent-two: #89b4fa;
  --accent-three: #a6e3a1;
  --glow-one: rgb(203 166 247 / 28%);
  --glow-two: rgb(137 180 250 / 24%);
  --glow-three: rgb(166 227 161 / 16%);
  --grid: rgb(205 214 244 / 5%);
  color-scheme: dark;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 280px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--background);
}

body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--foreground);
}

.welcome {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(145deg, var(--background), var(--surface));
  background-size: 4rem 4rem, 4rem 4rem, auto;
  transition: background-color 650ms ease, color 650ms ease;
  -webkit-tap-highlight-color: transparent;
}

.welcome::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 18% 24%, var(--glow-one), transparent 34%),
    radial-gradient(circle at 82% 28%, var(--glow-two), transparent 36%),
    radial-gradient(circle at 52% 86%, var(--glow-three), transparent 38%);
  content: "";
}

.welcome::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 28%, rgb(0 0 0 / 14%) 100%);
  content: "";
}

.ambient {
  position: absolute;
  z-index: -1;
  width: min(78vw, 64rem);
  aspect-ratio: 1;
  border: 1px solid var(--glow-two);
  border-radius: 43% 57% 61% 39% / 48% 42% 58% 52%;
  background: linear-gradient(130deg, var(--glow-one), var(--glow-two), var(--glow-three));
  filter: blur(38px) saturate(120%);
  opacity: 0.72;
  animation: drift 18s ease-in-out infinite alternate;
  transition: background 650ms ease, border-color 650ms ease;
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--foreground);
  font-size: clamp(2rem, 11vw, 8rem);
  font-weight: 650;
  letter-spacing: -0.075em;
  line-height: 0.92;
  white-space: nowrap;
  text-shadow: 0 0 1.25em var(--glow-one);
  transform: translateZ(0);
  transition: color 500ms ease, text-shadow 500ms ease, transform 180ms ease;
  animation: arrive 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

h1 span {
  color: var(--accent);
  transition: color 500ms ease;
}

h1::after {
  display: inline-block;
  width: 0.11em;
  height: 0.72em;
  margin-left: 0.16em;
  border-radius: 0.02em;
  background: var(--accent-two);
  box-shadow: 0 0 0.7em var(--glow-two);
  content: "";
  animation: blink 1.15s steps(1, end) infinite;
}

.welcome:focus {
  outline: none;
}

.welcome:focus-visible h1 {
  outline: 2px solid var(--accent);
  outline-offset: 0.24em;
}

.welcome.is-changing h1 {
  animation: refresh 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

::selection {
  color: var(--background);
  background: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .welcome:hover h1 {
    transform: scale(1.015);
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(0.16em) scale(0.98);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes refresh {
  0% {
    opacity: 0.76;
    filter: blur(4px);
    transform: scale(0.985);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes drift {
  from {
    transform: translate3d(-5%, -3%, 0) rotate(-8deg) scale(0.94);
  }
  to {
    transform: translate3d(6%, 4%, 0) rotate(9deg) scale(1.08);
  }
}

@keyframes blink {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 420px) {
  .welcome {
    background-size: 2.75rem 2.75rem, 2.75rem 2.75rem, auto;
  }

  .ambient {
    width: 115vw;
  }
}

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

  h1::after {
    opacity: 1;
  }
}
