/* 智映引擎 · 网页版 设计系统
   视觉基调：浅色、留白充足、排版精致干净（少文案、多呼吸感）。
   主色：克制的靛蓝紫；中性灰阶；圆角与大间距营造高级感。 */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --ink: #1c1f2a;
  --ink-2: #4a4f5e;
  --ink-3: #8a90a2;
  --line: #e9ebf2;
  --brand: #5b5bf0;
  --brand-ink: #4a3fd6;
  --brand-soft: #eef0ff;
  --green: #18a058;
  --green-soft: #e7f7ee;
  --amber: #d98b1a;
  --red: #e5484d;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 8px 30px rgba(28, 31, 42, 0.06);
  --shadow-lg: 0 18px 50px rgba(28, 31, 42, 0.10);
  --maxw: 540px;
  font-synthesis: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 布局：移动优先，居中容器 */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 84px; /* 给底部导航留位 */
}

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246, 247, 251, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.brand-logo { font-size: 12px; color: var(--ink-3); letter-spacing: .5px; }
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: .5px; }
.topbar .spacer { flex: 1; }
.topbar .sub { font-size: 12px; color: var(--ink-3); }

/* 通用区块 */
.section { padding: 18px; }
.section-title { font-size: 13px; color: var(--ink-3); font-weight: 600; letter-spacing: 1px; margin: 4px 2px 12px; }

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 14px; }

/* 身份选择卡（首页） */
.identity-grid { display: grid; gap: 16px; }
.identity-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  padding: 22px 20px;
  color: #fff;
  cursor: pointer;
  min-height: 150px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .18s ease, box-shadow .18s ease;
}
.identity-card:active { transform: scale(.985); }
.identity-card.merchant { background: linear-gradient(135deg, #6a5bf0, #8a6bf5); }
.identity-card.opc { background: linear-gradient(135deg, #2bb6a6, #36c8b0); }
.identity-card h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.identity-card .who { font-size: 13px; opacity: .9; margin-top: 2px; }
.identity-card .bullets { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.identity-card .bullet {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px;
}
.identity-card .enter { margin-top: 16px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 12px 20px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--brand); color: #fff;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--brand-ink); border: 1px solid var(--line); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* 输入框 */
.field { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; color: var(--ink); outline: none; font-family: inherit; }
.field:focus { border-color: var(--brand); }
textarea.field { resize: vertical; min-height: 88px; line-height: 1.6; }

/* 聊天 */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 130px); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; }
.msg { display: flex; margin-bottom: 14px; gap: 10px; }
.msg .avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 16px; background: var(--brand-soft); color: var(--brand-ink); }
.msg.user { flex-direction: row-reverse; }
.msg .bubble { max-width: 78%; padding: 12px 14px; border-radius: 16px; font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--brand); color: #fff; border-top-right-radius: 4px; }
.msg .bubble .cap { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.msg .bubble img.gen { width: 100%; border-radius: 12px; margin-top: 6px; display: block; }
.msg .bubble video.gen { width: 100%; border-radius: 12px; margin-top: 6px; display: block; background: #000; }

.composer {
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
  display: flex; gap: 8px; align-items: center;
}
.composer .field { flex: 1; border-radius: 999px; padding: 11px 16px; }
.composer .send { width: 46px; height: 46px; border-radius: 50%; flex: none; padding: 0; font-size: 18px; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: var(--maxw);
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 40;
}
.tabbar a { flex: 1; text-align: center; padding: 8px 0 9px; color: var(--ink-3); text-decoration: none; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabbar a .ic { font-size: 19px; line-height: 1; }
.tabbar a.active { color: var(--brand); }

/* 列表 / 资料 */
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-3); }
.kv .v { color: var(--ink); font-weight: 600; text-align: right; max-width: 60%; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.chip:active { background: var(--brand-soft); color: var(--brand-ink); }

/* 进度 / 状态 */
.muted { color: var(--ink-3); }
.center { text-align: center; }
.empty { text-align: center; color: var(--ink-3); padding: 48px 24px; }
.tag { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.tag.amber { background: #fbf0dc; color: var(--amber); }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(28,31,42,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s ease; pointer-events: none; max-width: 80%;
}
.toast.show { opacity: 1; }

/* 思考气泡 */
.thinking { color: var(--ink-3); font-style: italic; font-size: 13px; }

/* 加载指示 */
.dotwave span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--ink-3); animation: dw 1s infinite ease-in-out; }
.dotwave span:nth-child(2){ animation-delay:.15s } .dotwave span:nth-child(3){ animation-delay:.3s }
@keyframes dw { 0%,80%,100%{ transform: translateY(0); opacity:.4 } 40%{ transform: translateY(-5px); opacity:1 } }

@media (min-width: 560px) {
  .app { box-shadow: var(--shadow-lg); }
}

/* 付费视频生成弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(20,22,32,.45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 560px) { .modal-mask { align-items: center; } }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); padding: 18px; max-height: 92vh; overflow: auto; animation: slideUp .22s ease; }
@media (min-width: 560px) { .modal { border-radius: 22px; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-x { border: none; background: none; font-size: 26px; color: var(--ink-3); cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-body label { display: block; }
.modal-foot { display: flex; gap: 10px; margin-top: 14px; }
.modal-foot .btn.ghost { flex: 0 0 auto; }
.modal-foot .btn:not(.ghost) { flex: 1; }
.modal-progress { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 14px; font-size: 13px; color: var(--ink-2); }

/* 充值 */
.recharge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.amount-btn { padding: 14px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; font-weight: 700; color: var(--brand-ink); cursor: pointer; transition: transform .12s ease; }
.amount-btn:active { transform: scale(.97); background: var(--brand-soft); }
.amount-btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
