:root {
  color-scheme: dark;
  --bg: #131d1a;
  --bg-deep: #0c1311;
  --text: #eff6f2;
  --muted: #9cb5a8;
  --green: #8dff90;
  --green-shadow: #2fa836;
  --ink: #131d1a;
  --glow: #3b6bff;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --patch: min(46vh, 74vw, 440px);
  --font: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

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

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg) 40%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* Backdrop */

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

.glow {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 120vmin;
  height: 120vmin;
  transform: translate(-50%, -50%);
  background-color: var(--glow);
  opacity: 0.5;
  -webkit-mask: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
  mask: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
  transition: background-color 900ms ease;
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Chrome */

.top,
.bottom,
.stage {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.5rem 0;
}

.top img {
  display: block;
  height: 30px;
  width: auto;
}

.bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.25rem;
  padding: 1.25rem 1.5rem max(1.25rem, env(safe-area-inset-bottom));
  font-size: 0.8125rem;
  color: var(--muted);
}

.bottom a {
  text-decoration: none;
  transition: color 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .bottom a:hover {
    color: var(--text);
  }
}

/* Stage */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 4vh, 2.75rem);
  padding: 1rem 1.5rem;
}

/* Patch (shared by hero + minis) */

.patch-face {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 775 / 770;
  isolation: isolate;
  container-type: inline-size;
}

.patch-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.patch-dye,
.patch-holo,
.patch-sheen {
  position: absolute;
  inset: 0;
  display: block;
  -webkit-mask: url('/assets/patch-blank.webp') center / 100% 100% no-repeat;
  mask: url('/assets/patch-blank.webp') center / 100% 100% no-repeat;
  pointer-events: none;
}

.patch-dye {
  background: linear-gradient(140deg, var(--c1) 0%, var(--c2) 52%, var(--c3) 100%);
  mix-blend-mode: multiply;
}

.patch-holo,
.patch-sheen {
  overflow: hidden;
}

.patch-holo {
  opacity: 0;
  mix-blend-mode: overlay;
  transition: opacity 400ms ease;
}

.patch-holo i {
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    #ff5c9a,
    #ffe500,
    #3dffc6,
    #1ae0ff,
    #b24dff,
    #ff5c9a
  );
  animation: spin 7s linear infinite;
}

.patch.is-holo .patch-holo {
  opacity: 0.75;
}

.patch-sheen {
  mix-blend-mode: soft-light;
}

.patch-sheen i {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 60%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.95) 50%,
    transparent 100%
  );
  transform: translateX(-120%) skewX(-12deg);
}

.patch-illu {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 58%;
  height: 52%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0.6cqw 0 rgba(0, 0, 0, 0.28));
  user-select: none;
  -webkit-user-drag: none;
}

.patch-text {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 13.5%;
  text-align: center;
  font-family: var(--font);
  font-weight: 900;
  font-size: 7.4cqw;
  line-height: 1;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: #fff;
  text-shadow:
    0 0.35cqw 0 rgba(0, 0, 0, 0.35),
    0 0 0.3cqw rgba(0, 0, 0, 0.35);
}

.patch[data-ink='dark'] .patch-text {
  color: var(--ink);
  text-shadow:
    0 0.35cqw 0 rgba(255, 255, 255, 0.45),
    0 0 0.3cqw rgba(0, 0, 0, 0.2);
}

/* Hero patch */

.hero-patch {
  position: relative;
  width: var(--patch);
}

.float {
  animation: float 5.5s ease-in-out infinite alternate;
}

.drop {
  opacity: 0;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.35));
}

.is-ready .drop {
  animation: drop 1150ms var(--ease-out) both;
}

.tilt {
  will-change: transform;
}

.patch {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  --c1: #6b91ff;
  --c2: #3b6bff;
  --c3: #1e3fad;
}

.patch:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 8px;
  border-radius: 14%;
}

