/* ============================================================
   M1 · 组件层（按钮 / 导航 / 卡片 / 表单 / 页脚 / 弹层）
   ============================================================ */

/* ---------------- 按钮 ---------------- */
.btn {
  --btn-h: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 20px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: transform var(--e-fast), box-shadow var(--e), background-color var(--e), border-color var(--e), color var(--e);
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(.995); }

/* 白字按钮必须 ≥4.5:1；teal-500 只有 2.94，所以底色从 teal-700 起 */
.btn-primary {
  background: linear-gradient(180deg, var(--teal-700), var(--teal-800));
  color: #fff;
  box-shadow: 0 14px 32px -16px rgba(12, 116, 109, .85), var(--sh-inset);
}
.btn-primary:hover {
  color: #fff;
  background: linear-gradient(180deg, var(--teal-800), var(--teal-900));
  box-shadow: 0 20px 44px -18px rgba(12, 116, 109, .9);
}

.btn-outline {
  border-color: var(--line-hi);
  background: #fff;
  color: var(--text);
  box-shadow: var(--sh-xs);
}
.btn-outline:hover {
  border-color: var(--teal-300);
  color: var(--teal-800);
  background: var(--teal-50);
}

.btn-ghost {
  background: rgba(13, 21, 38, .04);
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: rgba(13, 21, 38, .08); color: var(--text); }

.btn-light {
  background: #fff;
  color: var(--teal-800);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .45);
}
.btn-light:hover { color: var(--teal-900); transform: translateY(-2px); }

.btn-ghost-light {
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
  background: rgba(255, 255, 255, .06);
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.btn-sm { --btn-h: 38px; padding: 0 16px; font-size: var(--fs-xs); }
.btn-lg { --btn-h: 54px; padding: 0 26px; font-size: var(--fs-base); }
.btn-block { display: flex; width: 100%; }

.btn[disabled], .btn[aria-busy="true"] {
  opacity: .62;
  pointer-events: none;
}

/* ---------------- 导航 ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background var(--e), border-color var(--e), box-shadow var(--e);
}
.nav.is-scrolled {
  background: rgba(255, 255, 255, .92);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 24px -18px rgba(9, 20, 38, .35);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.brand:hover { color: var(--text); }
.brandmark { display: block; width: 32px; height: 32px; }
.brandmark svg { width: 100%; height: 100%; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  position: relative;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--e-fast), background var(--e-fast);
}
.nav-link:hover { color: var(--text); background: rgba(13, 21, 38, .04); }
.nav-link.is-active { color: var(--teal-700); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--teal-500);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-mobile-actions { display: none; }

.hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: rgba(13, 21, 38, .05);
}
.hamburger span {
  display: block;
  width: 18px; height: 1.8px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--e), opacity var(--e);
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(7, 12, 20, .35);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- 卡片 ---------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-sm);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--teal-400), var(--teal-600));
  color: #fff;
  box-shadow: var(--sh-glow), var(--sh-inset);
  transition: transform var(--e-bounce), box-shadow var(--e);
}
.icon-tile svg { width: 24px; height: 24px; }

.icon-tile--dark {
  background: linear-gradient(150deg, rgba(19, 168, 161, .3), rgba(19, 168, 161, .12));
  border: 1px solid rgba(121, 218, 212, .3);
  box-shadow: 0 14px 30px -16px rgba(19, 168, 161, .8);
  color: var(--teal-200);
}

/* ---------------- 头像 / 星级 ---------------- */
.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  border: 2px solid #fff;
  flex: none;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar:not(:first-child) { margin-left: -12px; }

.tone-1 { background: linear-gradient(140deg, #13a8a1, #0a5b56); }
.tone-2 { background: linear-gradient(140deg, #3b82f6, #1e3a8a); }
.tone-3 { background: linear-gradient(140deg, #f59e0b, #b45309); }
.tone-4 { background: linear-gradient(140deg, #a855f7, #6b21a8); }
.tone-5 { background: linear-gradient(140deg, #ec4899, #9d174d); }
.tone-6 { background: linear-gradient(140deg, #10b981, #065f46); }

.stars { display: inline-flex; gap: 2px; }
.star {
  font-size: .95rem;
  line-height: 1;
  color: var(--ink-200);
}
.star.on { color: #f5b301; }

/* ---------------- 统计数字 ---------------- */
.stat-value {
  font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem);
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-hi);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: var(--fs-sm);
  transition: border-color var(--e), box-shadow var(--e), background var(--e);
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.55; }

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-300); }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal-400);
  box-shadow: 0 0 0 4px rgba(19, 168, 161, .12);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--bad);
  background: #fffafa;
}
.field input[aria-invalid="true"]:focus,
.field textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .12);
}

.field-error {
  margin: 0;
  min-height: 0;
  font-size: var(--fs-xs);
  color: var(--bad);
}
.field-error:empty { display: none; }
.field-hint { margin: 0; }

.input-with-btn { position: relative; display: flex; }
.input-with-btn input { padding-right: 64px !important; }

.pw-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--r-xs);
  color: var(--text-3);
  transition: background var(--e-fast), color var(--e-fast);
}
.pw-toggle:hover { background: var(--bg-soft); color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; }

.code-btn {
  position: absolute;
  right: 5px; top: 50%;
  transform: translateY(-50%);
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-xs);
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  color: var(--teal-700);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--e-fast), color var(--e-fast);
}
.code-btn:hover { background: var(--teal-100); }
.code-btn[disabled] { opacity: .6; pointer-events: none; font-variant-numeric: tabular-nums; }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.45;
  cursor: pointer;
}
.check input {
  appearance: none;
  width: 18px; height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid var(--line-hi);
  border-radius: 5px;
  background: #fff;
  flex: none;
  display: grid;
  place-items: center;
  transition: background var(--e-fast), border-color var(--e-fast);
}
.check input:checked {
  background: var(--teal-500);
  border-color: var(--teal-500);
}
.check input:checked::after {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.check a { font-weight: 600; }

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: var(--fs-sm);
}
.alert.is-ok {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

/* ---------------- 页脚 ---------------- */
.footer {
  padding-block: 64px 32px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
}

.footer-brand .brand { margin-bottom: 14px; }
.footer-tagline {
  max-width: 280px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-bottom: 18px;
}

.footer-social { display: flex; gap: 8px; }
.footer-social a {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  transition: color var(--e-fast), border-color var(--e-fast), transform var(--e-fast);
}
.footer-social a:hover { color: var(--teal-700); border-color: var(--teal-300); transform: translateY(-2px); }
.footer-social svg { width: 16px; height: 16px; }

.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 { margin: 0 0 6px; color: var(--text-3); font-size: var(--fs-xs); }
.footer-col a {
  color: var(--text-2);
  font-size: var(--fs-sm);
  width: fit-content;
}
.footer-col a:hover { color: var(--teal-700); }

.footer-legal {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.footer-risk {
  max-width: 720px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text-3);
}
.footer-copy { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }

/* ---------------- 悬浮客服 / Toast ---------------- */
.fab {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 70;
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--teal-400), var(--teal-600));
  color: #fff;
  box-shadow: var(--sh-glow), var(--sh-inset);
  transition: transform var(--e-bounce), box-shadow var(--e);
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { transform: translateY(-3px) scale(1.04); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 210;
  transform: translate(-50%, 12px);
  max-width: min(92vw, 460px);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--ink-900);
  color: #fff;
  font-size: var(--fs-sm);
  box-shadow: var(--sh-lg);
  opacity: 0;
  transition: opacity var(--e), transform var(--e);
}
.toast.is-in { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 24px; }
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 20, .5);
  backdrop-filter: blur(4px);
  animation: fade .2s ease;
}
.modal-card {
  position: relative;
  width: min(460px, 100%);
  padding: 30px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-lg);
  animation: pop .28s var(--e-out);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-card h2 { font-size: var(--fs-2xl); margin-bottom: 6px; }
