/* ZHCOOL MAIL — auth pages (login / register)
   与 zhcool.xyz 同一套视觉语言：玻璃卡片 + 靛紫渐变 + 柔和光晕
   无构建步骤，直接由 nginx 静态托管 */

:root {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-accent: #eef0fb;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-soft: #333a4d;
  --muted: #626b80;
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-ink: #ffffff;
  --brand-soft: rgba(99, 102, 241, 0.1);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.08);
  --success: #067647;
  --success-soft: rgba(6, 118, 71, 0.08);
  --ring: rgba(99, 102, 241, 0.35);
  --shadow: 0 28px 70px -30px rgba(15, 23, 42, 0.3);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.35s;
  --dur-base: 0.6s;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #07070f;
    --bg-accent: #0b0b18;
    --surface: rgba(20, 20, 33, 0.66);
    --surface-solid: #12121f;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #eef0f8;
    --text-soft: #c9cede;
    --muted: #98a1b6;
    --brand-soft: rgba(99, 102, 241, 0.16);
    --danger: #ff6b62;
    --danger-soft: rgba(255, 107, 98, 0.1);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.1);
    --shadow: 0 32px 90px -34px rgba(0, 0, 0, 0.85);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07070f;
  --bg-accent: #0b0b18;
  --surface: rgba(20, 20, 33, 0.66);
  --surface-solid: #12121f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f8;
  --text-soft: #c9cede;
  --muted: #98a1b6;
  --brand-soft: rgba(99, 102, 241, 0.16);
  --danger: #ff6b62;
  --danger-soft: rgba(255, 107, 98, 0.1);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.1);
  --shadow: 0 32px 90px -34px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(99, 102, 241, 0.20), transparent 60%),
    radial-gradient(900px 560px at 96% 8%, rgba(139, 92, 246, 0.16), transparent 62%),
    radial-gradient(800px 620px at 70% 110%, rgba(56, 189, 248, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-accent), var(--bg) 46%);
  color: var(--text);
  font-family: "Geist", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */

.page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
}

.shell {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 56px;
  align-items: center;
}

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

.brand { max-width: 460px; }

.brand__logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 26px -12px rgba(99, 102, 241, 0.55);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.brand__name { text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px; color: var(--muted); }

.brand h1 {
  margin: 40px 0 14px;
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 750;
}

.brand h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--brand-2) 55%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__lede {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 40ch;
}

.brand__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.brand__list li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-soft);
  font-size: 14px;
}

.brand__list svg { flex: none; color: var(--brand); }

.brand__foot {
  margin-top: 36px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

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

.card {
  position: relative;
  width: 100%;
  padding: 34px 34px 30px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(26px) saturate(1.15);
  backdrop-filter: blur(26px) saturate(1.15);
}

.card__head { margin-bottom: 24px; }

.card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.card__sub { margin: 0; color: var(--muted); font-size: 14px; }

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

.form { display: grid; gap: 18px; }

.field { display: grid; gap: 8px; }

.field__label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.field__label .aside { font-weight: 400; color: var(--muted); font-size: 12px; }

.control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

.control svg { flex: none; color: var(--muted); }

.control input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.control input::placeholder { color: var(--muted); opacity: 0.75; }

/* 隐藏 Edge 自带的密码显示按钮，避免和自定义眼睛重复 */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

.control--split { gap: 0; padding-right: 0; }

.control--split input { padding-right: 8px; }

.control .suffix {
  flex: none;
  padding: 0 14px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.control__toggle {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.control__toggle:hover { background: var(--brand-soft); color: var(--brand); }

.control__toggle .eye-off { display: none; }
.control__toggle[aria-pressed="true"] .eye { display: none; }
.control__toggle[aria-pressed="true"] .eye-off { display: block; }

.field__hint { margin: 0; font-size: 12px; color: var(--muted); }

.field[data-invalid="true"] .control {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.field__error {
  display: none;
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
}

.field[data-invalid="true"] .field__error { display: block; }

/* 密码强度 */

.strength { display: grid; gap: 6px; }

.strength__bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.strength__bars i {
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background var(--dur-fast) ease;
}

.strength__meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.strength[data-score="1"] i:nth-child(-n + 1),
.strength[data-score="2"] i:nth-child(-n + 2),
.strength[data-score="3"] i:nth-child(-n + 3),
.strength[data-score="4"] i:nth-child(-n + 4) {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

/* 密码规则清单 */

.rules {
  margin: -4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}

.rules li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--dur-fast) ease;
}

.rules li i {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.rules li[data-ok="true"] { color: var(--success); }

.rules li[data-ok="true"] i {
  border-color: var(--success);
  background: var(--success);
}

.rules li[data-ok="true"] i::after {
  content: "";
  width: 5px;
  height: 3px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-0.5px);
}

/* 大写锁定提示 + 邮箱可用性 */

.caps-hint {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

.caps-hint[hidden] { display: none; }

.field__hint[data-state="ok"] { color: var(--success); }
.field__hint[data-state="taken"] { color: var(--danger); }
.field__hint[data-state="pending"] { color: var(--muted); }

/* 复选框 */

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-solid);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.check input::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -1px) scale(0);
  transition: transform var(--dur-fast) var(--ease-spring);
}

.check input:checked {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
}

.check input:checked::after { transform: rotate(-45deg) translate(0.5px, -1px) scale(1); }

.check input:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.check a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 2px; }

