/* ===== Local Reset =====
 * 这里原本通过 CDN @import 引入 Tailwind。但项目实际并未使用任何 Tailwind 工具类
 * （HTML 中出现的 42 个 class 全部由本文件定义），@import 只是借用了它的 preflight
 * 来重置浏览器默认样式。
 * 打包成 NSIS / MSIX 后应用可能运行在离线环境，CDN 请求会失败导致样式基线丢失；
 * 且商店应用依赖外部远程资源也存在合规风险。
 * 因此改为内联等价的精简 reset，保证离线与在线表现完全一致。
 */

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* 去掉浏览器对标题/段落的默认外边距（原先依赖 Tailwind preflight） */
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 表单控件继承页面字体与配色，避免各浏览器默认样式不一致 */
button, input, optgroup, select, textarea {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
}

button, select {
  text-transform: none;
}

button, [type="button"], [type="reset"], [type="submit"] {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
}

button, [role="button"] {
  cursor: pointer;
}

/* 媒体元素按块级渲染，避免行内基线产生额外间隙 */
img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  vertical-align: middle;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* ===== Design Tokens ===== */
:root {
  --primary-1: #1D4ED8;
  --primary-2: #2563EB;
  --primary-3: #3B82F6;
  --bg-1: #E8F0FA;
  --bg-2: #FFFFFF;
  --bg-3: #D9E6F6;
  --text-1: #1F2937;
  --text-2: #4A5568;
  --text-3: #FFFFFF;
  --ok: #10B981;
  --err: #EF4444;
  --warn: #F59E0B;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(29, 78, 216, 0.45);
  --shadow-soft: 0 4px 16px -6px rgba(31, 41, 55, 0.18);
  --gradient: linear-gradient(135deg, #1D4ED8 0%, #2563EB 50%, #3B82F6 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-1);
  color: var(--text-1);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(59, 130, 246, 0.16), transparent 60%),
    var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* 移动端地址栏会占用视口高度，100vh 会把状态栏顶出可视区；dvh 才是「当前可见高度」 */
  min-height: 100dvh;
}

/* ===== Top Navigation ===== */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  /* 窄屏下菜单栏换行，而不是被内容撑出横向滚动 */
  flex-wrap: wrap;
  padding: 14px 28px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(236, 243, 253, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 4px 20px -12px rgba(37, 99, 235, 0.42);
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.app-logo .logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-3);
  padding: 5px;
  border-radius: 12px;
}
.nav-tab {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.25s ease;
}
.nav-tab.active {
  background: var(--bg-2);
  color: var(--primary-1);
  box-shadow: var(--shadow-soft);
}
.nav-tab:hover:not(.active) { color: var(--primary-1); }

/* 导航栏署名：低调但不缺席 */
.powered {
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid rgba(37, 99, 235, 0.30);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.nav-spacer { flex: 1; }

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover { box-shadow: 0 14px 34px -10px rgba(29, 78, 216, 0.60); transform: translateY(-1px); }
.btn-ghost {
  background: var(--bg-2);
  color: var(--primary-1);
  border: 1px solid rgba(37, 99, 235, 0.40);
}
.btn-ghost:hover { background: var(--bg-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== Layout ===== */
.page { flex: 1; display: none; min-height: 0; }
.page.active { display: flex; }
/* 子页面用 iframe 承载：填满可用高度 */
.page > iframe { width: 100%; height: 100%; border: 0; display: block; }

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 28px 28px;
  flex: 1;
  min-height: 0;
}

/* Editor layout: left params, center canvas, right export */
.editor-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 18px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 1200px) {
  .editor-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .editor-grid .panel-export { grid-column: 1 / -1; }
}

/* ===== Card / Panel ===== */
.card {
  background: rgba(243, 248, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.card:hover { box-shadow: 0 16px 40px -16px rgba(37, 99, 235, 0.46); }
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-1);
}
.card-title .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gradient);
}

