/* ============================================================
   RP Hub · 原生移动端设计系统 (mobile.css)
   抖音沉浸式深色 · 粉#FE2C55 / 青#25F4EE
   不修改 app.js / 引擎逻辑，仅 CSS 驱动 UI 重排
   ============================================================ */

/* ---- 设计变量 ---- */
:root {
  --pink: #FE2C55;
  --pink-dim: rgba(254,44,85,0.15);
  --cyan: #25F4EE;
  --cyan-dim: rgba(37,244,238,0.12);
  --bg-0: #0a0a0f;
  --bg-1: #12121a;
  --bg-2: #1a1a24;
  --bg-3: #22222e;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text-0: #f5f5f7;
  --text-1: #c5c5cf;
  --text-2: #7a7a88;
  --text-3: #4a4a58;
  --rphub-inset-top: 0px;
  --rphub-inset-bottom: 0px;
  --rphub-inset-left: 0px;
  --rphub-inset-right: 0px;
  --safe-t: max(env(safe-area-inset-top, 0px), var(--rphub-inset-top));
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--rphub-inset-bottom));
  --tab-h: 56px;
  --bar-h: 52px;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-xl: 24px;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-float: 0 8px 32px rgba(0,0,0,0.5);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --app-font-family: var(--font);
  --chat-font-size: 14px;
}

html[data-app-font="serif"] { --app-font-family: Georgia, "Noto Serif SC", "Songti SC", "SimSun", serif; }
html[data-app-font="system"] { --app-font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif; }

/* ---- 全局重置 ---- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg-0); color: var(--text-0);
  font-family: var(--app-font-family); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[v-cloak] { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
img { display: block; max-width: 100%; }

/* ---- #app 容器（全屏 flex 列） ---- */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  background: var(--bg-0);
}

/* 背景光晕 */
#app::before {
  content: ''; position: fixed; top: -30%; left: -20%;
  width: 70%; height: 50%;
  background: radial-gradient(circle, rgba(254,44,85,0.08), transparent 70%);
  pointer-events: none; z-index: 0;
}
#app::after {
  content: ''; position: fixed; bottom: -20%; right: -15%;
  width: 60%; height: 40%;
  background: radial-gradient(circle, rgba(37,244,238,0.06), transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.m-topbar {
  flex-shrink: 0; height: calc(var(--bar-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 12px;
  padding-left: 16px; padding-right: 16px;
  /* 顶部信息框使用实体背景，避免背景内容穿透导致标题和按钮难以辨认。 */
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-strong);
  position: relative; z-index: 10;
}
.m-topbar .m-back-placeholder {
  background: var(--bg-2) !important;
}
.m-topbar .m-back {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-2); color: var(--text-0);
  flex-shrink: 0;
}
.m-topbar .m-back svg { width: 20px; height: 20px; }
.m-topbar .m-title {
  flex: 1; font-size: 17px; font-weight: 600;
  color: var(--text-0); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-topbar .m-action {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-2); color: var(--text-1);
  flex-shrink: 0;
}
.m-topbar .m-action svg { width: 18px; height: 18px; }

/* ============================================================
   主内容区
   ============================================================ */
.m-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative; z-index: 1;
  scrollbar-width: none;
}
.m-content::-webkit-scrollbar { display: none; }
.m-pad { padding: 16px; padding-bottom: calc(20px + var(--safe-b)); }

/* ============================================================
   底部 Tab 栏
   ============================================================ */
.m-tabbar {
  flex-shrink: 0; height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  position: relative; z-index: 20;
}
.m-tabbar button {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); font-size: 10px; font-weight: 500;
  transition: color 0.2s;
}
.m-tabbar button svg { width: 22px; height: 22px; transition: all 0.2s; }
.m-tabbar button.active { color: var(--text-0); }
.m-tabbar button.active svg {
  filter: drop-shadow(0 0 6px rgba(254,44,85,0.7));
  transform: scale(1.08);
}
.m-tabbar button .ico-wrap {
  width: 32px; height: 28px; border-radius: 10px;
  display: grid; place-items: center; transition: all 0.2s;
}
.m-tabbar button.active .ico-wrap {
  background: linear-gradient(135deg, var(--pink-dim), var(--cyan-dim));
}

/* ============================================================
   通用组件
   ============================================================ */
/* 卡片 */
.m-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: 16px;
  box-shadow: var(--shadow-card); margin-bottom: 12px;
}
.m-card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  margin-bottom: 8px; transition: background 0.15s;
}
.m-card-row:active { background: var(--bg-2); }
.m-card-row .m-cr-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--pink-dim), var(--cyan-dim));
}
.m-card-row .m-cr-icon svg { width: 22px; height: 22px; color: var(--text-0); }
.m-card-row .m-cr-text { flex: 1; min-width: 0; }
.m-card-row .m-cr-title {
  font-size: 15px; font-weight: 600; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-card-row .m-cr-sub {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-card-row .m-cr-arrow { color: var(--text-3); flex-shrink: 0; }
.m-card-row .m-cr-arrow svg { width: 16px; height: 16px; }
/* 我的页：后台模型选中态 */
.m-card-row.m-cr-active { background: color-mix(in srgb, var(--pink) 12%, var(--bg-2)); }
.m-card-row.m-cr-active .m-cr-title { color: var(--pink); }
.m-cr-check { width: 20px; height: 20px; color: var(--pink); display: grid; place-items: center; flex-shrink: 0; }
.m-cr-check svg { width: 18px; height: 18px; }

/* 多个后台模型时使用选择框，避免“我的”页出现冗长卡片列表。 */
.m-backend-model-picker { margin-bottom: 0; }
.m-backend-model-picker .m-label { margin-top: 0; }
.m-backend-model-picker .m-input { appearance: auto; }

/* 按钮 */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: var(--radius-s);
  font-size: 15px; font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.m-btn:active { transform: scale(0.97); }
.m-btn-primary {
  background: linear-gradient(135deg, var(--pink), #ff4d6d);
  color: #fff;
}
.m-btn-ghost {
  background: var(--bg-2); color: var(--text-1);
  border: 1px solid var(--border);
}
.m-btn-danger {
  background: rgba(254,44,85,0.15); color: var(--pink);
  border: 1px solid rgba(254,44,85,0.3);
}
.m-btn-block { width: 100%; }

/* 输入框 */
.m-input, .m-textarea {
  width: 100%; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 12px 14px; color: var(--text-0);
  font-size: 15px; outline: none;
  transition: border-color 0.15s;
}
.m-input:focus, .m-textarea:focus { border-color: var(--pink); }
.m-textarea { min-height: 80px; resize: vertical; line-height: 1.6; }
.m-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-1); margin-bottom: 6px; margin-top: 14px;
}
.m-label:first-child { margin-top: 0; }
.m-field { margin-bottom: 14px; }

/* 区块标题 */
.m-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 20px 4px 10px;
}
.m-section-title:first-child { margin-top: 0; }

/* 空状态 */
.m-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 32px; text-align: center;
}
.m-empty .m-empty-icon {
  width: 72px; height: 72px; border-radius: 24px;
  display: grid; place-items: center; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--pink-dim), var(--cyan-dim));
}
.m-empty .m-empty-icon svg { width: 32px; height: 32px; color: var(--text-1); }
.m-empty .m-empty-title {
  font-size: 16px; font-weight: 600; color: var(--text-1); margin-bottom: 6px;
}
.m-empty .m-empty-sub {
  font-size: 13px; color: var(--text-2); line-height: 1.6; max-width: 260px;
}

/* ============================================================
   聊天视图（精致移动原生）
   ============================================================ */
.m-chat-wrap {
  display: flex; flex-direction: column; height: 100%;
  position: relative; overflow: hidden;
}

/* 背景微光 */
.m-chat-wrap::before {
  content: ''; position: absolute; top: -10%; left: -15%;
  width: 60%; height: 30%;
  background: radial-gradient(ellipse, rgba(254,44,85,0.06), transparent 70%);
  pointer-events: none; z-index: 0;
}
.m-chat-wrap::after {
  content: ''; position: absolute; bottom: -10%; right: -15%;
  width: 55%; height: 25%;
  background: radial-gradient(ellipse, rgba(37,244,238,0.04), transparent 70%);
  pointer-events: none; z-index: 0;
}

/* 消息列表 */
.m-chat-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 14px 8px; position: relative; z-index: 1;
  scrollbar-width: none;
}
.m-chat-list::-webkit-scrollbar { display: none; }

