*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0a0b0d;
  color: #f2f5ff;
  color-scheme: dark;
}

.page {
  min-height: 100vh;
  width: min(100%, 640px);
  margin: 0 auto;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-shell {
  width: min(100%, 500px);
  margin: 18px auto 0;
}

.auth-shell:has(#input2) {
  margin-top: 34px;
}

.title {
  width: min(100%, 388px);
  margin: 0 auto 22px;
  text-align: left;
  color: #f2f5ff;
  font-size: clamp(18px, 2.6vw, 26px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#form:has(#input2) {
  --step2-field-height: 58px;
  --step2-profile-height: 58px;
  --step2-field-radius: 10px;
  gap: 12px;
}

#form:has(#input2)::before {
  content: attr(data-first-field);
  box-sizing: border-box;
  width: min(100%, 388px);
  max-width: 388px;
  flex: 0 0 auto;
  align-self: center;
  height: var(--step2-profile-height);
  min-height: var(--step2-profile-height);
  padding: 0 16px 0 62px;
  border-radius: var(--step2-field-radius);
  border: 1px solid #2b2d32;
  background-color: #0a0b0d;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Ccircle cx='15' cy='15' r='15' fill='%23e7e9ee'/%3E%3Ccircle cx='15' cy='11' r='5' fill='%23989dac'/%3E%3Cpath d='M6.5 24c1.7-4 4.8-6 8.5-6s6.8 2 8.5 6' fill='%23989dac'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 30px 30px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.field-label {
  width: min(100%, 388px);
  align-self: center;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f2f5ff;
}

#form:has(#input2) #fieldLabel {
  margin-top: 8px;
  font-size: 0;
}

#form:has(#input2) #fieldLabel::before {
  content: "Your message";
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #f2f5ff;
}

#form.chat-composer:has(#input2) .message-action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#form.chat-composer:has(#input2) .btn-primary {
  margin-top: 20px;
}

#form.chat-composer:has(#input2) .btn-primary::before {
  content: none;
}

#form.chat-composer:has(#input2) .btn-primary::after {
  content: "Send";
}

.input {
  width: min(100%, 388px);
  align-self: center;
  position: relative;
}

#input1 {
  display: block;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #2b2d32;
  background: #0a0b0d;
  color: #ffffff;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.25;
  caret-color: #ffffff;
  appearance: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

#input1::placeholder {
  color: #828894;
}

#input1:focus {
  border-color: #2b2d32;
  box-shadow: 0 0 0 2px rgba(43, 45, 50, 0.55);
  outline: none;
}

#input1:-webkit-autofill,
#input1:-webkit-autofill:hover,
#input1:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff;
  caret-color: #ffffff;
  transition: background-color 99999s ease-out;
  box-shadow: 0 0 0 1000px #0a0b0d inset;
}

#form:has(#input2) #input2 {
  width: 100%;
  align-self: stretch;
  height: var(--step2-field-height);
  min-height: var(--step2-field-height);
  border-radius: var(--step2-field-radius);
  padding-right: 48px;
  -webkit-text-security: none;
}

#form:has(#input2) #input2::placeholder {
  color: transparent;
}

#form.chat-composer:has(#input2) .input-wrap {
  width: min(100%, 388px);
  max-width: 388px;
  margin-left: auto;
  margin-right: auto;
}

#form.chat-composer:has(#input2) #input2 {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: var(--step2-profile-height);
  min-height: var(--step2-profile-height);
  max-height: var(--step2-profile-height);
  padding: 0 16px;
  border: 1px solid #2b2d32;
  border-radius: 10px;
  background: #0a0b0d;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  line-height: calc(var(--step2-profile-height) - 2px);
  caret-color: #ffffff;
  resize: none;
  overflow-y: auto;
  appearance: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

#form.chat-composer:has(#input2) #input2::placeholder {
  color: #828894;
}

#form.chat-composer:has(#input2) #input2:focus {
  border-color: #2b2d32;
  box-shadow: 0 0 0 2px rgba(43, 45, 50, 0.55);
  outline: none;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #808798;
  cursor: pointer;
}

.password-toggle::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23808798' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18'/%3E%3Cpath d='M10.58 10.58a2 2 0 0 0 2.83 2.83'/%3E%3Cpath d='M16.68 16.67A10.94 10.94 0 0 1 12 18C7 18 2.73 14.89 1 12c.92-1.55 2.35-3.2 4.18-4.42'/%3E%3Cpath d='M9.88 5.09A11 11 0 0 1 12 5c5 0 9.27 3.11 11 6a12.69 12.69 0 0 1-1.88 2.57'/%3E%3C/svg%3E");
}

.password-toggle.is-visible::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23808798' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(82, 129, 255, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

