:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f5f1;
  background: #080a0a;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #080a0a;
  --surface: #111414;
  --surface-raised: #161a1a;
  --line: #242929;
  --line-soft: #1d2222;
  --text: #f5f5f1;
  --text-soft: #a7aeaa;
  --text-muted: #737a77;
  --cream: #e7e5dd;
  --green: #8ed7af;
  --blue: #68c4ff;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
a, button, label { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, label:has(input:focus-visible) {
  outline: 2px solid rgba(231, 229, 221, 0.86);
  outline-offset: 3px;
}

.shell {
  position: relative;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  padding: max(20px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% -12%, rgba(104, 196, 255, 0.055), transparent 29%),
    radial-gradient(circle at 4% 96%, rgba(142, 215, 175, 0.045), transparent 24%),
    var(--ink);
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  width: min(1040px, 100%);
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(231, 229, 221, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}
.brand-mark img { width: 21px; height: 21px; display: block; }
.brand-name { font-size: 12px; font-weight: 760; letter-spacing: 0.21em; }
.quiet-link, .secure-label { color: var(--text-muted); font-size: 11px; transition: color 150ms ease; }
.quiet-link:hover { color: var(--text); }

#main { position: relative; z-index: 2; display: flex; min-height: 0; flex: 1; }

.onboarding {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100%;
  place-items: center;
  padding: clamp(44px, 7vh, 86px) 0 38px;
}

.ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ambient-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(231, 229, 221, 0.055);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.ambient-ring-one { width: min(72vw, 760px); aspect-ratio: 1; animation: ring-breathe 7s ease-in-out infinite; }
.ambient-ring-two {
  width: min(48vw, 510px);
  aspect-ratio: 1;
  border-color: rgba(104, 196, 255, 0.065);
  animation: ring-breathe 7s ease-in-out 1.15s infinite reverse;
}
.ambient-dot { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: rgba(231, 229, 221, 0.23); }
.ambient-dot-one { left: 18%; top: 32%; animation: drift 8s ease-in-out infinite; }
.ambient-dot-two { right: 17%; bottom: 28%; animation: drift 9s ease-in-out 1.5s infinite reverse; }

.join-panel {
  position: relative;
  z-index: 3;
  width: min(430px, 100%);
  animation: panel-enter 620ms cubic-bezier(.22,1,.36,1) both;
}

.glyth-icon-stage {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 28px;
  place-items: center;
  border: 1px solid rgba(231, 229, 221, 0.12);
  border-radius: 22px;
  background: rgba(231, 229, 221, 0.96);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.33);
  animation: icon-float 6s ease-in-out infinite;
}
.icon-halo {
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(104, 196, 255, 0.13);
  border-radius: 30px;
  opacity: .7;
  animation: halo-pulse 4.6s ease-in-out infinite;
}
.glyth-icon { position: relative; z-index: 1; display: block; width: 42px; height: 42px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.19em;
  text-align: center;
  text-transform: uppercase;
}
.join-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 7vw, 45px);
  font-weight: 520;
  letter-spacing: -0.046em;
  line-height: 1.02;
  text-align: center;
}
.join-subtitle {
  max-width: 390px;
  margin: 15px auto 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.62;
  text-align: center;
}

