:root {
  --bg: #f8f8f8;
  --card: #ffffff;
  --ink: #0d0d0d;
  --line: #dddddd;
  --muted: #5f5f5f;
  --ok: #1f7a33;
  --danger: #b00020;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--ink);
  padding: 0;
  background: #fafafa;
  overflow-x: hidden;
  overflow-y: hidden;
}

.pixel-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.12) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: 0 0;
  animation: pixelDrift 6.8s ease-in-out infinite alternate;
  opacity: 0.24;
  transition: opacity 0.9s ease;
}

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

.launch-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.98);
  transition: opacity 0.8s ease, visibility 0.8s ease;
  overflow: hidden;
}

.launch-screen.exit {
  opacity: 0;
  visibility: hidden;
}

.launch-core {
  position: relative;
  width: min(80vw, 420px);
  display: grid;
  gap: 1rem;
  justify-items: center;
  z-index: 2;
}

.launch-logo {
  width: min(68vw, 340px);
  height: auto;
  object-fit: contain;
  animation: logoIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 2;
}

.launch-text {
  width: min(62vw, 260px);
  filter: grayscale(1) contrast(1.2);
  animation: textIn 0.8s ease 0.2s both;
  z-index: 2;
}

.launch-burst {
  display: none;
}

.launch-screen::before {
  content: "";
  position: absolute;
  inset: -4px;
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.23) 1px, transparent 1px);
  background-size: 14px 14px;
  background-position: center;
  clip-path: circle(0% at 50% 50%);
  opacity: 0.95;
  animation: launchExpand 1.65s cubic-bezier(0.22, 1, 0.36, 1) 0.22s forwards;
}

@keyframes logoIn {
  0% {
    opacity: 0;
    transform: scale(0.84);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes textIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes launchExpand {
  0% {
    clip-path: circle(0% at 50% 50%);
    opacity: 1;
  }
  100% {
    clip-path: circle(150% at 50% 50%);
    opacity: 0.15;
  }
}

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

.card-wrap {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: min(640px, calc(100vw - 2rem));
}

.card {
  width: 100%;
  margin: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.36));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  opacity: 0;
  transform: translateY(30px);
  clip-path: inset(45% 45% 45% 45% round 18px);
  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    clip-path 0.95s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

body.ready .card {
  opacity: 1;
  transform: translateY(0);
  clip-path: inset(0 0 0 0 round 20px);
}

body.ready .pixel-field {
  opacity: 0.95;
}

.hero {
  display: grid;
  gap: 0.35rem;
}

.route-art {
  width: min(92%, 320px);
  height: auto;
  object-fit: contain;
  margin-bottom: 0.2rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  letter-spacing: 0.01em;
}

.message {
  margin: 0;
  color: #202020;
  line-height: 1.4;
  min-height: 1.2em;
}

form {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.52rem;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: #111;
  padding: 0.76rem 0.82rem;
  font-size: 16px;
}

input:focus {
  outline: 2px solid #000;
  outline-offset: 1px;
}

button,
#continue-link {
  margin-top: 0.44rem;
  border-radius: 12px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-weight: 700;
  padding: 0.82rem 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover,
#continue-link:hover {
  transform: translateY(-1px);
  background: #1a1a1a;
}

#continue-link {
  display: inline-block;
  margin-top: 1rem;
}

.success {
  color: var(--ok);
}

.error {
  color: var(--danger);
}

.hidden {
  display: none;
}

.site-footer {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  align-items: center;
  text-align: center;
  gap: 0.18rem;
  width: max-content;
  pointer-events: none;
}

.site-footer img {
  width: min(20vw, 78px);
  height: auto;
  object-fit: contain;
}

.site-footer .copy {
  font-size: 0.75rem;
  color: #1f1f1f;
  text-align: center;
  line-height: 1.35;
}

@media (max-width: 560px) {
  .card-wrap {
    top: 47%;
    width: calc(100vw - 1rem);
  }

  .card {
    border-radius: 16px;
    padding: 0.95rem;
    max-height: calc(100vh - 150px);
  }

  .route-art {
    width: min(95%, 270px);
  }

  .site-footer img {
    width: min(26vw, 74px);
  }

  .site-footer .copy {
    font-size: 0.7rem;
  }
}
