/* 主题变量、卡片、按钮等基础样式复用 ../压缩/styles.css，这里只放本页新增的部分 */

/* ---------- 顶部链接组 ---------- */
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 三栏格式切换：沿用「压缩」页的两栏分段样式 */
.modes.modes-3 {
  grid-template-columns: repeat(3, 1fr);
}

.mode:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ---------- 竖排字段：标题在上，输入框在下 ---------- */
.field-stack {
  display: block;
}

.field-stack > span {
  display: block;
  margin-bottom: 6px;
}

.field-stack input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcff;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: .18s;
}

.field-stack input[type="text"]:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-stack input[type="text"]::placeholder {
  color: #a6b1c4;
}

/* 页码写错时给出明确的红色提示 */
.field-stack.is-invalid input[type="text"] {
  border-color: #f0b4b4;
  background: #fff7f7;
}

.field-stack.is-invalid input[type="text"]:focus {
  box-shadow: 0 0 0 3px #fdecec;
}

.field-hint.is-warn {
  color: var(--err);
}

.field input[type="range"]:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ---------- 已选文件列表 ---------- */
.file-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.file-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.file-list-head b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.file-clear {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: .16s;
}

.file-clear:hover:not(:disabled) {
  color: var(--err);
}

.file-clear:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.file-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* 文件很多时列表自己滚，不把页面撑长 */
  max-height: 216px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcff;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta-line {
  color: var(--muted);
  font-size: 11.5px;
}

.file-meta-line.is-error {
  color: var(--err);
}

.file-remove {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: .16s;
}

.file-remove:hover:not(:disabled) {
  border-color: #f0b4b4;
  background: #fff7f7;
  color: var(--err);
}

.file-remove:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ---------- 输出预览 ---------- */
.preview-hint {
  color: var(--muted);
  font-size: 12.5px;
}

.thumb-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 每个 PDF 一组，方便多文件时对照 */
.thumb-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.thumb-group-head strong {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.thumb-group-head span {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.thumbs-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.thumb-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcff;
}

/* 棋盘格底衬托透明背景，图片按比例缩放不裁切 */
.thumb-frame {
  position: relative;
  display: grid;
  place-items: center;
  height: 140px;
  border-radius: 7px;
  overflow: hidden;
  background-color: #fff;
  background-image: repeating-conic-gradient(#eceff6 0% 25%, #fff 0% 50%);
  background-size: 14px 14px;
}

/* 缩略图本身就是打开大图预览的按钮 */
button.thumb-frame {
  width: 100%;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: zoom-in;
  transition: box-shadow .16s;
}

button.thumb-frame:hover {
  box-shadow: inset 0 0 0 2px rgba(59, 110, 246, .4);
}

button.thumb-frame:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 缩略图按比例完整装进固定高度，不裁切也不撑破卡片 */
.thumb-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(23, 40, 84, .22));
}

.thumb-no {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(30, 39, 51, .62);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
}

.thumb-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.thumb-meta strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.thumb-dl {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #3c4759;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: .18s;
}

.thumb-dl:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 大图预览 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 64px 76px;
  background: rgba(16, 22, 34, .93);
}

.lightbox[hidden] {
  display: none;
}

/* 打开预览时锁住页面滚动，手机上下滑不会带着背景跑 */
body.lb-locked {
  overflow: hidden;
}

.lb-img {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .9);
}

/* 关闭与翻页按钮用深色半透明底，白色页面和深色背景上都能看清 */
.lb-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 8px;
  background: rgba(16, 22, 34, .6);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: .16s;
}

.lb-close:hover {
  background: rgba(16, 22, 34, .85);
}

.lb-nav {
  position: absolute;
  top: 50%;
  width: 38px;
  height: 62px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 10px;
  background: rgba(16, 22, 34, .6);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition: .16s;
}

.lb-nav:hover:not(:disabled) {
  background: rgba(16, 22, 34, .88);
}

.lb-nav:disabled {
  opacity: .25;
  cursor: not-allowed;
}

.lb-prev {
  left: 12px;
}

.lb-next {
  right: 12px;
}

.lb-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 28px);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  color: #e8edf9;
  font-size: 12.5px;
  transform: translateX(-50%);
}

.lb-caption {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-open,
.lb-save {
  flex: none;
  padding: 5px 10px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  transition: .16s;
}

.lb-open {
  border: 1px solid rgba(255, 255, 255, .32);
  color: #e8edf9;
}

.lb-open:hover {
  border-color: #fff;
  color: #fff;
}

.lb-save {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.lb-save:hover {
  background: var(--accent-dark);
}

/* ---------- 响应式 ---------- */
@media (max-width: 800px) {
  .thumbs {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .thumb-frame {
    height: 116px;
  }

  .lightbox {
    padding: 48px 8px 84px;
  }

  .lb-nav {
    width: 30px;
    height: 52px;
    font-size: 20px;
  }

  .lb-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .lb-caption {
    flex: 1 1 100%;
    text-align: center;
    white-space: normal;
  }
}