html.is-spectator:not(.is-authed) .app {
  visibility: visible;
  pointer-events: auto;
}

html.is-spectator .auth-screen {
  display: none;
}

.auth-screen {
  background: #F2F4F7;
}

/* Login, register and verify-email sit outside .app. While the iPhone keyboard is
   open, keyboard-fit.js sets html.is-keyboard-open and --app-* to the visible area
   above the keyboard; pin the auth layers there, top-align the card, and scroll on
   short viewports (register has more fields). When the keyboard is closed, desktop.css
   keeps the card vertically centered. */
/* Only while those screens are really showing: this rule's display:flex used to beat
   the is-authed and [hidden] rules that hide them, so on iPhone every keyboard open
   (any input) put the login screen over a signed-in app. */
html.is-keyboard-open:not(.is-authed):not(.is-spectator) .auth-screen,
html.is-keyboard-open .verify-email-screen:not([hidden]) {
  top: var(--app-top, 0px);
  left: var(--app-left, 0px);
  right: auto;
  bottom: auto;
  width: var(--app-width, 100%);
  height: var(--app-height, 100%);
  max-height: var(--app-height, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(12px + var(--safe-top, 0px)) 18px 16px;
}

html.is-keyboard-open:not(.is-authed):not(.is-spectator) .auth-screen .auth-card,
html.is-keyboard-open .verify-email-screen:not([hidden]) .verify-email-card {
  flex: 0 0 auto;
  margin: 0 auto;
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-brand-symbol {
  width: 56px;
  height: 56px;
}

.auth-brand-name {
  margin: 0;
  color: #111114;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-brand-byline {
  margin: 0;
  color: #66756e;
  font-size: 13px;
  font-weight: 600;
}

.auth-kicker {
  display: none;
}

.auth-submit {
  background: #111114;
}

.auth-skip {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border: 1px solid #d5dbe3;
  border-radius: 16px;
  color: #111114;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.guest-sign-in-pill {
  position: fixed;
  top: calc(8px + var(--safe-top, 0px));
  left: 50%;
  z-index: 70;
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid #ffd5c9;
  border-radius: 999px;
  color: #111114;
  background: #fff;
  box-shadow: 0 6px 18px rgba(17, 17, 20, 0.08);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

html.is-spectator:not(.is-authed) .guest-sign-in-pill:not([hidden]) {
  display: block;
}

/* Phone with the bottom bar: the pill sat on top of the search boxes (a tap on the box hit
   the pill and opened sign-in). Guests sign in from the Me tab card or when they send. */
html:not(.is-desktop-board)[data-main-tab].is-spectator:not(.is-authed) .guest-sign-in-pill {
  display: none;
}

.join-sheet {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: end center;
  padding: 16px;
  pointer-events: none;
}

.join-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(17, 17, 20, 0.32);
  pointer-events: none;
}

.join-sheet:not(.show) .join-sheet-panel {
  display: none;
}

.join-sheet.show {
  pointer-events: auto;
}

.join-sheet.show::before {
  opacity: 1;
  pointer-events: auto;
}

body:has(#joinSheet.show) .story-post-fab,
body:has(#verifyEmailScreen:not([hidden])) .story-post-fab {
  visibility: hidden;
  pointer-events: none;
}

.join-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 22px 20px 18px;
  border-radius: 24px 24px 20px 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(17, 17, 20, 0.16);
}

.join-sheet-panel h2 {
  margin: 0 0 8px;
  color: #111114;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.join-sheet-copy {
  margin: 0 0 16px;
  color: #66756e;
  font-size: 14px;
  line-height: 1.45;
}

.join-sheet-panel .auth-submit {
  width: 100%;
  margin-top: 4px;
  padding: 13px 16px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: #111114;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
}

.join-sheet-panel .auth-switch {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: #111114;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.join-sheet-panel .auth-skip {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border: 1px solid #d5dbe3;
  border-radius: 16px;
  color: #111114;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.verify-email-screen {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) 18px 24px;
  background: #F2F4F7;
}

.verify-email-screen[hidden] {
  display: none !important;
}

.verify-email-card {
  width: min(100%, 390px);
  padding: 28px 24px 22px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(22, 27, 34, 0.12);
}

.verify-email-card h2 {
  margin: 0 0 8px;
  color: #111114;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.verify-email-copy {
  margin: 0 0 18px;
  color: #66756e;
  font-size: 14px;
  line-height: 1.45;
}

.verify-code-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.verify-code-digit {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #dbe3de;
  border-radius: 14px;
  background: #f7faf8;
  color: #111114;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.verify-code-digit:focus {
  outline: none;
  border-color: #ff6b4a;
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.22);
}

.verify-email-card .auth-submit {
  background: #111114;
}

.verify-email-card .auth-logout {
  border-color: #d5dbe3;
  color: #111114;
  background: #fff;
}

@media (min-width: 600px) {
  .guest-sign-in-pill {
    top: 14px;
  }
  .join-sheet {
    place-items: center;
  }
  .join-sheet-panel {
    border-radius: 28px;
  }
}
