/* ===== 小猫咪工具箱 MiaoToolbox - Glass UI Light ===== */
:root {
  --bg: #eef1f6;
  --bg-deep: #e6eaf1;
  --panel: rgba(255, 255, 255, .70);
  --panel-solid: #ffffff;
  --line: rgba(15, 23, 42, .08);
  --line-strong: rgba(15, 23, 42, .10);
  --text: #1f2937;
  --muted: #64748b;
  --accent: #4285f4;
  --accent2: #1a73e8;
  --accent-ink: #3b78e7;
  --accent-soft: rgba(66, 133, 244, .10);
  --btn-primary-ink: #ffffff;
  --focus-ring: 0 0 0 3px rgba(66, 133, 244, .16);
  --side-bg: rgba(255, 255, 255, .62);
  --side-text: #475569;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-xs: 3px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, .10);
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

/* 管理后台：琥珀黄主色作用域（仅内容区，不碰 DOM） */
[data-server-page="/admin"] {
  --accent: #fbbc04;
  --accent2: #f29900;
  --accent-ink: #a16207;
  --accent-soft: rgba(251, 188, 4, .16);
  --btn-primary-ink: #3a2d00;
  --focus-ring: 0 0 0 3px rgba(251, 188, 4, .22);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

/* 固定光斑背景 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 380px at 12% 6%, rgba(66, 133, 244, .13), transparent 62%),
    radial-gradient(640px 440px at 90% 10%, rgba(52, 168, 83, .09), transparent 62%),
    radial-gradient(760px 500px at 50% 110%, rgba(251, 188, 4, .10), transparent 62%);
}

img { max-width: 100%; height: auto; }
input, select, textarea, button { font: inherit; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px;
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .70);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-width: 230px; flex: 0 0 auto; text-decoration: none; }
.brand-text { white-space: nowrap; overflow: hidden; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  font-size: 19px;
  background: var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
}
.brand-text b { display: block; font-size: 16px; letter-spacing: .5px; line-height: 1.2; color: var(--text); }
.brand-text i { font-style: normal; font-size: 11px; color: var(--muted); }

.top-search { flex: 1 1 240px; min-width: 120px; max-width: 520px; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .72); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px; height: 36px; transition: .2s; }
.top-search:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); background: #fff; }
.top-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.top-search kbd { font-size: 11px; color: var(--muted); background: rgba(15, 23, 42, .04); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 2px 7px; font-family: var(--mono); }
.icon-btn { display: none; border: 0; background: rgba(15, 23, 42, .05); border-radius: var(--radius); padding: 8px 12px; font-size: 16px; cursor: pointer; }

/* ---------- 顶栏：登录 / 用户 ---------- */
.top-user { display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; margin-left: auto; }
.top-user a { text-decoration: none; font-size: 13px; border-radius: var(--radius); padding: 7px 13px; }
.top-user a.top-login { background: var(--accent); color: var(--btn-primary-ink); font-weight: 600; }
.top-user a.top-login:hover { filter: brightness(.94); }

/* 已登录：一体化用户胶囊（头像 + 昵称 + 操作，共享一个外框） */
.user-chip {
  display: flex; align-items: center;
  background: rgba(255, 255, 255, .65);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 3px 3px 3px 4px;
  transition: border-color .2s, background .2s;
}
.user-chip:hover { border-color: rgba(15, 23, 42, .18); background: rgba(255, 255, 255, .85); }
.user-chip .u-avatar {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: var(--btn-primary-ink);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.user-chip .u-name {
  max-width: 132px; overflow: hidden; text-overflow: ellipsis;
  padding: 0 10px 0 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
}
.user-chip .u-act {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; line-height: 1.6;
  padding: 4px 12px 4px 11px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: .18s;
}
.user-chip .u-act:hover { background: rgba(15, 23, 42, .05); }
.user-chip .u-admin:hover { color: var(--accent-ink); }
.user-chip .u-key:hover { color: var(--accent-ink); }
.user-chip .u-out:hover { color: #dc2626; }
.user-chip .u-act .u-ico { font-size: 13px; line-height: 1; }

/* ---------- 管理后台 ---------- */
.adm-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; flex-wrap: wrap; }
.adm-scroll { overflow: auto; max-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th, .adm-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table th {
  background: rgba(245, 247, 250, .92); color: var(--muted); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 0;
}
.adm-table input[type="number"] { width: 90px; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 8px; background: rgba(255, 255, 255, .9); color: var(--text); }
.adm-mono { font-family: var(--mono); font-size: 12px; }
.adm-empty { color: var(--muted); text-align: center; padding: 26px 0 !important; }
.adm-radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.adm-radio input { accent-color: var(--accent); }
.adm-hint { color: var(--muted); font-size: 12px; }
.btn-danger:hover { color: #dc2626; border-color: #dc2626; }

/* ---------- API 密钥页 ---------- */
.ak-tip { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
.ak-create { display: flex; gap: 10px; align-items: center; margin: 10px 0 14px; flex-wrap: wrap; }
.ak-create input {
  flex: 1 1 220px; min-width: 0; max-width: 340px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px;
  background: rgba(255, 255, 255, .9); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ak-create input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.ak-once {
  border: 1px solid rgba(180, 83, 9, .25); background: rgba(254, 243, 199, .65); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 14px;
}
.ak-once-tip { font-size: 13px; color: #92400e; margin-bottom: 10px; line-height: 1.6; }
.ak-once-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ak-once-box code {
  flex: 1 1 260px; min-width: 0; font-family: var(--mono); font-size: 13px;
  background: rgba(255, 255, 255, .85); border: 1px solid rgba(217, 119, 6, .25); border-radius: var(--radius-sm);
  padding: 8px 10px; color: #78350f; word-break: break-all;
}
.ak-tip-line { color: var(--muted); font-size: 12px; margin-top: 10px; line-height: 1.7; }
.ak-doc p { margin: 0 0 8px; font-size: 14px; line-height: 1.8; color: var(--text); }
.ak-doc code {
  font-family: var(--mono); font-size: 12.5px; background: rgba(15, 23, 42, .04);
  border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 1px 6px; word-break: break-all;
}
.ak-code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  background: rgba(15, 23, 42, .03); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 12px; overflow-x: auto; white-space: pre;
  color: var(--text);
}

/* ---------- 布局 ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--side-bg);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  color: var(--side-text);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px 10px 60px;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, .14); border-radius: var(--radius-xs); }
.side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.side-paw {
  width: 32px; height: 32px; border-radius: var(--radius);
  display: grid; place-items: center; font-size: 16px;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .16);
}
.side-head-txt b { display: block; font-size: 13.5px; color: var(--text); letter-spacing: .3px; }
.side-head-txt i { font-style: normal; font-size: 11px; color: var(--muted); }
.side-foot { margin: 18px 10px 0; font-size: 11px; color: #94a3b8; line-height: 1.8; }

.cat { margin: 2px 0; border-radius: var(--radius); }
.cat summary {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  cursor: pointer; user-select: none;
  font-size: 13.5px; color: #475569;
  border-radius: var(--radius);
  list-style: none;
  transition: background .15s;
}
.cat summary::-webkit-details-marker { display: none; }
.cat summary:hover { background: rgba(15, 23, 42, .05); }
.cat[open] summary { color: var(--accent-ink); background: var(--accent-soft); }
.cat-icon { font-size: 15px; }
.cat-name { flex: 1; }
.cat-count { font-size: 11px; color: var(--muted); background: rgba(15, 23, 42, .06); border-radius: var(--radius-xs); padding: 1px 7px; font-family: var(--mono); }
.cat[open] .cat-count { background: var(--accent-soft); color: var(--accent-ink); }
.cat-tools { display: block; padding: 2px 6px 8px; max-height: 240px; overflow-y: auto; }
.cat-tool {
  display: block;
  padding: 6px 12px 6px 24px;
  margin: 1px 0;
  font-size: 13px; color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-tool:hover { color: var(--text); background: rgba(15, 23, 42, .05); padding-left: 28px; }
.cat-tool.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; overflow-y: auto; padding: 22px 26px 80px; transition: opacity .16s ease; }
.main.pj { opacity: 0; }

.noscript { padding: 20px; text-align: center; color: var(--muted); }

/* 首页 Hero */
.hero { max-width: 1060px; margin: 8px auto 0; }
.hero-badge {
  display: inline-block; font-size: 12px; color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid rgba(66, 133, 244, .22);
  border-radius: var(--radius-sm); padding: 3px 12px; margin-bottom: 12px;
}
.hero-title {
  font-size: 32px; font-weight: 800; letter-spacing: .3px;
  color: var(--text);
}
.hero-sub { color: var(--muted); margin: 6px 0 26px; font-size: 14.5px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cat-card {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.cat-card::before {
  content: ""; position: absolute; inset: 0 0 auto;
  height: 2px; background: var(--accent); opacity: 0; transition: opacity .2s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.cat-card:hover::before { opacity: 1; }
.cat-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.cat-card-head .ci {
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 19px; border-radius: var(--radius);
  background: var(--accent-soft);
}
.cat-card h3 { font-size: 15.5px; }
.cat-card .cat-desc { font-size: 12.5px; color: var(--muted); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12px; color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid rgba(66, 133, 244, .18);
  border-radius: var(--radius-sm); padding: 2px 9px;
  cursor: pointer; text-decoration: none; transition: .15s;
}
.chip:hover { background: rgba(66, 133, 244, .18); color: var(--accent-ink); border-color: rgba(66, 133, 244, .32); }
.cat-more { display: block; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* 工具页 */
.tool-page { max-width: 1120px; margin: 0 auto; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 14px; cursor: default; flex-wrap: wrap; }
.crumb a, .crumb-link { color: var(--accent-ink); text-decoration: none; cursor: pointer; }
.crumb a:hover, .crumb-link:hover { text-decoration: underline; }
.crumb b { font-weight: 400; color: var(--muted); }
.card-title .count-hint { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }

.tool-head { margin-bottom: 18px; }
.tool-head h1 { font-size: 23px; font-weight: 750; display: flex; align-items: center; gap: 10px; }
.tool-head .t-icon { width: 40px; height: 40px; display: grid; place-items: center; font-size: 19px; border-radius: var(--radius); background: var(--accent-soft); }
.tool-head p { color: var(--muted); margin-top: 5px; }

.tool-card {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 16px;
}
.card-title { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

textarea.inp, div.out {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px; line-height: 1.65;
  color: var(--text);
  background: rgba(255, 255, 255, .88);
  outline: none;
  resize: vertical;
  transition: border .15s, box-shadow .15s, background .15s;
}
textarea.inp:focus { border-color: var(--accent); box-shadow: var(--focus-ring); background: #fff; }
textarea.inp[readonly] { background: rgba(248, 250, 252, .9); }
textarea.inp.mono-result { background: #1e293b; color: #e2e8f0; border-color: transparent; min-height: 180px; }

/* 选项行 */
.opts-row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; margin: 14px 0; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; }
.opt label { white-space: nowrap; }
.opt select, .opt input[type=text], .opt input[type=number], .opt input[type=date], .opt input[type=datetime-local] {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, .9);
  color: var(--text);
  outline: none;
  min-width: 70px;
  transition: border .15s, box-shadow .15s;
}
.opt select:focus, .opt input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.opt input[type=number] { width: 92px; font-family: var(--mono); }
.opt input[type=text] { width: 150px; font-family: var(--mono); }
.opt-wide { flex-direction: column; align-items: stretch; width: 100%; }
.opt-wide input[type=text] { width: 100%; box-sizing: border-box; min-width: 0; font-family: var(--mono); }
.opt input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.opt-check { flex-wrap: wrap; gap: 14px; }

/* 模式切换（分段控件） */
.mode-switch { display: inline-flex; background: rgba(15, 23, 42, .06); border-radius: var(--radius); padding: 3px; gap: 3px; }
.mode-switch button {
  border: 0; background: transparent; border-radius: var(--radius-sm);
  padding: 6px 16px; font-size: 13px; color: var(--muted); cursor: pointer; transition: .15s;
}
.mode-switch button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* 操作按钮 */
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 0; cursor: pointer; border-radius: var(--radius);
  padding: 9px 18px; font-size: 14px; font-weight: 600;
  transition: .18s;
}
.btn-run { background: var(--accent); color: var(--btn-primary-ink); }
.btn-run:hover { filter: brightness(.94); }
.btn-run:active { filter: brightness(.88); }
.btn-ghost { background: rgba(15, 23, 42, .05); color: var(--text); }
.btn-ghost:hover { background: rgba(15, 23, 42, .09); }
.btn-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); padding: 7px 14px; font-size: 12.5px; border-radius: var(--radius); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.btn-ok { background: rgba(22, 163, 74, .10); color: var(--ok); }
.btn-ok:hover { background: rgba(22, 163, 74, .18); }

/* 结果 */
.result-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.result-bar .stat { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.result-bar .out-title { font-size: 13px; font-weight: 600; color: #475569; flex-shrink: 0; }
.result-bar .out-title::after { content: "·"; margin-left: 8px; color: var(--line-strong); font-weight: 400; }

/* 生成器类工具（无需文本输入）的提示条 */
.no-input-tip {
  padding: 14px 16px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .55); border: 1px dashed var(--line-strong);
  font-size: 13px; color: var(--muted); text-align: center;
}
.spacer { flex: 1; }
.result-meta { font-size: 12px; color: var(--ok); }

.error-box {
  background: rgba(220, 38, 38, .06); border: 1px solid rgba(220, 38, 38, .22);
  color: #b42318; border-radius: var(--radius);
  padding: 10px 14px; font-size: 13px; margin-bottom: 12px;
  white-space: pre-wrap;
}
.result-area { position: relative; }

/* 预览 */
.preview-frame {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; min-height: 320px;
  padding: 14px;
  overflow: auto;
  font-size: 14px;
}
.preview-frame img { max-width: 100%; }
.md-preview { display: block; background: #fff; color: #333; height: clamp(320px, 60vh, 560px); }
.md-preview pre { overflow: auto; }
.html-preview { display: block; height: 360px; padding: 0; background: #fff; border: 0; }
.html-preview:focus { outline: none; }
.img-preview { max-width: 360px; max-height: 320px; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 10px; display: block; }

/* 文件选择 */
.file-drop {
  border: 1.5px dashed rgba(15, 23, 42, .18); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--muted);
  cursor: pointer; transition: .2s; font-size: 13.5px;
}
.file-drop:hover, .file-drop.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.file-drop b { color: var(--accent-ink); }
.file-meta { margin-top: 8px; font-size: 12px; color: var(--muted); font-family: var(--mono); }

.hint { font-size: 12px; color: #94a3b8; margin-top: 8px; }

/* OCR 结果 */
.ocr-page { margin: 14px 0; }
.ocr-page-title { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.ocr-page-title::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: var(--radius-xs); }

/* 调色板 */
.pal-wrap { display: flex; gap: 24px; flex-wrap: wrap; }
.pal-main { flex: 0 0 260px; max-width: 260px; }
.pal-sv {
  position: relative; width: 100%; aspect-ratio: 1;
  border-radius: var(--radius); cursor: crosshair; touch-action: none;
  background:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, hsl(var(--h, 220deg), 100%, 50%));
  border: 1px solid var(--line);
}
.pal-dot {
  position: absolute; width: 13px; height: 13px;
  border-radius: 50%; background: #fff;
  border: 2px solid #334155;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.pal-hue { width: 100%; margin: 12px 0; accent-color: var(--accent); }
.pal-swatch { width: 100%; height: 52px; border-radius: var(--radius); border: 1px solid var(--line); background: #4285f4; }
.pal-side { flex: 1; min-width: 300px; }
.pal-fields .pal-hex input { font-family: var(--mono); width: 130px; }
.pal-hex { font-weight: 600; }
.pal-nums { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 10px 0; }
.pal-nums label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.pal-nums input { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 6px 4px; text-align: center; font-family: var(--mono); font-size: 13px; width: 100%; outline: none; background: rgba(255, 255, 255, .9); }
.pal-nums input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.pal-sets { margin-top: 16px; }
.pal-sets-title { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 8px; }
.pal-set-row { display: flex; align-items: center; gap: 5px; margin: 5px 0; }
.pal-set-row span { flex: 0 0 56px; font-size: 12px; color: var(--muted); }
.pal-set-row i {
  flex: 1; height: 26px; border-radius: var(--radius-xs); cursor: pointer;
  transition: transform .12s; border: 1px solid rgba(15, 23, 42, .08);
}
.pal-set-row i:hover { transform: scale(1.12); box-shadow: 0 3px 8px rgba(15, 23, 42, .2); }

/* 图片压缩 */
.cpt-wrap { width: 100%; }
.cpt-stats { margin-bottom: 10px; color: var(--muted); font-size: 13.5px; }
.cpt-stats b { color: var(--text); }
.cpt-stats .cpt-save { color: var(--ok); }
.cpt-q { width: 150px; accent-color: var(--accent); }

/* JS/CSS 批量压缩 */
.mf-card { width: 100%; margin-bottom: 16px; }
.mf-card .lbl { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.mf-head { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.mf-head .opt { flex: 1; min-width: 220px; }
.cpt-pre { cursor: pointer; border: 1.5px dashed rgba(15, 23, 42, .18); border-radius: var(--radius); padding: 26px 14px;
  text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 10px; transition: .2s; }
.cpt-pre:hover, .cpt-pre.drag { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.mf-line { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13px; background: rgba(255, 255, 255, .8); }
.mf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.mf-info { color: var(--muted); white-space: nowrap; }
.mf-save { padding: 3px 12px !important; font-size: 12.5px !important; }
.mf-rm { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; }
.mf-rm:hover { color: #dc2626; }

/* ===== Let's Encrypt 证书申请 ===== */
.le-card { display: flex; flex-direction: column; gap: 12px; }
.le-field { display: flex; flex-direction: column; gap: 6px; }
.le-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.le-label select { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 10px; background: rgba(255, 255, 255, .9); color: var(--text); font-size: 13px; }
.le-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.le-flow { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.le-tip { font-size: 12.5px; color: var(--muted); line-height: 1.7; background: rgba(255, 255, 255, .55); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 10px 12px; }
.le-working { color: var(--accent-ink); font-weight: 600; }
.le-err { font-size: 13px; color: #b42318; background: rgba(220, 38, 38, .06); border: 1px solid rgba(220, 38, 38, .22); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; }
.le-ok { color: #1a9e5c; font-weight: 600; }
.le-wait { color: #b45309; }
.le-mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.le-val { user-select: all; }
.le-block { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.le-block-head { font-size: 12.5px; font-weight: 700; color: var(--text); }
.le-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.le-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 2px solid var(--line); }
.le-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.le-table td.le-val { max-width: 220px; }

/* ===== 视频解析下载 ===== */
.pa-box { display: flex; flex-direction: column; gap: 12px; }
.pa-row { display: flex; gap: 10px; align-items: stretch; }
.pa-url {
  flex: 1; min-width: 0; min-height: 46px; padding: 11px 16px;
  font-size: 14px; color: var(--text); line-height: 1.5;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: rgba(255, 255, 255, .9); outline: none; resize: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  display: block;
}
.pa-url:focus { border-color: var(--accent); box-shadow: var(--focus-ring); background: #fff; }
.pa-url::placeholder { color: var(--muted); }
.pa-btns { display: flex; gap: 8px; align-items: stretch; flex-shrink: 0; }
.pa-btns .btn { height: 46px; padding: 0 22px; border-radius: var(--radius); font-size: 14px; white-space: nowrap; }
.pa-tip { font-size: 12px; color: var(--muted); line-height: 1.7; background: rgba(255, 255, 255, .55); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 9px 12px; }
.pa-state { font-size: 13px; color: var(--accent-ink); font-weight: 600; min-height: 18px; word-break: break-all; }
.pa-err { font-size: 13px; color: #b42318; background: rgba(220, 38, 38, .06); border: 1px solid rgba(220, 38, 38, .22); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; }
.pa-none { font-size: 13px; color: var(--muted); padding: 20px 0; text-align: center; }
.pa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.pa-platform { background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; border: 1px solid rgba(66, 133, 244, .2); border-radius: var(--radius-sm); padding: 3px 10px; white-space: nowrap; }
.pa-head .pa-title { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; min-width: 180px; }
.pa-engine { font-size: 11px; color: var(--muted); background: rgba(15, 23, 42, .05); border-radius: var(--radius-xs); padding: 3px 9px; white-space: nowrap; }
.pa-sub { font-size: 13px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.pa-item { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--panel); box-shadow: var(--shadow); }
.pa-thumb { position: relative; width: 120px; height: 160px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; background: rgba(15, 23, 42, .05); display: flex; align-items: center; justify-content: center; }
.pa-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pa-thumb-empty { font-size: 30px; color: #cbd5e1; }
.pa-badge { position: absolute; left: 6px; top: 6px; background: rgba(15, 23, 42, .68); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: var(--radius-xs); }
.pa-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pa-body .pa-title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pa-size { font-size: 12px; color: var(--muted); }
.pa-ops { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pa-quals { display: flex; gap: 6px; flex-wrap: wrap; }
.pa-qual { display: inline-flex; gap: 4px; align-items: center; }
.pa-qual .btn { padding: 4px 10px; font-size: 12px; }
.pa-music { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--panel); box-shadow: var(--shadow); }
.pa-music-tip { font-size: 12.5px; color: var(--muted); }
.pa-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pa-pic { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.pa-pic img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.pa-pic .pa-ops { padding: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: var(--radius);
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #b42318; }

/* 空状态 / 说明 */
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* 工具列表区（分类页） */
.cat-view-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mini-tool {
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius); padding: 15px 16px; cursor: pointer;
  box-shadow: var(--shadow); transition: .16s;
  display: flex; gap: 12px; align-items: flex-start;
  text-decoration: none; color: inherit;
}
.mini-tool:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: rgba(66, 133, 244, .35); }
.mini-tool .t-icon { font-size: 17px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--accent-soft); border-radius: var(--radius); flex-shrink: 0; }
.mini-tool b { display: block; font-size: 14px; }
.mini-tool span { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 玻璃效果降级：不支持 backdrop-filter 时使用实底 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .sidebar, .cat-card, .tool-card, .mini-tool { background: #ffffff; }
}

/* ---------- 响应式 ---------- */

/* 侧栏遮罩（移动端） */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(15, 23, 42, .38);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
@media (min-width: 921px) { .sidebar-backdrop { display: none; } }

/* ===== 平板 ≤920px ===== */
@media (max-width: 920px) {
  .sidebar {
    position: fixed; inset: 56px auto 0 0; width: 250px; z-index: 30;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(15, 23, 42, .22);
    padding-top: env(safe-area-inset-top, 0);
  }
  .sidebar.open { transform: none; }
  body.nav-open { overflow: hidden; }
  .icon-btn { display: grid; place-items: center; width: 40px; height: 40px; font-size: 18px; }
  .brand { min-width: auto; }
  .top-search { max-width: none; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .main { padding: 18px 18px 60px; }
}

/* ===== 手机 ≤640px ===== */
@media (max-width: 640px) {
  .topbar { height: 52px; padding: 0 12px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 17px; }
  .brand-text { display: none; }          /* 窄屏只留猫头，避免挤压换行 */
  .top-search { padding: 0 10px; gap: 6px; height: 34px; }
  .top-search input { font-size: 16px; } /* 防 iOS 缩放 */
  .top-search kbd { display: none; }
  .sidebar { inset: 52px auto 0 0; width: 78vw; max-width: 280px; }
  .main { padding: 14px 14px calc(50px + env(safe-area-inset-bottom, 0)); }

  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 13px; margin-bottom: 18px; }
  .cat-grid { grid-template-columns: 1fr; gap: 12px; }
  .cat-card { padding: 16px; }
  .cat-card h3 { font-size: 15px; }
  .cat-card .ci { width: 38px; height: 38px; font-size: 18px; }

  .crumb { font-size: 12px; }
  .tool-head h1 { font-size: 19px; }
  .tool-head .t-icon { width: 34px; height: 34px; font-size: 17px; }
  .tool-head p { font-size: 13px; }
  .tool-card { padding: 16px; margin-top: 12px; }
  textarea.inp, div.out { font-size: 13px; padding: 10px 12px; }
  textarea.inp.mono-result { min-height: 140px; }

  .opts-row { gap: 10px 16px; }
  .opt { font-size: 13px; }
  .opt select, .opt input[type=text], .opt input[type=number], .opt input[type=date] { min-width: 60px; height: 36px; }
  .actions .btn { padding: 9px 16px; font-size: 14px; }

  .cat-view-tools { grid-template-columns: 1fr; gap: 10px; }
  .mini-tool { padding: 12px 13px; }
  .mini-tool .t-icon { width: 36px; height: 36px; font-size: 16px; }
  .mini-tool b { font-size: 14px; }
  .mini-tool span { font-size: 12px; }

  /* 调色板竖排 */
  .pal-wrap { flex-direction: column; gap: 16px; }
  .pal-main { flex: none; max-width: 100%; width: 100%; }
  .pal-sv { max-width: 260px; }
  .pal-side { min-width: 0; width: 100%; }
  .pal-nums { grid-template-columns: repeat(3, 1fr); }

  /* 视频解析竖排 */
  .pa-item { flex-direction: column; gap: 10px; }
  .pa-thumb { width: 100%; height: 180px; }
  .pa-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .pa-url { min-height: 88px; font-size: 16px; }
  .pa-btns { width: 100%; }
  .pa-btns .btn { flex: 1; height: 44px; padding: 0 12px; }
  .pa-pics { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  /* 文件拖放 */
  .file-drop { padding: 20px 14px; }
  .cpt-pre { padding: 18px 12px; }
  .mf-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .mf-head .opt { min-width: 0; }

  /* LE 表格 */
  .le-table { font-size: 12px; }
  .le-table td.le-val { max-width: 140px; word-break: break-all; }

  /* Toast 上移避开 home 指示条 */
  .toast { bottom: calc(20px + env(safe-area-inset-bottom, 0)); }
}

/* ===== 小屏手机 ≤400px ===== */
@media (max-width: 400px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .brand-text { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  .top-user { gap: 5px; }
  .top-user a { padding: 6px 9px; font-size: 12px; }
  .top-search { min-width: 88px; }
  .user-chip { padding: 2px 2px 2px 3px; }
  .user-chip .u-avatar { width: 24px; height: 24px; flex: 0 0 24px; font-size: 11px; }
  .user-chip .u-name { display: none; }   /* 极窄屏只留头像，避免撑破顶栏 */
  .user-chip .u-act { padding: 4px 10px 4px 9px; font-size: 12px; }
  .main { padding: 12px 10px 50px; }
  .hero-title { font-size: 22px; }
  .tool-head h1 { font-size: 17px; }
  .actions .btn { padding: 8px 14px; font-size: 13px; }
  .pal-nums { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 人机验证弹层 ===== */
@keyframes cap-fade { from { opacity: 0; } }
@keyframes cap-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes cap-sheet { from { transform: translateY(100%); } }
@keyframes cap-spin { to { transform: rotate(360deg); } }

.cap-mask {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, .38);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: cap-fade .2s ease-out;
}
.cap-mask[hidden] { display: none !important; }
.cap-box {
  width: 100%; max-width: 380px; max-height: 70vh; overflow: auto;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius); padding: 20px 20px 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  animation: cap-pop .26s cubic-bezier(.18, .89, .32, 1.08);
}
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cap-title { display: inline-flex; align-items: center; gap: 7px; }
.cap-title b {
  font-size: 15px; font-weight: 600;
  color: var(--accent-ink);
}
.cap-shield { color: var(--accent-ink); }
.cap-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  color: var(--muted); border-radius: var(--radius-sm);
  transition: background .15s, color .15s, transform .15s;
}
.cap-close:hover { color: var(--text); background: rgba(15, 23, 42, .06); }
.cap-close:active { transform: scale(.92); }
.cap-desc { font-size: 12.5px; color: var(--muted); margin: 12px 0 14px; line-height: 1.55; }
.cap-state {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 12.5px; color: var(--muted); min-height: 20px;
}
.cap-state-txt { flex: 1; }
.cap-state.err { color: var(--err); }
.cap-state.ok { color: var(--ok); }
.cap-state:not(.loading) .cap-spinner { display: none; }
.cap-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: cap-spin .8s linear infinite;
}
.cap-retry { width: 100%; margin-top: 12px; }

@media (max-width: 480px) {
  .cap-mask { padding: 16px; }
  .cap-box {
    width: 92%; max-width: none; max-height: 70vh; overflow-y: auto;
    border-radius: var(--radius);
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    animation: cap-pop .26s cubic-bezier(.18, .89, .32, 1.08);
  }
}

/* ============ 网站资源抓取 site_fetch ============ */
.sf-box { display: flex; flex-direction: column; gap: 10px; }
.sf-row { display: flex; gap: 8px; align-items: stretch; }
.sf-input {
  flex: 1; min-width: 0; padding: 0 12px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: rgba(255, 255, 255, .9); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.sf-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.sf-tip { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.sf-view { min-height: 0; }
.sf-prog { height: 6px; border-radius: var(--radius-xs); background: var(--accent-soft); overflow: hidden; }
.sf-prog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: var(--radius-xs); transition: width .45s ease; }
.sf-line { font-size: 13px; color: var(--muted); }
.sf-url { font-size: 12px; color: var(--muted); font-family: var(--mono); word-break: break-all;
  background: rgba(15, 23, 42, .04); border-radius: var(--radius-sm); padding: 6px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-done { font-size: 14px; color: var(--ok); font-weight: 600; }
.sf-fail { font-size: 14px; color: var(--err); }
.sf-dl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0; }
.sf-dl { text-decoration: none; }
.sf-expire { font-size: 12px; color: var(--muted); }
.sf-files { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sf-files-head { padding: 8px 12px; font-size: 12px; color: var(--muted); background: rgba(245, 247, 250, .9); border-bottom: 1px solid var(--line); }
.sf-file { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px;
  font-size: 12.5px; border-top: 1px dashed var(--line); }
.sf-file:first-of-type { border-top: none; }
.sf-file-name { font-family: var(--mono); word-break: break-all; min-width: 0; }
.sf-file-size { color: var(--muted); white-space: nowrap; }

/* ============ 网站资源抓取 · 多任务列表 ============ */
.sf-none { font-size: 13px; color: var(--muted); padding: 8px 2px; }
.sf-task { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--panel); }
.sf-task-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sf-task-url { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-st { font-size: 12px; font-weight: 600; white-space: nowrap; }
.sf-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: var(--radius-xs); line-height: 1; }
.sf-x:hover { background: var(--accent-soft); color: var(--accent-ink); }
.sf-rm { padding: 4px 12px !important; font-size: 12.5px !important; }

/* ---------------- 二维码生成 / 解码 ---------------- */
.qr-wrap { display: flex; gap: 22px; flex-wrap: wrap; }
.qr-left { flex: 1 1 380px; min-width: 300px; }
.qr-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 460px; margin: 0 auto; }
.qr-stage { width: 100%; min-height: 250px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .55); padding: 14px; box-sizing: border-box; }
.qr-stage canvas { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.qr-empty, .qr-err { color: var(--muted); font-size: 13px; text-align: center; padding: 34px 12px; }
.qr-err { color: var(--err); }
.qr-opts input[type=color] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.qr-btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qr-btn-row .hint { margin-top: 0; }

.qrdec-result { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .55); }
.qrdec-result[hidden] { display: none !important; }
.qrdec-thumb { flex: 0 0 150px; max-width: 150px; }
.qrdec-thumb img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qrdec-body { flex: 1 1 280px; min-width: 0; }
.hf-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------------- LaTeX 公式编辑 ---------------- */
.ktx-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 2px; }
.ktx-chip-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.ktx-chip { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .8); color: var(--text); font-size: 12px; padding: 3px 11px; border-radius: var(--radius-sm); cursor: pointer; line-height: 1.6; }
.ktx-chip:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.ktx-char { font-family: var(--mono); }
.ktx-chip-gap { flex-basis: 100%; height: 0; }
.ktx-preview { min-height: 96px; display: flex; align-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .55); padding: 18px 22px; margin-top: 10px; overflow-x: auto; line-height: 1.5; }
.ktx-preview.ktx-empty { color: var(--muted); font-size: 13px; }
.ktx-err { min-height: 20px; margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(220, 38, 38, .07); color: var(--err); font-size: 12.5px; overflow-x: auto; }
.ktx-err[hidden] { display: none !important; }

/* ---------------- Mermaid 绘图 ---------------- */
.mmd-stage { margin-top: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .55); padding: 16px; overflow-x: auto; min-height: 120px; }
.mmd-stage svg { max-width: 100%; height: auto; }
.mmd-loading, .mmd-empty { color: var(--muted); font-size: 13px; padding: 34px 12px; text-align: center; }
.mmd-err { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(220, 38, 38, .07); color: var(--err); font-size: 12.5px; overflow-x: auto; }
.mmd-err[hidden] { display: none !important; }

/* ---------------- PDF 编辑 / 转图片 ---------------- */
.pdf-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pdf-acts .hint { margin-top: 0; }
.pdf-bar { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--panel); margin-bottom: 12px; }
.pdf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pdf-row .lbl { font-size: 13px; color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pdf-row input[type=number].w60, .pdf-row .w60 { width: 64px; }
.pdf-row input[type=text],
.pdf-row input[type=number],
.pdf-row input[type=password],
.pdf-row select,
.pdf-row .inp {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 34px;
  font-size: 13px;
  background: rgba(255, 255, 255, .9);
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border .15s, box-shadow .15s;
}
.pdf-row input:focus, .pdf-row select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.pdf-row input[type=text], .pdf-row .inp { flex: 1 1 140px; }
.pdf-row select { width: auto; min-width: 96px; cursor: pointer; }
.pdf-row input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.pdf-file { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--panel); }
.pdf-fname { font-weight: 600; font-size: 13px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-fmeta { font-size: 12px; color: var(--muted); flex: 1 1 auto; }
.pdf-frm { font-size: 12px; padding: 3px 10px; }
.pdf-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.pdf-thumb { position: relative; width: 178px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--panel); cursor: pointer; }
.pdf-thumb.sel { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.pdf-chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 2px 6px; }
.pdf-chk input { accent-color: var(--accent); }
.pdf-canvas { display: flex; align-items: center; justify-content: center; min-height: 60px; background: rgba(15, 23, 42, .04); border-radius: var(--radius-xs); overflow: hidden; }
.pdf-canvas canvas { max-width: 158px; max-height: 152px; }
.pdf-canvas.rot1 { transform: rotate(90deg); }
.pdf-canvas.rot2 { transform: rotate(180deg); }
.pdf-canvas.rot3 { transform: rotate(270deg); }
.pdf-pdl { position: absolute; bottom: 6px; right: 6px; font-size: 12px; padding: 2px 8px; opacity: .85; }
.pdf-thumb-err { color: var(--err); font-size: 11px; padding: 12px 6px; }
.pdf-edit-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }
