/* 登录与注册的独立页面。
   排版取自 831 动画助手，但按实际观感放宽了一档：输入框 40px 高、
   字段间距 28px、圆角 3px、按钮与输入框等高、基础字号 14px。
   配色仍用工作台那套，深色为默认。 */

:root {
  --font-base: 14px;
  --auth-bg-a: #eef4fb;
  --auth-bg-b: #f7fbff;
  --auth-card: #ffffff;
  --auth-input: #ffffff;
  --auth-text: #1f2530;
  --auth-muted: #9aa3ae;
  --auth-line: #dcdfe6;
  --auth-brand: #18a058;
  --auth-brand-dark: #0f7a42;
  --auth-danger: #d03050;
  color-scheme: light;
}

/* 深色是默认：工作台默认深色，登录页跟着走，中间不该闪一下白。 */
:root[data-theme="dark"] {
  --auth-bg-a: #141414;
  --auth-bg-b: #141414;
  --auth-card: #1a1a1a;
  --auth-input: #1f1f1f;
  --auth-text: #f2f2f2;
  --auth-muted: #b3b3b3;
  --auth-line: #474747;
  --auth-brand: #3fb884;
  --auth-brand-dark: #34a273;
  --auth-danger: #e07a6a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 两页共用一个起始 Y：登录内容 588px、注册 792px，各自居中的话品牌会上下
     跳 102px。这里统一按注册那一屏（--auth-block）算上边距，两页顶端因此完全
     对齐——登录相当于往上抬了 102px，注册原地不动。
     clamp 兜住两头：矮屏不至于把卡片顶出去，高屏也不会掉到屏幕中间偏下。 */
  --auth-block: 792px;
  justify-content: flex-start;
  gap: 30px;
  padding: clamp(24px, calc((100vh - var(--auth-block)) / 2), 220px) 16px 40px;
  background: linear-gradient(160deg, var(--auth-bg-a), var(--auth-bg-b));
  color: var(--auth-text);
  font-size: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  /* 界面文字不参与选中，避免拖动时整片变蓝。输入框要留着，
     否则用户没法选中自己打的内容去改。 */
  user-select: none;
  -webkit-user-select: none;
  /* 点空白处时浏览器照样会放一个折叠光标，而这里没有可落脚的文本，
     它就会在旁边元素的边缘渲染成一条游离的竖线。把它染透明。 */
  caret-color: transparent;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
  caret-color: auto;
}

/* ---------- 品牌 ---------- */

.auth-brand { text-align: center; }

.auth-brand h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 700;
  color: var(--auth-brand);
  letter-spacing: 1px;
}

.auth-brand p { margin: 8px 0 0; font-size: 16px; color: var(--auth-muted); }

/* ---------- 卡片 ---------- */

.auth-card {
  width: min(430px, 100%);
  background: var(--auth-card);
  border-radius: 3px;
  padding: 34px 32px 30px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .14);
}

/* 找回密码那页需要一句说明，紧跟标题。 */
.auth-hint {
  margin: -18px 0 24px;
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--auth-muted);
  text-align: center;
}

.auth-card h2 {
  margin: 0 0 30px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

/* ---------- 字段 ---------- */

/* 下外边距是留给错误提示的，提示用绝对定位落进这块空档里——
   这样它出现或消失都不会把下面的字段和按钮推来推去。 */
.auth-field { position: relative; margin-bottom: 28px; }

.auth-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--auth-line);
  border-radius: 3px;
  font-size: 14px;
  font-family: inherit;
  color: var(--auth-text);
  background-color: var(--auth-input);
  background-repeat: no-repeat;
  background-position: 11px center;
  background-size: 15px 15px;
}

/* 占位只是提示该填什么，压淡一档，别和用户真正输入的内容抢注意力。 */
.auth-field input::placeholder { color: var(--auth-muted); opacity: .55; }

.auth-field input:focus {
  outline: none;
  border-color: var(--auth-brand);
}

.auth-field input.invalid { border-color: var(--auth-danger); }

/* 前置图标画成 data URI，省一次请求。描边用中性灰，深浅主题下都够看。 */
#email {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e8b85' stroke-width='2'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m2 7 10 6 10-6'/%3E%3C/svg%3E");
}

#password, #password2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e8b85' stroke-width='2'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
}

#captcha {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e8b85' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M6 10h4M6 14h8'/%3E%3C/svg%3E");
}

#invite {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e8b85' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E");
}

.auth-error {
  position: absolute;
  top: 100%;
  left: 1px;
  right: 1px;
  margin: 3px 0 0;
  font-size: var(--font-base);
  line-height: 1.4;
  color: var(--auth-danger);
  /* 提示万一很长也不许换行撑开，超出就省略。 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 验证码 ---------- */

.auth-inline { display: flex; gap: 10px; align-items: stretch; }
.auth-inline input { flex: 1; min-width: 0; }

.auth-inline img {
  width: 108px;
  height: 40px;
  border: 1px solid var(--auth-line);
  border-radius: 3px;
  cursor: pointer;
  /* 验证码图本身是浅底的，深色下留白底才看得清。 */
  background: #f7f8fa;
  /* 它是用来点的，不是用来拖的。 */
  -webkit-user-drag: none;
  user-select: none;
}

/* ---------- 密码显示按钮 ---------- */

.auth-password input { padding-right: 40px; }

.auth-eye {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

.auth-eye::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 10px;
  border: 1.5px solid var(--auth-muted);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.auth-eye::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--auth-muted);
}

.auth-eye:hover::before { border-color: var(--auth-brand); }
.auth-eye:hover::after { background: var(--auth-brand); }

/* 已显示明文时给眼睛划一道斜杠，状态一眼可辨。 */
.auth-eye.revealed::after {
  width: 18px;
  height: 1.5px;
  border-radius: 0;
  transform: rotate(-45deg);
}

