    /* ===== 全局:去掉移动端点击蓝底和讨厌的高光 ===== */
    * {
      -webkit-tap-highlight-color: transparent;   /* 安卓/iOS 点按时的蓝色闪一下 */
      -webkit-touch-callout: none;                /* iOS 长按弹出的"拷贝/分享"菜单 */
    }
    button:focus, button:focus-visible { outline: none; }
    /* 默认整个 app 都不让选中文字(避免长按弹粘贴菜单) */
    body { -webkit-user-select: none; user-select: none; }
    /* 但消息内容、输入框、记忆文本框允许选中,方便复制 */
    .msg, .think-content, #input, #memoryText, .field input, .field textarea {
      -webkit-user-select: text; user-select: text;
      -webkit-touch-callout: default;
    }
    /* 设置面板打开时,整个消息区禁选 —— 这时你在改设置,不需要选消息,
       长按聊天框也不会误选中文字。关掉面板就自动放开。 */
    body.panel-open .msg, body.panel-open .think-content,
    body.workspace-open .msg, body.workspace-open .think-content {
      -webkit-user-select: none; user-select: none;
      -webkit-touch-callout: none;
    }

    /* ===== 主题色板:所有颜色都在这儿,换主题只换这一小块 =====
       下面这套是默认 🍑 水蜜桃。JS 切主题时会改这些 --变量 */
    :root {
      --bg-main:        #FBF4DC;  /* 主背景 */
      --bg-soft:        #FEFAEB;  /* 顶栏/输入栏/侧边栏 */
      --bg-hover:       #F8E8D0;  /* 悬停色 */
      --bg-readonly:    #FBF2DC;  /* 只读输入框背景 */

      --bubble-light:   #F9DEE2;  /* 你气泡浅头 */
      --bubble-deep:    #F0A9A9;  /* 你气泡深头 */

      --btn-soft-1:     #F4CFAE;  /* 浅档按钮浅头 */
      --btn-soft-2:     #F0A9A9;  /* 浅档按钮深头 */
      --btn-soft-text:  #5a4d40;  /* 浅档按钮字色 */
      --btn-deep-1:     #F9DEE2;  /* 深档按钮浅头(其实更"软") */
      --btn-deep-2:     #F4CFAE;  /* 深档按钮深头 */
      --btn-deep-text:  #5a4d40;  /* 深档按钮字色 */

      --text-main:      #5a4d40;  /* 主文字 */
      --text-soft:      #B89E78;  /* 辅助文字(时间、提示) */
      --text-label:     #8B6F47;  /* 表单 label */
      --text-accent:    #C76C6C;  /* 强调色(选中态、删除按钮) */

      --border-soft:    #ECD8B5;  /* 输入框边框 */
      --border-focus:   #F0A9A9;  /* 输入框聚焦边框 */
      --divider:        rgba(244, 207, 174, 0.4);  /* 分割线 */

      --think-bg:       rgba(244, 207, 174, 0.25);
      --think-bg-hover: rgba(244, 207, 174, 0.45);
      --think-border:   rgba(220, 170, 130, 0.5);
      --think-text:     #B07050;
      --think-c-bg:     rgba(244, 207, 174, 0.15);
      --think-c-border: rgba(220, 170, 130, 0.6);
      --think-c-text:   #8B6F47;
    }

    /* ===== 基础:整页撑满 ===== */
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
      background: var(--bg-main);
      color: var(--text-main);
    }
    /* 选中文字时的高亮颜色,跟着主题走;不写浏览器就默认蓝/绿,跟我们家不搭 */
    ::selection { background: var(--bubble-light); color: var(--text-main); }
    ::-moz-selection { background: var(--bubble-light); color: var(--text-main); }

    /* 整个app:手机撑满,电脑居中不至于太宽 */
    .app {
      height: 100dvh;
      max-height: 100%;
      max-width: 500px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      background: var(--bg-main);
      position: relative;   /* 圆圆要在右下角绝对定位 */
    }

    /* ===== 顶栏:像微信那样,左☰,中间只有"cc" ===== */
    .topbar {
      display: flex; align-items: center;
      padding: 14px 16px;
      background: var(--bg-soft);  /* 奶黄的姐妹色,更亮一点 */
      border-bottom: 1px solid var(--divider);
      flex-shrink: 0;
      position: relative;
    }
    #menuBtn {
      background: none; border: none;
      font-size: 15px;         /* 颜文字合适的字号 */
      color: var(--text-main);
      cursor: pointer;
      padding: 4px 8px;
      line-height: 1;
      font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;  /* 让颜文字显示稳定 */
    }
    #themeBtn {
      background: none; border: none;
      font-size: 18px;
      cursor: pointer;
      padding: 4px 8px;
      line-height: 1;
      margin-left: auto;       /* 推到顶栏最右边 */
    }
    #themeBtn:active { transform: scale(0.9); }
    .workspace-center {
      position: absolute; left: 50%; transform: translateX(-50%);
      display: flex; align-items: center; gap: 3px;
    }
    #workspaceTitle {
      background: none; border: none; cursor: pointer; font-family: inherit;
      color: var(--text-main); font-size: 17px; font-weight: 600;
      margin: 0; padding: 0;
      letter-spacing: 1px;
    }
    #workspaceTitle:active { transform: scale(0.96); }

    /* ===== 主题选择弹窗 ===== */
    #themeBox {
      position: fixed; top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.35); display: none;
      align-items: center; justify-content: center; z-index: 30;
    }
    .theme-card {
      background: var(--bg-soft); border-radius: 16px; padding: 22px 20px;
      width: 280px; max-width: 90vw;
      box-shadow: 0 8px 32px rgba(180, 130, 100, 0.18);
    }
    .theme-card h3 { margin: 0 0 16px; font-size: 15px; color: var(--text-main); text-align: center; font-weight: 600; }
    .theme-list {
      display: flex; flex-direction: column; gap: 8px;
      max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 4px;
    }
    .theme-item {
      display: flex; align-items: center; gap: 12px;
      padding: 10px 12px; border-radius: 10px; cursor: pointer;
      border: 2px solid transparent;
      transition: background 0.15s;
    }
    .theme-item:hover { background: var(--bg-hover); }
    .theme-item.current { border-color: var(--text-accent); background: var(--bg-hover); }
    .theme-emoji { font-size: 22px; }
    .theme-name { flex: 1; color: var(--text-main); font-size: 14px; }
    .theme-swatch { display: flex; gap: 3px; }
    .theme-swatch span {
      width: 14px; height: 14px; border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.6);
    }
    .theme-close {
      width: 100%; margin-top: 14px;
      padding: 9px; border: none; border-radius: 10px;
      background: var(--bg-hover); color: var(--text-main);
      cursor: pointer; font-size: 13px;
    }
    #workspaceBox {
      position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: none;
      align-items: center; justify-content: center; z-index: 30;
    }
    .workspace-card {
      background: var(--bg-soft); border-radius: 16px; padding: 18px;
      width: 280px; max-width: 90vw; box-shadow: 0 8px 32px rgba(180,130,100,0.18);
    }
    .workspace-card h3 { margin: 0 0 12px; text-align: center; color: var(--text-main); font-size: 15px; }
    #workspaceList { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
    .workspace-item {
      padding: 10px 12px; border-radius: 10px; cursor: pointer;
      color: var(--text-main); font-size: 14px; border: 1px solid transparent; position: relative;
      -webkit-user-select: none; user-select: none;
      -webkit-touch-callout: none;
    }
    .workspace-item .win-name { display: block; }
    .workspace-item:hover { background: var(--bg-hover); }
    .workspace-item.current { background: var(--bg-hover); border-color: var(--border-focus); font-weight: 600; }
    .workspace-actions { display: flex; gap: 8px; margin-top: 12px; }
    .workspace-actions button, #workspaceClose {
      flex: 1; padding: 8px; border: none; border-radius: 9px; cursor: pointer;
      background: var(--bg-hover); color: var(--text-main); font-family: inherit; font-size: 12px;
    }
    #newWorkspace { background: linear-gradient(135deg,var(--btn-soft-1),var(--btn-soft-2)); color: var(--btn-soft-text); }
    #workspaceClose { width: 100%; margin-top: 8px; }
    #renameBox {
      position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
      background: rgba(0,0,0,.35); z-index: 50;
    }
    .rename-card { width: 250px; padding: 18px; border-radius: 15px; background: var(--bg-soft); box-shadow: 0 8px 28px rgba(180,130,100,.18); }
    .rename-card h3 { margin: 0 0 10px; color: var(--text-main); font-size: 15px; text-align: center; }
    #renameInput { width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border-soft); outline: none; font: inherit; color: var(--text-main); }
    #renameInput:focus { border-color: var(--border-focus); }

    /* ===== 消息区:撑满中间,可滚动 ===== */
    #messages {
      flex: 1;
      background: var(--bg-main);
      padding: 16px;
      overflow-y: auto;
      display: flex; flex-direction: column;
      position: relative;
    }
    #greeting { position: absolute; top: 0; left: 0; right: 0; bottom: 0;
      display: flex; align-items: center; justify-content: center;
      color: var(--text-soft); font-size: 15px; pointer-events: none; text-align: center; padding: 0 20px; }
    #scrollToBottom {
      position: absolute; left: 50%; bottom: var(--scroll-bottom-offset, 76px); z-index: 8;
      display: none; transform: translateX(-50%);
      padding: 8px 14px; border: 1px solid var(--border-soft); border-radius: 999px;
      background: color-mix(in srgb, var(--bg-soft) 90%, transparent);
      color: var(--text-label); box-shadow: 0 4px 14px rgba(120,90,80,.14);
      backdrop-filter: blur(8px); cursor: pointer; font-family: inherit; font-size: 12px;
    }
    #scrollToBottom:active { transform: translateX(-50%) scale(.96); }
    /* 聊天区 / 设置页 / 输入框统一使用细而淡的主题滚动条 */
    #messages, .sub-body, .panel-bottom, #workspaceList, #input, .theme-list {
      scrollbar-width: thin;
      scrollbar-color: color-mix(in srgb, var(--border-focus) 52%, transparent) transparent;
    }
    #messages::-webkit-scrollbar, .sub-body::-webkit-scrollbar,
    .panel-bottom::-webkit-scrollbar, #workspaceList::-webkit-scrollbar, #input::-webkit-scrollbar, .theme-list::-webkit-scrollbar { width: 4px; height: 4px; }
    #messages::-webkit-scrollbar-track, .sub-body::-webkit-scrollbar-track,
    .panel-bottom::-webkit-scrollbar-track, #workspaceList::-webkit-scrollbar-track, #input::-webkit-scrollbar-track, .theme-list::-webkit-scrollbar-track { background: transparent; }
    #messages::-webkit-scrollbar-thumb, .sub-body::-webkit-scrollbar-thumb,
    .panel-bottom::-webkit-scrollbar-thumb, #workspaceList::-webkit-scrollbar-thumb, #input::-webkit-scrollbar-thumb, .theme-list::-webkit-scrollbar-thumb {
      background: color-mix(in srgb, var(--border-focus) 52%, transparent);
      border-radius: 999px;
    }
    #messages::-webkit-scrollbar-thumb:hover, .sub-body::-webkit-scrollbar-thumb:hover,
    .panel-bottom::-webkit-scrollbar-thumb:hover, #workspaceList::-webkit-scrollbar-thumb:hover, #input::-webkit-scrollbar-thumb:hover, .theme-list::-webkit-scrollbar-thumb:hover {
      background: color-mix(in srgb, var(--bubble-deep) 72%, transparent);
    }
    #messages::-webkit-scrollbar-button, .sub-body::-webkit-scrollbar-button,
    .panel-bottom::-webkit-scrollbar-button, #workspaceList::-webkit-scrollbar-button, #input::-webkit-scrollbar-button, .theme-list::-webkit-scrollbar-button {
      display: none; width: 0; height: 0;
    }

    /* 日期分隔条:跨天出现一次,淡淡居中 */
    .date-divider {
      align-self: center;
      color: var(--text-soft);
      font-size: 11px;
      padding: 6px 14px;
      margin: 6px 0 10px;
      letter-spacing: 1px;
    }

    .msg-group { display: flex; flex-direction: column; margin-bottom: 12px; }
    .msg-group.search-hit .msg {
      box-shadow: 0 0 0 2px var(--border-focus), 0 8px 22px rgba(120,90,80,.12);
      animation: searchPulse 1.2s ease 1;
    }
    @keyframes searchPulse {
      0% { transform: scale(1); }
      35% { transform: scale(1.02); }
      100% { transform: scale(1); }
    }
    /* 你那边:气泡靠右,有最大宽度 */
