:root {
  --bg: #0b0d17;
  --bg-soft: #141728;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #e8eaf2;
  --text-dim: #9aa0b4;
  --accent: #7c6cff;
  --accent-2: #ff6cae;
  --accent-grad: linear-gradient(135deg, #7c6cff 0%, #ff6cae 100%);
  --ok: #36d399;
  --warn: #fbbd23;
  --err: #f87272;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c1840 0%, transparent 60%),
              radial-gradient(900px 500px at 0% 0%, #102236 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.lg { width: 34px; height: 34px; }

/* 顶部栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--card-border);
  background: rgba(11, 13, 23, 0.7); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-grad); font-weight: 800; font-size: 20px; color: #fff;
  box-shadow: 0 6px 18px rgba(124, 108, 255, 0.4);
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.balance-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 999px; font-size: 13px;
}
.balance-label { color: var(--text-dim); }
.balance-value { font-weight: 700; color: var(--ok); font-variant-numeric: tabular-nums; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: none; border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--card); border: 1px solid var(--card-border);
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent-grad); border: none; color: #fff; box-shadow: 0 6px 18px rgba(124, 108, 255, 0.35); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; padding: 12px; font-size: 15px; }

/* Tabs */
.tabs { display: flex; gap: 8px; padding: 18px 28px 0; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 18px; border-radius: 12px 12px 0 0; font-size: 14px; font-weight: 600;
  color: var(--text-dim); background: transparent; border: 1px solid transparent; border-bottom: none;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--bg-soft); border-color: var(--card-border); position: relative; }
.tab.active::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; background: var(--accent-grad); }

/* Content */
.content { padding: 0 28px 40px; }
.panel { display: none; padding-top: 18px; }
.panel.active { display: block; }
.grid-2 { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 920px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-soft); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 16px; font-weight: 700; }

/* Form */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea, select, input[type="text"] {
  width: 100%; background: rgba(0, 0, 0, 0.25); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 10px; padding: 11px 12px;
  font-size: 14px; font-family: inherit; resize: vertical; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus, select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18); }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--card-border); border-radius: 12px; min-height: 130px;
  display: grid; place-items: center; cursor: pointer; position: relative; overflow: hidden;
  background: rgba(0, 0, 0, 0.18); transition: border-color .2s, background .2s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(124, 108, 255, 0.08); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.dropzone-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Results */
.placeholder { color: var(--text-dim); font-size: 13px; padding: 24px; text-align: center; border: 1px dashed var(--card-border); border-radius: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.result-stack { display: flex; flex-direction: column; gap: 16px; }

.result-item { border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,0.2); }
.result-item .media { width: 100%; display: block; background: #000; }
.result-item img.media { aspect-ratio: 3/4; object-fit: cover; }
.result-item .meta { padding: 10px 12px; font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; gap: 8px; }

/* 进度 */
.progress { padding: 18px; }
.progress .bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress .fill { height: 100%; width: 0%; background: var(--accent-grad); transition: width .4s ease; }
.progress .label { margin-top: 10px; font-size: 13px; color: var(--text-dim); display: flex; justify-content: space-between; }

/* 视频/数字人占位 */
.video-ph {
  position: relative; aspect-ratio: 9/16; max-width: 320px; margin: 0 auto; border-radius: 12px;
  background: linear-gradient(135deg, #2a2350, #3a1f3d); display: grid; place-items: center; overflow: hidden;
}
.video-ph.wide { aspect-ratio: 16/9; max-width: 100%; }
.video-ph .play {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.92); display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.video-ph .play svg { width: 24px; height: 24px; fill: #1a1a2e; margin-left: 3px; }
.video-ph .badge { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.6); padding: 3px 9px; border-radius: 999px; font-size: 11px; }
.video-ph .tag { position: absolute; top: 10px; left: 10px; background: var(--accent-grad); padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }

/* Drawer */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 90vw;
  background: var(--bg-soft); border-left: 1px solid var(--card-border); z-index: 40;
  transform: translateX(100%); transition: transform .28s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--card-border); }
