/*!
 * PDF 全能工作台 — yicool.com.cn /tools/pdf-studio
 * 三端响应式 + 深浅双主题。令牌定义在 :root（浮层/提示条可能脱离 .ps 容器）。
 */
:root {
    --ps-bg: var(--bg-primary, #0f1419);
    --ps-card: var(--bg-secondary, #161b22);
    --ps-card-2: rgba(127, 127, 127, .08);
    --ps-fg: var(--text-primary, #e6edf3);
    --ps-sub: var(--text-secondary, #8b949e);
    --ps-faint: #8b98a5;
    --ps-line: var(--border-color, #262d36);
    --ps-line-2: rgba(160, 175, 190, .22);
    --ps-accent: var(--accent, #58a6ff);
    --ps-accent-soft: rgba(88, 166, 255, .12);
    --ps-ok: #3fb950;
    --ps-ok-soft: rgba(63, 185, 80, .12);
    --ps-warn: #e3a008;
    --ps-warn-soft: rgba(227, 160, 8, .13);
    --ps-err: #f85149;
    --ps-err-soft: rgba(248, 81, 73, .12);
    --ps-shadow: 0 4px 20px rgba(0, 0, 0, .16);
    --ps-shadow-sm: 0 1px 6px rgba(0, 0, 0, .1);
    --ps-r: 14px;
    --ps-r-sm: 9px;
    --ps-zebra: rgba(127, 127, 127, .055);
}
[data-theme="light"] {
    --ps-bg: #f7f9fb;
    --ps-card: #ffffff;
    --ps-card-2: #f2f5f8;
    --ps-fg: #1c2430;
    --ps-sub: #5b6775;
    --ps-faint: #64748b;
    --ps-line: #e3e9ef;
    --ps-line-2: rgba(15, 20, 25, .16);
    --ps-accent: #136ce9;
    --ps-accent-soft: rgba(19, 108, 233, .09);
    --ps-ok: #1a7f37;
    --ps-warn: #9a6700;
    --ps-err: #cf222e;
    --ps-shadow: 0 4px 20px rgba(15, 20, 25, .07);
    --ps-shadow-sm: 0 1px 6px rgba(15, 20, 25, .06);
    --ps-zebra: rgba(15, 20, 25, .035);
}

/* ★ 桌面满屏（保留左侧导航）：站点 .app 有 1280px 限宽，这里逐层解除 */
body.page-pdf-studio-full .app,
body.page-pdf-studio-full .main-content,
body.page-pdf-studio-full .page-container { max-width: 100%; }
body.page-pdf-studio-full .main-content { width: 100%; border-right: 0; min-width: 0; }
/* ★ 站点 body{overflow-y:scroll} 会让页内 sticky 全部失效，把滚动权交还 html */
body.page-pdf-studio-full { overflow: visible; }

.ps {
    --ps-max: 100%;
    width: 100%;
    max-width: var(--ps-max);
    margin: 0;
    padding: 22px 26px 72px;
    box-sizing: border-box;
    color: var(--ps-fg);
    font-size: 14px;
    line-height: 1.6;
}
.ps *, .ps *::before, .ps *::after { box-sizing: border-box; }
.ps [hidden] { display: none !important; }
.ps button, .ps input, .ps select { font-family: inherit; }
.ps h1, .ps h2, .ps h3, .ps p { margin: 0; }

/* ---------------- Hero ---------------- */
.ps-hero {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 20px 24px;
    border: 1px solid var(--ps-line);
    border-radius: var(--ps-r);
    background: linear-gradient(120deg, var(--ps-accent-soft), transparent 62%), var(--ps-card);
    box-shadow: var(--ps-shadow-sm);
}
.ps-hero-ico {
    flex: 0 0 auto;
    width: 54px; height: 54px;
    display: grid; place-items: center;
    font-size: 28px;
    border-radius: 15px;
    background: var(--ps-accent-soft);
    border: 1px solid var(--ps-line-2);
}
.ps-hero-txt { min-width: 0; flex: 1 1 auto; }
.ps-title { font-size: 24px; font-weight: 750; letter-spacing: .2px; text-wrap: balance; }
.ps-sub { margin-top: 7px; color: var(--ps-sub); max-width: 96ch; font-size: 13.5px; }
.ps-hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.ps-tag {
    font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
    color: var(--ps-sub); background: var(--ps-card-2); border: 1px solid var(--ps-line);
}

/* ---------------- 提示条 / 统计 ---------------- */
.ps-note {
    margin-top: 14px; padding: 10px 14px;
    border: 1px solid var(--ps-line); border-left: 3px solid var(--ps-accent);
    border-radius: var(--ps-r-sm);
    background: var(--ps-accent-soft); color: var(--ps-fg);
    font-size: 13px; word-break: break-word;
}
.ps-note.is-ok { border-left-color: var(--ps-ok); background: var(--ps-ok-soft); }
.ps-note.is-warn { border-left-color: var(--ps-warn); background: var(--ps-warn-soft); }
.ps-note.is-err { border-left-color: var(--ps-err); background: var(--ps-err-soft); }

.ps-stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 16px; border: 1px solid var(--ps-line);
    border-radius: var(--ps-r); background: var(--ps-card);
    box-shadow: var(--ps-shadow-sm); overflow: hidden;
}
.ps-stat { padding: 13px 18px; border-left: 1px solid var(--ps-line); }
.ps-stat:first-child { border-left: 0; }
.ps-stat b { display: block; font-size: 22px; font-weight: 750; color: var(--ps-accent); font-variant-numeric: tabular-nums; }
.ps-stat:nth-child(3) b { color: var(--ps-ok); }
.ps-stat:nth-child(4) b { color: var(--ps-fg); }
.ps-stat span { font-size: 12px; color: var(--ps-sub); }

/* ---------------- 通用卡片 / 按钮 ---------------- */
.ps-card {
    margin-top: 16px; padding: 18px 20px 20px;
    border: 1px solid var(--ps-line); border-radius: var(--ps-r);
    background: var(--ps-card); box-shadow: var(--ps-shadow-sm);
}
.ps-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.ps-card-t { font-size: 15.5px; font-weight: 700; }
.ps-card-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ps-count { font-size: 12px; color: var(--ps-sub); white-space: nowrap; }
.ps-hint { color: var(--ps-sub); font-size: 12.5px; margin: 2px 0 12px; }
.ps-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 36px; padding: 7px 14px;
    border: 1px solid var(--ps-line-2); border-radius: var(--ps-r-sm);
    background: var(--ps-card-2); color: var(--ps-fg);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .14s, border-color .14s, transform .14s;
}
.ps-btn:hover:not(:disabled) { background: var(--ps-accent-soft); border-color: var(--ps-accent); }
.ps-btn:active:not(:disabled) { transform: translateY(1px); }
.ps-btn:disabled { opacity: .48; cursor: not-allowed; }
.ps-btn.is-pri { background: var(--ps-accent); border-color: var(--ps-accent); color: #fff; }
.ps-btn.is-pri:hover:not(:disabled) { filter: brightness(1.08); background: var(--ps-accent); }
.ps-btn.is-ghost { background: transparent; }
.ps-busy {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--ps-accent);
}
.ps-busy::before {
    content: ''; width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--ps-accent-soft); border-top-color: var(--ps-accent);
    animation: ps-spin .7s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-empty { color: var(--ps-sub); font-size: 12.5px; padding: 14px 4px; text-align: center; }

/* ---------------- 文件区 ---------------- */
.ps-drop {
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 26px 18px; text-align: center; cursor: pointer;
    border: 2px dashed var(--ps-line-2); border-radius: var(--ps-r);
    background: var(--ps-card-2); transition: border-color .16s, background .16s;
}
.ps-drop:hover, .ps-drop:focus-visible { border-color: var(--ps-accent); background: var(--ps-accent-soft); }
.ps-drop-ico { font-size: 30px; }
.ps-drop-t { font-size: 14.5px; font-weight: 650; }
.ps-drop-s { font-size: 12px; color: var(--ps-sub); max-width: 72ch; }
.ps-drop .ps-btn { margin-top: 6px; }
.ps-file-list, .ps-img-list { margin-top: 12px; contain: layout style; }
.ps-file-item {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 9px 11px; border: 1px solid var(--ps-line);
    border-radius: var(--ps-r-sm); background: var(--ps-card);
    margin-bottom: 7px;
}
.ps-file-item:nth-child(even) { background: var(--ps-zebra); }
.ps-file-item.is-on { border-color: var(--ps-accent); background: var(--ps-accent-soft); }
.ps-file-grip { color: var(--ps-faint); cursor: grab; user-select: none; font-size: 15px; }
.ps-file-ico { font-size: 19px; }
.ps-file-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ps-file-main b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-file-main small { font-size: 11.5px; color: var(--ps-sub); }
.ps-file-cur { font-size: 11px; color: var(--ps-accent); border: 1px solid var(--ps-accent); border-radius: 999px; padding: 2px 8px; }
.ps-file-act {
    flex: 0 0 auto; min-height: 30px; padding: 4px 10px; font-size: 12px;
    border: 1px solid var(--ps-line-2); border-radius: 7px;
    background: var(--ps-card-2); color: var(--ps-fg); cursor: pointer;
}
.ps-file-act:hover { border-color: var(--ps-accent); }
.ps-file-act.is-del { color: var(--ps-err); }
.ps-img-head { font-size: 12.5px; font-weight: 650; color: var(--ps-sub); margin-bottom: 8px; }
.ps-img-n { font-weight: 500; }

/* ---------------- 工作台两栏 ---------------- */
.ps-work {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: 16px;
}
.ps-work .ps-card { margin-top: 0; }
.ps-work .ps-left { position: sticky; top: 16px; }
.ps-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.ps-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ps-cat {
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 30px; padding: 4px 10px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--ps-line-2); border-radius: 999px;
    background: var(--ps-card-2); color: var(--ps-sub); cursor: pointer;
}
.ps-cat:hover { border-color: var(--ps-accent); color: var(--ps-fg); }
.ps-cat.is-on { background: var(--ps-accent); border-color: var(--ps-accent); color: #fff; }

.ps-op-list {
    display: grid; grid-template-columns: 1fr; gap: 8px;
    max-height: min(56vh, 620px); overflow-y: auto;
    padding-right: 4px; overscroll-behavior: contain;
}
.ps-op-card {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px; border: 1px solid var(--ps-line);
    border-radius: var(--ps-r-sm); background: var(--ps-card);
    color: var(--ps-fg); cursor: pointer; transition: border-color .14s, background .14s;
}
.ps-op-card:hover { border-color: var(--ps-accent); background: var(--ps-accent-soft); }
.ps-op-card.is-on { border-color: var(--ps-accent); background: var(--ps-accent-soft); box-shadow: inset 3px 0 0 var(--ps-accent); }
.ps-op-card.is-need { opacity: .7; }
.ps-op-ico { float: left; font-size: 19px; margin-right: 9px; line-height: 1.3; }
.ps-op-name { font-size: 13.5px; font-weight: 650; }
.ps-op-desc { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--ps-sub); }
.ps-op-tag { display: inline-block; margin-top: 6px; font-size: 10.5px; color: var(--ps-faint); letter-spacing: .2px; }

/* ---------------- 参数表单 ---------------- */
.ps-op-cur { padding: 12px 14px; border: 1px solid var(--ps-line); border-radius: var(--ps-r-sm); background: var(--ps-card-2); }
.ps-op-cur-t { font-size: 16px; font-weight: 700; }
.ps-op-cur-d { margin-top: 4px; font-size: 12.5px; color: var(--ps-sub); }
.ps-form { margin-top: 14px; }
.ps-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 14px; }
.ps-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ps-field-l { font-size: 12px; font-weight: 600; color: var(--ps-sub); }
.ps-in {
    width: 100%; min-height: 36px; padding: 6px 10px;
    border: 1px solid var(--ps-line-2); border-radius: 8px;
    background: var(--ps-bg); color: var(--ps-fg); font-size: 13.5px;
}
.ps-in:focus { outline: none; border-color: var(--ps-accent); box-shadow: 0 0 0 3px var(--ps-accent-soft); }
.ps-in-color { padding: 3px; height: 36px; cursor: pointer; }
.ps-field-h { font-size: 11px; color: var(--ps-faint); line-height: 1.4; }
.ps-form-empty { font-size: 12.5px; color: var(--ps-sub); padding: 10px 2px; }
.ps-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.ps-acts-hint { font-size: 11.5px; color: var(--ps-faint); }

/* ---------------- 流水线 / 结果列表 ---------------- */
.ps-pipe-list, .ps-out-list { display: flex; flex-direction: column; gap: 7px; }
.ps-pipe-item, .ps-out-item {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 8px 11px; border: 1px solid var(--ps-line);
    border-radius: var(--ps-r-sm); background: var(--ps-card);
}
.ps-pipe-item:nth-child(even), .ps-out-item:nth-child(even) { background: var(--ps-zebra); }
.ps-pipe-n {
    flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center;
    border-radius: 50%; background: var(--ps-accent-soft); color: var(--ps-accent);
    font-size: 11.5px; font-weight: 750;
}
.ps-pipe-ico, .ps-out-ico { flex: 0 0 auto; font-size: 18px; }
.ps-pipe-main, .ps-out-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ps-pipe-main b, .ps-out-main b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-pipe-main small, .ps-out-main small { font-size: 11.5px; color: var(--ps-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-pipe-act, .ps-out-act {
    flex: 0 0 auto; min-height: 30px; padding: 4px 10px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--ps-line-2); border-radius: 7px;
    background: var(--ps-card-2); color: var(--ps-fg); cursor: pointer;
}
.ps-pipe-act:hover, .ps-out-act:hover { border-color: var(--ps-accent); color: var(--ps-accent); }
.ps-pipe-act.is-del { color: var(--ps-err); }

/* ---------------- 页面缩略图 ---------------- */
.ps-preview { margin-top: 2px; }
.ps-prev-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px; max-height: 440px; overflow-y: auto; overscroll-behavior: contain;
}
.ps-prev-cell {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 8px; border: 1px solid var(--ps-line); border-radius: 9px;
    background: var(--ps-card); color: var(--ps-fg); cursor: pointer;
}
.ps-prev-cell:hover { border-color: var(--ps-accent); background: var(--ps-accent-soft); }
.ps-prev-cell canvas { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--ps-line); }
.ps-prev-cell span { font-size: 11px; color: var(--ps-sub); }
.ps-prev-more { grid-column: 1 / -1; font-size: 12px; color: var(--ps-sub); padding: 6px 2px; }

/* ---------------- 工具门户 ---------------- */
.ps-search {
    min-width: 220px; min-height: 36px; padding: 6px 13px;
    border: 1px solid var(--ps-line-2); border-radius: 999px;
    background: var(--ps-bg); color: var(--ps-fg); font-size: 13px;
}
.ps-search:focus { outline: none; border-color: var(--ps-accent); box-shadow: 0 0 0 3px var(--ps-accent-soft); }
.ps-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.ps-portal-sec + .ps-portal-sec { margin-top: 18px; }
.ps-portal-t {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 12.5px; font-weight: 700; color: var(--ps-sub);
    padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--ps-line);
}
.ps-portal-t span { font-size: 11px; font-weight: 600; color: var(--ps-faint); }
.ps-portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 9px; }
.ps-portal-card {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 11px 12px; border: 1px solid var(--ps-line); border-radius: 10px;
    background: var(--ps-card); color: var(--ps-fg); text-decoration: none;
    transition: border-color .14s, background .14s, transform .14s;
}
.ps-portal-card:hover { border-color: var(--ps-accent); background: var(--ps-accent-soft); transform: translateY(-1px); }
.ps-portal-ico { flex: 0 0 auto; font-size: 20px; }
.ps-portal-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ps-portal-main b { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-portal-main small { font-size: 11px; color: var(--ps-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-portal-go { flex: 0 0 auto; color: var(--ps-faint); font-size: 14px; }

/* ---------------- 说明 ---------------- */
.ps-help summary { cursor: pointer; font-size: 14px; font-weight: 650; padding: 2px 0; }
.ps-help-body { margin-top: 10px; font-size: 12.8px; line-height: 1.8; color: var(--ps-sub); }
.ps-help-body p + p { margin-top: 9px; }
.ps-help-body b { color: var(--ps-fg); }

/* ---------------- 滚动条 / 焦点 / 动效 ---------------- */
.ps-op-list, .ps-prev-grid { scrollbar-width: thin; scrollbar-color: var(--ps-line-2) transparent; }
.ps-op-list::-webkit-scrollbar, .ps-prev-grid::-webkit-scrollbar { width: 8px; height: 8px; }
.ps-op-list::-webkit-scrollbar-thumb, .ps-prev-grid::-webkit-scrollbar-thumb { background: var(--ps-line-2); border-radius: 8px; }
.ps :focus-visible { outline: 2px solid var(--ps-accent); outline-offset: 2px; }
.ps { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (hover: none) {
    .ps-portal-card:hover { transform: none; }
    .ps-btn:active:not(:disabled) { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .ps *, .ps *::before, .ps *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ---------------- 响应式（断点降序） ---------------- */
@media (min-width: 1600px) {
    .ps { padding-left: 34px; padding-right: 34px; }
    .ps-work { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
    .ps-portal-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .ps-sub { font-size: 14px; }
}
@media (max-width: 1100px) {
    .ps-work { grid-template-columns: minmax(0, 1fr); }
    .ps-work .ps-left { position: static; }
    .ps-op-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
    .ps-cards, .ps-right { min-width: 0; }
}
@media (max-width: 900px) {
    .ps-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ps-stat:nth-child(3) { border-left: 0; }
    .ps-stat:nth-child(n+3) { border-top: 1px solid var(--ps-line); }
    .ps-form-grid { grid-template-columns: minmax(0, 1fr); }
    .ps-search { min-width: 180px; flex: 1 1 200px; }
}
@media (max-width: 767px) {
    .ps { padding: 14px 12px 64px; font-size: 13.5px; }
    .ps-hero { padding: 14px 13px; gap: 11px; }
    .ps-hero-ico { width: 40px; height: 40px; font-size: 21px; border-radius: 12px; }
    .ps-title { font-size: 20px; }
    .ps-sub { font-size: 12.5px; }
    .ps-tag { font-size: 10.5px; padding: 3px 8px; }
    .ps-stat { padding: 10px 12px; }
    .ps-stat b { font-size: 19px; }
    .ps-card { padding: 14px 13px 16px; }
    .ps-card-t { font-size: 14.5px; }
    .ps-op-list { grid-template-columns: minmax(0, 1fr); }
    .ps-cat { min-height: 34px; }
    .ps-in, .ps-search, .ps-btn { min-height: 40px; font-size: 16px; }
    .ps-in-color { height: 40px; }
    .ps-file-act, .ps-pipe-act, .ps-out-act { min-height: 36px; font-size: 13px; }
    .ps-portal-grid { grid-template-columns: minmax(0, 1fr); }
    .ps-prev-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 360px; }
    .ps-drop { padding: 20px 12px; }
    .ps-drop-s { font-size: 11.5px; }
    .ps-acts .ps-btn { flex: 1 1 100%; }
    .ps-acts-hint { width: 100%; }
    .ps-card-acts { width: 100%; }
    .ps-card-acts .ps-btn { flex: 1 1 auto; }
}
@media (max-width: 420px) {
    .ps-hero-ico { display: none; }
    .ps-file-grip { display: none; }
    .ps-file-item { gap: 7px; padding: 8px; }
    .ps-file-act { padding: 4px 7px; }
    .ps-prev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ps-pipe-ico, .ps-out-ico { display: none; }
}

@media print {
    .ps-drop, .ps-cats, .ps-op-list, .ps-acts, .ps-card-acts, .ps-preview, .ps-portal-wrap, .ps-help { display: none !important; }
    .ps { padding: 0; }
    .ps-card { box-shadow: none; break-inside: avoid; }
}