/* ===== Form controls ===== */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
/* 目标格式 / 转换格式：加黑加粗加大 + 左侧橙色强调条，凸显交互重点 */
.field > label.fmt-label {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--primary-1);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.input, .select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(37, 99, 235, 0.34);
  border-radius: 10px;
  font-size: 14px;
  background: var(--bg-2);
  color: var(--text-1);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus, .select:focus {
  border-color: var(--primary-1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.30);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg {
  display: flex;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.seg button.active {
  background: var(--bg-2);
  color: var(--primary-1);
  box-shadow: var(--shadow-soft);
}

.checkbox {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text-1);
  cursor: pointer; user-select: none;
  padding: 6px 0;
}
.checkbox input { width: 17px; height: 17px; accent-color: var(--primary-1); }

.chip-group { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid rgba(37, 99, 235, 0.38);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.chip.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

/* ===== Canvas Stage ===== */
.stage-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.stage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tool-btn {
  border: 1px solid rgba(37, 99, 235, 0.34);
  background: var(--bg-2);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.tool-btn:hover { background: var(--bg-3); color: var(--primary-1); }
.zoom-label {
  font-size: 13px; color: var(--text-2);
  background: var(--bg-3); padding: 7px 12px; border-radius: 9px;
  min-width: 64px; text-align: center;
}
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(45deg, #eceef4 25%, transparent 25%),
    linear-gradient(-45deg, #eceef4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eceef4 75%),
    linear-gradient(-45deg, transparent 75%, #eceef4 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  border-radius: var(--radius);
  border: 1px solid rgba(37, 99, 235, 0.24);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-canvas-host {
  position: relative;
  transform-origin: top left;
}
.stage-canvas-host canvas { display: block; border-radius: 4px; }

.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-2);
  text-align: center;
  pointer-events: none;
}
.empty-hint .big {
  width: 76px; height: 76px; border-radius: 22px;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-size: 38px;
}

/* ===== Status bar ===== */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 10px 28px;
  /* 全面屏底部有 Home 手势条，留出安全区否则文字被盖 */
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(244, 248, 254, 0.80);
  border-top: 1px solid rgba(37,99,235,0.22);
  backdrop-filter: blur(8px);
}
.status-bar b { color: var(--text-1); font-weight: 600; }

/* ===== Toast ===== */
.toast-wrap {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-2);
  border-left: 4px solid var(--primary-1);
  border-radius: 12px;
  padding: 13px 18px;
  box-shadow: 0 14px 34px -10px rgba(31,41,55,0.35);
  font-size: 13.5px;
  color: var(--text-1);
  min-width: 240px;
  animation: toastIn 0.35s cubic-bezier(.22,1,.36,1);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.out { opacity: 0; transform: translateX(40px); transition: all .3s; }

/* ===== Modal ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(31,41,55,0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
.modal {
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 24px;
  width: 380px;
  box-shadow: 0 30px 60px -20px rgba(31,41,55,0.5);
  animation: modalIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn { from {opacity:0; transform: translateY(20px) scale(.97)} to {opacity:1} }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ===== Batch page ===== */
.batch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  flex: 1;
  min-height: 0;
}
.file-list { overflow: auto; min-height: 0; }
.view-toggle { display: flex; gap: 6px; }
.thumb-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.thumb-card {
  background: var(--bg-2);
  border: 1px solid rgba(37,130,246,0.24);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}
.thumb-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.thumb-card img { width: 100%; height: 110px; object-fit: cover; background: #eef1f5; }
.thumb-card .meta { padding: 9px 11px; font-size: 12px; color: var(--text-2); }
.thumb-card .meta b { color: var(--text-1); display: block; font-size: 12.5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track { height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--gradient); width: 0%; transition: width .25s; border-radius: 999px; }

.hint-text { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.divider { height: 1px; background: rgba(37,99,235,0.22); margin: 14px 0; }
.scroll-y { overflow-y: auto; }

/* ===== 图片转换工具新增组件 =====
 * 复用了既有设计令牌（渐变、圆角、阴影），只补充转换页需要的几类控件：
 * 质量滑块、输出信息表、批量文件表格、拖拽落区高亮。
 */

/* 质量滑块 */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-3);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--primary-1);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}
.slider:disabled { opacity: 0.45; cursor: not-allowed; }

/* 输出信息表（右侧「输出」卡片） */
.info-list { display: flex; flex-direction: column; gap: 9px; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-2);
}
.info-row b { color: var(--text-1); font-weight: 600; }

