/* ============================================================
   PDF to Pictures — Fluent 风格现代 Web 界面
   （桌面版 UI 的网页化版：同一套视觉，追加多语言菜单、商店徽章与移动端适配）
   ============================================================ */

:root {
  /* 主色（绿色强调） */
  --c-primary: #16A34A;
  --c-primary-hover: #15803D;
  --c-primary-active: #166534;
  --c-primary-soft: #ECFDF3;

  /* 背景与表面 */
  --c-bg: #F3F3F3;
  --c-surface: #FFFFFF;
  --c-surface-alt: #FAFAFA;
  --c-surface-sunken: #F0F2F5;

  /* 文本 */
  --c-text: #1A1A1A;
  --c-text-secondary: #605E5C;
  --c-text-tertiary: #8A8886;
  --c-text-on-primary: #FFFFFF;

  /* 边框与分隔 */
  --c-border: #E1E1E1;
  --c-border-strong: #C8C6C4;

  /* 功能色 */
  --c-success: #107C10;
  --c-danger: #D13438;
  --c-danger-soft: #FDECEC;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, .14);

  /* 圆角 */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* 字体 */
  --font-ui: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;

  /* 动效 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: .14s;
  --t-base: .22s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; }
/* 触屏：去掉 300ms 点击延迟与双击缩放 */
button, .lang-list a, .nav-site, .pdf-card { touch-action: manipulation; }

/* 视觉隐藏的 H1：不参与布局（position + 1×1 + clip），供爬虫与读屏使用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ====== 应用骨架 ====== */
#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh; /* 移动端地址栏收起/展开时不被裁切 */
  background: var(--c-bg);
}

/* ====== 顶部标题栏 ====== */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

/* 品牌徽章：与图标包同一套配色（绿色渐变） */
.brand-logo {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #16A34A 0%, #22C55E 55%, #4ADE80 100%);
  box-shadow: 0 3px 10px rgba(22, 163, 74, .32);
}

.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-title { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--c-text-tertiary); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ====== 品牌位：桌面版入口（商店徽章） ====== */
.store-area { display: flex; align-items: center; gap: 8px; }
.store-hint { font-size: 11.5px; color: var(--c-text-tertiary); }
.store-badge { display: flex; align-items: center; }
.store-badge img { display: block; height: 40px; width: auto; }

/* 官网外链 */
.nav-site {
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--c-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-site:hover { background: var(--c-surface-sunken); color: var(--c-text); }

/* ====== 语言菜单（点击展开，触屏可用） ====== */
.lang-menu { position: relative; }
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  min-height: 34px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: 12px;
  color: var(--c-text-secondary);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.lang-toggle:hover { border-color: var(--c-primary); color: var(--c-text); }
.lang-menu.open .lang-toggle { border-color: var(--c-primary); color: var(--c-text); }
.lang-icon { flex-shrink: 0; }
.caret { font-size: 10px; color: var(--c-text-tertiary); }

.lang-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 176px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: none;
}
.lang-menu.open .lang-list { display: block; }
.lang-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  min-height: 36px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
}
.lang-list a:hover { background: var(--c-surface-sunken); }
.lang-list a.active { background: var(--c-primary-soft); color: var(--c-primary-active); font-weight: 600; }
.lang-check { width: 12px; flex-shrink: 0; color: var(--c-primary); }
.lang-check.is-off { visibility: hidden; }

/* ====== 按钮 ====== */
.primary-btn {
  padding: 10px 20px;
  min-height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary-hover) 100%);
  color: var(--c-text-on-primary);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(22, 163, 74, .3);
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 4px 12px rgba(22, 163, 74, .38); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled { background: #C8C6C4; box-shadow: none; color: #FFFFFF; }
.primary-btn.lg { padding: 12px 34px; min-height: 44px; font-size: 14px; border-radius: 10px; }

.secondary-btn {
  padding: 10px 16px;
  min-height: 38px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.secondary-btn:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-active); }
.secondary-btn:active { transform: translateY(1px); }
.secondary-btn.small { padding: 6px 12px; min-height: 30px; font-size: 12px; }

.ghost-btn {
  padding: 9px 14px;
  min-height: 34px;
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.ghost-btn:hover { background: var(--c-surface-sunken); color: var(--c-text); }

.danger-btn {
  padding: 12px 26px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--c-danger-soft);
  color: var(--c-danger);
  font-weight: 600;
  border: 1px solid rgba(209, 52, 56, .28);
  transition: background var(--t-fast), transform var(--t-fast);
}
.danger-btn:hover { background: #FBDDDD; }
.danger-btn:active { transform: translateY(1px); }

.mini-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--c-text-secondary);
  font-size: 13px;
  transition: background var(--t-fast), color var(--t-fast);
}
.mini-btn:hover { background: var(--c-surface-sunken); color: var(--c-primary); }
.mini-btn.danger:hover { background: var(--c-danger-soft); color: var(--c-danger); }