.drawer-head h3 { font-size: 15px; }
.icon-btn { background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; line-height: 1; }
.drawer-body { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .28s; }
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.history-item { border: 1px solid var(--card-border); border-radius: 10px; padding: 12px; font-size: 13px; }
.history-item .h-top { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.history-item .h-prompt { color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-pending, .status-running { background: var(--warn); }
.status-succeeded { background: var(--ok); }
.status-failed { background: var(--err); }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2233; border: 1px solid var(--card-border); color: var(--text);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--err); }
.toast.ok { border-color: var(--ok); }

/* 占位提示条：区分演示占位与真实生成 */
.mock-banner {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 179, 0, 0.14);
  border: 1px solid rgba(255, 179, 0, 0.45);
  color: #ffce6b;
  font-size: 13px;
  line-height: 1.5;
}

/* ===== 充值弹窗 ===== */
.recharge-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center;
}
.recharge-card {
  width: 340px; max-width: 90vw;
  background: #1c1f2e; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rc-title { font-size: 17px; font-weight: 600; color: #fff; }
.rc-close { background: none; border: none; color: #8b90a5; font-size: 24px; cursor: pointer; line-height: 1; }
.rc-close:hover { color: #fff; }
.rc-label { color: #aab; font-size: 13px; margin-bottom: 10px; }
.rc-amounts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.rc-amt {
  padding: 12px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: #e5e7f0; font-size: 15px; font-weight: 600;
  transition: all .15s;
}
.rc-amt:hover { border-color: #a78bfa; }
.rc-amt.on { background: linear-gradient(135deg,#8b5cf6,#ec4899); border-color: transparent; color: #fff; }
.rc-custom { display: flex; align-items: center; gap: 8px; color: #aab; font-size: 13px; margin-bottom: 14px; }
.rc-custom input {
  flex: 1; padding: 9px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: #fff; font-size: 14px; outline: none;
}
.rc-custom input:focus { border-color: #a78bfa; }
.rc-submit {
  width: 100%; padding: 12px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(135deg,#8b5cf6,#ec4899); color: #fff;
  font-size: 15px; font-weight: 600;
}
.rc-submit:hover { filter: brightness(1.05); }
.rc-qr { display: block; width: 220px; height: 220px; margin: 0 auto 12px; border-radius: 10px; background: #fff; }
.rc-tip { text-align: center; color: #8b90a5; font-size: 12px; margin-bottom: 14px; }
.rc-err { color: #f87171; font-size: 13px; margin-bottom: 14px; text-align: center; }

/* 登录切换 */
.rc-switch { text-align: center; color: #a78bfa; font-size: 13px; margin-top: 14px; cursor: pointer; }
.rc-switch:hover { text-decoration: underline; }

/* 表单提示 */
.hint { font-size: 12px; color: #8b90a5; margin-top: 6px; line-height: 1.5; }

/* 明码标价栏 */
.pricing-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  padding: 10px 20px;
  background: rgba(167, 139, 250, 0.08);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px; color: #b8bdd0;
}
.pricing-title { font-weight: 700; color: #a78bfa; }
.pricing-item b { color: #ffce6b; font-weight: 700; }
.pricing-note { color: #8b90a5; margin-left: auto; }

/* 用户区（头像 + 手机号 + 退出） */
.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip[hidden] { display: none; }
.btn[hidden] { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg,#8b5cf6,#ec4899);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.user-phone { color: #e5e7f0; font-size: 13px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* 视频结果 + 下载链接 */
.video-media { width: 100%; border-radius: 12px; background: #000; max-height: 420px; }
.dl-link {
  color: #a78bfa; text-decoration: none; font-size: 13px; cursor: pointer;
  padding: 4px 10px; border: 1px solid rgba(167,139,250,0.4); border-radius: 6px;
}
.dl-link:hover { background: rgba(167,139,250,0.12); }
