.auth-page {
  min-height: 100vh;
  background: var(--bg);
}

.auth-shell {
  width: min(1120px, calc(100% - 48px));
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(410px, .95fr);
  margin: 24px auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-intro {
  position: relative;
  min-height: 660px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  overflow: hidden;
  color: #fff;
  background: var(--mint-deep);
}

.auth-intro::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  background: rgb(31 54 50 / .68);
}

.auth-intro > * {
  position: relative;
  z-index: 2;
}

.auth-intro > img {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.55);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.auth-brand span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  background: var(--pink);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

.auth-intro-copy {
  max-width: 390px;
  margin: auto 0 33px;
}

.auth-kicker {
  margin: 0;
  color: var(--mint-deep);
  font-family: var(--mono);
  font-size: 9px;
}

.auth-intro .auth-kicker {
  color: #f8c9d7;
}

.auth-intro h1 {
  margin: 11px 0 12px;
  font-size: clamp(31px, 4vw, 47px);
  line-height: 1.27;
}

.auth-intro-copy > p:last-child {
  max-width: 320px;
  margin: 0;
  color: rgb(255 255 255 / .82);
  font-size: 13px;
  line-height: 1.85;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 52px clamp(32px, 6vw, 68px);
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  /* 登录只有两个字段、注册有六个，用 auto 会把整块推到下半屏；
     改成固定间距，让「返回网站 + 表单」作为一个整体垂直居中 */
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.auth-back:hover {
  color: var(--pink);
}

.auth-back svg {
  width: 14px;
}

.auth-tabs {
  display: flex;
  gap: 18px;
  margin: 0 0 30px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  padding: 0 2px 9px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 700;
}

.auth-tab:hover,
.auth-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--pink);
}

.auth-heading h2 {
  margin: 5px 0 7px;
  color: var(--ink);
  font-size: 27px;
  line-height: 1.35;
}

.auth-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 25px;
}

.auth-form label:not(.terms-line) {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
}

.auth-form input:not([type="checkbox"]) {
  width: 100%;
  padding: 10px 0 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  font-size: 13px;
}

.auth-form input:not([type="checkbox"]):focus {
  border-color: var(--pink);
}

.auth-form input::placeholder {
  color: var(--muted);
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.auth-code-send {
  min-width: 88px;
  min-height: 32px;
  padding: 0 12px;
  color: var(--mint-deep);
  background: transparent;
  border: 1px solid var(--mint-deep);
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.auth-code-send:hover:not(:disabled) {
  color: #fff;
  background: var(--mint-deep);
}

.auth-code-send:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.turnstile-area {
  display: grid;
  gap: 7px;
  min-height: 76px;
  padding-top: 2px;
}

#turnstile-widget {
  min-height: 65px;
}

.turnstile-message {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.turnstile-message.is-ready {
  color: var(--mint-deep);
}

.turnstile-message.is-error,
.auth-status.is-error {
  color: #b64e70;
}

.terms-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  line-height: 1.55;
}

.terms-line input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--pink);
}

.auth-submit {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 2px;
  color: #fff;
  background: var(--pink);
  border: 1px solid var(--pink);
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.auth-submit:hover:not(:disabled) {
  background: var(--mint-deep);
  border-color: var(--mint-deep);
}

.auth-submit:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.auth-submit svg {
  width: 15px;
}

.auth-status {
  min-height: 17px;
  margin: -5px 0 0;
  color: var(--mint-deep);
  font-size: 10px;
  line-height: 1.5;
}

/* hidden 属性必须显式生效：上面的 display:grid 会覆盖浏览器默认的 [hidden]{display:none} */
.auth-form [hidden],
.auth-session[hidden],
#auth-methods[hidden],
#turnstile-area[hidden] {
  display: none !important;
}

/* ---------- 登录方式切换 ---------- */

.auth-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-method {
  padding: 8px 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.auth-method:hover {
  color: var(--ink);
}

.auth-method.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(83 78 110 / .12);
}

/* ---------- 已登录面板 ---------- */

.auth-session {
  display: grid;
  gap: 18px;
  margin-top: 25px;
}

.auth-session-list {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-session-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  background: var(--surface);
}

.auth-session-list dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.auth-session-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.auth-session-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-session-actions .auth-submit {
  flex: 1;
  margin-top: 0;
  text-decoration: none;
}

.auth-logout {
  min-height: 40px;
  padding: 0 15px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-logout:hover:not(:disabled) {
  color: var(--pink);
  border-color: var(--pink);
}

.auth-logout:disabled {
  cursor: not-allowed;
  opacity: .55;
}

@media (max-width: 800px) {
  .auth-shell {
    width: min(100% - 32px, 560px);
    display: block;
    min-height: 0;
    margin: 16px auto;
  }

  .auth-intro {
    min-height: 235px;
    padding: 23px;
  }

  .auth-intro-copy {
    margin: auto 0 0;
  }

  .auth-intro h1 {
    margin: 8px 0 5px;
    font-size: 28px;
  }

  .auth-intro-copy > p:last-child {
    max-width: 360px;
    font-size: 11px;
  }

  .auth-panel {
    min-height: 0;
    padding: 30px 24px 35px;
  }

  .auth-tabs {
    margin: 0 0 24px;
  }

  .auth-code-row {
    gap: 10px;
  }

  .auth-session-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
