/* ============================================================
   Aplovn · 设计系统
   参考三宝影像工坊（sanbaobeauty.com）视觉语言：
   深色底 + 玻璃拟态卡片 + 金色强调 + 大圆角 + 重投影
   ============================================================ */

:root {
  --bg: #080a0f;
  --surface: rgba(20, 24, 31, 0.78);
  --surface-2: rgba(29, 34, 43, 0.88);
  --line: rgba(255, 255, 255, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f7f8fb;
  --muted: rgba(247, 248, 251, 0.58);
  --muted-2: rgba(247, 248, 251, 0.38);
  --accent: #f2bd63;
  --accent-soft: rgba(242, 189, 99, 0.14);
  --ok: #8ae6a5;
  --danger: #ff6a6a;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 34px 110px rgba(0, 0, 0, 0.58);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #14181f; }

/* ---------- 背景 ---------- */
.bg-stack { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.5; filter: saturate(0.7) blur(2px);
}
.bg-wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(1100px 620px at 50% 8%, rgba(242, 189, 99, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(8, 10, 15, 0.72), rgba(8, 10, 15, 0.94)),
    linear-gradient(90deg, rgba(5, 7, 10, 0.5), rgba(5, 7, 10, 0.1));
}
.bg-grain {
  position: absolute; inset: 0; opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 3px 3px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 62px;
  display: flex; align-items: center; gap: 18px; padding: 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 12, 18, 0.62);
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; object-fit: cover;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.brand small { color: var(--muted); font-weight: 600; font-size: 12px; }

.nav-links { display: flex; gap: 4px; margin-left: 10px; }
.nav-links button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 700;
}
.nav-links button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.nav-links button.active { background: rgba(255, 255, 255, 0.1); color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* 积分卡 */
.credit-card {
  display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 999px;
  background: rgba(15, 18, 24, 0.62); backdrop-filter: blur(18px);
}
.credit-card .bolt { color: var(--accent); font-size: 13px; }
.credit-card strong { color: var(--accent); font-size: 13px; font-weight: 800; }
.credit-card span { color: var(--muted-2); font-size: 11px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  font-size: 13px; font-weight: 700; transition: 0.16s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); }
.btn-primary {
  border: 0; color: #14181f;
  background: linear-gradient(90deg, #f7d79a, var(--accent));
  box-shadow: 0 12px 30px rgba(242, 189, 99, 0.26);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(90deg, #f7d79a, var(--accent)); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- 页面容器 ---------- */
.page { position: relative; z-index: 10; padding: 62px 0 0; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 首页 Hero ---------- */
.home-stage {
  display: flex; min-height: calc(100vh - 62px); flex-direction: column;
  align-items: center; justify-content: center; padding: 10vh 5vw 6vh;
}
.home-stage h1 {
  margin: 0 0 14px; color: #fff; text-align: center;
  font-size: clamp(30px, 3.5vw, 46px); font-weight: 900;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.34);
}
.home-stage .sub { margin: 0 0 34px; color: var(--muted); font-size: 15px; }

/* ---------- Composer ---------- */
.composer {
  width: min(960px, calc(100vw - 48px));
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(22px);
  /* 不能用 overflow:hidden，会裁掉规格下拉菜单；圆角由 .composer-tools 自己收 */
}
.composer-body { padding: 16px 18px 8px; }
.composer textarea {
  width: 100%; min-height: 92px; border: 0; background: transparent; resize: none;
  color: var(--text); font-family: inherit; font-size: 15px; line-height: 1.65; outline: none;
}
.composer textarea::placeholder { color: var(--muted-2); }

.composer-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 14px; background: rgba(18, 22, 29, 0.7);
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
  border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.spec-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  font-size: 12px; font-weight: 700;
}
.chip:hover { background: rgba(255, 255, 255, 0.12); }
.chip.on { border-color: rgba(242, 189, 99, 0.5); background: var(--accent-soft); color: var(--accent); }
.chip.static { cursor: default; color: var(--muted); }
/* DEF-10：画幅被素材锁住时置灰，光标与下拉箭头都收掉 */
.chip.locked {
  opacity: 0.55; border-style: dashed; cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
}
.chip.locked:hover { background: rgba(255, 255, 255, 0.03); }
.chip.locked .chip-caret { display: none; }
.chip .k { color: var(--muted-2); font-weight: 600; }
/* 模型 chip 比其它规格更重要，稍微提亮一点 */
.chip-model { border-color: rgba(242, 189, 99, 0.42); background: var(--accent-soft); color: var(--accent); }

/* ---------- 时长控件：输入框（左） + 滑块（右），5–30s ---------- */
.dur-ctl {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
}
.dur-ctl.sold { opacity: 0.55; }
.dur-ctl input[type="number"] {
  width: 52px; min-height: 26px; padding: 0 4px;
  border: 1px solid var(--line); border-radius: 6px;
  background: rgba(0, 0, 0, 0.25); color: var(--text);
  font-size: 13px; font-weight: 800; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.dur-ctl input[type="number"]::-webkit-outer-spin-button,
.dur-ctl input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dur-ctl input[type="number"]:focus { outline: none; border-color: rgba(242, 189, 99, 0.55); }
.dur-ctl input:disabled { cursor: not-allowed; }
.dur-ctl .dur-unit { color: var(--muted-2); font-size: 12px; font-weight: 700; }
.dur-ctl input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 150px; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 0%), rgba(255,255,255,0.18) var(--fill, 0%));
  outline: none; cursor: pointer;
}
.dur-ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4); cursor: grab;
}
.dur-ctl input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4); cursor: grab;
}

