:root {
  --bg: #05070a;
  --surface: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f2f5f7;
  --muted: #99a3af;
  --accent: #38f2b0;
  --accent-dim: rgba(56, 242, 176, 0.14);
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ------------------------------------------------------------------
   Ambient background
------------------------------------------------------------------ */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Slow-drifting colour clouds */
.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.62;
  will-change: transform;
}

/* Sized in vmax, not vw — on a narrow phone viewport vw units shrink the blobs
   to nothing and the background reads as flat black. */
.a1 {
  top: -20%;
  left: -10%;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(circle, rgba(56, 242, 176, 0.55) 0%, rgba(56, 242, 176, 0) 70%);
  animation: drift1 26s ease-in-out infinite;
}

.a2 {
  bottom: -30%;
  right: -15%;
  width: 75vmax;
  height: 75vmax;
  background: radial-gradient(circle, rgba(56, 160, 255, 0.45) 0%, rgba(56, 160, 255, 0) 70%);
  animation: drift2 34s ease-in-out infinite;
}

.a3 {
  top: 25%;
  right: 10%;
  width: 45vmax;
  height: 45vmax;
  background: radial-gradient(circle, rgba(140, 90, 255, 0.35) 0%, rgba(140, 90, 255, 0) 70%);
  animation: drift3 42s ease-in-out infinite;
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(12vw, 8vh) scale(1.15); }
  66%      { transform: translate(-6vw, 14vh) scale(0.92); }
}

@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(-14vw, -10vh) scale(1.12); }
  75%      { transform: translate(8vw, -4vh) scale(0.95); }
}

@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(0.95); }
  50%      { transform: translate(-10vw, 12vh) scale(1.2); }
}

/* Film grain — keeps the gradients from banding on wide screens */
.grain {
  position: absolute;
  inset: -50%;
  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.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.16;
  animation: grainShift 0.7s steps(1) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -2%); }
  100% { transform: translate(3%, 1%); }
}

/* Darkens the edges so the text always has contrast */
.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(5, 7, 10, 0) 25%, rgba(5, 7, 10, 0.62) 100%),
    linear-gradient(to bottom, rgba(5, 7, 10, 0.4) 0%, rgba(5, 7, 10, 0) 30%);
}

/* ------------------------------------------------------------------
   Layout
------------------------------------------------------------------ */
.wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
  max-width: 620px;
  margin: 0 auto;
  padding: 32px 24px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Brand — centred lockup: hexagon mark above a letterspaced wordmark */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  animation: fadeUp 0.9s ease both;
}

.mark {
  width: 38px;
  height: 42px;
  color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(56, 242, 176, 0.35));
}
.mark-hex { opacity: 0.55; }
.mark-pulse { opacity: 1; }

.wordmark {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  /* letter-spacing adds a trailing gap on the last glyph; pull it back so the
     lockup reads as optically centred under the mark */
  text-indent: 0.24em;
}
.wordmark strong {
  color: var(--text);
  font-weight: 700;
}

/* Hero fills the space between header and footer */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 40px 0;
}

h1 {
  margin: 0;
  font-size: clamp(52px, 14vw, 92px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
  animation: fadeUp 0.9s ease both;
}

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

/* Form */
.signup {
  margin: 44px auto 0;
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.9s ease 0.15s both;
}

.prompt {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14.5px;
}

.field {
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus-within {
  border-color: rgba(56, 242, 176, 0.5);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.field.invalid {
  border-color: rgba(255, 107, 107, 0.6);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.12);
}

.field input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.field input::placeholder { color: #66727f; }

.field button {
  flex-shrink: 0;
  position: relative;
  padding: 12px 24px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #04150e;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.field button:hover:not(:disabled) { filter: brightness(1.08); }
.field button:active:not(:disabled) { transform: translateY(1px); }
.field button:disabled { opacity: 0.65; cursor: default; }

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(4, 21, 14, 0.25);
  border-top-color: #04150e;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.6s linear infinite;
}
.loading .btn-label { opacity: 0; }
.loading .spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.msg {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13.5px;
  color: var(--danger);
}

/* Success state */
.success {
  margin: 44px auto 0;
  animation: fadeUp 0.5s ease both;
}
.success-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}
.success-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* Footer */
.foot {
  text-align: center;
  color: #5d6874;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------
   Responsive / motion
------------------------------------------------------------------ */
@media (max-width: 440px) {
  .field { flex-direction: column; padding: 8px; }
  .field button { width: 100%; padding: 13px; }
  .aurora { filter: blur(60px); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .grain { animation: none !important; }
  #field { display: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
