/* Klevby auth welcome screen — visual shell only (#authSection) */

/* Full-screen entry mode: hide app chrome only while auth is visible */
body:has(#authSection:not(.hidden)) {
  overflow: hidden;
  background: #040807;
}

body:has(#authSection:not(.hidden)) #klevbyAppRoot > header,
body:has(#authSection:not(.hidden)) #klevbyAppRoot > #homeFloatBtn,
body:has(#authSection:not(.hidden)) #klevbyAppRoot > #installBanner,
body:has(#authSection:not(.hidden)) #klevbyAppRoot > .mobile-tabbar {
  display: none !important;
}

#authSection:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 1200;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  color-scheme: dark;
}

#authSection {
  margin: 0;
  padding: 0;
  color-scheme: dark;
}

#authSection .auth-welcome {
  position: relative;
  min-height: 100dvh;
  min-height: 100svh;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#authSection .auth-welcome-bg {
  position: absolute;
  inset: 0;
  background-image: url("../../images/auth-bg-klevby-sunset.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 22%;
  transform: scale(1.01);
  z-index: 0;
}

#authSection .auth-welcome-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(3, 5, 4, 0.34) 0%,
      rgba(3, 5, 4, 0.52) 24%,
      rgba(3, 5, 4, 0.78) 52%,
      rgba(2, 4, 3, 0.94) 78%,
      rgba(2, 3, 3, 0.98) 100%
    ),
    linear-gradient(
      90deg,
      rgba(2, 4, 3, 0.78) 0%,
      rgba(2, 4, 3, 0.42) 38%,
      rgba(2, 4, 3, 0.14) 72%,
      rgba(2, 4, 3, 0.08) 100%
    ),
    radial-gradient(
      circle at 78% 14%,
      rgba(244, 122, 43, 0.20) 0%,
      rgba(244, 122, 43, 0.08) 22%,
      transparent 54%
    );
  z-index: 1;
}

#authSection .auth-welcome-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100dvh;
  min-height: 100svh;
  padding:
    calc(env(safe-area-inset-top) + 16px)
    18px
    calc(env(safe-area-inset-bottom) + 24px);
  gap: 14px;
}

#authSection .auth-welcome-brand {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: clamp(8px, 3vh, 28px);
  flex: 0 0 auto;
}

#authSection .auth-welcome-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  width: fit-content;
  max-width: 100%;
}

#authSection .auth-welcome-logo-mark {
  display: block;
  width: clamp(68px, 18vw, 88px);
  height: clamp(68px, 18vw, 88px);
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
  image-rendering: -webkit-optimize-contrast;
}

#authSection .auth-welcome-logo-text {
  margin-left: -8px;
  font-size: clamp(30px, 7.8vw, 38px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

#authSection .auth-welcome-logo-main,
#authSection .auth-welcome-logo-accent {
  font-weight: inherit;
}

#authSection .auth-welcome-logo-main {
  color: #ffffff;
}

#authSection .auth-welcome-logo-accent {
  color: #F47A2B;
}

#authSection .auth-welcome-tagline {
  margin: 8px 0 0;
  max-width: 22em;
  color: rgba(255, 248, 234, 0.62);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0.03em;
  transform: translateX(4px);
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

#authSection .auth-welcome-panel {
  width: min(100%, 420px);
  margin: 0;
  flex: 0 0 auto;
  padding: 10px 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#authSection .auth-welcome-panel.panel {
  margin: 0;
  padding: 10px 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#authSection .auth-welcome-panel h2,
#authSection #authTitle {
  margin: 0 0 6px;
  text-align: center;
  font-size: clamp(19px, 4.9vw, 22px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: #fff8ea;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

#authSection #authSubtitle {
  margin: 0 0 16px;
  text-align: center;
  color: rgba(244, 251, 247, 0.72);
  font-size: 13px;
  line-height: 1.38;
  font-weight: 600;
  white-space: pre-line;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.48);
}

#authSection .auth-welcome-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#authSection .auth-welcome-fields label.auth-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#authSection .auth-welcome-fields input {
  box-sizing: border-box;
  margin: 0 0 12px;
  min-height: 50px;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(4, 8, 6, 0.52);
  color: #fff8ea;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

#authSection .auth-welcome-fields input:last-of-type {
  margin-bottom: 0;
}

#authSection .auth-welcome-fields input::placeholder {
  color: rgba(255, 248, 234, 0.34);
}

#authSection .auth-welcome-fields input:focus {
  border-color: rgba(244, 122, 43, 0.42);
  background: rgba(6, 10, 8, 0.62);
  box-shadow: 0 0 0 4px rgba(244, 122, 43, 0.12);
}

