/* auth.css — 登录 / 注册（.au-*）：暖纸底、毛笔写出「达达」、分段切换、名片预览、色块、错误抖动、加载转圈、成功飞字 */

.au-root {
  position: absolute;
  inset: 0;
  z-index: 95;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
  color: var(--ink);
}
/* 角落里一枚很淡的楷书「达」，给纸面一点气氛 */
.au-wm {
  position: absolute;
  right: -46px;
  bottom: -70px;
  z-index: 0;
  font-family: var(--font-char);
  font-size: 340px;
  line-height: 1;
  color: var(--line-2);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.au-scroll {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.au-scroll::-webkit-scrollbar { display: none; }
.au-inner {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 40px 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ---------- 品牌：楷书大字 + 印章 + 一句话 + 三段彩线 ---------- */
.au-head { display: flex; flex-direction: column; align-items: center; }
.au-brand {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 0;
  font-weight: 400;
}
.au-word {
  display: block;
  font-family: var(--font-char);
  font-size: 84px;
  line-height: 1;
  letter-spacing: 4px;
  color: var(--ink);
  -webkit-mask-image: linear-gradient(90deg, #000 44%, transparent 56%);
  mask-image: linear-gradient(90deg, #000 44%, transparent 56%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
}
.au-seal {
  margin-bottom: 9px;
  padding: 3px 4px;
  border-radius: 4px;
  background: var(--c-deep);
  color: var(--c-on-deep);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  transform: rotate(-6deg);
}
.au-tag {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .5px;
  color: var(--muted);
  text-align: center;
}
.au-stripe { display: flex; gap: 4px; margin-top: 14px; }
.au-stripe > i { display: block; width: 18px; height: 3px; border-radius: 2px; background: var(--c-deep); }

/* 「已退出登录」「登录已过期」 */
.au-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: center;
  margin-top: 18px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}
.au-notice .ui-ico { color: var(--muted); }

/* ---------- 分段控件（role=tablist） ---------- */
.au-seg { margin-top: 26px; }
.au-seg .ui-seg-btn { min-height: 40px; font-size: 15px; }
.au-seg .ui-seg-btn[aria-selected="true"] { color: var(--ink); font-weight: 600; }

/* ---------- 表单舞台：切换时高度平滑变化 ---------- */
.au-stage { position: relative; margin-top: 20px; }
.au-stage.is-morphing { overflow: hidden; }
.au-form { display: flex; flex-direction: column; gap: 14px; }
.au-form.is-leaving { position: absolute; top: 0; left: 0; right: 0; pointer-events: none; }
.au-fs { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.au-fs:disabled { opacity: .45; }

/* ---------- 字段 ---------- */
.au-field { display: flex; flex-direction: column; min-width: 0; }
.au-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px 6px; }
.au-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.au-count, .au-color-name { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; transition: color var(--dur-2); }
.au-count.is-over { color: var(--danger); font-weight: 600; }
.au-control { position: relative; }
.au-input.ui-input {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background-color var(--dur-2);
}
.au-input.ui-input:focus {
  border-color: var(--ink-2);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 9%, transparent);
}
/* 注册表单里，聚焦描边跟随所选颜色 */
#au-register .au-input.ui-input:focus {
  border-color: var(--c-deep);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-deep) 20%, transparent);
}
.au-field.is-error .au-input.ui-input,
#au-register .au-field.is-error .au-input.ui-input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent);
}
.au-input.ui-input:read-only { cursor: progress; }
.au-control.has-eye .au-input { padding-right: 52px; }
.au-eye {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--muted);
  transition: color var(--dur-2), background-color var(--dur-2), transform var(--dur-1) var(--ease-out);
}
@media (hover: hover) { .au-eye:hover { color: var(--ink); } }
.au-eye:active { transform: scale(.9); }
.au-eye[aria-pressed="true"] { color: var(--ink); }

/* 提示 / 错误：grid 0fr→1fr 折叠，出现时不跳 */
.au-msg-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--dur-3) var(--ease-out), opacity var(--dur-2) var(--ease-out);
}
.au-msg-wrap.is-shown { grid-template-rows: 1fr; opacity: 1; }
.au-msg-wrap > * { min-height: 0; overflow: hidden; }
.au-msg {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 6px 2px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  transition: color var(--dur-2);
}
.au-msg .ui-ico { margin-top: 1.5px; }
.au-field.is-error .au-msg { color: var(--danger); }
.au-field.is-ok .au-msg { color: var(--c-deep); }

