/* ============================================================
   Eros H5 · AI 语音陪伴
   主题：未来星蓝（默认暗色）/ 清爽白（浅色）
   ============================================================ */

:root {
  --primary: #4D7CFE;
  --primary-light: #6EA2FF;
  --primary-dark: #2F5CE0;
  --accent: #8B6CFF;
  --bg: #0A0E1A;
  --card: #131A30;
  --divider: #1E2742;
  --text-1: #E9EDFB;
  --text-2: #9AA3C4;
  --text-3: #5F6A92;
  --user-bubble: #4D7CFE;
  --ai-bubble: #1B2440;
  --success: #2EE6A8;
  --warning: #FFB74D;
  --error: #FF5C7A;
  --grad-a: #3B6FF0;
  --grad-b: #8B6CFF;
  --surface-alt: #10162B;
  --bar-bg: #0D1226;
  --input-fill: #10162B;
  --tabbar-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
}

body[data-theme="light"] {
  --primary: #5B8DEF;
  --primary-light: #8BB3F5;
  --primary-dark: #3D6FD4;
  --accent: #8B6CFF;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --divider: #EEF0F4;
  --text-1: #1A1D26;
  /* 次要/提示文字按 WCAG 校正：原 #8E95A6 对白底仅 2.8:1、#B8BECC 仅 1.7:1，几乎看不清 */
  --text-2: #6C717E;   /* 4.54:1 */
  --text-3: #7F838D;   /* 3.53:1 */
  --user-bubble: #5B8DEF;
  --ai-bubble: #F0F2F6;
  --success: #52C41A;
  --warning: #FAAD14;
  --error: #FF4D4F;
  --grad-a: #5B8DEF;
  --grad-b: #8B6CFF;
  --surface-alt: #EEF1F6;
  --bar-bg: #FFFFFF;
  --input-fill: #F5F7FA;
}

/* ===== 命名主题（对齐 App 主题页：暗夜霓虹 / 清新薄荷 / 樱花粉 / 深海蓝） ===== */
/* :root 即「暗夜霓虹」为默认暗色；以下为另三套。原 light 作为清爽白别名保留。 */
body[data-theme="mint"] {
  --primary: #1FBF8F;
  --primary-light: #46D3A8;
  --primary-dark: #149E72;
  --accent: #14B8A6;
  --bg: #EAF7F1;
  --card: #FFFFFF;
  --divider: #E3F0EA;
  --text-1: #10302A;
  /* 按 WCAG 校正：原 #5E7A72 仅 4.24:1、#A9C2BB 仅 1.71:1 */
  --text-2: #5A756D;   /* 4.53:1 */
  --text-3: #73847F;   /* 3.58:1 */
  --user-bubble: #1FBF8F;
  --ai-bubble: #F2F8F5;
  --success: #16A36E;
  --warning: #F59E0B;
  --error: #EF4444;
  --grad-a: #1FBF8F;
  --grad-b: #14B8A6;
  --surface-alt: #E3F0EA;
  --bar-bg: #FFFFFF;
  --input-fill: #F2F8F5;
}
body[data-theme="sakura"] {
  --primary: #FF6FA5;
  --primary-light: #FF90BD;
  --primary-dark: #E64C8A;
  --accent: #FF8FB1;
  --bg: #FFF1F5;
  --card: #FFFFFF;
  --divider: #FCE3EC;
  --text-1: #3A2230;
  /* 按 WCAG 校正：原 #8A6B7A 仅 4.29:1、#D7B9C7 仅 1.64:1 */
  --text-2: #866876;   /* 4.51:1 */
  --text-3: #907C85;   /* 3.54:1 */
  --user-bubble: #FF6FA5;
  --ai-bubble: #FEF4F8;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  --grad-a: #FF6FA5;
  --grad-b: #FF8FB1;
  --surface-alt: #FCE3EC;
  --bar-bg: #FFFFFF;
  --input-fill: #FEF4F8;
}
body[data-theme="ocean"] {
  --primary: #3B82F6;
  --primary-light: #60A5FA;
  --primary-dark: #2563EB;
  --accent: #22D3EE;
  --bg: #0B1A2E;
  --card: #12243D;
  --divider: #1E3A5C;
  --text-1: #E6F0FB;
  --text-2: #8FA8C4;
  --text-3: #5A7290;
  --user-bubble: #3B82F6;
  --ai-bubble: #16304F;
  --success: #2EE6A8;
  --warning: #FBBF24;
  --error: #F87171;
  --grad-a: #3B82F6;
  --grad-b: #22D3EE;
  --surface-alt: #102440;
  --bar-bg: #0E1E33;
  --input-fill: #102440;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", "Roboto", sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 16px; /* 防止 iOS 聚焦自动放大 */ color: var(--text-1); }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ===================== 页面容器 ===================== */
.page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#page-main { padding-top: var(--safe-top); }

/* ===================== 登录页 ===================== */
.login-bg { position: absolute; inset: 0; overflow: hidden; }
.login-orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35;
}
.login-orb-a { width: 300px; height: 300px; background: var(--grad-a); top: -80px; left: -100px; }
.login-orb-b { width: 260px; height: 260px; background: var(--grad-b); bottom: -60px; right: -80px; }

.login-wrap {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 24px 28px calc(24px + var(--safe-bottom));
  overflow-y: auto;
}
.login-brand { text-align: center; margin-bottom: 36px; }
.login-logo {
  width: 72px; height: 72px; margin: 0 auto 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: #fff;
  box-shadow: 0 12px 32px rgba(77, 124, 254, .35);
}
.login-title { font-size: 30px; font-weight: 800; letter-spacing: 2px; }
.login-subtitle { margin-top: 6px; font-size: 13px; color: var(--text-2); letter-spacing: 1px; }

.login-tabs {
  display: flex; background: var(--surface-alt); border-radius: 12px; padding: 4px; margin-bottom: 22px;
}
.login-tab {
  flex: 1; padding: 9px 0; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: all .2s;
}
.login-tab.active { background: var(--primary); color: #fff; }

.login-form .field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.field-optional { color: var(--text-3); font-weight: 400; }
.field-input {
  width: 100%; padding: 12px 14px;
  background: var(--input-fill);
  border: 1px solid var(--divider);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s;
}
.field-input:focus { border-color: var(--primary); }
.field-input::placeholder { color: var(--text-3); }
.field-row { display: flex; gap: 10px; }
.field-row .field-input { flex: 1; }

.btn-sendcode {
  flex-shrink: 0; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--primary);
  color: var(--primary); font-size: 13px; font-weight: 600;
  background: rgba(77, 124, 254, .08);
  white-space: nowrap;
}
.btn-sendcode:disabled { border-color: var(--divider); color: var(--text-3); background: var(--surface-alt); }

.btn-primary {
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 2px;
  border-radius: 12px; padding: 13px 20px;
  box-shadow: 0 8px 20px rgba(77, 124, 254, .3);
  transition: opacity .15s, transform .1s;
}
.btn-primary:active { transform: scale(.98); opacity: .92; }
.btn-primary:disabled { opacity: .5; box-shadow: none; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.login-tip { margin-top: 14px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ===================== 主框架 ===================== */
.main-header {
  flex-shrink: 0;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar-bg);
  border-bottom: .5px solid var(--divider);
  position: relative; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-brand { font-size: 18px; font-weight: 800; letter-spacing: 1.2px; }
.header-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 9px; border-radius: 10px;
  background: rgba(77, 124, 254, .12);
  border: 1px solid rgba(77, 124, 254, .25);
  color: var(--primary); font-size: 11px; font-weight: 600;
  max-width: 130px;
}
.header-chip span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-1);
}
.header-icon-btn:active { background: var(--surface-alt); }
/* 右上「+」新建（App 为紫色实心方块 + 白色加号） */
.header-add { background: linear-gradient(135deg, #6C7BFF, #8B6CFF); color: #fff; }
.header-add:active { opacity: .85; background: linear-gradient(135deg, #6C7BFF, #8B6CFF); }
.header-title {
  position: absolute; left: 0; right: 0; top: var(--safe-top); height: var(--header-h);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--text-1);
  pointer-events: none;
}

/* 聊天页头部：在线点 + 音色/设置 */
.chat-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-hdr-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-1);
  background: var(--surface-alt);
}
.chat-hdr-btn:active { background: var(--divider); }
.online-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--success); box-shadow: 0 0 0 0 rgba(46, 230, 168, .6);
  animation: pulseDot 1.8s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(46, 230, 168, .5); }
  70% { box-shadow: 0 0 0 6px rgba(46, 230, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 230, 168, 0); }
}
.lv-tag {
  font-size: 10px; font-weight: 700; color: var(--warning);
  background: rgba(255, 183, 77, .15); padding: 1px 6px; border-radius: 6px;
  flex-shrink: 0;
}

