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

@layer stitch-recovery {
html[data-theme] #modal-root#modal-root.stitch-recovery-open {
  --recovery-paper: #ffffff;
  --recovery-field: #f5f2f8;
  --recovery-border: #ddd6e3;
  --recovery-ink: #231a29;
  --recovery-muted: #6d6472;
  --recovery-accent: #7c3aed;
  --recovery-accent-2: #a855f7;
  --recovery-error: #b3261e;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background:
    radial-gradient(circle at 14% 18%, rgb(168 85 247 / 0.18), transparent 32%),
    color-mix(in srgb, #160c1c 58%, transparent) !important;
}

html[data-theme="dark"] #modal-root#modal-root.stitch-recovery-open {
  --recovery-paper: #17131f;
  --recovery-field: #241f2c;
  --recovery-border: #4c4357;
  --recovery-ink: #f1eaf4;
  --recovery-muted: #cfc5d5;
  --recovery-accent: #d8b9ff;
  --recovery-accent-2: #a855f7;
  --recovery-error: #ffb4ab;
  background:
    radial-gradient(circle at 14% 18%, rgb(168 85 247 / 0.22), transparent 34%),
    color-mix(in srgb, #07050a 80%, transparent) !important;
}

html[data-theme] #modal-root#modal-root > .modal.stitch-recovery-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%, 520px) !important;
  max-width: 520px !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(--recovery-border) !important;
  border-radius: 24px !important;
  background: var(--recovery-paper) !important;
  color: var(--recovery-ink) !important;
  box-shadow: 0 24px 80px rgb(7 5 10 / 0.46) !important;
  font-family: "Commissioner", system-ui, sans-serif !important;
}

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

html[data-theme] #modal-root#modal-root .stitch-recovery-dialog > .stitch-recovery-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: 30px 32px !important;
  overflow: auto !important;
  background: var(--recovery-paper) !important;
  color: var(--recovery-ink) !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-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(--recovery-border) !important;
  border-radius: 999px !important;
  background: var(--recovery-field) !important;
  color: var(--recovery-ink) !important;
}

.stitch-recovery-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin: 0 48px 28px 0;
}

.stitch-recovery-brand,
.stitch-recovery-signin,
.stitch-recovery-footer-link {
  color: var(--recovery-accent);
  font-weight: 700;
  text-decoration: none;
}

.stitch-recovery-brand {
  color: var(--recovery-ink);
  font: 800 20px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.stitch-recovery-signin {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--recovery-border);
  border-radius: 999px;
  background: var(--recovery-field);
  font-size: 14px;
}

.stitch-recovery-eyebrow {
  margin: 0 0 8px !important;
  color: var(--recovery-accent) !important;
  font: 700 12px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace !important;
  letter-spacing: 0.08em !important;
}

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

.stitch-recovery-intro {
  max-width: 48ch;
  margin: 0 0 24px !important;
  color: var(--recovery-muted) !important;
  font: 400 15px/1.55 "Commissioner", system-ui, sans-serif !important;
}

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

html[data-theme] #modal-root#modal-root .stitch-recovery-form > .field {
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
  min-width: 0 !important;
  margin: 0 !important;
}

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

html[data-theme] #modal-root#modal-root .stitch-recovery-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(--recovery-border) !important;
  border-radius: 12px !important;
  background: var(--recovery-field) !important;
  color: var(--recovery-ink) !important;
  font: 400 16px/1.5 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-form > p {
  margin: 0 !important;
  color: var(--recovery-muted) !important;
  font: 400 14px/1.5 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-form > [role="alert"]:not(:empty) {
  padding: 11px 12px !important;
  border: 1px solid color-mix(in srgb, var(--recovery-error) 42%, var(--recovery-border)) !important;
  border-radius: 12px !important;
  background: color-mix(in srgb, var(--recovery-error) 8%, var(--recovery-paper)) !important;
  color: var(--recovery-error) !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-form > :is(button, .btn) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 10px 18px !important;
  border-radius: 999px !important;
  font: 700 14px/1.4 "Commissioner", system-ui, sans-serif !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-form > :is(button[type="submit"], .primary) {
  border: 0 !important;
  background: linear-gradient(90deg, var(--recovery-accent-2), #7c3aed) !important;
  color: #ffffff !important;
  box-shadow: 0 7px 18px rgb(109 40 217 / 0.2) !important;
}

html[data-theme] #modal-root#modal-root .stitch-recovery-form > :is(button.secondary, [data-close-modal]) {
  border: 1px solid var(--recovery-border) !important;
  background: var(--recovery-field) !important;
  color: var(--recovery-ink) !important;
}

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

html[data-theme] #modal-root#modal-root .stitch-recovery-form button:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

.stitch-recovery-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--recovery-border);
  color: var(--recovery-muted);
  font-size: 14px;
}

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

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

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

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

  .stitch-recovery-masthead {
    margin: 0 44px 22px 0;
  }

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

  .stitch-recovery-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
}