/* 空状态 */
.m-chat-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; padding: 40px 28px;
  text-align: center;
}
.m-chat-empty .m-ce-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  padding: 3px; margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(254,44,85,0.25);
}
.m-chat-empty .m-ce-avatar > * {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: var(--bg-1); display: grid; place-items: center;
}
.m-chat-empty .m-ce-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-chat-empty .m-ce-avatar svg { width: 40px; height: 40px; color: var(--text-2); }
.m-chat-empty .m-ce-title {
  font-size: 20px; font-weight: 700; color: var(--text-0); margin-bottom: 8px;
}
.m-chat-empty .m-ce-sub {
  font-size: 14px; color: var(--text-2); margin-bottom: 24px;
  line-height: 1.6; max-width: 280px;
}
.m-chat-empty .m-ce-sub .m-md-content { text-align: center; }
.m-chat-empty .m-ce-sub .m-md-content p { margin: 0 0 6px; }

/* 消息行 */
.m-msg {
  margin-bottom: 14px; display: flex; gap: 10px;
  position: relative; z-index: 1;
  animation: m-msg-in 0.3s ease-out;
}
.m-msg-user { flex-direction: row-reverse; }
@keyframes m-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 头像 */
.m-msg-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-3); overflow: hidden;
  display: grid; place-items: center;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.m-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-msg-avatar svg { width: 18px; height: 18px; color: var(--text-2); }

