/* ============================================================
   Pictures to PDF — Fluent 风格现代桌面 UI
   ============================================================ */

:root {
  /* 主色 */
  --c-primary: #0078D4;
  --c-primary-hover: #106EBE;
  --c-primary-active: #005A9E;
  --c-primary-soft: #E8F3FD;

  /* 背景与表面 */
  --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-success-soft: #E7F5E7;
  --c-danger: #D13438;
  --c-danger-soft: #FDECEC;
  --c-warning: #FFB900;

  /* 阴影 */
  --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%;
  overflow: hidden;
  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; }

/* ====== 应用骨架 ====== */
#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  /* 移动端地址栏会吃掉视口高度，100dvh 能避免底部操作栏被裁切 */
  height: 100dvh;
  background: var(--c-bg);
}

/* ====== 顶部标题栏 ====== */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

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

/* 品牌徽章：与 UWP 图标包同一套配色（深红 → 暖橙渐变） */
.brand-logo {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #DC2626 0%, #EA580C 55%, #F97316 100%);
  box-shadow: 0 3px 10px rgba(220, 38, 38, .32);
}

.brand-text { display: flex; flex-direction: column; gap: 2px; }
.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; }

.lang-wrap { position: relative; display: flex; align-items: center; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  min-height: 32px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.lang-btn:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.lang-btn:focus-visible {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, .16);
}
.lang-icon { color: var(--c-text-tertiary); flex: 0 0 auto; }
.lang-caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--c-text-secondary);
  transition: transform var(--t-fast);
}
.lang-wrap.open .lang-caret { transform: rotate(180deg); }

/* 语言菜单：内容是真实的 <a href="/xx/"> 链接（构建期写入），触屏点击即可切换 */
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: none;
  min-width: 176px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 6px;
  margin: 0;
  list-style: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
}
.lang-wrap.open .lang-menu { display: block; }
.lang-menu a.lang-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 32px;
  border-radius: 6px;
  color: var(--c-text);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
}
.lang-menu a.lang-link:hover { background: var(--c-surface-sunken); }
.lang-menu li.active a.lang-link {
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-weight: 600;
}
.lang-menu .mi-icon { width: 12px; color: var(--c-primary); font-size: 11px; }

/* ====== 按钮 ====== */
.primary-btn {
  padding: 9px 20px;
  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(0, 120, 212, .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(0, 120, 212, .38); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled {
  background: #C8C6C4;
  box-shadow: none;
  color: #FFFFFF;
}
.primary-btn.lg { padding: 11px 34px; font-size: 14px; border-radius: 10px; }

.secondary-btn {
  padding: 9px 16px;
  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; font-size: 12px; }

.ghost-btn {
  padding: 7px 14px;
  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); }
/* 与 ghost-btn 同外观的外链（官网入口） */
.link-btn { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; }

.danger-btn {
  padding: 11px 26px;
  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: 28px; height: 28px;
  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::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 120, 212, .05), rgba(0, 120, 212, 0));
  opacity: 0;
  transition: opacity var(--t-base);
  pointer-events: none;
}
.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(0, 120, 212, .12);
}
.dropzone.drag-over::after { opacity: 1; }

.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; }
.dz-hint { margin-top: 4px; font-size: 11px; color: var(--c-text-tertiary); }

/* ====== 图片列表 ====== */
.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;
  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; }

.image-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;
}

/* 图片卡片 */
.img-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;
}
.img-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 120, 212, .5);
}
.img-card.dragging { opacity: .4; transform: scale(.97); cursor: grabbing; }
.img-card.drop-target { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(0, 120, 212, .18); }
.img-card.failed { border-color: var(--c-danger); }

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

.card-thumb-wrap {
  position: relative;
  width: 100%;
  /* padding-bottom: 100% 强制方形（padding 相对 width 计算），比 aspect-ratio 更可靠 */
  height: 0;
  padding-bottom: 100%;
  background:
    linear-gradient(45deg, #F5F6F7 25%, transparent 25%, transparent 75%, #F5F6F7 75%),
    linear-gradient(45deg, #F5F6F7 25%, #FAFBFC 25%, #FAFBFC 75%, #F5F6F7 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.card-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-thumb-err {
  color: var(--c-text-tertiary);
  font-size: 11px;
}

.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: 22px; height: 22px;
  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);
}
.img-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; font-size: 11px; color: var(--c-text-tertiary); }
.card-badge {
  align-self: flex-start;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--c-primary-soft);
  color: var(--c-primary-active);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
}
.card-badge.err { background: var(--c-danger-soft); color: var(--c-danger); }
.card-badge.ok { background: var(--c-success-soft); color: var(--c-success); }

