:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #1a1a1e;
  --muted: #8a8a90;
  --line: rgba(20, 20, 30, .08);
  --accent: #ff5a5f;
  --accent-d: #ec4750;
  --accent-2: #ff8a5c;
  --accent-soft: rgba(255, 90, 95, .10);
  --ok: #1f9d6b;
  --err: #d6455a;
  --shadow: 0 24px 60px -28px rgba(20, 20, 40, .30);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Outfit", -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景柔光 ---------- */
.bg-mesh {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(42% 42% at 14% 18%, rgba(255, 138, 92, .20), transparent 70%),
    radial-gradient(46% 46% at 86% 12%, rgba(255, 90, 95, .15), transparent 70%),
    radial-gradient(52% 52% at 78% 92%, rgba(120, 200, 180, .16), transparent 70%);
  filter: blur(6px);
  animation: drift 20s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2%, -2%); }
}

/* ---------- 顶部导航（玻璃态） ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 26px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px -12px rgba(255, 90, 95, .7);
}
.logo svg { width: 23px; height: 23px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.brand-txt small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge {
  font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-d);
  border: 1px solid rgba(255, 90, 95, .25);
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1100px; margin: 46px auto 6px; padding: 0 24px;
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
}
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-d);
  background: var(--accent-soft); padding: 6px 13px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 {
  margin: 0; font-weight: 800; letter-spacing: -.03em; line-height: 1.04;
  font-size: clamp(34px, 6vw, 56px); color: var(--ink);
}
.hero p { color: var(--muted); font-size: 16px; line-height: 1.75; max-width: 46ch; margin: 18px 0 0; }

.equalizer { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.equalizer span {
  width: 8px; border-radius: 6px; height: 30%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  animation: eq 1.1s ease-in-out infinite;
}
.equalizer span:nth-child(1) { animation-delay: 0s; }
.equalizer span:nth-child(2) { animation-delay: .15s; }
.equalizer span:nth-child(3) { animation-delay: .3s; }
.equalizer span:nth-child(4) { animation-delay: .45s; }
.equalizer span:nth-child(5) { animation-delay: .6s; }
.equalizer span:nth-child(6) { animation-delay: .25s; }
.equalizer span:nth-child(7) { animation-delay: .5s; }
.equalizer span:nth-child(8) { animation-delay: .1s; }
.equalizer span:nth-child(9) { animation-delay: .35s; }
.equalizer span:nth-child(10) { animation-delay: .55s; }
@keyframes eq { 0%, 100% { height: 22%; } 50% { height: 92%; } }

/* ---------- 布局：步骤导航 + 流程 ---------- */
.layout {
  max-width: 1100px; margin: 30px auto 60px; padding: 0 24px;
  display: grid; grid-template-columns: 200px 1fr; gap: 30px; align-items: start;
}
.rail { position: sticky; top: 92px; }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rail li {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 13px;
  color: var(--muted); font-size: 14px; font-weight: 500;
}
.rail li i {
  width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted);
}
.rail li.on { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
.rail li.on i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; }

.flow { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px); animation: rise .6s ease forwards;
}
.flow > .card:nth-child(1) { animation-delay: .04s; }
.flow > .card:nth-child(2) { animation-delay: .12s; }
.flow > .card:nth-child(3) { animation-delay: .20s; }
.flow > .card:nth-child(4) { animation-delay: .28s; }
.flow > .card:nth-child(5) { animation-delay: .36s; }
@keyframes rise { to { opacity: 1; transform: none; } }

.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.step-head .num {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 18px -8px rgba(255, 90, 95, .6);
}
.step-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.hint { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 14px; }

/* ---------- 上传区 ---------- */
.dropzone {
  display: block; border: 2px dashed var(--line); border-radius: 16px; padding: 34px;
  text-align: center; cursor: pointer; transition: .25s; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fbfbfa, #f7f7f5);
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-inner { color: var(--muted); }
.dz-inner p { margin: 12px 0 4px; font-size: 15px; color: var(--ink); font-weight: 500; }
.dz-inner small { font-size: 12.5px; }
.dz-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
  display: grid; place-items: center; color: var(--accent-d);
  background: var(--accent-soft); transition: .25s;
}
.dz-icon svg { width: 30px; height: 30px; }
.dropzone:hover .dz-icon { transform: scale(1.06); background: rgba(255, 90, 95, .16); }
.preview { max-width: 100%; max-height: 340px; border-radius: 14px; margin-top: 16px; display: block; box-shadow: var(--shadow); }

/* 多图缩略图 */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; margin-top: 16px; }
.thumb {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: #f3f3f1; box-shadow: 0 8px 18px -12px rgba(20,20,40,.3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(20,20,30,.62); color: #fff; font-size: 13px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(4px); transition: .15s;
}
.thumb-x:hover { background: var(--err); transform: scale(1.08); }

/* ---------- 按钮 ---------- */
.row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 12px; padding: 12px 22px; font-size: 14.5px; cursor: pointer;
  background: #f0f0ee; color: var(--ink); transition: .18s; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn .ico { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #ff7a6b); color: #fff;
  box-shadow: 0 12px 26px -12px rgba(255, 90, 95, .7);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(255, 90, 95, .8); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-d); background: var(--accent-soft); }
.btn.download {
  background: linear-gradient(135deg, var(--accent), #ff7a6b); color: #fff; text-decoration: none;
  display: inline-block; margin-top: 14px; box-shadow: 0 12px 26px -12px rgba(255, 90, 95, .7);
}
.status { font-size: 13.5px; color: var(--muted); }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }

/* ---------- 调试面板：模型原始返回 ---------- */
.raw-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.raw-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  user-select: none;
}
.raw-panel > summary::-webkit-details-marker { display: none; }
.raw-panel > summary::before {
  content: "";
  width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .2s ease;
}
.raw-panel[open] > summary::before { transform: rotate(45deg); }
.raw-meta { font-weight: 500; color: var(--muted); font-size: 12.5px; }
.raw-body { padding: 0 16px 16px; }
.raw-sub { font-size: 12px; color: var(--muted); margin: 12px 0 6px; letter-spacing: .02em; }
.raw-pre {
  margin: 0;
  max-height: 300px; overflow: auto;
  padding: 12px 14px;
  background: #1a1a1e; color: #e9e9ee;
  border-radius: 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------- 对话编辑 ---------- */
.conv-list { display: flex; flex-direction: column; gap: 10px; }
.conv-item {
  display: grid; grid-template-columns: 92px 1fr 36px; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: #fcfcfb; transition: .2s;
}
.conv-item.me { background: #fff6f6; border-color: #ffd9db; }
.conv-item:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.conv-item input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; width: 100%;
  background: #fff; color: var(--ink); font-family: inherit; transition: .15s;
}
.conv-item input:focus { outline: none; border-color: var(--accent); }
.side-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 40px;
  background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: .15s;
}
.side-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.conv-item.me .side-toggle { background: var(--accent); border-color: var(--accent); color: #fff; }
.side-dot { width: 9px; height: 9px; border-radius: 50%; background: #c9c9c6; }
.conv-item.me .side-dot { background: #fff; }
.conv-item .del {
  border: none; background: #fdecee; color: var(--err); border-radius: 10px; cursor: pointer;
  height: 38px; font-size: 14px; transition: .15s;
}
.conv-item .del:hover { background: #f9d8dc; }
.txt-wrap { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

/* ---------- 分图分组（多图校对） ---------- */
.conv-group {
  border: 1px solid var(--line); border-radius: 18px; padding: 14px;
  background: #fcfcfb; margin-bottom: 14px;
}
.conv-group.errored { border-color: rgba(214, 69, 90, .45); background: #fff6f7; }
.group-head {
  display: flex; align-items: center; gap: 12px; padding-bottom: 10px;
  border-bottom: 1px dashed var(--line); margin-bottom: 12px;
}
.group-thumb {
  width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none;
  cursor: zoom-in; border: 1px solid var(--line); background: #f3f3f1;
}
.group-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.group-title strong { font-size: 14.5px; font-weight: 700; }
.group-count { font-size: 12px; color: var(--muted); margin-top: 2px; }
.conv-group.errored .group-count { color: var(--err); }
.group-actions { display: flex; gap: 6px; flex: none; }
.g-move, .g-del {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 15px; color: var(--ink); display: grid; place-items: center;
  transition: .15s; font-family: inherit;
}
.g-move:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-d); }
.g-del:hover { border-color: var(--err); background: #fdecee; color: var(--err); }
.conv-lines { display: flex; flex-direction: column; gap: 10px; }
.conv-group .add-line { margin-top: 10px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.sort-row { margin: 0 0 14px; }

/* ---------- 聊天气泡式校对 ---------- */
.conv-list { display: flex; flex-direction: column; gap: 2px; }
.conv-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 6px; border-radius: 14px; transition: background .15s, box-shadow .15s;
}
.conv-row:hover { background: rgba(255, 90, 95, .04); }
.conv-row .row-check { order: 0; }
.conv-row .row-av { order: 1; }
.conv-row .row-main { order: 2; flex: 1 1 auto; }
.conv-row .row-acts { order: 3; }
/* 自己（右侧）：气泡在头像左侧、整条靠右对齐，操作按钮居于最右 */
.conv-row.me .row-main { order: 1; flex: 0 0 auto; margin-left: auto; align-items: flex-end; }
.conv-row.me .row-av { order: 2; }
.conv-row.me .row-acts { order: 3; }
.row-av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; background: #eee; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.row-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-row.selmode .row-av { cursor: pointer; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sp-name { font-weight: 600; color: var(--ink); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble {
  max-width: 100%; width: fit-content; padding: 10px 14px; border-radius: 18px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  outline: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.bubble:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bubble.me { background: linear-gradient(135deg, var(--accent), #ff7a6b); color: #fff; border-color: transparent; }
.row-acts { display: flex; flex-direction: column; gap: 6px; }
.mini {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 9px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s; white-space: nowrap;
}
.mini:hover { border-color: var(--accent); color: var(--accent-d); background: var(--accent-soft); }
.mini.del:hover { border-color: var(--err); color: var(--err); background: #fdecee; }
.conv-row.me .mini.side { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 编辑模式：勾选框在最左，其余顺序由上方 flex order 规则统一处理 */
.row-check { display: flex; align-items: center; justify-content: center; }
.row-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.conv-row.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px rgba(255, 90, 95, .35); }
.conv-row.dragging { opacity: .4; }
.drop-ph { height: 0; border-top: 3px dashed var(--accent); margin: 2px 0; border-radius: 3px; }
.sel-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid rgba(255, 90, 95, .25);
}
.sel-count { font-size: 13.5px; color: var(--accent-d); font-weight: 600; }

/* 底部按截图原始返回 & 头像（默认隐藏，renderSourcePanels 不再调用，故容器恒空） */
.src-panels { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.src-panels:empty { display: none; }
.src-panel {
  border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .55);
  overflow: hidden; box-shadow: var(--shadow);
}
.src-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  font-weight: 600; color: var(--ink); list-style: none; user-select: none;
}
.src-head::-webkit-details-marker { display: none; }
.src-head .src-title { font-weight: 700; }
.src-head .src-meta { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.src-head .src-del {
  margin-left: auto; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
}
.src-head .src-del:hover { color: var(--accent-d); border-color: var(--accent); }
.src-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.src-thumb { max-width: 160px; max-height: 160px; border-radius: 12px; cursor: zoom-in; border: 1px solid var(--line); box-shadow: var(--shadow); align-self: flex-start; }
.src-raw {
  margin: 0; padding: 10px 12px; background: rgba(20, 20, 30, .04); border-radius: 10px;
  font-size: 12px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow: auto;
}
.src-raw.err { background: rgba(255, 90, 95, .08); color: var(--accent-d); }
.src-avatars { display: flex; flex-wrap: wrap; gap: 12px; }
.src-av {
  display: flex; flex-direction: column; align-items: center; gap: 5px; width: 72px;
  border: none; background: none; cursor: pointer; font-family: inherit; padding: 0;
}
.src-av img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); border: 1px solid var(--line); }
.src-av:hover img { border-color: var(--accent); }
.src-av span { font-size: 11.5px; color: var(--muted); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.av-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.av-cell { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 72px; }
.av-cell img, .av-cell .av-def { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 6px rgba(0, 0, 0, .1); }
.av-cell .av-def { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 24px; }
.av-name { font-size: 11.5px; color: var(--muted); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.av-pick { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; font-family: inherit; }
.av-pick:hover { border-color: var(--accent); color: var(--accent-d); }

/* ---------- 图片放大查看（Lightbox） ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 14, .82); backdrop-filter: blur(6px); padding: 30px; cursor: zoom-out;
}
#lightbox img {
  max-width: 92vw; max-height: 88vh; border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}

/* ---------- 头像框选 ---------- */
#avatarPicker {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 14, .82); backdrop-filter: blur(6px); padding: 24px;
}
.ap-box {
  background: #fff; border-radius: 18px; width: min(520px, 92vw); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.ap-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px;
}
.ap-x { border: none; background: transparent; font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; }
.ap-x:hover { color: var(--err); }
.ap-stage {
  position: relative; background: #f3f3f1; max-height: 60vh; overflow: hidden; line-height: 0;
  touch-action: none; user-select: none;
}
.ap-stage img { display: block; width: 100%; height: auto; }
.ap-sel {
  position: absolute; border: 2px solid var(--accent); background: rgba(255, 90, 95, .18);
  pointer-events: none; box-sizing: border-box;
}
.ap-foot { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.ap-tip { font-size: 12.5px; color: var(--muted); }
.ap-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 7px; }
.form-grid input {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14.5px;
  color: var(--ink); background: #fff; font-family: inherit; transition: .15s;
}
.form-grid input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- 歌曲结果 ---------- */
.song-result { margin-top: 20px; animation: rise .5s ease forwards; }
.player-wrap {
  display: flex; align-items: center; gap: 12px; background: linear-gradient(180deg, #fff, #fbfbfa);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
}
.player-ico {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  color: var(--accent-d); background: var(--accent-soft); flex: none;
}
.player-ico svg { width: 22px; height: 22px; }
.player-wrap audio { flex: 1; width: 100%; height: 40px; }
.lyrics-box h3 { margin: 18px 0 8px; font-size: 14px; color: var(--ink); font-weight: 600; }
.lyrics-box pre {
  background: #fafafa; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  max-height: 240px; overflow: auto; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; color: #33333a; font-family: inherit;
}

/* ---------- 进度条 ---------- */
.progress { margin-top: 16px; background: #ececec; border-radius: 999px; height: 12px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .06); }
.progress .bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s ease-out;
}
/* 生成中的流动光效：即便进度是估算出来的，也让人感觉"在动、没卡死" */
.progress .bar.shimmer { background-size: 200% 100%; animation: barShimmer 1.4s linear infinite; }
@keyframes barShimmer {
  0% { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}
.progress .bar.shimmer { background-image: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent)); }

/* ---------- MV 模板选择（图选，不写大段说明） ---------- */
.tpl-picker { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tpl-card {
  position: relative; padding: 0; border: 2px solid transparent; border-radius: 16px;
  overflow: hidden; cursor: pointer; background: none; width: 108px; flex: none;
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.tpl-card:hover { transform: translateY(-2px); }
.tpl-card.on { border-color: var(--accent); }
.tpl-card img { display: block; width: 100%; aspect-ratio: 480/653; object-fit: cover; background: #111; }
.tpl-card span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 0 7px; text-align: center;
  font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,.72), transparent);
}
.tpl-card.on span { background: linear-gradient(0deg, var(--accent), transparent); }
.tpl-card:disabled { opacity: .5; pointer-events: none; }
.mv-regen { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- MV 结果 ---------- */
.mv-result { margin-top: 18px; }
.mv-result video { width: 100%; border-radius: 16px; background: #0d0d10; box-shadow: var(--shadow); display: block; }

/* ---------- 风格选择 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.field input {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14.5px;
  color: var(--ink); background: #fff; font-family: inherit; transition: .15s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.style-field { margin-bottom: 4px; }
.field-label { display: flex; align-items: baseline; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.field-sub { font-size: 12px; color: #b3b3b8; }
.style-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 13.5px;
  font-weight: 600; color: var(--ink); background: #fff; cursor: pointer; transition: .18s; font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { border-color: var(--accent); color: var(--accent-d); }
.chip.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent;
  box-shadow: 0 10px 22px -12px rgba(255, 90, 95, .8);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .55; }

/* ---------- 历史记录 ---------- */
.hist-ico svg { width: 18px; height: 18px; }
.hist-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.hist-item {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 15px; background: #fcfcfb; transition: .18s;
}
.hist-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.hist-cover {
  width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.hist-cover svg { width: 22px; height: 22px; }
.hist-meta { flex: 1; min-width: 0; }
.hist-title { font-size: 14.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.hist-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-d); }
.hist-actions { display: flex; gap: 8px; flex: none; }
.hist-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.hist-btn:hover { border-color: var(--accent); color: var(--accent-d); }
.hist-btn.danger:hover { border-color: var(--err); color: var(--err); }
.hist-btn svg { width: 15px; height: 15px; }
.hist-empty { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 50px; }

.hidden { display: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .rail { display: none; }
  .hero { grid-template-columns: 1fr; }
  .equalizer { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ==================== 顶部导航（登录态 / 额度） ==================== */
.brand { text-decoration: none; color: inherit; }
.nav-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-link {
  font-size: 14px; font-weight: 600; color: var(--ink);
  text-decoration: none; padding: 7px 12px; border-radius: 999px;
  transition: background .18s, color .18s;
}
.nav-link:hover { background: var(--accent-soft); color: var(--accent-d); }
.nav-link.on { background: var(--accent-soft); color: var(--accent-d); }
.nav-link.primary, .nav-link.primary:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 18px -10px rgba(255, 90, 95, .8);
}
.nav-link.linklike {
  border: none; background: none; cursor: pointer; font-family: inherit;
  color: var(--muted); font-weight: 500;
}
.nav-link.linklike:hover { color: var(--accent-d); background: var(--accent-soft); }
.nav-user {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  padding: 6px 10px; border-radius: 999px; background: rgba(20, 20, 30, .05);
}
.nav-quota {
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 2px 7px;
}

/* ==================== 通用：标签页 / 输入 / 提示 ==================== */
.tabs { display: flex; gap: 6px; margin: 2px 0 14px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 8px 15px; border-radius: 999px; transition: all .18s;
}
.tab:hover { color: var(--ink); border-color: rgba(20, 20, 30, .2); }
.tab.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 20px -12px rgba(255, 90, 95, .8);
}
.tab-pane { display: none; }
.tab-pane.on { display: block; }

.chat-input {
  width: 100%; min-height: 190px; resize: vertical;
  font-family: inherit; font-size: 14px; line-height: 1.7; color: var(--ink);
  background: #fbfbf9; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; outline: none;
}
.chat-input:focus { border-color: var(--accent); background: #fff; }
.file-info { font-size: 13px; color: var(--muted); margin-top: 10px; word-break: break-all; }

.inp {
  font-family: inherit; font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 11px; outline: none; flex: 1 1 160px; min-width: 0;
}
.inp:focus { border-color: var(--accent); }
.inp.sm { padding: 5px 8px; font-size: 12px; flex: 0 0 auto; }
.inp.num { flex: 0 0 88px; }
.inp.key { flex: 0 0 150px; }
.inp.wide { flex: 2 1 260px; }
.inp.ta { width: 100%; min-height: 62px; resize: vertical; line-height: 1.6; }

.row.center { justify-content: center; }
.btn.danger { background: #fff; color: var(--err); border: 1px solid rgba(214, 69, 90, .35); }
.btn.danger:hover { background: rgba(214, 69, 90, .08); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 14px);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  background: rgba(26, 26, 30, .92); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  max-width: 84vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.flow.narrow { max-width: 560px; margin: 36px auto; }

/* 无侧栏页面（登录 / 作品 / 后台）：单栏居中，不再被创作页的 200px 步骤栏占位 */
.layout.solo { grid-template-columns: 1fr; max-width: 1100px; }

/* 页头：标题居左、切换/操作居右 */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.page-head .step-head { margin-bottom: 0; }
.page-head .tabs { margin-bottom: 0; }

/* ==================== 登录 / 注册页 ==================== */
.auth-wrap {
  min-height: calc(100vh - 120px);
  display: grid; place-items: center; padding: 36px 20px 60px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 26px; box-shadow: var(--shadow);
  padding: 34px 34px 26px;
}
.auth-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.auth-logo {
  width: 50px; height: 50px; border-radius: 16px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 24px -12px rgba(255, 90, 95, .7);
}
.auth-logo svg { width: 26px; height: 26px; }
.auth-head h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: .5px; }
.auth-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: #f0f0ed; border-radius: 13px; padding: 4px; margin-bottom: 22px;
}
.seg-btn {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 700; color: var(--muted);
  padding: 10px 0; border-radius: 10px; transition: all .18s;
}
.seg-btn.on {
  background: #fff; color: var(--accent-d);
  box-shadow: 0 3px 10px rgba(20, 20, 40, .10);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .field { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.auth-form .field input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
  background: #fbfbf9; border: 1.5px solid var(--line); border-radius: 13px;
  padding: 13px 15px; outline: none; transition: border-color .18s, background .18s;
}
.auth-form .field input:focus { border-color: var(--accent); background: #fff; }
.auth-form .field input::placeholder { color: #c2c2c6; font-size: 13.5px; }
.btn.block { width: 100%; justify-content: center; padding: 13px; font-size: 15px; border-radius: 14px; }
.auth-status { min-height: 18px; margin: 0; font-size: 13px; font-weight: 600; }
.auth-status.ok { color: var(--ok); }
.auth-status.err { color: var(--err); }
.auth-foot {
  margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.7;
}

/* 联系平台获取账号（注册已关闭） */
.contact-box { margin-top: 22px; }
.contact-divider {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.contact-divider::before, .contact-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.contact-body {
  display: flex; align-items: center; gap: 16px;
  background: #fbfbf9; border: 1px solid var(--line); border-radius: 16px;
  padding: 14px;
}
.contact-qr {
  width: 118px; height: 118px; flex: none; display: block;
  border-radius: 12px; border: 1px solid var(--line); background: #fff;
}
.contact-txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.contact-txt b { font-size: 14px; color: var(--ink); }
.contact-txt span { font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* ==================== 管理后台：左侧菜单 + 右侧功能页 ==================== */
.layout.admin-layout {
  grid-template-columns: 232px 1fr; gap: 22px; max-width: 1180px; align-items: start;
}
.admin-side {
  position: sticky; top: 88px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: calc(100vh - 200px);
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 14px; border-bottom: 1px solid var(--line);
}
.logo.sm { width: 34px; height: 34px; border-radius: 11px; }
.logo.sm svg { width: 19px; height: 19px; }

.admin-menu { display: flex; flex-direction: column; gap: 4px; }
.admin-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 11px 13px; border-radius: 13px; text-align: left;
  transition: background .18s, color .18s, box-shadow .18s;
}
.admin-item svg { width: 18px; height: 18px; flex: none; }
.admin-item:hover { background: var(--accent-soft); color: var(--accent-d); }
.admin-item.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 10px 22px -12px rgba(255, 90, 95, .8);
}
.admin-item.on svg { color: #fff; }

.admin-side-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.admin-side-foot b { color: var(--ink); }
.admin-side-foot .nav-link { padding: 0; font-size: 12px; }

.admin-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.admin-main .pane { display: none; }
.admin-main .pane.on { display: block; animation: rise .35s ease both; }

@media (max-width: 860px) {
  .layout.admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; min-height: 0; }
  .admin-menu { flex-direction: row; overflow-x: auto; }
  .admin-item { width: auto; white-space: nowrap; }
  .admin-side-foot { flex-direction: row; justify-content: space-between; }
}

/* ==================== 风格 chip：效果预听 ==================== */
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.chip .chip-play {
  font-size: 10px; line-height: 1; color: var(--accent-d);
  background: var(--accent-soft); border-radius: 999px; padding: 4px 6px;
  margin-left: 2px; cursor: pointer;
}
.chip.previewing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip.previewing .chip-play { background: var(--accent); color: #fff; }

.publish-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
}

/* ==================== 作品卡片 / 广场 ==================== */
.work-grid {
  display: grid; gap: 16px; margin-top: 4px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.work-card {
  position: relative; cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.work-card:hover { transform: translateY(-3px); box-shadow: 0 30px 60px -28px rgba(20, 20, 40, .38); }
.wc-cover {
  width: 100%; height: 132px; object-fit: cover; display: block; background: #eee;
}
.wc-cover.ph {
  display: grid; place-items: center; height: 132px;
  background: linear-gradient(135deg, rgba(255, 90, 95, .22), rgba(255, 138, 92, .28), rgba(120, 200, 180, .3));
}
.wc-cover.ph span { font-size: 34px; color: rgba(255, 255, 255, .9); text-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.wc-body { padding: 12px 14px 14px; }
.wc-body h4 {
  margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wc-author { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.wc-tag {
  font-size: 11px; font-weight: 700; color: var(--accent-d);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 8px;
}
.wc-tag.public { color: var(--ok); background: rgba(31, 157, 107, .12); }
.wc-sub { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.wc-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; font-weight: 700; color: #fff; background: rgba(26, 26, 30, .55);
  border-radius: 999px; padding: 3px 9px;
}
.wc-badge.public { background: var(--ok); }
.wc-cover-wrap { position: relative; }
.wc-play {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: #fff; background: rgba(20, 16, 26, .6);
  border-radius: 999px; padding: 3px 9px 3px 7px; backdrop-filter: blur(2px);
}
.wc-play svg { width: 11px; height: 11px; fill: #fff; }

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(20, 20, 30, .5); backdrop-filter: blur(4px); padding: 20px;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.modal-foot:empty { display: none; }
.m-video { width: 100%; max-height: 46vh; background: #000; border-radius: 14px; }
.m-audio-wrap { margin-top: 14px; }
.m-audio { width: 100%; }
.m-info {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 12px; font-size: 12.5px; color: var(--muted);
}
.m-lyrics { margin-top: 16px; }
.m-lyrics h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.m-lyrics pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 13.5px; line-height: 1.75;
  background: #fbfbf9; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}

/* ==================== 管理后台 ==================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat {
  background: #fbfbf9; border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-size: 22px; font-weight: 800; color: var(--accent-d); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

.table-wrap { overflow-x: auto; margin-top: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.tbl th, .tbl td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tbl td { color: var(--ink); }
.tbl .acts { white-space: nowrap; display: flex; gap: 6px; }

.style-admin { display: flex; flex-direction: column; gap: 12px; }
.style-row {
  border: 1px solid var(--line); border-radius: 16px; padding: 12px;
  background: #fbfbf9; display: flex; flex-direction: column; gap: 8px;
}
.sr-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sr-file { font-size: 11px; max-width: 190px; }
.preview-line { flex-wrap: wrap; }