/* 消息列容器 */
.m-msg-col { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.m-msg-user .m-msg-col { align-items: flex-end; }

/* 气泡 */
.m-msg-bubble {
  max-width: 75%; padding: 11px 15px; border-radius: 20px;
  font-size: 15px; line-height: 1.65; word-break: break-word;
  position: relative;
}
.m-msg-user .m-msg-bubble {
  background: linear-gradient(135deg, var(--pink) 0%, #ff5a7a 100%);
  color: #fff; border-bottom-right-radius: 6px;
  box-shadow: 0 2px 12px rgba(254,44,85,0.3);
}
.m-msg-bubble.is-editing,
.m-msg-user .m-msg-bubble.is-editing {
  width: 100%; max-width: 100%;
}
.m-msg-ai .m-msg-bubble {
  width: 100%; max-width: 100%;
  background: var(--bg-2); color: var(--text-0);
  border: 1px solid var(--border); border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 气泡内 Markdown */
.m-msg-bubble .m-md-content { font-size: var(--chat-font-size); line-height: 1.65; }
.m-msg-bubble .m-md-content p { margin: 0 0 8px; }
.m-msg-bubble .m-md-content p:last-child { margin-bottom: 0; }
.m-msg-bubble .m-md-content pre {
  background: rgba(0,0,0,0.3); border-radius: 10px; padding: 12px;
  overflow-x: auto; margin: 8px 0; font-size: 13px;
  border: 1px solid var(--border);
}
.m-msg-bubble .m-md-content code {
  font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 13px;
}
.m-msg-bubble .m-md-content code:not(pre code) {
  background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px;
}
.m-msg-bubble .m-md-content ul, .m-msg-bubble .m-md-content ol { margin: 4px 0 8px; padding-left: 20px; }
.m-msg-bubble .m-md-content strong { font-weight: 700; }
.m-msg-bubble .m-md-content blockquote {
  border-left: 3px solid var(--pink); padding-left: 12px; margin: 8px 0; opacity: 0.85;
}
.m-msg-bubble .m-md-content img { max-width: 100%; border-radius: 10px; margin: 4px 0; }

/* 消息操作 */
.m-msg-actions {
  display: flex; gap: 2px; margin-top: 4px; padding: 0 4px;
  opacity: 0.7;
}
.m-msg-actions button {
  padding: 5px 10px; font-size: 11px; color: var(--text-2);
  border-radius: 8px; transition: all 0.15s; font-weight: 500;
}
.m-msg-actions button:active {
  color: var(--pink); background: var(--pink-dim); opacity: 1;
}

/* 时间戳 */
.m-msg-time {
  font-size: 10px; color: var(--text-3); margin-top: 2px; padding: 0 4px;
}

/* 打字动画 */
.m-typing { display: flex; gap: 5px; padding: 6px 4px; align-items: center; }
.m-typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-2); animation: m-bounce 1.4s infinite ease-in-out;
}
.m-typing span:nth-child(2) { animation-delay: 0.2s; }
.m-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes m-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* 思考链折叠卡 */
.m-think-card {
  max-width: 85%; margin-bottom: 6px; padding: 10px 14px;
  background: linear-gradient(135deg, rgba(37,244,238,0.08), rgba(254,44,85,0.05));
  border: 1px solid rgba(37,244,238,0.15); border-radius: 14px;
  cursor: pointer; transition: all 0.2s;
}
.m-think-card:active {
  border-color: rgba(37,244,238,0.3); background: linear-gradient(135deg, rgba(37,244,238,0.12), rgba(254,44,85,0.08));
}
.m-think-header { display: flex; align-items: center; gap: 6px; }
.m-think-label { font-size: 12px; color: var(--cyan); font-weight: 600; }
.m-think-body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.m-think-step { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12px; }
.m-think-step-type {
  padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 700;
  background: var(--cyan-dim); color: var(--cyan);
}
.m-think-step-title { color: var(--text-1); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-think-step-count { color: var(--text-3); font-size: 11px; }
.m-think-reasoning { margin-top: 8px; padding: 10px 12px; background: rgba(0,0,0,0.2); border-radius: 10px; border: 1px solid var(--border); max-height: 300px; overflow-y: auto; scrollbar-width: none; }
.m-think-reasoning::-webkit-scrollbar { display: none; }
.m-think-reasoning .m-md-content p { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: var(--text-1); }
.m-think-tools { margin-top: 8px; }
.m-think-tool { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--pink-dim); border-radius: 8px; margin-bottom: 4px; }
.m-think-tool-name { font-size: 11px; font-weight: 700; color: var(--pink); flex-shrink: 0; }
.m-think-tool-query { font-size: 12px; color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 图片附件 */
.m-msg-images { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; max-width: 85%; }
.m-msg-img { width: 140px; height: 140px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); }
.m-msg-user .m-msg-images { justify-content: flex-end; }

/* 消息编辑 */
.m-msg-edit {
  width: 100%; background: var(--bg-2); border: 2px solid var(--pink);
  border-radius: 14px; padding: 10px 14px; color: var(--text-0);
  font-size: var(--chat-font-size); outline: none; resize: none; min-height: 120px; max-height: 70dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: pan-y; line-height: 1.5; transition: height 0.12s ease;
}
.m-msg-edit-actions {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  gap: 8px; margin-top: 8px;
}
.m-msg-edit-actions button {
  min-height: 32px; padding: 6px 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 12px; font-weight: 600;
}
.m-msg-edit-actions .m-msg-edit-save { color: var(--text-0); background: var(--bg-3); }
.m-msg-edit-actions .m-msg-edit-regenerate { color: #fff; background: var(--pink); border-color: var(--pink); }
.m-msg-edit-actions .m-msg-edit-cancel { color: var(--text-2); background: transparent; }

/* 待发送图片 */
.m-pending-imgs { display: flex; gap: 6px; padding: 6px 0; overflow-x: auto; scrollbar-width: none; }
.m-pending-imgs::-webkit-scrollbar { display: none; }
.m-pending-img { position: relative; flex-shrink: 0; }
.m-pending-img img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.m-pending-img button {
  position: absolute; top: -5px; right: -5px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--pink); color: #fff;
  font-size: 13px; display: grid; place-items: center; border: 2px solid var(--bg-0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* 聊天输入栏 */
.m-chat-input {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px; padding-bottom: calc(10px + var(--safe-b));
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  position: relative; z-index: 5;
}
.m-chat-input .m-ci-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--bg-2); color: var(--text-1);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.m-chat-input .m-ci-btn:active { transform: scale(0.92); background: var(--bg-3); }
.m-chat-input .m-ci-btn svg { width: 19px; height: 19px; }
.m-chat-input .m-ci-textarea {
  flex: 1; max-height: 120px; min-height: 38px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 9px 16px;
  color: var(--text-0); font-size: var(--chat-font-size); line-height: 1.4;
  outline: none; resize: none; overflow-y: auto;
  scrollbar-width: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.m-chat-input .m-ci-textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(254,44,85,0.1);
}
.m-chat-input .m-ci-textarea::-webkit-scrollbar { display: none; }
.m-chat-input .m-ci-send {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pink) 0%, #ff5a7a 100%); color: #fff;
  box-shadow: 0 4px 16px rgba(254,44,85,0.4);
  transition: all 0.15s;
}
.m-chat-input .m-ci-send:active { transform: scale(0.88); box-shadow: 0 2px 8px rgba(254,44,85,0.3); }
.m-chat-input .m-ci-send svg { width: 18px; height: 18px; }
.m-chat-input .m-ci-send.m-stop {
  background: var(--bg-3); box-shadow: none; border: 1px solid var(--border);
}

/* ============================================================
   角色卡列表
   ============================================================ */
.m-char-grid {
  display: flex; flex-direction: column; gap: 10px;
}
.m-char-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  transition: border-color 0.15s, background 0.15s;
}
.m-char-card:active { background: var(--bg-2); }
.m-char-card.m-active { border-color: var(--pink); background: var(--pink-dim); }
.m-char-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-3); overflow: hidden;
  display: grid; place-items: center;
}
.m-char-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-char-avatar svg { width: 24px; height: 24px; color: var(--text-2); }
.m-char-info { flex: 1; min-width: 0; }
.m-char-name {
  font-size: 15px; font-weight: 600; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-char-desc {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-char-actions { display: flex; gap: 4px; flex-shrink: 0; }
.m-char-actions button {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text-1);
}
.m-char-actions button svg { width: 16px; height: 16px; }
.m-char-actions .m-fav-on { color: #ffd24a; }
.m-char-square-row { display:flex; align-items:center; gap:7px; margin-top:7px; min-width:0; }
.m-char-square-status { display:inline-flex; align-items:center; min-height:20px; padding:2px 7px; border-radius:999px; font-size:10px; font-weight:700; line-height:1; color:var(--text-2); background:var(--bg-3); border:1px solid var(--border); white-space:nowrap; }
.m-char-square-status.is-pending { color:#f6c453; background:rgba(246,196,83,.1); border-color:rgba(246,196,83,.28); }
.m-char-square-status.is-published { color:var(--cyan); background:var(--cyan-dim); border-color:rgba(37,244,238,.28); }
.m-char-square-status.is-offline { color:var(--text-2); }
.m-char-square-status.is-draft { color:var(--text-3); }
.m-char-square-action { min-height:22px; padding:2px 7px; border-radius:7px; color:var(--pink); background:rgba(254,44,85,.08); border:1px solid rgba(254,44,85,.22); font-size:10px; font-weight:700; white-space:nowrap; }
.m-char-square-action:disabled { opacity:.55; }
.m-square-publish-sheet { z-index:102; }
.m-square-publish-copy { margin:0 0 16px; color:var(--text-1); font-size:13px; line-height:1.65; }
.m-required { color:var(--pink); font-size:11px; font-weight:600; }

/* ============================================================
   底部弹层（Bottom Sheet）
   ============================================================ */
.m-sheet-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.m-sheet {
  position: fixed; left: 0; right: 0; bottom: calc(56px + var(--safe-b)); z-index: 101;
  max-height: 88dvh; overflow-y: auto;
  background: var(--bg-1); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px;
  box-shadow: var(--shadow-float);
  scrollbar-width: none;
}
.m-sheet::-webkit-scrollbar { display: none; }
.m-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.m-sheet-title {
  font-size: 18px; font-weight: 700; color: var(--text-0);
}
.m-sheet-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text-1);
}
.m-sheet-close svg { width: 16px; height: 16px; }

/* 聊天工具集中面板 */
.m-chat-tools-sheet {
  padding: 0 14px calc(14px + var(--safe-b));
  overflow: hidden;
}
.m-chat-tools-handle {
  width: 36px; height: 4px; margin: 8px auto 10px;
  border-radius: 999px; background: var(--text-3);
}
.m-chat-tools-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 14px;
}
.m-chat-tools-title { font-size: 17px; font-weight: 700; color: var(--text-0); }
.m-chat-tools-subtitle { margin-top: 2px; font-size: 12px; color: var(--text-2); }
.m-chat-tools-grid {
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
.m-chat-tool-card {
  width: 100%; min-height: 64px; padding: 10px 12px;
  display: flex; align-items: center; gap: 11px; text-align: left;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-2); color: var(--text-0);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.m-chat-tool-card:active:not(:disabled) { transform: scale(0.985); background: var(--bg-3); }
.m-chat-tool-card:disabled { opacity: 0.45; }
.m-chat-tool-card-toggle.is-on {
  border-color: rgba(254,44,85,0.42);
  background: linear-gradient(135deg, rgba(254,44,85,0.14), rgba(37,244,238,0.08));
}
.m-chat-tool-card-toggle .m-toggle { margin-left: auto; }
.m-chat-tool-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  flex-shrink: 0; border-radius: 10px;
}
.m-chat-tool-icon svg { width: 19px; height: 19px; }
.m-chat-tool-icon-pink { color: var(--pink); background: var(--pink-dim); }
.m-chat-tool-icon-cyan { color: var(--cyan); background: rgba(37,244,238,0.13); }
.m-chat-tool-icon-gold { color: #ffd24a; background: rgba(255,210,74,0.13); }
.m-chat-tool-icon-image { color: #7cffa0; background: rgba(124,255,160,0.13); }
.m-chat-tool-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.m-chat-tool-copy strong { font-size: 14px; font-weight: 600; color: var(--text-0); }
.m-chat-tool-copy small { overflow: hidden; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   设置项
   ============================================================ */
.m-setting-group { margin-bottom: 12px; }
.m-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  margin-bottom: 6px;
}
.m-setting-row .m-sr-label {
  font-size: 14px; color: var(--text-0); font-weight: 500;
}
.m-setting-row .m-sr-value {
  font-size: 13px; color: var(--text-2);
}
.m-setting-row .m-sr-input {
  flex: 1; max-width: 60%; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; color: var(--text-0); font-size: 14px; outline: none;
}
.m-setting-row .m-sr-input:focus { border-color: var(--pink); }

/* Toggle 开关 */
.m-toggle {
  position: relative; width: 44px; height: 26px;
  border-radius: 13px; background: var(--bg-3);
  transition: background 0.2s; flex-shrink: 0; cursor: pointer;
}
.m-toggle.on { background: var(--pink); }
.m-toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.m-toggle.on::after { transform: translateX(18px); }

/* ============================================================
   生图设置页（m-ig-*）· 现代重设计
   - 使用 14px 圆角（--radius-m）让卡片更柔和
   - 选中态使用粉→青渐变 / 实心粉色填充，提升视觉冲击
   - 数字 / 价格使用等宽数字字体（tnum）
   - 自定义下拉通过 m-ig-select-trigger 拉入深色主题
   ============================================================ */
.m-ig-page { padding-top: 4px; }

/* 区块标题：略微加大字距、让中线更稳 */
.m-ig-page .m-section-title {
  font-size: 13px;
  letter-spacing: 0.6px;
  margin: 22px 4px 12px;
}
.m-ig-page .m-card .m-label {
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 8px;
}
.m-ig-page .m-card .m-label:first-child { margin-top: 0; }

/* 服务加载/错误/空态提示 */
.m-ig-status {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius-m);
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); line-height: 1.5;
}
.m-ig-status-error {
  color: var(--pink);
  border-color: rgba(254,44,85,0.35);
  background: linear-gradient(135deg, rgba(254,44,85,0.12), rgba(254,44,85,0.04));
}
.m-ig-status-empty {
  border-style: dashed;
  border-color: var(--border-strong);
  color: var(--text-3);
}
.m-ig-retry-btn { margin-left: auto; padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.m-ig-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--pink-dim); border-top-color: var(--pink);
  animation: m-ig-spin 0.8s linear infinite;
}
@keyframes m-ig-spin { to { transform: rotate(360deg); } }