.join-form { display: grid; gap: 8px; margin-top: 29px; }
.field-label { color: var(--text-muted); font-size: 10px; font-weight: 650; letter-spacing: .03em; }
.email-field { position: relative; }
.email-field input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(17, 20, 20, 0.84);
  padding: 0 15px 0 43px;
  color: var(--text);
  font-size: 13px;
  outline: 0;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.email-field input::placeholder { color: #626966; }
.email-field input:focus { border-color: #3a403e; background: rgba(22, 26, 26, 0.92); box-shadow: 0 0 0 3px rgba(231, 229, 221, 0.035); }
.field-icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: #6d7471; pointer-events: none; }
.field-error { min-height: 15px; margin: 0; color: #d8a19b; font-size: 10px; }

.primary-button, .social-button {
  border: 0;
  cursor: pointer;
}
.primary-button {
  display: inline-flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: 11px;
  background: var(--cream);
  padding: 0 16px 0 18px;
  color: #0b0d0d;
  font-size: 12px;
  font-weight: 740;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}
.primary-button:hover { transform: translateY(-1px); background: #f4f1e8; }
.primary-button:disabled { cursor: progress; opacity: .64; transform: none; }
.primary-button.is-loading .arrow { animation: loading-nudge 700ms ease-in-out infinite alternate; }
.anchor-button { margin-top: 26px; }
.arrow { font-size: 16px; line-height: 1; }

.divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 21px 0 15px; }
.divider span { height: 1px; background: var(--line-soft); }
.divider small { color: #5e6562; font-size: 9px; text-transform: uppercase; }
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.social-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(17, 20, 20, 0.65);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}
.social-button:hover { border-color: #363c3a; background: rgba(22, 26, 26, .92); color: var(--text); transform: translateY(-1px); }
.social-icon { width: 17px; height: 17px; flex: 0 0 auto; }

.flowid-option {
  position: relative;
  display: grid;
  min-height: 64px;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(17, 20, 20, 0.46);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.flowid-option:hover, .flowid-option.selected { border-color: #303735; background: rgba(22, 26, 26, .66); }
.flowid-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.flowid-icon { width: 22px; height: 22px; color: #9da5a1; }
.flowid-copy { display: grid; gap: 3px; min-width: 0; }
.flowid-copy strong { color: var(--text); font-size: 11px; font-weight: 650; }
.flowid-copy small { color: var(--text-muted); font-size: 9px; line-height: 1.35; }
.toggle { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #242a28; transition: background 160ms ease; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #7e8783; transition: transform 180ms cubic-bezier(.22,1,.36,1), background 160ms ease; }
.flowid-option.selected .toggle { background: rgba(142, 215, 175, .22); }
.flowid-option.selected .toggle::after { transform: translateX(14px); background: var(--green); }
.flowid-option.selected .flowid-icon { color: var(--green); }

.legal-copy { margin: 15px auto 0; color: #525956; font-size: 9px; line-height: 1.45; text-align: center; }
.secondary-link { display: inline-flex; margin-top: 25px; color: var(--text-muted); font-size: 11px; transition: color 150ms ease; }
.secondary-link:hover { color: var(--text); }

.invite-context {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 25px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(17, 20, 20, .62);
  padding: 9px 10px;
}
.invite-avatar { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; background: var(--surface-raised); }
.invite-avatar-fallback { display: grid; place-items: center; border: 1px solid var(--line); color: var(--cream); font-size: 12px; }
.invite-context-copy { display: grid; gap: 2px; min-width: 0; }
.invite-context-copy small { color: var(--text-muted); font-size: 8px; text-transform: uppercase; letter-spacing: .09em; }
.invite-context-copy strong { overflow: hidden; color: var(--text); font-size: 10px; font-weight: 640; text-overflow: ellipsis; white-space: nowrap; }
.invite-access { color: #85908b; font-size: 9px; }

.invite-loading-wrap { width: 100%; flex: 1; display: grid; place-items: center; padding: 56px 0; }
.loading-card, .invalid-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 20, 20, 0.72);
  padding: 34px;
  backdrop-filter: blur(18px);
}
.loading-card { min-height: 330px; display: grid; align-content: center; gap: 13px; }
.invalid-card { text-align: center; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, #161a1a, #202525, #161a1a); background-size: 220% 100%; animation: shimmer 1.4s ease infinite; }
.avatar-skeleton { width: 62px; height: 62px; border-radius: 19px; margin: 0 auto 13px; }
.line { height: 14px; width: 100%; }
.line.short { width: 32%; height: 9px; margin: auto; }
.line.medium { width: 68%; margin: auto; }

.email-sent-panel { text-align: center; }
.success-stage::after { content: ""; position: absolute; inset: -24px; border: 1px solid rgba(142, 215, 175, .11); border-radius: 38px; animation: success-wave 2.8s ease-out infinite; }

.footer { position: relative; z-index: 10; width: min(1040px, 100%); margin: 0 auto; color: #4e5552; font-size: 9px; text-align: center; }

@keyframes panel-enter { from { opacity: 0; transform: translateY(16px) scale(.992); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes icon-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes halo-pulse { 0%,100% { opacity: .38; transform: scale(.97); } 50% { opacity: .78; transform: scale(1.035); } }
@keyframes ring-breathe { 0%,100% { opacity: .42; transform: translate(-50%,-50%) scale(.985); } 50% { opacity: .82; transform: translate(-50%,-50%) scale(1.025); } }
@keyframes drift { 0%,100% { transform: translate(0,0); opacity: .2; } 50% { transform: translate(8px,-12px); opacity: .6; } }
@keyframes loading-nudge { from { transform: translateX(0); } to { transform: translateX(3px); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes success-wave { 0% { opacity: .55; transform: scale(.82); } 100% { opacity: 0; transform: scale(1.2); } }

@media (max-width: 560px) {
  .shell { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .brand-name { font-size: 11px; }
  .quiet-link, .secure-label { font-size: 10px; }
  .onboarding { padding-top: 36px; padding-bottom: 24px; }
  .glyth-icon-stage { width: 62px; height: 62px; margin-bottom: 24px; border-radius: 20px; }
  .glyth-icon { width: 38px; height: 38px; }
  .join-title { font-size: clamp(33px, 10vw, 41px); }
  .join-subtitle { font-size: 13px; }
  .join-form { margin-top: 25px; }
  .social-grid { grid-template-columns: 1fr; }
  .social-button { min-height: 45px; }
  .flowid-option { margin-top: 11px; }
  .footer { padding-top: 10px; }
  .ambient-ring-one { width: 118vw; }
  .ambient-ring-two { width: 82vw; }
}

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