:root {
  --bg: #0b0e1a;
  --bg2: #11152a;
  --card: #171c36;
  --card2: #1d2342;
  --border: #2a3157;
  --text: #e7eaf6;
  --muted: #8b93b5;
  --primary: #6366f1;
  --primary2: #8b5cf6;
  --accent: #22d3ee;
  --gold: #f5b544;
  --red: #ff4d5e;
  --green: #34d399;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
}

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2145 0%, transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; height: 62px;
  background: rgba(13, 16, 33, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; display: block; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; }

.nav { display: flex; gap: 6px; }
.nav-item {
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 14px;
  color: var(--muted); transition: all .18s; user-select: none;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: var(--grad); box-shadow: 0 4px 16px rgba(99,102,241,.4); }

.auth-zone { display: flex; align-items: center; gap: 10px; }
.guest-box { display: flex; gap: 8px; }

.user-box { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; }
img.avatar, img.p-avatar { display: block; object-fit: cover; border-radius: 50%; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name-row { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.uid { color: var(--red); font-weight: 800; font-size: 13px; letter-spacing: .5px; }
.user-meta small { color: var(--muted); font-size: 12px; }
.vip-badge {
  background: linear-gradient(135deg, #f5b544, #f97316); color: #3a2500;
  font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 20px;
  letter-spacing: 1px;
}
.points-chip { color: var(--accent); font-size: 13px; font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; cursor: pointer; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; transition: all .18s; font-family: inherit;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.5); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(255,77,94,.14); color: var(--red); border: 1px solid rgba(255,77,94,.35); }
.btn-danger:hover { background: rgba(255,77,94,.25); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 容器与卡片 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }
.view { display: none; animation: fade .25s; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 30px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 8px; }
.hero p { color: var(--muted); font-size: 14px; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; margin-bottom: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.card h3 { font-size: 16px; margin-bottom: 16px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .panel-grid { grid-template-columns: 1fr; } }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 14px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: all .18s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: rgba(99,102,241,.06); }
.drop-icon { font-size: 34px; color: var(--primary); margin-bottom: 10px; }
.drop-inner p { font-size: 15px; margin-bottom: 6px; }
.drop-inner small { color: var(--muted); }
.file-chip {
  margin-top: 12px; padding: 10px 14px; background: var(--card2); border-radius: 10px;
  display: flex; align-items: center; gap: 8px; font-size: 14px; word-break: break-all;
}
.file-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.upload-tip {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: rgba(245, 197, 24, 0.08); border: 1px solid rgba(245, 197, 24, 0.35);
  color: #f5c518; font-size: 13px; line-height: 1.7; word-break: break-word;
}

/* ---------- 模式选择 ---------- */
.mode-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.sub-label { font-size: 13px; font-weight: 700; color: #a5b4fc; margin: 6px 0 10px; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mode-opt { position: relative; cursor: pointer; }
.mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt span {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; transition: all .15s;
}
.mode-opt span b { font-size: 14px; }
.mode-opt span small { color: var(--muted); font-size: 11px; }
.mode-opt.active span { border-color: var(--primary); background: rgba(99,102,241,.12); box-shadow: 0 0 0 1px var(--primary) inset; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin-bottom: 14px; cursor: pointer; user-select: none; }
.chk { width: 16px; height: 16px; accent-color: var(--primary); }

.progress-zone { margin-bottom: 14px; }
.progress-zone-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.progress-label { font-size: 13px; font-weight: 600; color: var(--text); }
.progress-percent { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ---------- 结果 ---------- */
.result-card { margin-top: 18px; }
.progress { height: 8px; background: var(--card2); border-radius: 6px; overflow: hidden; margin: 0; }
.progress-fill { height: 100%; width: 0%; background: var(--grad); border-radius: 6px; transition: width .25s ease; }
.progress-fill.indeterminate { width: 40%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.job-status { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

.stem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.stem-item {
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.stem-item .stem-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.stem-item audio { width: 100%; height: 36px; border-radius: 8px; }
.stem-item .dl { color: var(--accent); font-size: 12px; text-decoration: none; }
.stem-item .dl:hover { text-decoration: underline; }

/* ---------- 音乐生成 ---------- */
textarea {
  width: 100%; min-height: 130px; padding: 14px; resize: vertical;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 14px; font-family: inherit; line-height: 1.6;
}
textarea:focus, input:focus { outline: none; border-color: var(--primary); }
.char-count { text-align: right; font-size: 12px; color: var(--muted); margin: 8px 0 14px; }
#genBtn { width: 100%; }

.music-options { margin: 20px 0 6px; }
.option-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
#durationList { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) { .option-row { grid-template-columns: repeat(2, 1fr); } }

.music-list { display: flex; flex-direction: column; gap: 12px; }
.music-item {
  display: flex; flex-direction: column; gap: 10px; background: var(--card2);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.music-item .m-top { display: flex; align-items: flex-start; gap: 12px; width: 100%; }
.music-item .m-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.music-item .m-main { flex: 1; min-width: 0; }
.music-item .m-title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; min-width: 0; }
.music-item .m-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; flex: 1; min-width: 0; }
.music-item .m-title.marquee span { display: inline-block; white-space: nowrap; padding-left: 100%; animation: marquee 9s linear infinite; }
.music-item .m-tags { display: inline-flex; gap: 4px; flex-shrink: 0; align-items: center; }
.music-item .m-prompt { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-item .m-prompt.m-lyrics { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.music-item .m-time { color: var(--muted); font-size: 12px; }
.music-item audio { width: 100%; height: 36px; border-radius: 8px; }
.music-item .dl { color: var(--accent); font-size: 12px; text-decoration: none; flex-shrink: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; white-space: nowrap; }
.music-item .dl:hover { border-color: var(--accent); background: rgba(34,211,238,.08); }
.record-empty, .music-empty { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* ---------- 会员中心 ---------- */
.profile-card { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.p-avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; flex-shrink: 0; }
.p-info { flex: 1; min-width: 220px; padding-top: 1px; }
.p-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-name { font-size: 18px; font-weight: 700; }
.p-uid { color: var(--red); font-weight: 800; font-size: 15px; letter-spacing: .5px; }
.p-rows { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 7px; }
.p-rows b { color: var(--text); }

/* 两列两组操作框架 */
.action-framework { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; }
@media (max-width: 760px) { .action-framework { grid-template-columns: 1fr; } }
.af-column { display: flex; flex-direction: column; gap: 12px; }
.af-tile {
  width: 100%; padding: 16px 14px; border-radius: 12px; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border); background: var(--card2); color: var(--text);
  font-size: 15px; font-weight: 600; transition: all .15s; text-align: center;
}
.af-tile:hover { border-color: var(--primary); background: rgba(99,102,241,.1); }
.af-tile.active { border-color: var(--primary); background: rgba(99,102,241,.14); box-shadow: 0 0 0 1px var(--primary) inset; }
.af-tile:disabled { opacity: .5; cursor: not-allowed; }
.af-tile.af-primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(99,102,241,.3); }
.af-tile.af-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.45); }
.af-tile.af-primary:disabled { transform: none; box-shadow: none; }
.af-tile.af-gold { background: linear-gradient(135deg, #f5b544, #f97316); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(245,181,68,.35); }
.af-tile.af-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,181,68,.5); }

.recharge-modal { width: 360px; }
.recharge-body { text-align: center; }
.recharge-title { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.qr-wrap { width: 240px; height: 240px; margin: 18px auto 0; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.qr-wrap img { width: 100%; height: 100%; display: block; border-radius: 8px; }
.recharge-tip { color: var(--red); font-size: 14px; font-weight: 700; line-height: 1.7; margin-top: 16px; }
.storage-policy {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  background: rgba(245, 197, 24, .08); border: 1px solid rgba(245, 197, 24, .35);
  color: #f5c518; font-size: 13px; line-height: 1.7; text-align: center; font-weight: 600;
}
/* 首页底部数据看板（长条卡片） */
.stats-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 22px 18px; text-align: center; margin-bottom: 18px;
}
@media (max-width: 760px) { .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 22px 8px; } }
.stat-cell { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 4px 8px; }
.stat-cell + .stat-cell::before {
  content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 60%; background: var(--border);
}
@media (max-width: 760px) {
  .stat-cell:nth-child(odd)::before { display: none; }
  .stat-cell + .stat-cell::before { left: -4px; }
}
.stat-num {
  font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-cell:nth-child(2) .stat-num { background: linear-gradient(135deg, #22d3ee, #6366f1); -webkit-background-clip: text; background-clip: text; }
.stat-cell:nth-child(3) .stat-num { background: linear-gradient(135deg, #f5b544, #f97316); -webkit-background-clip: text; background-clip: text; }
.stat-cell:nth-child(4) .stat-num { background: linear-gradient(135deg, #34d399, #22d3ee); -webkit-background-clip: text; background-clip: text; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-box { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  min-width: 110px; text-align: center; background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; flex: 1;
}
.stat .num { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat.pts .num { color: var(--gold); }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  padding: 9px 20px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; transition: all .15s;
}
.tab.active { background: var(--grad); color: #fff; border-color: transparent; }

.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-item { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.record-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.record-head .r-name { font-weight: 600; font-size: 14px; flex: 1; word-break: break-all; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.tag.mode { background: rgba(99,102,241,.2); color: #a5b4fc; }
.tag.ok { background: rgba(52,211,153,.15); color: var(--green); }
.tag.err { background: rgba(255,77,94,.15); color: var(--red); }
.tag.run { background: rgba(245,181,68,.15); color: var(--gold); }
.record-head .r-time { color: var(--muted); font-size: 12px; }

/* ---------- 后台 ---------- */
.admin-table { display: flex; flex-direction: column; gap: 10px; }
.admin-row {
  display: grid; grid-template-columns: 90px 1fr 90px 90px 1fr; gap: 12px; align-items: center;
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
@media (max-width: 760px) { .admin-row { grid-template-columns: 1fr 1fr; } }
.admin-row .a-uid { color: var(--red); font-weight: 800; }
.admin-row .a-name { font-weight: 600; font-size: 14px; }
.admin-row .a-dim { color: var(--muted); font-size: 13px; }
.admin-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-actions input {
  width: 70px; padding: 7px 8px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px;
}
.banned-mark { color: var(--red); font-weight: 800; font-size: 12px; }

.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.log-item { font-size: 13px; color: var(--muted); padding: 8px 12px; background: var(--card2); border-radius: 8px; }
.log-item b { color: var(--text); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { width: 400px; max-width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; }
.close { background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.auth-switch { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.auth-tab.active { background: var(--grad); color: #fff; border-color: transparent; }
.modal-body label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.modal-body input {
  width: 100%; padding: 11px 12px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px;
}
.modal-body .btn { margin-top: 18px; }
.auth-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 22px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: all .25s; max-width: 90vw;
}
.toast.show { opacity: 1; }
.toast.ok { border-color: rgba(52,211,153,.5); }
.toast.err { border-color: rgba(255,77,94,.5); }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 20px; }