:root {
  --bg: #12081f;
  --bg2: #1a0a2e;
  --card: #241438;
  --card2: #2d1a45;
  --line: rgba(255,255,255,.08);
  --text: #f7f0ff;
  --muted: #b9a8d4;
  --pink: #ff4d6d;
  --pink2: #ff7a93;
  --gold: #ffd166;
  --green: #52d6a5;
  --blue: #7aa2ff;
  --orange: #ff9f43;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, #3b1d6e55, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #ff4d6d22, transparent 50%),
    var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--pink2); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(24px + var(--safe-b)); }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px; position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px); background: #12081fcc;
}
.brand { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.logo { font-size: 28px; filter: drop-shadow(0 4px 10px #ff4d6d66); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .04em; }
.slogan { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); font-size: 18px;
}

.banner-virt {
  margin: 0 16px 12px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(90deg, #ffd16622, #ff4d6d18);
  border: 1px solid #ffd16644; color: var(--gold); font-size: 12px; line-height: 1.45;
}
#main { padding: 0 16px 24px; }

.card {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 10px 30px #0004;
}
.card h2 { margin: 0 0 8px; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 12px; margin: 0 0 12px; }

.hero {
  text-align: center; padding: 28px 12px 18px;
}
.hero .emoji { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.hero h2 { margin: 0 0 8px; font-size: 22px; }
.hero p { margin: 0 auto 18px; max-width: 320px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 14px;
  background: var(--card2); border: 1px solid var(--line); font-weight: 600;
  transition: transform .12s ease, opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--pink), #c9184a);
  border: none; color: #fff; box-shadow: 0 8px 24px #ff4d6d55;
  width: 100%;
}
.btn.gold {
  background: linear-gradient(135deg, #ffd166, #f4a261);
  border: none; color: #3b2200; width: 100%;
}
.btn.ghost { width: 100%; margin-top: 8px; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; }

label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: #160824; border: 1px solid var(--line); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #ff4d6d88; }
textarea { min-height: 80px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 12px; border-radius: 999px; background: #160824;
  border: 1px solid var(--line); font-size: 13px;
}
.chip.on { background: #ff4d6d33; border-color: var(--pink); color: #fff; }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.av {
  width: 44px; height: 44px; border-radius: 14px; font-size: 22px;
  display: grid; place-items: center; background: #160824; border: 2px solid transparent;
}
.av.on { border-color: var(--pink); background: #ff4d6d22; }

.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0;
}
.stat {
  background: #160824; border-radius: 14px; padding: 12px 8px; text-align: center;
  border: 1px solid var(--line);
}
.stat b { display: block; font-size: 18px; color: var(--gold); }
.stat small { color: var(--muted); font-size: 11px; }

.cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px;
}
.cal-day {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  font-size: 11px; background: #160824; border: 1px solid var(--line); color: var(--muted);
}
.cal-day.done { background: #52d6a533; border-color: #52d6a588; color: var(--green); }
.cal-day.failed { background: #ff4d6d33; border-color: #ff4d6d88; color: var(--pink2); }
.cal-day.today { box-shadow: 0 0 0 2px var(--gold); color: var(--gold); }
.cal-day.upcoming { opacity: .45; }

.member {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: none; }
.member .ava { font-size: 24px; width: 40px; text-align: center; }
.member .meta { flex: 1; min-width: 0; }
.member .meta b { display: block; font-size: 14px; }
.member .meta span { font-size: 12px; color: var(--muted); }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: #7aa2ff33; color: var(--blue);
}
.badge.owner { background: #ffd16633; color: var(--gold); }
.badge.grab { background: #ff4d6d33; color: var(--pink2); }

.task-list { list-style: none; padding: 0; margin: 0 0 12px; }
.task-list li {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.task-list input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--pink); }

.feed-item {
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.feed-item .who { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feed-item .who b { font-size: 13px; }
.feed-item .who time { margin-left: auto; font-size: 11px; color: var(--muted); }
.feed-item .txt { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.kind-tag {
  font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-left: 6px;
}
.kind-tag.cheer { background: #52d6a533; color: var(--green); }
.kind-tag.roast { background: #ff4d6d33; color: var(--pink2); }
.kind-tag.comment { background: #7aa2ff33; color: var(--blue); }
.like-btn { margin-top: 8px; font-size: 13px; color: var(--muted); }
.like-btn.liked { color: var(--pink); }

.packet-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: linear-gradient(135deg, #5c0a1a, #2a0a14);
  border-radius: 14px; margin-bottom: 8px; border: 1px solid #ff4d6d55;
}
.packet-row .ico { font-size: 28px; }
.packet-row .info { flex: 1; }
.packet-row .info b { display: block; }
.packet-row .info span { font-size: 12px; color: #ffb3c1; }

.invite-box {
  background: #160824; border-radius: 14px; padding: 14px; text-align: center;
  border: 1px dashed #ff4d6d66;
}
.invite-box code {
  display: block; font-size: 28px; letter-spacing: .2em; color: var(--gold);
  font-weight: 700; margin: 8px 0;
}
.share-url { font-size: 12px; color: var(--muted); word-break: break-all; }

.modal {
  position: fixed; inset: 0; z-index: 100; background: #000a;
  display: grid; place-items: end center; padding: 0;
}
.modal-card {
  width: 100%; max-width: 480px; max-height: 88vh; overflow: auto;
  background: var(--bg2); border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + var(--safe-b));
  border: 1px solid var(--line); position: relative;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .5; } }
.modal-x {
  position: absolute; right: 12px; top: 12px; width: 36px; height: 36px;
  border-radius: 50%; background: var(--card); font-size: 20px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%);
  z-index: 200; background: #2a163f; color: #fff; padding: 10px 16px;
  border-radius: 999px; font-size: 13px; border: 1px solid var(--line);
  box-shadow: 0 8px 30px #0008; max-width: 90vw; text-align: center;
}

/* 红包动画 */
.packet-overlay {
  position: fixed; inset: 0; z-index: 150; background: #000c;
  display: grid; place-items: center; padding: 20px;
}
.packet-stage { position: relative; width: min(300px, 90vw); }
.packet-close {
  position: absolute; right: -8px; top: -36px; width: 36px; height: 36px;
  color: #fff; font-size: 24px; opacity: .7;
}
.packet-env {
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px #ff4d6d66;
  animation: packetPop .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes packetPop { from { transform: scale(.6); opacity: 0; } }
.packet-top {
  height: 70px; background: linear-gradient(180deg, #ff6b81, #e63956);
  position: relative;
}
.packet-top::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -18px; height: 36px;
  background: #e63956; border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.packet-body {
  background: linear-gradient(180deg, #c9184a, #8b0000);
  padding: 40px 20px 28px; text-align: center; min-height: 220px;
}
.packet-circle {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  background: linear-gradient(145deg, #ffe066, #f4a261);
  color: #6b2c00; font-size: 28px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 6px 0 #c47a2a, 0 10px 20px #0005;
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); } }
.packet-from { color: #ffd6de; font-size: 14px; margin: 0; }
.packet-result { text-align: center; color: #fff; animation: packetPop .3s ease; }
.pr-label { color: #ffb3c1; margin: 0 0 4px; }
.pr-amount { margin: 0; font-size: 48px; color: var(--gold); line-height: 1.1; }
.pr-amount small { font-size: 16px; margin-left: 4px; }
.pr-note { color: #ffb3c1; font-size: 12px; margin: 8px 0 16px; }
.pr-list { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; max-height: 160px; overflow: auto; }
.pr-list li {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid #ffffff18; font-size: 13px;
}

.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab-btn {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  background: #160824; border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.tab-btn.on { background: #ff4d6d33; border-color: var(--pink); color: #fff; }

.list-flag {
  display: flex; gap: 12px; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.list-flag .ico { font-size: 28px; }
.list-flag .meta { flex: 1; min-width: 0; }
.list-flag .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-flag .meta span { font-size: 12px; color: var(--muted); }

@media (min-width: 520px) {
  .modal { place-items: center; }
  .modal-card { border-radius: 22px; max-height: 80vh; }
}

[hidden] { display: none !important; }
