/* ==========================================================================
   娱播大师 —— 样式表

   设计语言：「瓷白 + 黛紫 + 香槟金」
   - 画布是低饱和的冷调瓷白，回复内容浮在一张有发丝边框的白卡上；
   - 主色是黛紫（#4C3AC0 → #7B5CE8），用于分区标识、话术卡、用户气泡；
   - 香槟金只用在「推荐回复」与 Pro 徽标上——全屏唯一的高光点，
     金色一多就不贵了，所以它必须稀缺。
   浅色为默认，深色跟随系统偏好，也可通过 html[data-theme] 手动覆盖。

   注意：`.bad-tag` 的颜色 #d93025 被回归测试按 rgb(217,48,37) 逐字断言，
   换色会直接让 bad-visual 挂掉，所以要改得连测试一起改。
   ========================================================================== */

/* 浅色（默认）。深色令牌写两遍是不得已：CSS 没有 mixin，
   一份给「跟随系统」，一份给「手动指定」，两边都要能命中。
   注意媒体查询带 :not([data-theme="light"])，否则用户手动选浅色时
   会被系统深色偏好盖掉，主题按钮就变成了摆设。 */
:root {
  /* 品牌 */
  --brand: #4C3AC0;
  --brand-2: #7B5CE8;
  --brand-soft: rgba(76, 58, 192, .07);
  --brand-line: rgba(76, 58, 192, .18);
  --brand-glow: rgba(76, 58, 192, .28);
  /* 香槟金：只给「推荐回复」和 Pro 徽标 */
  --gold: #A9761F;
  --gold-2: #D9A84E;
  --gold-soft: rgba(169, 118, 31, .1);
  --gold-line: rgba(169, 118, 31, .26);
  /* 语义色 */
  --danger: #d93025;
  --danger-soft: rgba(217, 48, 37, .05);
  --danger-line: rgba(217, 48, 37, .26);
  --bad-bg: rgba(217, 48, 37, .09);
  --bad-border: rgba(217, 48, 37, .24);
  --ok: #1a9c5b;
  --ok-soft: rgba(26, 156, 91, .09);

  /* 表面与文字 */
  --bg: #EEF0F7;
  --surface: #ffffff;
  --surface-2: #F6F7FC;
  --text-1: #16181F;
  --text-2: #4B5163;
  --text-3: #878E9F;
  --line: rgba(22, 24, 31, .07);
  --line-strong: rgba(22, 24, 31, .13);

  /* 结构 */
  --nav-bg: rgba(255, 255, 255, .78);
  --footer-bg: linear-gradient(to top, var(--bg) 72%, rgba(238, 240, 247, 0));
  --console-bg: #F4F5FB;
  --me-bubble: linear-gradient(135deg, #5B49D6 0%, #8B6FF0 100%);
  --btn-grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --glow-1: rgba(123, 92, 232, .16);
  --glow-2: rgba(217, 168, 78, .10);

  /* 阴影：大而软、低透明度，是"高级感"的主要来源 */
  --shadow-card: 0 1px 2px rgba(22, 24, 31, .04), 0 14px 34px -20px rgba(22, 24, 31, .22);
  --shadow-float: 0 2px 6px rgba(22, 24, 31, .05), 0 18px 40px -18px rgba(22, 24, 31, .2);
  --shadow-pop: 0 24px 60px -20px rgba(22, 24, 31, .35);
  --shadow: var(--shadow-float);

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --card-pad: 17px;
  --focus-ring: rgba(76, 58, 192, .22);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #9B8AF8;
    --brand-2: #BCAAFF;
    --brand-soft: rgba(155, 138, 248, .13);
    --brand-line: rgba(155, 138, 248, .3);
    --brand-glow: rgba(155, 138, 248, .3);
    --gold: #E0B75F;
    --gold-2: #EFD08C;
    --gold-soft: rgba(224, 183, 95, .12);
    --gold-line: rgba(224, 183, 95, .3);
    --danger: #f0665a;
    --danger-soft: rgba(217, 48, 37, .12);
    --danger-line: rgba(217, 48, 37, .38);
    --bad-bg: rgba(217, 48, 37, .16);
    --bad-border: rgba(217, 48, 37, .42);
    --ok: #55C98A;
    --ok-soft: rgba(85, 201, 138, .12);

    --bg: #0A0B10;
    --surface: #14161E;
    --surface-2: #1A1D27;
    --text-1: #EDEFF6;
    --text-2: #A9B0C4;
    --text-3: #757D92;
    --line: rgba(255, 255, 255, .075);
    --line-strong: rgba(255, 255, 255, .14);

    --nav-bg: rgba(10, 11, 16, .72);
    --footer-bg: linear-gradient(to top, #0A0B10 72%, rgba(10, 11, 16, 0));
    --console-bg: #101219;
    --me-bubble: linear-gradient(135deg, #4A3BB8 0%, #6E58DC 100%);
    --btn-grad: linear-gradient(135deg, #5B49D6 0%, #7E68E8 100%);
    --glow-1: rgba(155, 138, 248, .16);
    --glow-2: rgba(224, 183, 95, .07);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -22px rgba(0, 0, 0, .8);
    --shadow-float: 0 2px 8px rgba(0, 0, 0, .5), 0 20px 44px -18px rgba(0, 0, 0, .85);
    --shadow-pop: 0 28px 70px -20px rgba(0, 0, 0, .9);
    --focus-ring: rgba(155, 138, 248, .3);

    color-scheme: dark;
  }
}

/* 手动指定深色：与上面那段取值必须逐字一致（改一处记得改另一处） */
html[data-theme="dark"] {
  --brand: #9B8AF8;
  --brand-2: #BCAAFF;
  --brand-soft: rgba(155, 138, 248, .13);
  --brand-line: rgba(155, 138, 248, .3);
  --brand-glow: rgba(155, 138, 248, .3);
  --gold: #E0B75F;
  --gold-2: #EFD08C;
  --gold-soft: rgba(224, 183, 95, .12);
  --gold-line: rgba(224, 183, 95, .3);
  --danger: #f0665a;
  --danger-soft: rgba(217, 48, 37, .12);
  --danger-line: rgba(217, 48, 37, .38);
  --bad-bg: rgba(217, 48, 37, .16);
  --bad-border: rgba(217, 48, 37, .42);
  --ok: #55C98A;
  --ok-soft: rgba(85, 201, 138, .12);

  --bg: #0A0B10;
  --surface: #14161E;
  --surface-2: #1A1D27;
  --text-1: #EDEFF6;
  --text-2: #A9B0C4;
  --text-3: #757D92;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);

  --nav-bg: rgba(10, 11, 16, .72);
  --footer-bg: linear-gradient(to top, #0A0B10 72%, rgba(10, 11, 16, 0));
  --console-bg: #101219;
  --me-bubble: linear-gradient(135deg, #4A3BB8 0%, #6E58DC 100%);
  --btn-grad: linear-gradient(135deg, #5B49D6 0%, #7E68E8 100%);
  --glow-1: rgba(155, 138, 248, .16);
  --glow-2: rgba(224, 183, 95, .07);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -22px rgba(0, 0, 0, .8);
  --shadow-float: 0 2px 8px rgba(0, 0, 0, .5), 0 20px 44px -18px rgba(0, 0, 0, .85);
  --shadow-pop: 0 28px 70px -20px rgba(0, 0, 0, .9);
  --focus-ring: rgba(155, 138, 248, .3);

  color-scheme: dark;
}

html[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'HarmonyOS Sans SC', 'Microsoft YaHei', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1;
}

/* 画布上两团极淡的光晕：纯色背景会显得"平"，加了才有纵深。
   pointer-events:none 保证它绝不挡点击。 */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 88% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 520px at -10% 108%, var(--glow-2), transparent 62%);
}

#app { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; z-index: 1; }
.hidden { display: none !important; }

/* 主界面必须自己是一个撑满高度的纵向 flex 容器，
   否则里面 .chat-body 的 flex:1 不生效，会被内容一路撑高导致无法滚动 */
#mainView { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------------------------------------------------------------- 登录页 */
.login-container { flex: 1; min-height: 0; padding: 13vh 28px 30px; text-align: center; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.login-title {
  font-size: 31px; font-weight: 700; margin: 0 0 14px;
  background: linear-gradient(115deg, var(--brand) 0%, var(--brand-2) 52%, var(--gold-2) 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 6px; text-indent: 6px;
  /* 渐变文字本身没有阴影，用 drop-shadow 补一层极淡的辉光 */
  filter: drop-shadow(0 6px 18px var(--brand-glow));
}

.login-sub { font-size: 13px; color: var(--text-3); line-height: 1.9; margin: 0 0 34px; letter-spacing: .2px; }

.custom-input-group {
  background: var(--surface); border-radius: var(--r-md); padding: 13px 16px;
  border: 1px solid var(--line-strong); margin-bottom: 13px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .22s, box-shadow .22s, background .22s;
}
.custom-input-group:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.login-icon { width: 19px; height: 19px; color: var(--text-3); flex-shrink: 0; transition: color .2s; }
.custom-input-group:focus-within .login-icon { color: var(--brand); }
.login-icon.eye { cursor: pointer; }
.login-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 16px; color: var(--text-1); text-align: left; min-width: 0;
  font-family: inherit;
}
.login-input::placeholder { color: var(--text-3); }

.primary-btn {
  width: 100%; height: 52px; margin-top: 14px; border: none; border-radius: var(--r-md);
  background: var(--btn-grad); color: #fff;
  font-size: 16px; font-weight: 600; letter-spacing: 3px; text-indent: 3px; cursor: pointer;
  transition: transform .18s, box-shadow .18s, opacity .18s; font-family: inherit;
  box-shadow: 0 10px 26px -12px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.primary-btn:hover { box-shadow: 0 14px 32px -12px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .22); }
.primary-btn:active { transform: scale(.985); }
.primary-btn:disabled { opacity: .55; box-shadow: none; }

.switch-mode { margin-top: 20px; font-size: 14px; color: var(--brand); cursor: pointer; font-weight: 500; }
.login-foot { margin-top: 38px; font-size: 11px; color: var(--text-3); line-height: 2; }

/* ---------------------------------------------------------------- 导航栏 */
.nav-bar {
  height: 62px; flex-shrink: 0; display: flex; justify-content: space-between;
  align-items: center; padding: 0 14px 0 20px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
.brand { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex: 1; overflow: hidden; }
.brand-name {
  font-size: 19px; font-weight: 600; letter-spacing: .5px;
  color: var(--text-1); white-space: nowrap; flex-shrink: 0;
}
.brand-pro {
  font-size: 9.5px; font-weight: 700; letter-spacing: .8px;
  color: var(--gold); background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 1.5px 6px; border-radius: 999px; flex-shrink: 0;
}
/* 免责声明是必须留的，但窄屏上不能让它把右侧图标挤变形 —— 让它自己省略号收尾，
   而不是换行或挤压按钮。min-width:0 是 flex 子项能收缩的前提。 */
.brand-notice {
  font-size: 10px; color: var(--text-3); margin-left: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

.nav-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-icon {
  width: 32px; height: 32px; border: none; background: transparent; padding: 6px;
  color: var(--text-3); cursor: pointer; border-radius: 9px;
  transition: background .2s, color .2s; display: flex; align-items: center; justify-content: center;
}
.nav-icon svg { width: 100%; height: 100%; display: block; }
.nav-icon:hover { background: var(--brand-soft); color: var(--brand); }

.profile-trigger {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; margin-left: 4px;
  background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%);
  cursor: pointer; border: 2px solid var(--surface);
  box-shadow: 0 3px 12px rgba(255, 154, 158, .5);
  transition: transform .2s;
}
.profile-trigger:active { transform: scale(.94); }

/* ---------------------------------------------------------------- 聊天区 */
.chat-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px; padding-bottom: 132px;
  /* 不要用 smooth：正文一次性铺开后，平滑滚动会带出一段"自己往下滑"的拖影，
     叠加高频的程序化 scrollTop 就是之前那种抖动的观感。 */
  scroll-behavior: auto; -webkit-overflow-scrolling: touch;
}
.msg-list { max-width: 680px; margin: 0 auto; }
.message-item { margin-bottom: 26px; width: 100%; }
/* 入场动画只在"新出现的那一条"上播；整列表重绘时反复播 = 页面像在抖 */
.message-item.fresh { animation: fadeIn .26s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 用户消息：品牌渐变气泡，右下角收一个尖角当"话尾" */
.message-item.me { display: flex; justify-content: flex-end; }
.me-bubble {
  background: var(--me-bubble); color: #fff;
  padding: 12px 17px;
  border-radius: var(--r-lg) var(--r-lg) 6px var(--r-lg);
  max-width: 84%; font-size: 16px; line-height: 1.6; word-wrap: break-word; white-space: pre-wrap;
  box-shadow: 0 8px 22px -12px var(--brand-glow);
}
.me-bubble .chat-image-card { margin-bottom: 8px; max-width: 190px; max-height: 170px; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .12); }
.me-bubble .chat-image-card img { display: block; width: 100%; object-fit: cover; max-height: 170px; }

/* AI 消息 */
.message-item.ai { display: flex; flex-direction: column; align-items: flex-start; }
.ai-header { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; padding-left: 2px; }
.ai-avatar { width: 23px; height: 23px; flex-shrink: 0; filter: drop-shadow(0 3px 8px var(--brand-glow)); }
.ai-name { font-size: 14.5px; font-weight: 600; color: var(--text-1); letter-spacing: .2px; }
.ai-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .6px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #3A2708;
  padding: 1.5px 6px; border-radius: 999px;
}

/* 回复主体 = 一张卡。这是整个界面视觉重量的中心：
   发丝边框 + 大而软的阴影 + 左上角收窄的圆角（呼应上方的头像）。 */
.ai-content {
  position: relative;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px var(--r-lg) var(--r-lg) var(--r-lg);
  padding: var(--card-pad);
  box-shadow: var(--shadow-card);
  font-size: 15.5px; line-height: 1.78; color: var(--text-1);
}
/* 卡片顶部一道渐隐的紫金发丝光：极细，但让卡"立"起来了 */
.ai-content::before {
  content: ''; position: absolute; left: var(--card-pad); right: var(--card-pad); top: -1px; height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 38%, var(--gold-2) 72%, transparent 100%);
  opacity: .9;
}
.ai-content p { margin: 0 0 13px; }
.ai-content p:last-child { margin-bottom: 2px; }
.ai-content strong { font-weight: 650; color: var(--text-1); }
.ai-content em { font-style: normal; color: var(--text-3); font-size: 14px; }
.ai-content hr { height: 1px; border: none; background: var(--line); margin: 18px 0; }

/* 欢迎语 */
.wlc { padding: 2px 0 6px; }
.wlc-quote {
  font-size: 15px; font-weight: 650; letter-spacing: 1px; margin-bottom: 11px;
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 70%, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wlc-body { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.wlc-note {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-strong);
  font-size: 11.5px; line-height: 1.8; color: var(--text-3);
}

/* ---------------------------------------------------------------- 回复分区 */
/* 每个分区 = 标题（色块 + 字距放开的标签） + 正文。
   分区之间用发丝线分隔，而不是一个大标题加一条粗横线 —— 后者在一屏里
   出现 5 次会非常吵。 */
.sec { position: relative; }
.sec + .sec { margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.sec-mark {
  width: 13px; height: 13px; flex-shrink: 0; border-radius: 4px;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  box-shadow: 0 3px 8px -2px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
  position: relative;
}
.sec-mark::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, .95);
}
/* 分区标签：字距放到 .12em（再宽就散了），字号 13px —— 比正文小但比注释重，
   目的是"能扫"而不是"能读"。再小一档就退化成装饰，用户找不到「推荐回复」在哪。 */
.sec-text { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--text-2); }
.sec-body { position: relative; }

/* 没有标题的前导块（模型偶尔会在第一个分区前写一句总结） */
.sec.sec-plain { margin-top: 0; padding-top: 0; border-top: none; }

/* 「推荐回复」是主角：整块铺满卡宽的品牌底色带 + 金色标识。
   负外边距把它顶到卡片边缘，视觉上形成一个"章节书签"。 */
.sec.sec-hot {
  margin: 17px calc(-1 * var(--card-pad)) 0;
  padding: 17px var(--card-pad) 4px;
  background: linear-gradient(135deg, var(--brand-soft) 0%, transparent 72%);
  border-top: 1px solid var(--brand-line);
}
.sec.sec-hot .sec-mark { background: linear-gradient(140deg, var(--gold-2), var(--gold)); box-shadow: 0 3px 9px -2px var(--gold-line); }
.sec.sec-hot .sec-text { color: var(--brand); }
.sec.sec-hot:last-child { border-radius: 0 0 calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px); padding-bottom: 15px; }

/* 「不推荐回复」只换标识颜色，不做整块底色：
   一整块红色区域会显得像报错，而降级成"红点 + 常规排版"才像提醒。 */
.sec.sec-warn .sec-mark {
  background: linear-gradient(140deg, #ec6a5f, var(--danger));
  box-shadow: 0 3px 9px -2px rgba(217, 48, 37, .35);
}
.sec.sec-warn .sec-mark::after { background: rgba(255, 255, 255, .95); }
.sec.sec-warn .sec-text { color: var(--danger); opacity: .92; }

/* 方案小标题（1️⃣ 2️⃣ 3️⃣）：药丸标签，起"分组"而不是"强调"的作用 */
.sub-title {
  display: inline-flex; align-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  padding: 4px 11px; border-radius: 999px; margin: 14px 0 9px;
  letter-spacing: .3px;
}
.sec-body > .sub-title:first-child { margin-top: 2px; }

/* 话术卡：一眼能认出"这句是可以直接发出去的" */
.copy-line {
  position: relative;
  margin: 0 0 10px;
  padding: 12px 12px 12px 16px;
  background: linear-gradient(135deg, var(--brand-soft) 0%, transparent 80%);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-sm);
  display: flex; align-items: flex-start; gap: 9px; flex-wrap: wrap;
}
.copy-line::before {
  content: ''; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
}
.copy-text {
  flex: 1; min-width: 0;
  font-size: 16px; line-height: 1.68; font-weight: 500;
  color: var(--text-1); word-break: break-word;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  margin-left: auto; height: 26px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; font-family: inherit; letter-spacing: .3px;
  cursor: pointer; transition: background .18s, color .18s, border-color .18s;
}
.copy-btn svg { width: 12px; height: 12px; display: block; }
.copy-btn .copy-lb-done { display: none; }
.copy-btn:hover { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.copy-btn.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.copy-btn.done .copy-lb { display: none; }
.copy-btn.done .copy-lb-done { display: inline; }

/* 反例（反面示范，不可复制）：虚线红框 + 删除线。
   刻意做成"贴纸"而不是"卡片"——它不该和可复制的话术抢注意力。 */
.bad-line {
  margin: 0 0 10px; padding: 10px 13px;
  background: var(--danger-soft);
  border: 1px dashed var(--danger-line);
  border-radius: var(--r-sm);
  font-size: 14px; line-height: 1.75; color: var(--text-3);
}
.bad-text {
  font-size: 15.5px; color: var(--text-2); text-decoration: line-through;
  text-decoration-color: rgba(217, 48, 37, .5); text-decoration-thickness: 1.5px;
  word-break: break-word;
}
/* 文字色必须恒为 #d93025：回归测试按 rgb(217,48,37) 逐字断言，
   所以深色下只加深底色、不动文字色。 */
.bad-tag {
  display: inline-block; vertical-align: 1px; margin-left: 7px; padding: 1px 8px;
  font-size: 10.5px; line-height: 1.7; font-weight: 700; white-space: nowrap;
  color: #d93025; background: var(--bad-bg);
  border: 1px solid var(--bad-border); border-radius: 999px;
}
/* 反例后面紧跟的那句"为什么不能说"，降一级排版贴在被禁话术下，
   让它读起来像注解而不是另一条建议 */
.bad-line + p { font-size: 13px; line-height: 1.7; color: var(--text-3); margin-top: -3px; }

/* ---------------------------------------------------------------- 思考过程 */
.thinking-wrap { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.thinking-head { display: flex; align-items: center; gap: 9px; padding-left: 2px; }
.thinking-title { font-size: 13.5px; font-weight: 600; color: var(--text-2); letter-spacing: .4px; }
.gemini-loader { display: flex; align-items: center; height: 18px; gap: 4px; }
.gemini-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  animation: pulse 1.4s infinite ease-in-out both;
}
.gemini-dot:nth-child(2) { animation-delay: .16s; }
.gemini-dot:nth-child(3) { animation-delay: .32s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .3; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.1); } }
.thinking-sec { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.thinking-box {
  background: var(--console-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 15px;
  font-size: 11.5px; color: var(--text-3);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  line-height: 1.95;
}
.think-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .45; }
.think-line.now { opacity: 1; color: var(--text-1); animation: thinkIn .35s ease; }
@keyframes thinkIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* 生成进度：让用户知道"正在出内容"，而不是以为卡死了 */
.think-progress { font-size: 11px; color: var(--text-3); opacity: .8; min-height: 14px; font-variant-numeric: tabular-nums; }

/* 读图标记：只说明"这次看了图"，不暴露用了哪家模型 */
.ai-vision {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid var(--brand-line);
  letter-spacing: .3px;
}
.ai-vision svg { width: 11px; height: 11px; fill: currentColor; }

/* ---------------------------------------------------------------- 底部输入 */
.footer-area {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 100;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  background: var(--footer-bg);
}
.input-capsule {
  max-width: 680px; margin: 0 auto;
  background: var(--surface); border-radius: 26px;
  display: flex; align-items: flex-end;
  padding: 6px 6px 6px 6px;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line-strong);
  transition: border-color .22s, box-shadow .22s;
}
.input-capsule:focus-within {
  border-color: var(--brand-line);
  box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow-float);
}
.chat-input {
  flex: 1; border: none; background: transparent; outline: none; resize: none;
  font-size: 16px; max-height: 120px; padding: 12px 6px; color: var(--text-1);
  line-height: 1.5; font-family: inherit;
}
.chat-input::placeholder { color: var(--text-3); }
.action-btn {
  width: 40px; height: 40px; flex-shrink: 0; border: none; background: transparent;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-3); transition: background .2s, color .2s;
}
.action-btn svg { width: 21px; height: 21px; }
.action-btn:hover { background: var(--brand-soft); color: var(--brand); }
.send-btn { background: var(--btn-grad); color: #fff; box-shadow: 0 6px 18px -8px var(--brand-glow); }
.send-btn:hover { background: var(--btn-grad); color: #fff; opacity: .92; }
.send-btn.disabled, .send-btn.disabled:hover {
  background: var(--surface-2); color: var(--text-3); box-shadow: none; cursor: not-allowed; opacity: 1;
}

/* 预览 */
.preview-bar { position: absolute; bottom: 94px; left: 50%; transform: translateX(-50%); z-index: 90; width: 100%; max-width: 680px; padding: 0 24px; }
.preview-item {
  width: 62px; height: 62px; border-radius: var(--r-md); overflow: hidden;
  border: 2px solid var(--surface); box-shadow: var(--shadow-float); position: relative;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-close {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .38);
  display: flex; align-items: center; justify-content: center; color: #fff; cursor: pointer;
}
.preview-close svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- 弹层 */
.mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12, 14, 20, .42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
  background: var(--surface); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
  max-width: 680px; margin: 0 auto;
  /* 性格 + 心情两组芯片在小屏上会超过一屏，允许面板内部滚动，别把保存键顶出屏幕 */
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-pop);
  animation: slideUp .26s cubic-bezier(.22, 1, .36, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-head { display: flex; align-items: center; gap: 14px; padding: 0 6px 20px; border-bottom: 1px solid var(--line); }
.avatar-lg {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -10px rgba(255, 154, 158, .8);
}
.avatar-lg svg { width: 24px; height: 24px; }
.sheet-name { font-size: 16px; font-weight: 650; color: var(--text-1); }
.sheet-plan { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.sheet-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 6px; font-size: 15px; color: var(--text-1);
  border-bottom: 1px solid var(--line);
}
.sheet-row.tappable { cursor: pointer; transition: color .18s; }
.sheet-row.tappable:hover { color: var(--brand); }
.sheet-row.danger { color: var(--danger); border-bottom: none; }
.chev { color: var(--text-3); font-size: 20px; line-height: 1; }
.provider-select {
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-1);
  font-size: 14px; padding: 8px 12px; border-radius: var(--r-sm); outline: none; font-family: inherit;
  max-width: 60%;
}
.sheet-cancel {
  width: 100%; margin-top: 16px; height: 48px; border: none; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text-2); font-size: 15px;
  cursor: pointer; font-family: inherit; transition: background .18s;
}
.sheet-cancel:hover { background: var(--line); }

