:root {
  --bg: #fafaf9;
  --side: #f3f2f0;
  --surface: #ffffff;
  --surface-2: #f5f4f2;
  --text: #1c1b1a;
  --text-2: #57534e;
  --muted: #a19c96;
  --line: #e8e6e3;
  --line-strong: #d9d6d2;
  --primary: #1c1b1a;
  --primary-text: #fafaf9;
  --accent: #e5484d;
  --accent-soft: #fdecec;
  --ok: #2f8a57;
  --bad: #d13f3f;
  --shadow: 0 1px 2px rgba(28, 27, 26, .04), 0 4px 16px rgba(28, 27, 26, .05);
  --side-w: 288px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --side: #161615;
    --surface: #1a1a19;
    --surface-2: #222221;
    --text: #ecebe9;
    --text-2: #b5b1ab;
    --muted: #77736d;
    --line: #2a2928;
    --line-strong: #3a3836;
    --primary: #ecebe9;
    --primary-text: #111110;
    --accent: #ff6369;
    --accent-soft: #3a1d1e;
    --ok: #5ec48a;
    --bad: #ff7a7a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
svg { flex: none; }

/* ---------- 布局 ---------- */
.app { min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20;
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 10px calc(env(safe-area-inset-bottom) + 10px);
}
.main { margin-left: var(--side-w); min-width: 0; padding: 0 32px 48px; }
.scrim { display: none; }
.topbar { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: min(86vw, 320px); }
  body.side-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .18); }
  body.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, .25); }
  .main { margin-left: 0; padding: 0 16px 40px; }
  .topbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 10;
    margin: 0 -16px; padding: calc(env(safe-area-inset-top) + 6px) 16px 6px 8px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.8) blur(14px); -webkit-backdrop-filter: saturate(1.8) blur(14px);
  }
  .topbar-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- 侧边栏 ---------- */
.side-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; }
.brand { font-weight: 650; font-size: 15px; letter-spacing: .2px; }
.new-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 550; font-size: 14px; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.new-btn:hover { border-color: var(--muted); }
.side-label {
  display: flex; justify-content: space-between; padding: 18px 8px 6px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.lib { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; overscroll-behavior: contain; }
.lib-empty { font-size: 13px; color: var(--muted); padding: 8px; }
.lib-item {
  position: relative; display: flex; gap: 10px; align-items: center; width: 100%;
  padding: 8px; border-radius: 10px; border: none; background: none; text-align: left; cursor: pointer;
}
.lib-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.lib-item.active { background: var(--surface); box-shadow: var(--shadow); }
.lib-thumb { width: 40px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--line); flex: none; }
.lib-text { min-width: 0; flex: 1; padding-right: 14px; }
.lib-title { font-size: 13.5px; font-weight: 550; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-del {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; border: none;
  background: var(--surface-2); color: var(--muted); cursor: pointer; opacity: 0; display: grid; place-items: center;
}
.lib-item:hover .lib-del { opacity: 1; }
@media (hover: none) { .lib-del { opacity: .8; } }
.side-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 10px 8px; border-radius: 10px;
  border: none; background: none; color: var(--text-2); font-size: 14px; cursor: pointer;
}
.side-foot:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }

/* ---------- 输入区 ---------- */
.composer { max-width: 760px; margin: 0 auto; padding-top: 32px; }
@media (max-width: 900px) { .composer { padding-top: 8px; } }
.composer-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 6px; transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--line-strong); }
.composer-box textarea, .composer-box input {
  display: block; width: 100%; border: none; background: none; color: var(--text); font: inherit;
  padding: 10px 12px; resize: none; outline: none;
}
.composer-box textarea { font-size: 15.5px; }
.composer-box input { font-size: 13.5px; color: var(--text-2); border-top: 1px dashed var(--line); }
.composer-box ::placeholder { color: var(--muted); }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 4px 2px; }
.status { font-size: 13px; color: var(--muted); margin: 10px 4px 0; min-height: 1.2em; }
.status.error { color: var(--bad); }

