:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --primary: #534AB7;
  --primary-soft: #EEEDFE;
  --text: #2C2C2A;
  --muted: #5F5E5A;
  --line: rgba(0,0,0,0.08);
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  font-size: 15px;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }

.header {
  background: linear-gradient(135deg, #534AB7 0%, #7F77DD 100%);
  color: #fff; padding: 30px 16px 24px; text-align: center;
}
.header .moon { font-size: 30px; line-height: 1; margin-bottom: 8px; opacity: .95; }
.header .logo { font-size: 24px; font-weight: 700; letter-spacing: 2px; }
.header .sub { font-size: 13px; opacity: .9; margin-top: 8px; }

.card {
  background: var(--card); border-radius: 18px; padding: 22px 18px;
  margin-top: 16px; box-shadow: 0 6px 22px rgba(40,40,80,.07);
}
.card h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }

textarea#dreamInput {
  width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 15px; font-family: inherit; resize: vertical; background: #fbfbfe;
}
textarea#dreamInput:focus { outline: none; border-color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  border: 1px solid var(--line); background: #fafaff; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.chip:active { background: var(--primary-soft); }

.modes { display: flex; gap: 10px; margin-top: 14px; }
.modes label {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px;
}
.modes input { accent-color: var(--primary); }
.modes label.active { border-color: var(--primary); background: var(--primary-soft); }

.ai-panel { display: none; margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.ai-panel .row { margin-bottom: 10px; }
.ai-panel label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.ai-panel input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  font-size: 13px; font-family: inherit;
}

.btn {
  width: 100%; background: var(--primary); color: #fff; border: none; border-radius: 12px;
  padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 14px;
}
.btn:disabled { opacity: .6; }
.btn-ghost {
  background: #f3f2fb; color: var(--primary); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; font-size: 13px; cursor: pointer;
}

