/* =========================
   Terms / Privacy Modal (restore)
   ========================= */

/* 让协议弹窗的 overlay 永远高于登录弹窗 */
#termsModal.modal-overlay,
#privacyModal.modal-overlay {
  z-index: 10050;
  /* 比 #authModal(9999) 大就行 */
}

/* 弹窗容器 */
#termsModal .modal,
#privacyModal .modal {
  width: min(520px, calc(100vw - 32px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  padding: 22px 22px 18px;
  position: relative;
}

/* 标题 */
#termsModal .modal h3,
#privacyModal .modal h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
  color: #111;
}

/* 右上角关闭按钮 */
#termsModal .modal .close,
#privacyModal .modal .close {
  position: absolute;
  right: 12px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

#termsModal .modal .close:hover,
#privacyModal .modal .close:hover {
  color: #111;
}

/* 内容滚动区 */
#termsModal .modal-body,
#privacyModal .modal-body {
  max-height: 55vh;
  overflow: auto;
  padding-right: 6px;
  color: #444;
  font-size: 14px;
  line-height: 1.7;
}

/* 内容里的段落间距 */
#termsModal .modal-body p,
#privacyModal .modal-body p {
  margin-bottom: 12px;
}

/* 可选：滚动条细一点（不影响功能） */
#termsModal .modal-body::-webkit-scrollbar,
#privacyModal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#termsModal .modal-body::-webkit-scrollbar-thumb,
#privacyModal .modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 99px;
}

/* ✅ 适用于 termsModal / privacyModal 这种遮罩 */
#termsModal.active,
#privacyModal.active {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 如果你的 overlay 本来就有背景色，这段可不用；
   如果没有，补一个更舒服的遮罩 */
#termsModal,
#privacyModal {
  background: rgba(0, 0, 0, .35);
}


/* =============== Modal (scrollable + prettier) =============== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 6, 23, .55);
  display: none;
  /* 默认隐藏，打开时改成 flex */
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

.modal {
  width: min(920px, 100%);
  max-height: min(82vh, 760px);
  /* ✅ 限高：弹窗不会撑爆 */
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(2, 6, 23, .10);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
  position: relative;
  overflow: hidden;
  /* 让 header/close 更干净 */
  display: flex;
  flex-direction: column;
  /* ✅ 关键：让 body 独立滚动 */
}

.modal>h3 {
  margin: 0;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 800;
  border-bottom: 1px solid rgba(2, 6, 23, .08);
  background: #fff;
}

.modal .close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(2, 6, 23, .10);
  background: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal .close:hover {
  background: rgba(2, 6, 23, .04);
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
  /* ✅ 关键：内容在这里滚动 */
  -webkit-overflow-scrolling: touch;
}

/* =============== Legal typography (pretty) =============== */
.legal {
  max-width: 760px;
  /* 阅读宽度 */
  margin: 0 auto;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.75;
}

.legal__header {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(2, 6, 23, .08);
  margin-bottom: 14px;
}

.legal__title {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .2px;
}

.legal__meta {
  margin: 0;
  color: rgba(15, 23, 42, .65);
  font-size: 12px;
}

.legal__content p {
  margin: 10px 0;
}

.legal__content h2 {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 900;
}

.legal__content h3 {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: #111;
}

.legal__content ul {
  margin: 10px 0 10px 20px;
  padding: 0;
}

.legal__content li {
  margin: 6px 0;
}

/* =============== Modal bottom actions =============== */
#privacyModal .modal-actions,
#termsModal .modal-actions {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(2, 6, 23, .08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ✅ 隐藏：需要滚动到底才显示「同意隐私条款」 */
#privacyModal .modal-actions.is-hidden {
  display: none;
}

#privacyModal .modal-primary,
#termsModal .modal-primary {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 900;
  background: linear-gradient(90deg, #f2c94c, #f5d76e);
  color: #111;
}

#privacyModal .modal-primary:active,
#termsModal .modal-primary:active {
  transform: translateY(1px);
}

/* 手机端：弹窗更大一点可用空间 */
@media (max-width: 520px) {
  .modal {
    max-height: 86vh;
    border-radius: 16px;
  }

  .modal>h3 {
    padding: 14px 14px;
  }

  .modal-body {
    padding: 14px 14px;
  }
}