:root {
  color: #151922;
  background: #f4f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;

  --color-background: #f4f7fb;
  --color-surface: #ffffff;
  --color-surface-elevated: #fbfcfe;
  --color-text-primary: #151922;
  --color-text-secondary: #667085;
  --color-border: rgba(15, 23, 42, 0.09);
  --color-accent: #0068ff;
  --color-accent-hover: #005bdc;
  --color-accent-soft: #edf4ff;
  --color-success: #087a55;
  --color-success-soft: #ebfaf4;
  --color-warning: #9a5b08;
  --color-warning-soft: #fff8e8;
  --color-error: #b42318;
  --color-error-soft: #fff1f0;
  --radius-card: 28px;
  --radius-button: 17px;
  --radius-status: 15px;
  --radius-pill: 999px;
  --shadow-card: 0 28px 80px rgba(31, 61, 116, 0.11), 0 6px 22px rgba(31, 61, 116, 0.05);
  --shadow-card-hover: 0 32px 88px rgba(31, 61, 116, 0.14), 0 9px 28px rgba(31, 61, 116, 0.07);
  --shadow-button: 0 11px 25px rgba(0, 104, 255, 0.23);
  --shadow-button-hover: 0 15px 32px rgba(0, 104, 255, 0.29);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --transition-fast: 160ms;
  --transition-normal: 210ms;
  --ease-natural: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

[hidden][hidden],
.loading[hidden],
.button-spinner[hidden] {
  display: none;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--color-text-primary);
  background: var(--color-background);
}

button,
a {
  font: inherit;
}

button,
a,
img {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--space-3) + env(safe-area-inset-top, 0px))
    calc(var(--space-3) + env(safe-area-inset-right, 0px))
    calc(var(--space-3) + env(safe-area-inset-bottom, 0px))
    calc(var(--space-3) + env(safe-area-inset-left, 0px));
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 253, 0.96) 54%, rgba(240, 246, 253, 0.98)),
    var(--color-background);
}

.background-light {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.65;
}

.background-light-top {
  width: min(118vw, 560px);
  aspect-ratio: 1;
  top: -46%;
  left: -54%;
  background: radial-gradient(circle, rgba(0, 104, 255, 0.13), rgba(0, 104, 255, 0) 69%);
}

.background-light-bottom {
  width: min(112vw, 520px);
  aspect-ratio: 1;
  right: -52%;
  bottom: -42%;
  background: radial-gradient(circle, rgba(70, 176, 255, 0.13), rgba(70, 176, 255, 0) 70%);
}

.login-card {
  width: 100%;
  min-width: 0;
  min-height: calc(100vh - 24px);
  min-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-card);
  animation: card-in 420ms var(--ease-natural) backwards;
  transition:
    transform var(--transition-normal) var(--ease-natural),
    box-shadow var(--transition-normal) var(--ease-natural),
    border-color var(--transition-fast) ease,
    background-color var(--transition-fast) ease;
}

.story-panel {
  display: none;
}

.auth-panel {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding:
    var(--space-6)
    var(--space-5)
    max(var(--space-5), env(safe-area-inset-bottom, 0px));
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.mobile-brand,
.story-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-mark,
.button-leading {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--color-accent);
  font-weight: 760;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: 0 9px 20px rgba(0, 104, 255, 0.19);
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  color: var(--color-text-primary);
  font-size: 0.96rem;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.brand-copy small {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  line-height: 1.2;
}

.badge {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: #5b6880;
  background: #f1f4f8;
  font-size: 0.75rem;
  font-weight: 680;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    opacity var(--transition-fast) ease,
    background-color var(--transition-fast) ease;
}

.badge-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(82, 96, 120, 0.1);
}

.badge-ready,
.badge-success {
  color: var(--color-success);
  background: var(--color-success-soft);
}

.badge-warning {
  color: var(--color-warning);
  background: var(--color-warning-soft);
}

.hero-copy {
  margin-bottom: var(--space-5);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 390px;
  margin-bottom: 10px;
  color: var(--color-text-primary);
  font-size: clamp(1.95rem, 8.6vw, 2.125rem);
  font-weight: 740;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 400px;
  margin-bottom: 0;
  color: var(--color-text-secondary);
  font-size: 1rem;
  line-height: 1.55;
}

.status {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: 13px;
  border: 1px solid rgba(7, 88, 201, 0.09);
  border-radius: var(--radius-status);
  color: #0758c9;
  background: var(--color-accent-soft);
  animation: state-in var(--transition-normal) var(--ease-natural) backwards;
}

.status-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(31, 61, 116, 0.06);
}

.status-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.status-copy strong {
  overflow-wrap: anywhere;
  color: currentColor;
  font-size: 0.875rem;
  font-weight: 720;
  line-height: 1.35;
}

.status-copy span {
  overflow-wrap: anywhere;
  color: #5b6880;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.status.warning {
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border-color: rgba(154, 91, 8, 0.12);
}