.hidden { display: none !important; }

/* ====== 主工作区 ====== */
#workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 326px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

#leftPane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

/* ====== 拖放区 ====== */
.dropzone {
  position: relative;
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-xl);
  background: radial-gradient(120% 140% at 50% 0%, #FFFFFF 0%, #F7FAFE 100%);
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
  overflow: hidden;
}
.dropzone:hover { border-color: var(--c-primary); }
.dropzone.drag-over {
  border-color: var(--c-primary);
  border-style: solid;
  transform: scale(1.006);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}

.dz-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 24px 20px 22px;
  text-align: center;
}
.dz-icon { color: var(--c-primary); opacity: .9; }
.dz-title { font-size: 15px; font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--c-text-secondary); }
.dz-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.dz-hint { margin-top: 4px; font-size: 11px; color: var(--c-text-tertiary); }

/* ====== PDF 列表 ====== */
.list-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 0;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-alt);
}
.list-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.list-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.list-tools { display: flex; gap: 2px; }

.pdf-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  /* 关键：必须显式声明 row 高度 = max-content。
     否则在高度受限的容器里，grid 的 auto rows 会被压缩到 min-content（实测约 23px），
     导致第 2 行起的卡片全部重叠成一堆。 */
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
}

.list-empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--c-text-tertiary);
  font-size: 12px;
}

/* PDF 卡片 */
.pdf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
  cursor: grab;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base), border-color var(--t-fast);
  animation: cardIn .26s var(--ease) both;
}
.pdf-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(22, 163, 74, .5);
}
.pdf-card.dragging { opacity: .4; transform: scale(.97); cursor: grabbing; }
.pdf-card.drop-target { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.pdf-card .card-thumb-wrap {
  position: relative;
  width: 100%;
  height: 84px;
  flex-shrink: 0;
  overflow: hidden;
}
.pdf-glyph {
  display: grid;
  place-items: center;
  color: var(--c-primary);
  background: radial-gradient(120% 120% at 50% 0%, #F0FDF4 0%, #DCFCE7 100%);
}
.pdf-card .card-thumb-wrap.pdf-glyph svg { width: 34px; height: 34px; }

.card-index {
  position: absolute;
  top: 6px; left: 6px;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

.card-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  color: var(--c-text-secondary);
  font-size: 12px;
  opacity: 0;
  transform: scale(.9);
  transition: opacity var(--t-fast), transform var(--t-fast), background var(--t-fast), color var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.pdf-card:hover .card-remove { opacity: 1; transform: scale(1); }
.card-remove:hover { background: var(--c-danger); color: #fff; }

.card-body { padding: 8px 9px 9px; display: flex; flex-direction: column; gap: 3px; }
.card-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--c-text-tertiary); }

.card-pages {
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2px;
}

/* ====== 参数设置面板 ====== */
#settingsPanel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  min-height: 0;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--c-text-secondary); }
.field-tip { font-size: 11px; color: var(--c-text-tertiary); line-height: 1.5; }

.field-input {
  width: 100%;
  padding: 10px 11px;
  min-height: 38px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  font-size: 12.5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field-input:hover { border-color: var(--c-primary); }
.field-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
}

/* 分段控件 */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--c-surface-sunken);
  border-radius: var(--r-md);
}
.seg-btn {
  padding: 9px 6px;
  min-height: 34px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-secondary);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.seg-btn:hover { color: var(--c-text); }
.seg-btn.active {
  background: var(--c-surface);
  color: var(--c-primary-active);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.panel-note {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-size: 11px;
  line-height: 1.6;
}

/* ====== 底部操作栏 ====== */
#bottombar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, .04);
}

.summary { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--c-text-secondary); white-space: nowrap; }
.dot-sep { color: var(--c-border-strong); }
#summarySize { font-weight: 600; color: var(--c-text); }

