/* 小说 PDF「申请下载」弹窗样式 */

.dl-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  /* 上下留白，配合居中显示，避免弹窗贴边或贴到底部 */
  padding: 3vh 0;
  box-sizing: border-box;
}

.dl-gate.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-gate__mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(3px);
}

/* 面板：居中显示，头部固定 + 内容区滚动，整体高度由脚本按可视区重算 */
.dl-gate__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  width: min(92vw, 440px);
  max-height: 84vh;
  overflow: hidden;
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(2, 6, 23, 0.4);
  font: 15px/1.7 system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  animation: dl-gate-in 0.22s ease-out;
}

@keyframes dl-gate-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 头部（固定，不随内容滚动） ---------- */
.dl-gate__head {
  flex: 0 0 auto;
  padding: 22px 24px 14px;
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
  border-bottom: 1px solid #eef2f7;
}

.dl-gate__panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: 0.3px;
}

/* 当前被选中的小说卡片 */
.dl-gate__book {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e3ecfb;
  border-radius: 12px;
  background: linear-gradient(135deg, #f2f7ff 0%, #eaf2fe 100%);
}

.dl-gate__book-cover {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #353a44, #14161c);
  box-shadow: 0 4px 12px rgba(20, 22, 28, 0.3);
}

.dl-gate__book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dl-gate__book-cover::after {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  font-size: 20px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.dl-gate__book-cover.has-img::after {
  display: none;
}

.dl-gate__book-info {
  min-width: 0;
  flex: 1 1 auto;
}

.dl-gate__book-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.4;
  color: #241f1a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dl-gate__book-meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-gate__tip {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: #64748b;
}

/* ---------- 内容区（表单 / 成功态，超出时只在这一块滚动） ---------- */
.dl-gate__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 24px 20px;
}

.dl-gate__close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.05);
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.dl-gate__close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #334155;
}

/* ---------- 表单 ---------- */
.dl-gate__form label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: #334155;
}

.dl-gate__form input[type="text"],
.dl-gate__form input:not([type]),
.dl-gate__form input[type="email"],
.dl-gate__form textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.dl-gate__form input:focus,
.dl-gate__form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dl-gate__form textarea {
  resize: vertical;
}

.dl-gate__check {
  display: flex !important;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: #475569;
}

.dl-gate__check input {
  margin-top: 3px;
}

.dl-gate__check a {
  color: #2563eb;
}

.req {
  color: #dc2626;
}

.dl-gate__err {
  margin: 0 0 10px;
  min-height: 20px;
  font-size: 13px;
  color: #dc2626;
}

.dl-gate__submit {
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.dl-gate__submit:hover {
  background: #1d4ed8;
}

.dl-gate__submit:disabled {
  opacity: 0.65;
  cursor: default;
}

.dl-gate__done {
  text-align: center;
}

.dl-gate__download {
  display: inline-block;
  margin: 6px 0 10px;
  padding: 10px 22px;
  border-radius: 9px;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.dl-gate__download[href="#"] {
  opacity: 0.5;
  pointer-events: none;
}

.dl-gate__countdown {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

/* ---------- 窄屏适配 ---------- */
@media (max-width: 480px) {
  .dl-gate {
    padding: 2vh 0;
  }

  .dl-gate__head {
    padding: 20px 18px 12px;
  }

  .dl-gate__scroll {
    padding: 14px 18px 18px;
  }

  .dl-gate__book-cover {
    width: 42px;
    height: 56px;
  }
}