/* 行内辅助 */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.link-quiet { font-size: 13px; color: var(--muted); }
.link-quiet:hover { color: var(--brand); }

/* 按钮 */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 34px -14px rgba(99, 102, 241, 0.85);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s ease, filter 0.18s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: translateY(0) scale(0.99); }

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

.btn[disabled] { cursor: progress; opacity: 0.82; transform: none; }

.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.btn[data-loading="true"] .btn__spinner { display: block; }
.btn[data-loading="true"] .btn__label { opacity: 0.9; }

@keyframes spin { to { transform: rotate(360deg); } }

/* 消息条 */

.form-msg {
  display: none;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.form-msg[data-show="true"] { display: flex; }

.form-msg[data-tone="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.form-msg[data-tone="success"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 26%, transparent);
}

.form-msg[data-tone="info"] {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 28%, transparent);
}

.form-msg strong { font-weight: 650; }

/* 分隔线 */

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.card__foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.card__foot a { font-weight: 600; }

.legal {
  margin: 14px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.85;
}

/* 顶部工具（主题切换 / 返回首页） */

.topbar {
  position: fixed;
  top: 18px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: border-color var(--dur-fast) ease, transform 0.18s var(--ease-spring);
}

.icon-btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.icon-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.icon-btn .moon { display: none; }
html[data-theme="dark"] .icon-btn .moon { display: block; }
html[data-theme="dark"] .icon-btn .sun { display: none; }

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

.doc { width: 100%; max-width: 760px; margin: 0 auto; }

.doc .card { padding: 40px 44px; }

.doc h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.02em; }

.doc h2 { margin: 28px 0 8px; font-size: 17px; }

.doc p, .doc li { color: var(--text-soft); font-size: 14px; }

.doc ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

.doc .legal { text-align: left; margin-top: 32px; }

.doc__back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 18px; }

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
    max-width: 460px;
  }

  .brand { text-align: center; max-width: none; }

  .brand h1 { margin-top: 26px; }

  .brand__lede { margin-left: auto; margin-right: auto; }

  .brand__list { display: none; }

  .brand__foot { justify-content: center; margin-top: 18px; }

  .page { padding: 84px 18px 40px; }
}

@media (max-width: 420px) {
  .card { padding: 26px 20px 22px; border-radius: 18px; }
  .control { min-height: 46px; padding: 0 12px; }
  .control .suffix { padding: 0 10px; }
}

/* ---------- 注册通道选择 ---------- */

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 2px 0 8px;
}

.channel {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease-spring);
}

.channel strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 650;
}

.channel em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--danger);
  background: var(--danger-soft);
}

.channel span { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

.channel[aria-selected="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--ring);
}

.channel:disabled { cursor: not-allowed; opacity: 0.5; }
.channel:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.channel-note {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 次要按钮 / 发送验证码 ---------- */

.btn-ghost {
  width: auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  filter: none;
}

.send-btn { flex: 0 0 auto; margin-left: 6px; white-space: nowrap; }

.send-btn[disabled] { cursor: progress; opacity: 0.7; }

/* ---------- 注册成功 ---------- */

.success-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--success);
  background: var(--success-soft);
  text-align: center;
}

.success-box__code {
  margin-bottom: 8px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 17px;
  font-weight: 700;
  word-break: break-all;
  color: var(--success);
}

.success-box .btn { margin-top: 12px; }

@media (max-width: 480px) {
  .channels { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