.report h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 600; }
.r-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mood-badge { color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.mode-badge { font-size: 12px; color: var(--muted); background: #f0f0f6; border-radius: 999px; padding: 4px 10px; }
.theme { margin-top: 10px; font-size: 15px; color: var(--text); }

.sym { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.sym-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sym-name { font-size: 15px; font-weight: 600; color: var(--primary); }
.sym-match { font-size: 11px; color: var(--muted); }
.sym-views { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sym-views .v { font-size: 12px; background: #fafaff; border-radius: 8px; padding: 8px; line-height: 1.5; }
.sym-views .v b { display: block; font-size: 12px; margin-bottom: 2px; }
.v-freud b { color: #993C1D; } .v-jung b { color: #534AB7; }
.v-zhou b { color: #854F0B; } .v-cog b { color: #0F6E56; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

.ai-block { background: linear-gradient(135deg, #f3f1ff, #eef4ff); border-radius: 12px; padding: 14px; margin-top: 6px; }
.ai-block .ai-tag { font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.ai-block p { margin: 0; font-size: 14px; }

.advice { margin: 0; padding-left: 20px; }
.advice li { font-size: 14px; margin-bottom: 6px; }
.safe { margin-top: 14px; font-size: 12px; color: var(--muted); background: #f6f6f9; border-radius: 8px; padding: 10px; }
.r-actions { display: flex; gap: 10px; margin-top: 14px; }
.poster-wrap { margin-top: 12px; }
.poster-tip { font-size: 12px; color: var(--muted); text-align: center; margin: 6px 0; }
.poster-img { width: 100%; border-radius: 12px; display: block; }
.poster-dl { display: block; width: fit-content; margin: 12px auto 0; text-decoration: none; text-align: center; }
.poster-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.poster-bar-tip { font-size: 12px; color: var(--muted); }
.poster-collapse { flex: none; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.poster-collapse:active { background: var(--line); }

.hist-empty { color: var(--muted); font-size: 13px; }
.hist-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.hist-item:active { background: #f7f7fc; }
.hist-text { font-size: 14px; }
.hist-meta { display: flex; gap: 10px; margin-top: 4px; }
.hist-mood { font-size: 11px; color: #fff; background: var(--primary); border-radius: 999px; padding: 2px 8px; }
.hist-sym { font-size: 11px; color: var(--muted); }

.link-btn { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; margin-top: 6px; }
.principle { font-size: 13px; color: var(--muted); }
.principle b { color: var(--text); }

#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,30,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 24px; }

/* 会员徽标（主页账户条） */
.member-badge { font-size: 13px; margin-left: 2px; }
.member-badge .mbadge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.member-badge .mbadge.on { background: linear-gradient(135deg,#534AB7,#7F77DD); color:#fff; }
.member-badge .mbadge.off { color: #fff; background: #07C160; text-decoration: none; }
.member-badge .mbadge.off:active { opacity: .8; }

/* 付费墙弹层 */
.pay-mask {
  position: fixed; inset: 0; background: rgba(10,12,30,.62);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 60;
}
.pay-box {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 20px 18px 22px;
  position: relative; max-height: 90vh; overflow: auto; animation: payIn .2s ease;
}
@keyframes payIn { from { transform: translateY(12px); opacity: .6; } to { transform: none; opacity: 1; } }
.pay-close { position: absolute; right: 12px; top: 10px; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.pay-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.pay-loading, .pay-err, .pay-ok { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 0; }
.pay-err { color: #A32D2D; }
.pay-ok { color: #0F6E56; }
.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; transition: .15s; }
.plan:active { border-color: var(--primary); }
.plan-top { display: flex; align-items: baseline; justify-content: space-between; }
.plan-name { font-size: 16px; font-weight: 700; color: var(--text); }
.plan-price { color: #E0452B; font-size: 14px; }
.plan-price b { font-size: 22px; }
.plan-desc { font-size: 12px; color: var(--muted); margin: 6px 0 12px; min-height: 16px; }
.plan-buy { margin-top: 0; background: linear-gradient(135deg,#07C160,#16C95F); }
.plan-buy:active { opacity: .9; }
.pay-amt { text-align: center; font-size: 26px; font-weight: 800; color: #E0452B; margin: 4px 0 10px; }
.pay-qr { width: 220px; height: 220px; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fafafa; }
.pay-qr img { width: 100%; height: 100%; object-fit: contain; }
.pay-wx { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 14px; }
.pay-expire { text-align: center; font-size: 12px; color: #A3632D; background: #FFF7E8; border: 1px solid #F3DCA0; border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; }
.pay-actions { display: flex; flex-direction: column; gap: 10px; }
.pay-actions .btn { background: linear-gradient(135deg,#07C160,#16C95F); }
.pay-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.5; }

/* 主页顶部账户条 */
.homebar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 12px 16px;
  margin-top: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.homebar span { font-size: 14px; color: var(--text); }
.homebar #btnLogout { width: auto; padding: 7px 14px; margin-top: 0; }

/* 用户状态卡（个性化） */
.opt { font-size: 12px; color: var(--muted); font-weight: 400; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pf-row { display: flex; flex-direction: column; gap: 4px; }
.pf-row.full { grid-column: 1 / -1; margin-bottom: 10px; }
.pf-row label { font-size: 12px; color: var(--muted); }
.pf-row select, .pf-row input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  font-size: 13px; font-family: inherit; background: #fbfbfe;
}
.pf-note { font-size: 12px; color: var(--primary); background: var(--primary-soft); border-radius: 8px; padding: 8px 10px; margin-top: 8px; display: none; }
.pf-note.show { display: block; }
.hist-pf { display: block; font-size: 11px; color: var(--primary); margin-top: 4px; }

/* 账户卡片 */
.acct-head { margin-bottom: 16px; }
.acct-card-title { font-size: 19px; font-weight: 700; color: var(--text); margin: 0 0 4px; letter-spacing: .5px; }
.acct-card-sub { font-size: 12px; color: var(--muted); margin: 0; }
.acct-in { display: flex; flex-direction: column; gap: 10px; }
.acct-user { font-size: 15px; color: var(--text); }
.acct-user b { color: var(--primary); }
.acct-hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.acct-tabs { display: flex; gap: 6px; background: #f3f2fb; padding: 5px; border-radius: 12px; margin-bottom: 18px; }
.acct-tab { flex: 1; background: transparent; color: var(--muted); border: none;
  border-radius: 9px; padding: 10px 0; font-size: 14px; font-weight: 500; cursor: pointer; transition: .2s; }
.acct-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.10); font-weight: 600; }
.acct-form { margin-top: 2px; }
.acct-form .row { margin-bottom: 14px; }
.acct-form label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.acct-form input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font-size: 15px; font-family: inherit; background: #fbfbfe; transition: .2s; }
.acct-form input::placeholder { color: #b7b6c2; }
.acct-form input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.acct-form input[readonly] { background: #f4f4fb; color: var(--muted); }
.acct-group { font-size: 12px; font-weight: 600; color: var(--primary); letter-spacing: .5px; margin: 2px 0 12px; }
.acct-form .btn { width: 100%; margin-top: 6px; }
.sync-status { font-size: 12px; color: var(--muted); margin-top: 12px; }
.sync-status.ok { color: #0F6E56; }
.sync-status.err { color: #A32D2D; }
