/* The gate scrolls as one page; content is never squeezed to fit the screen. */
#account-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(min-content, 1fr) auto;
  align-items: stretch;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.auth-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: clamp(40px, 6vw, 88px);
  background: #132c2c;
  color: #e5efdf;
  overflow-wrap: anywhere;
}
.auth-intro > * { flex-shrink: 0; }
.auth-brand {
  font-size: 30px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -1px;
}
.auth-brand small {
  display: block;
  margin-top: 9px;
  color: #9bbfa6;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 2.8px;
}
.auth-intro h1 {
  margin: 56px 0 22px;
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -1.5px;
  white-space: pre-line;
}
.auth-intro p {
  max-width: 34em;
  margin: 0;
  color: #b2c9bc;
  font-size: 14px;
  line-height: 1.95;
  white-space: pre-line;
}
.auth-features {
  display: inline-flex;
  max-width: 100%;
  margin-top: 42px;
  padding: 7px 12px;
  border: 1px solid #aecbb333;
  border-radius: 999px;
  background: #ffffff06;
  color: #b4d0bc;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: .3px;
}

.auth-card {
  align-self: center;
  justify-self: center;
  min-width: 0;
  width: 100%;
  max-width: 490px;
  padding: 48px 44px;
  overflow-wrap: anywhere;
}
.auth-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px;
  margin-bottom: 30px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
}
.auth-tabs button {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.auth-tabs button.selected {
  border-color: var(--line);
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 1px 4px #132c2c0a;
}
.auth-card h2 {
  margin: 0 0 26px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.5px;
}
#auth-form {
  display: grid;
  gap: 18px;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.auth-card input {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
.auth-card input::placeholder { color: var(--muted); font-size: 13px; }
.auth-card input:focus { border-color: var(--accent); }
.auth-card .primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.auth-caption {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
  white-space: pre-line;
}
#auth-error {
  margin: 0;
  color: #b95440;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#auth-error:empty { display: none; }
#account-gate > .site-registration { grid-column: 1 / -1; }

@media (max-width: 860px) {
  #account-gate {
    display: flex;
    flex-direction: column;
  }
  #account-gate > * { flex-shrink: 0; }
  .auth-intro {
    justify-content: flex-start;
    padding: 26px 24px 28px;
    border-radius: 0 0 22px 22px;
  }
  .auth-brand { font-size: 24px; }
  .auth-brand small { margin-top: 7px; font-size: 8px; letter-spacing: 2.5px; }
  .auth-intro h1 {
    margin: 24px 0 14px;
    font-size: clamp(28px, 7.5vw, 34px);
    letter-spacing: -.6px;
  }
  .auth-intro p { font-size: 13px; line-height: 1.85; }
  .auth-features { margin-top: 20px; padding: 6px 10px; font-size: 10px; }
  .auth-card {
    align-self: center;
    width: calc(100% - 32px);
    max-width: 460px;
    margin: 22px auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 4px 20px #132c2c04;
  }
  .auth-tabs { margin-bottom: 24px; }
  .auth-card h2 { margin-bottom: 22px; font-size: 22px; }
  .auth-card label { font-size: 12px; }
  .auth-caption { margin-top: 20px; }
  #account-gate > .site-registration { width: 100%; margin-top: auto; }
}

@media (max-width: 360px) {
  .auth-intro { padding: 24px 20px; }
  .auth-card { width: calc(100% - 24px); padding: 20px; }
  .auth-tabs button { padding-inline: 5px; font-size: 12px; }
}