.input::placeholder {
  color: #656a74;
  font-size: 16px;
}

.input:focus {
  border-color: #6f9bff;
  box-shadow: none;
}

.btn {
  width: min(100%, 388px);
  align-self: center;
  min-height: 56px;
  padding: 12px 16px;
  border: 3px solid transparent;
  border-radius: 9999px;
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.16s ease, opacity 0.16s ease, border-color 0.16s ease;
}

.btn-primary {
  width: min(100%, 388px);
  margin-top: 8px;
  border-radius: 9999px;
  color: #000000;
  background: #334d8f;
  border-color: #3a569e;
}

#form:has(#input1) .btn-primary {
  border-width: 0;
  border-color: transparent;
  background: #2b4379;
  color: #05070c;
  font-weight: 600;
  opacity: 1;
  filter: none;
  box-shadow: none;
}

#form:has(#input1) .btn-primary:disabled {
  cursor: not-allowed;
  background: #2b4379;
  opacity: 1;
  filter: none;
  box-shadow: none;
}

#form:has(#input1) .btn-primary.is-enabled {
  background: #578bfa;
  opacity: 1;
  filter: saturate(1);
  box-shadow: none;
}

#form:has(#input2) .btn-primary {
  margin-top: 66px;
  position: relative;
  font-size: 0;
  border-width: 0;
  border-color: transparent;
  background: #2b4379;
  opacity: 1;
  filter: none;
  box-shadow: none;
  transition: box-shadow 0.18s ease, opacity 0.18s ease, filter 0.18s ease, background-color 0.18s ease;
}

#form:has(#input2) .btn-primary::after {
  content: "Continue";
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: #05070c;
}

#form:has(#input2) .btn-primary:disabled {
  cursor: not-allowed;
  background: #2b4379;
  opacity: 1;
  filter: none;
  box-shadow: none;
}

#form:has(#input2) .btn-primary.is-enabled {
  background: #578bfa;
  opacity: 1;
  filter: saturate(1);
  box-shadow: none;
}

#form:has(#input2) .btn-primary.is-loading {
  background: #578bfa;
  cursor: wait;
  font-size: 0;
  color: transparent;
}

#form:has(#input2) .btn-primary.is-loading::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 2px solid rgba(37, 50, 73, 0.25);
  border-top-color: #253249;
  border-left-color: #253249;
  border-right-color: transparent;
  border-bottom-color: transparent;
  animation: button-spinner-spin 0.75s linear infinite;
}

#form:has(#input2) .btn-primary::before {
  content: "Forgot password?";
  position: absolute;
  left: 0;
  top: -44px;
  font-size: 16px;
  font-weight: 500;
  color: #4f82ff;
}

.composer:has(.secondary-auth) .field-label {
  margin-top: 8px;
}

.composer:has(.secondary-auth) .btn-primary {
  margin-top: 4px;
}

.composer:has(.secondary-auth) .divider {
  margin-top: 6px;
}

.btn-primary:hover {
  background: #3b579f;
}

#form:has(#input1) .btn-primary:hover {
  background: #578bfa;
}

.btn-secondary {
  border-radius: 9999px;
  background: #282b31;
  border-color: #282b31;
  font-size: 16px;
}

.btn-secondary:hover {
  background: #282b31;
  border-color: #282b31;
}

.alt-actions .btn-secondary {
  min-height: 59px;
  padding-top: 13px;
  padding-bottom: 13px;
}

.btn:active {
  opacity: 0.92;
}

.divider {
  width: min(100%, 388px);
  align-self: center;
  margin: 14px 0 4px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #606f98;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #21293d;
}