/* 服务单选列表 */
.m-ig-service-list { display: flex; flex-direction: column; gap: 10px; }
.m-ig-service {
  position: relative;
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color 0.2s, background 0.2s, transform 0.1s, box-shadow 0.2s;
  overflow: hidden;
}
.m-ig-service:active { background: var(--bg-3); }
.m-ig-service::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: transparent;
  transition: background 0.2s;
}
.m-ig-service-on {
  border-color: var(--pink);
  background: linear-gradient(135deg, rgba(254,44,85,0.14), rgba(37,244,238,0.06));
  box-shadow: 0 4px 18px rgba(254,44,85,0.18);
}
.m-ig-service-on::before { background: linear-gradient(180deg, var(--pink), var(--cyan)); }
.m-ig-service-radio {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--text-3);
  display: grid; place-items: center;
  transition: border-color 0.2s, background 0.2s;
}
.m-ig-service-radio::after {
  content: ''; width: 9px; height: 9px;
  border-radius: 50%; background: var(--pink);
  transform: scale(0); transition: transform 0.2s;
}
.m-ig-service-on .m-ig-service-radio {
  border-color: var(--pink);
  background: rgba(254,44,85,0.1);
}
.m-ig-service-on .m-ig-service-radio::after { transform: scale(1); }
.m-ig-service-name {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600; color: var(--text-0);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-ig-service-price {
  flex-shrink: 0;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  font-feature-settings: "tnum";
}
.m-ig-service-on .m-ig-service-price {
  color: var(--pink);
  background: rgba(254,44,85,0.12);
  border-color: rgba(254,44,85,0.3);
}

/* 高分辨率开关行（金色警示） */
.m-ig-hires-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(255,210,74,0.14), rgba(255,143,0,0.06));
  border: 1px solid rgba(255,210,74,0.32);
  border-radius: var(--radius-m);
  position: relative; overflow: hidden;
}
.m-ig-hires-row::before {
  content: '✨';
  position: absolute; right: 56px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px; opacity: 0.35;
  pointer-events: none;
}
.m-ig-hires-row .m-toggle.on {
  background: linear-gradient(135deg, #ffd24a, #ff8c00);
  box-shadow: 0 2px 8px rgba(255,143,0,0.35);
}
.m-ig-hires-copy { flex: 1; min-width: 0; padding-right: 24px; }
.m-ig-hires-title { font-size: 14px; font-weight: 700; color: #ffd24a; }
.m-ig-hires-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 档位价格卡 */
.m-ig-price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.m-ig-price {
  position: relative;
  padding: 12px 8px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color 0.2s, background 0.2s, opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.m-ig-price-on {
  border-color: var(--pink);
  background: linear-gradient(180deg, rgba(254,44,85,0.20), rgba(254,44,85,0.05));
  box-shadow: inset 0 0 0 1px var(--pink), 0 4px 14px rgba(254,44,85,0.18);
  transform: translateY(-1px);
}
.m-ig-price-on::before {
  content: '已选';
  position: absolute; top: 0; right: 8px;
  transform: translateY(-50%);
  padding: 1px 6px;
  font-size: 9px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--pink), #ff4d6d);
  border-radius: 6px; letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(254,44,85,0.4);
}
.m-ig-price-off { opacity: 0.4; filter: saturate(0.6); }
.m-ig-price-name {
  font-size: 12px; color: var(--text-2);
  margin-bottom: 4px; font-weight: 700; letter-spacing: 0.3px;
}
.m-ig-price-on .m-ig-price-name { color: var(--pink); }
.m-ig-price-val {
  font-size: 18px; font-weight: 800; color: var(--text-0);
  font-feature-settings: "tnum"; letter-spacing: -0.5px;
}
.m-ig-price-val span {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  margin-left: 3px; letter-spacing: 0;
}

/* 档位选择 */
.m-ig-tier-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-ig-tier {
  padding: 12px 8px;
  font-size: 14px; font-weight: 600;
  color: var(--text-1); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  position: relative;
}
.m-ig-tier:active:not(:disabled) { background: var(--bg-3); transform: scale(0.98); }
.m-ig-tier-on {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--pink), #ff4d6d);
  box-shadow: 0 4px 14px rgba(254,44,85,0.32);
}
.m-ig-tier:disabled { opacity: 0.35; cursor: not-allowed; filter: saturate(0.5); }
.m-ig-tier-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; padding-left: 2px; }

/* 方向选择 */
.m-ig-orient-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-ig-orient {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.1s, box-shadow 0.2s;
}
.m-ig-orient:active { background: var(--bg-3); }
.m-ig-orient-on {
  color: var(--pink);
  border-color: var(--pink);
  background: linear-gradient(180deg, rgba(254,44,85,0.18), rgba(254,44,85,0.04));
  box-shadow: inset 0 0 0 1px var(--pink);
}
.m-ig-orient-icon {
  border-radius: 4px;
  background: currentColor;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}
.m-ig-orient-on .m-ig-orient-icon { opacity: 1; transform: scale(1.1); }
.m-ig-oi-portrait { width: 14px; height: 22px; }
.m-ig-oi-landscape { width: 22px; height: 14px; }
.m-ig-oi-square { width: 18px; height: 18px; }
.m-ig-orient-ratio {
  font-size: 10px; font-weight: 600;
  color: var(--text-3); letter-spacing: 0.5px;
}
.m-ig-orient-on .m-ig-orient-ratio { color: rgba(254,44,85,0.8); }

/* 当前选择/预计消耗摘要 */
.m-ig-summary {
  margin-top: 12px; padding: 12px 14px;
  background: linear-gradient(135deg, rgba(254,44,85,0.10), rgba(37,244,238,0.04));
  border: 1px solid rgba(254,44,85,0.20);
  border-radius: var(--radius-m);
  font-size: 13px; color: var(--text-1);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.m-ig-summary::before {
  content: '◆';
  color: var(--pink);
  font-size: 11px;
}
.m-ig-summary strong { color: var(--text-0); font-weight: 700; }

/* 数量网格 */
.m-ig-count-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.m-ig-count {
  padding: 12px 0;
  font-size: 15px; font-weight: 700;
  color: var(--text-1); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.1s, box-shadow 0.2s;
  font-feature-settings: "tnum";
}
.m-ig-count:active { background: var(--bg-3); transform: scale(0.96); }
.m-ig-count-on {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--pink), #ff4d6d);
  box-shadow: 0 4px 14px rgba(254,44,85,0.32);
}

/* 自定义下拉（生图风格）拉入深色主题 */
.m-ig-select-trigger {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-0) !important;
  border-radius: var(--radius-m) !important;
  padding: 12px 14px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transition: border-color 0.2s, background 0.2s;
}
.m-ig-select-trigger:hover { border-color: var(--border-strong) !important; }
.m-ig-select-trigger:focus,
.m-ig-select-trigger[aria-expanded="true"] {
  border-color: var(--pink) !important;
  box-shadow: 0 0 0 3px rgba(254,44,85,0.15) !important;
  outline: none !important;
}
.m-ig-select-trigger svg { color: var(--text-2) !important; }
.m-ig-select-menu {
  background: var(--bg-1) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-m) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6) !important;
  padding: 6px !important;
}
.m-ig-select-menu > div {
  color: var(--text-1) !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  transition: background 0.15s, color 0.15s;
}
.m-ig-select-menu > div:hover { background: var(--bg-2) !important; color: var(--text-0) !important; }
.m-ig-select-menu [aria-selected="true"],
.m-ig-select-menu .bg-primary-50,
.m-ig-select-menu .text-primary-700 {
  background: var(--pink-dim) !important;
  color: var(--pink) !important;
}

/* ============================================================
   Toast
   ============================================================ */
.m-toast-wrap {
  position: fixed; top: calc(var(--safe-t) + 8px); left: 50%;
  transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: 100%; max-width: 360px;
}
.m-toast {
  padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 500; text-align: center;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: var(--shadow-float);
}
.m-toast-success { background: #124b4d; color: #e7ffff; border: 1px solid var(--cyan); }
.m-toast-error { background: #551526; color: #fff0f3; border: 1px solid var(--pink); }
.m-toast-info { background: #272a33; color: #fff; border: 1px solid #515564; }

/* ============================================================
   FAB 浮动操作按钮
   ============================================================ */
.m-fab {
  position: fixed; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; z-index: 15;
  background: linear-gradient(135deg, var(--pink), #ff5a7a);
  color: #fff; box-shadow: 0 4px 16px rgba(254,44,85,0.4);
  transition: transform 0.15s;
}
.m-fab:active { transform: scale(0.9); }
.m-fab svg { width: 24px; height: 24px; }

/* ============================================================
   iframe 全屏视图（创作三件套）
   ============================================================ */
.m-iframe-full {
  position: fixed; inset: 0;
  z-index: 50;
  background: var(--bg-0);
}
.m-iframe-full iframe { width: 100%; height: 100%; border: none; }

/* Keep the workshop's own header and model controls below the parent title bar. */
#app:has(.m-iframe-full > iframe[src="character/mobile.html"]) .m-iframe-full {
  top: calc(var(--bar-h) + var(--safe-t));
}

/* The character workshop owns the full viewport and exposes its own return control. */
#app:has(.m-iframe-full > iframe[src="character/mobile.html"]) .m-tabbar { display: none; }
.m-iframe-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-0); color: var(--text-2); font-size: 14px;
}
.m-iframe-back {
  position: fixed; top: calc(var(--safe-t) + 10px); left: 10px;
  z-index: 60; display: flex; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: 20px;
  background: rgba(10,10,15,0.85); backdrop-filter: blur(20px);
  border: 1px solid var(--border); color: var(--text-0);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-card);
}
.m-iframe-back svg { width: 18px; height: 18px; }
.m-iframe-back:active { transform: scale(0.95); }