/* 主题选择面板 */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1.5px solid var(--divider); border-radius: 14px; cursor: pointer;
  background: var(--card); position: relative;
}
.theme-card.selected { border-color: var(--primary); }
.theme-swatch { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.theme-dark { background: linear-gradient(135deg, #0A0E1A, #3B6FF0); }
.theme-mint { background: linear-gradient(135deg, #1FBF8F, #14B8A6); }
.theme-sakura { background: linear-gradient(135deg, #FF6FA5, #FF8FB1); }
.theme-ocean { background: linear-gradient(135deg, #0B1A2E, #3B82F6); }
.theme-meta { flex: 1; min-width: 0; }
.theme-name { font-size: 14px; font-weight: 600; }
.theme-desc { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.theme-check { position: absolute; top: 8px; right: 8px; color: var(--primary); }

.main-body { flex: 1; position: relative; overflow: hidden; }
.tab-page {
  position: absolute; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
}

/* 底部导航 */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--bar-bg);
  border-top: .5px solid var(--divider);
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); font-size: 12px; font-weight: 500;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.tabbar-item.active { color: var(--primary); font-weight: 600; }

/* App 原版底部导航图标（选中/未选中双态图） */
.nav-ic {
  position: relative; display: block; width: 26px; height: 26px;
}
.nav-ic img {
  position: absolute; inset: 0; width: 26px; height: 26px;
  object-fit: contain; transition: opacity .15s ease;
  -webkit-user-drag: none; user-select: none;
}
.nav-ic .nav-ic-on { opacity: 0; }
.tabbar-item.active .nav-ic .nav-ic-on { opacity: 1; }
.tabbar-item.active .nav-ic .nav-ic-off { opacity: 0; }

/* 顶栏 / 聊天页 App 原版图标 */
.chip-ic { width: 16px; height: 16px; object-fit: contain; display: block; flex-shrink: 0; -webkit-user-drag: none; }
.header-icon-img { width: 22px; height: 22px; object-fit: contain; display: block; -webkit-user-drag: none; }

/* ===================== 会话列表 ===================== */
.list-pad { padding: 12px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 8px;
}
.section-title { font-size: 17px; font-weight: 700; color: var(--text-1); }
.section-actions { display: flex; gap: 8px; }
.section-btn {
  padding: 6px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-alt); color: var(--text-1);
}
.section-btn.primary { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; }
.section-btn:active { opacity: .85; }
.session-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 14px;
  padding: 13px;
  margin-bottom: 10px;
  transition: transform .12s;
}
.session-card:active { transform: scale(.985); }
.session-avatar {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  object-fit: cover; background: var(--surface-alt);
}
.session-avatar-fallback {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: rgba(77, 124, 254, .12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.session-info { flex: 1; min-width: 0; }
.session-name-row { display: flex; align-items: center; gap: 6px; }
.session-name {
  font-size: 14.5px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-char-badge {
  display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(77, 124, 254, .12); color: var(--primary);
  font-size: 10px; font-weight: 500;
}
.session-time { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.session-del {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.session-del:active { background: rgba(255, 92, 122, .12); color: var(--error); }

/* 空状态 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}
.empty-icon {
  width: 76px; height: 76px; border-radius: 22px;
  background: rgba(77, 124, 254, .1);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); margin-bottom: 18px;
}
.empty-title { font-size: 17px; font-weight: 600; }
.empty-sub { margin-top: 7px; font-size: 13px; color: var(--text-2); margin-bottom: 22px; }
.empty-actions { display: flex; gap: 10px; }

/* ===================== 通用卡片/表单 ===================== */
.panel { padding: 14px; }
.panel-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-1);
  margin: 4px 2px 10px;
}
.panel-title::before {
  content: ""; width: 3px; height: 12px; border-radius: 2px;
  background: linear-gradient(180deg, var(--grad-a), var(--grad-b));
}
.card {
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-row { display: flex; align-items: center; gap: 12px; }
.card-row + .card-row { margin-top: 12px; }
/* 会话卡片右侧箭头（App 列表为「›」而非删除按钮） */
.session-chevron { color: var(--text-3); flex-shrink: 0; margin-left: 4px; }

/* 聊天设置分组列表（对齐 App 图8） */
.menu-group { margin-bottom: 14px; }
.menu-group-title { font-size: 12px; color: var(--text-3); padding: 0 4px 7px; font-weight: 500; }
.menu-group .card { padding: 2px 14px; margin-bottom: 0; }
.menu-group .card-row { padding: 11px 0; }
.menu-group .card-row + .card-row { margin-top: 0; border-top: .5px solid var(--divider); }

/* 对话模型整页（对齐 App 图4：单选列表 + API Key 卡片） */
.model-row { padding: 12px 0; cursor: pointer; }
.model-row + .model-row { margin-top: 0; border-top: .5px solid var(--divider); }
.model-row .card-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.model-radio {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--divider); background: var(--card);
}
.model-row.selected .model-radio { display: none; }
.model-check { flex-shrink: 0; }

/* 角色卡牌（对齐 App：分段控件 + 搜索 + 分类 chips + 大图瀑布流） */
.char-seg { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.char-seg-item {
  padding: 7px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--text-2); background: var(--surface-alt); cursor: pointer;
}
.char-seg-item.active { background: linear-gradient(135deg, #4A90FF, #6C5CE7); color: #fff; }
.char-seg-add {
  margin-left: auto; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #6C7BFF, #8B6CFF); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600; cursor: pointer;
}
.char-search {
  display: flex; align-items: center; gap: 7px;
  margin: 0 12px 10px; padding: 9px 12px;
  background: var(--surface-alt); border-radius: 12px; color: var(--text-3);
}
.char-search-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 13.5px; color: var(--text-1); font-family: inherit;
}
.char-cats { display: flex; gap: 7px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.char-cats::-webkit-scrollbar { display: none; }
.char-cat {
  flex-shrink: 0; padding: 5px 12px; border-radius: 14px;
  font-size: 12px; color: var(--text-2); background: var(--surface-alt); cursor: pointer;
}
.char-cat.active { background: rgba(91, 141, 239, .14); color: var(--primary); font-weight: 600; }
.char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.char-grid .char-card { margin-bottom: 0; }
.char-list-wrap { padding: 0 12px 12px; }

.card-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(77, 124, 254, .12); color: var(--primary);
}
/* App 原版 3D 功能图标（无底色，直接 contain 显示） */
.card-icon--img { background: none; border-radius: 0; width: 32px; height: 32px; }
.card-icon--img img { width: 32px; height: 32px; object-fit: contain; display: block; -webkit-user-drag: none; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-size: 14.5px; font-weight: 600; }
.card-desc { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.card-value { font-size: 14px; font-weight: 600; color: var(--text-1); text-align: right; }
.card-value-sub { font-size: 11px; color: var(--text-2); text-align: right; margin-top: 2px; }
.chevron { color: var(--text-3); flex-shrink: 0; }

.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2.5px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600;
}
.tag-primary { background: rgba(77, 124, 254, .14); color: var(--primary); }
.tag-success { background: rgba(46, 230, 168, .13); color: var(--success); }
.tag-warning { background: rgba(255, 183, 77, .14); color: var(--warning); }
.tag-error { background: rgba(255, 92, 122, .13); color: var(--error); }
.tag-plain { background: var(--surface-alt); color: var(--text-2); }
.tag-relationship { background: rgba(255, 132, 168, .16); color: #ff84a8; }

.cd-avatar-edit {
  position: absolute; right: 4px; bottom: 4px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.cd-avatar-edit:active { transform: scale(.92); }

.btn-outline {
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--primary); color: var(--primary);
  font-size: 13px; font-weight: 600;
  background: rgba(77, 124, 254, .07);
}
.btn-outline:active { background: rgba(77, 124, 254, .16); }

/* 设置页头部（对齐 App「设置」页） */
.settings-header {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 12px 0; padding: 16px;
  border-radius: 16px; background: var(--card); border: .5px solid var(--divider);
}
.settings-avatar {
  width: 60px; height: 60px; border-radius: 16px; overflow: hidden; flex-shrink: 0;
  cursor: pointer; background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: var(--primary);
}
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-id { flex: 1; min-width: 0; }
.settings-nick { font-size: 17px; font-weight: 700; }
.settings-email { font-size: 12px; color: var(--text-2); margin-top: 3px; word-break: break-all; }
.settings-vip {
  flex-shrink: 0; border: none; border-radius: 11px; padding: 7px 12px;
  font-size: 12px; font-weight: 700; color: #7A4A00;
  background: linear-gradient(135deg, #FFD479, #FFB03A); cursor: pointer;
}
.settings-vip:active { transform: scale(.96); }
.btn-ghost {
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--divider); color: var(--text-2);
  font-size: 13px; font-weight: 500;
}
.btn-danger {
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid rgba(255, 92, 122, .4); color: var(--error);
  font-size: 13px; font-weight: 600;
  background: rgba(255, 92, 122, .07);
}
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

/* 表单（底部面板/页面内） */
.form-field { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.form-input, .form-textarea {
  width: 100%; padding: 11px 13px;
  background: var(--input-fill);
  border: 1px solid var(--divider);
  border-radius: 11px;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: none; line-height: 1.5; }
.form-hint { margin-top: 5px; font-size: 11px; color: var(--text-3); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all .18s;
}
.chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* ===================== 聊天页 ===================== */
.page-chat { background: var(--bg); padding-top: var(--safe-top); z-index: 40; }
.chat-header {
  flex-shrink: 0; height: var(--header-h);
  padding: 0 8px;
  display: flex; align-items: center; gap: 4px;
  background: var(--bar-bg);
  border-bottom: .5px solid var(--divider);
}
.chat-back, .chat-menu {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-1); flex-shrink: 0;
}
.chat-back:active, .chat-menu:active { background: var(--surface-alt); }
.chat-title {
  flex: 1; text-align: center;
  font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 12px 8px;
}
.chat-messages { display: flex; flex-direction: column; gap: 12px; min-height: 100%; justify-content: flex-end; }

.msg-row { display: flex; gap: 8px; max-width: 100%; }
.msg-row.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  object-fit: cover; background: var(--surface-alt);
}
.msg-avatar-fallback {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
}
.msg-avatar-ai { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); }
.msg-avatar-char { background: linear-gradient(135deg, var(--grad-b), #E58BFF); }

.msg-bubble-wrap { max-width: calc(100% - 90px); display: flex; flex-direction: column; }
.msg-row.user .msg-bubble-wrap { align-items: flex-end; }
.msg-char-name { font-size: 11px; color: var(--accent); margin-bottom: 3px; font-weight: 600; }
.msg-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: var(--chat-font-size, 15px);
  line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
  position: relative;
}
.msg-bubble.ai {
  background: var(--ai-bubble);
  border: .5px solid var(--divider);
  border-top-left-radius: 4px;
  /* 自定义字体颜色作用于 AI 气泡（对齐 App：用户气泡恒为主题色） */
  color: var(--chat-text-color, var(--text-1));
}
.msg-bubble.user {
  background: var(--user-bubble);
  border-top-right-radius: 4px;
  /* 主色偏亮时由 JS 写入自动转深的可读色，兜底白色 */
  color: var(--chat-user-text-color, #fff);
}
/* 深夜黑背景下提高 AI 气泡对比度 */
.page-chat[data-bg-dark="1"] .msg-bubble.ai {
  background: rgba(20, 24, 38, .88);
  border-color: rgba(255, 255, 255, .12);
  color: #F0F3FA;
}
.page-chat[data-bg-dark="1"] .chat-inputbar { background: rgba(13, 18, 38, .96); }
.page-chat[data-bg-dark="1"] .chat-header { background: rgba(13, 18, 38, .96); }
.page-chat[data-bg-dark="1"] .msg-time { color: rgba(255, 255, 255, .55); }
.msg-bubble.mono {
  background: rgba(139, 108, 255, .12);
  border: .5px dashed rgba(139, 108, 255, .4);
  font-size: 13px; color: var(--text-2);
  font-style: italic;
}
.msg-bubble-image { padding: 5px; }
.msg-bubble-image img { border-radius: 10px; max-height: 200px; object-fit: cover; }
.msg-tools {
  display: flex; gap: 12px; margin-top: 5px;
}
.msg-tool-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--text-3);
  padding: 3px 8px; border-radius: 7px;
  background: var(--surface-alt);
}
.msg-tool-btn:active { color: var(--primary); }
.msg-tool-btn.playing { color: var(--primary); }
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
  animation: typing 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-inputbar {
  flex-shrink: 0;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--bar-bg);
  border-top: .5px solid var(--divider);
}
.input-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.input-icon-btn:active { background: var(--surface-alt); color: var(--primary); }
.chat-input {
  flex: 1;
  max-height: 110px;
  padding: 8px 13px;
  background: var(--input-fill);
  border: 1px solid var(--divider);
  border-radius: 18px;
  outline: none; resize: none;
  line-height: 1.45;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--primary); }
.btn-send {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  transition: opacity .15s, transform .1s;
}
.btn-send:active { transform: scale(.92); }
.btn-send:disabled { opacity: .35; }

/* ===================== 覆盖页 ===================== */
.page-sub { z-index: 45; padding-top: var(--safe-top); }
.sub-header {
  flex-shrink: 0; height: var(--header-h);
  padding: 0 8px;
  display: flex; align-items: center; gap: 4px;
  background: var(--bar-bg);
  border-bottom: .5px solid var(--divider);
}
.sub-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ===================== 底部面板 ===================== */
.sheet-mask, .dialog-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding-bottom: var(--safe-bottom);
  animation: sheet-up .28s cubic-bezier(.22, 1, .36, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: var(--divider); margin: 10px auto 4px; flex-shrink: 0; }
.sheet-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 10px;
}
.sheet-title { font-size: 17px; font-weight: 700; flex: 1; }
.sheet-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--text-2); border-radius: 8px; }
.sheet-body { overflow-y: auto; padding: 0 18px 18px; -webkit-overflow-scrolling: touch; }

/* ===================== 对话框 ===================== */
.dialog {
  position: fixed; left: 50%; top: 50%; z-index: 95;
  width: min(84vw, 320px);
  transform: translate(-50%, -50%);
  background: var(--card);
  border-radius: 16px;
  padding: 20px 18px 14px;
  animation: dialog-in .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.dialog-title { font-size: 16px; font-weight: 700; text-align: center; }
.dialog-body { margin-top: 10px; font-size: 14px; color: var(--text-2); line-height: 1.6; text-align: center; }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog-actions button { flex: 1; padding: 10px 0; border-radius: 10px; font-size: 14px; font-weight: 600; }
.dialog-btn-cancel { background: var(--surface-alt); color: var(--text-2); }
.dialog-btn-ok { background: var(--primary); color: #fff; }
.dialog-btn-ok.danger { background: var(--error); }

/* 会员权益弹窗（对齐 App 图2） */
.dialog.benefits-dialog {
  width: min(86vw, 344px);
  max-height: 78vh;
  overflow-y: auto;
  padding: 20px 18px 16px;
  text-align: left;
}
.benefits-head { display: flex; align-items: center; gap: 12px; }
.benefits-head-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #6C7BFF, #8B6CFF);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.benefits-title { font-size: 18px; font-weight: 700; }
.benefits-intro { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 14px 0 16px; }
.benefit-group { padding: 12px; border-radius: 10px; margin-bottom: 12px; }
.benefit-group-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.benefit-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.benefit-item:last-child { margin-bottom: 0; }
.benefit-emoji { font-size: 14px; line-height: 1.4; flex-shrink: 0; }
.benefit-text { font-size: 12px; line-height: 1.45; color: var(--text-1); }
.benefit-text b { font-weight: 600; }
.benefit-desc { color: var(--text-2); }
.benefits-recharge-btn {
  width: 100%; padding: 11px 0; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #6C7BFF, #8B6CFF); color: #fff;
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.benefits-actions { margin-top: 14px; }
.benefits-actions .dialog-btn-cancel { background: var(--surface-alt); border: 1px solid var(--divider); }

/* ===================== Toast / Loading ===================== */
.toast {
  position: fixed; left: 50%; top: calc(18% + var(--safe-top)); z-index: 120;
  transform: translateX(-50%);
  max-width: 78vw;
  padding: 10px 18px;
  background: rgba(20, 26, 46, .92);
  border: 1px solid var(--divider);
  border-radius: 12px;
  color: #fff; font-size: 13.5px; text-align: center;
  animation: toast-in .25s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
body[data-theme="light"] .toast { background: rgba(30, 34, 46, .92); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.loading-mask {
  position: fixed; inset: 0; z-index: 130;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .35);
}
.loading-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .18);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== 角色卡牌 ===================== */
.char-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.char-card {
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 14px; overflow: hidden;
  transition: transform .12s;
}
.char-card:active { transform: scale(.97); }
.char-cover { position: relative; aspect-ratio: 3 / 3.6; background: var(--surface-alt); }
.char-cover img { width: 100%; height: 100%; object-fit: cover; }
.char-cover-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; color: rgba(255, 255, 255, .85);
  background: linear-gradient(160deg, var(--grad-a), var(--grad-b));
}
.char-official {
  position: absolute; top: 7px; left: 7px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .5); color: #FFD76D;
  font-size: 10px; font-weight: 600;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.char-type {
  position: absolute; top: 7px; right: 7px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 10px; font-weight: 500;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.char-body { padding: 9px 10px 11px; }
.char-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-desc {
  margin-top: 3px; font-size: 11px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 30px;
}
.char-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.char-affinity { font-size: 10px; color: var(--text-3); white-space: nowrap; }

/* ===================== 任务中心 ===================== */
/* 每日签到（紫色渐变，对齐 App 任务中心） */
.task-hero {
  margin: 12px; border-radius: 18px; padding: 16px;
  background: linear-gradient(145deg, #7C3AED 0%, #9333EA 55%, #A855F7 100%);
  color: #fff;
}
.th-head { display: flex; align-items: center; justify-content: space-between; }
.th-title { font-size: 17px; font-weight: 800; }
.th-status {
  border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .14);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 16px; cursor: pointer;
}
.th-status.done { opacity: .85; }
.th-streak { font-size: 12.5px; opacity: .9; margin-top: 8px; }
.th-tip {
  font-size: 12.5px; line-height: 1.6;
  background: rgba(255, 255, 255, .14); border-radius: 12px;
  padding: 10px 12px; margin-top: 10px;
}
.th-days { display: flex; gap: 6px; margin-top: 12px; }
.th-day {
  flex: 1; background: rgba(255, 255, 255, .16); border-radius: 10px;
  padding: 8px 2px; text-align: center;
  display: flex; flex-direction: column; gap: 3px;
}
.th-day.done { background: rgba(255, 255, 255, .30); }
.th-day.today { background: #fff; color: #7C3AED; }
.th-d { font-size: 11px; font-weight: 700; }
.th-r { font-size: 9.5px; opacity: .9; }

.task-checkin {
  border-radius: 16px; padding: 16px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff; margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
}
.task-checkin-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
}
.task-checkin-main { flex: 1; min-width: 0; }
.task-checkin-title { font-size: 15.5px; font-weight: 700; }
.task-checkin-sub { font-size: 11.5px; opacity: .85; margin-top: 3px; }
.task-checkin-btn {
  flex-shrink: 0; padding: 8px 15px; border-radius: 18px;
  background: #fff; color: var(--primary-dark);
  font-size: 13px; font-weight: 700;
}
.task-checkin-btn.done { background: rgba(255, 255, 255, .22); color: #fff; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-item {
  background: var(--card); border: .5px solid var(--divider); border-radius: 13px;
  padding: 13px 8px; text-align: center;
}
.stat-value { font-size: 19px; font-weight: 800; background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 11px; color: var(--text-2); margin-top: 3px; }

.copy-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-alt);
  border: 1px dashed var(--divider);
  border-radius: 11px; padding: 11px 13px;
}
.copy-code { flex: 1; font-size: 15px; font-weight: 700; letter-spacing: 1.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ===================== 我的 / 充值 ===================== */
.profile-hero {
  margin: 12px; border-radius: 18px; padding: 18px 16px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
}
.profile-hero::after {
  content: ""; position: absolute; right: -30px; top: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.profile-avatar {
  width: 60px; height: 60px; border-radius: 16px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .4);
  object-fit: cover; background: rgba(255, 255, 255, .15);
}
.profile-avatar-fallback {
  width: 60px; height: 60px; border-radius: 16px; flex-shrink: 0;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
}
.profile-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.profile-nick { font-size: 17px; font-weight: 700; }
.profile-email { font-size: 12px; opacity: .82; margin-top: 3px; word-break: break-all; }
.profile-level {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px; padding: 3px 10px; border-radius: 12px;
  background: rgba(0, 0, 0, .22);
  font-size: 11px; font-weight: 600;
}

/* 橙色品牌 hero（对齐 App「我的」页） */
/* 浅色用户卡（对齐 App 个人中心：白卡 + 金色会员胶囊） */
.profile-hero--light {
  background: var(--card); color: var(--text-1);
  flex-direction: column; align-items: stretch; gap: 10px;
  border: .5px solid var(--divider);
  box-shadow: 0 2px 10px rgba(20, 30, 60, .04);
}
.profile-hero--light::after { display: none; }
.pf-user { display: flex; align-items: center; gap: 12px; }
.pf-ava {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, #DCE4F5, #EEF1F6);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: var(--primary);
}
.pf-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-meta { flex: 1; min-width: 0; }
.pf-nick { font-size: 17px; font-weight: 700; color: var(--text-1); }
.pf-mail { font-size: 12px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-vip-pill {
  border: 0; cursor: pointer; flex-shrink: 0;
  padding: 6px 12px; border-radius: 18px;
  font-size: 11px; font-weight: 700; color: #7A5200;
  background: linear-gradient(135deg, #FFE7A8, #FFC94D);
  box-shadow: 0 2px 6px rgba(255, 180, 40, .3);
}
.pf-service { font-size: 12px; color: var(--text-2); border-top: .5px solid var(--divider); padding-top: 9px; }

/* 今日使用次数 */
.usage-grid { display: flex; gap: 10px; }
.usage-item {
  flex: 1; min-width: 0; padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-alt);                                   /* 回退：不支持 color-mix 的浏览器 */
  border: .5px solid var(--divider);
  background: color-mix(in srgb, var(--uc) 6%, transparent);
  border: .5px solid color-mix(in srgb, var(--uc) 10%, transparent);
}
.u-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--uc); font-weight: 500; }
.u-label img { width: 16px; height: 16px; object-fit: contain; }
.u-main { font-size: 13px; margin-top: 4px; color: var(--text-1); }
.u-main b { color: var(--uc); font-size: 15px; }
.u-sub { font-size: 11px; color: var(--uc); font-weight: 600; margin-top: 3px; }
.u-bar { margin-top: 8px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--uc) 12%, transparent); overflow: hidden; }
.u-bar i { display: block; height: 100%; border-radius: 3px; background: var(--uc); transition: width .25s; }
.usage-svip {
  margin-top: 10px; padding: 10px; border-radius: 10px;
  background: rgba(77, 124, 254, .07);
  font-size: 12px; font-weight: 600; color: var(--primary); line-height: 1.55;
}
.usage-note { font-size: 11.5px; color: var(--text-3); line-height: 1.6; margin-top: 10px; }

/* 快捷入口（模型设置/充值/兑换/兑换记录） */
.pf-quick { display: flex; gap: 8px; margin: 0 12px 4px; }
.pf-q {
  flex: 1; background: var(--card); border: .5px solid var(--divider);
  border-radius: 14px; padding: 12px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pf-q:active { background: var(--surface-alt); }
.pf-q img { width: 30px; height: 30px; object-fit: contain; }
.pf-q span { font-size: 11.5px; color: var(--text-1); font-weight: 500; }

/* 主题皮肤 */
.pf-themes { display: flex; gap: 10px; padding: 4px 2px 2px; }
.pf-theme { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.pf-th-dot { width: 42px; height: 42px; border-radius: 50%; display: block; border: 2px solid var(--divider); }
.pf-theme.active .pf-th-dot { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(91, 141, 239, .25); }
.pf-th-name { font-size: 11px; color: var(--text-2); }
.pf-theme.active .pf-th-name { color: var(--primary); font-weight: 600; }

.profile-hero--brand {
  background: linear-gradient(135deg, #FF9A3C, #FF6A3D);
  flex-direction: column; align-items: stretch; gap: 12px;
}
.profile-hero--brand .profile-avatar {
  width: 64px; height: 64px; border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
}
.profile-top { display: flex; align-items: center; gap: 8px; }
.profile-badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 10px;
  background: rgba(0, 0, 0, .26); font-size: 11px; font-weight: 700; color: #FFF3D6;
}
.profile-badge--plain { background: rgba(255, 255, 255, .22); color: #fff; }
.profile-stats { display: flex; gap: 22px; }
.ps-item { display: flex; flex-direction: column; }
.ps-v { font-size: 19px; font-weight: 800; line-height: 1.1; }
.ps-v small { font-size: 11px; font-weight: 600; margin-left: 1px; }
.ps-l { font-size: 11px; opacity: .82; margin-top: 3px; }
.profile-invite {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, .2); border-radius: 10px; padding: 7px 10px;
  font-size: 12px;
}
.profile-invite b { letter-spacing: .5px; }
.profile-invite-copy {
  margin-left: auto; border: none; background: rgba(255, 255, 255, .9); color: #FF6A3D;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 8px; cursor: pointer;
}
.profile-invite-copy:active { transform: scale(.95); }
.service-contact {
  margin-top: 10px; padding: 9px 10px; border-radius: 10px;
  background: var(--surface-alt); font-size: 13px; font-weight: 600; text-align: center;
}

.quota-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 12px 12px; }
.quota-item {
  background: var(--card); border: .5px solid var(--divider); border-radius: 13px;
  padding: 12px 13px;
}
.quota-label { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.quota-value { font-size: 17px; font-weight: 800; margin-top: 5px; }
.quota-value small { font-size: 11px; font-weight: 500; color: var(--text-2); }

.plan-card {
  background: var(--card); border: .5px solid var(--divider); border-radius: 14px;
  padding: 14px; margin-bottom: 11px; position: relative;
  transition: border-color .15s;
}
.plan-card.selected { border-color: var(--primary); background: rgba(77, 124, 254, .06); }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.plan-price { text-align: right; }
.plan-price-value { font-size: 18px; font-weight: 800; color: var(--primary); }
.plan-price-value small { font-size: 11px; font-weight: 500; }
.plan-desc { font-size: 12px; color: var(--text-2); margin-top: 7px; line-height: 1.55; }
.plan-radio {
  position: absolute; top: 14px; right: 14px;
  width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid var(--divider);
  display: flex; align-items: center; justify-content: center;
}
.plan-card.selected .plan-radio { border-color: var(--primary); background: var(--primary); }
.plan-card.selected .plan-radio::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }

/* 充值中心（对齐 App：渐变会员卡 + 分段 tab + 套餐卡） */
.rc-vip-card {
  margin: 12px; border-radius: 18px; padding: 18px 16px;
  background: linear-gradient(135deg, #4A90FF, #6C5CE7); color: #fff;
}
.rc-vip-name { font-size: 18px; font-weight: 800; }
.rc-vip-sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.rc-vip-quota { font-size: 12px; margin-top: 10px; opacity: .95; }

.rc-tabs {
  display: flex; gap: 6px; margin: 0 12px 12px;
  background: var(--surface-alt); border-radius: 12px; padding: 4px;
}
.rc-tab {
  flex: 1; text-align: center; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); padding: 8px 0; border-radius: 9px; cursor: pointer;
}
.rc-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 4px rgba(20, 30, 60, .08); }

.rc-plan { margin: 0 12px 12px; border-radius: 18px; padding: 18px 16px; color: #fff; }
.rc-plan--brand { background: linear-gradient(135deg, #4A90FF, #6C5CE7); }
.rc-plan--dark { background: linear-gradient(135deg, #1F2437, #2E3550); }
.rc-plan-name { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.rc-plan-price { font-size: 26px; font-weight: 800; margin-top: 6px; }
.rc-plan-price small { font-size: 12px; font-weight: 500; opacity: .85; }
.rc-plan-desc { font-size: 12.5px; opacity: .9; margin-top: 8px; line-height: 1.6; }

.rc-price-line { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.rc-price-line b { font-size: 18px; color: var(--error); }

.rc-pay-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid var(--divider); }
.rc-pay-dot.on { border-color: var(--primary); background: var(--primary); position: relative; }
.rc-pay-dot.on::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }

/* 充值页会员状态条 */
.recharge-member {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #2b2b40, #3a2b4a);
  border: 1px solid rgba(255, 200, 120, .28);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 16px;
}
.rm-info { display: flex; flex-direction: column; gap: 3px; }
.rm-name { font-size: 16px; font-weight: 800; color: #ffd479; letter-spacing: .5px; }
.rm-sub { font-size: 12px; color: rgba(255, 255, 255, .6); }
.rm-days { text-align: right; font-size: 22px; font-weight: 800; color: #fff; line-height: 1; }
.rm-days small { display: block; font-size: 10px; font-weight: 500; color: rgba(255, 255, 255, .55); margin-top: 3px; }

.duration-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.duration-chip {
  padding: 6px 12px; border-radius: 9px;
  background: var(--surface-alt); border: 1px solid var(--divider);
  font-size: 12px; font-weight: 500; color: var(--text-2);
}
.duration-chip.active { background: rgba(77, 124, 254, .12); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.duration-chip .discount { font-size: 10px; color: var(--warning); margin-left: 3px; font-weight: 600; }

.qr-wrap { text-align: center; padding: 8px 0 4px; }
.qr-img { width: 180px; height: 180px; margin: 0 auto; border-radius: 12px; background: #fff; padding: 8px; }
.qr-tip { margin-top: 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

.notice-box {
  background: rgba(255, 183, 77, .08);
  border: 1px solid rgba(255, 183, 77, .25);
  border-radius: 11px; padding: 11px 13px;
  font-size: 12px; color: var(--warning); line-height: 1.6;
}

/* ===================== 公告弹窗 ===================== */
.announce-card {
  width: min(84vw, 330px);
  background: var(--card);
  border-radius: 18px; padding: 22px 20px 16px;
  text-align: center;
}
.announce-icon {
  width: 44px; height: 44px; margin: 0 auto 12px;
  border-radius: 13px;
  background: rgba(77, 124, 254, .13);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.announce-title { font-size: 16px; font-weight: 700; }
.announce-content { margin-top: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.7; text-align: left; white-space: pre-wrap; }
.announce-btn { margin-top: 16px; width: 100%; }
/* 公告弹窗：让 .dialog 宿主透明、无内边距，仅由 .announce-card 呈现为单张正圆角卡片，
   避免出现「外层圆角框 + 内层卡片」的双重方框错位。 */
.dialog.announce-host {
  width: min(86vw, 340px);
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 20px;
}
.announce-host .announce-card { width: 100%; }

/* ===================== 创建角色：结构化填写表单 ===================== */
.cc-struct-wrap { margin-top: 4px; }
.cc-struct-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-1); margin-top: 14px; }
.cc-struct-head .cc-bolt { color: var(--primary); }
.cc-struct-sub { font-size: 11px; color: var(--text-2); margin: 3px 0 8px; line-height: 1.5; }
.cc-group-title { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-1); margin: 4px 0 8px; }
.cc-group-title span { width: 3px; height: 12px; border-radius: 2px; background: var(--primary); display: inline-block; }
.req { font-size: 9px; color: var(--error); background: rgba(255, 77, 79, .12); padding: 1px 5px; border-radius: 4px; margin-left: 4px; vertical-align: middle; }

/* 角色卡介绍编辑区（创建/编辑角色） */
.cc-intro-box {
  margin-top: 12px; padding: 12px;
  background: var(--surface-alt);
  border-radius: 12px;
}
.cc-intro-head { font-size: 13px; font-weight: 600; color: var(--text-1); }
.cc-intro-sub { margin-top: 4px; font-size: 11px; line-height: 1.45; color: var(--text-3); }
.cc-intro-box .form-field { margin-top: 10px; margin-bottom: 0; }
.cc-intro-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.cc-intro-title-row > span { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.cc-intro-add {
  border: none; background: transparent; color: var(--primary);
  font-size: 12px; font-weight: 600; padding: 4px 2px; cursor: pointer;
}
.cc-intro-empty { margin-top: 6px; font-size: 11px; line-height: 1.45; color: var(--text-3); }
.cc-intro-item {
  margin-top: 8px; padding: 8px 10px 10px;
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 10px;
}
.cc-intro-item-head { display: flex; align-items: center; gap: 6px; }
.cc-intro-item-head .cc-intro-title { flex: 1; min-width: 0; }
.cc-intro-del {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px;
  border: none; background: transparent; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cc-intro-item .cc-intro-content { margin-top: 6px; }

/* ===================== 响应式/杂项 ===================== */
.switch {
  width: 42px; height: 24px; border-radius: 12px;
  background: var(--divider); position: relative;
  transition: background .2s; flex-shrink: 0;
}
.switch span {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.switch.on { background: var(--primary); }
.switch.on span { transform: translateX(18px); }

.plan-price-sub { text-align: right; }

@media (min-width: 480px) {
  #page-login .login-wrap, #page-main, .page-chat, .page-sub { max-width: 480px; margin: 0 auto; }
  body { background: #05070f; }
  body[data-theme="light"] { background: #e8ebf0; }
  .page { box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
}

.fade-in { animation: fade-in .22s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.divider { height: .5px; background: var(--divider); margin: 10px 0; }

.section-gap { height: 14px; }

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-1 { color: var(--text-1); }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fw-600 { font-weight: 600; }
.avatar-preview {
  width: 96px; height: 96px; border-radius: 48px; margin: 6px auto 16px;
  overflow: hidden; background: var(--surface-alt);
  border: .5px solid var(--divider);
  display: flex; align-items: center; justify-content: center;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview-fallback { font-size: 34px; font-weight: 800; color: var(--primary); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-1 { flex: 1; min-width: 0; }

/* ===================== 开关组件（设置项） ===================== */
.switch {
  width: 44px; height: 26px; border-radius: 13px;
  background: var(--divider);
  position: relative; flex-shrink: 0;
  transition: background .2s;
  cursor: pointer;
}
.switch span {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.switch.on { background: var(--primary); }
.switch.on span { transform: translateX(18px); }

/* ===================== 好感度进度 ===================== */
.affinity-head { display: flex; align-items: baseline; gap: 8px; }
.affinity-value { font-size: 26px; font-weight: 800; background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.affinity-stage { font-size: 13px; font-weight: 600; color: var(--primary); }
.progress-track {
  height: 9px; border-radius: 5px;
  background: var(--surface-alt);
  overflow: hidden; margin-top: 10px;
}
.progress-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}
.progress-label { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.unlock-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.unlock-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 8px;
  background: rgba(46, 230, 168, .1);
  border: 1px solid rgba(46, 230, 168, .25);
  font-size: 11px; color: var(--success);
}

/* ===================== 成长轨迹时间线 ===================== */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1.5px; background: var(--divider);
}
.timeline-item { position: relative; padding: 0 0 14px 8px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -18px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 0 0 3px var(--card);
}
.timeline-desc { font-size: 13px; color: var(--text-1); line-height: 1.5; }
.timeline-meta { margin-top: 3px; font-size: 11px; color: var(--text-3); }
.timeline-affinity { font-size: 11px; font-weight: 600; }
.timeline-affinity.up { color: var(--success); }
.timeline-affinity.down { color: var(--error); }

/* ===================== 主动消息卡片 ===================== */
.proactive-card {
  border-radius: 16px; padding: 14px;
  background: linear-gradient(135deg, rgba(139, 108, 255, .14), rgba(77, 124, 254, .1));
  border: 1px solid rgba(139, 108, 255, .3);
  margin-bottom: 12px;
}
.proactive-head { display: flex; align-items: center; gap: 8px; }
.proactive-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 6px;
    background: rgba(139, 108, 255, .2); color: var(--accent);
    font-size: 10px; font-weight: 600;
}
.proactive-name { font-size: 13px; font-weight: 700; color: var(--accent); }
.proactive-content { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--text-1); }
.proactive-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ===================== 游戏面板 ===================== */
.game-panel { padding: 4px 0 8px; }
.game-type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.game-type-card {
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  border-radius: 13px;
  padding: 13px 11px;
  cursor: pointer;
  transition: all .18s;
}
.game-type-card:active, .game-type-card.selected { border-color: var(--primary); background: rgba(77, 124, 254, .08); }
.game-type-icon { color: var(--primary); margin-bottom: 7px; }
.game-type-name { font-size: 13.5px; font-weight: 700; }
.game-type-desc { font-size: 11px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.game-status {
  background: var(--surface-alt);
  border: 1px dashed var(--divider);
  border-radius: 12px;
  padding: 13px;
  font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap;
}
.game-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.game-option-btn {
  text-align: left;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  font-size: 13.5px; color: var(--text-1);
  transition: all .15s;
}
.game-option-btn:active { border-color: var(--primary); background: rgba(77, 124, 254, .08); }
.game-option-btn .opt-key {
  display: inline-flex; width: 18px; height: 18px; border-radius: 5px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  align-items: center; justify-content: center;
  margin-right: 8px; vertical-align: 1px;
}

/* ===================== MCP ===================== */
.mcp-server-card { margin-bottom: 10px; }
.mcp-status { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; }
.mcp-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.mcp-status.ok { color: var(--success); }
.mcp-status.ok::before { background: var(--success); box-shadow: 0 0 6px var(--success); }
.mcp-status.error { color: var(--error); }
.mcp-status.error::before { background: var(--error); }
.mcp-status.unknown { color: var(--text-3); }
.mcp-status.unknown::before { background: var(--text-3); }
.mcp-tool-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: .5px solid var(--divider);
}
.mcp-tool-row:last-child { border-bottom: none; }
.mcp-tool-name { font-size: 13px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mcp-tool-desc { font-size: 11.5px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.mcp-empty { text-align: center; padding: 22px 0; font-size: 12.5px; color: var(--text-3); }

/* ===================== MCP 工具页（对齐 App 图3） ===================== */
.mcp-notice {
  background: rgba(77, 124, 254, .06);
  border: .5px solid var(--divider);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}
.mcp-notice-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--primary); }
.mcp-notice-desc { font-size: 12px; color: var(--text-2); line-height: 1.55; margin-top: 8px; }
.mcp-notice-warn { font-size: 12px; color: #E65100; line-height: 1.55; margin-top: 6px; }
.mcp-section-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; }
.mcp-section-title { font-size: 15px; font-weight: 600; }
.mcp-section-count { font-size: 12px; color: var(--text-3); }
.mcp-section-head .btn-outline { margin-left: auto; }
.mcp-card-head { display: flex; align-items: center; gap: 8px; }
.mcp-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.mcp-card-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mcp-key-chip { padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.mcp-url-row { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 12px; color: var(--text-2); min-width: 0; }
.mcp-url-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tools-toggle {
  display: flex; align-items: center; gap: 4px;
  margin-top: 10px; padding-top: 10px;
  border-top: .5px solid var(--divider);
  font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer;
}
.mcp-tools-toggle svg { transition: transform .18s; }
.mcp-tools-toggle.open svg { transform: rotate(90deg); }
.mcp-tools-toggle.open { color: var(--primary); }
.mcp-tools-box { margin-top: 4px; }
.mcp-empty-card {
  text-align: center; padding: 30px 16px;
  background: var(--card); border: .5px solid var(--divider); border-radius: 14px;
  color: var(--text-3);
}
.mcp-empty-title { font-size: 13px; color: var(--text-2); margin-top: 10px; }
.mcp-empty-sub { font-size: 12px; margin-top: 4px; }

/* ===================== 聊天个性化 ===================== */
.swatch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }

/* 气泡/字体配色预览：直接展示自动校正后的真实观感 */
.ps-preview { margin-top: 4px; }
.ps-preview-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.55;
  border: .5px solid var(--divider);
}
.ps-preview-hint {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-2);
}
.swatch {
  aspect-ratio: 1; border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s;
  position: relative;
}
.swatch:active { transform: scale(.9); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--primary); }
.swatch.selected::after {
  content: ""; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/14px no-repeat;
}
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.bg-item {
  aspect-ratio: 9 / 14;
  border-radius: 11px;
  border: 2px solid var(--divider);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background-size: cover; background-position: center;
}
.bg-item.selected { border-color: var(--primary); }
.bg-item .bg-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 10px; font-weight: 500;
  text-align: center;
}
.font-size-row { display: flex; align-items: center; gap: 12px; }
.font-size-preview {
  flex: 1; text-align: center;
  padding: 10px; border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-1);
}

/* ===================== 协议页 ===================== */
.agree-body { padding: 18px 20px calc(20px + var(--safe-bottom)); }
.agree-section-title { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.agree-section-title:first-child { margin-top: 0; }
.agree-section-body { font-size: 13.5px; color: var(--text-2); line-height: 1.85; white-space: pre-line; }
.agree-footer {
  position: sticky; bottom: 0;
  display: flex; gap: 10px;
  padding: 12px 20px calc(14px + var(--safe-bottom));
  background: var(--bar-bg);
  border-top: .5px solid var(--divider);
}
.agree-footer button { flex: 1; padding: 12px 0; border-radius: 12px; font-size: 15px; font-weight: 600; }
.agree-btn-exit { background: var(--surface-alt); color: var(--text-2); }
.agree-btn-ok { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; }
.agree-btn-ok:disabled { opacity: .45; }

/* ===================== 邀请记录 ===================== */
.referral-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: .5px solid var(--divider); }
.referral-row:last-child { border-bottom: none; }
.referral-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: rgba(77, 124, 254, .12); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* =====================  WS 状态点 ===================== */
.ws-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); margin-left: 5px; vertical-align: 1px;
  box-shadow: 0 0 5px var(--success);
}
.ws-dot.off { background: var(--text-3); box-shadow: none; }

/* =====================  截图上传占位 ===================== */
.shot-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border: 1.5px dashed var(--divider);
  border-radius: 11px;
  padding: 14px 8px;
  color: var(--text-2); font-size: 12px;
  cursor: pointer;
  background: var(--surface-alt);
  position: relative;
  overflow: hidden;
}
.shot-upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot-upload:active { border-color: var(--primary); }
.shot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===================== 聊天页增强（对齐 App） ===================== */
/* AppBar：头像 + Lv + 时间 */
.chat-header { gap: 6px; }
.chat-header-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-header-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: var(--surface-alt);
  border: .5px solid var(--divider);
  position: relative;
}
.chat-header-avatar-fallback {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff; font-size: 12px; font-weight: 700;
}
.chat-header-text { min-width: 0; flex: 1; }
.chat-title-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.chat-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-tag {
  flex-shrink: 0;
  padding: 1px 6px; border-radius: 5px;
  background: rgba(139, 108, 255, .18); color: var(--accent);
  font-size: 9.5px; font-weight: 700;
}
.chat-header-time { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.chat-menu-text {
  width: auto; height: auto; min-height: 32px;
  display: inline-flex; align-items: center; gap: 3px;
  white-space: nowrap;
  color: var(--primary); font-size: 13px; font-weight: 600;
  padding: 0 6px;
}

/* 角色卡片气泡（角色会话，对齐 App 渐变卡片） */
.msg-row .msg-bubble.char-card {
  background: linear-gradient(135deg, rgba(77, 124, 254, .16), rgba(139, 108, 255, .16));
  border: .5px solid rgba(139, 108, 255, .35);
  border-radius: 18px;
  max-width: 300px;
  box-shadow: 0 2px 10px rgba(77, 124, 254, .1);
}
.char-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.char-card-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  object-fit: cover; background: var(--surface-alt);
}
.char-card-avatar-fallback {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--grad-b), #E58BFF);
  color: #fff; font-size: 11px; font-weight: 700;
}
.char-card-meta { flex: 1; min-width: 0; }
.char-card-name { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.char-card-time { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.char-card-game-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--accent); font-weight: 600;
}

/* 游戏消息标签 */
.msg-game-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--accent);
  margin-bottom: 4px;
}

/* 逐句显示气泡（无背景，逐条出现） */
.msg-row .msg-bubble.sentence {
  background: none;
  border: none;
  padding: 2px 4px;
  /* 无气泡底色，文字直接压在聊天背景上：JS 会按背景写入可读色 */
  color: var(--chat-text-color, var(--text-1));
  text-shadow: 0 1px 2px var(--sentence-shadow, rgba(0, 0, 0, .35));
}
/* 浅色背景不需要文字阴影，深色/图片背景需要 */
body[data-theme="light"] .msg-row .msg-bubble.sentence,
body[data-theme="mint"] .msg-row .msg-bubble.sentence,
body[data-theme="sakura"] .msg-row .msg-bubble.sentence {
  text-shadow: 0 1px 2px rgba(255, 255, 255, .8);
}
.sentence-anim { animation: sentence-in .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes sentence-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* MCP 工具状态条 */
.mcp-status-bar {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 9px;
  background: rgba(77, 124, 254, .1);
  border: .5px solid rgba(77, 124, 254, .3);
  font-size: 11px; color: var(--primary);
  margin-bottom: 5px;
}
.mcp-status-bar.ok { background: rgba(46, 230, 168, .1); border-color: rgba(46, 230, 168, .3); color: var(--success); }
.mcp-status-bar.fail { background: rgba(255, 92, 122, .1); border-color: rgba(255, 92, 122, .3); color: var(--error); }

/* 错误提示条（输入栏上方） */
.chat-error-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 10px 6px;
  padding: 9px 11px;
  background: rgba(255, 92, 122, .1);
  border: 1px solid rgba(255, 92, 122, .3);
  border-radius: 11px;
  font-size: 12.5px; color: var(--error);
}
.chat-error-bar .err-text { flex: 1; line-height: 1.4; }
.chat-error-bar button { flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--primary); }

/* 游戏进行中状态栏 */
.game-active-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 10px 8px;
  padding: 8px 11px;
  background: linear-gradient(135deg, rgba(77, 124, 254, .12), rgba(139, 108, 255, .12));
  border: 1px solid rgba(139, 108, 255, .3);
  border-radius: 11px;
}
.game-active-emoji { font-size: 18px; }
.game-active-info { flex: 1; min-width: 0; }
.game-active-name { font-size: 12.5px; font-weight: 700; color: var(--text-1); display: flex; align-items: center; gap: 5px; }
.game-active-name .tag { font-size: 9px; }
.game-active-tip { font-size: 10.5px; color: var(--text-2); margin-top: 1px; }
.game-active-end {
  flex-shrink: 0; padding: 5px 11px; border-radius: 13px;
  background: #fff; color: var(--primary-dark);
  font-size: 11.5px; font-weight: 700;
}
body[data-theme="dark"] .game-active-end { background: rgba(255, 255, 255, .92); }

/* 输入栏：前缀图标 / 计数 / 预览条 / 游戏中 */
.chat-input-wrap { flex: 1; display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.input-prefix { display: flex; align-items: center; gap: 2px; flex-shrink: 0; padding-bottom: 4px; }
.input-prefix .input-icon-btn { width: 30px; height: 30px; }
.chat-input-box { position: relative; flex: 1; min-width: 0; }
.chat-input-box .chat-input { width: 100%; }
.char-count {
  position: absolute; right: 8px; bottom: -16px;
  font-size: 10px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.char-count.over { color: var(--error); }

.img-preview-bar {
  display: flex; align-items: center; gap: 9px;
  margin: 0 10px 8px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  border-radius: 11px;
}
.img-preview-bar img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.img-preview-bar .pv-text { flex: 1; font-size: 11.5px; color: var(--text-2); line-height: 1.4; }
.img-preview-bar .pv-close {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--divider); color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* 真心话快捷按钮 */
.truth-dare-bar {
  display: flex; gap: 8px;
  padding: 0 10px 8px;
}
.truth-dare-bar button {
  flex: 1; padding: 8px 0; border-radius: 10px;
  font-size: 12.5px; font-weight: 700;
}
.td-dare { background: rgba(232, 98, 92, .15); color: #E8625C; border: 1px solid rgba(232, 98, 92, .4); }
.td-truth { background: rgba(91, 141, 239, .15); color: #5B8DEF; border: 1px solid rgba(91, 141, 239, .4); }

/* 发送中 loading */
.btn-send .send-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

/* ===================== 面具身份 ===================== */
.mask-row { padding: 11px 0; border-bottom: .5px solid var(--divider); }
.mask-row + .mask-row { margin-top: 0; }
.mask-row:last-child { border-bottom: none; }
.mask-row:active { opacity: .7; }

/* ===================== 角色介绍卡（空会话） ===================== */
.char-intro-card {
  margin: 14px 12px;
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 14px;
  overflow: hidden;
}
.char-intro-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
}
.char-intro-main { flex: 1; min-width: 0; }
.char-intro-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 1.5px;
  color: var(--text-3);
}
.char-intro-label svg { color: var(--primary); }
.char-intro-tagline {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 600; color: var(--text-1);
  line-height: 1.5;
}
.char-intro-main .char-intro-tagline {
  margin-top: 8px;
  font-size: 17px; font-weight: 700; line-height: 1.35;
}
.char-intro-chevron { flex-shrink: 0; color: var(--text-3); transition: transform .18s; }
.char-intro-body { padding: 0 14px 14px; }
.char-intro-sec + .char-intro-sec { margin-top: 12px; }
.char-intro-sec-title {
  font-size: 12.5px; font-weight: 600; color: var(--primary);
  margin-bottom: 5px;
}
.char-intro-sec-text {
  font-size: 13px; line-height: 1.65; color: var(--text-2);
  white-space: pre-wrap;
}
.char-intro-line {
  font-size: 13px; line-height: 1.65; color: var(--text-2);
  padding: 3px 0;
}
.char-intro-line b { color: var(--text-1); font-weight: 600; }

/* ===================== 角色卡牌审核 ===================== */
.review-tabs {
  display: flex; gap: 6px;
  padding: 12px 12px 8px;
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
}
.review-tab {
  flex: 1; padding: 8px 0; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  background: var(--surface-alt); color: var(--text-2);
  border: none; cursor: pointer;
}
.review-tab.active { background: rgba(77, 124, 254, .14); color: var(--primary); }

.review-search {
  display: flex; align-items: center; gap: 7px;
  margin: 0 12px 8px; padding: 9px 12px;
  background: var(--surface-alt); border-radius: 12px; color: var(--text-3);
}
.review-search-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 13.5px; color: var(--text-1); font-family: inherit;
}
.review-count { padding: 0 14px 6px; font-size: 11.5px; color: var(--text-3); }

.review-list { padding-top: 2px; }
.review-card {
  margin-bottom: 12px; padding: 14px;
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 14px;
  cursor: pointer;
}
.review-card:active { transform: scale(.99); }
.review-head { display: flex; align-items: flex-start; gap: 12px; }
.review-avatar {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: rgba(77, 124, 254, .12); color: var(--primary);
  font-size: 18px; font-weight: 700;
}
.review-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.review-avatar-lg { width: 62px; height: 62px; border-radius: 16px; font-size: 24px; }
.review-main { flex: 1; min-width: 0; }
.review-name-row { display: flex; align-items: center; gap: 8px; }
.review-name {
  font-size: 15.5px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.review-sub {
  margin-top: 4px; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.review-time { flex-shrink: 0; font-size: 11px; color: var(--text-3); }
.review-desc {
  margin-top: 10px; font-size: 13px; line-height: 1.45; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.review-report {
  margin-top: 10px; padding: 10px;
  background: rgba(255, 92, 122, .06);
  border-radius: 10px;
}
.review-report-title { font-size: 13px; font-weight: 600; color: var(--error); }
.review-report-detail { margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--text-2); }
.review-report-by { margin-top: 4px; font-size: 11px; color: var(--text-3); }

.review-actions { display: flex; gap: 12px; margin-top: 12px; }
.review-act {
  flex: 1; padding: 9px 0; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
}
.review-act-reject { color: var(--error); border-color: rgba(255, 92, 122, .5); }
.review-act-danger { background: var(--error); }

.review-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.review-detail-name { font-size: 17px; font-weight: 600; color: var(--text-1); }
.review-detail-sec { margin-bottom: 18px; }
.review-detail-title { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.review-detail-text {
  padding: 12px;
  background: var(--card);
  border: .5px solid var(--divider);
  border-radius: 10px;
  font-size: 13.5px; line-height: 1.55; color: var(--text-1);
  white-space: pre-wrap; word-break: break-word;
}

/* 图片全屏预览 */
.img-viewer {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .2s ease;
}
.img-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-viewer-close {
  position: absolute; top: calc(12px + var(--safe-top)); right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* 消息时间（相对时间，弱化） */
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }

/* ==================== 金币：转账 / 礼物 ==================== */

/* 聊天流中的金币卡片（对齐 App：橙/粉渐变） */
.coin-card {
  max-width: 250px;
  padding: 14px;
  border-radius: 18px 6px 18px 18px;
  color: #fff;
  box-shadow: 0 3px 8px rgba(239, 122, 42, .28);
}
.coin-transfer { background: linear-gradient(135deg, #F7A64A, #EF7A2A); }
.coin-gift {
  background: linear-gradient(135deg, #FF9BC0, #FF5E9C);
  box-shadow: 0 3px 8px rgba(255, 94, 156, .28);
}
.coin-card-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.coin-card-ico { display: flex; align-items: center; }
.coin-card-time { margin-left: auto; font-size: 10px; opacity: .85; font-weight: 400; }
.coin-amount { font-size: 24px; font-weight: 700; line-height: 1.2; margin-top: 10px; }
.coin-note { font-size: 12px; line-height: 1.3; margin-top: 6px; opacity: .92; }
.coin-gift-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.coin-gift-img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.coin-gift-emoji { font-size: 30px; line-height: 1; }
.coin-gift-name { font-size: 15px; font-weight: 600; }
.coin-gift-cost { font-size: 11px; opacity: .9; margin-top: 2px; }

/* 金币操作面板 */
.coin-balance-head {
  margin: 4px 0 16px; padding: 18px;
  border-radius: 16px; text-align: center;
  background: linear-gradient(135deg, rgba(247, 166, 74, .16), rgba(239, 122, 42, .12));
  border: 1px solid rgba(239, 122, 42, .25);
}
.coin-balance-label { font-size: 12px; color: var(--text-2); }
.coin-balance-num { font-size: 26px; font-weight: 800; color: #EF7A2A; margin-top: 4px; }
.coin-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.coin-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 16px 14px; border-radius: 14px; text-align: left;
  border: 1px solid var(--divider); background: var(--surface);
}
.coin-tile-transfer {
  background: linear-gradient(135deg, rgba(247, 166, 74, .14), rgba(239, 122, 42, .08));
  border-color: rgba(239, 122, 42, .28);
}
.coin-tile-gift {
  background: linear-gradient(135deg, rgba(255, 155, 192, .16), rgba(255, 94, 156, .08));
  border-color: rgba(255, 94, 156, .28);
}
.coin-tile-ico { font-size: 22px; }
.coin-tile-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.coin-tile-desc { font-size: 11px; color: var(--text-2); }
.coin-foot-tip { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 16px; }

/* 转账表单 */
.coin-balance-tip { font-size: 12.5px; color: var(--text-2); margin: 2px 0 14px; }
.coin-balance-tip b { color: #EF7A2A; font-size: 15px; }
.coin-field { margin-bottom: 12px; }
.coin-label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.coin-input {
  width: 100%; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--divider); background: var(--surface-alt);
  color: var(--text-1); font-size: 14px; outline: none;
  -webkit-appearance: none;
}
.coin-input:focus { border-color: #EF7A2A; }
.coin-err { color: var(--error); font-size: 12px; margin-bottom: 10px; }
.coin-primary-btn {
  width: 100%; padding: 13px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, #F7A64A, #EF7A2A);
  color: #fff; font-size: 15px; font-weight: 700;
}
.coin-primary-btn:disabled { opacity: .6; }

/* 礼物商城 */
.gift-shop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gift-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 6px 10px; border-radius: 14px;
  border: 1px solid var(--divider); background: var(--surface-alt);
}
.gift-item:active { transform: scale(.97); }
.gift-item-img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.gift-item-emoji { font-size: 30px; line-height: 1; height: 42px; display: flex; align-items: center; }
.gift-item-name {
  font-size: 12px; font-weight: 600; color: var(--text-1);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gift-item-price { font-size: 11.5px; font-weight: 700; color: #EF7A2A; }