.modal-card .small { margin-bottom: 20px; }
.modal-close {
  position: absolute;
  right: 14px; top: 14px;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-pill);
  color: var(--text-3);
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .nav-links { gap: 0; }
  .nav-link { padding: 8px 9px; font-size: var(--fs-xs); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 880px) {
  .hamburger { display: flex; flex-shrink: 0; }
  .nav-actions { gap: 8px; }
  .nav-actions .btn-ghost { display: none; }
  /* 小屏只留汉堡菜单，注册按钮进抽屉，避免右侧溢出 */
  .nav-actions .btn-primary { display: none; }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    z-index: 85;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 14px var(--gutter) 22px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--e), transform var(--e);
  }
  .nav-links.is-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-link {
    padding: 13px 10px;
    font-size: var(--fs-base);
    border-radius: var(--r-sm);
  }
  .nav-link.is-active::after { display: none; }
  .nav-link.is-active { background: var(--teal-50); }

  .nav-mobile-actions {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-legal { flex-direction: column; gap: 12px; }
  .footer-copy { white-space: normal; }
}

/* 中性提示（例如"登录后继续访问 xx"） */
.alert.is-info {
  border-color: var(--teal-200);
  background: var(--teal-50);
  color: var(--teal-800);
}

/* ---------------- 手机端收尾调整 ---------------- */
@media (max-width: 640px) {
  /* 悬浮客服不压内容：缩小并上移，正文底部留出安全区 */
  .fab { right: 14px; bottom: 14px; width: 46px; height: 46px; }
  .fab svg { width: 20px; height: 20px; }
  body { padding-bottom: 8px; }
  .footer { padding-bottom: 72px; }

  /* 登录/注册页：表单贴顶，去掉垂直居中造成的空白 */
  .auth-shell { gap: 0; }
  .auth-main { place-items: start center; padding: 16px 18px 40px; }
  .auth-aside { max-height: 34vh; overflow: hidden; }
}

/* 导航标签不换行：中文两字标题曾被挤成两行 */
.nav-link{white-space:nowrap}
@media (min-width:881px){
  .nav-links{gap:2px}
  .nav-link{padding:8px 9px;font-size:13px}
}
