:root {
  --bg: #070b14;
  --bg-2: #0c1322;
  --panel: rgba(18, 25, 40, 0.72);
  --panel-solid: #121a2b;
  --panel-2: rgba(30, 40, 60, 0.6);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eaf1f9;
  --muted: #93a4bd;
  --muted-2: #6b7c95;
  --accent: #7c5cff;
  --accent-2: #23c4d8;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #23c4d8 100%);
  --danger: #ff5d6c;
  --ok: #2fd27a;
  --warn: #ffd66b;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(35, 196, 216, 0.18), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================ 登录 ============================ */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(7,11,20,.92), rgba(7,11,20,.55)),
    url("/assets/hero.jpg") center/cover no-repeat;
  filter: saturate(1.05);
  z-index: -1;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
  animation: pop .35s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: .3px;
  margin-bottom: 22px;
}
.brand .logo { flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(124,92,255,.5)); }

.login-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: .5px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.field {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  margin-bottom: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .18);
}
.field .ico { font-size: 15px; opacity: .85; }
.field input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; padding: 13px 0; font-family: inherit;
}
.field input::placeholder { color: var(--muted-2); }

#login-btn {
  width: 100%; margin-top: 6px; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--accent-grad); color: #fff; border: none; border-radius: 12px;
  box-shadow: 0 10px 24px rgba(124, 92, 255, .35);
  transition: transform .08s, filter .15s;
}
#login-btn:hover { filter: brightness(1.08); }
#login-btn:active { transform: translateY(1px); }
#login-btn:disabled { opacity: .6; cursor: not-allowed; }

#reg-btn {
  width: 100%; margin-top: 14px; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--accent-grad); color: #fff; border: none; border-radius: 12px;
  box-shadow: 0 10px 24px rgba(124, 92, 255, .35);
  transition: transform .08s, filter .15s;
}
#reg-btn:hover { filter: brightness(1.08); }
#reg-btn:active { transform: translateY(1px); }
#reg-btn:disabled { opacity: .6; cursor: not-allowed; }

.login-foot { margin-top: 18px; text-align: center; color: var(--muted-2); font-size: 12.5px; }
.login-foot .link { cursor: pointer; color: #8fd0ff; text-decoration: none; }
.login-foot .link:hover { text-decoration: underline; }

/* 注册表单：短信验证码行（输入框 + 获取按钮） */
.sms-row { display: flex; gap: 10px; margin-bottom: 14px; }
.sms-row .field { flex: 1; margin-bottom: 0; min-width: 0; }
.sms-send {
  flex-shrink: 0; white-space: nowrap; padding: 0 16px; font-size: 14px; font-weight: 600;
  color: #fff; background: rgba(124, 92, 255, .9); border: none; border-radius: 12px;
  cursor: pointer; transition: filter .15s, opacity .15s;
}
.sms-send:hover:not(:disabled) { filter: brightness(1.08); }
.sms-send:disabled { opacity: .55; cursor: not-allowed; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }

/* 阿里云点选验证码容器：挑战以浮层弹出，容器空状态不显示、不占位 */
.alicaptcha-box:empty { display: none; margin: 0; min-height: 0; }
.alicaptcha-box { margin-bottom: 14px; min-height: 44px; }

/* ============================ 主应用 ============================ */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: rgba(10, 15, 26, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { margin-bottom: 0; font-size: 16px; }
.spacer { flex: 1; }

.credits-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255, 214, 107, 0.12);
  border: 1px solid rgba(255, 214, 107, 0.3);
  color: var(--warn); font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 999px;
}
.credits-pill i { font-style: normal; color: var(--muted); font-weight: 500; font-size: 12.5px; }

.user {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 5px 8px 5px 6px; border-radius: 999px;
  border: 1px solid var(--border); transition: border-color .15s;
}
.user:hover { border-color: var(--border-strong); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-grad); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.user #username { font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .caret { transition: transform .2s; }
.user.open .caret { transform: rotate(180deg); }
.user.open { border-color: var(--accent); }