/* ============================================================
   通用工具类
   ============================================================ */
.m-flex { display: flex; }
.m-flex-1 { flex: 1; }
.m-gap-8 { gap: 8px; }
.m-gap-12 { gap: 12px; }
.m-mt-8 { margin-top: 8px; }
.m-mt-12 { margin-top: 12px; }
.m-mt-16 { margin-top: 16px; }
.m-mt-20 { margin-top: 20px; }
.m-text-dim { color: var(--text-2); }
.m-text-sm { font-size: 13px; }
.m-text-xs { font-size: 11px; }
.m-text-center { text-align: center; }
.m-mb-8 { margin-bottom: 8px; }
.m-mb-12 { margin-bottom: 12px; }
.m-mb-16 { margin-bottom: 16px; }
.m-hidden { display: none !important; }
.m-flex-center { display: flex; align-items: center; justify-content: center; }

/* ============================================================
   隐藏桌面专用元素（原模板内可能的残留）
   ============================================================ */
.app-sidebar, .mobile-overlay, .resize-handle, .collapse-toggle { display: none !important; }

/* ============================================================
   Markdown 渲染覆盖
   ============================================================ */
.m-md-content { font-size: 15px; line-height: 1.65; color: var(--text-0); }
.m-md-content p { margin: 0 0 8px; }
.m-md-content p:last-child { margin-bottom: 0; }
.m-md-content ul, .m-md-content ol { margin: 4px 0 8px; padding-left: 20px; }
.m-md-content li { margin-bottom: 4px; }
.m-md-content strong { font-weight: 700; }
.m-md-content em { font-style: italic; }
.m-md-content code {
  font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 13px;
}
.m-md-content code:not(pre code) {
  background: var(--bg-3); padding: 2px 6px; border-radius: 4px;
}
.m-md-content pre {
  background: var(--bg-0) !important; border-radius: 8px;
  padding: 12px; overflow-x: auto; margin: 8px 0;
}
.m-md-content pre code { background: none !important; padding: 0; }
.m-md-content blockquote {
  border-left: 3px solid var(--pink); padding-left: 12px;
  margin: 8px 0; color: var(--text-1);
}
.m-md-content img { max-width: 100%; border-radius: 8px; margin: 4px 0; }
.m-md-content h1, .m-md-content h2, .m-md-content h3 {
  font-weight: 700; margin: 12px 0 8px;
}
.m-md-content h1 { font-size: 20px; }
.m-md-content h2 { font-size: 18px; }
.m-md-content h3 { font-size: 16px; }
.m-md-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.m-md-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.m-md-content th, .m-md-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.m-md-content th { background: var(--bg-3); font-weight: 700; }

/* ============================================================
   聊天页移动原生组件
   ============================================================ */
