/* ============================================================
   Chengfa · 账户入口（登录 / 注册）
   与首页共用 style.css 的设计变量，此处只处理本页布局
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-back {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
  transition: color .14s ease, border-color .14s ease;
}

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

/* ---------- 主体：左右分栏 ---------- */

.auth {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* 一道贯穿的红色斜线，与首页呼应 */
.auth::before {
  content: "";
  position: absolute;
  left: -12%;
  top: 62%;
  width: 132%;
  height: 4px;
  background: var(--red);
  opacity: .14;
  transform: rotate(-11deg);
  pointer-events: none;
}

.auth__in {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .72fr);
  gap: clamp(32px, 4.6vw, 68px);
  align-items: center;
  padding: clamp(44px, 5.5vw, 78px) 0;
}

.auth__panel {
  width: 100%;
  max-width: 520px;
}

/* ---------- 标题区 ---------- */

.auth__t {
  margin: 24px 0 12px;
  font-size: clamp(38px, 4.8vw, 58px);
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: 1;
}

.auth__d {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.8;
  color: #4A453C;
}

/* ---------- 模式切换 ---------- */

.auth__tabs {
  display: flex;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 30px;
}

.auth__tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 0 13px;
  margin-right: 34px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--gray);
  position: relative;
  transition: color .14s ease;
}

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

.auth__tab.is-on { color: var(--ink); }

.auth__tab.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 7px;
  background: var(--red);
}

/* ---------- 表单 ---------- */

.field {
  margin-bottom: 22px;
}

.field[hidden] { display: none; }

.field__l {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.field__i {
  display: block;
  width: 100%;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  padding: 14px 15px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.field__i::placeholder { color: #A79F90; }

.field__i:focus {
  border-color: var(--red);
  box-shadow: 5px 5px 0 var(--red);
}

.field__i[aria-invalid="true"] {
  border-color: var(--red);
  background: #FAE7E4;
}

.field__h {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #6E685C;
}

.field__e {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--red-deep);
}

/* 勾选框：方形，选中后填红并显示 × */
.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
  margin-bottom: 24px;
}

.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check__box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid var(--ink);
  background: var(--paper);
  position: relative;
}

.check input:checked + .check__box { background: var(--red); }

.check input:checked + .check__box::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--black);
  font-size: 17px;
  line-height: 1;
  color: var(--paper);
}

.check input:focus-visible + .check__box { box-shadow: 4px 4px 0 var(--ink); }

.check__t {
  font-size: 12.5px;
  line-height: 1.7;
  color: #4A453C;
}

/* ---------- 提交 ---------- */

.auth__submit {
  width: 100%;
  justify-content: center;
  background: var(--red);
  box-shadow: 6px 6px 0 var(--ink);
  margin-top: 2px;
}

.auth__submit:hover { box-shadow: 9px 9px 0 var(--ink); }
.auth__submit:active { box-shadow: 1px 1px 0 var(--ink); }

.auth__note {
  margin: 22px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--ink);
  background: var(--paper-2);
  font-size: 12px;
  line-height: 1.75;
  color: #4A453C;
}

/* ---------- 右侧图形：三角形楔子 ---------- */

.auth__art {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

/* 三条边全部倾斜，尖端刺向右侧 */
.ac-tri {
  position: relative;
  width: clamp(248px, 20.5vw, 318px);
  aspect-ratio: 1;
  background: var(--red);
  clip-path: polygon(7% 0, 0 97%, 96% 53%);
  filter: drop-shadow(14px 14px 0 var(--ink));
  display: flex;
  align-items: center;
  padding-left: 15%;
}

/* 内容锁在左侧宽处，不接近尖端 */
.ac-tri__inner {
  width: 46%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--paper);
}

.ac-tri__num {
  font-family: var(--black);
  font-weight: 800;
  font-size: clamp(58px, 5.6vw, 74px);
  line-height: .84;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.ac-tri__num .u {
  font-size: .34em;
  letter-spacing: 0;
  margin-left: 2px;
}

.ac-tri__label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.5;
}

/* ---------- 页脚 ---------- */

.auth-foot {
  border-top: 3px solid var(--ink);
  padding: 15px 0;
}

.auth-foot__in {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--gray);
}

/* ---------- 断点 ---------- */