/* 用户下拉菜单（交付级） */
.usermenu {
  position: absolute; right: 16px; top: 56px; z-index: 60;
  width: 236px;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 8px;
  box-shadow: 0 20px 48px rgba(0,0,0,.55);
  transform-origin: top right;
  animation: umIn .16s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes umIn { from { transform: scale(.92) translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.um-head {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 10px 12px;
}
.um-head .avatar { width: 40px; height: 40px; font-size: 17px; flex-shrink: 0; }
.um-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.um-info b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-info span { font-size: 12.5px; color: var(--muted); }
.um-info span i { font-style: normal; color: var(--warn); font-weight: 700; }
.um-sep { height: 1px; background: var(--border); margin: 0 6px 6px; }
.um-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  background: transparent; color: var(--text);
  padding: 11px 12px; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .14s ease, color .14s ease;
}
.um-item svg { flex-shrink: 0; opacity: .8; }
.um-item:hover { background: rgba(124, 92, 255, .12); }
.um-item.recharge { color: #ffd66b; }
.um-item.recharge:hover { background: rgba(255, 214, 107, .1); }
.um-item.danger { color: #ff8f9c; }
.um-item.danger:hover { background: rgba(255, 93, 108, .12); color: #ffb3bc; }

/* 充值弹窗 */
.modal-card.modal-sm { width: min(420px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 48px)); }
.recharge-body { display: flex; flex-direction: column; gap: 16px; }
.rc-balance {
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  padding: 22px 16px 18px;
  background: linear-gradient(135deg, rgba(255,214,107,.1), rgba(255,214,107,.03));
  border: 1px solid rgba(255,214,107,.28);
  border-radius: 16px;
}
.rc-balance-label { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; }
.rc-balance b { font-size: 40px; line-height: 1; color: var(--warn); font-weight: 800; }
.rc-balance b i { font-style: normal; }
.rc-balance b u { text-decoration: none; font-size: 14px; font-weight: 600; margin-left: 6px; color: var(--muted); }
.rc-account {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
}
.rc-account > span { font-size: 12.5px; color: var(--muted); }
.rc-account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rc-account-row b { font-size: 15px; }
.rc-copy {
  padding: 5px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  background: var(--panel); color: var(--accent-2);
  border: 1px solid var(--border-strong); border-radius: 999px;
  transition: all .15s ease;
}
.rc-copy:hover { border-color: var(--accent); color: #fff; }
.rc-copy.copied { color: var(--ok); border-color: var(--ok); }
.rc-steps { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--text); line-height: 1.9; }
.rc-tip { font-size: 12.5px; color: var(--muted); background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.rc-ok { margin-top: 4px; }

.layout { display: flex; flex: 1; min-height: 0; }

/* 侧边栏 */
.sidebar {
  width: 264px; flex-shrink: 0;
  background: rgba(10, 15, 26, 0.55);
  border-right: 1px solid var(--border);
  padding: 18px 14px; overflow-y: auto;
}
.side-title { color: var(--muted); font-size: 12px; margin: 4px 6px 12px; letter-spacing: 2px; }
.tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tool-list li {
  position: relative; display: flex; gap: 12px; align-items: center;
  padding: 10px; border-radius: 14px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  transition: border-color .15s, transform .08s, background .15s;
}
.tool-list li:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.tool-list li.active { border-color: transparent; background: linear-gradient(135deg, rgba(124,92,255,.25), rgba(35,196,216,.18)); box-shadow: inset 0 0 0 1px rgba(124,92,255,.5); }
.tool-list .t-thumb {
  width: 52px; height: 52px; border-radius: 11px; object-fit: cover; flex-shrink: 0;
  background: #0b1220;
}
.tool-list .t-info { min-width: 0; }
.tool-list .t-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-list .t-cost { font-size: 12px; color: var(--warn); margin-top: 3px; }

/* 侧边栏分组（模型系列归类，点击组头展开） */
.tool-list li.tool-group {
  flex-direction: column; align-items: stretch; gap: 0;
  padding: 4px;
}
.tool-list .tg-head {
  display: flex; gap: 12px; align-items: center;
  padding: 7px; border-radius: 11px; cursor: pointer;
  transition: background .15s;
}
.tool-list .tg-head:hover { background: rgba(255, 255, 255, .05); }
.tg-chevron { color: var(--muted); flex-shrink: 0; transition: transform .2s ease; }
.tool-group.open .tg-chevron { transform: rotate(90deg); }
.tool-list .tg-children {
  list-style: none; margin: 2px 0 0; padding: 0 0 2px 14px;
  display: none; flex-direction: column; gap: 8px;
}
.tool-group.open .tg-children { display: flex; }
.tg-children li { padding: 8px; }
.tg-children .t-thumb { width: 36px; height: 36px; border-radius: 9px; }
.tg-children .t-name { font-size: 12.5px; }
.tg-children .t-cost { font-size: 11px; margin-top: 2px; }

/* 首页分组卡片的模式列表 */
.c-subs { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.c-sub {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border);
  transition: border-color .14s, background .14s, transform .08s;
}
.c-sub:hover {
  border-color: var(--accent); background: rgba(124, 92, 255, .12);
  transform: translateX(2px);
}
.cs-name { font-size: 13px; font-weight: 600; }
.cs-cost { font-size: 12px; color: var(--warn); flex-shrink: 0; }
.c-hint { font-size: 12px; color: var(--muted); }
.play-badge {
  position: absolute; left: 10px; top: 10px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
}

/* 主区域 */
.main { flex: 1; overflow-y: auto; padding: 24px; }

/* 首页 */
.home-hero {
  display: flex; gap: 22px; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 22px; padding: 28px 30px; box-shadow: var(--shadow);
  overflow: hidden; position: relative;
}
.home-hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(124,92,255,.35), transparent 70%);
}
.home-hero-text { flex: 1; min-width: 0; }
.home-hero-text h2 { margin: 0 0 10px; font-size: 26px; line-height: 1.3; }
.home-hero-text p { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; max-width: 540px; line-height: 1.7; }
.home-hero-img { width: 280px; height: 170px; object-fit: cover; border-radius: 16px; box-shadow: 0 14px 30px rgba(0,0,0,.5); flex-shrink: 0; }
.home-stats { display: flex; gap: 14px; }
.stat {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 20px; min-width: 110px;
}
.stat b { display: block; font-size: 24px; font-weight: 800; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 12.5px; color: var(--muted); }

.home-title { margin: 28px 4px 14px; font-size: 15px; color: var(--muted); letter-spacing: 1px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  overflow: hidden; cursor: pointer; transition: transform .12s, border-color .15s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card .c-thumb { width: 100%; height: 140px; object-fit: cover; display: block; background: #0b1220; }
.card .c-body { padding: 14px 15px 15px; }
.card .c-name { font-size: 15px; font-weight: 700; }
.card .c-desc { font-size: 12.5px; color: var(--muted); margin: 6px 0 12px; line-height: 1.5; min-height: 38px; }
.card .c-foot { display: flex; align-items: center; justify-content: space-between; }
.card .c-cost { font-size: 13px; color: var(--warn); font-weight: 700; }
.card .c-use {
  background: var(--accent-grad); color: #fff; border: none; border-radius: 9px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
}
.card .c-thumb-wrap { position: relative; }
.card .c-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}

/* 工具面板 */
.panel { max-width: 1360px; }
.panel-body {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.panel-right {
  position: sticky; top: 20px;
  min-height: 320px;
}
.result-title {
  font-size: 14px; font-weight: 700; color: var(--muted);
  letter-spacing: .04em; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.result-title::before {
  content: ""; width: 4px; height: 14px; border-radius: 2px;
  background: var(--accent-grad, linear-gradient(135deg,#7c5cff,#5ca8ff));
}
.result-area:empty::before {
  content: "生成结果会显示在这里";
  display: flex; align-items: center; justify-content: center;
  min-height: 280px;
  border: 1.5px dashed var(--border); border-radius: 18px;
  color: var(--muted); font-size: 13.5px;
}
.tool-head { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.tool-thumb { width: 84px; height: 84px; border-radius: 16px; object-fit: cover; box-shadow: 0 10px 24px rgba(0,0,0,.5); flex-shrink: 0; background:#0b1220; }
.tool-head-info h2 { margin: 0 0 6px; font-size: 22px; }
.tool-head-info p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.cost-badge {
  display: inline-block; background: rgba(255,214,107,.12); border: 1px solid rgba(255,214,107,.3);
  color: var(--warn); font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px;
}

.tool-form { display: flex; flex-direction: column; gap: 16px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.tool-form input, .tool-form textarea, .tool-form select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; color: var(--text); font-size: 14.5px;
  outline: none; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.tool-form textarea { min-height: 110px; resize: vertical; }
.tool-form input:focus, .tool-form textarea:focus, .tool-form select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.16);
}

.primary-btn {
  margin-top: 18px; padding: 15px; font-size: 16px; font-weight: 700; color: #fff;
  background: var(--accent-grad); border: none; border-radius: 13px; width: 100%;
  box-shadow: 0 12px 26px rgba(124,92,255,.32); transition: transform .08s, filter .15s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .65; cursor: not-allowed; filter: none; }
.cost-inline { font-size: 13px; font-weight: 600; opacity: .9; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.18); }

.msg { font-size: 13.5px; margin-top: 14px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* 结果区 */
.result-area { margin-top: 0; }
.result-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px; box-shadow: var(--shadow);
}
.result-card img, .result-card video {
  width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; background: #05080f;
  display: block;
}
.result-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; gap: 8px; }
.result-meta .rm-text { color: var(--muted); font-size: 13px; }
.result-meta a.dl {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; padding: 8px 14px; border-radius: 10px; font-size: 13px;
}
.result-meta a.dl:hover { border-color: var(--border-strong); }

/* 加载动画 */
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  color: var(--text); padding: 12px 20px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 100; animation: pop .25s ease;
}
.toast.err { border-color: rgba(255,93,108,.5); }
.toast.ok { border-color: rgba(47,210,122,.5); }

/* ---------------- 参考图上传组件 ---------------- */
.imgfield { display: flex; flex-direction: column; gap: 10px; }
.img-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 22px 14px; cursor: pointer;
  color: var(--muted); text-align: center;
  background: rgba(255,255,255,.02);
  border: 1.5px dashed var(--border-strong); border-radius: 14px;
  transition: all .18s ease;
}
.img-drop:hover, .img-drop.drag {
  border-color: var(--accent);
  background: rgba(124,92,255,.06);
  color: var(--text);
}
.img-drop.full { opacity: .55; cursor: not-allowed; }
.img-drop svg { opacity: .8; }
.img-drop-text { font-size: 13.5px; color: var(--text); }
.img-drop-text b { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.img-drop-hint { font-size: 12px; }
.img-counter {
  font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 999px;
}
.img-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.img-thumb {
  position: relative; width: 72px; height: 72px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border-strong);
  animation: pop .2s ease;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-mask {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10,14,24,.62);
}
.img-thumb.uploading img { filter: blur(2px) brightness(.7); }
.img-del {
  position: absolute; right: 4px; top: 4px;
  width: 18px; height: 18px; line-height: 16px; padding: 0;
  border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.65); color: #fff; font-size: 10px;
  transition: all .15s ease;
}
.img-del:hover { background: rgba(255,93,108,.9); transform: scale(1.12); }

/* ---------------- 参考音频上传组件 ---------------- */
.aud-list { display: flex; flex-direction: column; gap: 8px; }
.aud-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.02);
  animation: pop .2s ease;
}
.aud-row .aud-icon { display: flex; color: var(--accent); opacity: .9; }
.aud-row .aud-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; color: var(--text);
}
.aud-row.uploading { opacity: .65; }
.aud-row .img-del { position: static; flex: none; }

/* ============================ 响应式 ============================ */
@media (max-width: 960px) {
  .panel-body { grid-template-columns: 1fr; }
  .panel-right { position: static; min-height: 0; }
  .result-area:empty::before { min-height: 120px; }
}

/* 汉堡按钮与抽屉遮罩：桌面隐藏 */
.nav-btn { display: none; }
.nav-overlay {
  position: fixed; inset: 0; z-index: 94;
  background: rgba(3, 6, 12, .55);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: modalFade .18s ease;
}

@media (max-width: 860px) {
  /* —— 顶栏 —— */
  .nav-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
    transition: border-color .15s;
  }
  .nav-btn:active { border-color: var(--accent); }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar .brand { font-size: 14.5px; }
  .credits-pill { padding: 6px 10px; font-size: 12.5px; gap: 5px; }
  .credits-pill svg { width: 15px; height: 15px; }
  .usermenu { right: 10px; top: 52px; width: min(260px, calc(100vw - 20px)); }

  /* —— 侧边栏 → 抽屉 —— */
  .layout { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 280px; max-width: 82vw;
    z-index: 95;
    background: #0d1424;
    border-right: 1px solid var(--border-strong);
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%);
    transition: transform .24s cubic-bezier(.2, .8, .3, 1);
    box-shadow: none;
  }
  .layout.nav-open .sidebar {
    transform: none;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .55);
  }
  .tool-list { flex-direction: column; gap: 9px; padding-bottom: 0; }
  .tool-list li { min-width: 0; }
  .main { padding: 14px 12px 30px; overflow: visible; }

  /* —— 首页 —— */
  .home-hero { flex-direction: column; align-items: flex-start; padding: 20px 18px; border-radius: 18px; }
  .home-hero-text h2 { font-size: 20px; }
  .home-hero-text p { font-size: 13.5px; margin-bottom: 14px; }
  .home-hero-img { width: 100%; height: 160px; }
  .topbar .brand span { white-space: nowrap; }
  .credits-pill { white-space: nowrap; }
  .home-stats { gap: 10px; }
  .stat { padding: 11px 14px; min-width: 92px; }
  .stat b { font-size: 20px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; }
  .card .c-thumb { height: 104px; }

  /* —— 工具面板 —— */
  .tool-head { gap: 12px; margin-bottom: 16px; }
  .tool-thumb { width: 58px; height: 58px; border-radius: 13px; }
  .tool-head-info h2 { font-size: 17.5px; }
  .tool-head-info p {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-size: 12.5px; margin-bottom: 8px;
  }
  .hist-btn { padding: 9px 11px; }
  .hist-btn span { display: none; }

  .panel-body { gap: 18px; }
  .tool-form input, .tool-form textarea, .tool-form select { font-size: 16px; }
  .tool-form textarea { min-height: 96px; }
  .primary-btn { margin-top: 14px; padding: 14px; }
  .img-thumb { width: 62px; height: 62px; }
  .result-card img, .result-card video { max-height: 44vh; }

  /* —— 弹窗 —— */
  .toast { max-width: calc(100vw - 32px); font-size: 13px; }
}