/* ---------- 协议 ---------- */

.auth-agree-field { margin-bottom: 30px; }

.auth-agree {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--font-base);
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-agree input {
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--auth-brand);
  cursor: pointer;
}

.auth-agree span { flex: 1; }
/* 悬浮不加下划线，靠颜色变化提示可点即可。 */
.auth-agree a { color: var(--auth-brand); text-decoration: none; }
.auth-agree a:hover { color: var(--auth-brand-dark); }

/* ---------- 提交与页脚 ---------- */

.auth-submit {
  /* 和上面的协议行拉开距离，避免误点。 */
  margin-top: 6px;
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 3px;
  background: var(--auth-brand);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.auth-submit:hover:not(:disabled) { background: var(--auth-brand-dark); }
.auth-submit:disabled { opacity: .6; cursor: not-allowed; }

.auth-status {
  margin: 12px 0 0;
  min-height: 18px;
  font-size: var(--font-base);
  color: var(--auth-danger);
  text-align: center;
}

/* 只有一条链接时居中；有两条时分列两端。 */
.auth-links {
  margin-top: 4px;
  font-size: var(--font-base);
  color: var(--auth-muted);
  text-align: center;
}

.auth-links-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.auth-links a { color: var(--auth-brand); text-decoration: none; }
.auth-links a:hover { color: var(--auth-brand-dark); }
.auth-links > span:empty { display: none; }

/* ---------- 条款页 ---------- */

.legal {
  width: min(760px, 100%);
  background: var(--auth-card);
  border-radius: 3px;
  padding: 34px 38px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .14);
  line-height: 1.85;
  font-size: 14px;
}

.legal h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.legal .legal-updated { margin: 0 0 22px; color: var(--auth-muted); font-size: var(--font-base); }
.legal h3 { margin: 24px 0 8px; font-size: 15px; font-weight: 600; }
.legal p, .legal li { color: var(--auth-text); opacity: .88; }
.legal ul { padding-left: 20px; }
.legal a { color: var(--auth-brand); }

@media (max-width: 480px) {
  .auth-card, .legal { padding: 24px 20px; }
  .auth-brand h1 { font-size: 28px; }
}

/* 登录注册页的 logo：白底圆角方块 + 怪兽 TV 线稿 */
.auth-logo { display: block; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px; background: #ffffff url("/static/logo.png?v=1") center / 80% no-repeat; }

/* ---- 语言切换器：国旗 + 语言名，下拉列出五种 ---- */
.lang-switch { position: relative; flex: none; }
.lang-switch .lang-current { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 8px; border: 1px solid var(--card-border, #262626); border-radius: 8px; background: var(--card-bg, #161616); color: var(--text, #f2f2f2); font: inherit; cursor: pointer; }
.lang-switch .lang-current:hover { background: var(--card-active, #222222); border-color: var(--card-active, #222222); }
.lang-switch .lang-flag { display: inline-flex; width: 22px; height: 15px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.lang-switch .lang-flag svg { width: 100%; height: 100%; display: block; }
.lang-switch .lang-caret { color: var(--muted, #b3b3b3); font-size: 11px; }
.lang-switch .lang-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 160px; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--card-border, #262626); border-radius: 10px; background: var(--card-bg, #161616); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.lang-switch .lang-menu li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.lang-switch .lang-menu li:hover, .lang-switch .lang-menu li.active { background: var(--card-active, #222222); }
.lang-switch .lang-menu li.active { color: var(--green, #69d3a4); }
.lang-switch-floating { position: fixed; top: 16px; right: 16px; z-index: 60; }

/* 语言下拉靠这个类收起；之前这份样式表没有它，列表一直摊开着 */
.hidden { display: none !important; }

/* ---- 注册：获取验证码按钮 + 图形验证码弹窗 ---- */

#emailCode {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e8b85' stroke-width='2'%3E%3Cpath d='M4 8h16v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z'/%3E%3Cpath d='m4 8 8 6 8-6'/%3E%3Cpath d='M9 4h6'/%3E%3C/svg%3E");
}

.auth-code-button {
  flex: none;
  min-width: 106px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--auth-brand);
  border-radius: 3px;
  background: transparent;
  color: var(--auth-brand);
  font-size: var(--font-base);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.auth-code-button:hover:not(:disabled) {
  background: var(--auth-brand);
  color: #fff;
}

/* 冷却期间不再是可点的绿色，避免用户反复戳。 */
.auth-code-button:disabled {
  border-color: var(--auth-line);
  color: var(--auth-muted);
  background: transparent;
  cursor: not-allowed;
}

.auth-dialog {
  width: min(340px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  background: var(--auth-card);
  color: var(--auth-text);
  font-family: inherit;
}

.auth-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.auth-dialog h3 { margin: 0 0 6px; font-size: 16px; }

.auth-dialog-hint {
  margin: 0 0 16px;
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--auth-muted);
}

/* 弹窗里这一格是最后一格，不需要再拉开和下面按钮的距离。 */
.auth-dialog .auth-field { margin-bottom: 0; }

.auth-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.auth-dialog-actions button {
  height: 36px;
  padding: 0 16px;
  border-radius: 3px;
  font-size: var(--font-base);
  font-family: inherit;
  cursor: pointer;
}

.auth-dialog-ghost {
  border: 1px solid var(--auth-line);
  background: transparent;
  color: var(--auth-text);
}

.auth-dialog-primary {
  border: 0;
  background: var(--auth-brand);
  color: #fff;
}

.auth-dialog-primary:hover:not(:disabled) { background: var(--auth-brand-dark); }
.auth-dialog-primary:disabled { opacity: .6; cursor: not-allowed; }
