/* ---- logged out: landing map + card ----
   The map fills the screen and plays its story; the card sits on top:
   a bottom sheet on phones, a panel on the left on wide screens. */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--sunken);
  overflow: hidden;
}
/* Returning users skip it while their session is checked (see <head>). */
html[data-session] #login-overlay {
  display: none;
}
/* An invite, reset or link code in the address: no login form until the
   server says which form it is. */
html[data-entry] #login-form {
  display: none;
}
#auth-wait {
  display: none;
}
html[data-entry] #auth-wait {
  display: block;
}
#landing-map {
  position: absolute;
  inset: 0;
  transition: opacity 0.8s var(--ease);
}
#landing-map.fading {
  opacity: 0;
}
#landing-hud {
  position: absolute;
  z-index: 1;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.landing-stats {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.landing-stats b {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
#landing-caption {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: var(--ink);
  color: var(--ink-text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
}
#landing-caption.show {
  animation: caption 2.2s var(--ease) forwards;
}
@keyframes caption {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  12%,
  80% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}
#auth-card {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--glass);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 -12px 40px -18px rgba(0, 0, 0, 0.35);
  border-radius: 26px 26px 0 0;
  padding: 26px max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  animation: sheet-in 0.5s var(--ease);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
/* backwards, not both: once in, the fields keep no transform, so they
   aren't separate layers that could draw over the city list. */
.auth-form > * {
  animation: rise-in 0.5s var(--ease) backwards;
}
.auth-form > :nth-child(2) {
  animation-delay: 60ms;
}
.auth-form > :nth-child(3) {
  animation-delay: 120ms;
}
.auth-form > :nth-child(4) {
  animation-delay: 180ms;
}
/* The sign-up form's field for bots (index.html): off-screen, not display:
   none, which some bots skip. */
.auth-form > .leave-empty {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.auth-form h1 {
  font-size: 2.3rem;
  line-height: 1.05;
}
.auth-form .tagline {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.3;
  margin-top: -4px;
}
.auth-form .lead {
  font-size: 1rem;
  line-height: 1.45;
  color: var(--muted);
}
.beats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0;
}
.beats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--text);
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.beats span {
  font-size: 1.3rem;
}
.promise {
  margin-bottom: 4px;
}
.auth-form button {
  margin-top: 4px;
}
.auth-form button[type="submit"] {
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: var(--ink);
  color: var(--ink-text);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s var(--ease);
}
.auth-form button[type="submit"]:active {
  transform: scale(0.98);
}
/* While sign-up is open: as easy to find as logging in. */
.login-join {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.login-join .btn {
  padding: 13px;
}
.auth-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}
#landing-map .you-pin .tag {
  text-shadow:
    0 0 3px var(--panel),
    0 0 3px var(--panel);
}

@media (min-width: 900px) {
  #auth-card {
    top: 24px;
    bottom: 24px;
    left: 24px;
    right: auto;
    width: 440px;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: 26px;
    display: flex;
    flex-direction: column;
    padding: 36px 34px;
    animation: rise-in 0.6s var(--ease);
  }
  .auth-form {
    margin: auto 0;
  }
  #landing-hud {
    left: 488px;
    right: 24px;
    top: 24px;
    align-items: flex-start;
  }
}
@media (max-width: 899px) and (max-height: 700px) {
  /* Short phones: the beats would push the form off screen. */
  .beats {
    display: none;
  }
}

/* "How it works", under the login form: part of the panel on wide screens;
   on phones folded away until asked for, then the sheet opens full height. */
.how {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.5;
}
.how h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
}
.how h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin-top: 8px;
}
.how figure {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.how img {
  display: block;
  width: 78%;
  height: auto;
  margin: 0 auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.how figcaption b {
  font-weight: 600;
}
.how ul {
  padding-left: 1.2em;
}
@media (max-width: 899px) {
  #auth-card:not(.expanded) .how {
    display: none;
  }
  #auth-card.expanded {
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
  }
}