.patch .patch-illu,
.patch .patch-text {
  opacity: 0;
}

.is-ready .patch .patch-illu {
  animation: pop 650ms var(--ease-out) 520ms both;
}

.is-ready .patch .patch-text {
  animation: rise 500ms var(--ease-out) 720ms both;
}

.shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -9%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
  opacity: 0;
  animation: shadow 5.5s ease-in-out infinite alternate;
}

.is-ready .shadow {
  opacity: 1;
  transition: opacity 900ms ease 300ms;
}

/* Minis */

.minis {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.is-ready .minis {
  opacity: 1;
  transition: opacity 1200ms ease 900ms;
}

.mini {
  position: absolute;
  width: var(--size);
  filter: blur(var(--blur, 0px));
  opacity: var(--alpha, 0.85);
  animation: drift var(--dur, 14s) ease-in-out infinite alternate;
}

.mini-a {
  --size: clamp(72px, 11vw, 140px);
  --blur: 1px;
  --dur: 15s;
  left: 9%;
  top: 14%;
  rotate: -14deg;
}

.mini-b {
  --size: clamp(60px, 8vw, 110px);
  --blur: 2.5px;
  --alpha: 0.6;
  --dur: 18s;
  right: 10%;
  top: 20%;
  rotate: 12deg;
  animation-delay: -6s;
}

.mini-c {
  --size: clamp(80px, 12vw, 150px);
  --blur: 0.5px;
  --dur: 13s;
  right: 14%;
  bottom: 12%;
  rotate: -8deg;
  animation-delay: -3s;
}

@media (max-width: 720px) {
  .mini-a {
    left: -4%;
    top: 6%;
  }

  .mini-b {
    right: -3%;
    top: 34%;
  }

  .mini-c {
    display: none;
  }
}

/* Copy */

.copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.9rem;
}

.copy h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6.2vw, 4.75rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.copy p {
  margin: 0;
  max-width: 30ch;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 600;
  color: var(--muted);
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  background: var(--green);
  color: var(--ink);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--green-shadow);
  transition:
    transform 140ms var(--ease-out),
    box-shadow 140ms var(--ease-out);
}

.store svg {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: -0.15rem;
}

.store:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--green-shadow);
}

@media (hover: hover) and (pointer: fine) {
  .store:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 var(--green-shadow);
  }

  .store:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--green-shadow);
  }
}

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

.copy > * {
  opacity: 0;
}

.is-ready .copy > * {
  animation: rise 600ms var(--ease-out) both;
}

.is-ready .copy > :nth-child(1) {
  animation-delay: 780ms;
}

.is-ready .copy > :nth-child(2) {
  animation-delay: 850ms;
}

.is-ready .copy > :nth-child(3) {
  animation-delay: 920ms;
}

/* Keyframes */

@keyframes drop {
  0% {
    opacity: 0;
    transform: translateY(-70px) rotate(-12deg) scale(0.9);
  }
  45% {
    opacity: 1;
    transform: translateY(8px) rotate(3deg) scale(1.03, 0.97);
  }
  70% {
    transform: translateY(-4px) rotate(-1deg) scale(0.995, 1.005);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6) rotate(-14deg);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}

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

@keyframes float {
  from {
    transform: translateY(0) rotate(-1.5deg);
  }
  to {
    transform: translateY(-16px) rotate(1.5deg);
  }
}

@keyframes shadow {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.82);
    opacity: 0.6;
  }
}

@keyframes drift {
  from {
    translate: 0 0;
  }
  to {
    translate: 14px -26px;
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .float,
  .shadow,
  .mini,
  .patch-holo i {
    animation: none;
  }

  .is-ready .drop,
  .is-ready .patch .patch-illu,
  .is-ready .patch .patch-text,
  .is-ready .copy > * {
    animation: fade 400ms ease both;
  }

  .is-ready .patch .patch-illu {
    transform: translate(-50%, -50%);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
