:root {
  --brand: #7c5cff;
  --brand-soft: #efeaff;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #8a90a2;
  --line: #ececf2;
  --shadow: 0 2px 12px rgba(30, 30, 60, 0.06);
}
html.dark {
  --bg: #15161c;
  --card: #1e2029;
  --text: #e8eaf2;
  --muted: #9aa0b4;
  --line: #2c2f3a;
  --brand-soft: #2a2440;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
}
.hidden { display: none !important; }

/* 封面 + 头像 */
.cover { position: relative; }
.cover-img {
  height: 200px; width: 100%;
  background: linear-gradient(120deg, var(--brand), #4b3fd6);
  background-size: cover; background-position: center;
}
.profile {
  max-width: 960px; margin: -48px auto 0; padding: 0 20px;
  display: flex; align-items: flex-end; gap: 16px; position: relative;
}
.avatar {
  width: 96px; height: 96px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand) center/cover; border: 4px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff; font-weight: 700;
}
.profile-meta { flex: 1; padding-bottom: 6px; }
.profile-meta h1 { font-size: 22px; }
.bio { color: var(--muted); font-size: 14px; margin-top: 4px; }
.profile-stats { color: var(--muted); font-size: 13px; margin-top: 6px; }
.support-top { margin-bottom: 10px; }

.btn-primary {
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 10px 22px; font-size: 15px; cursor: pointer; font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }

/* Tab */
.tabs {
  max-width: 960px; margin: 18px auto 0; padding: 0 20px;
  display: flex; gap: 8px; border-bottom: 1px solid var(--line);
}
.tab {
  background: none; border: none; padding: 12px 16px; font-size: 15px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 布局 */
.layout {
  max-width: 960px; margin: 20px auto; padding: 0 20px;
  display: grid; grid-template-columns: 1fr 300px; gap: 20px;
}
.main { min-width: 0; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card .price { color: var(--brand); font-weight: 700; font-size: 18px; }
.card .desc { color: var(--muted); font-size: 13px; margin: 6px 0; }
.card .sold { color: var(--muted); font-size: 12px; }
.card .buy {
  margin-top: 10px; width: 100%; background: var(--brand-soft); color: var(--brand);
  border: none; border-radius: 999px; padding: 8px; font-weight: 600; cursor: pointer;
}
.tier-perks { list-style: none; margin: 8px 0; }
.tier-perks li { font-size: 13px; color: var(--text); padding-left: 16px; position: relative; }
.tier-perks li:before { content: "·"; color: var(--brand); position: absolute; left: 4px; font-weight: 700; }

/* 动态 */
.feed-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.feed-item .time { color: var(--muted); font-size: 12px; }
.feed-item .text { margin-top: 4px; }

/* 关于 */
.about-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow);
}
.about-box p { margin-bottom: 8px; }

/* 侧栏 */
.side { display: flex; flex-direction: column; gap: 14px; }
.widget {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.widget h3 { font-size: 14px; margin-bottom: 10px; }
.goal-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.goal-fill { height: 100%; background: var(--brand); width: 0; transition: width 0.4s; }
.goal-text { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sponsor-list { list-style: none; }
.sponsor-list li {
  display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.sponsor-list li:last-child { border-bottom: none; }
.sponsor-list .amt { color: var(--brand); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat-grid .n { font-size: 20px; font-weight: 700; color: var(--brand); }
.stat-grid .l { font-size: 12px; color: var(--muted); }

.foot { max-width: 960px; margin: 30px auto; padding: 0 20px; color: var(--muted); font-size: 12px; text-align: center; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 16px; width: 100%; max-width: 380px;
  padding: 22px; position: relative; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; right: 14px; top: 10px; background: none; border: none;
  font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal h2 { font-size: 18px; }
.pay-amount { margin: 8px 0; color: var(--muted); }
.pay-amount b { color: var(--brand); font-size: 20px; }
.channel-switch { display: flex; gap: 8px; margin: 12px 0; }
.chan {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: none;
  border-radius: 10px; cursor: pointer; color: var(--text); font-size: 14px;
}
.chan.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.qr-box { text-align: center; margin: 10px 0; }
.qr-img {
  width: 200px; height: 200px; margin: 0 auto; border-radius: 10px;
  background: var(--line) center/cover; display: flex; align-items: center;
  justify-content: center; color: var(--muted); font-size: 13px; text-align: center;
}
.qr-tip { font-size: 13px; color: var(--muted); margin-top: 8px; }
.order-meta { margin: 12px 0; }
.order-meta label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.order-meta input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.order-id { font-size: 13px; color: var(--muted); margin: 8px 0; }
.order-id b { color: var(--text); }
.pay-warn { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .profile { flex-wrap: wrap; }
  .support-top { width: 100%; }
}

/* ===== 创作者后台 ===== */
.admin-head { max-width: 960px; margin: 0 auto; padding: 20px 20px 0; }
.admin-head h1 { font-size: 20px; }
.token-bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.token-bar input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); flex: 1; max-width: 320px; }
#connStatus { font-size: 13px; color: var(--muted); }
.admin-main { max-width: 960px; margin: 16px auto; padding: 0 20px; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.admin-card h3 { font-size: 15px; margin-bottom: 10px; }
.admin-card label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.admin-card input[type=text], .admin-card input[type=number], .admin-card textarea, .admin-card select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit;
}
.admin-card textarea { resize: vertical; }
.admin-card .ck { display: flex; align-items: center; gap: 6px; color: var(--text); }
.admin-card .ck input { width: auto; }
.admin-card button { margin-top: 10px; margin-right: 8px; }
.admin-list .row { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.admin-list .row > div:first-child { flex: 1; min-width: 0; }
.mini { background: var(--brand-soft); color: var(--brand); border: none; border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.mini.danger { background: #ffe9e9; color: #d33; }
.muted { color: var(--muted); font-size: 13px; }
.off { color: #d33; font-size: 12px; margin-left: 6px; }
.st { font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-left: 8px; }
.st-pending { background: #fff4e0; color: #c87; }
.st-paid { background: #e6f4ff; color: #37a; }
.st-done { background: #e7f9ee; color: #2a9; }
.row.order { flex-direction: column; align-items: stretch; }
.row.order > span { margin-top: 8px; }
