/* 登录弹窗 + 账号入口 —— 各页共用(浅色蓝调，与 shell 统一) */

:root { --sp-brand: #185FA5; }

.sp-auth-btn {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

/* 遮罩 */
.sp-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: sp-fade .15s ease;
}
.sp-modal-mask[hidden] { display: none; }
@keyframes sp-fade { from { opacity: 0; } to { opacity: 1; } }

/* 弹窗 */
.sp-modal {
  position: relative;
  /* 360 → 400：邮箱比手机号长得多，360px 下输入框只剩 175px(约 22 字符)，
     稍长一点的地址就看不全。max-width 兜住窄屏，不影响手机。 */
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #fff;
  color: #1f2328;
  border-radius: 16px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 60px rgba(17, 24, 39, .28);
  animation: sp-pop .18s cubic-bezier(.2, .8, .3, 1.1);
}
@keyframes sp-pop {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* 头部 */
.sp-modal-head { text-align: center; margin-bottom: 20px; }
.sp-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, var(--sp-brand));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 6px 16px rgba(24, 95, 165, .35);
}
.sp-modal h3 { margin: 0 0 4px; font-size: 19px; font-weight: 700; color: #1f2328; }
.sp-modal .sp-sub { margin: 0; font-size: 12px; color: #8a929c; }

/* 输入 */
.sp-field { display: flex; gap: 10px; margin-bottom: 12px; }
.sp-field input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #dfe3e8;
  background: #f7f9fb;
  color: #1f2328;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.sp-field input::placeholder { color: #aab1ba; }
.sp-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--sp-brand);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, .15);
}

.sp-code-btn {
  flex: none;
  width: 118px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--sp-brand);
  background: rgba(24, 95, 165, .06);
  color: var(--sp-brand);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.sp-code-btn:hover:not(:disabled) { background: rgba(24, 95, 165, .12); }
.sp-code-btn:disabled {
  border-color: #e5e8ec;
  background: #f2f4f6;
  color: #aab1ba;
  cursor: default;
}

.sp-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, var(--sp-brand));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(24, 95, 165, .3);
  transition: filter .15s, transform .05s;
}
.sp-submit:hover:not(:disabled) { filter: brightness(1.05); }
.sp-submit:active:not(:disabled) { transform: translateY(1px); }
.sp-submit:disabled { opacity: .55; cursor: default; box-shadow: none; }

.sp-msg {
  min-height: 18px;
  margin: 10px 0 2px;
  font-size: 12px;
  text-align: center;
  color: #e5484d;
}
.sp-msg.ok { color: #1a7f37; }

.sp-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: #aab1ba;
  font-size: 22px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sp-modal-close:hover { background: #f2f4f6; color: #57606a; }

.sp-agreement {
  margin-top: 14px;
  font-size: 11px;
  color: #aab1ba;
  line-height: 1.6;
  text-align: center;
}

/* ── 响应式（≤480px 手机）───────────────────────────────────────────────
   邮箱登录带来的两处必要调整（手机号时代不需要，11 位数字怎么挤都够看）：

   1) 换行堆叠：桌面端邮箱框和"获取验证码"按钮并排，在 375px 屏上只剩
      173px，`a.very.long+tag@subdomain.example.com` 这种地址打到一半就
      看不见开头了。改成输入框独占一行、按钮落到下一行整宽。
   2) 字号顶到 16px：iOS Safari 对 font-size < 16px 的输入框会在聚焦时
      自动放大整个页面，放大后还不会自己缩回去 —— 登录弹窗现在是主转化
      路径，不能在第一次点输入框就把版面搞乱。style.css:730 已经为首页
      回测表单做过同样处理，这里是当时没覆盖到的另一处。 */
@media (max-width: 480px) {
  .sp-field { flex-wrap: wrap; }
  .sp-field input { flex: 1 1 100%; font-size: 16px; }
  .sp-code-btn { width: 100%; }
}

/* ── 头像 ─────────────────────────────────────────────────────────────────
   两种形态共用一个类:自定义头像是 <img>,默认头像是带渐变底色的首字色块。
   尺寸由 JS 内联给(同一个组件在顶栏 26px、菜单 40px、资料页 88px),
   这里只管形状与不变的部分。 */
.sp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  object-fit: cover;              /* 服务端已裁成正方形,这里兜住异常比例 */
  background: #e9edf2;
  vertical-align: middle;
}
.sp-avatar-default {
  color: #fff;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

/* 旧版页面 header 里的账号入口(#spAuthSlot) */
.sp-auth-acct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid #dfe3e8;
  background: #fff;
  cursor: pointer;
}
.sp-auth-acct:hover { border-color: var(--sp-brand); color: var(--sp-brand); }
.sp-auth-name { font-size: 13px; max-width: 120px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

/* ── 个人资料弹窗 ────────────────────────────────────────────────────── */
.sp-profile { text-align: left; }
.sp-prof-avatar { text-align: center; margin-bottom: 18px; }

.sp-avatar-wrap {
  position: relative;
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
}
.sp-avatar-wrap:focus-visible { outline: 2px solid var(--sp-brand); outline-offset: 3px; }
.sp-avatar-edit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 999px 999px;
  background: rgba(17, 24, 39, .55);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.sp-avatar-wrap:hover .sp-avatar-edit { opacity: 1; }

.sp-prof-hint { margin-top: 10px; font-size: 11px; color: #aab1ba; }
.sp-linkbtn {
  margin-left: 8px;
  border: none;
  background: none;
  padding: 0;
  color: var(--sp-brand);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}
.sp-linkbtn[hidden] { display: none; }

.sp-prof-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #57606a;
}
.sp-prof-label span { color: #aab1ba; }
.sp-prof-static {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: #f2f4f6;
  color: #8a929c;
  font-size: 13px;
}

/* ── 轻提示 ───────────────────────────────────────────────────────────────
   保存/上传这类动作要有即时反馈,但不该再弹一个需要点确定的框。
   固定在底部中间,2.6s 自动消失。 */
.sp-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1100;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .88);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .18s, transform .18s;
}
.sp-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sp-toast.err { background: rgba(190, 30, 40, .92); }