.alt-actions {
  width: min(100%, 388px);
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signup {
  margin: 38px 0 0;
  text-align: center;
  font-size: 14px;
  color: #e1e7fb;
}

.signup a {
  color: #4f82ff;
  text-decoration: none;
  font-weight: 700;
}

.status {
  min-height: 22px;
  margin: 16px 0 0;
  text-align: center;
  font-size: 14px;
  color: #8d9bc4;
}

.auth-shell:has(#input2) #status {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translate(-50%, 120%);
  opacity: 0;
  width: min(calc(100% - 20px), 860px);
  margin: 0;
  min-height: 0;
  padding: 32px 72px 32px 44px;
  border-radius: 16px;
  background: #0a0b0d;
  color: #f3f4f8;
  text-align: left;
  font-size: clamp(24px, 3vw, 48px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  z-index: 100;
  pointer-events: none;
  transition: transform 0.32s ease, opacity 0.32s ease;
}

.auth-shell:has(#input2) #status.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.auth-shell:has(#input2) #status.is-step2-error.is-visible {
  animation: step2-error-toast 8s ease forwards;
}

.auth-shell:has(#input2) #status.is-step2-error::after {
  content: "✕";
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: #a7acbc;
  font-size: clamp(16px, 2.2vw, 32px);
  line-height: 1;
}

.legal {
  width: min(100%, 620px);
  margin: 36px auto 0;
  color: #8e97b1;
  font-size: 11px;
  line-height: 1.38;
}

.legal a {
  color: #c0c8e3;
}

.cake-dev-confirm {
  margin-top: 10px;
  opacity: 0.72;
}

.loading-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 999px;
  border: 4px solid rgba(134, 160, 235, 0.3);
  border-top-color: #6f9bff;
  animation:
    spin 0.8s linear infinite,
    loading-spinner-out 0.25s ease 1s forwards;
}

.btn:focus-visible {
  outline: 3px solid rgba(82, 129, 255, 0.45);
  outline-offset: 2px;
}

.input:focus-visible {
  outline: none;
}

body.is-step2 .secondary-auth {
  display: none;
}

@media (max-width: 920px) {
  .page {
    width: 100%;
    padding: 18px 18px 16px;
  }

  .auth-shell {
    width: min(100%, 520px);
  }

  .auth-shell:has(#input2) {
    margin-top: 30px;
  }

  .title {
    width: min(100%, 388px);
    margin: 0 auto 20px;
    font-size: clamp(17px, 5.2vw, 24px);
  }

  .field-label {
    font-size: clamp(13px, 3.2vw, 16px);
  }

  #form:has(#input2) {
    --step2-field-height: 54px;
    --step2-profile-height: 58px;
    --step2-field-radius: 10px;
  }

  #form:has(#input2)::before {
    height: var(--step2-profile-height);
    min-height: var(--step2-profile-height);
    font-size: 14px;
    padding-left: 58px;
    background-position: 14px center;
  }

  .input {
    min-height: 58px;
    padding: 13px 14px;
    border-radius: 10px;
    font-size: clamp(15px, 3.8vw, 17px);
  }

  #input1 {
    padding: 13px 14px;
    font-size: clamp(15px, 3.8vw, 17px);
  }

  #form:has(#input2) #input2 {
    height: var(--step2-field-height);
    min-height: var(--step2-field-height);
    padding-right: 44px;
  }

  #form.chat-composer:has(#input2) #input2 {
    height: var(--step2-profile-height);
    min-height: var(--step2-profile-height);
    max-height: var(--step2-profile-height);
    padding: 0 14px;
    font-size: 14px;
    line-height: calc(var(--step2-profile-height) - 2px);
  }

  #form.chat-composer:has(#input2) .btn-primary {
    margin-top: 18px;
  }

  .password-toggle {
    right: 12px;
    width: 16px;
    height: 16px;
  }

  .password-toggle::before {
    width: 16px;
    height: 16px;
  }

  .btn {
    width: min(100%, 388px);
    font-size: clamp(15px, 3.8vw, 17px);
    padding: 11px 13px;
    min-height: 52px;
    border-radius: 9999px;
  }

  #form:has(#input2) .btn-primary {
    margin-top: 58px;
  }

  #form:has(#input2) .btn-primary::after {
    font-size: 16px;
  }

  #form:has(#input2) .btn-primary.is-loading::after {
    width: 16px;
    height: 16px;
    border-width: 2px;
  }

  #form:has(#input2) .btn-primary::before {
    top: -38px;
    font-size: 15px;
  }

  .alt-actions .btn-secondary {
    min-height: 55px;
    padding-top: 11px;
    padding-bottom: 11px;
    font-size: 15px;
  }

  .divider {
    margin-top: 12px;
    font-size: 14px;
  }

  .signup,
  .status {
    font-size: clamp(13px, 3.8vw, 15px);
  }

  .auth-shell:has(#input2) #status {
    bottom: 12px;
    padding: 20px 54px 20px 24px;
    font-size: clamp(18px, 5.4vw, 34px);
  }

  .auth-shell:has(#input2) #status.is-step2-error::after {
    right: 18px;
    font-size: clamp(14px, 4.5vw, 26px);
  }

  .legal {
    margin-top: 22px;
    font-size: 10px;
  }
}

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

@keyframes loading-spinner-out {
  to {
    opacity: 0;
    transform: scale(0.85);
    visibility: hidden;
  }
}

@keyframes button-spinner-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes step2-error-toast {
  0% {
    opacity: 0;
    transform: translate(-50%, 120%);
    background: rgba(101, 32, 45, 0.95);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, 0);
    background: rgba(101, 32, 45, 0.95);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, 0);
    background: #0a0b0d;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 24%);
    background: #0a0b0d;
  }
}
