:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1d2b26;
  --muted: #6b7a72;
  --brand: #0f5e54;
  --brand-soft: #e4f1ee;
  --gold: #b8860b;
  --user: #0f5e54;
  --user-bg: #e4f1ee;
  --bot-bg: #ffffff;
  --border: #e2e6e1;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--brand); color: #fff;
  box-shadow: var(--shadow); flex: 0 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-weight: 800; font-size: 17px; letter-spacing: 1px; }
.sub { font-size: 12px; opacity: 0.85; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 8px; font-size: 18px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.3); }
.acct-chip {
  background: rgba(255,255,255,0.18); border: none; color: #fff;
  font-size: 12px; padding: 6px 10px; border-radius: 999px; cursor: pointer; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-chip.hidden { display: none; }

/* 账户条 */
.acct-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 16px; background: var(--brand-soft); color: var(--brand);
  font-size: 12px; border-bottom: 1px solid #cfe6e1; flex: 0 0 auto;
}
.acct-bar.hidden { display: none; }
.acct-bar .plan-tag {
  font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 11px;
}
.acct-bar .plan-free { background: #fff; color: var(--gold); border: 1px solid #e3c98a; }
.acct-bar .plan-pro { background: var(--brand); color: #fff; }
.acct-bar .logout { background: none; border: none; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: 12px; }

/* 状态条 */
.banner {
  background: #fff4e0; color: #8a5a00; font-size: 13px;
  padding: 8px 16px; border-bottom: 1px solid #f0d9a8;
}
.banner.hidden { display: none; }

/* 聊天区 */
.chat {
  flex: 1 1 auto; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.6; font-size: 15px; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow); }
.msg.user { align-self: flex-end; background: var(--user-bg); color: var(--ink); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--bot-bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot strong { color: var(--brand); }
.msg.bot h1, .msg.bot h2, .msg.bot h3 { margin: 6px 0 4px; font-size: 15px; color: var(--brand); }
.msg.error { align-self: flex-start; background: #fdecec; color: #b00020; border: 1px solid #f5c2c2; }

.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--brand); }
@keyframes blink { 0%,50%{opacity:1} 50.01%,100%{opacity:0} }

/* 六合一 */
.quickbar { flex: 0 0 auto; padding: 8px 12px 4px; background: var(--panel); border-top: 1px solid var(--border); }
.quick-title { font-size: 11px; color: var(--muted); margin: 2px 4px 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.chip {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 13px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid #cfe6e1; cursor: pointer; white-space: nowrap;
}
.chip:active { transform: scale(0.96); }

/* 输入区 */
.composer {
  flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px;
  background: var(--panel); border-top: 1px solid var(--border); align-items: flex-end;
}
#input {
  flex: 1 1 auto; resize: none; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; line-height: 1.5; max-height: 120px; outline: none;
}
#input:focus { border-color: var(--brand); }
.send-btn {
  flex: 0 0 auto; background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.send-btn:disabled { opacity: 0.5; }
.send-btn:active { transform: scale(0.96); }

.mic-btn {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: #e4f1ee; color: #0f5e54; font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
  transition: background .15s, color .15s;
}
.mic-btn:hover { background: #d4ebe6; }
.mic-btn.recording { background: #fde8e8; color: #dc2626; animation: micPulse 1s ease-in-out infinite; }
.mic-btn.recognizing { opacity: 0.6; cursor: wait; }
@keyframes micPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-card h3 { margin: 0 0 6px; color: var(--brand); }
.modal-card .hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.modal-card label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 12px; }
.modal-card input { width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.preset { flex: 1 1 auto; padding: 7px 4px; font-size: 12px; border: 1px solid var(--border); background: #f3f5f2; border-radius: 8px; cursor: pointer; color: var(--ink); }
.preset:active { background: var(--brand-soft); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: #fff; }
.modal-actions .primary { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 登录卡片 */
.login-card { max-width: 360px; }
.login-card .block { width: 100%; margin-top: 4px; }
.login-err { color: #b00020; font-size: 13px; background: #fdecec; border: 1px solid #f5c2c2; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.login-err.hidden { display: none; }
.login-card .wx { color: var(--brand); font-weight: 700; }
.demo { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; background: #f3f5f2; padding: 8px 10px; border-radius: 8px; }
.primary.block { background: var(--brand); color: #fff; border: none; padding: 11px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }

/* 登录：通道切换 */
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-btn { flex: 1; padding: 9px; border: 1px solid var(--border); background: #f3f5f2; border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--ink); }
.seg-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 套餐自选 */
.plan-pick { background: #f3f5f2; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.plan-pick-title { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.plan-opt { display: flex !important; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px !important; color: var(--ink); }
.plan-opt input { width: auto !important; margin: 0 !important; }

/* 验证码行 */
.code-row { display: flex; gap: 8px; margin-bottom: 8px; }
.code-row input { flex: 1; }
.ghost { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 9px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.dev-tip { font-size: 12px; color: var(--gold); background: #fff8e8; border: 1px solid #f0d9a8; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.5; }
.dev-tip.hidden { display: none; }

/* 升级按钮 */
.upgrade-btn { background: var(--gold); color: #fff; border: none; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.upgrade-btn:active { opacity: 0.85; }

/* ====== 登录弹窗 v2（双 Tab）====== */
.login-header { text-align: center; margin: -4px 0 14px; }
.login-header h3 { margin: 0; font-size: 17px; color: var(--brand); }
.login-sub { font-size: 11px; color: var(--muted); margin: 4px 0 0; letter-spacing: 0.5px; }

.login-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #f3f5f2; padding: 4px; border-radius: 11px; }
.login-tab { flex: 1; padding: 9px 4px; border: none; background: transparent; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 600; transition: all 0.15s; }
.login-tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.login-tab:active { transform: scale(0.98); }

.login-pane { display: none; }
.login-pane.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* 申请步骤列表 */
.apply-steps { margin: 0 0 14px; padding: 0; list-style: none; }
.apply-steps li { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.apply-steps li:last-child { border-bottom: none; padding-bottom: 0; }
.apply-steps li b { display: block; color: var(--brand); font-size: 13px; margin-bottom: 4px; }
.apply-steps li small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* 微信号复制行 */
.wx-copy-row { display: flex; gap: 6px; align-items: center; margin: 6px 0 0; }
.wx-copy-row code { flex: 1; background: #f3f5f2; padding: 8px 11px; border-radius: 8px; font-size: 14px; color: var(--brand); font-weight: 700; letter-spacing: 0.5px; font-family: -apple-system, "SF Mono", monospace; }
.wx-copy-row.login-wx { background: #f7faf9; border: 1px dashed #b9d3cd; border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.ghost-mini { padding: 7px 14px; background: #fff; border: 1px solid var(--brand); color: var(--brand); border-radius: 8px; font-size: 12px; cursor: pointer; font-weight: 600; flex: 0 0 auto; }
.ghost-mini:active { background: var(--brand-soft); }

/* 分隔线 */
.divider { text-align: center; position: relative; margin: 14px 0; color: var(--muted); font-size: 11px; }
.divider:before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.divider span { background: #fff; padding: 0 12px; position: relative; }

/* 微信扫码登录·即将上线 */
.qr-soon { display: flex; gap: 12px; align-items: center; padding: 14px; background: #fafaf7; border: 1px dashed var(--border); border-radius: 11px; }
.qr-soon .qr-icon { font-size: 26px; flex: 0 0 auto; opacity: 0.7; }
.qr-soon b { display: block; font-size: 13px; color: var(--ink); margin-bottom: 2px; }
.qr-soon small { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* 记住手机号 */
.remember-row { display: flex !important; align-items: center; gap: 6px; font-size: 12px !important; color: var(--muted) !important; margin: 10px 0 8px !important; }
.remember-row input { width: auto !important; margin: 0 !important; }

/* 顶栏申请 CTA */
.apply-cta { background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.apply-cta:active { background: rgba(255,255,255,0.4); }
.apply-cta.hidden { display: none; }

/* 账户条·四档套餐配色 */
.acct-bar .plan-free  { background: #fff; color: var(--gold); border: 1px solid #e3c98a; }
.acct-bar .plan-trial { background: #e8f7ef; color: #1e7a45; border: 1px solid #b9e2c8; }
.acct-bar .plan-basic { background: #fff4e0; color: #8a5a00; border: 1px solid #f0d9a8; }
.acct-bar .plan-pro   { background: var(--brand); color: #fff; }

/* ====== 公益版落地页 ====== */
body:not(.logged-in) #chat,
body:not(.logged-in) .quickbar,
body:not(.logged-in) .composer { display: none; }
body.logged-in .landing { display: none; }
.landing { flex: 1 1 auto; overflow-y: auto; background: linear-gradient(180deg,#ffffff 0%, var(--bg) 100%); -webkit-overflow-scrolling: touch; }
.landing-inner { max-width: 760px; margin: 0 auto; padding: 28px 16px 56px; }
.hero { text-align: center; padding: 16px 0 6px; }
.hero h1 { font-size: 25px; line-height: 1.4; margin: 0 0 10px; color: var(--brand); }
.hero-sub { font-size: 14px; color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.primary.big, .ghost.big { padding: 12px 26px; font-size: 15px; border-radius: 999px; font-weight: 700; cursor: pointer; border: none; }
.primary.big { background: var(--brand); color: #fff; }
.ghost.big { background: #fff; border: 1px solid var(--brand); color: var(--brand); text-decoration: none; display: inline-flex; align-items: center; }
.ghost.big:active { background: var(--brand-soft); }
.quota-strip { margin: 18px auto 0; max-width: 560px; background: var(--brand-soft); color: var(--brand); font-size: 13px; padding: 10px 14px; border-radius: 12px; line-height: 1.6; }
.sec-title { text-align: center; font-size: 18px; color: var(--ink); margin: 34px 0 16px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feat-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.feat-card b { display: block; color: var(--brand); font-size: 14px; margin-bottom: 6px; }
.feat-card span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-align: center; }
.step .num { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; align-items: center; justify-content: center; font-size: 13px; margin-bottom: 8px; }
.step b { display: block; font-size: 14px; margin-bottom: 4px; }
.step span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.faq { max-width: 620px; margin: 0 auto; }
.faq p { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--ink); line-height: 1.7; margin: 0 0 10px; }
.faq p b { color: var(--brand); }
.landing-foot { margin-top: 34px; border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.landing-foot code { color: var(--brand); font-weight: 700; }
.landing-foot a { color: var(--brand); }

/* 顶栏导航链接 */
.nav-link { color: #fff; text-decoration: none; font-size: 12px; opacity: 0.9; margin-right: 4px; }
.nav-link:active { opacity: 1; }

/* 验证码提示 */
.code-hint { font-size: 12px; color: var(--gold); background: #fff8e8; border: 1px solid #f0d9a8; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.5; }
.code-hint.hidden { display: none; }

/* 功能 chip 剩余次数 / 锁定 */
.chip .cnt { font-size: 11px; opacity: 0.8; margin-left: 3px; }
.chip.locked { opacity: 0.5; background: #f0f0f0; border-color: #ddd; cursor: not-allowed; }
.chip.locked .cnt::before { content: '🔒'; margin-right: 2px; }

/* 礼貌提醒（配额用尽） */
.msg.notice { align-self: flex-start; background: #fff8e8; border: 1px solid #f0d9a8; color: #8a5a00; border-bottom-left-radius: 4px; white-space: pre-wrap; word-break: break-word; }

/* 账户条·公益版 + 邀请 */
.acct-bar .plan-charity { background: var(--brand); color: #fff; }
.acct-bar .plan-member { background: #0f5e54; color: #fff; border: 1px solid #0f5e54; }
.acct-bar .plan-pending { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.acct-bar .member-btn { background: #0f5e54; color: #fff; border: none; border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; margin-left: 8px; }
.invite-btn { background: #fff; border: 1px solid var(--brand); color: var(--brand); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.invite-btn:active { background: var(--brand-soft); }

@media (max-width: 560px) {
  .feat-grid, .steps { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 22px; }
}

/* 内容门户入口横幅（index.html 陪练首页顶部）*/
.cms-banner { background: var(--brand); color: #fff; text-align: center; padding: 8px 12px; font-size: 13px; }
.cms-banner a { color: #fff; text-decoration: underline; font-weight: 600; }