.cost-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 1px solid rgba(242, 189, 99, 0.32); border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 13px; font-weight: 800;
}
.generate-btn { min-height: 38px; padding: 0 22px; font-size: 14px; }

.composer-hint { margin: 10px 0 0; color: var(--muted-2); font-size: 12px; text-align: center; }
.composer-err { margin: 10px 0 0; color: var(--danger); font-size: 13px; text-align: center; }

/* ---------- 通用区块 ---------- */
.section { width: min(1180px, calc(100vw - 48px)); margin: 0 auto; padding: 46px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 850; }
.section-head span { color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  backdrop-filter: blur(18px); padding: 18px;
}
.card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.card .kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- 作品卡 ---------- */
.work-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.work-media { position: relative; aspect-ratio: 9 / 16; background: #0c0f15; }
.work-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-media .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; text-align: center; padding: 12px;
}
.work-meta { padding: 12px 14px 14px; }
.work-meta .prompt {
  margin: 0 0 8px; font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
  color: var(--muted); font-size: 11px; font-weight: 700;
}
.status { font-size: 12px; font-weight: 800; }
.status.queued, .status.submitted, .status.running { color: var(--accent); }
.status.completed { color: var(--ok); }
.status.failed { color: var(--danger); }
.work-actions { display: flex; gap: 8px; }

/* ---------- 购买积分 / 套餐 ---------- */
/* 页面标题与第一个区块之间留出呼吸，避免两个 h2 挤在一起 */
.credits-plans-head { margin-top: 30px; }
/* 价格公示：独立卡片，按模型分组显示每秒价 */
.price-board { padding: 18px 20px; }
.price-list { display: grid; gap: 18px; }
.price-note { margin: 16px 0 0; color: var(--muted-2); font-size: 12px; line-height: 1.7; }

/* 积分明细：第一行是当前可用积分（汇总行） */
.ledger-card { padding: 0 14px 6px; }
.total-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 16px 8px 14px; border-bottom: 1px solid var(--line);
}
.total-row > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.total-row > b { color: var(--accent); font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -0.01em; }
.total-row .muted-sm { color: var(--muted-2); font-size: 14px; font-weight: 700; letter-spacing: 0; }

.plan-card { text-align: left; transition: 0.16s ease; }
.plan-card:hover { border-color: rgba(242, 189, 99, 0.7); transform: translateY(-2px); }
.plan-card .n { color: var(--accent); font-size: 26px; font-weight: 900; }
.plan-card .n small { font-size: 13px; font-weight: 700; color: var(--muted); }
.plan-card ul { margin: 10px 0 14px; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }

.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger th, .ledger td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.ledger th { color: var(--muted-2); font-size: 12px; font-weight: 700; }
.ledger td.delta.plus { color: var(--ok); font-weight: 800; }
.ledger td.delta.minus { color: var(--danger); font-weight: 800; }

