    * { margin: 0; padding: 0; box-sizing: border-box; }
    .hidden { display: none !important; }
    :root {
      --ba-pink: #e87d95;
      --ba-pink-deep: #ce6b83;
      --header-top: #f4b3c4;
      --header-bottom: #ec8aa0;
      --chat-bg: #fff5f8;
      --bubble-user: #ee8fa3;
      --bubble-user-deep: #dd7189;
      --bubble-bot: #ffffff;
      --bubble-border: #f3dbe2;
      --text: #333c45;
      --text-dim: #8ea0b3;
      --text-light: #ffffff;
      --divider: #d9a3b3;
      --input-bg: #fceef3;
      --border: #f1d7df;
    }
    html, body { height: 100%; }
    body {
      background: linear-gradient(160deg, #f9e3ea 0%, #fdf4f6 55%, #f7dbe4 100%);
      color: var(--text);
      font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
      display: flex;
      justify-content: center;
      align-items: stretch;
    }

    /* ===== 手机应用窗口 ===== */
    .app {
      width: 100%;
      max-width: 520px;
      height: 100vh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      background: var(--chat-bg);
      box-shadow: 0 0 48px rgba(200, 110, 150, .28);
      position: relative;
    }
    /* ===== 视图切换 ===== */
    .view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
    .view.hidden { display: none; }
    /* ===== 聊天列表 ===== */
    .list-header {
      position: relative;
      flex-shrink: 0;
      background: linear-gradient(180deg, var(--header-top) 0%, var(--header-bottom) 100%);
      color: var(--text-light);
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      box-shadow: 0 1px 6px rgba(200, 110, 150, .28);
      z-index: 5;
    }
    .list-header .name {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: 1px;
      text-shadow: 0 1px 2px rgba(0,0,0,.12);
    }
    #momotalkLogo { display: inline-block; position: relative; overflow: visible; }
    .list-header .sub {
      font-size: 11.5px;
      opacity: .92;
    }
    .head-info { position: relative; }
    .announce-dot {
      position: absolute;
      top: -2px;
      right: -6px;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #ff4d6a;
      box-shadow: 0 0 0 2px rgba(255,255,255,.35);
      animation: announceBlink 1.2s ease-in-out infinite;
    }
    @keyframes announceBlink {
      0%, 100% { opacity: 1; }
      50% { opacity: .2; }
    }
    #charList {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 10px 10px 16px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      background-color: var(--chat-bg);
      background-image: radial-gradient(rgba(255,255,255,.9) 1.3px, transparent 1.5px);
      background-size: 26px 26px;
    }
    .char-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 14px;
      cursor: pointer;
      background: #fff;
      border: 1px solid var(--bubble-border);
      box-shadow: 0 1px 3px rgba(200,110,150,.10);
      transition: transform .1s ease, background .15s ease;
    }
    .char-item:hover { background: #fffafc; transform: translateY(-1px); }
    .char-item img {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      object-fit: cover;
      object-position: 50% 12%;
      border: 2px solid #fff;
      box-shadow: 0 1px 4px rgba(0,0,0,.12);
      flex-shrink: 0;
      background: #fff;
    }
    .char-item .ci-info { flex: 1; min-width: 0; }
    .char-item .ci-name { font-size: 15px; font-weight: 700; color: #5a4a52; }
    .char-item .ci-school { font-size: 11px; color: #b98fa0; margin-left: 6px; }
    .char-item .ci-preview {
      font-size: 12px;
      color: var(--text-dim);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 2px;
    }
    .char-item .ci-time {
      font-size: 10.5px;
      color: #bfa0ac;
      flex-shrink: 0;
      align-self: flex-start;
      margin-top: 2px;
    }
    @media (min-width: 560px) {
      body { padding: 18px 0; }
      .app {
        height: calc(100vh - 36px);
        border-radius: 24px;
        overflow: hidden;
        border: 1px solid rgba(255,255,255,.8);
      }
    }

    /* ===== MomoTalk 顶部栏 ===== */
    header {
      flex-shrink: 0;
      background: linear-gradient(180deg, var(--header-top) 0%, var(--header-bottom) 100%);
      color: var(--text-light);
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      position: relative;
      box-shadow: 0 1px 6px rgba(200, 110, 150, .28);
      z-index: 5;
    }
    .back-btn {
      font-size: 26px;
      line-height: 1;
      padding: 2px 6px 4px 2px;
      cursor: default;
      opacity: .95;
      user-select: none;
    }
    .avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: 2px solid rgba(255,255,255,.9);
      object-fit: cover;
      object-position: 50% 12%;
      background: #fff;
      box-shadow: 0 1px 4px rgba(0,0,0,.15);
      flex-shrink: 0;
    }
    .head-info { flex: 1; min-width: 0; }
    .head-info .name {
      font-size: 17px;
      font-weight: 700;
      letter-spacing: .5px;
      line-height: 1.25;
      text-shadow: 0 1px 2px rgba(0,0,0,.12);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .head-info .sub {
      font-size: 11.5px;
      opacity: .92;
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    /* 反馈弹窗 */
    .fb-mask {
      position: fixed;
      inset: 0;
      background: rgba(90,60,75,.35);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 999;
    }
    .fb-box {
      width: min(340px, 86vw);
      background: #fff;
      border-radius: 16px;
      padding: 16px;
      box-shadow: 0 8px 30px rgba(120,70,90,.28);
    }
    .fb-title {
      font-size: 15px;
      font-weight: 700;
      color: #5b4250;
      margin-bottom: 10px;
    }
    .fb-box textarea {
      width: 100%;
      box-sizing: border-box;
      min-height: 110px;
      resize: vertical;
      border: 1px solid #f0dbe3;
      border-radius: 10px;
      padding: 9px;
      font-size: 13px;
      color: #5a4a52;
      font-family: inherit;
      outline: none;
    }
    .fb-box textarea:focus { border-color: #e3b7c6; }
    .fb-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 10px;
    }
    .fb-actions button {
      border: none;
      border-radius: 10px;
      padding: 7px 14px;
      font-size: 13px;
      cursor: pointer;
    }
    .fb-actions #feedbackCancel {
      background: #f5eaf0;
      color: #a08a96;
    }
    .fb-actions #feedbackSend {
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
    }
    .menu-btn {
      font-size: 24px;
      padding: 2px 10px 0;
      cursor: pointer;
      user-select: none;
      border-radius: 10px;
    }
    #listFeedbackBtn {
      font-size: 13px;
      line-height: 30px;
      padding: 0 10px;
      font-weight: 600;
      letter-spacing: 1px;
      position: relative;
    }
    .fb-badge {
      position: absolute;
      top: -2px;
      right: -4px;
      min-width: 14px;
      height: 14px;
      line-height: 14px;
      padding: 0 3px;
      border-radius: 8px;
      background: #e53935;
      color: #fff;
      font-size: 10px;
      text-align: center;
      box-sizing: border-box;
    }
    .fb-badge.blink {
      animation: fbBlink 1s ease-in-out infinite;
    }
    @keyframes fbBlink {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.2; }
    }
    .menu-btn:hover { background: rgba(255,255,255,.18); }
    .menu-btn svg { display: block; margin: 1px auto 0; }
    .model-pop {
      position: absolute;
      top: 58px;
      right: 12px;
      background: #fff;
      border-radius: 14px;
      box-shadow: 0 6px 24px rgba(190,100,140,.22);
      padding: 12px;
      display: none;
      min-width: 250px;
      max-height: calc(100dvh - 80px);
      overflow-y: auto;
      z-index: 20;
    }
    .model-pop.show { display: block; }
    .model-field { margin-bottom: 10px; }
    .model-field label {
      display: block;
      font-size: 12px;
      color: var(--text-dim);
      margin-bottom: 4px;
    }
    .model-field input[type="text"],
    .model-field input[type="password"],
    .model-field input[type="number"] {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 7px 9px;
      font-size: 13px;
      outline: none;
      font-family: inherit;
      color: var(--text);
    }
    .model-field input:focus { border-color: var(--ba-pink); }
    .model-field small {
      display: block;
      font-size: 10.5px;
      color: #a08a96;
      margin-top: 3px;
      line-height: 1.4;
    }
    .model-field.check {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
    }
    .model-field.check label { margin: 0; flex: 1; color: #5a4a52; font-size: 13px; }
    .model-field.check input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--ba-pink);
      flex-shrink: 0;
    }
    .model-tip {
      font-size: 10.5px;
      color: #a08a96;
      line-height: 1.5;
      margin-bottom: 10px;
    }
    .model-save {
      width: 100%;
      border: none;
      border-radius: 10px;
      padding: 9px;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
      font-size: 13.5px;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(221,111,154,.3);
    }
    .model-save:active { transform: scale(.97); }
    .model-key-test {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 8px;
    }
    .login-hint {
      margin: auto;
      max-width: 260px;
      text-align: center;
      padding: 26px 20px;
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 4px 18px rgba(190,100,140,.18);
    }
    .lh-icon { font-size: 32px; }
    .lh-title { font-size: 15px; font-weight: 700; color: #5b4250; margin: 10px 0 6px; }
    .lh-desc { font-size: 15px; color: #a08a96; line-height: 1.8; }
    @keyframes pulseBtn {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.15); }
    }
    .pulse { animation: pulseBtn 1.2s ease-in-out infinite; }
    .model-key-test button {
      flex-shrink: 0;
      border: 1px solid #e3b7c6;
      border-radius: 10px;
      padding: 6px 10px;
      background: #fff;
      color: var(--ba-pink-deep);
      font-size: 12.5px;
      cursor: pointer;
    }
    .model-key-test button:active { transform: scale(.97); }
    .model-key-test span { font-size: 12px; color: #999; }
    .preset-btn {
      border: 1px solid #e3b7c6;
      border-radius: 8px;
      padding: 4px 9px;
      background: #fff;
      color: var(--ba-pink-deep);
      font-size: 12px;
      cursor: pointer;
    }
    .preset-btn:hover { background: #fdf0f6; }
    .preset-btn:active { transform: scale(.97); }
    .api-key-row {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 2px;
    }
    .api-key-row input { flex: 1; min-width: 0; }
    .api-key-row button {
      flex-shrink: 0;
      border: 1px solid #e3b7c6;
      border-radius: 8px;
      padding: 5px 9px;
      background: #fff;
      color: var(--ba-pink-deep);
      font-size: 12px;
      cursor: pointer;
    }
    .api-key-row button:active { transform: scale(.97); }
    .api-key-result { font-size: 12px; color: #999; min-height: 16px; margin-bottom: 6px; }
    .menu-pop {
      position: absolute;
      top: 58px;
      right: 12px;
      background: #fff;
      border-radius: 14px;
      box-shadow: 0 6px 24px rgba(190,100,140,.22);
      padding: 12px;
      display: none;
      width: min(340px, calc(100vw - 24px));
      max-height: calc(100dvh - 80px);
      overflow-y: auto;
      z-index: 20;
    }
    .menu-pop.show { display: block; }
    .menu-pop label {
      display: block;
      font-size: 12px;
      color: var(--text-dim);
      margin-bottom: 6px;
    }
    .menu-pop input {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 8px 10px;
      font-size: 13px;
      outline: none;
      font-family: inherit;
    }
    .menu-pop input:focus { border-color: var(--ba-pink); }
    .session-row {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 6px;
      font-size: 11px;
      color: var(--text-dim);
    }
    .session-row code {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      background: #fdf3f7;
      border-radius: 7px;
      padding: 4px 7px;
      font-size: 10.5px;
      color: #a4748c;
    }
    .session-row button {
      border: 1px solid var(--border);
      background: #fff;
      color: #b06b83;
      border-radius: 7px;
      padding: 4px 8px;
      font-size: 10.5px;
      cursor: pointer;
      flex-shrink: 0;
    }
    .session-row button:hover { background: #fdf0f6; }
    .session-actions { margin-top: 6px; }
    .session-actions input {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 7px 9px;
      font-size: 12px;
      outline: none;
      font-family: inherit;
      color: var(--text);
    }
    .session-actions input:focus { border-color: var(--ba-pink); }
    .session-actions-row { display: flex; gap: 6px; margin-top: 6px; }
    .session-actions-row button {
      flex: 1;
      border: 1px solid var(--border);
      background: #fff;
      color: #b06b83;
      border-radius: 9px;
      padding: 7px 4px;
      font-size: 12px;
      cursor: pointer;
    }
    .session-actions-row button:hover { background: #fdf0f6; }
    .session-actions-row button.danger { color: #c96b6b; }
    .owner-row { display: flex; gap: 6px; }
    .owner-row input {
      flex: 1;
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 7px 9px;
      font-size: 12px;
      outline: none;
      font-family: inherit;
      color: var(--text);
    }
    .owner-row input:focus { border-color: var(--ba-pink); }
    .owner-row button {
      border: none;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
      border-radius: 9px;
      padding: 7px 12px;
      font-size: 12.5px;
      cursor: pointer;
    }
    .owner-status { font-size: 10.5px; color: #a08a96; margin-top: 4px; }
    .import-btn {
      width: 100%;
      border: 1px solid var(--border);
      background: #fff;
      color: #b06b83;
      border-radius: 10px;
      padding: 8px 4px;
      font-size: 12.5px;
      cursor: pointer;
    }
    .import-btn:hover { background: #fdf0f6; }
    /* ===== 会话管理（开发者） ===== */
    .session-mgr {
      position: fixed;
      inset: 0;
      background: #fff;
      z-index: 200;
      display: flex;
      flex-direction: column;
      padding: 14px;
      gap: 10px;
    }
    .session-mgr.hidden { display: none; }
    .sm-header { display: flex; align-items: center; justify-content: space-between; }
    .sm-header span { font-size: 16px; font-weight: 700; color: #5a4a52; }
    .sm-header button {
      border: none;
      background: #fdf0f6;
      color: #b06b83;
      border-radius: 10px;
      padding: 6px 12px;
      cursor: pointer;
      font-size: 13px;
    }
    .sm-back-row { display: flex; align-items: center; gap: 8px; }
    .sm-back-row.hidden { display: none; }
    .sm-back-row button {
      border: 1px solid var(--border);
      background: #fff;
      color: #b06b83;
      border-radius: 10px;
      padding: 6px 12px;
      cursor: pointer;
      font-size: 12.5px;
    }
    .sm-back-row button.sm-del {
      border-color: #e8b4c2;
      background: #fff5f7;
      color: #c2455f;
      margin-left: auto;
    }
    .sm-back-row button.sm-del:hover { background: #fde8ee; }
    .sm-current {
      flex: 1;
      min-width: 0;
      font-size: 11.5px;
      color: #a08a96;
      text-align: center;
      word-break: break-all;
      padding: 0 8px;
    }
    .sm-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
    .sm-item {
      border: 1px solid var(--bubble-border);
      border-radius: 12px;
      padding: 10px 12px;
      cursor: pointer;
      background: #fff;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .sm-item:hover { background: #fffafc; }
    .sm-item .sm-info { flex: 1; min-width: 0; }
    .sm-item .sm-id { font-size: 12.5px; color: #5a4a52; font-weight: 600; word-break: break-all; }
    .sm-item .sm-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
    .sm-item .sm-del {
      flex: none;
      border: 1px solid #e8b4c2;
      background: #fff5f7;
      color: #c2455f;
      border-radius: 8px;
      padding: 4px 10px;
      cursor: pointer;
      font-size: 12px;
    }
    .sm-item .sm-del:hover { background: #fde8ee; }
    .sm-msg {
      border-radius: 12px;
      padding: 8px 12px;
      font-size: 13px;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .sm-msg.user { background: #fdf0f6; align-self: flex-end; max-width: 90%; }
    .sm-msg.bot { background: #f7f9fb; align-self: flex-start; max-width: 90%; }
    .sm-msg .sm-role { font-size: 10px; color: #b06b83; font-weight: 600; margin-bottom: 2px; }
    .sm-msg img { width: 110px; border-radius: 10px; margin-top: 6px; display: block; }
    .sm-empty { color: #a08a96; text-align: center; padding: 40px 0; font-size: 13px; }
    .menu-divider {
      margin: 12px 0 8px;
      font-size: 11.5px;
      color: var(--ba-pink-deep);
      font-weight: 700;
      letter-spacing: 1px;
    }
    .settings-list {
      max-height: 220px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .setting-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 7px 6px;
      border-radius: 10px;
      cursor: pointer;
    }
    .setting-row:hover { background: #fdf0f6; }
    .setting-row .setting-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
    }
    .setting-row .setting-info b {
      font-size: 13px;
      color: #5a4a52;
      font-weight: 600;
    }
    .setting-row .setting-info small {
      font-size: 11px;
      color: #a08a96;
      line-height: 1.35;
    }
    .setting-row input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--ba-pink);
      flex-shrink: 0;
      margin: 0;
    }

    /* ===== 聊天区：浅粉波点背景 ===== */
    #chat {
      flex: 1;
      overflow-y: auto;
      padding: 16px 14px 10px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      background-color: var(--chat-bg);
      background-image: radial-gradient(rgba(255,255,255,.9) 1.3px, transparent 1.5px);
      background-size: 26px 26px;
      scroll-behavior: smooth;
    }

    /* ===== 日期分隔 ===== */
    .date-divider {
      align-self: center;
      font-size: 11.5px;
      color: var(--text-dim);
      background: rgba(255,255,255,.8);
      padding: 3px 12px;
      border-radius: 999px;
      margin: 2px 0;
      box-shadow: 0 1px 2px rgba(200,110,150,.10);
    }

    /* ===== 消息组 ===== */
    .group { display: flex; max-width: 86%; animation: groupIn .18s ease-out; }
    .group.bot { align-self: flex-start; align-items: flex-start; gap: 8px; }
    .group.user { align-self: flex-end; }
    .group .avatar {
      width: 38px;
      height: 38px;
      border-width: 1.5px;
      margin-top: 17px;
    }
    .group-body { display: flex; flex-direction: column; min-width: 0; }
    .group.bot .group-body { align-items: flex-start; }
    .group.user .group-body { align-items: flex-end; }

    /* MomoTalk 风格：名字 + 智能时间一行 */
    .meta {
      display: flex;
      align-items: baseline;
      gap: 6px;
      margin-bottom: 3px;
      white-space: nowrap;
    }
    .group.bot .meta { margin-left: 6px; }
    .group.user .meta { justify-content: flex-end; margin-right: 4px; }
    .name-label {
      font-size: 11.5px;
      color: #cf6f86;
      font-weight: 600;
    }
    .time {
      font-size: 10.5px;
      color: var(--text-dim);
    }

    .bubbles { display: flex; flex-direction: column; gap: 5px; }
    .group.bot .bubbles { align-items: flex-start; }
    .group.user .bubbles { align-items: flex-end; }
    .bubble {
      padding: 9px 13px;
      line-height: 1.6;
      font-size: 14.5px;
      white-space: pre-wrap;
      word-break: break-word;
      max-width: 100%;
      animation: bubbleIn .18s ease-out;
    }
    @keyframes groupIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes bubbleIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
    .group.bot .bubble {
      background: var(--bubble-bot);
      color: var(--text);
      border: 1px solid var(--bubble-border);
      border-radius: 18px 18px 18px 6px;
      box-shadow: 0 1px 3px rgba(200,110,150,.12);
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }
    .group.user .bubble {
      background: linear-gradient(180deg, var(--bubble-user) 0%, var(--bubble-user-deep) 100%);
      color: var(--text-light);
      border-radius: 18px 18px 6px 18px;
      box-shadow: 0 1px 3px rgba(200,110,150,.22);
    }

    /* 差分表情：包含在回复气泡内、位于文字上方 */
    .bubble .sprite {
      width: 150px;
      border-radius: 12px;
      margin-bottom: 8px;
      border: 1px solid var(--bubble-border);
      box-shadow: 0 2px 10px rgba(200,110,150,.22);
      display: none;
      object-fit: cover;
    }
    .bubble .sprite.show { display: block; }
    .bubble-text {
      white-space: pre-wrap;
      word-break: break-word;
    }
    .bubble-row { display: flex; align-items: flex-start; gap: 8px; max-width: 100%; }
    .group.bot .bubble-row { align-self: flex-start; }
    .group.user .bubble-row { align-self: flex-end; }
    .bubble-row .sel-check {
      display: none;
      width: 16px;
      height: 16px;
      margin-top: 12px;
      flex-shrink: 0;
      accent-color: var(--ba-pink);
      cursor: pointer;
    }
    .selecting .bubble-row .sel-check { display: inline-block; }
    .bubble-row .bubble { max-width: 100%; }
    .sel-bar {
      z-index: 70;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      background: #ffffff;
      border: 1px solid var(--border);
      border-radius: 24px;
      padding: 8px 14px;
      box-shadow: 0 4px 18px rgba(200, 110, 150, .25);
      font-size: 13px;
      color: var(--text);
      margin: 6px 12px 0;
      flex-shrink: 0;
    }
    .sel-bar.hidden { display: none; }
    .sel-confirm {
      border: none;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #ffffff;
      border-radius: 16px;
      padding: 6px 14px;
      font-size: 13px;
      cursor: pointer;
    }
    .sel-confirm:disabled { opacity: .5; cursor: default; }
    .sel-cancel {
      border: 1px solid var(--border);
      background: #ffffff;
      color: var(--text-dim);
      border-radius: 16px;
      padding: 6px 12px;
      font-size: 13px;
      cursor: pointer;
    }
    /* 系统提示：灰色小字（异常/限流/加载失败） */
    .sys-note {
      align-self: center;
      font-size: 11px;
      color: #a9a1a7;
      text-align: center;
      padding: 2px 0;
      line-height: 1.5;
    }
    .sys-note.demo {
      margin: 10px auto 4px;
      padding: 6px 14px;
      font-size: 12px;
      font-weight: 700;
      color: #8a4a68;
      background: #fbeef3;
      border: 1px dashed #e0a8bd;
      border-radius: 14px;
      letter-spacing: 0.5px;
    }

    /* ===== 正在输入（MomoTalk 风格三点） ===== */
    .typing {
      display: none;
      align-items: center;
      gap: 8px;
    }
    .typing.show { display: flex; animation: groupIn .18s ease-out; }
    .typing .bubble {
      background: var(--bubble-bot);
      border: 1px solid var(--bubble-border);
      border-radius: 18px 18px 18px 6px;
      box-shadow: 0 1px 3px rgba(200,110,150,.12);
      display: inline-flex;
      gap: 5px;
      padding: 13px 15px;
    }
    .typing .dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #e88bb0;
      animation: blink 1.2s infinite;
    }
    .typing .dot:nth-child(2) { animation-delay: .2s; }
    .typing .dot:nth-child(3) { animation-delay: .4s; }
    @keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

    /* ===== 底部输入栏 ===== */
    footer {
      flex-shrink: 0;
      background: #fff;
      border-top: 1px solid var(--border);
      padding: 10px 12px 12px;
      display: flex;
      align-items: flex-end;
      gap: 9px;
      position: relative;
    }
    .input-pill {
      flex: 1;
      display: flex;
      align-items: center;
      background: var(--input-bg);
      border-radius: 999px;
      padding: 4px 6px 4px 8px;
      min-height: 44px;
    }
    .input-pill textarea {
      flex: 1;
      resize: none;
      border: none;
      background: transparent;
      color: var(--text);
      font-size: 14.5px;
      font-family: inherit;
      line-height: 1.45;
      outline: none;
      max-height: 110px;
      padding: 8px 0;
    }
    .input-pill textarea::placeholder { color: #a5b3c2; }
    .send-btn {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      border: none;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
      font-size: 17px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 2px 6px rgba(221,111,154,.35);
      transition: transform .1s ease, opacity .15s ease;
    }
    .send-btn:active { transform: scale(.92); }
    .send-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

    /* ===== 菜单内命令区 ===== */
    .cmd-list {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }
    .cmd-item {
      border: 1px solid var(--border);
      background: #fff;
      color: #b06b83;
      font-size: 12.5px;
      padding: 7px 4px;
      border-radius: 10px;
      cursor: pointer;
      text-align: center;
      transition: background .15s ease;
    }
    .cmd-item:hover { background: #fdf0f6; }
    .cmd-list.busy .cmd-item { opacity: .45; pointer-events: none; }
    #affectionPop {
      display: flex;
      gap: 6px;
      margin-top: 8px;
    }
    #affectionPop.hidden { display: none; }
    #affectionPop input {
      flex: 1;
      border: 1px solid var(--border);
      border-radius: 9px;
      padding: 6px 8px;
      font-size: 13px;
      outline: none;
      font-family: inherit;
    }
    #affectionPop input:focus { border-color: var(--ba-pink); }
    #affectionPop button {
      border: none;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
      border-radius: 9px;
      padding: 6px 12px;
      font-size: 12.5px;
      cursor: pointer;
    }

    /* ===== 回到底部按钮 ===== */
    #backToBottom {
      position: fixed;
      right: calc(50% - 260px + 18px);
      bottom: 116px;
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 50%;
      background: linear-gradient(180deg, var(--ba-pink) 0%, var(--ba-pink-deep) 100%);
      color: #fff;
      font-size: 16px;
      cursor: pointer;
      z-index: 50;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 14px rgba(221,111,154,.38);
      opacity: 0;
      transform: translateY(10px);
      pointer-events: none;
      transition: opacity .2s ease, transform .2s ease;
    }
    @media (max-width: 560px) {
      #backToBottom { right: 18px; }
    }
    #backToBottom.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
    #newCount {
      position: absolute;
      top: -3px;
      right: -3px;
      min-width: 17px;
      height: 17px;
      padding: 0 4px;
      border-radius: 999px;
      background: #ef476f;
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      line-height: 17px;
      text-align: center;
      box-shadow: 0 1px 3px rgba(0,0,0,.25);
    }

    #toast {
      position: fixed;
      top: 74px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(140,70,105,.92);
      color: #fff;
      padding: 8px 16px;
      border-radius: 999px;
      font-size: 12.5px;
      display: none;
      z-index: 99;
      box-shadow: 0 4px 14px rgba(0,0,0,.2);
    }

    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #e3a5b8, #d08ea4); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: #c77f97; }

    /* ===== 高级感润色：层次、材质与微动效 ===== */
    :root {
      --shadow-soft: 0 1px 2px rgba(150,70,100,.10), 0 10px 28px rgba(150,70,100,.12);
      --shadow-float: 0 2px 6px rgba(150,70,100,.12), 0 18px 44px rgba(150,70,100,.18);
    }

    body {
      background:
        radial-gradient(900px 520px at 12% -8%, rgba(232,125,149,.14), transparent 60%),
        radial-gradient(760px 480px at 92% 108%, rgba(206,107,131,.13), transparent 60%),
        linear-gradient(160deg, #f9e3ea 0%, #fdf4f6 55%, #f7dbe4 100%);
      background-attachment: fixed;
    }

    .app {
      box-shadow: 0 0 0 1px rgba(255,255,255,.55) inset, 0 30px 70px rgba(150,70,100,.20);
    }

    /* 顶部栏：内高光 + 更深投影 */
    header {
      box-shadow: 0 1px 0 rgba(255,255,255,.32) inset, 0 2px 12px rgba(150,70,100,.20);
    }
    header .back-btn,
    header .menu-btn {
      transition: background .15s ease, transform .15s ease;
    }
    header .back-btn:hover,
    header .menu-btn:hover {
      background: rgba(255,255,255,.28);
      transform: translateY(-1px);
    }
    #status {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 10.5px;
      padding: 2px 9px;
      border-radius: 999px;
      background: rgba(255,255,255,.24);
      color: #fff;
      box-shadow: 0 1px 3px rgba(150,70,100,.18);
      text-shadow: none;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    #status::before {
      content: "";
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #8fe3b0;
      box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 0 8px rgba(143,227,176,.8);
      animation: statusPulse 2.4s ease-in-out infinite;
    }
    @keyframes statusPulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: .55; transform: scale(.85); }
    }

    /* 角色卡片：白卡 + 层次阴影 + 悬停浮起 */
    .char-item {
      border-radius: 16px;
      box-shadow: var(--shadow-soft);
      transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s ease, background .18s ease, border-color .18s ease;
    }
    .char-item:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-float);
      border-color: rgba(232,125,149,.38);
    }
    .char-item img {
      box-shadow: 0 2px 6px rgba(120,60,80,.18), 0 0 0 2px #fff;
      transition: transform .2s ease, box-shadow .2s ease;
    }
    .char-item:hover img {
      transform: scale(1.04);
      box-shadow: 0 4px 12px rgba(200,110,150,.28), 0 0 0 2px #fff, 0 0 0 4px rgba(232,125,149,.16);
    }
    .ci-school {
      background: rgba(232,125,149,.10);
      color: #c96a82;
      padding: 1px 7px;
      border-radius: 999px;
      font-size: 10.5px;
    }

    /* 聊天区：波点改浅粉，更细腻 */
    #chat {
      background-image: radial-gradient(rgba(232,125,149,.07) 1.3px, transparent 1.5px);
    }
    .date-divider {
      background: rgba(255,255,255,.72);
      box-shadow: var(--shadow-soft);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .group .avatar {
      box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(140,70,95,.22);
    }
    .group { animation: groupIn .22s cubic-bezier(.22,1,.36,1); }
    .bubble { animation: bubbleIn .22s cubic-bezier(.22,1,.36,1); }
    .group.bot .bubble {
      box-shadow: 0 1px 2px rgba(150,70,100,.08), 0 6px 16px rgba(150,70,100,.10);
    }
    .group.user .bubble {
      box-shadow: 0 1px 2px rgba(150,70,100,.10), 0 8px 18px rgba(190,95,125,.22), inset 0 1px 0 rgba(255,255,255,.28);
    }
    .bubble .sprite {
      border-radius: 14px;
      box-shadow: 0 4px 14px rgba(150,70,100,.20), inset 0 0 0 1px rgba(255,255,255,.55);
    }

    /* 弹层：毛玻璃 + 柔弹入 */
    .menu-pop,
    .model-pop {
      background: rgba(255,255,255,.86);
      border: 1px solid rgba(255,255,255,.9);
      border-radius: 18px;
      box-shadow: 0 2px 8px rgba(140,70,95,.10), 0 18px 44px rgba(140,70,95,.22);
      backdrop-filter: blur(18px) saturate(1.3);
      -webkit-backdrop-filter: blur(18px) saturate(1.3);
      animation: popIn .16s ease-out;
    }
    @keyframes popIn {
      from { opacity: 0; transform: translateY(6px) scale(.98); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    /* 输入框：柔和聚焦光晕 */
    .menu-pop input:focus,
    .model-field input:focus,
    .session-actions input:focus,
    .owner-row input:focus,
    #affectionPop input:focus {
      border-color: var(--ba-pink);
      box-shadow: 0 0 0 3px rgba(232,125,149,.14);
      outline: none;
    }

    /* 主按钮：悬浮微动效 */
    .sel-confirm,
    .model-save,
    #ownerSave {
      transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
      box-shadow: 0 4px 12px rgba(206,107,131,.28);
    }
    .sel-confirm:hover,
    .model-save:hover,
    #ownerSave:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 16px rgba(206,107,131,.34);
      filter: brightness(1.04);
    }
    .sel-confirm:active,
    .model-save:active,
    #ownerSave:active { transform: translateY(0); }
    #ownerLogout {
      flex-shrink: 0;
      border: 1px solid #e3b7c6;
      border-radius: 8px;
      padding: 5px 9px;
      background: #fff;
      color: #b98fa0;
      font-size: 12px;
      cursor: pointer;
    }
    #ownerLogout:active { transform: translateY(0); }

    .cmd-item,
    .import-btn,
    .session-row button,
    .session-actions-row button {
      transition: background .15s ease, transform .15s ease, color .15s ease;
    }
    .cmd-item:hover,
    .import-btn:hover { transform: translateY(-1px); }
    /* ===== 角色档案 / 表情抽屉 / 消息操作 ===== */
    #headAvatar { cursor: pointer; }
    .header-btn { font-size: 13px; line-height: 30px; padding: 0 8px; font-weight: 600; letter-spacing: 1px; }
    .profile-box {
      width: min(540px, 92vw);
      max-height: 82vh;
      background: #fff;
      border-radius: 16px;
      padding: 16px;
      box-shadow: 0 8px 30px rgba(120,70,90,.28);
      display: flex;
      flex-direction: column;
    }
    .profile-head { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #f3dbe2; padding-bottom: 12px; }
    .profile-head img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; background: #fdf2f6; }
    .profile-title { font-size: 18px; font-weight: 800; color: #5b4250; }
    .profile-sub { font-size: 12px; color: #b98fa0; margin-top: 2px; }
    .profile-body { overflow-y: auto; margin-top: 10px; }
    .profile-section { margin-bottom: 10px; }
    .profile-section h4 { margin: 0 0 4px; font-size: 13px; color: #b06a84; }
    .profile-section .ps-content {
      font-size: 12px;
      color: #5a4a52;
      white-space: pre-wrap;
      word-break: break-word;
      background: #fdf7f9;
      border-radius: 10px;
      padding: 8px 10px;
      line-height: 1.6;
    }
    .profile-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #f3dbe2; align-items: baseline; }
    .profile-row .pk { width: 76px; flex-shrink: 0; font-size: 12px; color: #b06a84; }
    .profile-row .pv { flex: 1; font-size: 13px; color: #5a4a52; word-break: break-word; }
    .profile-bio { margin-top: 12px; }
    .profile-bio h4 { margin: 0 0 4px; font-size: 13px; color: #b06a84; }
    .sprite-box { width: min(420px, 90vw); background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 8px 30px rgba(120,70,90,.28); }
    .sprite-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
      gap: 8px;
      max-height: 60vh;
      overflow-y: auto;
      margin: 10px 0;
    }
    .sprite-item { border: 1px solid #f0dbe4; border-radius: 10px; padding: 4px; cursor: pointer; text-align: center; background: #fdf7f9; }
    .sprite-item:hover { border-color: #e0a8bd; background: #fbeef3; }
    .sprite-item img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto; }
    .sprite-item div { font-size: 11px; color: #8a6a78; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .edit-box { width: min(420px, 90vw); background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 8px 30px rgba(120,70,90,.28); }
    .edit-box textarea {
      width: 100%;
      box-sizing: border-box;
      min-height: 90px;
      font-size: 13px;
      border: 1px solid #e3b7c5;
      border-radius: 10px;
      padding: 8px;
      resize: vertical;
      color: #5a4a52;
    }
    /* ===== 搜索 ===== */
    #searchBtn { background: none; border: none; color: inherit; cursor: pointer; padding: 2px 8px 0; }
    .dark-row { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; flex-wrap: nowrap; gap: 8px; }
    .dark-row label { display: inline; font-size: 12px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; margin-bottom: 0; }
    .dark-row input { width: auto; flex-shrink: 0; }
    .search-box { width: min(520px, 92vw); background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 8px 30px rgba(120,70,90,.28); }
    .search-head { display: flex; gap: 8px; align-items: center; }
    .search-head input {
      flex: 1;
      min-width: 0;
      font-size: 14px;
      padding: 9px 12px;
      border: 1px solid var(--border);
      border-radius: 12px;
      background: var(--input-bg);
      color: var(--text);
      outline: none;
    }
    .search-head button { border: none; background: none; color: #b98fa0; font-size: 16px; cursor: pointer; }
    .search-group { margin-bottom: 10px; }
    .search-group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #5b4250; padding: 6px 2px; }
    .search-group-title img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #fdf2f6; }
    .search-item {
      display: block;
      width: 100%;
      text-align: left;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fdf7f9;
      padding: 7px 10px;
      margin-bottom: 6px;
      cursor: pointer;
      font-family: inherit;
    }
    .search-item:hover { background: #fbeef3; }
    .search-item .si-meta { font-size: 11px; color: #b98fa0; margin-bottom: 2px; }
    .search-item .si-text { font-size: 13px; color: #5a4a52; white-space: pre-wrap; word-break: break-word; }
    .search-item mark { background: #ffe08a; color: #5a3d00; border-radius: 3px; padding: 0 1px; }
    .bubble-row.flash .bubble { animation: msgFlash 1.6s ease; }
    @keyframes msgFlash {
      0% { box-shadow: 0 0 0 3px #ffd7e3; }
      100% { box-shadow: 0 0 0 0 rgba(255,215,227,0); }
    }
    /* ===== 深色模式 ===== */
    body.dark {
      background: linear-gradient(160deg, #221b26 0%, #1b1520 55%, #241a24 100%);
      color: #e8dde6;
    }
    body.dark {
      --chat-bg: #1b1520;
      --header-top: #3a2b3a;
      --header-bottom: #2b2030;
      --bubble-bot: #2b2232;
      --bubble-user: #7a4d66;
      --bubble-user-deep: #6b4058;
      --bubble-border: #3a3042;
      --text: #e8dde6;
      --text-dim: #a493a6;
      --input-bg: #251d2c;
      --border: #3a3042;
      --divider: #4a3c50;
    }
    body.dark .app { box-shadow: 0 0 48px rgba(0,0,0,.5); }
    body.dark .menu-pop,
    body.dark .model-pop,
    body.dark .fb-box,
    body.dark .profile-box,
    body.dark .sprite-box,
    body.dark .edit-box,
    body.dark .search-box,
    body.dark .cmd-item,
    body.dark .session-mgr,
    body.dark .char-item { background: #282130; border-color: #3a3042; }
    body.dark .cmd-item { color: #e4b6c8; }
    body.dark .fb-title,
    body.dark .profile-title,
    body.dark .search-group-title,
    body.dark .name { color: #f0dce6; }
    body.dark .profile-sub,
    body.dark .search-item .si-meta { color: #a493a6; }
    body.dark .ps-content,
    body.dark .search-item,
    body.dark .profile-row .pv,
    body.dark .search-item .si-text { color: #e0d3e0; background: #2e2536; border-color: #3a3042; }
    body.dark input,
    body.dark textarea { background: #1f1926; color: #e8dde6; border-color: #3a3042; }
    body.dark .bubble { background: #2b2232; color: #ece2ea; border-color: #3a3042; }
    body.dark .group.user .bubble { background: #7a4d66; color: #fff; }
    body.dark .meta .time,
    body.dark .ci-time,
    body.dark .ci-preview { color: #a493a6; }
    body.dark .search-item mark { background: #8a6a30; color: #ffe9b0; }
    /* ===== 深色模式补全：把遗漏的浅色区域统一变暗 ===== */
    body.dark footer,
    body.dark .sel-bar,
    body.dark .sel-cancel,
    body.dark .login-hint,
    body.dark .date-divider,
    body.dark .sys-note.demo,
    body.dark .session-row code,
    body.dark .session-row button,
    body.dark .api-key-row button,
    body.dark .model-key-test button,
    body.dark .import-btn,
    body.dark .sm-header button,
    body.dark .sm-back-row button,
    body.dark .sm-item,
    body.dark .sm-msg.user,
    body.dark .sm-msg.bot,
    body.dark .sprite-item { background: #2e2536; border-color: #3a3042; color: #e0d3e0; }
    body.dark footer { background: #1f1926; border-top-color: #3a3042; }
    body.dark .sel-bar { border-color: #3a3042; }
    body.dark .date-divider { background: rgba(43,34,50,.85); color: #b9a8ba; box-shadow: none; }
    body.dark .sys-note.demo { background: #3a2434; border-color: #5c3348; color: #e4b6c8; }
    body.dark .sm-header span,
    body.dark .sm-item .sm-id { color: #f0dce6; }
    body.dark .sm-item .sm-del,
    body.dark .sm-back-row button.sm-del { background: #3a2230; color: #e59aa8; border-color: #5c3348; }
    body.dark .sm-msg.user { background: #4a3040; }
    body.dark .sm-msg.bot { background: #2e2536; }
    body.dark .session-row button:hover,
    body.dark .api-key-row button:hover,
    body.dark .model-key-test button:hover,
    body.dark .import-btn:hover,
    body.dark .sm-item:hover,
    body.dark .sm-back-row button:hover { background: #382c42; }
    body.dark .menu-pop button,
    body.dark .model-pop button,
    body.dark .fb-mask .edit-box button,
    body.dark .fb-mask .fb-box button { background: #2e2536 !important; color: #e0d3e0 !important; border-color: #3a3042 !important; }
    body.dark .login-hint { box-shadow: 0 4px 18px rgba(0,0,0,.35); }
    body.dark .profile-head img,
    body.dark .search-group-title img { background: #2e2536; }
    body.dark .group .avatar { box-shadow: 0 0 0 2px #2e2536, 0 4px 10px rgba(0,0,0,.35); }
