/* =========================================================
   心情美随叫随到【简易独立版】- 全站样式
   主题：柔和治愈（暖白 + 薰衣草紫 + 蜜桃粉），圆角卡片
   ========================================================= */
:root {
  --bg: #f6f4fb;
  --card: #ffffff;
  --ink: #2e2a3a;
  --sub: #8a85a0;
  --brand: #7c6cf0;
  --brand-2: #b58bf0;
  --accent: #ff8fae;
  --ok: #3ecf8e;
  --warn: #ffb648;
  --danger: #ff6b81;
  --border: #ece9f4;
  --shadow: 0 6px 24px rgba(124, 108, 240, .10);
  --radius: 16px;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  background: #fff;
  outline: none;
  transition: border .2s, box-shadow .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124,108,240,.12);
}
textarea { resize: vertical; min-height: 84px; }
img { max-width: 100%; display: block; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  transition: transform .15s, box-shadow .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 14px rgba(124,108,240,.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(124,108,240,.45); }
.btn-ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-soft { background: #efecfd; color: var(--brand); }
.btn-danger { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 顶栏导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 58px;
  display: flex; align-items: center; gap: 18px;
}
.topbar .logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 17px; color: var(--ink);
}
.topbar .logo .dot {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar nav a {
  padding: 7px 14px; border-radius: 999px; color: var(--sub);
  font-size: 14px; font-weight: 600; transition: all .2s; white-space: nowrap;
}
.topbar nav a.active, .topbar nav a:hover { background: #efecfd; color: var(--brand); }
.topbar .userbox { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}

/* ---------- 页面骨架 ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 26px 20px 80px; }
.page-narrow { max-width: 560px; }
h1.page-title { font-size: 24px; margin-bottom: 4px; }
p.page-sub { color: var(--sub); margin-bottom: 22px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: #efecfd; color: var(--brand); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--sub); margin-top: 4px; }
.err-text { color: var(--danger); font-size: 13px; margin-top: 4px; min-height: 18px; }
.ok-text { color: var(--ok); font-size: 13px; margin-top: 4px; }

/* ---------- 徽章 / 状态 ---------- */
.badge {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-pending { background: #fff3e0; color: #e68a00; }
.badge-paid, .badge-accepted, .badge-settled, .badge-withdrawn { background: #e8f8f0; color: #1da06a; }
.badge-serving, .badge-on { background: #e9e5ff; color: var(--brand); }
.badge-completed, .badge-active { background: #e2f2ff; color: #2b7fd4; }
.badge-cancelled, .badge-off { background: #fdeef0; color: var(--danger); }

/* ---------- 套餐卡片 ---------- */
.pkg {
  position: relative; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 20px; background: #fff; transition: all .25s; cursor: pointer;
}
.pkg:hover, .pkg.sel { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-3px); }
.pkg.sel::after {
  content: "已选"; position: absolute; top: 12px; right: 12px;
  background: var(--brand); color: #fff; font-size: 11px; padding: 2px 10px; border-radius: 999px;
}
.pkg .pkg-name { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.pkg .pkg-desc { font-size: 13px; color: var(--sub); min-height: 40px; margin-bottom: 10px; }
.pkg .pkg-price { font-size: 22px; font-weight: 800; color: var(--brand); }
.pkg .pkg-price small { font-size: 12px; color: var(--sub); font-weight: 500; }
.pkg .pkg-old { font-size: 13px; color: #b9b4cc; text-decoration: line-through; margin-left: 6px; }

/* ---------- 列表 / 表 ---------- */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; }
.list-item .li-sub { font-size: 12.5px; color: var(--sub); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.tbl th { color: var(--sub); font-weight: 600; background: #faf9fd; white-space: nowrap; }
.tbl tr:hover td { background: #fbfaff; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(46,42,58,.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 20px; padding: 26px; width: 100%; max-width: 460px;
  max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal-close { float: right; color: var(--sub); font-size: 20px; line-height: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #33304a; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: pop .25s ease;
  max-width: 88vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- 数字人形象 ---------- */
.dh-wrap { display: flex; flex-direction: column; align-items: center; }
.dh-stage {
  position: relative; width: 220px; height: 220px;
  display: flex; align-items: center; justify-content: center;
}
.dh-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,108,240,.22), transparent 70%);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.08); opacity: 1; } }
.dh-face {
  width: 150px; height: 150px; border-radius: 50%;
  background: linear-gradient(160deg, #d6cdfb, #f7d6e6);
  position: relative; box-shadow: inset 0 -12px 24px rgba(124,108,240,.25), 0 10px 30px rgba(124,108,240,.3);
  transition: transform .3s;
}
.dh-face.talking { transform: scale(1.03); }
.dh-eye {
  position: absolute; top: 52px; width: 16px; height: 16px; border-radius: 50%;
  background: #3a2f55;
}
.dh-eye.l { left: 42px; } .dh-eye.r { right: 42px; }
.dh-eye.blink { animation: blink 4s infinite; }
@keyframes blink { 0%,94%,100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.dh-mouth {
  position: absolute; top: 94px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 8px; border-radius: 50%;
  background: #b3718f;
}
.dh-mouth.talk { animation: talkmov .35s infinite alternate; }
@keyframes talkmov { from { height: 5px; } to { height: 13px; } }
.dh-name { margin-top: 10px; font-weight: 700; color: var(--brand); }
.dh-status { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.dh-status.on { color: var(--ok); }

/* ---------- 对话气泡 ---------- */
.chat-box {
  height: 320px; overflow-y: auto; border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px; background: #fdfcff;
  display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; word-break: break-word; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; border: 1.5px solid var(--border); border-bottom-left-radius: 4px; }
.msg.ai .who { font-size: 11px; color: var(--brand); font-weight: 700; display: block; margin-bottom: 3px; }
.msg.sys { align-self: center; background: #f3f0fc; color: var(--sub); font-size: 12.5px; border-radius: 999px; padding: 6px 14px; }

/* ---------- 录音按钮 ---------- */
.mic-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; font-size: 22px; box-shadow: 0 6px 18px rgba(124,108,240,.4);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .2s; position: relative; flex: none;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.listening { background: var(--danger); animation: micpulse 1.2s infinite; }
.mic-btn:disabled { opacity: .45; cursor: not-allowed; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,107,129,.5); } 50% { box-shadow: 0 0 0 14px rgba(255,107,129,0); } }

/* ---------- 输入条 ---------- */
.input-bar { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.input-bar input { flex: 1; }
.quick-words { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  padding: 5px 14px; border-radius: 999px; background: #f0edfb; color: var(--brand);
  font-size: 13px; cursor: pointer; transition: all .2s; border: 1px solid transparent;
}
.chip:hover { background: #e3defa; }

/* ---------- 微妙动效 ---------- */
.fade-in { animation: fadein .4s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.muted { color: var(--sub); font-size: 13px; }
.empty {
  text-align: center; color: var(--sub); padding: 30px 10px; font-size: 14px;
}
.money { font-weight: 700; color: var(--brand); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* =========================================================
   辅导模块：上传 / 题目卡 / 语音条
   ========================================================= */
/* AI 老师形象（暖橙系，区别于倾听薰衣草紫） */
.dh-face.tutor {
  background: linear-gradient(160deg, #ffe3c4, #ffd2e0);
  box-shadow: inset 0 -12px 24px rgba(255,150,80,.25), 0 10px 30px rgba(255,150,80,.28);
}
.dh-name.tutor { color: #e8833a; }
.dh-status.tutor.on { color: var(--ok); }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--brand);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #faf9ff;
}
.upload-zone:hover, .upload-zone.drag { background: #f0edfb; border-color: var(--brand-2); }
.upload-zone .up-ic { font-size: 34px; }
.upload-zone.done { border-style: solid; border-color: var(--ok); background: #f2fcf7; }
.upload-zone img.preview {
  max-height: 220px; margin: 0 auto; border-radius: 12px; box-shadow: var(--shadow);
}
.upload-zone .up-tip { color: var(--sub); font-size: 13px; margin-top: 6px; }

/* 题目卡 */
.q-item {
  border: 1.5px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 10px; background: #fff;
}
.q-item .q-title { font-weight: 700; font-size: 14.5px; margin-bottom: 6px; }
.q-item .q-options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.q-item .q-options .opt {
  padding: 4px 12px; border-radius: 999px; background: #f3f1fb;
  font-size: 13px; color: var(--sub);
}
.q-item .q-answer { display: flex; gap: 8px; align-items: center; }
.q-item .q-answer input { flex: 1; padding: 8px 12px; font-size: 14px; }
.q-item.correct { border-color: var(--ok); background: #f4fdf8; }
.q-item.wrong { border-color: var(--danger); background: #fef6f7; }
.q-item .q-verdict { font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.q-item.correct .q-verdict { color: #17a05f; }
.q-item.wrong .q-verdict { color: var(--danger); }
.q-item .q-verdict b { font-size: 14px; }

/* 语音播报条 */
.voice-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #f7f5fe; border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 14px; font-size: 13px; color: var(--sub);
}
.voice-bar .line { flex: 1; min-width: 200px; color: var(--ink); font-size: 13.5px; }
/* ============ 服务商城（淘宝风格） ============ */
.mall-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 26px 28px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, #7c6cf0, #ff8fae 60%, #ffb26b);
  box-shadow: 0 10px 26px rgba(124,108,240,.28); margin-bottom: 18px;
}
.mall-banner-title { font-size: 24px; font-weight: 800; }
.mall-banner-sub { font-size: 13px; opacity: .92; margin-top: 6px; }
.mall-banner-tag {
  font-size: 12px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.4); white-space: nowrap;
}
.mall-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mall-tab {
  padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .18s;
}
.mall-tab:hover { border-color: var(--brand); color: var(--brand); }
.mall-tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(124,108,240,.3); }
.mall-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 980px) { .mall-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .mall-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.mall-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  transition: all .2s; display: flex; flex-direction: column;
}
.mall-card:hover { box-shadow: 0 10px 24px rgba(80,60,180,.14); transform: translateY(-4px); }
.mall-img { width: 100%; aspect-ratio: 4/3; background: #f6f4fc; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mall-img img { width: 100%; height: 100%; object-fit: cover; }
.mall-img-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.mall-info { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.mall-name { font-size: 14.5px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.mall-desc { font-size: 12px; color: var(--sub); margin: 6px 0 10px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mall-price-row { display: flex; align-items: center; gap: 8px; }
.mall-price { font-size: 20px; font-weight: 800; color: var(--danger); }
.mall-old { font-size: 12.5px; color: #b9b4cc; text-decoration: line-through; }
.mall-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #efecfd; color: var(--brand); font-weight: 600; }
.mall-detail { display: flex; flex-direction: column; gap: 14px; }
.mall-detail-head { width: 100%; height: 260px; border-radius: 14px; overflow: hidden; background: #f6f4fc; display: flex; align-items: center; justify-content: center; }
.mall-detail-head img { width: 100%; height: 100%; object-fit: cover; }
.mall-detail-head .mall-img-empty { height: 260px; }
.mall-detail-info { display: flex; flex-direction: column; gap: 8px; }
.mall-detail-body { border-top: 1px dashed var(--border); margin-top: 4px; }
.modal-lg { width: min(680px, 94vw); max-height: 86vh; overflow-y: auto; }

/* ================= 个人中心（mine.html） ================= */
.me-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.me-avatar { position: relative; width: 74px; height: 74px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 32px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; flex-shrink: 0; box-shadow: var(--shadow); }
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-avatar-edit { position: absolute; right: 0; bottom: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.me-info { flex: 1; min-width: 180px; }
.me-name-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.me-nickname { font-size: 20px; font-weight: 800; }
.me-right { text-align: center; }
.inv-code { font-size: 20px; font-weight: 800; letter-spacing: 2px; color: var(--brand); cursor: pointer; user-select: all; }
.me-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 4px; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.wallet-row:last-child { border-bottom: none; }
.wallet-right { display: flex; align-items: center; gap: 12px; }
.wallet-avail { font-weight: 800; color: var(--ok); font-size: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: #faf9ff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat-num { font-size: 18px; font-weight: 800; color: var(--brand); }
.stat-label { font-size: 12px; color: var(--sub); margin-top: 2px; }
.dist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.dist-card { border: 1px solid var(--border); border-radius: 16px; padding: 18px; background: #fdfcff; }
.dist-note { border-style: dashed; background: #fff9f4; }
.dist-title { font-weight: 800; font-size: 16px; }
.dist-price { font-size: 18px; font-weight: 800; color: var(--brand); margin: 6px 0; }
.dist-price .muted { font-weight: 400; }
.dist-desc { font-size: 13.5px; color: var(--sub); margin-bottom: 12px; }
.invite-hero { text-align: center; padding: 6px 0; }
.invite-code-big { font-size: 26px; font-weight: 800; letter-spacing: 3px; color: var(--brand); user-select: all; }
.qr-wrap { margin: 14px auto 4px; display: flex; justify-content: center; }
.qr-wrap img { border-radius: 12px; display: block; }
.invite-link { margin-top: 10px; font-size: 12.5px; color: var(--sub); word-break: break-all; background: #f7f5fd; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 700; font-size: 16px; }
.fade-in { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