/* 窄屏（手机竖屏）：顶栏进一步收紧 */
@media (max-width: 720px) {
  .user #username { display: none; }
  .user { padding: 4px; gap: 0; }
  .user .caret { display: none; }
  .topbar { gap: 8px; }
}

/* ---------------- 历史查询（工具面板内入口 + 弹窗） ---------------- */
.hist-btn {
  margin-left: auto; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; cursor: pointer;
  background: linear-gradient(135deg, rgba(124,92,255,.16), rgba(35,196,216,.12));
  border: 1px solid rgba(124,92,255,.45);
  border-radius: 12px; color: #d9d3ff; font-size: 13.5px; font-weight: 700;
  transition: all .18s ease;
  box-shadow: 0 2px 10px rgba(124,92,255,.12);
}
.hist-btn:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(124,92,255,.28), rgba(35,196,216,.2));
  color: #fff; transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,92,255,.28);
}
.hist-btn:active { transform: translateY(0); }

.modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 14, 0.66);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: modalFade .18s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(920px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  display: flex; flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  animation: modalRise .22s cubic-bezier(.2,.8,.3,1);
  overflow: hidden;
}
@keyframes modalRise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
/* 历史记录弹窗：比通用弹窗更宽更高，给卡片留呼吸空间 */
#hist-modal .modal-card {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(800px, calc(100vh - 40px));
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-title { display: flex; align-items: center; gap: 10px; color: var(--accent-2); }
.modal-title h3 { margin: 0; font-size: 18px; color: var(--text); }
.modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--muted); transition: all .16s ease;
}
.modal-close:hover { border-color: var(--accent); color: #fff; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 6px 22px 0; }
.modal-scroll {
  overflow-y: auto; padding: 18px 22px 22px; margin-top: 14px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.hist-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px; align-content: start;
}
.hist-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; cursor: pointer; transition: all .18s ease;
}
.hist-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.hist-thumb { position: relative; height: 200px; background: var(--panel-2, #131a26); }
.hist-thumb img, .hist-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: var(--panel-2, #131a26);
}
.hist-thumb .h-play {
  position: absolute; left: 10px; top: 10px;
  background: rgba(0,0,0,.62); border-radius: 9px; padding: 5px 8px;
  display: flex; align-items: center;
}
.hist-body { padding: 12px 14px 14px; }
.hist-prompt {
  font-size: 13px; line-height: 1.55; color: #cdd8e6;
  margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.hist-tool { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.hist-meta .h-cost { color: var(--warn); }
.hist-empty { color: var(--muted); text-align: center; padding: 48px 0; font-size: 14px; }
/* 排队中 / 失败状态卡片 */
.hist-card.hist-inactive { cursor: default; opacity: .92; }
.h-pending {
  height: 100%; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
}
.h-pending .spinner { width: 22px; height: 22px; border-width: 2px; }
.h-failed {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: #ff8f8f; font-size: 26px; font-weight: 700;
}
.hist-status { font-size: 12px; margin: 4px 0; }
.hs-pending { color: var(--warn, #e8b34b); }
.hs-failed { color: #ff8f8f; }

/* ---------------- 灯箱（点击图片放大预览） ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 28px;
  background: rgba(3, 5, 10, 0.82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: modalFade .18s ease;
}
.lightbox.hidden { display: none; }
.lb-stage {
  display: flex; align-items: center; justify-content: center;
  max-width: 100%; flex: 1; min-height: 0;
  animation: lbZoom .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes lbZoom { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.lb-stage img, .lb-stage video {
  max-width: min(1100px, 92vw); max-height: 100%;
  object-fit: contain; border-radius: 14px;
  box-shadow: 0 24px 72px rgba(0,0,0,.6);
}
.lb-close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px; color: #dfe7f2; transition: all .16s ease;
}
.lb-close:hover { background: rgba(255,255,255,.16); color: #fff; transform: rotate(90deg); }
.lb-bar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  width: min(1100px, 92vw);
  background: rgba(18, 26, 43, 0.82);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px;
}
.lb-caption {
  flex: 1; min-width: 0;
  color: #cdd8e6; font-size: 13.5px; line-height: 1.7;
  white-space: normal; word-break: break-word;
  max-height: 22vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.lb-prompt { color: #e2e9f3; }
.lb-refs-label {
  color: var(--muted); font-size: 12px; font-weight: 700;
  margin-bottom: 6px; letter-spacing: .02em;
}
.lb-refs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.lb-ref {
  width: 62px; height: 62px; object-fit: cover; border-radius: 9px;
  border: 2px solid var(--border); cursor: pointer;
  transition: transform .14s ease, border-color .14s ease;
  background: var(--panel-2);
}
.lb-ref:hover {
  transform: translateY(-2px); border-color: var(--accent);
}
.lb-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------------- 提示词 @ 参考图联想弹层 ---------------- */
.at-popup {
  position: fixed; z-index: 120;
  min-width: 220px; max-width: 280px;
  max-height: 250px; overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.at-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
  transition: background .12s ease;
}
.at-item.active, .at-item:hover { background: rgba(255, 255, 255, .08); }
.at-item img {
  width: 38px; height: 38px; object-fit: cover;
  border-radius: 7px; background: var(--panel);
  border: 1px solid var(--border); flex-shrink: 0;
}
.at-item .at-label { color: var(--text); font-weight: 600; white-space: nowrap; }
.at-item .at-audio-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; color: var(--accent);
  background: rgba(124, 92, 255, .12);
  border: 1px solid var(--border);
}
.at-empty {
  padding: 12px 10px; color: var(--muted);
  font-size: 12.5px; text-align: center;
}

/* 开关字段（圆形填充勾选框） */
.ckfield { margin: 2px 0 6px; }
.ck-row {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none; padding: 4px 2px;
}
.ck-circle {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong, #3a4a63);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .18s, box-shadow .18s;
  flex: none;
}
.ck-circle::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent, #5b8cff);
  transform: scale(0); transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.ck-circle.on { border-color: var(--accent, #5b8cff); }
.ck-circle.on::after { transform: scale(1); }
.ck-row:hover .ck-circle { box-shadow: 0 0 0 4px rgba(91, 140, 255, .12); }
.ck-text { font-size: 13.5px; color: var(--text); }
.lb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.lb-copy, .lb-dl {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .16s ease;
}
.lb-copy {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text);
}
.lb-copy:hover { border-color: var(--accent); color: #fff; }
.lb-dl {
  background: var(--accent-grad); color: #fff; text-decoration: none; border: none;
}
.lb-dl:hover { filter: brightness(1.12); transform: translateY(-1px); }
@media (max-width: 720px) {
  .lightbox { padding: 16px; }
  .lb-bar { flex-direction: column; align-items: stretch; text-align: center; }
}
@media (max-width: 720px) {
  .hist-btn { padding: 8px 12px; font-size: 12.5px; }
  .hist-btn span { display: none; }
  .hist-btn svg { width: 20px; height: 20px; }
}

/* ============================ 移动端覆盖（必须置于文件末尾，防止被后续基础规则反杀） ============================ */
@media (max-width: 860px) {
  .modal-card {
    width: calc(100vw - 16px); max-height: calc(100dvh - 24px); border-radius: 16px;
  }
  .modal-head { padding: 14px 16px 0; }
  .modal-scroll { padding: 14px 14px 16px; }
  .hist-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
  .hist-thumb { height: 140px; }
  .hist-body { padding: 9px 11px 11px; }
  .hist-prompt { font-size: 12px; }
}

/* ============================ 引用菜单（右键/长按历史参考图） ============================ */
.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 200px;
  max-width: 300px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  animation: umIn 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 11px;
  border: none;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}
.ctx-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 7px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.ctx-item:hover { background: rgba(124, 92, 255, 0.14); }
.ctx-item.accent { color: #cdb9ff; }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ============================ 参考图拖拽换位 ============================ */
.img-thumb { cursor: grab; }
.img-thumb:active { cursor: grabbing; }
.img-thumb.dragging {
  opacity: 0.4;
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}
.img-thumb.drag-over {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ============================ 积分日志弹窗（任务表格） ============================ */
.cl-card { width: min(880px, calc(100vw - 32px)); }
.cl-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 14px 22px 4px;
}
.cl-balance span {
  font-size: 12.5px;
  color: var(--text-dim, #93a3b8);
}
.cl-balance b {
  font-size: 18px;
  color: var(--text);
}
.cl-balance b i { font-style: normal; }
.cl-balance b u {
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  margin-left: 4px;
  color: var(--text-dim, #93a3b8);
}
.cl-scroll { overflow-x: auto; }
.cl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.cl-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim, #93a3b8);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--panel-solid);
  z-index: 1;
}
.cl-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  vertical-align: middle;
}
.cl-table tr:last-child td { border-bottom: none; }
.cl-table .cl-num { text-align: right; font-variant-numeric: tabular-nums; }
.cl-table .cl-mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-dim, #93a3b8); }
.cl-table .cl-dim { color: var(--text-dim, #93a3b8); }
.cl-table .cl-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.cl-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
}
.cl-badge.cl-consume { color: #ff9d9d; background: rgba(255, 92, 92, 0.12); }
.cl-badge.cl-refund { color: #7fe0a7; background: rgba(60, 200, 120, 0.13); }
.cl-badge.cl-admin { color: #ffd66b; background: rgba(255, 200, 60, 0.13); }
.cl-change { font-weight: 800; font-size: 13px; }
.cl-change.plus { color: #7fe0a7; }
.cl-change.minus { color: #ff9d9d; }
.cl-more { width: 100%; margin-top: 10px; }

/* ============================ 积分日志筛选栏 ============================ */
.cl-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 22px 4px;
}
.cl-f {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  flex: 1 1 120px;
}
.cl-f label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim, #93a3b8);
}
.cl-f input,
.cl-f select {
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.cl-f input:focus,
.cl-f select:focus { border-color: var(--accent); }
.cl-f input::placeholder { color: var(--text-dim, #7b8aa0); }
.cl-f select option { background: #1a2030; color: #e8eef7; }
.cl-f-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.cl-f-btn {
  height: 32px;
  padding: 0 16px;
  font-size: 12.5px;
  border-radius: 8px;
  cursor: pointer;
}

/* ============================ 次要按钮（ghost）统一补定义 ============================ */
/* 此前 ghost-btn 无任何样式定义，重置/加载更多按钮一直显示为浏览器默认样式 */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-height: 32px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-dim, #93a3b8);
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ghost-btn:hover {
  color: var(--text, #e8eef7);
  border-color: var(--accent, #7c5cff);
  background: rgba(124, 92, 255, 0.08);
}
.ghost-btn:active { transform: translateY(1px); }

/* 筛选栏按钮：覆盖 primary-btn 的全宽/大内边距遗留样式 */
.cl-f-btn {
  width: auto;
  margin-top: 0;
  padding: 0 18px;
  min-height: 32px;
  height: 32px;
  flex-shrink: 0;
}
.cl-f-btn.primary-btn {
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.25);
}
/* 加载更多：居中窄版 */
.cl-more.ghost-btn {
  margin: 12px auto 0;
  padding: 0 22px;
  min-height: 34px;
  display: flex;
}

/* ============================ 虚拟人像素材库 ============================ */
.as-card {
  width: min(960px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.as-sub {
  font-size: 12.5px;
  color: var(--text-dim, #93a3b8);
  padding: 0 22px 12px;
}
.as-body {
  display: flex;
  gap: 14px;
  padding: 0 22px 20px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.as-left {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.as-right {
  flex: 1;
  min-width: 0;
  background: var(--bg-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  overflow-y: auto;
}
.as-sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.as-sec-gap { margin-top: 16px; }
.as-input,
.as-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  resize: none;
}
.as-input { height: 34px; margin-bottom: 8px; }
.as-textarea { height: 64px; margin-bottom: 10px; }
.as-input:focus,
.as-textarea:focus { border-color: var(--accent); }
.as-create {
  margin-top: 0;
  padding: 9px;
  font-size: 13px;
  border-radius: 9px;
  width: 100%;
}
.as-groups {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}
.as-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.as-group-row:hover { border-color: var(--accent); }
.as-group-row.active {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.1);
}
.as-group-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-group-info b {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.as-group-info span { font-size: 11px; color: var(--text-dim, #93a3b8); }
.as-group-ops { flex-shrink: 0; display: flex; gap: 4px; }
.as-del {
  background: transparent;
  border: none;
  color: var(--text-dim, #93a3b8);
  cursor: pointer;
  padding: 5px;
  border-radius: 7px;
  line-height: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.as-del:hover { color: var(--danger, #ff6b6b); background: rgba(255, 92, 92, 0.1); }
.as-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim, #93a3b8);
  cursor: pointer;
  padding: 4px;
  border-radius: 7px;
  line-height: 0;
}
.as-icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.as-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim, #93a3b8);
  font-size: 13px;
}
.as-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.as-detail-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-detail-title b { font-size: 14.5px; color: var(--text); }
.as-detail-title span {
  font-size: 11.5px;
  color: var(--text-dim, #93a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.as-detail-ops { display: flex; align-items: center; gap: 8px; }
.as-select {
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.as-select option { background: #1a2030; color: #e8eef7; }
.as-upload-btn {
  height: 32px;
  padding: 0 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-3, rgba(255, 255, 255, 0.07));
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.as-upload-btn:hover { border-color: var(--accent); }
.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.as-card-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}
.as-pv {
  position: relative;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.as-pv img,
.as-pv video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.as-pv.audio { color: var(--text-dim, #93a3b8); }
.as-kind-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.as-item-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.as-item-status { font-size: 11px; color: var(--text-dim, #93a3b8); }
.as-item-ops { display: flex; justify-content: flex-end; }
.as-quote {
  height: 30px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad, linear-gradient(135deg, #7c5cff, #a78bfa));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: filter 0.15s ease;
}
.as-quote:hover { filter: brightness(1.08); }

/* ---------------- 对话工具（提示词优化助手） ---------------- */
.panel-body.chat-mode { grid-template-columns: minmax(0, 1fr); }
.panel-body.chat-mode .panel-right { display: none; }

.chat-wrap { display: flex; flex-direction: column; gap: 12px; }
.chat-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.chat-hint { font-size: 12.5px; color: var(--muted); }
.chat-msgs {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 320px; max-height: 56vh; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px;
}
.chat-bubble {
  max-width: 82%; padding: 11px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-grad, linear-gradient(135deg,#7c5cff,#5ca8ff));
  color: #fff; border-bottom-right-radius: 5px;
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  color: var(--text); border-bottom-left-radius: 5px;
}
.chat-bubble.typing { opacity: .55; font-style: italic; }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; color: var(--text); font-size: 14.5px;
  outline: none; font-family: inherit; resize: vertical; min-height: 52px; max-height: 200px;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.16); }
.chat-send {
  padding: 13px 26px; font-size: 14.5px; font-weight: 700; color: #fff;
  background: var(--accent-grad, linear-gradient(135deg,#7c5cff,#5ca8ff));
  border: none; border-radius: 12px; cursor: pointer; flex-shrink: 0;
  transition: filter .15s, transform .08s;
}
.chat-send:hover { filter: brightness(1.08); }
.chat-send:active { transform: translateY(1px); }
.chat-send:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.chat-err { margin-top: 0; min-height: 18px; }

/* —— 提示词 @ 引用行内胶囊：镜像层显示全部文字+胶囊，textarea 文字透明只留光标。
   两边逐字符同宽（图标净占位 0），换行/行高天然一致，滚动与长文本不错位 —— */
.mirror-host { position: relative; display: block; }
.mirror-host > textarea {
  position: relative; z-index: 2;
  display: block; width: 100%;  /* textarea 默认 inline-block 会在宿主产生行盒底部空隙，导致镜像比输入框高 */
  background: transparent !important;
  color: transparent !important;
  caret-color: var(--text);
}
.mirror-host > textarea::placeholder { color: #64718c; opacity: 1; }
.mirror-host > textarea::selection { background: rgba(124, 92, 255, 0.32); color: transparent; }
.mirror-host > textarea.at-composing { color: var(--text) !important; }
.mention-mirror {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none; overflow: hidden;
  white-space: pre-wrap; overflow-wrap: break-word;
  color: var(--text);
}
.mention-mirror .mchip {
  display: inline;
  border-radius: 4px;
  background: linear-gradient(180deg, #2c3d6b, #1d2a4f);
  box-shadow: 0 0 0 1px rgba(124, 92, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  /* 左右 padding 与负 margin 抵消：底色外扩 3px 但不改变占位宽度 */
  padding: 1px 3px;
  margin: 0 -3px;
}
.mention-mirror .mchip-at0 { color: transparent; }
.mention-mirror .mchip-at {
  /* 0x0 行内锚点：净占位 0，不改变行盒高度；图标绝对定位盖在透明 @ 上 */
  position: relative;
  display: inline-block;
  width: 0; height: 0;
}
.mention-mirror .mchip-at img,
.mention-mirror .mchip-at svg {
  position: absolute; left: 0; bottom: -0.1em;
  width: 16px; height: 0.92em;   /* 宽度由 JS 按 @ 字形实测覆盖 */
  object-fit: cover; display: block;
  border-radius: 3px;
}

/* —— 嵌入式工具（人物/场景提示词设计器）：隐藏左侧表单，iframe 占满整行 —— */
.panel-body.embed-mode { grid-template-columns: minmax(0, 1fr); }
.panel-body.embed-mode .panel-left { display: none; }
.panel-body.embed-mode .result-title { display: none; }
.panel-body.embed-mode .panel-right { min-height: 0; position: static; }
.embed-frame {
  width: 100%;
  /* 高度由 iframe 内 postMessage(dg-height) 撑开：内容多长就多高，
     滚动统一走外层页面，框内不再出现第二个滚动条 */
  height: 480px;
  border: none;
  border-radius: 0;
  background: transparent;
  display: block;
}
/* 全屏型嵌入工具（柒柒3D导演台）：占满主区可用高度，而非 480px 滚动页 */
.embed-frame-full {
  height: calc(100vh - 220px);
}

/* ===================== 沉浸模式（embed_full 工具） =====================
   打开 3D 导演台等全屏型工具时：隐藏顶栏/侧栏/工具头/备案栏，
   iframe 铺满整个视口；右上角浮动「退出沉浸」按钮恢复原布局。 */
body.focus-mode .topbar,
body.focus-mode .sidebar,
body.focus-mode .tool-head,
body.focus-mode .site-footer { display: none; }
body.focus-mode .main {
  padding: 10px 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.focus-mode .panel {
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.focus-mode .panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch; /* 覆盖基础规则的 align-items:start，否则 iframe 宽度塌缩 */
  min-height: 0;
}
body.focus-mode .panel-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}
body.focus-mode .result-area {
  flex: 1;
  min-height: 0;
}
body.focus-mode .embed-frame-full {
  height: 100%;
  border-radius: 12px;
}
.focus-exit {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(16, 24, 40, 0.85);
  border: 1px solid var(--border-strong, #3a4a66);
  color: var(--text, #e8eefc);
  font-size: 13px;
  font-family: inherit;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, background 0.15s;
}
.focus-exit:hover {
  border-color: #7c5cff;
  background: rgba(30, 40, 62, 0.92);
}
body.focus-mode .focus-exit { display: inline-flex; }


/* ===================== 底部 ICP 备案栏 ===================== */
.site-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 5px 0 6px;
  pointer-events: none;           /* 只让备案链接可点，其余不挡操作 */
  background: linear-gradient(to top, rgba(4, 7, 14, 0.85), rgba(4, 7, 14, 0));
}
.beian {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(207, 216, 230, 0.62);
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: color 0.15s ease;
}
.beian:hover { color: rgba(207, 216, 230, 0.95); }
.beian-ico { opacity: 0.75; flex: none; }

/* ===================== 微信客服悬浮按钮 ===================== */
.wx-widget {
  position: fixed;
  right: 22px;
  bottom: 110px;                  /* 悬浮在右侧中部，避免太靠下 */
  z-index: 70;
}
.wx-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #ffffff;
  color: #2aae67;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wx-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.46);
}
.wx-pop {
  /* 悬停 .wx-widget 即显示（纯 CSS），移开即收起 */
  display: none;
  position: absolute;
  right: 0;
  bottom: 64px;
  width: 224px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: #ffffff;
  color: #2c3346;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  text-align: center;
}
.wx-widget:hover .wx-pop { display: block; }
.wx-pop-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  color: #1f2536;
}
.wx-qr {
  width: 178px; height: 178px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  border: 1px solid #eceff5;
}
.wx-pop-tip {
  margin: 9px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: #6b7488;
}
.wx-pop-arrow {
  position: absolute;
  right: 20px;
  bottom: -6px;
  width: 12px; height: 12px;
  background: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  transform: rotate(45deg);
}

/* 移动端：按钮更小、贴边、半透明，尽量少遮挡表单与结果区 */
@media (max-width: 720px) {
  .wx-widget { right: 10px; bottom: 88px; opacity: .82; }
  .wx-btn { width: 40px; height: 40px; }
  .wx-btn svg { width: 20px; height: 20px; }
  .wx-widget:hover, .wx-widget:active { opacity: 1; }
}

/* ===================== CDK 卡密兑换（充值弹窗） ===================== */
.rc-cdk {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(35, 196, 216, 0.05));
  border: 1px solid rgba(124, 92, 255, 0.35);
}
.rc-cdk-label { font-size: 13px; font-weight: 600; color: #cdd8e6; }
.rc-cdk-row { display: flex; gap: 8px; }
.rc-cdk-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.5px;
  outline: none;
  transition: border-color 0.15s ease;
}
.rc-cdk-row input:focus { border-color: rgba(124, 92, 255, 0.65); }
.rc-cdk-btn { padding: 9px 16px; flex: none; }
.rc-cdk-btn:disabled { opacity: 0.55; cursor: default; }
.rc-cdk-msg { font-size: 12.5px; min-height: 16px; }
.rc-cdk-msg.good { color: #7fe0a7; }
.rc-cdk-msg.bad { color: #ff9d9d; }

/* ===================== 卡密管理弹窗（管理员） ===================== */
.cdk-card { max-width: 720px; width: min(720px, 92vw); }
.cdk-summary {
  font-size: 13px;
  color: #8fd0ff;
  background: rgba(143, 208, 255, 0.08);
  border: 1px solid rgba(143, 208, 255, 0.22);
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 14px;
}
.cdk-gen { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.cdk-gen label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: #93a0b5;
}
.cdk-gen input {
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.cdk-gen input:focus { border-color: rgba(124, 92, 255, 0.65); }
.cdk-gen label:nth-child(1) input { width: 90px; }
.cdk-gen label:nth-child(2) input { width: 110px; }
.cdk-gen label:nth-child(3) input { width: 170px; }
.cdk-gen-btn { flex: none; padding: 9px 18px; }
.cdk-result { margin-top: 14px; }
.cdk-result-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; font-size: 13px; color: #cdd8e6;
}
.cdk-result-area {
  width: 100%;
  height: 132px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: #cfe0f5;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  padding: 10px 12px;
  outline: none;
  box-sizing: border-box;
}
.cdk-tip { margin: 7px 0 0; font-size: 12px; color: #8a93a6; }
.cdk-list-head { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: #cdd8e6; }
.cdk-scroll { max-height: 260px; }
.cdk-table td, .cdk-table th { padding: 8px 10px; font-size: 12.5px; }

/* 平台公告横幅 */
.announce-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 44px 9px 16px;
  background: linear-gradient(90deg, rgba(79,124,255,.14), rgba(79,124,255,.05));
  border-bottom: 1px solid rgba(79,124,255,.35);
  color: var(--text, #e8eefc);
  font-size: 13.5px;
  line-height: 1.5;
}
.announce-banner .announce-text { max-width: 900px; }
.announce-banner .announce-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted, #93a1b8);
  font-size: 14px;
  cursor: pointer;
}
.announce-banner .announce-close:hover { color: var(--text, #fff); }

/* 登录验证码行：输入框 + 可点击刷新的 SVG 验证码 */
.captcha-row {
  display: flex; align-items: stretch; gap: 10px;
}
.captcha-row .field { flex: 1; margin-bottom: 14px; min-width: 0; }
.captcha-img {
  flex-shrink: 0; width: 132px; height: 46px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; user-select: none;
  background: #f2f4f9; font-size: 12px; color: #667;
  transition: border-color .16s ease;
}
.captcha-img:hover { border-color: var(--accent); }
.captcha-img svg { display: block; width: 100%; height: 100%; }

/* 24h 排队：取消任务按钮 */
.cancel-task {
  display: inline-block; margin: 8px 0 14px; padding: 6px 14px;
  font-size: 13px; color: #b4232a; background: #fff;
  border: 1px solid #e5b4b7; border-radius: 10px; cursor: pointer;
  transition: all .15s ease;
}
.cancel-task:hover:not(:disabled) { background: #fdf1f1; border-color: #b4232a; }
.cancel-task:disabled { opacity: .55; cursor: default; }
.h-cancel {
  margin-left: 8px; padding: 1px 8px; font-size: 12px;
  color: #b4232a; background: transparent;
  border: 1px solid #e5b4b7; border-radius: 8px; cursor: pointer;
}
.h-cancel:hover:not(:disabled) { background: #fdf1f1; border-color: #b4232a; }
.h-cancel:disabled { opacity: .55; cursor: default; }
