/* ============================================================
   链存 LinkSaver — T 型布局
   顶栏通栏（T 横）+ 居中单列内容流（T 竖），参照 smallpdf 工具页：
   大标题居中、工具卡为页面主体、按钮与次级入口收进导航栏。
   字号固定 rem 字阶，不随视口缩放，保留浏览器字号偏好。
   ============================================================ */

:root {
  --bg: #edf1ec;
  --panel: #eff3ee;
  --inset: #e3e8e3;
  --pill: #e2e7e2;
  --line: #d4ddd6;
  --line-2: #e4eae4;

  --ink: #242924;
  --ink-2: #3f473f;
  --muted: #6d766c;   /* 辅助文字，≥4.5:1 */
  --muted-2: #879188; /* 时间戳等弱信息，≈3:1 */

  --green: #b2d2c0;
  --green-2: #a4cbb6;
  --green-3: #d9e9df;
  --green-ink: #2c4a39;
  --green-deep: #457c60;   /* 主操作底色，白字 ≈4.9:1 */
  --green-deep-2: #3c6d54;

  --danger: #b4553f;
  --danger-2: #9d4a36;
  --warn: #8d6b28;
  --bar: #dfe4e0;

  --r: .75rem;
  --r-sm: .5625rem;

  --pad: 1.75rem;
  --gap: 1.0625rem;
  --top: 4.5rem;
  --bar-h: 1.75rem;

  /* 字阶：固定 rem；12→13→14→15→18→19→22→32 拉开层级 */
  --fs-xs: .75rem;     /* 12px 时间戳、微注、行内操作 */
  --fs-sm: .8125rem;   /* 13px 辅助信息、状态行 */
  --fs-md: .875rem;    /* 14px 次要正文、弹层菜单 */
  --fs-base: .9375rem; /* 15px 正文与控件 */
  --fs-lg: 1.125rem;   /* 18px 卡片标题 */
  --fs-xl: 1.1875rem;  /* 19px 结果标题 */
  --fs-sub: 1.375rem;  /* 22px 区块标题（备用强调档） */
  --fs-hero: 2rem;     /* 32px 页面主标题 */

  --sans: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
          "Source Han Sans SC", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* 字号固定：尊重浏览器字号偏好；需要放大走 Ctrl + / Ctrl - 整页缩放 */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-bottom: var(--bar-h);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; }
ul { padding: 0; list-style: none; }
button { font-family: inherit; }
img { display: block; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
  position: absolute;
  left: .75rem; top: -3rem;
  z-index: 100;
  padding: .5rem .875rem;
  border-radius: .5rem;
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: top .15s ease;
}
.skip:focus { top: .75rem; }