.m-msg-col { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.m-msg-user .m-msg-col { align-items: flex-end; }
.m-think-card { max-width: 90%; margin-bottom: 6px; padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.m-think-card:active { background: var(--bg-3); }
.m-think-header { display: flex; align-items: center; gap: 6px; }
.m-think-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.m-think-body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.m-think-step { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
.m-think-step-type { padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; background: var(--cyan-dim); color: var(--cyan); }
.m-think-step-title { color: var(--text-1); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-think-step-count { color: var(--text-3); font-size: 11px; }
.m-think-reasoning { margin-top: 8px; padding: 10px 12px; background: rgba(0,0,0,0.2); border-radius: 10px; border: 1px solid var(--border); max-height: 300px; overflow-y: auto; scrollbar-width: none; }
.m-think-reasoning::-webkit-scrollbar { display: none; }
.m-think-reasoning .m-md-content p { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: var(--text-1); }
.m-think-tools { margin-top: 8px; }
.m-think-tool { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--pink-dim); border-radius: 8px; margin-bottom: 4px; }
.m-think-tool-name { font-size: 11px; font-weight: 700; color: var(--pink); flex-shrink: 0; }
.m-think-tool-query { font-size: 12px; color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-msg-images { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; max-width: 90%; }
.m-msg-ai .m-msg-images { width: 100%; max-width: 100%; }
.m-msg-img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.m-msg-user .m-msg-images { justify-content: flex-end; }
.m-pending-imgs { display: flex; gap: 6px; padding: 4px 0; overflow-x: auto; scrollbar-width: none; }
.m-pending-imgs::-webkit-scrollbar { display: none; }
.m-pending-img { position: relative; flex-shrink: 0; }
.m-pending-img img { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.m-pending-img button { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 12px; display: grid; place-items: center; border: 2px solid var(--bg-0); }

/* ============================================================
   桌面组件深色覆盖（让原站 ModalShell / 编辑器组件匹配移动端深色主题）
   ============================================================ */

/* 背景 */
.bg-white, .bg-white\/30, .bg-white\/40, .bg-white\/50, .bg-white\/60, .bg-white\/70, .bg-white\/80, .bg-white\/90 {
  background: var(--bg-1) !important;
}
.bg-gray-50, .bg-gray-50\/30, .bg-gray-50\/50, .bg-gray-100 {
  background: var(--bg-2) !important;
}
.bg-gray-200 { background: var(--bg-3) !important; }
.bg-black\/50, .bg-black\/40 { background: rgba(0,0,0,0.65) !important; backdrop-filter: blur(6px) !important; }

/* primary 系列 */
.bg-primary-50, .bg-primary-100 { background: rgba(254,44,85,0.12) !important; }
.text-primary-600, .text-primary-700 { color: var(--pink) !important; }
.border-primary-100, .border-primary-200 { border-color: rgba(254,44,85,0.2) !important; }

/* 文字 */
.text-gray-900, .text-gray-800, .text-gray-700 { color: var(--text-0) !important; }
.text-gray-600, .text-gray-500 { color: var(--text-1) !important; }
.text-gray-400, .text-gray-300 { color: var(--text-2) !important; }

/* 边框 */
.border-gray-200, .border-gray-300, .border-gray-100 { border-color: var(--border) !important; }

/* 输入 */
input[type="text"], input[type="number"], input[type="password"], input[type="url"],
input[type="range"], textarea, select {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  color: var(--text-0) !important;
  padding: 10px 14px !important;
  outline: none !important;
}
input:focus, textarea:focus, select:focus { border-color: var(--pink) !important; }
input::placeholder, textarea::placeholder { color: var(--text-3) !important; }
input[type="range"] { accent-color: var(--pink) !important; }

/* Modal 组件 */
.editor-modal-header {
  background: var(--bg-2) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 14px 20px !important;
  display: flex !important; align-items: center !important; justify-content: space-between !important;
}
.modal-close-button {
  width: 32px !important; height: 32px !important; border-radius: 8px !important;
  display: grid !important; place-items: center !important;
  background: var(--bg-3) !important; color: var(--text-1) !important;
  border: none !important; cursor: pointer !important;
}
.modal-close-button:hover { background: var(--pink) !important; color: #fff !important; }
.modal-close-button svg { width: 16px !important; height: 16px !important; }

.modal-primary-button {
  background: linear-gradient(135deg, var(--pink), #ff5a7a) !important;
  color: #fff !important; border: none !important;
  border-radius: 10px !important; padding: 10px 20px !important;
  font-weight: 600 !important; font-size: 14px !important; cursor: pointer !important;
}
.modal-primary-button:active { transform: scale(0.97) !important; }

.modal-secondary-button {
  background: var(--bg-3) !important; color: var(--text-1) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important; padding: 10px 20px !important;
  font-weight: 600 !important; font-size: 14px !important; cursor: pointer !important;
}

/* 开关 */
.settings-toggle { background: var(--bg-3) !important; }
.settings-toggle::after { background: #fff !important; }
input:checked + .settings-toggle { background: var(--pink) !important; }

/* 滚动条 */
.custom-scrollbar::-webkit-scrollbar { width: 0 !important; }

/* 标签 */
.animate-fade-in { animation: m-fade-in 0.2s ease-out; }
@keyframes m-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* 确保 modal 层级在 tabbar 之上 */
.fixed.inset-0.z-50, .fixed.inset-0[class*="z-50"] { z-index: 200 !important; }

/* 模态框面板在手机上全宽 */
.fixed.inset-0 .max-w-3xl, .fixed.inset-0 .max-w-2xl, .fixed.inset-0 .max-w-xl {
  max-width: 100% !important; width: 100% !important;
  max-height: 92dvh !important;
  border-radius: 20px 20px 0 0 !important;
  margin-top: auto !important;
}

/* ============================================================
   桌面 modal 组件深色补丁
   覆盖 character-editor / context-viewer / story-branch / ui-template-pending 等
   ============================================================ */
/* 带透明度的浅色背景 → 深色（桌面 modal header/footer/tab 容器常用） */
.bg-gray-50\/80, .bg-gray-50\/60, .bg-gray-50\/55, .bg-gray-50\/40, .bg-gray-50\/30,
.bg-gray-200\/50, .bg-gray-200\/60, .bg-gray-200\/80,
.bg-white\/50, .bg-white\/40, .bg-white\/30, .bg-white\/20, .bg-white\/10, .bg-white\/5,
.bg-gray-100\/50, .bg-gray-100\/80, .bg-gray-100\/60 { background: var(--bg-2) !important; }

/* ring-white → 边框色 */
.ring-white { --tw-ring-color: var(--border) !important; }

/* 桌面蓝色系（ui-template-pending "正在构建" 等）→ 移动粉色主题 */
.text-blue-600, .text-blue-700, .text-blue-500, .text-blue-600\/80, .text-blue-500\/80 { color: var(--pink) !important; }
.bg-blue-50, .bg-blue-100, .bg-blue-500\/10 { background: var(--pink-dim) !important; }
.border-blue-200, .border-blue-300 { border-color: rgba(254,44,85,0.3) !important; }

/* character-editor tab 激活态（bg-white.text-primary-600 在深色 modal 上突出） */
button.bg-white.text-primary-600 { background: var(--pink-dim) !important; color: var(--pink) !important; }

/* ui-template-pending dots */
.ui-build-dots i { background: var(--pink) !important; }

/* details/summary（正则高级选项等折叠块） */
summary.bg-gray-50, summary.bg-gray-100, summary.bg-gray-200\/50 { background: var(--bg-3) !important; }
details.border-gray-200 { border-color: var(--border) !important; }

/* segmented-switch 分段控件（角色视角等） */
.segmented-switch { background: var(--bg-3) !important; }
.segmented-switch__option.is-active, .segmented-switch__option.is-active span { color: var(--pink) !important; }
.segmented-switch__indicator { background: var(--bg-1) !important; }

/* generation-timer / loading 蓝色 */
.embedded-loading-spinner { color: var(--pink) !important; }

/* UI 模板“分析中”状态卡深色适配 */
.ui-template-pending-card {
  color: var(--text-0) !important;
  background: linear-gradient(135deg, rgba(34,34,46,0.98), rgba(26,26,36,0.98)) !important;
  border-color: rgba(254,44,85,0.28) !important;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04) !important;
}
.ui-template-pending-icon {
  color: var(--pink) !important;
  background: var(--pink-dim) !important;
  border-color: rgba(254,44,85,0.32) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08) !important;
}
.ui-template-pending-icon .live-dots {
  color: var(--cyan) !important;
  background: var(--bg-1) !important;
  border-color: rgba(37,244,238,0.26) !important;
  box-shadow: 0 3px 8px rgba(37,244,238,0.12) !important;
}
.ui-template-pending-title { color: var(--text-0) !important; }
.m-msg-actions button:disabled { color: var(--text-3); opacity: 0.45; }

/* 续写状态：被截断、续写中、成功和失败均保留在对应消息旁。 */
.m-continuation-status {
  display: inline-flex; align-items: center; gap: 7px;
  width: fit-content; max-width: 100%;
  margin: 0 0 7px 2px; padding: 5px 9px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg-2); color: var(--text-1);
  font-size: 12px; line-height: 1.35;
}
.m-continuation-status-icon { display: inline-flex; align-items: center; min-width: 14px; justify-content: center; font-weight: 800; }
.m-continuation-status.is-running { color: var(--cyan); border-color: rgba(37,244,238,0.28); }
.m-continuation-status.is-success { color: #76e3a5; border-color: rgba(118,227,165,0.3); }
.m-continuation-status.is-error { color: var(--pink); border-color: rgba(254,44,85,0.32); }
.m-continuation-status .m-typing { display: inline-flex; gap: 2px; }
.m-continuation-status .m-typing span { width: 4px; height: 4px; }

@media (prefers-reduced-motion: reduce) {
  .m-continuation-status .m-typing span { animation: none; opacity: 1; }
}

/* ============================================================
   剧情分支 modal 深色（story-route-* 来自桌面 styles.css 2563-2860）
   ============================================================ */
.story-route-modal-body { background: var(--bg-1) !important; }
.story-route-map-panel { background: var(--bg-1) !important; border-color: var(--border) !important; }
.story-route-map-scroll { background: var(--bg-2) !important; }
.story-route-canvas { background-color: var(--bg-2) !important; background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px) !important; }
.story-route-link { stroke: var(--border) !important; }
.story-route-link.is-active { stroke: var(--cyan) !important; }
.story-route-link.is-selected { stroke: var(--pink) !important; }
.story-route-node { background: var(--bg-2) !important; border-color: var(--border) !important; color: var(--text-0) !important; box-shadow: 0 0 0 1px var(--border) !important; }
.story-route-node:hover { border-color: var(--cyan) !important; box-shadow: 0 0 0 1px rgba(37,244,238,0.35) !important; }
.story-route-node.is-on-route { border-color: rgba(37,244,238,0.3) !important; }
.story-route-node.is-selected { border-color: var(--pink) !important; }
.story-route-node.is-current { border-color: var(--pink) !important; background: var(--pink-dim) !important; }
.story-route-node-copy strong { color: var(--text-0) !important; }
.story-route-node-copy small { color: var(--text-2) !important; }
.story-route-node-type { background: var(--bg-3) !important; color: var(--cyan) !important; }
.story-route-node-current { background: var(--pink) !important; color: #fff !important; border-color: var(--pink) !important; }
.story-route-actions { border-top-color: var(--border) !important; }
.story-route-enter-button { background: var(--pink) !important; color: #fff !important; border-color: transparent !important; }
.story-route-enter-button:hover:not(:disabled) { background: #ff5a7a !important; }
.story-route-enter-button:disabled { background: var(--bg-3) !important; color: var(--text-3) !important; }
.story-route-edit-button, .story-route-delete-button { background: var(--bg-2) !important; color: var(--text-1) !important; border-color: var(--border) !important; }
.story-route-edit-button:hover:not(:disabled), .story-route-delete-button:hover:not(:disabled) { background: var(--bg-3) !important; }
.story-route-delete-button { color: var(--pink) !important; }
.story-route-delete-button:hover:not(:disabled) { background: rgba(254,44,85,0.12) !important; border-color: var(--pink) !important; }
.story-route-edit-button:disabled, .story-route-delete-button:disabled { color: var(--text-3) !important; }
.story-route-node-checkpoint { background: var(--cyan) !important; }
.story-route-node.is-current .story-route-node-checkpoint { background: var(--pink) !important; }

/* modal 内 label 辅助色 */
label.text-gray-500, label.text-gray-400, .label-text { color: var(--text-1) !important; }

/* ============================================================
   「我的」页（me_hub）重排版 — 主题统一 / 分类管理 / 积分卡片
   ============================================================ */

/* 区块标题：左侧粉→青渐变 accent 条，统一全站分区视觉 */
.m-section-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 13px; border-radius: 2px;
  margin-right: 8px; vertical-align: -1px;
  background: linear-gradient(180deg, var(--pink), var(--cyan));
}

/* 我的页在宽屏下居中限宽，避免在大屏被拉得过宽 */
@media (min-width: 600px) {
  .m-me-hub { max-width: 560px; margin: 0 auto; }
}

/* 用户资料卡 */
.m-profile-card {
  width: 100%; display: flex; align-items: center; gap: 14px;
  margin: 0 0 18px; padding: 16px; text-align: left;
  color: var(--text-0); border: 1px solid rgba(254,44,85,0.22);
  border-radius: var(--radius-l);
  background: linear-gradient(135deg, rgba(254,44,85,0.14), rgba(37,244,238,0.07));
  box-shadow: var(--shadow-card);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.m-profile-card:active {
  transform: scale(0.985);
  border-color: rgba(37,244,238,0.48);
  background: linear-gradient(135deg, rgba(254,44,85,0.2), rgba(37,244,238,0.11));
}
.m-profile-card .mp-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0; display: grid; place-items: center;
  background: var(--bg-3); color: var(--text-2);
  border: 2px solid transparent;
  background-image: linear-gradient(var(--bg-3), var(--bg-3)), linear-gradient(135deg, var(--pink), var(--cyan));
  background-origin: border-box; background-clip: content-box, border-box;
}
.m-profile-card .mp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-profile-card .mp-avatar svg { width: 30px; height: 30px; }
.m-profile-card .mp-meta { flex: 1; min-width: 0; }
.m-profile-card .mp-kicker {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px; color: var(--cyan); font-size: 11px; font-weight: 700;
}
.m-profile-card .mp-kicker i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(37,244,238,0.12);
}
.m-profile-card .mp-name {
  font-size: 18px; font-weight: 700; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-profile-card .mp-description {
  display: -webkit-box; margin-top: 3px; overflow: hidden;
  color: var(--text-2); font-size: 12px; line-height: 1.45;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-profile-card .mp-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; color: var(--text-1);
  background: var(--bg-2); border: 1px solid var(--border);
  max-width: 100%;
}
.m-profile-card .mp-tag span, .m-profile-card .mp-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-profile-card .mp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); flex-shrink: 0; }
.m-profile-card .mp-tag-muted { color: var(--text-2); }
.m-profile-card .mp-edit {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-1); font-size: 10px; flex-shrink: 0;
}
.m-profile-card .mp-edit svg { width: 18px; height: 18px; }
.m-profile-card .mp-edit small { font-size: 10px; line-height: 1; }

/* 积分卡片 */
.m-points-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 20px 18px; margin-bottom: 8px;
  border-radius: var(--radius-l);
  background: linear-gradient(135deg, #FE2C55 0%, #ff5a7a 55%, #ff8aa3 100%);
  color: #fff; box-shadow: 0 8px 24px rgba(254,44,85,0.30);
  transition: transform 0.12s ease;
}
.m-points-card:active { transform: scale(0.985); }
.m-points-card::before {
  content: ''; position: absolute; right: -36px; top: -36px;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.22), transparent 70%);
  pointer-events: none;
}
.m-points-card .mpc-info { position: relative; z-index: 1; min-width: 0; }
.m-points-card .mpc-label { font-size: 13px; opacity: 0.92; }
.m-points-card .mpc-value {
  font-size: 34px; font-weight: 800; line-height: 1.15; margin: 3px 0 2px;
  letter-spacing: 0.5px; font-variant-numeric: tabular-nums;
}
.m-points-card .mpc-hint { font-size: 12px; opacity: 0.88; }
.m-points-card .mpc-icon {
  position: relative; z-index: 1; width: 48px; height: 48px; flex-shrink: 0; opacity: 0.95;
}

/* Scroll to bottom button animation */
.fade-scale-enter-active, .fade-scale-leave-active {
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fade-scale-enter-from, .fade-scale-leave-to {
  opacity: 0;
  transform: translate(-50%, 0) scale(0.8);
}
.fade-scale-enter-to, .fade-scale-leave-from {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.m-points-card .mpc-icon svg { width: 100%; height: 100%; }

/* Scroll to Bottom Button Transition */
.fade-scale-enter-active, .fade-scale-leave-active {
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fade-scale-enter-from, .fade-scale-leave-to {
  opacity: 0;
  transform: translate(-50%, 0) scale(0.8);
}
.fade-scale-enter-to, .fade-scale-leave-from {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* 滚动到底部按钮 — 适配抖音深色主题 */
.m-scroll-to-bottom {
  position: fixed;
  left: 50%;
  bottom: 12rem;
  transform: translateX(-50%);
  z-index: 20;
  width: 40px;
  height: 40px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}
.m-scroll-to-bottom svg {
  width: 20px;
  height: 20px;
  color: var(--text-0);
}
.m-scroll-to-bottom:active {
  transform: translateX(-50%) scale(0.95);
  background: var(--bg-3);
  border-color: var(--pink);
}
.m-scroll-to-bottom:active svg {
  color: var(--pink);
}

/* ============================================================
   用量统计页面 - 全新设计的移动端 UI
   ============================================================ */

/* 今日消耗卡片容器 */
.usage-cards-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

/* 单个卡片样式 */
.usage-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.usage-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.usage-card:active {
  transform: scale(0.98);
  background: var(--bg-3);
}

.usage-card:active::before {
  opacity: 1;
}

/* 卡片图标 */
.usage-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.usage-card-points .usage-card-icon {
  background: linear-gradient(135deg, rgba(254, 44, 85, 0.15), rgba(254, 44, 85, 0.05));
}

.usage-card-tokens .usage-card-icon {
  background: linear-gradient(135deg, rgba(0, 209, 178, 0.15), rgba(0, 209, 178, 0.05));
}

.usage-card-images .usage-card-icon {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.18), rgba(129, 140, 248, 0.06));
}

.usage-card-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.usage-card-points .usage-card-icon svg {
  color: var(--pink);
}

.usage-card-tokens .usage-card-icon svg {
  color: var(--cyan);
}

.usage-card-images .usage-card-icon svg {
  color: #818cf8;
}

/* 卡片内容 */
.usage-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.usage-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.usage-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.usage-card-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* 积分消耗明细列表 */
.usage-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 单条明细项 */
.usage-detail-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: all 0.15s ease;
}

.usage-detail-item:active {
  background: var(--bg-3);
  transform: scale(0.99);
}

/* 明细头部（类型 + 积分） */
.usage-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.usage-detail-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

/* 类型徽章 */
.usage-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.usage-type-badge.badge-chat {
  background: linear-gradient(135deg, rgba(254, 44, 85, 0.15), rgba(254, 44, 85, 0.05));
  color: var(--pink);
  border: 1px solid rgba(254, 44, 85, 0.2);
}

.usage-type-badge.badge-image,
.usage-type-badge.badge-image_generation {
  background: linear-gradient(135deg, rgba(37, 244, 238, 0.15), rgba(37, 244, 238, 0.05));
  color: var(--cyan);
  border: 1px solid rgba(37, 244, 238, 0.2);
}

.usage-type-badge.badge-other,
.usage-type-badge.badge-recharge {
  background: linear-gradient(135deg, rgba(150, 150, 150, 0.15), rgba(150, 150, 150, 0.05));
  color: var(--text-1);
  border: 1px solid rgba(150, 150, 150, 0.2);
}

.usage-type-badge.badge-memory {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.usage-type-badge.badge-variables {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* 积分变化 */
.usage-detail-points {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.usage-detail-points.points-minus {
  color: var(--pink);
}

.usage-detail-points.points-add {
  color: var(--cyan);
}

/* 时间标签 */
.usage-detail-time {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* 用途说明 */
.usage-detail-purpose {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  margin-top: 6px;
}

/* 元数据标签（token/图片数量） */
.usage-detail-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.usage-detail-meta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* 响应式调整 */
@media (max-width: 360px) {
  .usage-cards-container {
    grid-template-columns: 1fr;
  }
  
  .usage-card-value {
    font-size: 22px;
  }
}

/* 工具全局设置 */
.m-tool-global-card {
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
}
.m-tool-global-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
}
.m-tool-global-trigger:active { background: var(--bg-3); }
.m-tool-global-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.m-tool-global-title-wrap > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.m-tool-global-title-wrap strong {
  color: var(--text-0);
  font-size: 14px;
}
.m-tool-global-title-wrap small {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 11px;
}
.m-tool-global-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: var(--pink);
  background: var(--pink-dim);
  border-radius: 10px;
}
.m-tool-global-icon svg { width: 18px; height: 18px; }
.m-tool-global-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--text-2);
  transition: transform 0.2s ease;
}
.m-tool-global-chevron.open { transform: rotate(180deg); color: var(--pink); }
.m-tool-global-panel {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.m-tool-global-label {
  padding: 12px 1px 8px;
  color: var(--text-1);
  font-size: 12px;
  font-weight: 700;
}
.m-tool-aggressiveness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.m-tool-aggressiveness-option {
  min-width: 0;
  padding: 9px 5px;
  color: var(--text-2);
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.m-tool-aggressiveness-option.active {
  color: var(--pink);
  background: var(--pink-dim);
  box-shadow: 0 0 0 1px rgba(254,44,85,0.25) inset;
}

/* ============================================================
   移动端思考 / 检索时间线
   ============================================================ */
.m-summary-timeline {
  width: 100%; margin: 0 0 10px; overflow: hidden;
  background: linear-gradient(135deg, rgba(20,20,32,.96), rgba(14,14,24,.98));
  border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.m-summary-timeline.is-open { border-color: rgba(37,244,238,.28); }
.m-summary-timeline.is-live { border-color: rgba(254,44,85,.42); box-shadow: 0 0 0 1px rgba(254,44,85,.08), 0 8px 26px rgba(0,0,0,.28); }
.m-summary-timeline-header {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px;
  padding: 10px 12px; text-align: left;
}
.m-summary-timeline-header:active { background: rgba(255,255,255,.035); }
.m-summary-timeline-leading {
  display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto;
  color: var(--cyan); background: var(--cyan-dim); border-radius: 9px;
}
.m-summary-timeline-leading svg { width: 16px; height: 16px; }
.m-summary-timeline.is-live .m-summary-timeline-leading { color: var(--pink); background: var(--pink-dim); }
.m-summary-timeline-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-summary-timeline-copy strong { color: var(--text-0); font-size: 13px; }
.m-summary-timeline-copy small { margin-top: 2px; color: var(--text-2); font-size: 10px; }
.m-summary-timeline-chevron { width: 17px; height: 17px; color: var(--text-2); transition: transform .2s ease; }
.m-summary-timeline-chevron.open { color: var(--cyan); transform: rotate(180deg); }
.m-summary-live-dots { display:flex; gap:3px; align-items:center; }
.m-summary-live-dots i, .m-summary-live-dot { width:5px; height:5px; background:currentColor; border-radius:50%; animation:m-summary-pulse 1.05s infinite ease-in-out; }
.m-summary-live-dots i:nth-child(2) { animation-delay:.15s; }.m-summary-live-dots i:nth-child(3) { animation-delay:.3s; }
@keyframes m-summary-pulse { 0%,100% { opacity:.25; transform:scale(.75); } 50% { opacity:1; transform:scale(1); } }
.m-summary-timeline-body { padding: 0 12px 12px; border-top: 1px solid var(--border); }
.m-summary-timeline-rail { position:relative; padding: 11px 0 2px 20px; }
.m-summary-timeline-rail::before { content:''; position:absolute; left:5px; top:16px; bottom:13px; width:1px; background:linear-gradient(var(--cyan), rgba(37,244,238,.08)); }
.m-summary-step { position:relative; margin-bottom: 8px; }
.m-summary-step:last-child { margin-bottom:0; }
.m-summary-step-node { position:absolute; left:-18px; top:15px; width:8px; height:8px; border-radius:50%; background:var(--bg-1); border:2px solid var(--cyan); box-shadow:0 0 0 3px rgba(37,244,238,.08); }
.m-summary-step.is-tool .m-summary-step-node { border-color:#a78bfa; box-shadow:0 0 0 3px rgba(167,139,250,.08); }
.m-summary-step.is-live .m-summary-step-node { border-color:var(--pink); animation:m-summary-pulse 1s infinite; }
.m-summary-step.is-error .m-summary-step-node { border-color:var(--pink); background:var(--pink); }
.m-summary-step-details { border:1px solid rgba(255,255,255,.06); background:rgba(255,255,255,.025); border-radius:10px; overflow:hidden; }
.m-summary-step-details summary { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:42px; padding:8px 9px; list-style:none; cursor:pointer; }
.m-summary-step-details summary::-webkit-details-marker { display:none; }
.m-summary-step-title-wrap { display:flex; align-items:center; gap:6px; min-width:0; }
.m-summary-step-kind { flex:0 0 auto; padding:2px 6px; border-radius:5px; color:var(--cyan); background:var(--cyan-dim); font-size:9px; font-weight:700; }
.m-summary-step.is-tool .m-summary-step-kind { color:#c4b5fd; background:rgba(167,139,250,.13); }
.m-summary-step-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-1); font-size:12px; font-weight:600; }
.m-summary-step-count { flex:0 0 auto; color:var(--text-3); font-size:10px; font-variant-numeric:tabular-nums; }
.m-summary-step-state { display:flex; align-items:center; gap:5px; color:var(--text-3); font-size:11px; }
.m-summary-step-state svg { width:14px; height:14px; transition:transform .18s ease; }
.m-summary-step-details[open] .m-summary-step-state svg { transform:rotate(180deg); color:var(--cyan); }
.m-summary-step-detail { max-height:min(42vh,300px); overflow:auto; overscroll-behavior:contain; padding:0 10px 10px; color:var(--text-1); font-size:12px; line-height:1.65; overflow-wrap:anywhere; }
.m-summary-step-detail .m-md-content { font-size:12px; }
.m-summary-tool-detail { display:flex; flex-direction:column; gap:7px; }
.m-summary-tool-mode { color:#c4b5fd; font-size:10px; font-weight:700; }
.m-summary-tool-query, .m-summary-tool-result, .m-summary-tool-error { padding:8px; border-radius:7px; white-space:pre-wrap; word-break:break-word; }
.m-summary-tool-query { color:var(--text-2); background:var(--bg-1); font-family:ui-monospace, SFMono-Regular, Consolas, monospace; font-size:10px; }
.m-summary-tool-result { color:var(--text-1); background:rgba(37,244,238,.05); }
.m-summary-tool-error { color:#ff9bb3; background:rgba(254,44,85,.1); }

/* 向量记忆检索 */
.m-vector-search { overflow:hidden; background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-m); box-shadow:var(--shadow-card); }
.m-vector-search-hero { padding:14px; background:linear-gradient(135deg, rgba(37,244,238,.11), rgba(167,139,250,.08)); border-bottom:1px solid var(--border); }
.m-vector-search-heading { display:flex; gap:9px; align-items:center; }
.m-vector-search-icon { display:grid; place-items:center; width:32px; height:32px; color:var(--cyan); background:var(--cyan-dim); border-radius:9px; }.m-vector-search-icon svg{width:17px;height:17px;}
.m-vector-search-heading span:last-child { display:flex; flex-direction:column; }.m-vector-search-heading strong{font-size:13px;color:var(--text-0);}.m-vector-search-heading small{margin-top:2px;font-size:10px;color:var(--text-2);}
.m-vector-search-stats { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.m-vector-search-stats div { padding:8px; text-align:center; background:rgba(10,10,15,.34); border:1px solid rgba(255,255,255,.05); border-radius:9px; }.m-vector-search-stats strong{display:block;color:var(--cyan);font-size:18px;font-variant-numeric:tabular-nums;}.m-vector-search-stats small{font-size:10px;color:var(--text-2);}
.m-vector-search-form { display:flex; gap:8px; padding:12px; }.m-vector-search-input-wrap{display:flex;align-items:center;gap:7px;min-width:0;flex:1;padding:0 10px;background:var(--bg-1);border:1px solid var(--border);border-radius:10px;}.m-vector-search-input-wrap svg{width:15px;height:15px;color:var(--text-3);flex:0 0 auto;}.m-vector-search-input-wrap input{width:100%;min-width:0;padding:10px 0;background:transparent;border:0;outline:0;color:var(--text-0);font-size:12px;}.m-vector-search-form>button{padding:0 12px;color:#fff;background:linear-gradient(135deg,var(--pink),#ff5a7a);border-radius:10px;font-size:12px;font-weight:700;}.m-vector-search-form>button:disabled{opacity:.4;}.m-vector-search-spinner{display:inline-block;width:10px;height:10px;margin-right:4px;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:m-vector-spin .7s linear infinite;}@keyframes m-vector-spin{to{transform:rotate(360deg)}}
.m-vector-search-clear { width:calc(100% - 24px); margin:0 12px 12px; padding:7px; color:var(--text-2); background:var(--bg-1); border:1px solid var(--border); border-radius:8px; font-size:11px; }.m-vector-search-error{display:flex;align-items:center;gap:7px;margin:0 12px 12px;padding:9px;color:#ff9bb3;background:rgba(254,44,85,.1);border:1px solid rgba(254,44,85,.25);border-radius:9px;font-size:11px;}.m-vector-search-error svg{width:15px;height:15px;flex:0 0 auto;}
.m-vector-search-results { padding:0 12px 12px; }.m-vector-search-result-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:2px 0 9px;color:var(--text-2);font-size:11px;}.m-vector-search-sort{display:flex;padding:3px;background:var(--bg-1);border:1px solid var(--border);border-radius:8px;}.m-vector-search-sort button{padding:4px 8px;color:var(--text-3);border-radius:5px;font-size:10px;}.m-vector-search-sort button.active{color:var(--pink);background:var(--pink-dim);}
.m-vector-search-result { margin-bottom:8px;padding:10px;background:var(--bg-1);border:1px solid var(--border);border-radius:10px; }.m-vector-search-result-head{display:flex;align-items:center;justify-content:space-between;gap:8px;}.m-vector-search-turn{color:var(--text-1);font-size:11px;font-weight:700;}.m-vector-search-score{padding:3px 6px;color:var(--cyan);background:var(--cyan-dim);border-radius:5px;font-size:10px;font-weight:700;font-variant-numeric:tabular-nums;}.m-vector-search-bar{height:3px;margin:8px 0;background:var(--bg-3);border-radius:99px;overflow:hidden;}.m-vector-search-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--cyan),#a78bfa);border-radius:inherit;}.m-vector-search-result p{margin:0;color:var(--text-1);font-size:12px;line-height:1.6;white-space:pre-wrap;word-break:break-word;}