.empty { max-width: 760px; margin: 40px auto 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 550; cursor: pointer; transition: opacity .15s, background .15s, border-color .15s;
}
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--line-strong); }
.btn.block { width: 100%; height: 40px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: none; background: none; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.link-btn { border: none; background: none; color: var(--text-2); font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.link-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn:disabled { opacity: .4; cursor: default; }

/* ---------- 工作区 ---------- */
.workspace {
  max-width: 1280px; margin: 24px auto 0;
  display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 20px; align-items: start;
}
@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; max-width: 760px; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 1101px) { .source { position: sticky; top: 20px; } }

.viewer { position: relative; background: #0d0d0c; aspect-ratio: 3 / 4; display: grid; place-items: center; }
.v-nav {
  position: absolute; top: 50%; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.45); color: #fff; font-size: 24px; line-height: 1; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.v-nav:hover { background: rgba(0,0,0,.7); }
.viewer:hover .v-nav { opacity: 1; }
@media (hover: none) { .v-nav { opacity: .85; } }
.v-prev { left: 8px; }
.v-next { right: 8px; }
.v-count { position: absolute; right: 10px; top: 10px; font-size: 11.5px; color: #fff; background: rgba(0,0,0,.5); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; pointer-events: none; }
@media (max-width: 1100px) { .viewer { aspect-ratio: auto; max-height: 62vh; } .viewer img, .viewer video { max-height: 62vh; } }
.viewer img, .viewer video { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.thumbs::-webkit-scrollbar { display: none; }
.thumbs:empty { display: none; }
.thumb { flex: none; width: 44px; height: 58px; border-radius: 6px; border: 2px solid transparent; padding: 0; overflow: hidden; cursor: pointer; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--primary); }

.source-body { padding: 16px; }
.source-title { display: block; font-size: 16px; font-weight: 650; line-height: 1.45; color: var(--text); text-decoration: none; }
.source-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
.stats { display: flex; gap: 4px 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); margin-left: 2px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.orig { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.orig summary { cursor: pointer; font-size: 13px; color: var(--text-2); list-style: none; }
.orig summary::-webkit-details-marker { display: none; }
.orig summary::before { content: '›'; display: inline-block; margin-right: 6px; transition: transform .15s; }
.orig[open] summary::before { transform: rotate(90deg); }
.orig p { white-space: pre-wrap; font-size: 13.5px; color: var(--text-2); margin: 8px 0 0; }

/* ---------- 输出 ---------- */
.output { padding: 6px 20px 20px; }
@media (max-width: 600px) { .output { padding: 4px 14px 16px; } }
.output-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.versions { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.version { border: none; background: none; padding: 5px 10px; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.version.active { background: var(--surface-2); color: var(--text); font-weight: 600; }

.streaming { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; padding: 24px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .2; transform: scale(.8); } }

.sec { padding: 18px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: none; padding-bottom: 4px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sec-head h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .6px; }
.ref { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.ref b { color: var(--text-2); font-weight: 550; }

.opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; margin-bottom: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--line-strong); }
.opt.active { border-color: var(--primary); background: var(--surface-2); }
.opt-radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; margin-top: 4px; }
.opt.active .opt-radio { border: 5px solid var(--primary); }
.opt-main { flex: 1; min-width: 0; }
.opt-text { font-size: 15.5px; font-weight: 600; }
.opt-note { font-size: 12px; color: var(--muted); margin-top: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.cover-form { display: grid; gap: 10px; margin-top: 12px; }
.cover-form input {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; outline: none;
}
.cover-form input:focus { border-color: var(--line-strong); }
.cover-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; padding: 5px 10px; border-radius: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cover-row .btn.primary { margin-left: auto; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin-top: 14px; }
.covers:empty { display: none; }
.cover { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 2 / 3; border: 1px solid var(--line); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-state { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 10px; font-size: 12px; color: var(--muted); }
.cover-state.err { color: var(--bad); }
.cover-label { position: absolute; left: 6px; top: 6px; font-size: 10.5px; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; max-width: calc(100% - 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover-actions { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 6px; }
.cover-actions button { flex: 1; height: 28px; border-radius: 7px; border: none; font-size: 12px; font-weight: 600; cursor: pointer; background: rgba(255,255,255,.92); color: #1c1b1a; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--text); animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.body-text { white-space: pre-wrap; font-size: 15px; line-height: 1.75; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 13px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; }
.check { font-size: 13px; color: var(--text-2); }
.check.ok b { color: var(--ok); }
.check.bad b { color: var(--bad); }
.check ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
pre.raw { white-space: pre-wrap; word-break: break-all; font-size: 12px; color: var(--muted); max-height: 40vh; overflow: auto; margin: 0; }

/* ---------- 弹窗 & 提示 ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text);
  width: min(480px, calc(100vw - 32px)); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(0,0,0,.3); backdrop-filter: blur(2px); }
.settings-form h2 { margin: 0 0 16px; font-size: 17px; }
.label { display: block; font-size: 12.5px; color: var(--text-2); margin: 0 0 6px; font-weight: 500; }
.settings-form textarea, .settings-form input {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; resize: vertical; outline: none;
}
.settings-form textarea:focus, .settings-form input:focus { border-color: var(--line-strong); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 50;
  transform: translateX(-50%) translateY(12px); opacity: 0; pointer-events: none; transition: .2s;
  background: var(--primary); color: var(--primary-text); padding: 9px 16px; border-radius: 999px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 数字人 ---------- */
.avatar-entry {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 10px; text-align: left;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text);
}
.avatar-entry:hover { border-color: var(--line-strong); }
.avatar-entry > svg { color: var(--muted); }
.avatar-stack { display: flex; flex: none; }
.avatar-stack img, .avatar-stack .avatar-ph {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); margin-left: -8px; background: var(--surface-2);
}
.avatar-stack img:first-child, .avatar-stack .avatar-ph:first-child { margin-left: 0; }
.avatar-ph { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.avatar-entry-text { flex: 1; min-width: 0; }
.avatar-entry-text b { display: block; font-size: 13.5px; font-weight: 600; }
.avatar-entry-text small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-note { font-size: 12.5px; color: var(--muted); margin: -6px 0 16px; line-height: 1.6; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.avatar-cell { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.avatar-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-cell button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer; display: grid; place-items: center;
}
.avatar-add {
  aspect-ratio: 3 / 4; border-radius: 10px; border: 1.5px dashed var(--line-strong); background: none; color: var(--muted);
  display: grid; place-content: center; gap: 4px; font-size: 12px; cursor: pointer; text-align: center;
}
.avatar-add:hover { border-color: var(--muted); color: var(--text-2); }
.avatar-add span { font-size: 22px; line-height: 1; }

/* ---------- 数字人调试页 ---------- */
.avatar-entry.active { border-color: var(--primary); box-shadow: var(--shadow); }
.av-page { max-width: 1180px; margin: 0 auto; padding-top: 28px; }
@media (max-width: 900px) { .av-page { padding-top: 4px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: .3px; }
.page-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; }
.dirty { font-size: 12.5px; color: var(--accent); }
.av-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .av-layout { grid-template-columns: 1fr; } }
.av-config { padding: 2px 20px 10px; }
@media (min-width: 1101px) { .av-config { position: sticky; top: 20px; } }
.av-trials { padding: 16px 20px 20px; min-height: 300px; }
@media (max-width: 600px) { .av-config, .av-trials { padding-left: 14px; padding-right: 14px; } }
.sec-note { font-size: 12px; color: var(--muted); }
.field {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; outline: none; resize: vertical; margin-bottom: 8px;
}
.field:focus { border-color: var(--line-strong); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-cell { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; border: 2px solid transparent; padding: 0; }
.avatar-cell img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .55; transition: opacity .15s; }
.avatar-cell.on { border-color: var(--primary); }
.avatar-cell.on img { opacity: 1; }
.avatar-cell .tick {
  position: absolute; left: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #fff;
  background: rgba(0,0,0,.25); display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700;
}
.avatar-cell.on .tick { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.avatar-cell .del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: none;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; cursor: pointer; display: grid; place-items: center;
}
.avatar-add {
  aspect-ratio: 3 / 4; border-radius: 10px; border: 1.5px dashed var(--line-strong); background: none; color: var(--muted);
  display: grid; place-content: center; gap: 4px; font-size: 12px; cursor: pointer; text-align: center;
}
.avatar-add:hover { border-color: var(--muted); color: var(--text-2); }
.avatar-add span { font-size: 22px; line-height: 1; }

.saved-card { display: flex; gap: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 18px; align-items: center; }
.saved-card img { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.saved-card .ph { width: 64px; height: 96px; border-radius: 8px; flex: none; border: 1.5px dashed var(--line-strong); display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; }
.saved-card b { font-size: 13.5px; display: block; }
.saved-card p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.saved-card small { font-size: 11.5px; color: var(--muted); }
.trials-head { margin-bottom: 12px; }
.trials { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.trials-empty { color: var(--muted); font-size: 13px; padding: 30px 0; text-align: center; grid-column: 1 / -1; }
.trial { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.trial.sample { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.trial-img { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); }
.trial-img img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.trial-badge { position: absolute; left: 6px; top: 6px; font-size: 10.5px; padding: 2px 6px; border-radius: 6px; background: var(--primary); color: var(--primary-text); font-weight: 600; }
.trial-body { padding: 10px; display: grid; gap: 6px; align-content: start; }
.trial-title { font-size: 13px; font-weight: 600; }
.trial-meta { font-size: 11.5px; color: var(--muted); }
.trial-req { font-size: 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trial-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.trial-actions button { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; font-size: 12px; padding: 3px 8px; cursor: pointer; color: var(--text-2); }
.trial-actions button:hover { border-color: var(--line-strong); color: var(--text); }
.trial-actions button.main { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.trial details { font-size: 11.5px; color: var(--muted); }
.trial details summary { cursor: pointer; }
.trial details p { white-space: pre-wrap; margin: 4px 0 0; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10,10,10,.88); display: grid; place-items: center; padding: 56px 64px; cursor: zoom-out; }
@media (max-width: 600px) { .lightbox { padding: 52px 8px 44px; } }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 112px); border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); cursor: default; }
.lb-nav, .lb-close {
  position: absolute; border: none; cursor: pointer; color: #fff; background: rgba(255,255,255,.12); border-radius: 50%;
  display: grid; place-items: center; transition: background .15s;
}
.lb-nav:hover, .lb-close:hover { background: rgba(255,255,255,.24); }
.lb-nav { top: 50%; width: 48px; height: 48px; margin-top: -24px; font-size: 30px; line-height: 1; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
@media (max-width: 600px) { .lb-nav { width: 38px; height: 38px; margin-top: -19px; font-size: 24px; background: rgba(0,0,0,.4); } .lb-prev { left: 6px; } .lb-next { right: 6px; } }
.lb-close { top: max(12px, env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; font-size: 16px; }
.lb-count { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.8); font-size: 13px; font-variant-numeric: tabular-nums; }
.zoomable { cursor: zoom-in; }
.trial-actions button:disabled { opacity: .55; cursor: default; }

/* ---------- 设置页 ---------- */
.side-foot.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.saved-flag { color: var(--muted); }
.set-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .set-layout { grid-template-columns: 1fr; } }
.set-card { padding: 2px 20px 10px; }
@media (max-width: 600px) { .set-card { padding-left: 14px; padding-right: 14px; } }
@media (min-width: 1101px) { .side-card { position: sticky; top: 20px; } }
.me-input { display: flex; gap: 8px; align-items: flex-start; }
.me-input .field { margin-bottom: 0; }
.me-input .btn { height: 39px; flex: none; }
.me-card { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.me-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.me-card b { font-size: 16px; }
.me-card p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; }
.me-stats { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.elements { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.elements:empty { display: none; }
@media (max-width: 700px) { .elements { grid-template-columns: 1fr; } }
.el-card { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.el-card.wide { grid-column: 1 / -1; }
.el-card h4 { margin: 0 0 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.el-card p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.el-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.el-card .tags { margin-top: 0; }
.account-head { margin-bottom: 6px; }
.account-head .label { margin: 0; }
.me-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.me-note { text-decoration: none; color: var(--text); }
.me-note img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.me-note b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 550; margin-top: 6px; line-height: 1.4; }
.me-note small { font-size: 11.5px; color: var(--muted); }

.ref-account { margin-right: auto; align-self: center; font-size: 12px; color: var(--muted); text-decoration: none; padding: 4px 8px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ref-account:hover { background: var(--surface-2); color: var(--text-2); }
.ref-account.off { color: var(--accent); }

/* ---------- 内页 ---------- */
.sec-actions { display: flex; align-items: center; gap: 8px; }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.page-thumb { position: relative; text-align: center; color: var(--muted); font-size: 12px; }
.page-pick { display: block; width: 100%; border: none; background: none; padding: 0; cursor: pointer; }
.page-thumb.active .page-pick { cursor: zoom-in; }
.page-zoom {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s;
}
.page-thumb:hover .page-zoom, .page-thumb.active .page-zoom { opacity: 1; }
@media (hover: none) { .page-zoom { opacity: 1; } }
.page-canvas { width: 100%; aspect-ratio: 3 / 4; height: auto; display: block; border-radius: 8px; border: 2px solid var(--line); margin-bottom: 4px; }
.page-thumb.active .page-canvas { border-color: var(--primary); }
.page-thumb.active span { color: var(--text); font-weight: 600; }
.pages-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pages-bar .hint { margin: 0; }
.dropped { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.page-editor { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.page-editor .field { background: var(--surface); margin-bottom: 0; }
.pe-head, .pe-block-head { display: flex; align-items: center; justify-content: space-between; }
.pe-head b { font-size: 14px; }
.pe-block-head b { font-size: 12px; color: var(--muted); font-weight: 600; }
.pe-field { display: grid; gap: 4px; min-width: 0; }
.pe-label { font-size: 12px; color: var(--muted); }
.pe-label small { margin-left: 6px; }
.pe-label:empty { display: none; }
.pe-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .pe-two { grid-template-columns: 1fr; } }
.pe-block { display: grid; gap: 4px; }
.error-text { color: var(--bad); }

/* ---------- 复刻目的 ---------- */
.purpose-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px 4px; border-top: 1px dashed var(--line); }
.purpose-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.purpose-label.need { color: var(--bad); }
.purpose-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pchip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.pchip:hover { border-color: var(--muted); }
.pchip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.purpose-product { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 4px 8px; }
.side-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.side-foot.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }

/* ---------- 资源包 ---------- */
.assets-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .assets-layout { grid-template-columns: 1fr; } }
.products-panel { padding: 12px; display: grid; gap: 10px; }
.product-list { display: grid; gap: 4px; }
.product-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; border: none; background: none; cursor: pointer; text-align: left; width: 100%; }
.product-item:hover { background: var(--surface-2); }
.product-item.active { background: var(--surface-2); font-weight: 600; }
.product-item img, .product-item .ph { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: var(--line); flex: none; }
.product-item small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.product-editor { padding: 2px 20px 16px; min-height: 300px; }
.pe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 700px) { .pe-grid { grid-template-columns: 1fr; } }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.asset-cell { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.asset-img { position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); }
.asset-img img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.asset-img .del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 7px; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 12px; }
.asset-id { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,.55); color: #fff; font-family: ui-monospace, monospace; }
.asset-meta { padding: 8px; display: grid; gap: 6px; }
.asset-meta textarea, .asset-meta select { width: 100%; font: inherit; font-size: 12.5px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 6px 8px; resize: vertical; outline: none; }
.asset-meta textarea:focus { border-color: var(--line-strong); }
.asset-add { aspect-ratio: 3 / 4; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: none; color: var(--muted); cursor: pointer; display: grid; place-content: center; gap: 4px; font-size: 13px; }
.asset-add span { font-size: 26px; line-height: 1; }
.asset-add:hover { border-color: var(--muted); color: var(--text-2); }

/* ---------- AI 设计排版的内页 ---------- */
.page-frame { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 8px; border: 2px solid var(--line); background: #f3f1ee; margin-bottom: 4px; }
.page-thumb.active .page-frame { border-color: var(--primary); }
.page-frame > .k-page { position: absolute; top: 0; left: 0; transform-origin: 0 0; transform: scale(var(--s, .15)); pointer-events: none; }
.page-frame .pf-state { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: 12px; color: var(--muted); padding: 8px; }
.pf-state.err { color: var(--bad); }
.instruct { display: flex; gap: 8px; align-items: flex-start; }
.instruct textarea { flex: 1; }
.instruct .btn { flex: none; height: 38px; }
.mode-seg { margin-right: 4px; }

.composer-box .purpose-text { flex: 1 1 260px; width: auto; display: block; min-width: 0; font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 5px 10px; outline: none; }
.composer-box .purpose-text:focus { border-color: var(--muted); }

.layout-pick { display: flex; gap: 10px; align-items: flex-start; }
.layout-pick .field { flex: 1; }
.layout-preview:empty { display: none; }
.layout-preview { position: relative; flex: none; width: 54px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.layout-preview img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.layout-preview button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 5px; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; cursor: pointer; display: grid; place-items: center; }
.rec-dot { display: inline-grid; place-items: center; margin-left: 4px; font-size: 10px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; vertical-align: 1px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.sync-status { font-size: 11.5px; color: var(--muted); padding: 2px 10px 0; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-status.ok { color: var(--ok); }
.sync-status.bad { color: var(--bad); }