/* ---------------------------------------------------------------- 性格 / 心情 */
/* 点头像去选性格与心情 —— 角标是必要的：没有它，用户不会知道那个圆头像能点。 */
.avatar-lg.tap { position: relative; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.avatar-lg.tap:hover { transform: scale(1.04); box-shadow: 0 10px 24px -10px rgba(255, 154, 158, .95); }
.avatar-lg.tap:active { transform: scale(.97); }
.avatar-lg.tap::after {
  content: '✎';
  position: absolute; right: -3px; bottom: -3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--btn-grad); color: #fff;
  font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
  box-shadow: 0 4px 10px -4px var(--brand-glow);
}
/* 个人中心里的「我的性格与心情」当前值 */
.row-val { color: var(--brand); font-size: 13px; font-weight: 500; }

.persona-block { padding: 18px 6px 6px; }
.persona-block + .persona-block { border-top: 1px solid var(--line); }
.persona-title {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 14px; font-weight: 650; color: var(--text-1); margin-bottom: 13px;
}
.persona-tip { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 36px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 13.5px; font-family: inherit; cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.chip-emoji { font-size: 14px; line-height: 1; }
.chip:hover { border-color: var(--brand-line); color: var(--brand); }
.chip:active { transform: scale(.96); }
/* 选中态用品牌渐变：整屏只有这里和发送键用这个底，一眼能看出"点了哪个" */
.chip.on {
  background: var(--btn-grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px -8px var(--brand-glow);
}
.chip.on:hover { color: #fff; }
.persona-foot {
  margin: 16px 6px 0; padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-size: 11.5px; line-height: 1.8; color: var(--text-3);
}

.dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 210;
  width: min(88vw, 340px); background: var(--surface); border-radius: 20px;
  border: 1px solid var(--line);
  padding: 24px 20px 16px; box-shadow: var(--shadow-pop);
  animation: fadeIn .2s ease;
}
.dialog-title { margin: 0 0 14px; font-size: 17px; font-weight: 650; text-align: center; color: var(--text-1); }
.dialog-text { font-size: 14px; color: var(--text-2); line-height: 1.85; text-align: center; margin: 0 0 20px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 8px; }
.dialog-btn {
  flex: 1; height: 46px; border: none; border-radius: var(--r-md); background: var(--surface-2);
  color: var(--text-2); font-size: 15px; cursor: pointer; font-family: inherit; transition: background .18s;
}
.dialog-btn:hover { background: var(--line); }
.dialog-btn.primary { background: var(--btn-grad); color: #fff; font-weight: 600; box-shadow: 0 8px 22px -12px var(--brand-glow); }
.dialog-btn.primary:hover { opacity: .93; }

/* Toast */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 300;
  background: rgba(16, 18, 24, .9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; font-size: 14px;
  padding: 13px 22px; border-radius: var(--r-md); max-width: 70vw; text-align: center;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: var(--shadow-pop);
  animation: fadeIn .2s ease; line-height: 1.6;
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-line); }
::-webkit-scrollbar-track { background: transparent; }

/* 窄屏收紧留白：手机上 17px 的内边距已经偏大，再窄就会挤出换行 */
@media (max-width: 380px) {
  :root { --card-pad: 14px; }
  .chat-body { padding-left: 12px; padding-right: 12px; }
  .copy-line { padding: 11px 10px 11px 14px; }
}