@media (max-width: 900px) {
  .auth__in {
    grid-template-columns: 1fr;
    gap: 46px;
    padding: 38px 0 44px;
  }

  .auth__panel { max-width: none; }

  .auth__art {
    min-height: 232px;
    align-self: auto;
  }

  .ac-tri { width: min(272px, 80%); }
  .ac-tri__num { font-size: 48px; }
  .ac-tri__label { font-size: 11px; margin-top: 8px; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 32px); }

  .auth::before { display: none; }

  .auth__in { gap: 38px; padding: 30px 0 38px; }

  .auth__t { font-size: 36px; margin-top: 18px; }
  .auth__d { font-size: 13px; margin-bottom: 24px; }

  .auth__tab { font-size: 14px; margin-right: 26px; }

  .field { margin-bottom: 18px; }
  .field__i { font-size: 16px; padding: 13px 14px; }

  .auth__submit { font-size: 15px; padding: 15px 20px; }

  .auth__art { min-height: 200px; }
  .ac-tri { width: 228px; }
  .ac-tri__num { font-size: 44px; }

  .auth-foot__in { flex-direction: column; gap: 6px; }
}

.auth__note.is-error {
  border-left-color: var(--red);
  color: var(--red-deep);
}

/* 登录态预检：已登录会直接跳账户页，先藏表单避免闪一下登录框。
   1.6s 后无论 JS 是否到位都自动显形，不会把页面卡成空白。 */
.auth-checking .auth__panel {
  visibility: hidden;
  animation: authPanelReveal 0s linear 1.6s forwards;
}

@keyframes authPanelReveal {
  to { visibility: visible; }
}

/* ---------- 人机验证（自绘按钮，官方控件不渲染） ---------- */

.auth__verify {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 2px 0 18px;
  padding: 12px 13px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.auth__verify:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.auth__verify[data-state="idle"]:hover { background: var(--paper-2); }

.auth__verify__mark {
  width: 12px;
  height: 12px;
  flex: none;
  background: var(--red);
  transition: background .14s ease;
}

.auth__verify__text {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--ink);
  transition: color .14s ease;
}

.auth__verify__tag {
  flex: none;
  font-family: var(--num);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--gray);
  transition: color .14s ease, background .14s ease;
}

/* 隐形控件完全让位，不参与布局 */
.auth__verify .cf-turnstile {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* 校验中 */
.auth__verify[data-state="checking"] { cursor: progress; }
.auth__verify[data-state="checking"] .auth__verify__text { color: var(--gray); }
.auth__verify[data-state="checking"] .auth__verify__mark {
  animation: cfMarkPulse 1.1s steps(2, end) infinite;
}

@keyframes cfMarkPulse {
  50% { opacity: .15; }
}

/* 通过：整块翻黑，和站内选中态一致 */
.auth__verify[data-state="ok"] {
  background: var(--ink);
  border-color: var(--ink);
  cursor: default;
}

.auth__verify[data-state="ok"] .auth__verify__text { color: var(--paper); }

.auth__verify[data-state="ok"] .auth__verify__tag {
  color: var(--paper);
  background: var(--red);
  padding: 2px 6px;
}

.auth__verify[data-state="ok"] .auth__verify__mark { background: var(--paper); }

/* 失败 / 超时：红框 + 硬阴影，点一下重来 */
.auth__verify[data-state="error"],
.auth__verify[data-state="expired"] {
  border-color: var(--red);
  box-shadow: 4px 4px 0 var(--red);
}

.auth__verify[data-state="error"] .auth__verify__text,
.auth__verify[data-state="expired"] .auth__verify__text { color: var(--red); }

.auth__verify[data-state="error"] .auth__verify__tag,
.auth__verify[data-state="expired"] .auth__verify__tag { color: var(--red); }

/* 需要人工确认：把官方控件在条内展开，绝不能藏着不让人点 */
.auth__verify[data-state="action"] {
  cursor: default;
  flex-wrap: wrap;
}

.auth__verify[data-state="action"] .auth__verify__text { color: var(--ink); }
.auth__verify[data-state="action"] .auth__verify__tag { color: var(--red); }

.auth__verify[data-state="action"] .cf-turnstile {
  position: static;
  flex: 1 0 100%;
  width: auto;
  height: auto;
  overflow: visible;
  margin-top: 10px;
}

/* 同意条款里的文档链接：点链接不该顺带勾选复选框 */
.check__a {
  color: var(--ink);
  border-bottom: 1px solid var(--red);
}

.check__a:hover { color: var(--red); }

/* 验证码行：输入框占满，发送按钮贴右 */
.auth__code {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth__code .field__i {
  /* field__i 本身是 width:100%，在 flex 行里会把自己撑满再叠上按钮的宽度，
     窄屏直接顶出屏幕。这里换成按剩余空间分，才能跟按钮并排不溢出。 */
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.auth__code .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* 再窄就把按钮换到下一行，别硬挤输入框 */
@media (max-width: 380px) {
  .auth__code { flex-wrap: wrap; }
  .auth__code .btn { flex: 1 1 100%; }
}

/* 行内小字链接：忘记密码、返回登录 */
.auth__link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

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

.auth__alt {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* 两个验证条各自独立，宽度撑满表单 */
#resetForm .auth__verify { margin-top: 4px; }
