:root {
  --bg: #fdf6f2;
  --card: #ffffff;
  --ink: #3a2e2b;
  --muted: #a08b84;
  --line: #f4e6de;
  --rose: #e0576b;
  --rose-deep: #c93f55;
  --rose-soft: #fdecee;
  --gold: #d99127;
  --green: #3f9c74;
  --blue: #4a7fd6;
  --shadow: 0 6px 22px rgba(176, 118, 102, 0.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 登录 ---------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #fff2ec 0%, #fdf6f2 45%, #ffe9e6 100%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #e0576b, #f19a86);
  color: #fff;
  font-size: 26px;
}

.login-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: 1px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.seg { display: flex; gap: 10px; margin-bottom: 16px; }

.seg button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.seg button.on {
  border-color: var(--rose);
  background: var(--rose-soft);
  color: var(--rose-deep);
  font-weight: 600;
}

/* ---------- 布局 ---------- */

.app { max-width: 640px; margin: 0 auto; padding-bottom: 96px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #e0576b 0%, #ef8b7f 100%);
  color: #fff;
  padding: 16px 18px 18px;
  border-radius: 0 0 22px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 20px rgba(224, 87, 107, .18);
}

.topbar .brand { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.topbar .brand small { display: block; font-weight: 400; font-size: 11px; opacity: .8; letter-spacing: 0; }

.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .user button {
  border: 1px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.main { padding: 16px 16px 0; }

.stack > * + * { margin-top: 14px; }

/* ---------- 通用 ---------- */

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(135deg, #fff 0%, #fff8f5 100%);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid #fbeade;
}

.hero-label { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.hero-value { font-size: 38px; font-weight: 700; color: var(--rose); line-height: 1.15; margin: 2px 0 2px; }
.hero-value span { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.hero-sub { font-size: 12px; color: var(--muted); }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--muted);
  padding: 4px 4px 0;
  letter-spacing: .5px;
}

.section-title b { color: var(--ink); font-size: 14px; font-weight: 600; }

.empty {
  border: 1.5px dashed #f0ded4;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: #bfa9a0;
  font-size: 13px;
  background: rgba(255,255,255,.55);
}

/* ---------- 任务卡 ---------- */

.task-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f6efe9;
  color: var(--muted);
  white-space: nowrap;
}
.pill.warn { background: #fff3dd; color: var(--gold); }
.pill.info { background: #e9f0fd; color: var(--blue); }
.pill.accent { background: var(--rose-soft); color: var(--rose-deep); }
.pill.ok { background: #e6f5ee; color: var(--green); }
.pill.muted { background: #f3eeeb; color: #a9988f; }

.task-points { font-weight: 700; color: var(--rose); font-size: 17px; white-space: nowrap; }
.task-points small { font-size: 11px; font-weight: 400; color: var(--muted); }

.task-title { font-size: 16px; margin: 0 0 4px; font-weight: 600; line-height: 1.4; }
.task-desc { margin: 0; color: #6b5a54; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.task-meta { margin-top: 8px; font-size: 11px; color: #bda69c; }

.offer-box {
  margin-top: 12px;
  background: #fffaf0;
  border: 1px solid #f7e4c4;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #8a6b2f;
}
.offer-box b { color: var(--gold); }

.task-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.task-actions .btn { flex: 1; min-width: 96px; }

.earned { color: var(--green); font-weight: 600; }

/* ---------- 按钮 ---------- */

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #f4eeea;
  color: #6b5a54;
  transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, #e0576b, #ec7b78); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(224,87,107,.25); }
.btn.gold { background: linear-gradient(135deg, #e8a33d, #f0b961); color: #fff; font-weight: 600; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: #8a746c; }
.btn.green { background: linear-gradient(135deg, #3f9c74, #55b389); color: #fff; font-weight: 600; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }

/* ---------- 表单 ---------- */

.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.input, textarea.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fffdfc;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: #e8b3aa; background: #fff; }
textarea.input { resize: vertical; min-height: 78px; line-height: 1.6; }

.hint { font-size: 12px; color: var(--muted); margin: 0; }

/* ---------- 兑换 ---------- */

.redeem-row { display: flex; gap: 10px; }
.redeem-row .field { flex: 1; margin-top: 12px; }
.redeem-row .field.narrow { flex: 0 0 104px; }

/* ---------- 记录 ---------- */

.ledger { display: flex; flex-direction: column; }
.ledger-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.ledger-item:last-child { border-bottom: 0; }
.ledger-item .note { font-size: 14px; }
.ledger-item .time { font-size: 11px; color: #bda69c; margin-top: 2px; }
.ledger-item .amount { font-weight: 700; white-space: nowrap; }
.ledger-item .amount.plus { color: var(--green); }
.ledger-item .amount.minus { color: var(--rose-deep); }

/* ---------- 底栏 ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  border-radius: 18px 18px 0 0;
}

.tabbar button {
  flex: 1;
  border: 0; background: none;
  padding: 6px 0;
  color: #ab958c;
  font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  position: relative;
  cursor: pointer;
}
.tabbar button .ico { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--rose); font-weight: 600; }
.tabbar .dot {
  position: absolute; top: 2px; right: 50%;
  transform: translateX(16px);
  min-width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  padding: 0 4px;
  font-weight: 600;
}

/* ---------- 弹窗 ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(58, 46, 43, .38);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(18px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dialog-head h3 { margin: 0; font-size: 17px; }
.dialog-head .x { border: 0; background: #f6efeb; color: #a08b84; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }
.dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.dialog-actions .btn { flex: 1; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(58,46,43,.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 90;
  opacity: 0;
  transition: all .22s ease;
  pointer-events: none;
  max-width: 82vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(201,63,85,.95); }

/* ---------------- 头像 ---------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(224, 87, 107, .12);
  flex-shrink: 0;
}
.avatar-xs { width: 26px; height: 26px; font-size: 14px; }
.avatar-sm { width: 32px; height: 32px; font-size: 16px; }
.avatar-lg { width: 84px; height: 84px; font-size: 40px; }
.avatar-fallback { line-height: 1; }
.avatar-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.avatar-side { flex: 1; min-width: 0; }
.avatar-side .btn { width: 100%; }

@media (min-width: 520px) {
  .overlay { align-items: center; padding: 20px; }
  .dialog { border-radius: 22px; }
}