/* ---------- 登录弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; display: none; place-items: center;
  background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(8px); padding: 20px;
}
.modal-mask.show { display: grid; }
.login-card {
  position: relative;
  width: min(420px, 100%); border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(17, 20, 28, 0.98); box-shadow: var(--shadow-lg); padding: 26px;
}
/* 关闭按钮：弹层唯一的退出入口（点外部不再关闭） */
.modal-x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.modal-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.modal-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.modal-x svg { width: 18px; height: 18px; }
.login-card h2 { margin: 0 0 4px; font-size: 26px; font-weight: 850; padding-right: 40px; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field input {
  width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus { border-color: rgba(242, 189, 99, 0.6); background: rgba(255, 255, 255, 0.08); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field-row .send-wrap { display: flex; align-items: flex-end; padding-bottom: 14px; }

/* 邮箱验证码：输入框独占剩余宽度，按钮不换行 */
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.code-row .btn { flex: 0 0 auto; min-width: 106px; white-space: nowrap; }
.code-row .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.field-hint:empty { display: none; }
.field-hint.warn { color: var(--accent); }
.dev-tip {
  margin-top: 6px; padding: 8px 12px; border: 1px solid rgba(242, 189, 99, 0.3);
  border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--accent); font-size: 12.5px;
}
.agreement { margin: 4px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.agreement a { color: var(--accent); }

/* 密码找回：字段标签右侧的文字按钮 + 面板底部返回 */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.auth-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent); font-size: 12px; font-weight: 700; line-height: 1.4;
}
.auth-link:hover { text-decoration: underline; }
.auth-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.auth-back { margin: 12px 0 0; text-align: center; }
.auth-back .auth-link { font-size: 12.5px; color: var(--muted); }
.auth-back .auth-link:hover { color: var(--text); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; z-index: 80; top: 78px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast {
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(17, 20, 28, 0.96); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.4);
  font-size: 13px; font-weight: 700;
}
.toast.err { border-color: rgba(255, 106, 106, 0.5); color: #ffb5b5; }
.toast.ok { border-color: rgba(138, 230, 165, 0.45); color: var(--ok); }

/* ---------- 空态 / 页脚 ---------- */
.empty {
  display: grid; place-items: center; gap: 8px; min-height: 140px; padding: 30px;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px;
}
.footer {
  position: relative; z-index: 10; border-top: 1px solid var(--line-soft);
  padding: 26px 22px; color: var(--muted-2); font-size: 12px; text-align: center;
}

/* ---------- 充值弹层 ---------- */
.pay-card { width: min(380px, 100%); text-align: center; }
.pay-card h2 { text-align: left; }
.pay-card .sub { text-align: left; margin-bottom: 14px; }

.pay-amount { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin: 6px 0 16px; }
.pay-amount .cur { color: var(--muted); font-size: 18px; font-weight: 700; }
.pay-amount b { color: var(--accent); font-size: 44px; font-weight: 900; line-height: 1; }
.pay-amount .gain {
  margin-left: 10px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 800;
}
/* 标题行内联的到账积分徽章 */
.pay-card h2 .gain {
  margin-left: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 800; vertical-align: 3px;
}

.qr-box {
  display: grid; place-items: center; width: 200px; height: 200px; margin: 0 auto 14px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { display: grid; place-items: center; gap: 4px; color: #8a8f99; font-size: 13px; text-align: center; padding: 12px; }
.qr-placeholder .qr-icon { font-size: 30px; color: #c9ced8; }
.qr-placeholder small { color: #a8aeb8; font-size: 11px; line-height: 1.5; }

.order-line {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 12px; color: var(--muted); font-size: 13px;
}
.order-line b {
  color: var(--text); font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px; letter-spacing: 0.12em; font-weight: 800;
}

.notice {
  margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid rgba(242, 189, 99, 0.34); background: var(--accent-soft);
  color: var(--accent); font-size: 13px; font-weight: 700;
}

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .topbar { gap: 10px; padding: 0 14px; }
  .nav-links { display: none; }
  .brand small { display: none; }
  .home-stage { padding: 8vh 18px 6vh; }
  .composer { width: calc(100vw - 36px); }
  .composer-tools { justify-content: flex-start; }
  .generate-btn { width: 100%; }
}

/* ---------- 邮箱登录：登录/注册切换 ---------- */
.auth-tabs {
  display: flex; gap: 6px; margin: 0 0 18px;
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 4px;
  background: rgba(255, 255, 255, 0.04);
}
.auth-tab {
  flex: 1; min-height: 38px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 800; transition: all .16s ease;
}
.auth-tab.active { background: var(--accent); color: #14181f; }
.auth-tab:not(.active):hover { color: var(--text); }

/* ---------- 收款二维码：正方形纯码图（已从竖版名片裁出） ---------- */
.qr-box {
  width: 232px; height: 232px; margin: 4px auto 16px;
}
.qr-box img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pay-card { max-height: 86vh; overflow-y: auto; }

/* ============================================================
   账户信息：默认头像 / 顶栏用户卡 / 下拉面板 / 积分页资料卡
   ============================================================ */
:root { --avatar-h: 38; }

/* 默认头像：昵称首字符 + 由用户 ID 派生的色相，无需上传图片 */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background:
    radial-gradient(120% 120% at 28% 18%, rgba(255, 255, 255, 0.42), transparent 55%),
    linear-gradient(140deg,
      hsl(var(--avatar-h) 82% 68%),
      hsl(calc(var(--avatar-h) + 34) 68% 46%));
  color: #16191f; font-weight: 900; font-size: 13px; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 6px 16px rgba(0, 0, 0, 0.3);
  user-select: none;
}
.avatar-lg { width: 44px; height: 44px; border-radius: 14px; font-size: 17px; }

/* 顶栏用户卡 */
.user-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 12px 0 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); color: var(--text);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.26); }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.18; min-width: 0; }
.user-chip-text b {
  max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 800;
}
.user-chip-text small {
  max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; color: var(--muted-2);
}
.user-chip .caret { margin-left: 2px; color: var(--muted-2); font-size: 10px; transition: transform 0.16s ease; }
.user-chip[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* 下拉面板 */
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  width: 272px; padding: 14px;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(18, 22, 29, 0.97);
  backdrop-filter: blur(26px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: um-pop 0.14s ease;
}
@keyframes um-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.um-head {
  display: flex; align-items: center; gap: 11px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.um-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.um-id b {
  font-size: 14px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.um-id small {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.um-id small.um-uid { color: var(--muted-2); font-variant-numeric: tabular-nums; font-size: 11px; }

.um-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.um-stats > div {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05);
}
.um-stats span { font-size: 10.5px; color: var(--muted-2); }
.um-stats b { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.um-actions { display: flex; flex-direction: column; gap: 2px; }
.um-actions button {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text);
  font-size: 13px; font-weight: 600;
}
.um-actions button:hover { background: rgba(255, 255, 255, 0.09); }
/* display:block 会盖掉 hidden 属性的默认 display:none，必须显式补一条 */
.um-actions button[hidden] { display: none; }
.um-actions button.danger { color: var(--danger); }
.um-actions button.danger:hover { background: rgba(255, 106, 106, 0.12); }

/* 账户设置弹层 */
.profile-head {
  display: flex; align-items: center; gap: 11px;
  margin: 4px 0 16px; padding: 12px;
  border: 1px solid var(--line-soft); border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 760px) {
  .user-chip-text small { display: none; }
  .user-chip-text b { max-width: 76px; }
  .user-menu { width: min(272px, calc(100vw - 40px)); }
}

/* ============================================================
   规格选择：下拉菜单（画幅 / 分辨率 / 时长）
   ============================================================ */
.chip-dd { position: relative; }
.chip-caret {
  margin-left: 5px; font-size: 9px; color: var(--muted-2);
  transition: transform 0.16s ease;
}
.chip.open { border-color: var(--accent); color: var(--accent); }
.chip.open .chip-caret { transform: rotate(180deg); color: var(--accent); }

.chip-menu {
  position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 30;
  min-width: 212px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(18, 22, 29, 0.97);
  backdrop-filter: blur(26px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: um-pop 0.14s ease;
}
.chip-menu button {
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text); text-align: left;
}
.chip-menu .menu-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* 模型官方图标：chip 内 16px，下拉菜单 22px */
.chip-ico, .menu-ico { flex: none; object-fit: contain; display: block; }
.chip-ico { width: 16px; height: 16px; }
.menu-ico { width: 22px; height: 22px; }
.chip-txt { font-size: 13px; font-weight: 750; letter-spacing: 0.01em; }
.chip-menu button:hover { background: rgba(255, 255, 255, 0.09); }
.chip-menu button.on { background: var(--accent-soft); }
.chip-menu button.on b { color: var(--accent); }
.chip-menu button.sold { opacity: 0.42; cursor: not-allowed; }
.chip-menu button.sold:hover { background: transparent; }
.chip-menu button.sold small { color: var(--danger); }
.chip-menu b { font-size: 13px; font-weight: 700; }
.chip-menu small { font-size: 11px; color: var(--muted-2); }

@media (max-width: 760px) {
  .chip-menu { min-width: 190px; }
  /* 靠右的选项菜单在小屏可能出屏，右对齐兜底 */
  .spec-row .chip-dd:last-of-type .chip-menu { left: auto; right: 0; }
}

/* ============================================================
   文生视频 / 图生视频 + 首帧图上传
   ============================================================ */
.mode-tabs {
  display: inline-flex; gap: 4px; margin-bottom: 12px;
  padding: 3px; border: 1px solid var(--line-soft); border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}
.mode-tab {
  min-height: 30px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 800; transition: all 0.16s ease;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--accent); color: #14181f;
  box-shadow: 0 6px 18px rgba(242, 189, 99, 0.24);
}

/* ---------- 素材卡片：首帧 / 尾帧 / 参考图 / 参考视频 / 参考音频 ----------
   每类一张卡片，卡片里是「小方图 + 加号」。能力（是否出现、数量、大小、时长）
   由 MODEL_OPTS[].caps 决定，与后端 config.MODELS 一致。 */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  align-items: start;            /* 卡片各自高度，不被参考图那行撑出大片空白 */
  gap: 10px; margin-bottom: 12px;
}
.ref-card {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0; padding: 10px;
  border: 1px solid var(--line-soft); border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.16s ease, background 0.16s ease;
}
/* 已上传：整张卡片轻微点亮，和空状态一眼可分 */
.ref-card.has { border-color: rgba(242, 189, 99, 0.4); background: rgba(242, 189, 99, 0.07); }
/* 互斥锁定：只压暗可交互区，红字提示保持清晰 */
.ref-card.locked .ref-card-head,
.ref-card.locked .ref-body { opacity: 0.4; }
.ref-card.locked .ref-add { pointer-events: none; }

.ref-card-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ref-card-head b {
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.01em; white-space: nowrap;
}
.ref-card-head small {
  font-size: 10.5px; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ref-body { display: flex; flex-wrap: wrap; gap: 7px; }

.ref-add {
  flex: none; width: 56px; height: 56px;
  display: grid; place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.24); border-radius: 11px;
  background: rgba(255, 255, 255, 0.03); color: var(--accent);
  font-size: 20px; font-weight: 400; line-height: 1;
  transition: 0.16s ease;
}
.ref-add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.ref-item { position: relative; flex: none; width: 56px; }
.ref-item > small {
  display: block; margin-top: 3px;
  font-size: 9.5px; color: var(--muted-2); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.ref-thumb {
  position: relative; width: 56px; height: 56px;
  display: grid; place-items: center;
  overflow: hidden; border: 1px solid var(--line-soft); border-radius: 11px;
  background: #05070b;
}
.ref-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ref-file-ico { font-size: 18px; color: var(--accent); line-height: 1; }

/* 多图顺序号：左上角，多选时按点选顺序递增 */
.ref-num {
  position: absolute; top: -5px; left: -5px; z-index: 2;
  min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--accent); color: #14181f;
  font-size: 9.5px; font-weight: 900; line-height: 1;
}
.ref-del {
  position: absolute; top: -5px; right: -5px; z-index: 2;
  width: 16px; height: 16px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: #2a2f39; color: var(--muted);
  font-size: 11px; line-height: 1;
  opacity: 0.72; transition: 0.14s ease;      /* 常显半透明，否则用户找不到怎么删 */
}
.ref-item:hover .ref-del, .ref-del:focus-visible { opacity: 1; }
.ref-del:hover { background: var(--danger); color: #14181f; }

.ref-total { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.ref-total.over { color: var(--danger); font-weight: 700; }
.ref-lock { font-size: 10.5px; line-height: 1.4; color: var(--danger); }

/* 上传中占位 */
.ref-item.busy .ref-thumb { border-style: dashed; border-color: rgba(242, 189, 99, 0.35); }
.ref-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(242, 189, 99, 0.22);
  border-top-color: var(--accent);
  animation: refspin 0.7s linear infinite;
}
@keyframes refspin { to { transform: rotate(360deg); } }

/* 触屏没有 hover，删除按钮常显，否则删不掉 */
@media (hover: none) {
  .ref-del { opacity: 1; }
}
/* 小屏两列，避免五张卡片竖着排一长条 */
@media (max-width: 640px) {
  .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* chip static 已随"视频生成"标签一起移除，保留定义以防后台页面复用 */
.chip.static { cursor: default; }

/* display:flex / grid 会覆盖 [hidden] 的默认样式，这里显式兜住 */
[hidden] { display: none !important; }

/* ================= 运营（管理员视图，嵌在站内） ================= */
.atabs {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px;
  border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255, 255, 255, 0.04);
}
.atabs button {
  min-height: 36px; padding: 0 18px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 800;
}
.atabs button.active { background: var(--accent); color: #14181f; }

.astat { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.a-order {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 14px 16px; margin-bottom: 10px; backdrop-filter: blur(18px);
}
.a-order .code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 19px;
  font-weight: 900; letter-spacing: 0.12em; color: var(--accent);
}
.a-order .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.7; }
.a-order .right { display: flex; align-items: center; gap: 14px; }
.a-order .amt { font-size: 24px; font-weight: 900; }
.a-order .acts { display: flex; flex-direction: column; gap: 8px; }

.a-user {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03); padding: 11px 13px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.a-user:hover { border-color: rgba(242, 189, 99, 0.35); }
.a-user.sel { border-color: rgba(242, 189, 99, 0.7); background: rgba(242, 189, 99, 0.09); }
.a-user .em { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13.5px; word-break: break-all; }
.a-user .sub2 { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.a-user .right { display: flex; align-items: center; gap: 12px; }
.a-user .bal { font-size: 18px; font-weight: 900; color: var(--accent); white-space: nowrap; }
.a-user .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* 用户与调账：左列表 / 右功能 */
.alayout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.aside {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 14px; position: sticky; top: 84px;
  max-height: calc(100vh - 120px); overflow: auto; backdrop-filter: blur(18px);
}
.aside-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.aside-head b { font-size: 14px; }
.amain { min-width: 0; }
.a-em { font-weight: 800; font-size: 15px; word-break: break-all; display: flex; align-items: center; gap: 6px; }
.a-bal-row { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 14px; }
.a-bal-row b { font-size: 26px; color: var(--accent); }
.a-bal-row span { color: var(--muted); font-size: 13px; }

.abadge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 900; color: #14181f; background: var(--accent); letter-spacing: 0.04em;
}

.apanel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 16px; margin-bottom: 18px; backdrop-filter: blur(18px);
}
.apanel h3 { margin: 0 0 12px; font-size: 14.5px; }
.agrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.agrid input, .abar input {
  min-height: 42px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-size: 14px; outline: none;
}
.agrid input:focus, .abar input:focus { border-color: rgba(242, 189, 99, 0.55); }
.agrid .btn { min-height: 42px; }
.abar { display: flex; gap: 10px; margin-bottom: 12px; }
.abar input { flex: 1; }
.atext {
  width: 100%; min-height: 140px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.7; outline: none; resize: vertical;
}
.arow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* 收款二维码卡片墙 */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.qr-card {
  position: relative; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03); padding: 10px; text-align: center;
  transition: border-color .15s, background .15s;
}
.qr-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; display: block; background: #fff; }
.qr-card .st { margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.qr-card.on { border-color: rgba(242, 189, 99, 0.7); background: rgba(242, 189, 99, 0.09); }
.qr-card.on .st { color: var(--accent); }
.qr-card .del {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1;
  background: rgba(0, 0, 0, 0.55); color: #fff; display: none;
}
.qr-card:hover .del { display: block; }
.qr-empty { color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .alayout { grid-template-columns: 1fr; }
  .aside { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .agrid { grid-template-columns: 1fr; }
  .a-user, .a-order { grid-template-columns: 1fr; }
  .a-user .acts { justify-content: flex-start; }
  .a-order .right { justify-content: space-between; }
}

/* 密码输入框：右侧小眼睛切换明文/密文 */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.pw-eye:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.pw-eye.on { color: var(--accent); }
.pw-eye svg { width: 18px; height: 18px; }

/* ================= 运营 → 价格设置 ================= */
.a-price {
  display: grid; grid-template-columns: 210px 132px 1fr auto; gap: 12px; align-items: center;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03); padding: 10px 14px; margin-bottom: 8px;
}
.a-price.off { opacity: 0.5; }

/* 「积分」页价格表：按模型分组 */
.price-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.price-group > b { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13.5px; }
.price-group > span { color: var(--muted); font-size: 13px; line-height: 1.85; }
.price-ico { width: 16px; height: 16px; object-fit: contain; display: block; }
.tag.tag-model {
  display: inline-flex; align-items: center; gap: 4px;
  border-color: rgba(242, 189, 99, 0.42); background: var(--accent-soft); color: var(--accent);
}
.tag-ico { width: 13px; height: 13px; object-fit: contain; display: block; }
.a-price .lbl { font-size: 13.5px; font-weight: 800; letter-spacing: 0.01em; }
.a-price .lbl small {
  display: block; margin-top: 3px; color: var(--muted);
  font-weight: 600; font-size: 11.5px; letter-spacing: 0;
}
.a-price .pCredits {
  width: 100%; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255, 255, 255, 0.05); color: var(--text);
  font-size: 15px; font-weight: 900; text-align: right; outline: none;
  font-variant-numeric: tabular-nums;
}
.a-price .pCredits:focus { border-color: rgba(242, 189, 99, 0.55); }
.a-price .pYuan { color: var(--muted); font-size: 13px; font-weight: 700; }
.a-price .pYuan b { color: var(--accent); font-weight: 900; }
.a-price .pOn { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.a-price .pOn input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

@media (max-width: 640px) {
  .a-price { grid-template-columns: 1fr 110px; row-gap: 8px; }
  .a-price .pOn { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Online checkout: fit full payment order IDs on narrow screens. */
.pay-card .order-line { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; text-align:left; padding:12px; margin:16px 0; border-radius:12px; background:rgba(255,255,255,.035); font-size:12px; }
.pay-card #payOrderNo { grid-column:1 / -1; grid-row:2; min-width:0; font-size:12px; line-height:1.5; letter-spacing:.02em; overflow-wrap:anywhere; word-break:break-all; color:var(--text); }
.pay-card #copyOrderBtn { grid-column:2; grid-row:1; }
.pay-card #paymentMethodRow { margin:16px 0; }
.pay-card #paymentMethodRow label { display:block; text-align:left; margin-bottom:6px; }
.pay-card #paymentMethod { display:block; width:100%; padding:10px 12px; border-radius:10px; border:1px solid rgba(255,255,255,.15); background:#181c24; color:#f5f6f8; color-scheme:dark; font:inherit; }
.pay-card #payOnlineLink { justify-content:center; align-items:center; min-height:42px; text-decoration:none; }

/* 订单二维码在本站生成，白色留边保证手机扫码识别。 */
.online-qr-section { margin: 12px 0 14px; }
.online-qr { box-sizing: content-box; width: 200px; height: 200px; padding: 28px; margin: 0 auto; background: #fff; border-radius: 12px; }
.online-qr canvas, .online-qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.scan-pay-label { margin: 10px 0 0; font-size: 13px; color: var(--text); }
.pay-card .order-line { margin: 12px 0; padding: 9px 12px; }

.pay-card #payHint { margin: 10px 0 12px; line-height: 1.6; }
@media (max-width:360px) { .online-qr { width:160px; height:160px; padding:24px; } .online-qr canvas, .online-qr img { width:160px; height:160px; } }

.pay-card h2 .gain { display:inline-block; white-space:nowrap; margin-left:8px; }

/* Operational release: media reference pricing and compact mobile navigation. */
.a-price{grid-template-columns:minmax(170px,1.5fr) 90px 110px minmax(145px,1fr) 70px}.pRef{font-size:11px;color:var(--muted)}.pRef input{display:block;width:100%;margin-top:6px;box-sizing:border-box}.work-actions{flex-wrap:wrap}
@media(max-width:640px){.a-price{grid-template-columns:1fr 90px}.a-price .pRef{grid-column:1/-1}.a-price .pOn{grid-column:2}.topbar{padding:0 12px;gap:10px}.topbar-right{gap:6px}.brand{flex-shrink:0}.brand>div{display:none}.credit-card{padding:0 8px;gap:4px;flex-shrink:0}.credit-card>span:last-child{display:none}#buyBtn{white-space:nowrap;flex-shrink:0;padding-left:10px;padding-right:10px}.user-chip{max-width:150px}.user-chip-text b{max-width:68px}.user-wrap{min-width:0}.composer-hint{overflow-wrap:anywhere}}