/* 密码强度小条 */
.au-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  align-items: center;
  gap: 4px;
  height: 0;
  margin: 0 2px;
  opacity: 0;
  overflow: hidden;
  transition: height var(--dur-3) var(--ease-out), margin var(--dur-3) var(--ease-out), opacity var(--dur-2);
}
.au-meter.is-on { height: 14px; margin-top: 8px; opacity: 1; }
.au-meter > i {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  transform-origin: left center;
  transition: background-color var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-spring);
}
.au-meter > i.is-on { background: var(--c-deep); }
.au-meter-l { min-width: 2.6em; padding-left: 4px; font-size: 12px; font-weight: 600; line-height: 1; color: var(--c-deep); text-align: right; }
.au-meter.t-ink .au-meter-l { color: var(--muted); font-weight: 500; }

/* ---------- 名片预览：浅色做底、深色写字 ---------- */
.au-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 22px;
  margin: 2px 0;
}
.au-card-skin {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 14px 18px 14px 14px;
  background: var(--c-soft);
  color: var(--c-ink);
  transition: background-color var(--dur-3) var(--ease-out), color var(--dur-3) var(--ease-out);
}
.au-card-wipe { position: absolute; inset: 0; z-index: 2; pointer-events: none; transition: none; }
.au-card-char {
  flex: none;
  width: 78px;
  font-family: var(--font-char);
  font-size: 72px;
  line-height: 1;
  text-align: center;
  color: var(--c-wm);
  -webkit-user-select: none;
  user-select: none;
}
.au-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.au-card-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  transition: opacity var(--dur-2);
}
.au-card-handle {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  opacity: .72;
  transition: opacity var(--dur-2);
}
.au-card-name.is-empty, .au-card-handle.is-empty { opacity: .42; }
.au-card-cap { position: absolute; top: 10px; right: 14px; font-size: 11px; letter-spacing: .5px; opacity: .58; }

/* 昵称 + 头像字一行：两个字段 display:contents，提示/错误各占整行 */
.au-pair { display: grid; grid-template-columns: minmax(0, 1fr) 76px; column-gap: 12px; }
.au-pair > .au-field { display: contents; }
.au-pair > [data-f="name"] > .au-label-row { grid-area: 1 / 1; }
.au-pair > [data-f="char"] > .au-label-row { grid-area: 1 / 2; }
.au-pair > [data-f="name"] > .au-control { grid-area: 2 / 1; }
.au-pair > [data-f="char"] > .au-control { grid-area: 2 / 2; }
.au-pair > [data-f="name"] > .au-msg-wrap { grid-area: 3 / 1 / 4 / 3; }
.au-pair > [data-f="char"] > .au-msg-wrap { grid-area: 4 / 1 / 5 / 3; }
/* 头像字：一个字的小方框，楷书 */
.au-field-char .au-input.ui-input::placeholder { font-family: var(--font-char); color: var(--placeholder); }
.au-field-char .au-input.ui-input {
  width: 100%;
  padding: 6px 0 4px;
  font-family: var(--font-char);
  font-size: 28px;
  line-height: 1;
  text-align: center;
  color: var(--c-deep);
}

/* ---------- 颜色：8 个圆色块 ---------- */
.au-swatches { display: flex; justify-content: space-between; gap: 4px; padding: 6px 4px 4px; }
.au-sw {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-soft);
  box-shadow: inset 0 0 0 1px rgba(31, 29, 26, .08);
  transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}
.au-sw::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; }
@media (hover: hover) { .au-sw:hover { transform: scale(1.08); } }
.au-sw:focus-visible { outline-offset: 5px; }
.au-sw-dot {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-wm);      /* 墨色的深色和底色太接近：水印色（浅色模式为白）更醒目 */
  color: var(--c-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width var(--dur-3) var(--ease-spring), height var(--dur-3) var(--ease-spring);
}
.au-sw-dot svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 300ms 80ms var(--ease-out);
}
.au-sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c-deep); }
.au-sw[aria-checked="true"] .au-sw-dot { width: 22px; height: 22px; }
.au-sw[aria-checked="true"] .au-sw-dot svg { stroke-dashoffset: 0; }