#authSection .auth-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

#authSection .auth-welcome-primary {
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid rgba(244, 122, 43, 0.34);
  border-radius: 18px;
  background: linear-gradient(135deg, #f47a2b 0%, #f09a58 100%);
  color: #fff8ea;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  box-shadow:
    0 14px 28px rgba(244, 122, 43, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

#authSection .auth-welcome-primary.hidden {
  display: none !important;
}

#authSection .auth-welcome-primary:active {
  transform: scale(0.985);
  filter: brightness(0.96);
}

#authSection .auth-welcome-secondary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#authSection .auth-welcome-secondary .auth-welcome-primary,
#authSection .auth-welcome-secondary .small-btn {
  width: 100%;
}

#authSection .auth-welcome-link-btn {
  width: auto;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 248, 234, 0.58);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 248, 234, 0.28);
}

#authSection .auth-welcome-link-btn:active {
  color: rgba(255, 248, 234, 0.82);
  transform: none;
  filter: none;
}

#authSection .auth-welcome-logout {
  color: rgba(255, 248, 234, 0.42);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

#authSection #authResendBtn:not(.hidden) {
  width: 100%;
  min-height: 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 248, 234, 0.84);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

#authSection #authSwitchText {
  margin-top: 10px;
  text-align: center;
  color: rgba(255, 248, 234, 0.48);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

#authSection #authSwitchText .small-btn {
  min-height: auto;
  margin-left: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 248, 234, 0.82);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 248, 234, 0.28);
}

#authSection #authStatus {
  margin-top: 8px;
  text-align: center;
  color: rgba(255, 248, 234, 0.48);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
}

#authSection:not(.hidden) ~ .footer {
  display: none;
}

@media (max-width: 900px) {
  #authSection .auth-welcome-bg {
    background-size: auto 118%;
    background-position: 72% 10%;
  }

  #authSection .auth-welcome-overlay {
    background:
      linear-gradient(
        180deg,
        rgba(3, 5, 4, 0.30) 0%,
        rgba(3, 5, 4, 0.48) 22%,
        rgba(3, 5, 4, 0.76) 50%,
        rgba(2, 4, 3, 0.94) 76%,
        rgba(2, 3, 3, 0.98) 100%
      ),
      linear-gradient(
        90deg,
        rgba(2, 4, 3, 0.82) 0%,
        rgba(2, 4, 3, 0.46) 34%,
        rgba(2, 4, 3, 0.16) 68%,
        rgba(2, 4, 3, 0.10) 100%
      ),
      radial-gradient(
        circle at 82% 12%,
        rgba(244, 122, 43, 0.24) 0%,
        rgba(244, 122, 43, 0.10) 20%,
        transparent 50%
      );
  }

  #authSection .auth-welcome-inner {
    justify-content: flex-start;
    padding-top: calc(env(safe-area-inset-top) + max(12px, 2.5vh));
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
    gap: 0;
  }

  #authSection .auth-welcome-brand {
    padding-top: clamp(4px, 2vh, 18px);
  }

  #authSection .auth-welcome-logo {
    gap: 0;
  }

  #authSection .auth-welcome-logo-text {
    font-size: clamp(30px, 7.7vw, 36px);
  }

  #authSection .auth-welcome-logo-mark {
    width: clamp(70px, 18vw, 80px);
    height: clamp(66px, 16.8vw, 78px);
  }

  #authSection .auth-welcome-tagline {
    font-size: 13px;
    margin-top: 7px;
  }

  #authSection #authTitle {
    font-size: clamp(30px, 8vw, 36px);
    margin-bottom: 8px;
    font-weight: 800;
  }

  #authSection #authSubtitle {
    margin-bottom: 14px;
    line-height: 1.36;
  }

  #authSection .auth-welcome-panel,
  #authSection .auth-welcome-panel.panel {
    margin-top: clamp(52px, 7.2vh, 72px);
    padding: 0;
  }

  #authSection .auth-welcome-fields input,
  #authSection .auth-welcome-primary {
    width: min(calc(100% - 37px), 403px);
    min-height: 55px;
    height: 55px;
    margin-left: auto;
    margin-right: auto;
  }

  #authSection .auth-welcome-primary {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* TEMP auth skip button: remove when auth wall flow is finalized */
#authSection .auth-welcome-skip {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  z-index: 6;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 234, 0.22);
  background: rgba(255, 248, 234, 0.075);
  color: rgba(255, 248, 234, 0.78);
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

#authSection .auth-welcome-skip:active {
  transform: translateY(1px) scale(0.98);
}
/* /TEMP auth skip button */

