/* ── Login / Welcome · light liquid glass, centered page reveal ── */

.login-flow {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg, #f5f5f7);
  color: var(--text, #1d1d1f);
  isolation: isolate;
}

.login-flow * {
  box-sizing: border-box;
}

/* Soft ambient field (light) */
.login-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 50% -5%, rgba(0, 113, 227, 0.16) 0%, transparent 52%),
    radial-gradient(90% 50% at 100% 80%, rgba(94, 92, 230, 0.1) 0%, transparent 48%),
    linear-gradient(180deg, #eef3fb 0%, var(--bg, #f5f5f7) 42%, #f7f7f9 100%);
  transition-property: opacity, transform, filter;
  transition-duration: 560ms;
  transition-timing-function: var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1));
}

.login-grid {
  position: absolute;
  inset: -15%;
  background-image:
    linear-gradient(rgba(0, 113, 227, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 113, 227, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  transform: perspective(640px) rotateX(56deg) translateY(-6%);
  transform-origin: center top;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 72%);
  opacity: 0;
  animation: login-grid-in 1.1s var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1)) 0.12s forwards;
}

.login-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.18) 0%, transparent 68%);
  filter: blur(6px);
  opacity: 0;
  animation: login-fade-up 0.85s ease-out 0.3s forwards;
}

/* Soft radar */
.login-radar {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: login-radar-in 0.55s ease-out 0.4s forwards;
}

.login-radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 113, 227, 0.16);
  animation: login-ring-pulse 2.4s var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1)) infinite;
}

.login-radar-ring:nth-child(2) {
  inset: 18%;
  animation-delay: 0.25s;
  border-color: rgba(0, 113, 227, 0.28);
}

.login-radar-ring:nth-child(3) {
  inset: 36%;
  animation-delay: 0.5s;
  border-color: rgba(48, 209, 88, 0.32);
}

.login-radar-sweep {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 113, 227, 0.22) 48deg,
    transparent 88deg
  );
  animation: login-sweep 2.2s linear 0.55s infinite;
  mask-image: radial-gradient(circle, transparent 28%, #000 30%, #000 70%, transparent 72%);
}

.login-radar-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--accent, #0071e3);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15), 0 0 16px rgba(0, 113, 227, 0.35);
  animation: pulse-dot 1.8s ease infinite;
}

.login-scanline {
  position: absolute;
  left: 14%;
  right: 14%;
  height: 1px;
  top: 20%;
  background: linear-gradient(90deg, transparent, rgba(0, 113, 227, 0.4), transparent);
  opacity: 0;
  animation: login-scan 2.4s ease-in-out 0.75s infinite;
  pointer-events: none;
}

.login-brand {
  position: absolute;
  left: 0;
  right: 0;
  top: 56%;
  text-align: center;
  padding: 0 28px;
  z-index: 2;
}

.login-brand-kicker {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent, #0071e3);
  opacity: 0;
  transform: translateY(10px);
  animation: login-fade-up 0.65s var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1)) 1s forwards;
}

.login-brand-title {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text, #1d1d1f);
  text-wrap: balance;
  opacity: 0;
  transform: translateY(14px);
  animation: login-fade-up 0.7s var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1)) 1.18s forwards;
}

.login-brand-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-2, #6e6e73);
  line-height: 1.45;
  text-wrap: pretty;
  opacity: 0;
  transform: translateY(10px);
  animation: login-fade-up 0.65s var(--ease-out, cubic-bezier(0.25, 1, 0.5, 1)) 1.4s forwards;
}

.login-hud {
  position: absolute;
  left: 20px;
  right: var(--capsule-right, 100px);
  top: calc(var(--status-h, 44px) + 8px);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3, #86868b);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: login-fade-up 0.55s ease-out 0.65s forwards;
  z-index: 3;
}

.login-hud .live {
  color: var(--accent, #0071e3);
}

/* Continue CTA */
.login-continue {
  position: absolute;
  left: 50%;
  bottom: 72px;
  z-index: 6;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--accent, #0071e3);
  box-shadow:
    0 0 0 1px rgba(0, 113, 227, 0.12),
    0 10px 28px rgba(0, 113, 227, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(18px) scale(0.86);
  pointer-events: none;
  transition-property: transform, opacity, background-color, box-shadow;
  transition-duration: 200ms;
  transition-timing-function: var(--ease-press, ease-out);
}

.login-flow.is-ready .login-continue,
.login-flow[data-phase="ready"] .login-continue {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: login-cta-breathe 2.4s ease-in-out infinite;
}

.login-continue::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 113, 227, 0.2);
  animation: login-ring-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.login-continue svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateX(1px);
}

.login-continue:active {
  transform: scale(0.96);
  animation: none;
}

/* Intro exit when building login page */
.login-intro-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  transition-property: transform, opacity, filter;
  transition-duration: 520ms;
  transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

.login-flow.is-build .login-intro-layer,
.login-flow.is-form .login-intro-layer,
.login-flow[data-phase="build"] .login-intro-layer,
.login-flow[data-phase="form"] .login-intro-layer {
  opacity: 0;
  transform: scale(1.04) translateY(-10px);
  filter: blur(10px);
  pointer-events: none;
}

.login-flow.is-build .login-continue,
.login-flow.is-form .login-continue,
.login-flow[data-phase="build"] .login-continue,
.login-flow[data-phase="form"] .login-continue {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.72) translateY(10px);
  animation: none;
}