.status.error {
  color: var(--color-error);
  background: var(--color-error-soft);
  border-color: rgba(180, 35, 24, 0.1);
}

.status.success {
  color: var(--color-success);
  background: var(--color-success-soft);
  border-color: rgba(8, 122, 85, 0.1);
}

.loading {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.spinner,
.button-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid rgba(0, 104, 255, 0.18);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.signed-out,
.profile {
  animation: state-in 260ms var(--ease-natural) backwards;
}

.button {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  transition:
    transform var(--transition-fast) var(--ease-natural),
    box-shadow var(--transition-normal) var(--ease-natural),
    opacity var(--transition-fast) ease,
    background-color var(--transition-fast) ease,
    border-color var(--transition-fast) ease;
}

.button:active {
  transform: scale(0.985);
  box-shadow: 0 5px 14px rgba(0, 104, 255, 0.16);
}

.button:focus-visible {
  outline: 3px solid rgba(0, 104, 255, 0.25);
  outline-offset: 3px;
}

.button-primary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  color: #fff;
  background: var(--color-accent);
  box-shadow: var(--shadow-button);
}

.button-leading {
  width: 24px;
  height: 24px;
  justify-self: start;
  border-radius: 8px;
  color: var(--color-accent);
  background: #fff;
  font-size: 0.75rem;
}

.button-label {
  justify-self: center;
}

.button-arrow {
  justify-self: end;
  font-size: 1.08rem;
  transition: transform var(--transition-fast) var(--ease-natural);
}

.button-primary .button-spinner {
  justify-self: end;
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

.button[aria-disabled="true"],
.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

.button[aria-busy="true"] {
  pointer-events: none;
}

.privacy-note {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  margin: 14px 3px 0;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.48;
}

.privacy-note svg,
.card-footer svg,
.button-secondary svg,
.session-state svg,
.story-step svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.privacy-note svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.profile {
  min-width: 0;
}

.profile-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-surface-elevated);
  transition:
    transform var(--transition-normal) var(--ease-natural),
    box-shadow var(--transition-normal) var(--ease-natural),
    border-color var(--transition-fast) ease,
    background-color var(--transition-fast) ease;
}

.avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.avatar,
.avatar-fallback {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  color: #fff;
  background: linear-gradient(145deg, var(--color-accent), #64b3ff);
  font-size: 1.25rem;
  font-weight: 760;
  box-shadow: 0 9px 22px rgba(0, 104, 255, 0.17);
}

.verified-mark {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--color-accent);
}

.verified-mark svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-copy {
  min-width: 0;
}

.profile-copy .badge {
  max-width: 100%;
  white-space: normal;
}

.profile h2 {
  margin: 8px 0 5px;
  overflow-wrap: anywhere;
  color: var(--color-text-primary);
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.user-id {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

.user-id code {
  max-width: 100%;
  overflow: hidden;
  color: #53627b;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-state {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: 12px 14px;
  border-radius: var(--radius-status);
  color: var(--color-success);
  background: var(--color-success-soft);
}

.session-state-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.75);
}

.session-state-icon svg {
  width: 18px;
  height: 18px;
}

.session-state > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.session-state strong {
  font-size: 0.8125rem;
}

.session-state small {
  color: #55766a;
  font-size: 0.75rem;
}

.button-secondary {
  color: #344054;
  border-color: var(--color-border);
  background: #fff;
  box-shadow: 0 5px 14px rgba(31, 61, 116, 0.06);
}

.button-secondary svg {
  width: 18px;
  height: 18px;
}

.button-spinner-dark {
  border-color: rgba(52, 64, 84, 0.18);
  border-top-color: #344054;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.footer-lock {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #6e7c92;
  background: #f0f3f7;
}

.footer-lock svg {
  width: 13px;
  height: 13px;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes state-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    transform: translateY(-2px) scale(1.01);
  }

  .button-primary:hover {
    background: var(--color-accent-hover);
    box-shadow: var(--shadow-button-hover);
  }

  .button-primary:hover .button-arrow {
    transform: translateX(3px);
  }

  .button-secondary:hover {
    border-color: rgba(15, 23, 42, 0.14);
    background: #f7f9fc;
    box-shadow: 0 10px 22px rgba(31, 61, 116, 0.09);
  }

  .profile-identity:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 104, 255, 0.13);
    background: #fff;
    box-shadow: 0 13px 30px rgba(31, 61, 116, 0.08);
  }

  .button:active {
    transform: scale(0.985);
    box-shadow: 0 5px 14px rgba(0, 104, 255, 0.16);
  }
}

