:root {
  --gold: #d4af37;
  --gold-light: #f0d060;
  --purple: #8b5cf6;
  --blue: #60a5fa;
  --bg: #0a0a0a;
  --bg2: #1a0f2e;
  --card: #1a1a2e;
  --card2: #222240;
  --text: #e8e6f0;
  --text-dim: #9a97a8;
  --text-faint: #5a5870;
  --border: rgba(255,255,255,0.08);
  --border-gold: rgba(212,175,55,0.25);
  --grad-gold: linear-gradient(135deg, #d4af37, #f0d060);
  --grad-purple: linear-gradient(135deg, #8b5cf6, #d4af37);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #1a0f2e 0%, #0a0a0a 55%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.page { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── 顶部栏 ── */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-gold);
  flex-shrink: 0;
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--grad-gold); flex-shrink: 0;
  overflow: hidden; border: 2px solid rgba(212,175,55,0.5);
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.header-info { flex: 1; }
.name { font-size: 16px; font-weight: 700; background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.status { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-online { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.dot-offline { background: #ef4444; }
.header-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4);
  font-size: 16px; cursor: pointer; flex-shrink: 0;
}

/* ── 消息列表 ── */
.msg-list {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch;
}
.msg-row { display: flex; gap: 8px; animation: fadeIn 0.3s ease; }
.msg-row.ai { align-self: flex-start; }
.msg-row.user { flex-direction: row-reverse; align-self: flex-end; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); flex-shrink: 0; overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.msg-body { max-width: 78%; }
.bubble { padding: 10px 14px; font-size: 15px; line-height: 1.5; word-break: break-word; }
.bubble.ai { background: var(--card); border-radius: 16px 16px 16px 4px; color: var(--text); border: 1px solid var(--border); }
.bubble.user { background: var(--grad-gold); color: #1a1200; border-radius: 16px 16px 4px 16px; font-weight: 500; }
.msg-img { max-width: 200px; max-height: 280px; border-radius: 12px; display: block; object-fit: cover; }
.divider { text-align: center; font-size: 11px; color: var(--text-faint); padding: 4px 0; }
.divider::before, .divider::after { content: '—'; margin: 0 8px; color: var(--border); }

/* 输入中动画 */
.typing { display: flex; gap: 4px; padding: 6px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: blink 1.4s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── 推荐卡片 ── */
.card-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.reco-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--border-gold);
  border-radius: 16px; padding: 12px; cursor: pointer; transition: all 0.2s;
}
.reco-card:active { background: var(--card2); transform: scale(0.98); }
.rc-avatar { width: 60px; height: 60px; border-radius: 12px; background: #2a2a3e; flex-shrink: 0; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.rc-info { flex: 1; min-width: 0; }
.rc-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.rc-name { font-size: 15px; font-weight: 600; color: var(--text); }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.badge-ss { background: var(--grad-gold); color: #1a1200; }
.badge-s { background: linear-gradient(135deg,#c0c0c0,#e0e0e0); color: #1a1a1a; }
.badge-a { background: rgba(139,92,246,0.25); color: #c9b3ff; }
.rc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.rc-tag { font-size: 10px; padding: 2px 8px; border-radius: 8px; background: rgba(139,92,246,0.18); color: #c9b3ff; }
.rc-meta { font-size: 11px; color: var(--text-dim); display: flex; gap: 8px; }
.rc-price { font-size: 16px; font-weight: 700; background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-left: auto; }

/* ── 订单卡片 ── */
.order-card { background: var(--card); border: 1px solid var(--border-gold); border-radius: 16px; padding: 14px; width: 100%; }
.order-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-dim); padding: 4px 0; }
.order-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; color: var(--gold); border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

/* ── 快捷操作 ── */
.quick-bar { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; flex-shrink: 0; }
.chip {
  white-space: nowrap; padding: 7px 14px; border-radius: 18px;
  font-size: 12px; background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.3); color: #c9b3ff;
  cursor: pointer; flex-shrink: 0;
}
.chip:active { background: rgba(139,92,246,0.3); }

/* ── 输入区 ── */
.input-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 16px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(10,10,10,0.9); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.input-bar input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 16px; color: var(--text); font-size: 15px; outline: none;
}
.input-bar input:focus { border-color: rgba(212,175,55,0.5); }
.img-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); font-size: 18px; cursor: pointer; flex-shrink: 0; }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--grad-gold); color: #1a1200; font-size: 20px; cursor: pointer; flex-shrink: 0; }

/* ── 子页头部 ── */
.sub-header { padding: 16px 16px 8px; flex-shrink: 0; }
.sub-title { font-size: 22px; font-weight: 800; background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sub-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ── 首页：场景筛选 ── */
.scene-tabs { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; flex-shrink: 0; }
.scene-chip {
  white-space: nowrap; padding: 7px 16px; border-radius: 18px;
  font-size: 13px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; flex-shrink: 0;
}
.scene-chip.active { background: var(--grad-gold); color: #1a1200; border-color: transparent; font-weight: 600; }

/* ── 首页列表 ── */
.home-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.loading { text-align: center; color: var(--text-faint); padding: 40px 0; font-size: 14px; }
.reco-card.full { width: 100%; }

/* ── 我的页 ── */
.mine-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.asset-card {
  background: linear-gradient(135deg, #1a1a2e, #2a1a3e);
  border: 1px solid var(--border-gold); border-radius: 18px; padding: 20px; margin-bottom: 16px;
}
.asset-row { display: flex; }
.asset-item { flex: 1; text-align: center; }
.asset-val { font-size: 26px; font-weight: 800; background: var(--grad-gold); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.asset-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.menu-group { background: var(--card); border-radius: 18px; border: 1px solid var(--border); overflow: hidden; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--card2); }
.menu-icon { font-size: 20px; }
.menu-text { font-size: 15px; font-weight: 500; color: var(--text); }
.menu-desc { font-size: 12px; color: var(--text-faint); }
.menu-arrow { margin-left: auto; color: var(--text-faint); font-size: 20px; }

/* ── 底部 Tab 导航 ── */
.tabbar {
  display: flex; flex-shrink: 0;
  background: rgba(10,10,10,0.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; text-align: center; padding: 8px 0 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab-icon { font-size: 22px; filter: grayscale(1) opacity(0.5); transition: all 0.2s; }
.tab-text { font-size: 11px; color: var(--text-faint); }
.tab.active .tab-icon { filter: none; transform: scale(1.1); }
.tab.active .tab-text { color: var(--gold); font-weight: 600; }

/* ── 弹层 ── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-sheet {
  width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
  background: linear-gradient(180deg, #1a1a2e, #0f0f1a);
  border-radius: 24px 24px 0 0; padding: 24px 20px;
  border-top: 2px solid var(--border-gold);
}
.sheet-title { font-size: 18px; font-weight: 700; color: var(--gold); margin-bottom: 16px; text-align: center; }
.sheet-btn {
  display: block; width: 100%; padding: 14px; border-radius: 14px;
  background: var(--grad-gold); color: #1a1200; font-size: 16px; font-weight: 700;
  border: none; cursor: pointer; margin-top: 16px;
}
.sheet-input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-size: 15px; outline: none; margin-bottom: 10px;
}
.sheet-input:focus { border-color: rgba(212,175,55,0.5); }
.sheet-label { font-size: 13px; color: var(--text-dim); margin: 8px 0 4px; }
.sheet-close { text-align: center; color: var(--text-faint); padding: 12px; font-size: 14px; cursor: pointer; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%,60%,100% { opacity: 0.2; } 30% { opacity: 1; } }