/* Full-page login (centered, not a sheet) */
.login-page {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--status-h, 44px) + 12px) 24px 28px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.login-flow.is-build .login-page,
.login-flow.is-form .login-page,
.login-flow[data-phase="build"] .login-page,
.login-flow[data-phase="form"] .login-page {
  opacity: 1;
  pointer-events: auto;
}

/* Soft wash that “draws” the page — only during build */
.login-page-wash {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(245, 245, 247, 0.92) 55%, transparent 72%);
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}

.login-flow.is-build .login-page-wash,
.login-flow[data-phase="build"] .login-page-wash {
  animation: login-wash-expand 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.login-flow.is-form .login-page-wash,
.login-flow[data-phase="form"] .login-page-wash {
  opacity: 1;
  transform: scale(22);
  animation: none;
}

.login-page-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Materialize chunks during build only */
.login-gen {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
}

.login-flow.is-build .login-gen,
.login-flow[data-phase="build"] .login-gen {
  animation: login-materialize 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.login-flow.is-build .login-gen:nth-child(1),
.login-flow[data-phase="build"] .login-gen:nth-child(1) { animation-delay: 0.18s; }

.login-flow.is-build .login-gen:nth-child(2),
.login-flow[data-phase="build"] .login-gen:nth-child(2) { animation-delay: 0.3s; }

.login-flow.is-build .login-gen:nth-child(3),
.login-flow[data-phase="build"] .login-gen:nth-child(3) { animation-delay: 0.42s; }

.login-flow.is-build .login-gen:nth-child(4),
.login-flow[data-phase="build"] .login-gen:nth-child(4) { animation-delay: 0.54s; }

.login-flow.is-build .login-gen:nth-child(5),
.login-flow[data-phase="build"] .login-gen:nth-child(5) { animation-delay: 0.66s; }

.login-flow.is-build .login-gen:nth-child(6),
.login-flow[data-phase="build"] .login-gen:nth-child(6) { animation-delay: 0.78s; }

.login-flow.is-build .login-gen:nth-child(7),
.login-flow[data-phase="build"] .login-gen:nth-child(7) { animation-delay: 0.9s; }

.login-flow.is-build .login-gen:nth-child(8),
.login-flow[data-phase="build"] .login-gen:nth-child(8) { animation-delay: 1.02s; }

/* Settled form state */
.login-flow.is-form .login-gen,
.login-flow[data-phase="form"] .login-gen {
  opacity: 1;
  transform: none;
  animation: none;
}

.login-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--grad-cta, linear-gradient(135deg, #0071e3, #5e5ce6));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--sh-cta, 0 12px 32px rgba(0, 113, 227, 0.28));
}

.login-mark svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-copy {
  text-align: center;
  margin-bottom: 22px;
}

.login-copy h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.login-copy p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2, #6e6e73);
  line-height: 1.45;
  text-wrap: pretty;
}

.login-wx {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: #07c160;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(7, 193, 96, 0.22);
  transition-property: transform;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-press, ease-out);
  cursor: pointer;
}

.login-wx:active { transform: scale(0.96); }

.login-wx svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  font-size: 12px;
  color: var(--text-3, #86868b);
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2, #6e6e73);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: none;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text, #1d1d1f);
  background: var(--surface, #fff);
  box-shadow: var(--sh-border, 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04));
  outline: none;
}

.login-field input:focus {
  box-shadow:
    0 0 0 1px rgba(0, 113, 227, 0.45),
    0 0 0 4px rgba(0, 113, 227, 0.12);
}

.login-bind {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: var(--accent, #0071e3);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition-property: transform;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-press, ease-out);
}

.login-bind:active { transform: scale(0.96); }

.login-legal {
  margin-top: 16px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3, #86868b);
  text-align: center;
  text-wrap: pretty;
}

.login-legal a {
  color: var(--accent-link, #0066cc);
  text-decoration: none;
}

.login-replay {
  display: block;
  margin: 10px auto 0;
  font-size: 12px;
  font-weight: 550;
  color: var(--accent, #0071e3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
}

/* Status bar stays light (default ink) */
.login-flow > .status-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 10;
  color: var(--text, #1d1d1f);
}

.login-flow > .status-bar::after {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

/* Keyframes */
@keyframes login-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes login-grid-in {
  to { opacity: 1; }
}

@keyframes login-radar-in {
  to { opacity: 1; }
}

@keyframes login-sweep {
  to { transform: rotate(360deg); }
}

@keyframes login-ring-pulse {
  0% { transform: scale(0.92); opacity: 0.85; }
  70% { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}

@keyframes login-scan {
  0% { top: 16%; opacity: 0; }
  15% { opacity: 0.75; }
  85% { opacity: 0.4; }
  100% { top: 70%; opacity: 0; }
}

@keyframes login-cta-breathe {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.12), 0 10px 28px rgba(0, 113, 227, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.18), 0 12px 34px rgba(0, 113, 227, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

@keyframes login-wash-expand {
  0% {
    opacity: 0.7;
    transform: scale(0.25);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(22);
  }
}

@keyframes login-materialize {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-grid,
  .login-glow,
  .login-radar,
  .login-brand-kicker,
  .login-brand-title,
  .login-brand-sub,
  .login-hud,
  .login-scanline,
  .login-radar-sweep,
  .login-radar-ring,
  .login-radar-core,
  .login-continue::before,
  .login-page-wash,
  .login-gen {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .login-continue {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    animation: none !important;
  }

  .login-intro-layer,
  .login-page {
    transition-duration: 0.01ms !important;
  }
}

.login-demo-note {
  margin-top: 10px;
  max-width: var(--phone-w, 390px);
  font-size: 12px;
  color: var(--text-3, #86868b);
  line-height: 1.45;
}