.msg-group-me {
  align-self: flex-end; align-items: flex-end; max-width: 75%;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
    /* cc 那边:横铺,几乎占满,像 claude.ai 那样 */
    .msg-group-cc { align-self: stretch; align-items: flex-start; max-width: 100%; }

    .msg { word-wrap: break-word; line-height: 1.6; white-space: pre-wrap; }
    /* 你的:樱粉 → 珊瑚红,洲洲最初那张图里的两个粉 */
    .msg-me {
      background: linear-gradient(135deg, var(--bubble-light) 0%, var(--bubble-deep) 100%);
      color: var(--text-main);
      border-radius: 18px; border-bottom-right-radius: 6px;
      padding: 10px 14px;
      font-size: 14.5px;
      box-shadow: 0 1px 2px rgba(180, 130, 100, 0.06);
      -webkit-user-select: none; user-select: none;
      -webkit-touch-callout: none;
    }
    /* cc 的:横铺,无气泡,字稍微大一点,呼吸感更足 */
    .msg-cc {
      background: transparent;
      color: var(--text-main);
      padding: 2px 4px 2px 0;
      font-size: 15px;
      line-height: 1.7;
    }
    .msg-time { font-size: 10px; color: var(--text-soft); margin-top: 3px; padding: 0 6px; }
    .message-action-card button {
      padding: 8px 13px; border: none; border-radius: 9px; cursor: pointer;
      font-family: inherit; font-size: 13px;
    }
    #messageActionCancel { background: var(--bg-hover); color: var(--text-main); }
    #messageActionCopy { background: var(--bubble-light); color: var(--text-main); }
    #messageActionDelete { background: var(--bg-hover); color: var(--text-accent); box-shadow: inset 0 0 0 1px var(--border-focus); }
    #messageActionBox {
      position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center;
      padding: 16px; background: rgba(0,0,0,.22); z-index: 70;
    }
    .message-action-card {
      width: min(360px, 100%); padding: 12px; border-radius: 15px;
      background: var(--bg-soft); box-shadow: 0 8px 28px rgba(120,90,80,.18);
      display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    }
    .message-action-preview {
      grid-column: 1 / -1; padding: 10px; border-radius: 10px;
      background: var(--bg-hover); border: 1px solid var(--border-soft);
    }
    .message-action-preview-title { margin-bottom: 5px; color: var(--text-label); font-size: 12px; font-weight: 600; }
    #messageActionPreviewText {
      color: var(--text-main); font-size: 13px; line-height: 1.5;
      white-space: pre-wrap; word-break: break-word; max-height: 78px; overflow: hidden;
    }
    #messageActionPreviewMeta { margin-top: 6px; color: var(--text-soft); font-size: 11px; line-height: 1.4; }
    #toast {
      position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 90;
      transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
      padding: 9px 16px; border-radius: 999px;
      background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
      border: 1px solid var(--border-soft); color: var(--text-label);
      box-shadow: 0 8px 24px rgba(120, 90, 80, .14);
      backdrop-filter: blur(10px); font-size: 13px; font-weight: 600;
      transition: opacity .18s ease, transform .18s ease;
    }
    #toast.show { opacity: 1; transform: translate(-50%, 0); }
    .retry-actions { display: flex; gap: 8px; margin-top: 8px; }
    .retry-btn {
      border: 1px solid var(--border-soft); border-radius: 999px;
      background: var(--bubble-light); color: var(--text-label);
      padding: 6px 12px; font-family: inherit; font-size: 12px;
      font-weight: 600; cursor: pointer;
    }
    .retry-btn:disabled { opacity: .58; cursor: wait; }
    .chat-load-older {
      align-self: center; margin: 0 0 12px; padding: 6px 12px;
      border: 1px solid var(--border-soft); border-radius: 999px;
      background: var(--bg-hover); color: var(--text-label);
      font-family: inherit; font-size: 12px; font-weight: 600;
      cursor: pointer;
    }
    .chat-load-older:active { transform: scale(.98); }

    /* 收藏:双击消息时短促弹一下;已收藏的尾巴上挂个心 */
    .msg { transition: transform 0.15s ease; }
    @keyframes favPulse {
      0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); }
    }
    .msg.fav-pulse { animation: favPulse 0.32s ease; }
    .msg.is-fav::after {
      content: " ♥"; color: var(--bubble-deep);
      font-size: 12px; margin-left: 4px; vertical-align: middle;
    }
    /* 你的消息有粉气泡,颜色加深一档让心看得清 */
    .msg-me.is-fav::after { color: var(--text-accent); opacity: 0.85; }
    .msg-images {
      display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px;
    }
    .msg-image {
      max-width: min(220px, 62vw); max-height: 220px;
      border-radius: 12px; border: 1px solid var(--border-soft);
      object-fit: cover; display: block; background: white;
    }

    /* 收藏二级页 */
    #favList { display: flex; flex-direction: column; gap: 12px; }
    .fav-item {
      background: var(--bg-soft); border: 1px solid var(--border-soft);
      border-radius: 12px; padding: 12px 14px;
    }
    .fav-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
    .fav-who { font-size: 12px; font-weight: 600; color: var(--text-accent); }
    .fav-who-me { color: var(--text-accent); }
    .fav-who-cc { color: var(--bubble-deep); }
    .fav-from { font-size: 11px; color: var(--text-soft); }
    .fav-text { font-size: 14px; color: var(--text-main); line-height: 1.6;
      white-space: pre-wrap; word-wrap: break-word;
      -webkit-user-select: text; user-select: text; }
    .fav-remove {
      margin-top: 8px; padding: 4px 10px; font-size: 11px;
      background: transparent; color: var(--text-soft);
      border: 1px solid var(--border-soft); border-radius: 8px;
      cursor: pointer; font-family: inherit;
    }
    .fav-remove:hover { color: var(--text-accent); border-color: var(--border-focus); }
    .fav-empty {
      text-align: center; color: var(--text-soft); font-size: 13px;
      padding: 60px 20px; line-height: 1.8;
    }
    .fav-empty-hint { font-size: 12px; color: var(--text-soft); opacity: 0.7; }

    .search-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
    .search-meta { font-size: 12px; color: var(--text-soft); min-height: 16px; }
    #searchResults { display: flex; flex-direction: column; gap: 10px; }
    .search-result {
      width: 100%; text-align: left; border: 1px solid var(--border-soft);
      background: var(--bg-soft); color: var(--text-main); border-radius: 12px;
      padding: 11px 12px; cursor: pointer; font-family: inherit;
    }
    .search-result:active { transform: scale(.99); }
    .search-result-meta {
      display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px;
      color: var(--text-soft); font-size: 11px; line-height: 1.4;
    }
    .search-result-who { color: var(--text-accent); font-weight: 700; }
    .search-result-text {
      color: var(--text-main); font-size: 13px; line-height: 1.55;
      white-space: pre-wrap; word-break: break-word;
    }
    .search-result-text mark {
      padding: 0 2px; border-radius: 4px;
      background: var(--bubble-light); color: var(--text-accent);
    }

    /* 摘要区:在 profile 页底部 */
    .summary-section {
      margin-top: 22px; padding-top: 16px;
      border-top: 1px dashed var(--divider);
    }
    .summary-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
    .summary-title { font-size: 13px; color: var(--text-label); font-weight: 600; }
    .summary-meta { font-size: 11px; color: var(--text-soft); }
    .summary-hint { font-size: 11px; color: var(--text-soft); margin: 0 0 8px; line-height: 1.5; }
    #summaryText {
      width: 100%; min-height: 100px; padding: 10px;
      border-radius: 10px; border: 1px solid var(--border-soft);
      background: white; font-family: inherit; font-size: 13px;
      line-height: 1.6; color: var(--text-main); outline: none;
      resize: vertical;
    }
    #summaryText:focus { border-color: var(--bubble-deep); }
    #summaryText:read-only { background: var(--bg-readonly); color: var(--text-label); }
    .summary-btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
    .summary-btn-row .mini-btn { flex: 1 1 0; width: auto; padding: 9px; font-size: 13px; }
    .summary-section .switch-row { margin: 0 0 8px; }
    .summary-clear {
      background: transparent !important; color: var(--text-soft) !important;
      border: 1px solid var(--border-soft) !important;
    }
    .prompt-preview-btn {
      margin-top: 8px !important;
      background: transparent !important;
      color: var(--text-label) !important;
      border: 1px solid var(--border-soft) !important;
    }
    #promptPreviewBox {
      position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
      padding: 18px; background: rgba(0,0,0,.28); z-index: 75;
    }
    .prompt-preview-card {
      width: min(620px, 100%); max-height: min(78vh, 720px);
      display: flex; flex-direction: column;
      padding: 16px; border-radius: 16px;
      background: var(--bg-soft); border: 1px solid var(--border-soft);
      box-shadow: 0 10px 34px rgba(120, 90, 80, .18);
    }
    .prompt-preview-head {
      display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
      margin-bottom: 10px;
    }
    .prompt-preview-title { color: var(--text-main); font-size: 15px; font-weight: 700; }
    .prompt-preview-meta { color: var(--text-soft); font-size: 11px; }
    #promptPreviewText {
      flex: 1; min-height: 260px; padding: 12px;
      border: 1px solid var(--border-soft); border-radius: 12px;
      background: white; color: var(--text-main);
      font-family: inherit; font-size: 12.5px; line-height: 1.6;
      resize: none; outline: none;
    }
    .prompt-preview-actions { display: flex; gap: 8px; margin-top: 10px; }
    .prompt-preview-actions button {
      flex: 1; border: none; border-radius: 12px; padding: 10px;
      font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    }
    #copyPromptPreview { background: var(--bubble-light); color: var(--text-label); }
    #closePromptPreview { background: var(--bg-hover); color: var(--text-accent); box-shadow: inset 0 0 0 1px var(--border-focus); }

    /* 整理回忆时的小提示:输入框上方飘一条 */
    .compress-hint {
      text-align: center;
      font-size: 11px; color: var(--text-soft);
      padding: 6px 12px;
      background: var(--bg-soft);
      border-top: 1px solid var(--divider);
      display: none;
    }

    /* 跟随主题的滑动开关 */
    .switch-row{ display:flex; align-items:center; justify-content:space-between; gap:12px;
      padding:11px 14px; background:var(--bg-soft); border:1px solid var(--border-soft);
      border-radius:14px; margin:4px 0 2px; }
    .switch-row .switch-text{ display:flex; flex-direction:column; gap:2px; min-width:0; }
    .switch-row .switch-label{ font-size:14px; color:var(--text-main); }
    .switch-row .switch-hint{ font-size:11px; color:var(--text-soft); line-height:1.3; }
    .switch{ position:relative; width:46px; height:26px; flex:0 0 auto; cursor:pointer; }
    .switch input{ position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
    .switch .track{ position:absolute; inset:0; border-radius:999px; background:var(--border-soft);
      transition:background .25s ease; }
    .switch .knob{ position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%;
      background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.18); transition:transform .25s ease; }
    .switch input:checked ~ .track{ background:var(--bubble-deep); }
    .switch input:checked ~ .knob{ transform:translateX(20px); }

    /* 思考链:折叠按钮淡淡的,展开后像引用块 */
    .think-toggle {
      align-self: flex-start;
      background: var(--think-bg);
      border: 1px dashed var(--think-border);
      color: var(--think-text);
      font-size: 11px;
      padding: 4px 10px;
      border-radius: 12px;
      margin-bottom: 5px;
      cursor: pointer;
      user-select: none;
      transition: background 0.15s;
    }
    .think-toggle:hover { background: var(--think-bg-hover); }
    .think-content {
      background: var(--think-c-bg);
      border-left: 2px solid var(--think-c-border);
      color: var(--text-label);
      font-size: 12px;
      line-height: 1.6;
      padding: 8px 12px;
      margin-bottom: 6px;
      border-radius: 0 10px 10px 0;
      white-space: pre-wrap;
      max-width: 100%;
    }
    .think-content.hidden { display: none; }

    /* ===== 圆圆:微信表情包"睡帽圆圆",可拖动 ===== */
    #yuanyuan {
      position: absolute;
      right: 10px;
      bottom: 68px;
      width: 78px;
      height: 78px;
      pointer-events: auto;            /* 能被摸到、能拖 */
      touch-action: none;              /* 拖她时别把页面也跟着滚了 */
      cursor: grab;
      -webkit-user-select: none; user-select: none;
      z-index: 5;
      animation: yy-breathe 3.5s ease-in-out infinite;
      transform-origin: center bottom;
    }
    #yuanyuan:active { cursor: grabbing; }
    /* 拖动中:停掉呼吸,免得 transform 和位置打架 */
    #yuanyuan.yy-still { animation: none; }
    /* 归位/掉落:让 left/top 平滑滑过去。掉落放慢到 1s,看清圆圆表情 */
    #yuanyuan.yy-fall {
      animation: none;
      transition: left 0.45s ease, top 1s cubic-bezier(0.5, 0.02, 0.5, 1.05);
    }
    @media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
      #yuanyuan { animation: none; }
      .msg.fav-pulse { animation: none; }
    }
    #yuanyuan img {
      position: absolute; top: 0; left: 0;
      width: 100%; height: 100%;
      object-fit: contain;
      transition: opacity 0.25s;
    }
    #yuanyuan img { opacity: 1; }

    /* 呼吸:身体非常轻微地涨缩 */
    @keyframes yy-breathe {
      0%, 100% { transform: scale(1, 1); }
      50%      { transform: scale(1.03, 0.97); }
    }

    /* ===== 输入栏:贴底,像微信 ===== */
    .inputbar {
      display: flex; gap: 8px;
      align-items: flex-end;
      padding: 10px 12px;
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
      background: var(--bg-soft);
      border-top: 1px solid var(--divider);
      flex-shrink: 0;
    }
    #attachImage {
      width: 42px; height: 42px; flex: 0 0 42px;
      border: 1px solid var(--border-soft); border-radius: 50%;
      background: white; color: var(--text-label);
      font-size: 22px; line-height: 1; cursor: pointer;
      font-family: inherit;
    }
    #attachImage:active { transform: scale(.96); }
    .image-preview {
      position: relative; width: 42px; height: 42px; flex: 0 0 42px;
      border-radius: 12px; overflow: hidden;
      border: 1px solid var(--border-soft);
      background: white;
    }
    .image-preview img {
      width: 100%; height: 100%; object-fit: cover; display: block;
    }
    #removeImage {
      position: absolute; right: -1px; top: -1px;
      width: 18px; height: 18px; border: 0; border-radius: 0 0 0 8px;
      background: rgba(0,0,0,.55); color: white;
      font-size: 14px; line-height: 18px; padding: 0; cursor: pointer;
    }
    #input {
      flex: 1; padding: 10px 18px 10px 14px;
      border-radius: 20px;
      border: 1px solid var(--border-soft);
      background: white;
      font-size: 16px;
      line-height: 1.45;
      min-height: 42px;
      max-height: 132px;
      overflow-y: hidden;
      resize: none;
      font-family: inherit;
      outline: none;
    }
    #input:focus { border-color: var(--bubble-deep); }
    #input::-webkit-scrollbar-track { margin: 10px 0; }
    #send {
      min-width: 58px; padding: 10px 18px; border: none; border-radius: 20px;
      background: linear-gradient(135deg, var(--btn-soft-1) 0%, var(--btn-soft-2) 100%);
      color: var(--btn-soft-text); cursor: pointer; font-size: 14px; font-weight: 600;
    }
    #send.is-stop { background: var(--bg-hover); color: var(--text-accent); box-shadow: inset 0 0 0 1px var(--border-focus); }
    #send:disabled { opacity: .68; cursor: default; }
    #send:active { transform: scale(0.96); }

    #overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.3); display: none; z-index: 10; }
    #panel { position: fixed; top: 0; left: 0; bottom: 0; width: min(88vw, 560px); background: var(--bg-soft);
      box-shadow: 2px 0 12px rgba(180, 130, 100, 0.12); transform: translateX(-100%); transition: transform 0.25s; z-index: 20;
      display: flex; flex-direction: column; }
    #panel.open { transform: translateX(0); }

    /* 一级页里那三个跳转 row:左字右箭头,长得像 iOS 设置项 */
    .settings-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 12px 14px; margin-bottom: 8px;
      background: white;
      border: 1px solid var(--border-soft);
      border-radius: 12px;
      cursor: pointer;
      font-size: 14px; color: var(--text-main);
      transition: background 0.15s, border-color 0.15s;
    }
    .settings-row:hover { background: var(--bg-hover); border-color: var(--border-focus); }
    .settings-row:active { transform: scale(0.99); }
    .settings-row .arrow { color: var(--text-soft); font-size: 18px; line-height: 1; }

    /* 二级页:Profile / 记忆 / API key 共用这一套外壳 */
    .sub-page { flex: 1; display: none; flex-direction: column; overflow: hidden; }
    .sub-header {
      display: flex; align-items: center; gap: 6px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--divider);
      background: var(--bg-soft);
      flex-shrink: 0;
    }
    .back-btn {
      background: none; border: none; cursor: pointer;
      color: var(--text-accent); font-size: 14px;
      padding: 4px 8px; line-height: 1;
      font-family: inherit;
    }
    .back-btn:active { transform: scale(0.95); }
    .sub-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
    .sub-body { flex: 1; overflow-y: auto; padding: 18px 18px 20px; }
    .sub-body-flex { display: flex; flex-direction: column; }   /* 记忆页那个 textarea 要撑满,需要 flex */

    .panel-top { padding: 18px 20px 14px; border-bottom: 1px solid var(--divider); }
    .field { margin-bottom: 12px; }
    .profile-name-row { display: flex; gap: 10px; }
    .profile-name-row .field { flex: 1 1 0; min-width: 0; }
    .field label { display: block; font-size: 12px; color: var(--text-label); margin-bottom: 4px; }
    .field input, .field textarea, .field select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-soft);
      background: white; font-family: inherit; font-size: 13px; outline: none; color: var(--text-main); }
    .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--bubble-deep); }
    .secret-field { display: flex; gap: 6px; align-items: stretch; }
    .secret-field input { flex: 1; min-width: 0; }
    .icon-mini-btn {
      width: 38px; flex: 0 0 38px; border-radius: 9px; border: 1px solid var(--border-soft);
      background: var(--bg-hover); color: var(--text-label); cursor: pointer; font-family: inherit; font-size: 12px;
    }
    .icon-mini-btn:active { transform: scale(.96); }
    .api-btn-row { display: flex; gap: 8px; margin-top: 6px; }
    .api-btn-row .mini-btn { flex: 1; margin-top: 0 !important; }
    .mini-btn.secondary { background: var(--bg-hover); color: var(--text-main); border: 1px solid var(--border-soft); }
    .mini-btn:disabled { opacity: .62; cursor: default; transform: none; }
    .status-card {
      margin-top: 12px; padding: 10px 11px; border-radius: 10px;
      background: var(--bg-hover); border: 1px solid var(--border-soft);
    }
    .status-row {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      padding: 5px 0; color: var(--text-label); font-size: 12px;
    }
    .status-row + .status-row { border-top: 1px solid var(--divider); }
    .status-value { color: var(--text-main); font-weight: 600; text-align: right; }
    .status-value.good { color: #4E8C82; }
    .status-value.warn { color: var(--text-accent); }
    .status-value.muted { color: var(--text-soft); }
    #refreshApiStatus { margin-top: 8px; background: transparent; color: var(--text-label); border: 1px solid var(--border-soft); }
    .pretty-select { position: relative; }
    .pretty-select select { display: none; }
    .pretty-select-btn {
      width: 100%; padding: 9px 32px 9px 11px; border-radius: 10px;
      border: 1px solid var(--border-soft); background: var(--bg-soft);
      color: var(--text-main); cursor: pointer; font-family: inherit; font-size: 13px;
      text-align: left; position: relative; box-shadow: 0 1px 3px rgba(180,130,100,0.06);
    }
    .pretty-select-btn::after {
      content: ""; position: absolute; right: 12px; top: 50%;
      width: 7px; height: 7px; border-right: 2px solid var(--text-accent);
      border-bottom: 2px solid var(--text-accent); transform: translateY(-70%) rotate(45deg);
      transition: transform .15s;
    }
    .pretty-select.open .pretty-select-btn { border-color: var(--border-focus); background: var(--bg-hover); }
    .pretty-select.open .pretty-select-btn::after { transform: translateY(-20%) rotate(225deg); }
    .pretty-select-menu {
      display: none; position: absolute; left: 0; right: 0; top: calc(100% + 5px);
      z-index: 40; padding: 5px; border-radius: 11px; border: 1px solid var(--border-soft);
      background: var(--bg-soft); box-shadow: 0 8px 18px rgba(180,130,100,.15);
    }
    .pretty-select.open .pretty-select-menu { display: flex; flex-direction: column; gap: 3px; }
    .pretty-select-option {
      padding: 8px 9px; border-radius: 8px; color: var(--text-main);
      cursor: pointer; font-size: 13px; line-height: 1.25;
    }
    .pretty-select-option:hover { background: var(--bg-hover); }
    .pretty-select-option.selected { background: var(--bubble-light); color: var(--text-label); font-weight: 600; }
    .field textarea { height: 110px; min-height: 110px; resize: vertical; }
    .field-check { margin-bottom: 12px; }
    .field-check label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-label); cursor: pointer; }
    .field-check input { width: auto; cursor: pointer; }
    #apikeyPage .switch-row { margin: 2px 0 12px; }
    .mini-btn { width: 100%; padding: 9px; border: none; border-radius: 10px;
      background: linear-gradient(135deg, var(--btn-soft-1) 0%, var(--btn-soft-2) 100%);
      color: var(--btn-soft-text); cursor: pointer; font-size: 13px; font-weight: 600; }
    .mini-btn:active { transform: scale(0.98); }
    .saved-hint { font-size: 12px; color: var(--text-accent); text-align: center; height: 14px; margin-top: 6px; }
    /* 新窗口和编辑记忆稍微换个方向,做出层级差异 */
    #newWindowBtn { margin-top: 10px; background: linear-gradient(135deg, var(--btn-deep-1) 0%, var(--btn-deep-2) 100%); color: var(--btn-deep-text); }

    .panel-bottom { flex: 1; overflow-y: auto; padding: 12px 14px; }
    .panel-bottom .list-title { font-size: 12px; color: var(--text-soft); margin: 0 6px 8px; }
    .window-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text-main); font-size: 14px;
      margin-bottom: 4px; position: relative;
      -webkit-user-select: none; user-select: none;
      -webkit-touch-callout: none; }
    .window-item .win-name { display: block; }
    .window-item:hover { background: var(--bg-hover); }
    .window-item.active { background: linear-gradient(135deg, var(--btn-soft-1) 0%, var(--btn-soft-2) 100%); color: var(--btn-soft-text); font-weight: 600; }
    .win-actions {
      position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
      display: none; gap: 4px;
    }
    .window-item.show-delete .win-actions { display: flex; }
    .workspace-item.show-delete .win-actions { display: flex; }
    .action-btn {
      border: none; border-radius: 8px; font-size: 12px; padding: 4px 8px; cursor: pointer;
      -webkit-user-select: none; user-select: none;
      -webkit-touch-callout: none;
    }
    .rename-btn { background: var(--btn-soft-1); color: var(--btn-soft-text); }
    .delete-btn  { background: var(--bg-hover); color: var(--text-accent); box-shadow: inset 0 0 0 1px var(--border-focus); }

    .sub-body .hint { font-size: 12px; color: var(--text-soft); margin: 0 0 10px; line-height: 1.5; }
    #memoryText { flex: 1; width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border-soft);
      background: white; font-family: inherit; font-size: 13px; resize: none; line-height: 1.6; color: var(--text-main); outline: none; }
    #memoryText:focus { border-color: var(--bubble-deep); }
    #memoryText:read-only { background: var(--bg-readonly); color: var(--text-label); }
    .mem-btn-row { display: flex; gap: 8px; margin-top: 10px; }
    .mem-btn-row .mini-btn { margin: 0; }
    .mem-btn-row .mini-btn:disabled { opacity: .58; cursor: wait; }
    #editMemory { background: linear-gradient(135deg, var(--btn-deep-1) 0%, var(--btn-deep-2) 100%); color: var(--btn-deep-text); }

    #settingsPage { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

    #confirmBox { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.35); display: none;
      align-items: center; justify-content: center; z-index: 60; }
    .confirm-card { background: var(--bg-soft); border-radius: 16px; padding: 22px 20px; width: 240px; text-align: center;
      box-shadow: 0 8px 32px rgba(180, 130, 100, 0.18); }
    .confirm-card p { color: var(--text-main); font-size: 14px; margin: 0 0 18px; line-height: 1.5; }
    .confirm-row { display: flex; gap: 10px; }
    .confirm-row button { flex: 1; padding: 10px; border: none; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 500; }
    #confirmYes { background: var(--bg-hover); color: var(--text-accent); box-shadow: inset 0 0 0 1px var(--border-focus); }
    #confirmNo { background: var(--bubble-light); color: var(--text-main); }