/* 批量文件表格（列与在线转换工具一致） */
.file-table { flex: none; }
.file-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.6fr) 92px 110px 100px 110px 88px 72px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(37,99,235,0.20);
  font-size: 13px;
}
.file-row.file-head {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  background: var(--bg-3);
  border-radius: 10px;
  border-bottom: none;
  margin-bottom: 4px;
}
.file-row .fname {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .fcell { color: var(--text-2); font-size: 12.5px; }
.file-row .badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--primary-1);
  display: inline-block;
}
.file-row .badge.ok { background: rgba(16,185,129,0.14); color: var(--ok); }
.file-row .badge.err { background: rgba(239,68,68,0.14); color: var(--err); }
.file-row .badge.run { background: rgba(245,158,11,0.16); color: var(--warn); }

/* 行内文字按钮（移除） */
.link-btn {
  border: none;
  background: transparent;
  color: var(--primary-1);
  font-size: 12.5px;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.link-btn:hover { background: var(--bg-3); color: var(--err); }

/* 缩略图卡片底部的操作区 */
.thumb-card .thumb-actions {
  padding: 0 11px 9px;
  display: flex;
  justify-content: flex-end;
}
.thumb-card .meta { padding-bottom: 6px; }

/* 拖拽落区：整页高亮，给用户明确的放置反馈 */
body.dragging::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  border: 3px dashed var(--primary-1);
  border-radius: 12px;
  background: rgba(37,99,235,0.18);
}

/* ===== 模板里原本写在内联样式里的布局（挪进 CSS，媒体查询才覆盖得动） ===== */
.drop-zone { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 14px; padding: 14px 18px; }
.toolbar-card { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 14px; padding: 14px 18px; }
.panel-stage { padding: 14px; }
.panel-queue { padding: 14px; }
.card-head { display: flex; align-items: center; margin-bottom: 12px; }
.card-title-flat { margin: 0; }
.static-hint { position: static; }
.formats-hint { margin: -6px 4px 0; align-self: flex-start; }
.hint-flat { margin: 0 0 12px; }
.btn-block { justify-content: center; width: 100%; }
.seg-auto { width: auto; flex: none; }
.status-msg { margin-left: auto; color: var(--primary-1); }
/* 工作区里的「条状」块（导入栏 / 工具栏 / 格式提示 / 状态栏）只有一行高，
   不该参与 flex 压缩：一旦被压就是文字直接裁掉，窗口一矮就必现 */
.drop-zone,
.toolbar-card,
.formats-hint,
.status-bar { flex: none; }
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.mt10 { margin-top: 10px; }

/* ===== 无障碍：视觉隐藏但仍可被读屏与爬虫读到 =====
 * 用 1×1px + clip 而不是 display:none —— 后者会连同内容一起从无障碍树里摘掉。
 * 页面 H1 就是靠这个类挂在顶部，既不参与布局也不影响观感。 */
.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;
}

/* ===== 语言菜单（构建期写入的真实 <a> 链接） ===== */
.lang-menu { position: relative; }
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(37, 99, 235, 0.40);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--primary-1);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}
.lang-toggle:hover { background: var(--bg-3); }
.caret { font-size: 11px; transition: transform 0.2s ease; }
.lang-menu.open .caret { transform: rotate(180deg); }

.lang-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 178px;
  /* 13 种语言排下来约 545px：桌面端一屏放下（560px 上限），
   * 小屏则被 70vh 压住并允许内部滚动，保证菜单位置始终收敛在视口内 */
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid rgba(37, 99, 235, 0.20);
  border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(31, 41, 55, 0.35);
  z-index: 60;
}
/* 桌面端靠 hover 更顺手，触屏端没有 hover，必须靠点击加上的 .open。
 * 只写 :hover 的话，触屏点一下反而会把菜单关掉，等于完全不可用。 */
.lang-menu:hover .lang-list,
.lang-menu.open .lang-list { display: block; }
.lang-list a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-1);
  font-size: 13.5px;
  text-decoration: none;
  touch-action: manipulation;
}
.lang-list a:hover { background: var(--bg-3); color: var(--primary-1); }
.lang-list a.active { background: var(--bg-3); color: var(--primary-1); font-weight: 600; }
/* 选中标记：用 visibility 隐藏而不是不渲染，保证各语言名称左边缘对齐 */
.lang-check { width: 1.1em; flex: none; color: var(--primary-1); font-size: 12px; }
.lang-check.is-off { visibility: hidden; }