/* ---------- 名额已满 ---------- */
.au-full {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 50%, transparent);
  border-radius: 18px;
}
.au-full-ch { flex: none; font-family: var(--font-char); font-size: 44px; line-height: 1; color: var(--ink-2); }
.au-full-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.au-full-t { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.au-full-d { font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* ---------- 表单级错误 + 提交按钮（加载转圈） ---------- */
.au-formerr-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: -14px;   /* 收起时不占 flex gap */
  transition: grid-template-rows var(--dur-3) var(--ease-out), opacity var(--dur-2), margin var(--dur-3) var(--ease-out);
}
.au-formerr-wrap.is-shown { grid-template-rows: 1fr; opacity: 1; margin-bottom: 0; }
.au-formerr-wrap > * { min-height: 0; overflow: hidden; }
.au-formerr {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--danger);
}
.au-formerr .ui-ico { margin-top: 2px; }
.au-submit.ui-btn {
  position: relative;
  min-height: 50px;
  margin-top: 4px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}
.au-submit-t { transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.au-spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  opacity: 0;
  transform: scale(.5);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-3) var(--ease-spring);
  pointer-events: none;
}
.au-spin > i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2.25px solid currentColor;
  border-right-color: transparent;
  border-bottom-color: color-mix(in srgb, currentColor 35%, transparent);
  animation: au-spin 700ms linear infinite;
}
.au-form.is-busy .au-submit { cursor: progress; }
.au-form.is-busy .au-submit-t { opacity: 0; transform: translateY(-6px); }
.au-form.is-busy .au-spin { opacity: 1; transform: scale(1); }
.au-submit.ui-btn:disabled { cursor: not-allowed; }
.ui-btn-deep.au-submit:disabled { background: var(--placeholder); color: var(--bg); }
@keyframes au-spin { to { transform: rotate(360deg); } }

.au-foot { margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.au-foot:empty { display: none; }

/* ---------- 成功：头像字飞到中央 ---------- */
.au-fly { position: absolute; left: 50%; top: 50%; z-index: 3; width: 0; height: 0; pointer-events: none; }
.au-fly-disc {
  position: absolute;
  left: -108px;
  top: -108px;
  width: 216px;
  height: 216px;
  border-radius: 50%;
  background: var(--c-soft);
}
.au-fly-ch {
  position: absolute;
  left: -110px;
  top: -110px;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-char);
  font-size: 150px;
  line-height: 1;
  color: var(--c-wm);
}

/* ---------- 入场：启动画面收起后，毛笔写出「达达」，其余依次浮上来 ---------- */
.au-root.is-pre .au-word { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
.au-root.is-pre .au-seal, .au-root.is-pre .au-in, .au-root.is-pre .au-stag { opacity: 0; }
.au-root.is-intro .au-word { animation: au-write 760ms var(--ease-in-out) both; }
.au-root.is-intro .au-seal { animation: au-seal 300ms 600ms var(--ease-spring) both; }
.au-root.is-intro .au-in,
.au-root.is-intro-form .au-form:not([hidden]) .au-stag {
  animation: au-rise 520ms var(--ease-out) both;
  animation-delay: calc(380ms + var(--d, 0) * 45ms);
}
/* 从启动画面接过来的入场（auth.js handoff）：「达达」和印章由 JS 从启动画面的位置飞过来，不再写一遍；其余照常依次浮上来 */
.au-root.is-intro-flip .au-in {
  animation: au-rise 520ms var(--ease-out) both;
  animation-delay: calc(460ms + var(--d, 0) * 45ms);   /* 等「达达」快飞到位再出来，不和它交叠 */
}
@keyframes au-write {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
@keyframes au-seal {
  from { opacity: 0; transform: rotate(-6deg) scale(1.7); }
  to { opacity: 1; transform: rotate(-6deg) scale(1); }
}
@keyframes au-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 小屏 / 矮屏 ---------- */
@media (max-width: 359.98px) {
  .au-inner { padding-left: 18px; padding-right: 18px; }
  .au-sw { width: 30px; height: 30px; }
  .au-sw[aria-checked="true"] .au-sw-dot { width: 20px; height: 20px; }
  .au-card-char { width: 64px; font-size: 60px; }
}
@media (max-height: 700px) {
  .au-inner { padding-top: 28px; }
  .au-word { font-size: 68px; }
  .au-seg { margin-top: 20px; }
}
