/* 课件清图 · 苹果风：大标题、留白、白卡片、细线、毛玻璃底栏 */

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --faint: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --fill: #f2f2f4;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.1);
  --red: #e5372b;
  --red-soft: rgba(229, 55, 43, 0.1);
  --orange: #c25e00;
  --orange-soft: rgba(255, 149, 0, 0.12);
  --check-a: #ececef;
  --check-b: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
  --bar-bg: rgba(255, 255, 255, 0.78);
  --radius: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #f5f5f7;
    --sub: #a1a1a6;
    --faint: #86868b;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --fill: #2c2c2e;
    --blue: #0a84ff;
    --blue-hover: #409cff;
    --blue-soft: rgba(10, 132, 255, 0.18);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.18);
    --orange: #ffb340;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --check-a: #2c2c2e;
    --check-b: #3a3a3c;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --bar-bg: rgba(28, 28, 30, 0.78);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fill); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--sub); }

/* ---------- 顶栏 ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { max-width: 1120px; margin: 0 auto; height: 52px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand img { border-radius: 6px; }
.nav-link { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--sub); cursor: pointer; padding: 6px 4px; font-size: 14px; }
.nav-link:hover { color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 0 22px 140px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-plain { background: var(--fill); color: var(--ink); }
.btn-plain:hover { background: color-mix(in srgb, var(--fill) 80%, var(--ink) 8%); }
.btn-link { background: none; color: var(--blue); padding: 0 6px; height: auto; }
.btn-link:hover { text-decoration: underline; }
.btn-lg { height: 46px; padding: 0 30px; font-size: 16px; }

/* ---------- 空状态 ---------- */
.hero { text-align: center; padding: 72px 0 40px; }
.hero h1 { font-size: clamp(32px, 5.4vw, 56px); line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 18px; }
.lead { font-size: clamp(16px, 2vw, 21px); color: var(--sub); line-height: 1.5; margin: 0 0 44px; }
.drop {
  max-width: 640px; margin: 0 auto; padding: 48px 24px 44px;
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  border: 1.5px dashed var(--line-strong);
  transition: border-color .2s, background-color .2s;
}
.drop-icon { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.drop-title { font-size: 19px; font-weight: 600; margin: 0; }
.drop-sub { color: var(--faint); margin: 6px 0 16px; font-size: 14px; }
.promises { list-style: none; padding: 0; margin: 36px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; color: var(--sub); font-size: 14px; }
.promises li { display: flex; align-items: center; gap: 7px; }
.promises svg { color: var(--blue); }

/* 拖文件时整页的提示 */
.drag-veil { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: color-mix(in srgb, var(--blue) 12%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.drag-veil div { background: var(--card); color: var(--blue); font-size: 19px; font-weight: 600; padding: 22px 36px; border-radius: 22px; box-shadow: var(--shadow-lg); border: 2px dashed var(--blue); }
body.dragging .drag-veil { display: grid; }

/* ---------- 读取中 ---------- */
.loading { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 160px 0; color: var(--sub); font-size: 16px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--blue); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 15px; height: 15px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 工作区：文件信息 ---------- */
.workspace { padding-top: 32px; }
.file { display: flex; align-items: center; gap: 16px; }
.file-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.file-text { min-width: 0; flex: 1; }
.file-text h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-text p { margin: 2px 0 0; color: var(--sub); font-size: 14px; }

.filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 16px; flex-wrap: wrap; }

/* 分段控件 */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--fill); border-radius: 10px; }
.seg button { border: 0; background: none; cursor: pointer; padding: 5px 12px; border-radius: 8px; font-size: 13px; color: var(--sub); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 0 0 .5px rgba(0,0,0,.04); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg-lg button { padding: 7px 16px; font-size: 14px; }
.seg .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- 图片卡片 ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.item {
  position: relative;
  display: grid; grid-template-columns: 148px minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; align-items: start;
  background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s;
}
.item.selected { outline-color: var(--blue); }

.pick {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); background: color-mix(in srgb, var(--card) 85%, transparent);
  color: transparent; backdrop-filter: blur(4px);
  transition: background-color .15s, border-color .15s;
}
.pick:hover { border-color: var(--blue); }
.item.selected .pick { background: var(--blue); border-color: var(--blue); color: #fff; }

.thumb {
  width: 148px; height: 148px; border-radius: 14px; overflow: hidden; cursor: pointer;
  display: grid; place-items: center; padding: 10px;
  background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 14px 14px;
  border: 1px solid var(--line);
}
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.no-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; text-align: center; line-height: 1.4; }