/* ===== 品牌位：桌面版入口（外链，href 由构建脚本按语言带上商店 locale） ===== */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 5px 12px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text-1);
  text-decoration: none;
  touch-action: manipulation;
}
.store-badge:hover { background: var(--bg-3); }
.store-badge-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  flex: none;
}
.store-badge-text { display: flex; flex-direction: column; line-height: 1.25; }
.store-badge-text b { font-size: 12.5px; font-weight: 600; }
.store-badge-text span { font-size: 11px; color: var(--text-2); }
.store-badge-arrow { color: var(--primary-1); font-size: 13px; }

/* ===== 触屏：加大触控目标，去掉 300ms 点击延迟 ===== */
.btn, .nav-tab, .tool-btn, .seg button, .chip, .checkbox,
.lang-toggle, .lang-list a, .store-badge, .link-btn {
  touch-action: manipulation;
}
.btn { min-height: 40px; }
.tool-btn { min-height: 38px; }
.nav-tab { min-height: 38px; }
.seg button { min-height: 36px; }
.link-btn { min-height: 32px; }

/* ===== 移动端适配 ===== */
/* ≤860px：菜单栏/工具栏换行；工作区由左右两栏改为上下堆叠 */
@media (max-width: 860px) {
  .app-nav { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 10px 12px; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .nav-tab { white-space: nowrap; }
  /* 窄屏整体改成「整页滚动」：workspace 与其下每个块都不再被 100dvh 压缩
     （flex:1 0 auto = 内容矮时铺满、内容高时撑开而不收缩） */
  .workspace { flex: 1 0 auto; padding: 14px 14px 18px; gap: 14px; }
  .workspace > * { flex: none; }
  /* 堆叠成单列后，卡片不能再各自滚动：栅格容器还有 flex:1/min-height:0 的高度约束，
     卡片会被压成几十像素高、内容被裁掉（只能靠卡片内滚动条看），手机上完全不可用。
     这里让它高度随内容撑开，改由整页滚动。 */
  .editor-grid,
  .batch-grid { grid-template-columns: minmax(0, 1fr); flex: none; }
  .editor-grid > .card,
  .batch-grid > .card { overflow: visible; }
  .editor-grid .panel-export { grid-column: auto; }
  .panel-stage { min-height: 240px; }
  /* 必须同时关掉 wrap：flex-direction:column + flex-wrap:wrap 会把条目「折成多列」，
     容器宽度随之内爆到内容宽度，窄屏直接横向溢出 */
  .drop-zone,
  .toolbar-card { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; }
  .status-bar { padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); gap: 6px 14px; }
  .status-msg { margin-left: 0; width: 100%; }
  /* 文件表格 7 列在窄屏放不下：只留文件名 / 原格式 / 状态 / 操作 */
  .file-row { grid-template-columns: minmax(88px, 1.6fr) 82px 76px 64px; }
  .file-row > :nth-child(3),
  .file-row > :nth-child(4),
  .file-row > :nth-child(5) { display: none; }
}

/* ≤640px：隐藏次要提示文案，缩小徽章，收紧内边距 */
@media (max-width: 640px) {
  .formats-hint { display: none; }
  /* 徽章只留主标语，避免在 320px 宽的屏幕上把导航挤成三行 */
  .store-badge-text span { display: none; }
  .store-badge { padding: 5px 9px; gap: 7px; }
  .card { padding: 14px; }
  .checkbox { padding: 10px 0; }
  .checkbox input { width: 20px; height: 20px; }
  .modal { width: min(380px, 92vw); padding: 18px; }
  .toast-wrap { left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; }
  .powered { display: none; }
  .thumb-view { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
}

/* 横屏且很矮：恢复左右两栏，保证主视图（画布/队列）还有高度 */
@media (max-height: 480px) and (orientation: landscape) {
  .app-nav { position: static; }
  .editor-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .batch-grid { grid-template-columns: minmax(0, 1fr) 240px; }
}

/* ===== 防止窄屏横向溢出 =====
 * 栅格轨道默认是 minmax(auto, 1fr)，而栅格项默认 min-width:auto：
 * 只要里面有一个「内容偏宽」的元素（画布、长文件名、长语种名），整条轨道就会被撑得
 * 比容器还宽，页面于是横向溢出。这里给栅格项 min-width:0，
 * 让内部 overflow 容器去承担滚动。 */
.workspace > *,
.editor-grid > *,
.batch-grid > * { min-width: 0; }