.progress-area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.progress-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 15px; }
.progress-text {
  font-size: 12px;
  color: var(--c-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-timer { font-size: 11.5px; color: var(--c-text-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums; }

.progress-track {
  height: 7px;
  border-radius: 4px;
  background: var(--c-surface-sunken);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #16A34A 0%, #22C55E 40%, #16A34A 80%);
  background-size: 220% 100%;
  transition: width .28s var(--ease);
}
.progress-fill.running { animation: flow 1.1s linear infinite; }
.progress-fill.done { background: linear-gradient(90deg, #107C10, #16A516); background-size: 100% 100%; }
.progress-fill.error { background: var(--c-danger); background-size: 100% 100%; }

@keyframes flow {
  from { background-position: 0 0; }
  to { background-position: -220% 0; }
}

.bottom-actions { display: flex; align-items: center; gap: 10px; }

/* ====== 关于对话框 ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(2px);
  z-index: 1000;
  animation: fadeIn .18s var(--ease);
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal-box {
  position: relative;
  width: 400px;
  max-width: 92vw;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
  animation: popIn .22s var(--ease);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--c-text-tertiary);
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--c-surface-sunken); color: var(--c-text); }

.about-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 14px; }
.about-logo {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #16A34A, #4ADE80);
  box-shadow: 0 4px 14px rgba(22, 163, 74, .35);
}
.about-title { font-size: 17px; font-weight: 600; margin-top: 6px; }
.about-version { font-size: 11px; color: var(--c-text-tertiary); }
.about-body {
  white-space: pre-line;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--c-text-secondary);
  margin-bottom: 14px;
}
.about-contact {
  border-top: 1px solid var(--c-border);
  padding-top: 12px;
  font-size: 12px;
  line-height: 1.8;
}
.contact-title { font-weight: 600; margin-bottom: 3px; }
.about-contact a { color: var(--c-primary); text-decoration: none; word-break: break-all; }
.about-contact a:hover { text-decoration: underline; }
.about-actions { margin-top: 18px; text-align: right; }

/* ====== Toast ====== */
.toast {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 22px;
  background: rgba(26, 26, 26, .93);
  color: #fff;
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
  z-index: 1100;
  max-width: 78vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(16, 124, 16, .96); }
.toast.error { background: rgba(209, 52, 56, .96); }

/* ====== 滚动条 ====== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #C8C6C4;
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: #A19F9D; background-clip: padding-box; }

/* ============================================================
   触屏设备：没有 hover，必须让「删除」常显、并加大触控目标
   ============================================================ */
@media (hover: none) {
  .card-remove { opacity: 1; transform: scale(1); }
  .mini-btn { width: 36px; height: 36px; }
  .lang-toggle, .ghost-btn, .nav-site { min-height: 38px; }
}

/* ============================================================
   ≤860px：菜单栏/工具栏换行；工作区左右两栏 → 上下堆叠
   ============================================================ */
@media (max-width: 860px) {
  /* 关键：解除 100% 定高，让「文档本身」滚动。
     否则 body 会变成嵌套滚动容器，移动端会出现双滚动条、地址栏收起时底部栏被裁切。 */
  html, body { height: auto; min-height: 100dvh; overflow-x: hidden; }
  #app { height: auto; min-height: 100dvh; }

  #topbar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); flex-wrap: wrap; }

  #workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    overflow: visible;
    padding: 12px;
    gap: 12px;
  }

  #leftPane { grid-template-rows: auto auto; }
  .list-section { min-height: 240px; }
  .pdf-list { max-height: 46dvh; }
  #settingsPanel { max-height: none; overflow: visible; }

  #bottombar { flex-wrap: wrap; gap: 10px; }
  .progress-area { order: 3; flex-basis: 100%; }
  .bottom-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
}

/* ============================================================
   ≤640px：隐藏次要提示文案、缩小徽章
   ============================================================ */
@media (max-width: 640px) {
  .dz-hint { display: none; }
  .store-hint { display: none; }
  .brand-sub { display: none; }
  .store-badge img { height: 32px; }
  .brand-logo { width: 34px; height: 34px; }
  .topbar-actions { gap: 6px; }
  .dz-inner { padding: 18px 14px 16px; }
  .pdf-list { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .primary-btn.lg { padding: 12px 22px; }
  .summary { font-size: 11.5px; }
}

/* ============================================================
   横屏且高度很矮：恢复左右两栏，保证主视图高度
   ============================================================ */
@media (orientation: landscape) and (max-height: 480px) {
  #app { height: 100dvh; min-height: 0; }
  #topbar { flex-wrap: nowrap; padding: 6px 12px; }
  .store-hint, .dz-hint, .brand-sub { display: none; }
  #workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    padding: 8px;
    gap: 10px;
  }
  #leftPane { grid-template-rows: auto minmax(0, 1fr); }
  .list-section { min-height: 0; }
  .pdf-list { max-height: none; }
  #settingsPanel { overflow-y: auto; }
  #bottombar { flex-wrap: nowrap; }
  .progress-area { order: 0; flex-basis: auto; }
  .dz-inner { padding: 12px 14px; }
}