.meta { min-width: 0; padding-top: 2px; }
.title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.title-row h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; }
.tag-hot { background: var(--red-soft); color: var(--red); }
.tag-info { background: var(--blue-soft); color: var(--blue); }
.tag-muted { background: var(--orange-soft); color: var(--orange); }
.pages { margin: 6px 0 0; color: var(--ink); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.where { margin: 4px 0 0; color: var(--faint); font-size: 13px; }

/* 勾选后的删除范围 */
.scope { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pages-input {
  width: 100%; max-width: 260px; height: 36px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--card); outline: none; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.pages-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.pages-input.bad { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.switch-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row small { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.switch { flex: none; position: relative; width: 38px; height: 23px; border-radius: 999px; background: var(--line-strong); transition: background-color .2s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch-row input:checked + .switch { background: #34c759; }
.switch-row input:checked + .switch::after { transform: translateX(15px); }
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 3px var(--blue-soft); }

.impact { margin: 0; font-size: 13px; color: var(--sub); }
.impact b { color: var(--ink); font-variant-numeric: tabular-nums; }
.impact.warn { color: var(--red); }

/* ---------- 位置示意 ---------- */
.previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini { margin: 0; }
.mini-canvas { position: relative; width: 100%; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.mini-canvas img { position: absolute; object-fit: fill; opacity: .55; }
.mini-canvas img.is-target { opacity: 1; filter: none; }
.mini-canvas .ring { position: absolute; border-radius: 3px; box-shadow: 0 0 0 2px var(--blue), 0 0 0 4px rgba(0, 113, 227, .18); pointer-events: none; min-width: 4px; min-height: 4px; }
.mini-canvas .ring-del { box-shadow: 0 0 0 2px var(--red), 0 0 0 4px rgba(229, 55, 43, .2); background: rgba(229, 55, 43, .12); }
.mini figcaption { margin-top: 6px; font-size: 12px; color: var(--faint); text-align: center; display: flex; justify-content: center; align-items: center; gap: 6px; }
.del-dot { color: var(--red); font-weight: 500; }

.empty-list { text-align: center; color: var(--faint); padding: 60px 0; background: var(--card); border-radius: var(--radius); }

/* ---------- 底部操作条 ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(120%); visibility: hidden;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s .3s;
  pointer-events: none;
}
.bar.show { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.bar-inner {
  pointer-events: auto;
  max-width: 1076px; margin: 0 auto; padding: 12px 12px 12px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bar-bg); border-radius: 20px; box-shadow: var(--shadow-lg), 0 0 0 .5px var(--line-strong);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
}
#bar-text { margin: 0; font-size: 14px; color: var(--sub); }
#bar-text b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bar-warn { color: var(--red); }
.bar-actions { display: flex; gap: 10px; flex: none; }

/* ---------- 弹窗 ---------- */
.sheet {
  width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 24px; padding: 32px 30px 24px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); text-align: center;
}
.sheet::backdrop { background: rgba(0, 0, 0, .32); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet[open] { animation: pop .22s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.sheet h2 { margin: 0 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sheet p { margin: 0 0 8px; font-size: 14px; color: var(--sub); line-height: 1.6; }
.sheet .done-big { font-size: 17px; color: var(--ink); margin-bottom: 12px; }
.sheet .done-big small { display: block; font-size: 13px; color: var(--faint); margin-top: 2px; }
.sheet-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; }
.sheet-icon.ok { background: rgba(52, 199, 89, .14); color: #28a745; }
.sheet-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.sheet-wide { width: min(620px, calc(100vw - 32px)); text-align: left; max-height: calc(100vh - 48px); padding: 34px 34px 24px; }
.sheet-wide h3 { font-size: 16px; margin: 26px 0 8px; }
.sheet-wide .sheet-actions { justify-content: flex-end; }
.sheet-close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--fill); color: var(--sub); cursor: pointer; display: grid; place-items: center; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; font-size: 14px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 600; font-size: 13px; display: grid; place-items: center; }
.steps b { font-weight: 600; }
.steps span { color: var(--sub); line-height: 1.6; }
.faq { margin: 0; font-size: 14px; }
.faq dt { font-weight: 600; margin-top: 12px; }
.faq dd { margin: 3px 0 0; color: var(--sub); line-height: 1.6; }

.mini { cursor: zoom-in; }
.mini:hover .mini-canvas { box-shadow: 0 0 0 1px var(--line-strong), 0 4px 14px rgba(0,0,0,.08); }

/* 大图弹窗 */
.sheet-zoom { width: min(960px, calc(100vw - 32px)); text-align: left; padding: 20px 22px 18px; }
.zoom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.zoom-head h2 { margin: 0; font-size: 19px; display: flex; align-items: baseline; gap: 10px; }
.zoom-count { font-size: 13px; font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.zoom-nav { display: flex; gap: 8px; }
.round { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.round:hover:not(:disabled) { background: color-mix(in srgb, var(--fill) 80%, var(--ink) 8%); }
.round:disabled { opacity: .35; cursor: default; }
#zoom-body .mini-canvas { border-radius: 12px; }
#zoom-body .ring { box-shadow: 0 0 0 3px var(--blue), 0 0 0 6px rgba(0, 113, 227, .18); }
#zoom-body .ring-del { box-shadow: 0 0 0 3px var(--red), 0 0 0 6px rgba(229, 55, 43, .2); }
.zoom-note { margin: 12px 2px 0; font-size: 13px; color: var(--faint); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 68px; z-index: 60; transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  display: flex; align-items: flex-start; gap: 10px; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-lg), 0 0 0 .5px var(--line-strong);
  font-size: 14px; line-height: 1.55; transition: opacity .2s, transform .25s;
}
.toast svg { flex: none; margin-top: 1px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error svg { color: var(--red); }
.toast.info svg { color: #28a745; }

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .item { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; }
  .thumb { width: 112px; height: 112px; }
  .previews { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .nav-inner, main { padding-left: 16px; padding-right: 16px; }
  .hero { padding-top: 44px; }
  .hero h1 br, .lead br { display: none; }
  .file { flex-wrap: wrap; }
  .file .btn { width: 100%; }
  .bar-inner { flex-direction: column; align-items: stretch; padding: 14px; }
  .bar-actions .btn { flex: 1; }
  .previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .previews .mini:nth-child(3) { display: none; }
}
