/* ============================================================
   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); }
.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); }

.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; }

/* ---------- 积分 / 套餐 ---------- */
.credits-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px;
  background: linear-gradient(120deg, rgba(242, 189, 99, 0.12), rgba(20, 24, 31, 0.78) 55%);
  backdrop-filter: blur(18px);
}
.credits-hero .num { font-size: 44px; font-weight: 900; color: var(--accent); line-height: 1; }
.credits-hero .lbl { color: var(--muted); font-size: 13px; margin-top: 8px; }

.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); }

/* ---------- 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: column; align-items: flex-start; gap: 1px;
  width: 100%; padding: 8px 10px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text); text-align: left;
}
.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);
}

.ref-drop { margin-bottom: 12px; }

.ref-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; padding: 20px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.22); border-radius: 14px;
  background: rgba(255, 255, 255, 0.03); color: var(--muted);
  transition: 0.16s ease;
}
.ref-empty:hover, .ref-drop.dragging .ref-empty {
  border-color: var(--accent); background: var(--accent-soft); color: var(--text);
}
.ref-empty b { font-size: 13px; font-weight: 800; }
.ref-empty small { font-size: 11.5px; color: var(--muted-2); }
.ref-plus {
  display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 2px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.08);
  color: var(--accent); font-size: 16px; font-weight: 700;
}

.ref-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid var(--line-soft); border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}
.ref-preview img {
  width: 72px; height: 72px; flex: none; object-fit: cover;
  border-radius: 10px; background: #000;
}
.ref-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ref-meta b {
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ref-meta small { font-size: 11.5px; color: var(--muted-2); }
.ref-remove {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: var(--muted);
  font-size: 17px; line-height: 1;
}
.ref-remove:hover { background: rgba(255, 106, 106, 0.16); color: var(--danger); }

/* chip static 已随"视频生成"标签一起移除，保留定义以防后台页面复用 */
.chip.static { cursor: default; }

/* display:flex 会覆盖 [hidden] 的默认样式，这里显式兜住 */
[hidden] { display: none !important; }
.ref-empty[hidden], .ref-preview[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 { color: var(--text); font-size: 13.5px; }
.price-group > span { color: var(--muted); font-size: 13px; }
.tag.tag-model { border-color: rgba(242, 189, 99, 0.42); background: var(--accent-soft); color: var(--accent); }
.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; }
}