:focus-visible { outline: 2px solid #82bb9c; outline-offset: 2px; }

::selection { background: rgba(178, 210, 192, .5); color: var(--ink); }

.ic {
  width: 1.125rem; height: 1.125rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic--13 { width: .8125rem; height: .8125rem; }
.ic--14 { width: .875rem; height: .875rem; }
.ic--16 { width: 1rem; height: 1rem; }
.ic--20 { width: 1.25rem; height: 1.25rem; }

/* ---------------- 顶栏（T 横） ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  height: var(--top);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  text-decoration: none;
}
.logo__mark { width: 2rem; height: 2rem; flex: 0 0 auto; }
.logo__cn { font-size: 1.375rem; font-weight: 600; letter-spacing: .02em; }
.logo__en { font-size: 1.0625rem; font-weight: 500; color: var(--muted); }

.topbar__nav { display: flex; align-items: center; gap: .625rem; }
.topbar__nav .btn { height: 2.5rem; padding: 0 1.5rem; font-size: 1rem; }

/* ---------------- 居中单列（T 竖） ---------------- */
.page {
  width: min(52rem, 100%);
  margin: 0 auto;
  padding: 0 var(--pad) 3rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.hero {
  text-align: center;
  margin: 2.75rem 0 1.25rem;
}
.hero h1 {
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.25;
}
.hero p {
  max-width: 40rem;
  margin: .75rem auto 0;
  font-size: 1.125rem;
  line-height: 1.7;
  text-wrap: pretty;
  color: var(--muted);
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .75rem 1.125rem .8125rem;
  min-height: 0;
}

.card__head {
  display: flex;
  align-items: baseline;
  gap: .625rem;
  min-height: 1.5rem;
  margin-bottom: .625rem;
}

.card__title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .02em;
  color: var(--ink);
}

.card__aside {
  margin-left: auto;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 解析工具卡 ---------------- */
.tool {
  padding: 1.5rem 1.5rem 1.375rem;
  border-radius: 1.125rem;
}

/* 平台选择：四个品牌 Logo 定宽居中（不随卡片拉满） */
.pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .875rem;
}

.pill {
  display: grid;
  place-items: center;
  width: 6.25rem;
  height: 3.75rem;
  border: 1px solid transparent;
  border-radius: .875rem;
  background: var(--pill);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.pill:hover { background: #dce3db; }
.pill:active { transform: scale(.97); }
.pill:focus-visible { outline-offset: 1px; }
.pill__logo { display: block; width: 2.5rem; height: 2.5rem; }

.pill[data-pf="douyin"][aria-checked="true"] { background: #f3f3f6; border-color: #c9c9d6; box-shadow: 0 1px 4px rgba(17, 20, 24, .08); }
.pill[data-pf="bilibili"][aria-checked="true"] { background: #e6f4fb; border-color: #a6d3ea; box-shadow: 0 1px 4px rgba(0, 161, 214, .12); }
.pill[data-pf="xiaohongshu"][aria-checked="true"] { background: #fdecee; border-color: #f5b3bc; box-shadow: 0 1px 4px rgba(255, 36, 66, .12); }
.pill[data-pf="kuaishou"][aria-checked="true"] { background: #fff2e5; border-color: #f2bd8b; box-shadow: 0 1px 4px rgba(255, 102, 0, .12); }

.field {
  display: block;
  width: 100%;
  height: 10rem;
  margin-top: 1rem;
  padding: .875rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--inset);
  color: var(--ink);
  font-family: inherit;
  font-size: 1.0625rem;
  line-height: 1.65;
  resize: none;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field::placeholder { color: var(--muted-2); }
.field:focus {
  border-color: #b4d2bf;
  box-shadow: 0 0 0 3px rgba(178, 210, 192, .26);
}

.tool__row {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-top: 1rem;
}
.tool__row .btn--primary {
  flex: 1 1 auto;
  height: 3.5rem;
  font-size: 1.125rem;
  font-weight: 500;
}
.tool__row .btn { height: 3.5rem; padding: 0 1.625rem; }

.paste__hint {
  margin-top: .5rem;
  min-height: 1.0625rem;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.paste__hint[data-tone="warn"] { color: var(--warn); }
.paste__hint[data-tone="info"] { color: #4a7a63; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  height: 2.25rem;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease;
}
.btn:hover { background: #dce3db; }
.btn:active { transform: scale(.985); }

.btn--primary { background: var(--green-deep); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn--primary:hover { background: var(--green-deep-2); }
.btn--primary:disabled { background: #c3d2c8; color: #f2f7f3; cursor: not-allowed; }

.btn--ghost { background: none; color: var(--ink-2); }
.btn--ghost:hover { background: var(--pill); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-2); }

/* ---------------- 解析结果 ---------------- */
.res__main {
  display: grid;
  grid-template-columns: 9.75rem minmax(0, 1fr);
  gap: .875rem;
  align-items: start;
}

.res__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #dfe5de;
  box-shadow: inset 0 0 0 1px rgba(30, 40, 30, .07);
}
.res__cover img { width: 100%; height: 100%; object-fit: cover; }

.res__play { position: absolute; inset: 0; display: grid; place-items: center; }
.res__play i {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(20, 26, 20, .18);
  transition: transform .18s ease, background .18s ease;
}
.res__cover:hover .res__play i { transform: scale(1.08); background: #fff; }
.res__play svg { width: .75rem; height: .75rem; margin-left: 2px; fill: #2b342b; stroke: none; }

.res__title {
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.res__meta {
  margin-top: .4375rem;
  font-size: var(--fs-sm);
  line-height: 1.62;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.res__meta span { display: block; }
.nb { white-space: nowrap; }
.res__meta b { font-weight: 400; color: var(--ink-2); }

.res__desc {
  margin-top: .375rem;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
}

.quals { display: flex; flex-wrap: wrap; gap: .4375rem; margin-top: .75rem; }

.qchip {
  display: inline-flex;
  font-variant-numeric: tabular-nums;
  align-items: center;
  gap: .3125rem;
  height: 2rem;
  padding: 0 .6875rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: var(--pill);
  color: #4b544b;
  font-size: var(--fs-md);
  font-family: var(--mono);
  letter-spacing: -.01em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.qchip:hover { background: #dde4dc; }
.qchip[aria-checked="true"] {
  background: var(--green-3);
  border-color: #bdd9c8;
  color: var(--green-ink);
}
/* 选中态的 ✓ 常驻 DOM，用可见性切换，避免整组重建导致焦点丢失 */
.qchip .ic { display: none; color: #4f8a6c; }
.qchip[aria-checked="true"] .ic { display: block; }
.qchip__tag { font-family: var(--sans); font-size: var(--fs-xs); color: var(--warn); }

.res__act { display: flex; align-items: center; gap: .375rem; margin-top: .75rem; }
.res__wrap { position: relative; }

.btn--dl {
  flex: 1 1 auto;
  height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--green-deep);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: background .16s ease, transform .12s ease;
}
.btn--dl:active { transform: scale(.992); }
.btn--dl:hover { background: var(--green-deep-2); }
.btn--dl:disabled { background: #c3d2c8; color: #f2f7f3; cursor: not-allowed; }

.btn--more {
  display: grid;
  place-items: center;
  width: 1.875rem; height: 1.875rem;
  padding: 0;
  border: 0;
  border-radius: .5rem;
  background: none;
  color: #7d857d;
  cursor: pointer;
}
.btn--more:hover { background: var(--pill); color: var(--ink-2); }

.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 9.75rem;
  padding: .3125rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfdfa;
  box-shadow: 0 10px 26px -10px rgba(30, 40, 30, .26);
}
.pop button {
  display: block;
  width: 100%;
  padding: .5rem .625rem;
  border: 0;
  border-radius: .375rem;
  background: none;
  color: var(--ink-2);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.pop button:hover { background: var(--pill); }
.pop button:disabled { color: #bcc4bb; background: none; cursor: not-allowed; }

/* 结果卡内的次级操作行（复制文案 / 仅音频） */
.res__sub {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4375rem;
}
.res__sub button {
  padding: .25rem .125rem;
  border: 0;
  border-radius: .375rem;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.res__sub button:hover:not(:disabled) { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.res__sub button:disabled { color: #b7bfb6; cursor: not-allowed; }
.res__sub > span { color: var(--muted-2); }

.blank {
  padding: 1.25rem 0 1.125rem;
  text-align: center;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--muted-2);
}
/* 卡片里只有一句空态时，垂直居中显示 */
.card__body:has(> .blank:only-child) { display: grid; place-items: center; }

/* ---------------- 队列 ---------------- */
/* 队列卡横向拉长：超出单列宽度、以页面中线居中 */
#queueCard {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(62rem, calc(100vw - var(--pad) * 2));
}

/* 一次显示 5~6 行，其余在卡内滚动查看 */
#jobs {
  max-height: 26.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 41, 36, .18) transparent;
  padding-right: .375rem;
}
#jobs::-webkit-scrollbar { width: 6px; }
#jobs::-webkit-scrollbar-track { background: transparent; }
#jobs::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(36, 41, 36, .18); }

/* 飞入动画的落点脉冲 */
@keyframes qpulse {
  from { box-shadow: 0 0 0 0 rgba(69, 124, 96, .4); }
  to { box-shadow: 0 0 0 16px rgba(69, 124, 96, 0); }
}
#queueCard.qpulse { animation: qpulse .7s ease-out; }

/* 文件包飞行元素（WAAPI 控制位移） */
.fly {
  position: fixed;
  z-index: 90;
  width: 2.5rem;
  height: 2.5rem;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(20, 40, 28, .35));
}
.fly svg { width: 100%; height: 100%; display: block; }

/* 卡头右侧「全部删除」 */
.queue__clear {
  margin-left: .75rem;
  padding: .25rem .75rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease;
}
.queue__clear:hover { background: rgba(180, 85, 63, .09); }

.queue__row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .875rem;
  padding: .625rem 0;
}
.queue__row + .queue__row { border-top: 1px solid var(--line-2); }

/* 缩略图统一 16:9，封面铺满形状；无封面时回落平台色块 */
.thumb {
  display: grid;
  place-items: center;
  width: 5.5rem;
  aspect-ratio: 16 / 9;
  border-radius: .5rem;
  overflow: hidden;
  background: #dfe5de;
  color: #5c6a5e;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(30, 40, 30, .06);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb > span, .thumb > img { grid-area: 1 / 1; }
.thumb[data-pf="douyin"] { background: #e6e6e8; color: #3a3a42; }
.thumb[data-pf="kuaishou"] { background: #f5e4d9; color: #8a4a22; }
.thumb[data-pf="bilibili"] { background: #dfe9ec; color: #26606d; }
.thumb[data-pf="xiaohongshu"] { background: #f3e0e1; color: #8a3038; }

.queue__main { min-width: 0; }
.queue__name {
  font-size: var(--fs-base);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue__note {
  margin-top: .125rem;
  font-size: var(--fs-xs);
  color: var(--warn);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  position: relative;
  height: .25rem;
  margin-top: .5rem;
  border-radius: 999px;
  background: #e2e8e1;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #9ccab4;
  transition: width .35s ease;
}
.bar[data-status="failed"] > i { background: #dcae9f; }
.queue__row:has(.bar[data-status="failed"]) .queue__note { color: var(--danger); }

/* 行内操作：打开目录 / 删除文件 / 删除记录 */
.queue__acts {
  display: flex;
  flex-wrap: wrap;
  gap: .125rem .75rem;
  margin-top: .375rem;
}
.queue__link {
  padding: 0;
  border: 0;
  border-radius: .25rem;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}
.queue__link:hover { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.queue__link--danger:hover { color: var(--danger); }

.queue__status {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 2.75em;
  white-space: nowrap;
  cursor: pointer;
}
.queue__status:hover { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.queue__status[data-status="failed"] { color: var(--danger); }
.queue__status[data-status="downloading"] { color: #4a7a63; }
.queue__status[data-status="queued"] { color: var(--muted); }

/* ---------------- 历史记录行（抽屉内复用） ---------------- */
.recent__row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .875rem;
  padding: .5625rem 0;
  cursor: pointer;
  transition: background .15s ease;
}
.recent__row + .recent__row { border-top: 1px solid var(--line-2); }
.recent__row:hover { background: rgba(34, 41, 34, .03); }

.recent__main { min-width: 0; }
.recent__name {
  font-size: var(--fs-base);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent__time {
  margin-top: .0625rem;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.recent__state { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }

/* ---------------- 底部状态条 ---------------- */
.statusbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--bar-h);
  padding: 0 var(--pad);
  border-top: 1px solid #d6ddd7;
  background: var(--bar);
  font-size: var(--fs-sm);
  color: #4a534a;
  font-variant-numeric: tabular-nums;
}
.statusbar__cell {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  white-space: nowrap;
}
.statusbar__cell > span:first-child { flex: 0 0 auto; }
.statusbar__cell--mid {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #6b746b;
}
.statusbar__path {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 46vw;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: #6b746b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.statusbar__right { color: #4a534a; }
.statusbar__right::before {
  content: "";
  width: .375rem; height: .375rem;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(120, 132, 120, .1);
  transition: background .2s ease, box-shadow .2s ease;
}
.statusbar__right[data-state="ok"] { color: #3c6a52; }
.statusbar__right[data-state="ok"]::before {
  background: #5aa87e;
  box-shadow: 0 0 0 3px rgba(90, 168, 126, .16);
}
.statusbar__right[data-state="bad"] { color: var(--danger); }
.statusbar__right[data-state="bad"]::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 85, 63, .14);
}

/* ---------------- 抽屉（历史 / 设置共用） ---------------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer__mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 32, 26, .28);
  backdrop-filter: blur(1.5px);
}
.drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(32rem, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px -26px rgba(20, 30, 20, .4);
  animation: slide .22s ease both;
}
@keyframes slide { from { transform: translateX(18px); opacity: .6; } }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.375rem .875rem;
  border-bottom: 1px solid var(--line);
}
.drawer__head h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: .02em; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border: 0;
  border-radius: .5rem;
  background: none;
  color: #6f786e;
  cursor: pointer;
}
.icon-btn:hover { background: var(--pill); color: var(--ink); }

.drawer__body {
  flex: 1;
  overflow: auto;
  padding: .25rem 1.375rem 1.5rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 41, 36, .14) transparent;
}
.drawer__body::-webkit-scrollbar { width: 6px; }
.drawer__body::-webkit-scrollbar-track { background: transparent; }
.drawer__body::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(36, 41, 36, .14); }

.fs { margin: 0; padding: 1.125rem 0 .375rem; border: 0; }
.fs:first-child { padding-top: .625rem; }
.fs + .fs { border-top: 1px solid var(--line-2); }
.fs legend {
  padding: 0;
  color: #5f695e;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
}
.fs__note { margin: .5rem 0 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--muted-2); }

.f { display: block; margin-top: .75rem; font-size: var(--fs-sm); color: #5b645a; }
.f input {
  display: block;
  width: 100%;
  height: 2.375rem;
  margin-top: .375rem;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--inset);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-md);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.f input:focus {
  border-color: #b4d2bf;
  box-shadow: 0 0 0 3px rgba(178, 210, 192, .26);
}
.f__note { display: block; margin-top: .3125rem; font-size: var(--fs-xs); color: var(--muted-2); }
.f + .f { margin-top: .875rem; }

.drawer__foot {
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 -10px 24px -22px rgba(24, 32, 24, .45);
}
.drawer__foot .btn { width: 100%; height: 2.625rem; }

/* 抽屉内独立的操作行 */
.drawer__action { margin-top: .75rem; }

/* ---------------- 确认弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}
.modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 32, 26, .32);
  backdrop-filter: blur(1.5px);
}
.modal__panel {
  position: relative;
  width: min(24rem, calc(100% - 2rem));
  padding: 1.25rem 1.375rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: 0 18px 48px -20px rgba(20, 28, 20, .45);
  animation: pop .18s ease both;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .5; } }
.modal__panel h3 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: .02em; }
.modal__panel p {
  margin-top: .5rem;
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--muted);
}
/* 确认弹窗内的可选项（如：同时删除本地文件） */
.modal__check {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .875rem;
  padding: .5rem .6875rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--inset);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.modal__check input {
  width: 1.0625rem;
  height: 1.0625rem;
  margin: 0;
  accent-color: var(--danger);
  cursor: pointer;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.125rem;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + 1.125rem);
  z-index: 80;
  padding: .5625rem 1.125rem;
  border-radius: 999px;
  background: #2c352c;
  color: #f4f8f3;
  font-size: var(--fs-md);
  box-shadow: 0 8px 24px -12px rgba(20, 28, 20, .5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  :root { --pad: 1rem; --gap: .875rem; --top: 3.5rem; --bar-h: 1.75rem; }

  body { padding-bottom: var(--bar-h); }

  .page { padding-bottom: 2rem; }
  .hero { margin-top: 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: var(--fs-base); }

  .topbar__in { height: auto; min-height: 4rem; padding-top: .5rem; padding-bottom: .375rem; }
  .logo__mark { width: 1.75rem; height: 1.75rem; }
  .logo__cn { font-size: 1.25rem; }
  .logo__en { display: none; }
  .topbar__nav .btn { height: 2.375rem; padding: 0 1.25rem; }

  .card { padding: .875rem .9375rem; }
  .card__title { font-size: 1.125rem; }
  .tool { padding: 1.125rem .9375rem 1rem; }
  .field { height: 7.5rem; }
  .pills { gap: .625rem; }
  .pill { width: 5.25rem; height: 3.125rem; border-radius: .75rem; }
  .pill__logo { width: 2.125rem; height: 2.125rem; }
  .btn { height: 2.25rem; padding: 0 1.125rem; font-size: var(--fs-base); }
  .tool__row .btn, .tool__row .btn--primary { height: 2.875rem; }

  /* 队列拉长卡在窄屏复位为通栏 */
  #queueCard { left: 0; transform: none; width: 100%; }

  .res__main { grid-template-columns: 7.75rem minmax(0, 1fr); gap: .75rem; }
  .res__title { font-size: 1.0625rem; }

  .queue__row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: .625rem; }
  .thumb { width: 4.5rem; }
  #jobs { max-height: 22rem; }
  .recent__row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: .625rem; }
  .statusbar { font-size: var(--fs-xs); }
  .statusbar__path { max-width: 52vw; }
}

@media (max-width: 460px) {
  .pill { width: 5rem; }
  .res__main { grid-template-columns: minmax(0, 1fr); }
  .res__cover { aspect-ratio: 16 / 9; }
  .tool__row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ============================================================
   视觉层：青绿工作台
   与品牌标记同色系（叶绿 + 墨绿），弃用蓝紫渐变与靛蓝按钮；
   工具卡与队列卡同宽对齐，平台选项白底描边选中。
   ============================================================ */
:root {
  --bg: #f4f8f5;
  --panel: #ffffff;
  --inset: #f6f9f7;
  --pill: #eff5f1;
  --line: #dde8e1;
  --line-2: #eef3ef;

  --ink: #16241c;
  --ink-2: #33443a;
  --muted: #63756a;
  --muted-2: #8a9a8f;

  --green-deep: #276b53;
  --green-deep-2: #1f5945;
  --green-3: #e6f2eb;
  --green-ink: #225c47;

  --danger: #bf4436;
  --danger-2: #a2382c;

  --r: 1.125rem;
  --shadow: 0 14px 36px -20px rgba(24, 62, 44, .28);
}

body {
  background:
    radial-gradient(60rem 32rem at 12% -8%, #e8f3ec 0, transparent 60%),
    radial-gradient(52rem 30rem at 92% 2%, #eaf3f4 0, transparent 58%),
    var(--bg);
}

/* 顶栏：白毛玻璃，边界只留一条极淡发丝线 */
.topbar {
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(219, 231, 223, .9);
  backdrop-filter: blur(14px);
}
.topbar__in { max-width: 62rem; }
.logo__cn { color: #16241c; letter-spacing: .01em; }
.logo__en { color: #7b8b80; letter-spacing: .03em; }
.topbar__nav .btn:not(.btn--ghost) {
  background: #fff;
  border-color: var(--line);
}
.topbar__nav .btn:not(.btn--ghost):hover { background: var(--pill); }

/* 单列内容：工具卡与队列卡同宽，页面中线对齐 */
.page { width: 100%; max-width: 56rem; padding-bottom: 4rem; }

.hero { margin: 3rem 0 1.5rem; }
.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.05rem);
  letter-spacing: -.03em;
  line-height: 1.14;
  color: #12211a;
}
.hero p {
  max-width: 42rem;
  margin-top: .875rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: #63756a;
}

.card {
  padding: 1.5rem;
  border: 1px solid rgba(216, 229, 220, .95);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.tool { padding: 1.625rem; }

/* 平台：四等分白底块，选中态用品牌色描边而非整块染色 */
.pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .7rem;
}
.pill {
  display: grid;
  place-items: center;
  width: auto;
  height: 4.25rem;
  border: 1px solid #e6ede8;
  border-radius: .875rem;
  background: #f8fbf9;
  box-shadow: none;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .14s ease;
}
.pill:hover { background: #f2f8f4; border-color: #d6e4da; }
.pill:active { transform: scale(.985); }
.pill__logo { width: 2.125rem; height: 2.125rem; opacity: .84; transition: opacity .18s ease; }
.pill:hover .pill__logo { opacity: 1; }
.pill[aria-checked="true"] { background: #fff; box-shadow: 0 6px 18px -10px rgba(24, 62, 44, .38); }
.pill[aria-checked="true"] .pill__logo { opacity: 1; }
.pill[data-pf="douyin"][aria-checked="true"] { border-color: #22252b; }
.pill[data-pf="bilibili"][aria-checked="true"] { border-color: #45b3d8; }
.pill[data-pf="xiaohongshu"][aria-checked="true"] { border-color: #ef5f6d; }
.pill[data-pf="kuaishou"][aria-checked="true"] { border-color: #f0863c; }

.field {
  height: 8.25rem;
  border-color: #dbe6df;
  border-radius: .875rem;
  background: var(--inset);
}
.field:focus {
  border-color: #9ec9b3;
  box-shadow: 0 0 0 4px rgba(39, 107, 83, .1);
}

/* 主操作：与 logo 同族的墨绿，白字对比度 ≈5.3:1 */
.tool__row .btn--primary,
.btn--dl,
.btn--primary {
  background: var(--green-deep);
  box-shadow: 0 10px 20px -12px rgba(31, 89, 69, .7);
}
.tool__row .btn--primary:hover,
.btn--dl:hover,
.btn--primary:hover { background: var(--green-deep-2); }
.tool__row .btn--primary { border-radius: .75rem; }
.tool__row .btn:not(.btn--primary) { border-radius: .75rem; }

/* 队列与工具卡同宽，不再横向溢出 */
#queueCard {
  position: static;
  left: auto;
  transform: none;
  width: 100%;
}

.queue__row {
  grid-template-columns: 5.75rem minmax(0, 1fr) auto;
  gap: .9rem;
  padding: .7rem 0;
}
.thumb {
  width: 5.75rem;
  border-radius: .625rem;
  background: #e9f0eb;
  color: #6b7d71;
  box-shadow: inset 0 0 0 1px rgba(24, 62, 44, .08);
}
.thumb img { object-fit: cover; }
.thumb > span, .thumb > img { grid-area: 1 / 1; }

.queue__name { color: #21332a; font-weight: 500; }
.queue__note { color: var(--danger); }

/* 行内操作：纯图标按钮，圆形热区，删除文件红、删除记录中性 */
.queue__acts { gap: .25rem; margin-top: .375rem; }
.queue__link {
  display: inline-grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: #7c8d82;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.queue__link .ic { width: 1rem; height: 1rem; }
.queue__link:hover { background: var(--pill); color: #2b4a3a; }
.queue__link--danger { color: #b8564a; }
.queue__link--danger:hover { background: #fdeeec; color: var(--danger); }
.queue__action-label { display: none; }

.queue__status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: #7c8d82;
}
.queue__status[data-status="done"] { color: #2c7a58; }
.queue__status[data-status="done"] .ic { width: .875rem; height: .875rem; }

/* 卡头「全部删除」保持图标 + 文字的轻量红按钮 */
.queue__clear {
  display: inline-grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  margin-left: .625rem;
  padding: 0 .625rem;
  border-radius: .5rem;
  color: #b8564a;
}
.queue__clear:hover { background: #fdeeec; color: var(--danger); }

.statusbar {
  background: rgba(246, 250, 247, .9);
  border-top-color: #dde8e1;
  color: #4e6156;
  backdrop-filter: blur(12px);
}
.drawer__panel, .modal__panel { background: #fff; }
.drawer__head { background: #fbfdfb; }

@media (max-width: 600px) {
  .hero { margin-top: 2rem; }
  .page { padding-left: 1rem; padding-right: 1rem; }
  .card, .tool { padding: 1rem; }
  .pills { grid-template-columns: repeat(2, 1fr); gap: .55rem; }
  .pill { height: 3.6rem; }
  .pill__logo { width: 1.875rem; height: 1.875rem; }
  .queue__row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: .7rem; }
  .thumb { width: 4.5rem; }
  .field { height: 6.5rem; }
}

/* 细节收敛：中文不做负字距；队列内联图标放大加深，热区更舒展 */
.hero h1 { letter-spacing: -.01em; }
.queue__acts { gap: .375rem; }
.queue__link { color: #66796d; }
.queue__link .ic { width: 1.0625rem; height: 1.0625rem; }
.queue__link--danger { color: #b8564a; }
.queue__clear { color: #87988c; }
.queue__clear:hover { color: var(--danger); background: #fdeeec; }
#queueCard .card__head { gap: .5rem; }

/* 图标可辨识度：放大热区与线条，清空按钮加发丝边框 */
.queue__acts { margin-top: .5rem; }
.queue__link { width: 2.125rem; height: 2.125rem; border-radius: .5625rem; color: #4d6156; }
.queue__link .ic { width: 1.25rem; height: 1.25rem; }
.queue__link:hover { background: #edf4f0; color: #1f3a2c; }
.queue__link--danger { color: #b8564a; }
.queue__clear {
  width: 2.125rem;
  height: 2.125rem;
  border: 1px solid #e2ebe5;
  background: #fff;
  color: #7d8f83;
}
.queue__clear .ic { width: 1.125rem; height: 1.125rem; }
.pill__logo { width: 2.25rem; height: 2.25rem; }

/* 操作组作为一条轻工具条，避免三个图标散落 */
.queue__acts {
  display: inline-flex;
  align-items: center;
  gap: .125rem;
  margin-top: .45rem;
  padding: .125rem;
  border-radius: .625rem;
  background: #f4f8f5;
}
.queue__acts[hidden] { display: none; }
.queue__link { width: 2rem; height: 2rem; border-radius: .5rem; background: transparent; }
.queue__link:hover { background: #e6f0e9; }
.queue__link--danger:hover { background: #fdeceb; }
.queue__link .ic { width: 1.375rem; height: 1.375rem; stroke-width: 1.6; }

/* 选中态描边加粗，浅底上一眼可辨 */
.pill[aria-checked="true"] { border-width: 2px; }

/* 封面完整显示：竖版（3:4）与横版（16:9）都不裁切。
   缩略图改正方形托底 + contain；解析结果大图同样不裁。 */
.queue__row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; }
.thumb {
  width: 4.5rem;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #eef3ef;
}
.thumb img { object-fit: contain; }
.res__cover { background: #eef3ef; }
.res__cover img { object-fit: contain; }

@media (max-width: 600px) {
  .queue__row { grid-template-columns: 3.75rem minmax(0, 1fr) auto; }
  .thumb { width: 3.75rem; }
}

/* 根因修正：容器高度靠 aspect-ratio 推导时，img 的 height:100% 解析为 auto，
   竖图会按固有比例撑高再被 overflow 裁掉底部。改为绝对定位铺满容器。 */
.thumb {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  aspect-ratio: auto;
}
.thumb img,
.res__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (max-width: 600px) {
  .thumb { width: 3.75rem; height: 3.75rem; }
}

/* 结果卡封面：主流平台（抖音/快手/小红书）封面为 3:4 竖版，
   用竖框承载，横版（B站）上下留白但同样完整。 */
.res__main { grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; }
.res__cover { width: 6rem; aspect-ratio: 3 / 4; }
@media (max-width: 600px) {
  .res__main { grid-template-columns: 5rem minmax(0, 1fr); gap: .75rem; }
  .res__cover { width: 5rem; }
}