@media (max-width: 374px), (max-height: 700px) and (max-width: 520px) {
  .auth-panel {
    padding: 18px 18px 16px;
  }

  .brand-header {
    margin-bottom: 18px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .hero-copy {
    margin-bottom: 16px;
  }

  h1 {
    font-size: 1.9rem;
  }

  .lead {
    font-size: 0.9375rem;
    line-height: 1.48;
  }

  .status {
    margin-bottom: 12px;
    padding: 11px;
  }

  .privacy-note {
    margin-top: 11px;
    font-size: 0.75rem;
  }

  .card-footer {
    padding-top: 12px;
  }
}

@media (min-width: 521px) and (max-width: 1023px) {
  .page-shell {
    padding:
      calc(var(--space-6) + env(safe-area-inset-top, 0px))
      calc(var(--space-6) + env(safe-area-inset-right, 0px))
      calc(var(--space-6) + env(safe-area-inset-bottom, 0px))
      calc(var(--space-6) + env(safe-area-inset-left, 0px));
  }

  .login-card {
    width: min(100%, 540px);
    min-height: min(720px, calc(100dvh - 48px));
  }

  .auth-panel {
    padding: var(--space-8);
  }

  h1 {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .page-shell {
    padding: 32px;
  }

  .background-light-top {
    width: min(58vw, 900px);
    top: -50%;
    left: -20%;
  }

  .background-light-bottom {
    width: min(48vw, 760px);
    right: -12%;
    bottom: -52%;
  }

  .login-card {
    width: min(100%, 1180px);
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(430px, 0.88fr);
    border-color: rgba(255, 255, 255, 0.94);
  }

  .story-panel {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: clamp(48px, 5vw, 72px);
    border-right: 1px solid var(--color-border);
    background:
      radial-gradient(circle at 10% 5%, rgba(0, 104, 255, 0.1), transparent 36%),
      linear-gradient(145deg, #f9fbff, #f2f6fc);
  }

  .story-panel::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    right: -150px;
    bottom: -150px;
    border: 1px solid rgba(0, 104, 255, 0.09);
    border-radius: 50%;
    box-shadow:
      0 0 0 42px rgba(0, 104, 255, 0.025),
      0 0 0 86px rgba(0, 104, 255, 0.018);
    pointer-events: none;
  }

  .story-brand {
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 720;
  }

  .brand-mark-large {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .story-copy {
    max-width: 510px;
    margin: auto 0 42px;
  }

  .story-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    margin-bottom: 20px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    color: var(--color-accent);
    background: var(--color-accent-soft);
    font-size: 0.75rem;
    font-weight: 720;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .story-copy h2 {
    margin-bottom: 18px;
    color: var(--color-text-primary);
    font-size: clamp(2.45rem, 3.2vw, 3.35rem);
    font-weight: 740;
    line-height: 1.08;
    letter-spacing: -0.05em;
  }

  .story-copy p {
    max-width: 460px;
    margin-bottom: 0;
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    line-height: 1.65;
  }

  .story-steps {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 32px;
  }

  .story-step {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 11px;
    padding: 15px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    transition:
      transform var(--transition-normal) var(--ease-natural),
      box-shadow var(--transition-normal) var(--ease-natural),
      border-color var(--transition-fast) ease,
      background-color var(--transition-fast) ease;
  }

  .story-step-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--color-accent);
    background: var(--color-accent-soft);
  }

  .story-step-icon svg {
    width: 18px;
    height: 18px;
  }

  .story-step > span:last-child {
    min-width: 0;
    display: grid;
    gap: 4px;
  }

  .story-step strong {
    color: #293247;
    font-size: 0.8125rem;
    line-height: 1.35;
  }

  .story-step small {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .story-footnote {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
  }

  .story-footnote > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 0 4px rgba(8, 122, 85, 0.09);
  }

  .auth-panel {
    min-height: 100%;
    padding: clamp(44px, 4vw, 60px);
    background: var(--color-surface);
  }

  .brand-header {
    margin-bottom: auto;
    padding-bottom: 36px;
  }

  .hero-copy {
    margin-bottom: 24px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .card-footer {
    margin-top: auto;
    padding-top: 28px;
  }
}

@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .login-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 104, 255, 0.08);
    box-shadow: var(--shadow-card-hover);
  }

  .story-step:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 104, 255, 0.12);
    background: #fff;
    box-shadow: 0 12px 26px rgba(31, 61, 116, 0.07);
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 1023px) {
  .page-shell {
    align-items: flex-start;
    overflow-y: auto;
  }

  .login-card {
    width: min(100%, 540px);
    min-height: 0;
    margin: auto;
  }

  .auth-panel {
    padding: 20px;
  }
}

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

  .login-card,
  .status,
  .signed-out,
  .profile,
  .spinner,
  .button-spinner {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }

  .button,
  .login-card,
  .profile-identity,
  .story-step {
    transition-duration: 0.01ms;
  }

  .button:active,
  .button:hover,
  .login-card:hover,
  .profile-identity:hover,
  .story-step:hover {
    transform: none;
  }
}
