@layer stitch-sign-in, stitch-recovery, stitch-auth-fallback;
@import "./auth-presentation.css" layer(stitch-auth-fallback);

@layer stitch-sign-in {
html[data-theme] #modal-root#modal-root.stitch-signin-open {
  --signin-paper: #ffffff;
  --signin-field: #f2f0f8;
  --signin-border: #ded9e7;
  --signin-ink: #201a2b;
  --signin-muted: #675f70;
  --signin-primary: #6d28d9;
  --signin-primary-2: #a855f7;
  --signin-error: #b3261e;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: color-mix(in srgb, #17111f 52%, transparent) !important;
}

html[data-theme="dark"] #modal-root#modal-root.stitch-signin-open {
  --signin-paper: #17131f;
  --signin-field: #241f2c;
  --signin-border: #4c4357;
  --signin-ink: #ece5f0;
  --signin-muted: #cfc5d5;
  --signin-primary: #d8b9ff;
  --signin-primary-2: #a855f7;
  --signin-error: #ffb4ab;
  background: color-mix(in srgb, #07050a 74%, transparent) !important;
}

html[data-theme] #modal-root#modal-root > .modal.stitch-signin-dialog {
  box-sizing: border-box !important;
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: min(100%, 460px) !important;
  max-width: 460px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 40px) !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  transform: none !important;
  border: 1px solid var(--signin-border) !important;
  border-radius: 24px !important;
  background: var(--signin-paper) !important;
  color: var(--signin-ink) !important;
  box-shadow: 0 24px 80px rgb(7 5 10 / 0.42) !important;
  font-family: "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog > :is(.endgame-auth-art, .concept-state-recovery-art) {
  display: none !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog > .stitch-signin-body {
  box-sizing: border-box !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 40px) !important;
  margin: 0 !important;
  padding: 32px !important;
  overflow: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--signin-paper) !important;
  color: var(--signin-ink) !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog > .modal-close {
  position: absolute !important;
  z-index: 4 !important;
  inset: 14px 14px auto auto !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid var(--signin-border) !important;
  border-radius: 999px !important;
  background: var(--signin-field) !important;
  color: var(--signin-ink) !important;
}

.stitch-signin-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin: 0 48px 12px 0;
}

.stitch-signin-route {
  color: var(--signin-primary);
  font: 600 12px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.04em;
}

.stitch-signin-mascot {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
  border-radius: 9px;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog :is(#dialog-title, #castlori-dialog-title, h2) {
  margin: 0 48px 8px 0 !important;
  padding: 0 !important;
  color: var(--signin-ink) !important;
  font: 700 clamp(28px, 5vw, 36px)/1.12 Georgia, "Times New Roman", serif !important;
  letter-spacing: -0.025em !important;
  overflow-wrap: anywhere;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-intro {
  max-width: 42ch !important;
  margin: 0 0 24px !important;
  color: var(--signin-muted) !important;
  font: 400 15px/1.55 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .auth127129-password-jump {
  display: none !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form {
  display: grid !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form > .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
  min-width: 0 !important;
  margin: 0 !important;
  color: var(--signin-ink) !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form label {
  margin: 0 !important;
  color: var(--signin-ink) !important;
  font: 600 14px/1.45 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form input:not([type="hidden"]) {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 10px 14px !important;
  border: 1px solid var(--signin-border) !important;
  border-radius: 12px !important;
  background: var(--signin-field) !important;
  color: var(--signin-ink) !important;
  font: 400 16px/1.5 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form input::placeholder {
  color: var(--signin-muted) !important;
  opacity: 0.86;
}

.stitch-signin-password-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.stitch-signin-input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-input-shell > input {
  padding-right: 68px !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-password-toggle {
  position: absolute !important;
  inset: 5px 5px 5px auto !important;
  width: auto !important;
  min-width: 54px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 6px 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--signin-primary) !important;
  font: 650 13px/1.3 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-recovery {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 36px !important;
  margin: -8px -8px -8px 0 !important;
  padding: 8px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--signin-primary) !important;
  font: 650 13px/1.35 "Commissioner", system-ui, sans-serif !important;
  text-align: right !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form > .notice {
  display: none !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form > [data-auth-error] {
  margin: 0 !important;
  padding: 11px 12px !important;
  border: 1px solid color-mix(in srgb, var(--signin-error) 42%, var(--signin-border)) !important;
  border-radius: 12px !important;
  background: color-mix(in srgb, var(--signin-error) 8%, var(--signin-paper)) !important;
  color: var(--signin-error) !important;
  font: 500 14px/1.45 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form > button[type="submit"] {
  width: 100% !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 10px 18px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, var(--signin-primary-2), #7c3aed) !important;
  color: #ffffff !important;
  font: 700 15px/1.4 "Commissioner", system-ui, sans-serif !important;
  box-shadow: 0 7px 18px rgb(109 40 217 / 0.2) !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-passkey {
  display: grid !important;
  gap: 10px !important;
  margin: 2px 0 0 !important;
  padding: 17px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--signin-border) !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-passkey::before {
  content: "OR CONTINUE WITH";
  display: block;
  color: var(--signin-muted);
  font: 600 11px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.06em;
  text-align: center;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-passkey > h3 {
  display: none !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-passkey > [data-passkey-login] {
  width: 100% !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 9px 14px !important;
  border: 1px solid var(--signin-border) !important;
  border-radius: 999px !important;
  background: var(--signin-field) !important;
  color: var(--signin-ink) !important;
  font: 650 14px/1.4 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-form[aria-busy="true"] > button[type="submit"] {
  opacity: 0.72;
  cursor: wait !important;
}

.stitch-signin-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 2px;
  padding-top: 16px;
  border-top: 1px solid var(--signin-border);
}

.stitch-signin-account-copy {
  color: var(--signin-muted);
  font: 400 14px/1.45 "Commissioner", system-ui, sans-serif;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog .stitch-signin-account-action {
  width: auto !important;
  min-width: 0 !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 8px 14px !important;
  border: 1px solid var(--signin-border) !important;
  border-radius: 999px !important;
  background: var(--signin-field) !important;
  color: var(--signin-primary) !important;
  font: 650 14px/1.35 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-signin-dialog :is(button, input):focus-visible {
  outline: 2px solid var(--signin-primary) !important;
  outline-offset: 2px !important;
}

@media (max-width: 600px) {
  html[data-theme] #modal-root#modal-root.stitch-signin-open {
    align-items: center !important;
    padding: 8px !important;
    overflow: hidden !important;
  }

  html[data-theme] #modal-root#modal-root > .modal.stitch-signin-dialog {
    width: min(100%, calc(100vw - 16px)) !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
    border: 1px solid var(--signin-border) !important;
    border-radius: 20px !important;
  }

  html[data-theme] #modal-root#modal-root .stitch-signin-dialog > .stitch-signin-body {
    min-height: 0 !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 24px 18px !important;
  }

  html[data-theme] #modal-root#modal-root .stitch-signin-dialog > .modal-close {
    inset: 10px 10px auto auto !important;
  }

  .stitch-signin-brand {
    margin-right: 44px;
  }

  html[data-theme] #modal-root#modal-root .stitch-signin-dialog :is(#dialog-title, #castlori-dialog-title, h2) {
    margin-right: 0 !important;
    font-size: 29px !important;
  }
}

@media (max-height: 620px) {
  html[data-theme] #modal-root#modal-root .stitch-signin-dialog > .stitch-signin-body {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stitch-signin-dialog *,
  .stitch-signin-dialog *::before,
  .stitch-signin-dialog *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
}
