#before-boot-screen {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  background: #f5f4ef;
  color: #141410;
  opacity: 1;
  transition: opacity .28s ease;
}

#before-boot-screen img {
  width: clamp(104px, 30vw, 138px);
  height: clamp(104px, 30vw, 138px);
  opacity: 0;
  filter: blur(15px);
  transform: scale(.88);
  animation: before-logo-focus 1.35s cubic-bezier(.2,.8,.2,1) forwards;
}

#before-boot-screen span {
  margin-top: 22px;
  color: #141410;
  font: 800 11px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: .2em;
  text-indent: .2em;
  opacity: 0;
  transform: translateY(5px);
  animation: before-loading-copy .55s ease .72s forwards;
}

#before-boot-screen.is-leaving {
  opacity: 0;
  pointer-events: none;
}

/* React fallback while the auth session itself is still resolving. */
.auth-shell:has(> .auth-card:not(:has(form)):has(> .auth-logo + h1 + p)) {
  background: #f5f4ef;
  padding: 0;
}

.auth-shell > .auth-card:not(:has(form)):has(> .auth-logo + h1 + p) {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  border-radius: 0;
  box-shadow: none;
  background: #f5f4ef;
  padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-shell > .auth-card:not(:has(form)):has(> .auth-logo + h1 + p) .auth-logo {
  width: clamp(104px, 30vw, 138px);
  height: clamp(104px, 30vw, 138px);
  margin: 0;
  border-radius: 0;
  background: transparent url('/loading-logo.svg') center / contain no-repeat;
  color: transparent;
  font-size: 0;
  opacity: 1;
  filter: none;
  transform: none;
}

.auth-shell > .auth-card:not(:has(form)):has(> .auth-logo + h1 + p) h1,
.auth-shell > .auth-card:not(:has(form)):has(> .auth-logo + h1 + p) p {
  display: none;
}

.auth-shell > .auth-card:not(:has(form)):has(> .auth-logo + h1 + p)::after {
  content: 'BEFORE LOADING…';
  margin-top: 22px;
  color: #141410;
  font: 800 11px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: .2em;
  text-indent: .2em;
}

@keyframes before-logo-focus {
  0% {
    opacity: 0;
    filter: blur(15px);
    transform: scale(.88);
  }
  48% {
    opacity: .9;
    filter: blur(5px);
    transform: scale(1.015);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes before-loading-copy {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #before-boot-screen,
  #before-boot-screen img,
  #before-boot-screen span {
    animation: none;
    transition: none;
    filter: none;
    transform: none;
    opacity: 1;
  }
}