/* ====== 参数设置面板 ====== */
#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; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--c-text-secondary);
  border-bottom: 1.6px solid var(--c-text-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.field-select, .field-input {
  width: 100%;
  padding: 9px 30px 9px 11px;
  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 { padding-right: 11px; }
.field-select { appearance: none; cursor: pointer; }
.field-select:hover, .field-input:hover { border-color: var(--c-primary); }
.field-select:focus, .field-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, .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: 8px 6px;
  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);
}

.dir-row { display: flex; align-items: center; gap: 8px; }
.dir-text {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--c-surface-sunken);
  font-size: 11.5px;
  color: var(--c-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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;
  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, #0078D4 0%, #2B9AE8 40%, #0078D4 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;
  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;
  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: 26px; height: 26px;
  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, #DC2626, #F97316);
  box-shadow: 0 4px 14px rgba(220, 38, 38, .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; }
.about-contact a:hover { text-decoration: underline; }
.about-actions { margin-top: 18px; text-align: right; }

/* ====== Toast ====== */
.toast {
  position: fixed;
  bottom: 84px;
  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; }

/* ====== 视觉隐藏主标题（供搜索引擎与读屏识别，不参与布局）====== */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ====== 品牌位：官网入口 + 商店徽章 ====== */
.store-hint { font-size: 11px; color: var(--c-text-tertiary); white-space: nowrap; }
.store-badge { display: flex; align-items: center; }
.store-badge a { display: inline-flex; }
.store-badge img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 6px;
  transition: transform var(--t-fast), filter var(--t-fast);
}
.store-badge img:hover { transform: translateY(-1px); filter: brightness(1.08); }

/* ====== 保存方式说明（网页版没有「保存位置」）====== */
.save-note {
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--c-surface-sunken);
  color: var(--c-text-secondary);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ====== 卡片排序按钮（触屏没有 hover 拖放，用按钮兜底）====== */
.card-move { display: flex; gap: 6px; margin-top: 6px; }
.move-btn {
  flex: 1;
  min-height: 28px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: var(--c-surface-alt);
  color: var(--c-text-secondary);
  font-size: 11px;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.move-btn:hover:not(:disabled) {
  background: var(--c-primary-soft);
  border-color: var(--c-primary);
  color: var(--c-primary-active);
}
.move-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 触控优化：消除 300ms 点击延迟与双击缩放 */
button, a, select, input, .img-card { touch-action: manipulation; }

/* 底部操作栏避开手机手势条 */
#bottombar { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ====== 响应式 ====== */
/* ≤860px：菜单栏/操作栏换行，工作区由左右两栏改为上下堆叠 */
@media (max-width: 860px) {
  #topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .brand-sub { display: none; }
  .topbar-actions { flex-wrap: wrap; }
  #workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
  }
  #settingsPanel { max-height: none; }
  #bottombar { flex-wrap: wrap; gap: 10px; }
  .progress-area { flex-basis: 100%; order: 3; }
}

/* ≤640px：隐藏次要提示文案，缩小徽章与留白 */
@media (max-width: 640px) {
  .dz-sub, .dz-hint, .store-hint, .list-count { display: none; }
  /* 菜单的水平位置由 main.js 按视口宽度收敛，这里只限制高度 */
  .lang-menu { max-height: 62vh; }
  .dz-inner { padding: 18px 14px 16px; }
  .brand-title { font-size: 14px; }
  .store-badge img { height: 32px; }
  .bottom-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .bottom-actions .primary-btn.lg { padding: 11px 20px; }
  .image-list { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; padding: 10px; }
  .mini-btn { width: 32px; height: 32px; }
  .modal-box { padding: 20px; }
}

/* 横屏且高度很小：恢复左右两栏，保证主视图高度 */
@media (orientation: landscape) and (max-height: 480px) {
  #workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
    grid-template-rows: minmax(0, 1fr);
  }
  .dz-inner { padding: 12px; }
  .dz-icon, .dz-sub, .dz-hint { display: none; }
}
