:root {
  --bg: #fff7f3;
  --card: #ffffff;
  --ink: #1d1d2b;
  --muted: #7a7d8c;
  --brand: #ff6b4a;
  --brand-2: #7c5cff;
  --ok: #16a34a;
  --bad: #ef4444;
  --line: #f0e4de;
  --shadow: 0 10px 30px rgba(60, 30, 20, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at -10% -10%, #ffe0d3 0%, transparent 60%),
    radial-gradient(800px 500px at 110% 0%, #e6dfff 0%, transparent 60%),
    var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
h2 { margin: 0 0 8px; font-size: 20px; }
h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }
.note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.center { text-align: center; }
.big { font-size: 40px; margin: 0; }
.container { max-width: 480px; margin: 0 auto; padding: 8px 14px 24px; }
.testnet-notice { max-width: 452px; width: calc(100% - 28px); margin: 8px auto; padding: 10px 14px; border: 1px solid #e6c66b; border-radius: 12px; background: #fff3c4; color: #694b00; font-size: 13px; line-height: 1.6; }

/* 顶栏与底部导航 */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 480px; margin: 0 auto; padding: 12px 16px;
  background: rgba(255, 247, 243, 0.85); backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; }
.me, .pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); text-decoration: none; }
.pill { padding: 7px 14px; border-radius: 999px; background: var(--ink); color: #fff; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; max-width: 480px; margin: 0 auto;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
}
.tabbar a { position: relative; flex: 1; padding: 6px 0; text-align: center; font-size: 13px; color: var(--muted); text-decoration: none; }
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tabbar .dot { position: absolute; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 4px; }

/* 通用组件 */
.avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%; object-fit: cover;
  display: inline-grid; place-items: center;
  background: #ffe0d3; color: #b5401f; font-weight: 700;
}
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.profile { display: flex; align-items: center; gap: 14px; }
.badge { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: #fff3c4; color: #7a5b00; font-size: 13px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stats > div { background: var(--card); border-radius: 16px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 15px; }
.stats span { font-size: 12px; color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link { background: none; border: none; padding: 0; color: var(--brand-2); font-size: 14px; cursor: pointer; text-decoration: none; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: none; }
.list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list li > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list li.unread > span:first-child { font-weight: 700; }
.list small, .list time { color: var(--muted); font-size: 12px; }
.list span { overflow-wrap: anywhere; }

.status { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f0ff; color: #5b3fd9; }
.s-open, .s-released, .s-confirmed { background: #e6f7ec; color: #15803d; }
.s-funded { background: #fff3c4; color: #7a5b00; }
.s-pending { background: #f1f0ff; color: #5b3fd9; }
.s-held { background: #fff0e8; color: #c2410c; }
.s-rejected, .s-expired { background: #fde8e8; color: #b91c1c; }
.s-hidden { background: #eceff3; color: #4b5563; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 14px; border: 1px solid transparent;
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 700;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: linear-gradient(135deg, var(--brand), #ff9a3c); color: #fff; box-shadow: 0 8px 20px rgba(255, 107, 74, 0.3); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn:disabled { opacity: 0.6; cursor: default; }
.block { display: flex; width: 100%; margin: 8px 0; }
.icon { background: none; border: none; padding: 4px 8px; font-size: 18px; color: var(--muted); cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.field input, .field select, .field textarea, .filters select, .demo-form input {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 15px;
}
.field textarea { resize: vertical; }
.char-count { align-self: flex-end; font-size: 12px; color: var(--muted); margin-top: -4px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview { display: block; max-width: 100%; max-height: 180px; margin: -4px 0 12px; border-radius: 14px; border: 1px solid var(--line); }
.demo-form { margin-top: 10px; }

.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #fff0eb; color: #c2410c; font-size: 13px; font-weight: 600; }
.chip.alt { background: #f1f0ff; color: #5b3fd9; }

/* 许愿池：卡片堆叠 */
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.filters select { padding: 8px 6px; font-size: 13px; border-radius: 12px; }
.stack { position: relative; width: 100%; max-width: 360px; height: 480px; margin: 6px auto 0; }
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center; color: var(--muted);
  background: var(--card); border-radius: 26px; box-shadow: var(--shadow);
}
.bill-card {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; padding: 22px;
  background: var(--card); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden;
  touch-action: none; user-select: none; cursor: grab;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s;
}
.bill-card.dragging { transition: none; cursor: grabbing; }
.bill-card.fly-out { opacity: 0; transition: transform 0.32s ease-in, opacity 0.32s ease-in; }
.stamp {
  position: absolute; top: 28px; padding: 4px 12px; border: 4px solid currentColor; border-radius: 12px;
  font-size: 26px; font-weight: 900; opacity: 0; pointer-events: none;
}
.stamp-like { right: 18px; color: var(--ok); transform: rotate(12deg); }
.stamp-nope { left: 18px; color: var(--bad); transform: rotate(-12deg); }
.bill-head { display: flex; gap: 8px; }
.amount { font-size: 40px; font-weight: 800; letter-spacing: -0.5px; }
.reason { margin: 0; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.demo-title { margin: 0; font-size: 22px; line-height: 1.35; }
.demo-wish .amount small { font-size: 18px; }
.demo-wish .poster span { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.round:disabled { opacity: 0.4; cursor: default; }
.bill-img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.progress { height: 8px; border-radius: 99px; background: #f3ece8; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #ffb020); transition: width 0.4s; }
.meta { margin: 0; font-size: 14px; color: var(--muted); }
.meta b { color: var(--ink); }
.poster { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 12px; }
.round { width: 60px; height: 60px; border-radius: 50%; border: none; background: #fff; box-shadow: var(--shadow); font-size: 24px; cursor: pointer; }
.round.like-btn { color: var(--brand); }
.round.nope-btn { color: var(--bad); }
.round.report-btn { width: 46px; height: 46px; font-size: 18px; color: var(--muted); }
.hint { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* 弹层 */
dialog.sheet-dialog {
  width: min(92vw, 420px); max-height: 90vh; padding: 0; border: none; border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
dialog.sheet-dialog::backdrop { background: rgba(20, 12, 30, 0.45); }
.sheet { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.sheet-actions .btn { flex: 1; }
.quote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--brand); border-radius: 10px; background: #fff7f3; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.chip-btn { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; }
.fee { min-height: 1.2em; margin: 0; font-size: 14px; font-weight: 600; color: var(--brand); }
.success { align-items: center; text-align: center; }
.share-img { width: 100%; max-width: 280px; border-radius: 18px; box-shadow: var(--shadow); }

/* 榜单 */
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 10px; border-radius: 12px; background: #f6efeb; }
.segmented.small { flex-wrap: wrap; padding: 0; background: transparent; }
.segmented button { flex: 1; padding: 8px 6px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.segmented.small button { flex: none; margin: 0 6px 8px 0; padding: 5px 10px; font-size: 13px; background: #fff; border: 1px solid var(--line); }
.segmented button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.board { list-style: none; margin: 10px 0 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grow small { color: var(--muted); }
.rank { flex: none; width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; background: #f1ece9; color: var(--muted); font-size: 13px; font-weight: 800; }
.rank.r1 { background: #ffd54a; color: #6b4e00; }
.rank.r2 { background: #d9dde3; color: #3b4450; }
.rank.r3 { background: #f2b48c; color: #7a3410; }
.amt { font-size: 15px; }

/* 审核后台 */
.review-card { display: flex; flex-direction: column; gap: 8px; }
.review-card .thumb { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.review-meta { font-size: 13px; color: var(--muted); }
.review-actions { display: flex; gap: 8px; }
.review-actions .btn { flex: 1; }
.admin .container { max-width: 640px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 10; max-width: 88vw; padding: 10px 16px;
  border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px;
  opacity: 0; transform: translate(-50%, 16px); transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 链上支付相关 */
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.addr-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #f6efeb; }
.addr-box code { flex: 1; }
.addr-box .btn { flex: none; padding: 8px 12px; font-size: 13px; }
.manual summary { cursor: pointer; margin: 4px 0 8px; font-size: 14px; color: var(--brand-2); }
.s-verifying { background: #fff3c4; color: #7a5b00; }
.s-failed { background: #fde8e8; color: #b91c1c; }
.s-paid { background: #e6f7ec; color: #15803d; }
.review-meta { margin: 0; font-size: 13px; color: var(--muted); }
.promise { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); font-size: 13px; line-height: 1.55; }
.promise span { display: block; margin-top: 4px; color: var(--muted); }
.latest-update { margin: 0; font-size: 13px; line-height: 1.5; color: var(--brand-2); overflow-wrap: anywhere; }
.confirm-item { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.confirm-item:last-of-type { border-bottom: none; }
.confirm-item small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.confirm-actions { display: flex; gap: 8px; margin-top: 4px; }
.confirm-actions .btn { flex: 1; padding: 9px 10px; font-size: 14px; }
