/** Promised Land - extra.css | Auto-split from style.css */
/* ============================================
       上下文统计条
       ============================================ */
    .msg-token-stats {
      display: flex;
      align-items: center;
      gap: 3px;
      margin-top: 6px;
      padding: 4px 8px;
      font-family: 'Inter', sans-serif;
      font-size: 0.7rem;
      font-weight: 350;
      color: var(--color-msg-token-stats-text);
      line-height: 1.4;
      letter-spacing: 0.3px;
      opacity: 0;
      transition: opacity 0.3s;
    }

    .msg-wrapper:hover .msg-token-stats {
      opacity: 0.55;
    }

    .msg-token-stats svg {
      flex-shrink: 0;
      color: var(--color-msg-token-stats-icon);
      margin-right: 1px;
    }

    /* ============================================
       常驻记忆编辑弹窗 · 脊骨记忆
       ============================================ */

    /* 弹窗遮罩复用 prompt-card-overlay */

    /* ── 卡片列表滚动容器 ── */
    .memory-card-list {
      flex: 1;
      min-height: 240px;
      max-height: 58vh;
      overflow-y: auto;
      scrollbar-width: none;
      -ms-overflow-style: none;
      -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      padding: 0.5rem 0.3rem 2.5rem;
      position: relative;
    }

    .memory-card-list::-webkit-scrollbar {
      display: none;
    }

    /* ── 单张记忆卡片 ── */
    .memory-card {
      position: relative;
      background: rgba(255, 255, 255, 0.035);
      border: 0.5px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 1.2rem 1.4rem 0.8rem;
      margin-bottom: 20px;
      transition: background 0.25s, border-color 0.25s;
    }

    .memory-card:hover {
      background: rgba(255, 255, 255, 0.06);
      border-color: rgba(255, 255, 255, 0.14);
    }

    .memory-card.dirty {
      border-color: rgba(232, 201, 160, 0.3);
    }

    /* ── 卡片标题行：圆点 + 可编辑标题 ── */
    .memory-card-title-row {
      display: flex;
      align-items: baseline;
      gap: 8px;
      margin-bottom: 8px;
    }

    .memory-card-dot {
      flex-shrink: 0;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--color-tag-entry-dot);
      box-shadow: 0 0 4px var(--color-tag-entry-dot-shadow), inset 0 0 0 0.5px var(--color-tag-entry-dot-inner);
      margin-bottom: 1px;
    }

    .memory-card-title {
      flex: 1;
      border: none;
      background: transparent;
      font-family: 'Times New Roman', serif;
      font-size: 0.92rem;
      font-weight: 370;
      letter-spacing: 1px;
      color: var(--color-tag-entry-title);
      outline: none;
      padding: 1px 0;
      border-bottom: 0.5px dashed transparent;
      transition: border-color 0.25s;
    }

    .memory-card-title::placeholder {
      color: var(--color-tag-entry-title-placeholder);
      font-style: italic;
    }

    .memory-card-title:focus {
      border-bottom-color: rgba(255, 255, 255, 0.2);
    }

    /* ── 卡片正文编辑区 ── */
    .memory-card-content {
      display: block;
      width: 100%;
      border: none;
      background: transparent;
      font-family: 'Times New Roman', serif;
      font-size: 0.82rem;
      font-weight: 320;
      line-height: 2.0;
      color: var(--color-card-content);
      outline: none;
      resize: vertical;
      min-height: 3.2em;
      padding: 0 0 0.6rem;
      transition: color 0.2s;
      overflow-y: auto;
      scrollbar-width: none;
    }

    .memory-card-content::-webkit-scrollbar {
      display: none;
    }

    .memory-card-content::placeholder {
      color: var(--color-card-content-placeholder);
      font-style: italic;
    }

    /* ── 卡片右下角 Meta 信息 ── */
    .memory-card-meta {
      text-align: right;
      font-family: 'Inter', sans-serif;
      font-size: 0.62rem;
      font-weight: 290;
      letter-spacing: 0.4px;
      color: rgba(234, 225, 245, 0.3);
      margin-top: 4px;
      cursor: default;
      user-select: none;
    }

    .memory-card-meta .meta-date {
      cursor: pointer;
      transition: color 0.2s;
      border-bottom: 0.5px dashed transparent;
    }

    .memory-card-meta .meta-date:hover {
      color: rgba(234, 225, 245, 0.55);
      border-bottom-color: rgba(234, 225, 245, 0.25);
    }

    /* ── 记忆卡片右侧标签栏 ── */
    .memory-card-tag-col {
      position: absolute;
      right: -56px;
      top: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    /* ── 空状态 ── */
    .memory-card-empty {
      text-align: center;
      padding: 3rem 1rem;
      color: rgba(234, 225, 245, 0.25);
      font-family: 'Times New Roman', serif;
      font-style: italic;
      font-size: 0.85rem;
      letter-spacing: 1px;
    }

    /* ── 删除确认浮层 ── */
    .memory-delete-confirm {
      position: absolute;
      bottom: 10px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--color-card-bg);
      border: 0.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      padding: 10px 18px;
      font-family: 'Times New Roman', serif;
      font-size: 0.75rem;
      font-weight: 350;
      color: var(--color-card-content);
      letter-spacing: 0.8px;
      display: flex;
      align-items: center;
      gap: 14px;
      z-index: 10;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
      white-space: nowrap;
      opacity: 0;
      animation: confirmFadeIn 0.25s var(--ease-out-expo) forwards;
    }
    .memory-delete-confirm > * { flex-shrink: 0; }

    /* ★ 只用 opacity 动画，不碰 transform，避免覆盖 translateX(-50%) */
    @keyframes confirmFadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    .memory-delete-confirm .confirm-text {
      flex-shrink: 0;
    }

    .memory-delete-confirm .confirm-remove {
      background: var(--color-tag-danger-bg);
      border: none;
      border-radius: 8px;
      padding: 4px 12px;
      font-family: 'Times New Roman', serif;
      font-size: 0.72rem;
      color: var(--color-tag-danger-text);
      cursor: pointer;
      letter-spacing: 0.5px;
      transition: filter 0.2s;
    }

    .memory-delete-confirm .confirm-remove:hover {
      filter: brightness(1.15);
    }

    .memory-delete-confirm .confirm-think {
      background: transparent;
      border: 0.5px solid rgba(255, 255, 255, 0.2);
      border-radius: 8px;
      padding: 4px 12px;
      font-family: 'Times New Roman', serif;
      font-size: 0.72rem;
      color: rgba(234, 225, 245, 0.7);
      cursor: pointer;
      letter-spacing: 0.5px;
      transition: all 0.2s;
    }

    .memory-delete-confirm .confirm-think:hover {
      border-color: rgba(255, 255, 255, 0.4);
      color: rgba(234, 225, 245, 0.9);
    }

    /* ── 前缀字母选择器（新建Agent第一个条目时） ── */
    .memory-prefix-select {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 8px 0 4px;
      padding: 4px 8px;
      border-radius: 8px;
      background: rgba(0, 0, 0, 0.1);
    }

    .memory-prefix-select .prefix-label {
      font-family: 'Inter', sans-serif;
      font-size: 0.7rem;
      color: rgba(234, 225, 245, 0.5);
      letter-spacing: 0.5px;
    }

    .memory-prefix-select input {
      width: 36px;
      border: 0.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 6px;
      background: rgba(0, 0, 0, 0.1);
      text-align: center;
      font-family: 'Inter', sans-serif;
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--color-card-content);
      letter-spacing: 1px;
      padding: 3px 4px;
      outline: none;
      text-transform: uppercase;
    }

    .memory-prefix-select input:focus {
      border-color: rgba(255, 255, 255, 0.35);
    }

    /* ★★★ L2 脊骨记忆编辑 · 胶片式卡片列 ★★★ */
    
    /* 遮罩层：不再滚动，仅作固定画框，增强模糊营造景深 */
    .l2-overlay {
      z-index: 1000 !important;
      flex-direction: column !important;
      overflow: hidden;
      align-items: flex-start !important;
      padding: 0;
      animation: none !important;
      transition: opacity 0.35s var(--ease-out-expo);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    /* 卡片列容器：承担滚动 + snap + 上下淡入淡出（不影响 overlay 背景） */
    .l2-card-strip {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0;
      width: 100%;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      scroll-snap-type: y mandatory;
      scrollbar-width: none;
      -ms-overflow-style: none;
      padding: 0 10vw;
      -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
      mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
    }
    .l2-card-strip::-webkit-scrollbar { display: none; }

    /* 单张 L2 卡片 —— 默认缩小，active 时弹回原大小 */
    .l2-memory-card {
      position: relative;
      width: 409px;
      max-width: 76vw;
      border-radius: 8px;
      padding: 3rem 3.2rem 2.8rem;
      background-color: var(--color-card-bg);
      background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.25'/%3E%3C/svg%3E");
      box-shadow: 0 18px 44px -10px var(--color-card-shadow), 0 4px 14px var(--color-card-shadow-light);
      margin: 16px 0;
      /* snap：每条卡都在视口中央吸附 */
      scroll-snap-align: center;
      /* 默认缩小 */
      transform: scale(0.88);
      transition: transform 0.45s var(--ease-out-expo), box-shadow 0.35s var(--ease-out-expo);
    }

    /* 活跃卡片：弹回原大小 + 阴影加大 */
    .l2-memory-card.active {
      transform: scale(1);
      box-shadow: 0 32px 64px -16px var(--color-card-shadow), 0 8px 28px var(--color-card-shadow-light);
    }

    /* 非活跃卡片的标签列隐藏 */
    .l2-memory-card:not(.active) .l2-tag-col {
      opacity: 0;
      pointer-events: none;
    }
    .l2-memory-card.active .l2-tag-col {
      opacity: 1;
      pointer-events: auto;
    }

    /* 标签列动画（与 entry-tag-col 一致） */
    .l2-tag-col .entry-tag-btn {
      opacity: 0;
      animation: tagStaggerIn 0.25s var(--ease-out-expo) forwards;
    }
    .l2-tag-col .entry-tag-btn:nth-child(1) { animation-delay: 0.05s; }
    .l2-tag-col .entry-tag-btn:nth-child(2) { animation-delay: 0.13s; }
    .l2-tag-col .entry-tag-btn:nth-child(3) { animation-delay: 0.21s; }
    .l2-tag-col .entry-tag-btn:nth-child(4) { animation-delay: 0.29s; }

    /* 卡片间视觉连线：用 border-bottom 模拟 */
    .l2-memory-card::after {
      content: '';
      position: absolute;
      bottom: -14px;
      left: 50%;
      transform: translateX(-50%);
      width: 1px;
      height: 14px;
      background: linear-gradient(to bottom, rgba(184, 161, 128, 0.3), transparent);
    }
    .l2-memory-card:last-of-type::after {
      display: none;
    }

    /* 底部/顶部占位：让首尾卡片也能滚到视口中间，不吸附 */
    .l2-spacer {
      height: 45vh;
      flex-shrink: 0;
      scroll-snap-align: none;
    }

    /* 卡片内标题行微调 */
    .l2-memory-card .entry-title-row {
      display: flex;
      align-items: baseline;
      gap: 6px;
      margin-bottom: 1.2rem;
    }
    .l2-memory-card .entry-title-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--color-tag-entry-dot);
      flex-shrink: 0;
    }
    .l2-memory-card .entry-title-input {
      flex: 1;
      border: none;
      border-bottom: 0.5px solid transparent;
      background: transparent;
      font-family: 'Times New Roman', serif;
      font-size: 1.05rem;
      font-weight: 350;
      color: var(--color-tag-entry-title);
      letter-spacing: 0.5px;
      padding: 2px 0;
      outline: none;
      transition: border-bottom-color 0.25s;
    }
    .l2-memory-card .entry-title-input:focus {
      border-bottom-color: rgba(255, 255, 255, 0.2);
    }
    .l2-memory-card .entry-title-input::placeholder {
      color: var(--color-card-content-placeholder);
      font-style: italic;
    }

    /* 卡片正文编辑区 */
    .l2-card-textarea {
      display: block;
      width: 100%;
      min-height: 120px;
      max-height: 40vh;
      border: none !important;
      background: transparent !important;
      padding: 0.2rem 0.2rem 0.6rem !important;
      font-family: 'Times New Roman', serif !important;
      font-size: 0.95rem !important;
      font-weight: 330 !important;
      line-height: 2.4 !important;
      color: var(--color-tag-entry-title) !important;
      resize: none;
      outline: none;
      overflow-y: auto;
      scrollbar-width: none;
      -ms-overflow-style: none;
      -webkit-mask-image: none !important;
      mask-image: none !important;
    }
    .l2-card-textarea::-webkit-scrollbar { display: none; }
    .l2-card-textarea::placeholder {
      color: var(--color-card-content-placeholder);
      font-style: italic;
    }

    /* 卡片 Meta 行 —— 底边居中，像胶片底部的编号戳 */
    .l2-card-meta {
      text-align: center;
      font-family: 'Inter', sans-serif;
      font-size: 0.72rem;
      font-weight: 320;
      color: rgba(234, 225, 245, 0.25);
      letter-spacing: 0.3px;
      margin-top: 0.7rem;
      padding-bottom: 0;
    }
    .l2-card-meta .meta-date {
      cursor: pointer;
      transition: color 0.25s;
    }
    .l2-card-meta .meta-date:hover {
      color: rgba(234, 225, 245, 0.45);
    }

    /* 标签列定位（与 entry-tag-col 一致，绝对定位在卡片右侧外） */
    .l2-tag-col {
      position: absolute;
      right: -130px;
      top: 28px;
      display: flex;
      flex-direction: column;
      gap: 18px;
      z-index: 10;
      transition: opacity 0.35s var(--ease-out-expo);
    }

    /* 空状态 */
    .l2-empty-hint {
      color: rgba(234, 225, 245, 0.25);
      font-family: 'Times New Roman', serif;
      font-size: 1rem;
      font-style: italic;
      letter-spacing: 1.5px;
      margin-top: 30vh;
    }

    /* dirty 标记 */
    .l2-memory-card.dirty {
      border: 0.5px solid rgba(232, 201, 160, 0.2);
    }

    /* ============================================
       工具调用展示条 · 内嵌气泡 blockquote 风格
       ============================================ */

    .tool-call-block {
      margin: 12px 0 8px;
      border-left: 2px solid rgba(168, 148, 112, 0.35);
      padding: 10px 14px 10px 14px;
      border-radius: 0 8px 8px 0;
      background: rgba(168, 148, 112, 0.04);
      position: relative;
      overflow: hidden;
      transition: border-color 0.4s, background 0.4s;
      cursor: pointer;
      user-select: none;
    }

    .tool-call-block:first-child { margin-top: 2px; }

    .tool-call-block:hover {
      border-left-color: rgba(168, 148, 112, 0.55);
      background: rgba(168, 148, 112, 0.07);
    }

    /* ── 运行中的光带扫过 ── */
    .tool-call-block.running::before {
      content: '';
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.03) 45%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.03) 55%, transparent 60%);
      background-size: 200% 100%;
      animation: toolShimmer 3.2s ease-in-out infinite;
      pointer-events: none;
      z-index: 0;
    }

    @keyframes toolShimmer {
      0%   { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    /* ── 头部：羽毛笔 + 文案 + 状态点 ── */
    .tool-call-header {
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
      z-index: 1;
    }

    .tool-call-quill {
      flex-shrink: 0;
      width: 14px;
      height: 14px;
      color: rgba(168, 148, 112, 0.6);
      animation: quillBob 2.6s ease-in-out infinite;
    }

    .tool-call-block.done .tool-call-quill {
      animation: none;
      color: rgba(168, 148, 112, 0.4);
    }

    @keyframes quillBob {
      0%, 100% { transform: translateY(0); }
      35%  { transform: translateY(-2.8px); }
      70%  { transform: translateY(0.8px); }
    }

    .tool-call-label {
      font-family: 'Times New Roman', serif;
      font-size: 0.82rem;
      font-weight: 350;
      letter-spacing: 0.6px;
      color: rgba(210, 200, 180, 0.75);
      flex: 1;
    }

    .tool-call-dot {
      flex-shrink: 0;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: rgba(168, 148, 112, 0.5);
      animation: dotPulse 1.4s ease-in-out infinite;
    }

    .tool-call-block.done .tool-call-dot {
      animation: none;
      background: rgba(168, 148, 112, 0.25);
    }

    @keyframes dotPulse {
      0%, 100% { opacity: 0.4; transform: scale(0.8); }
      50%      { opacity: 1;   transform: scale(1);   }
    }

    /* ── 折叠/展开体 ── */
    .tool-call-body {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.35s var(--ease-out-expo), margin-top 0.35s var(--ease-out-expo);
      margin-top: 0;
      position: relative;
      z-index: 1;
    }

    .tool-call-block.expanded .tool-call-body {
      /* 上限给足 + 始终 hidden：展开过程与展开后都不出现滚动条（内容自然撑开） */
      max-height: 2000px;
      margin-top: 10px;
      overflow-y: hidden;
    }

    .tool-call-section {
      margin-bottom: 8px;
    }

    .tool-call-section:last-child { margin-bottom: 0; }

    .tool-call-section-label {
      display: block;
      font-family: 'Inter', sans-serif;
      font-size: 0.62rem;
      font-weight: 400;
      letter-spacing: 0.5px;
      color: rgba(180, 170, 155, 0.45);
      text-transform: uppercase;
      margin-bottom: 3px;
    }

    .tool-call-json {
      margin: 0;
      padding: 8px 10px;
      background: rgba(0, 0, 0, 0.18);
      border-radius: 6px;
      font-family: 'Inter', monospace;
      font-size: 0.68rem;
      font-weight: 350;
      line-height: 1.55;
      color: rgba(210, 200, 180, 0.55);
      white-space: pre-wrap;
      word-break: break-word;
    }

    .tool-call-result-section {
      display: none;
    }
    .tool-call-block.done .tool-call-result-section {
      display: block;
    }

    /* ============================================
       全文搜索 · 极简样式（复用 conv-list 区域）
       ============================================ */
    /* 搜索结果的 conv-item 适配多行 */
    .conv-item.search-result {
      flex-direction: column;
      align-items: flex-start;
      gap: 3px;
      padding: 8px 12px;
    }
    .conv-item.search-result .conv-item-title {
      font-size: 0.85rem;
      color: rgba(220, 225, 245, 0.85);
      white-space: normal;
      line-height: 1.5;
    }

    /* 搜索结果中的正文预览 — 第二行，稍小浅色 */
    .conv-search-preview {
      display: block;
      margin-top: 3px;
      font-family: 'Inter', sans-serif;
      font-size: 0.8rem;
      font-weight: 330;
      color: rgba(200, 210, 240, 0.5);
      line-height: 1.45;
      word-break: break-word;
      white-space: normal;
    }

    /* 关键词高亮 */
    .conv-search-preview mark {
      background: rgba(255, 220, 140, 0.35);
      color: rgba(255, 240, 200, 0.95);
      border-radius: 2px;
      padding: 0 1px;
    }

    /* ★ 搜索结果点击后消息高亮闪烁 */
    @keyframes msgSearchGlow {
      0% { box-shadow: inset 0 0 0px rgba(255, 220, 140, 0); }
      30% { box-shadow: inset 0 0 60px rgba(255, 220, 140, 0.25); }
      70% { box-shadow: inset 0 0 60px rgba(255, 220, 140, 0.25); }
      100% { box-shadow: inset 0 0 0px rgba(255, 220, 140, 0); }
    }
    .msg-search-highlight {
      animation: msgSearchGlow 2.5s ease-in-out;
      border-radius: 10px;
    }

    /* ========== 移动端适配 ========== */
    @media (max-width: 800px) {
      /* 隐藏导航条 */
      .nav-strip {
        display: none !important;
      }

      /* 隐藏右下角恢复按钮（冗余） */
      .right-restore-btn {
        display: none !important;
      }

      /* 取消输入区和消息区的移位（左边栏/右边栏不挤压） */
      .chat-input-area {
        transform: translateX(0) !important;
        width: calc(100% - 24px) !important;
        left: 12px !important;
        right: 12px !important;
      }

      .chat-body-inner {
        transform: translateX(0) !important;
      }

      /* L2 记忆卡：加宽左边距（圆点不贴边）；标签列不占卡纸版面 */
      .l2-card-strip {
        padding: 0 4vw;
      }

      .l2-memory-card {
        width: 88vw;
        max-width: 88vw;
        padding: 2rem 1.6rem 1.6rem;
        will-change: transform;
        transition: margin-bottom 0.35s var(--ease-out-expo);
      }

      /* L2 移动端性能：吸附改软（mandatory 吸附动画跟手指打架） */
      .l2-card-strip {
        scroll-snap-type: y proximity;
      }

      .l2-tag-col {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
      }

      /* 浏览/滑动时标签隐形；点入（聚焦）视口中心的卡片编辑时，标签在卡纸下方浮现 */
      .l2-memory-card.active .l2-tag-col {
        opacity: 0;
        pointer-events: none;
      }
      .l2-memory-card.active:focus-within .l2-tag-col {
        opacity: 1;
        pointer-events: auto;
      }

      /* 编辑态卡片底部留位：后续记忆卡自动向后排，不与标签行重叠 */
      .l2-memory-card.active:focus-within {
        margin-bottom: 84px;
      }

      /* L2 移动端性能：遮罩 blur 降压；滚动容器的上下渐隐遮罩在安卓上合成开销大，去掉 */
      .l2-overlay {
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
      }
      .l2-card-strip {
        -webkit-mask-image: none !important;
        mask-image: none !important;
      }

      /* L2 移动端性能：卡片滚动中不做缩放动画（滚动即动画是最大掉帧源），活跃卡用阴影区分 */
      .l2-memory-card,
      .l2-memory-card.active {
        transform: none !important;
      }

      /* 移动端性能：侧栏滚动区的渐隐遮罩同样去掉 */
      .panel-2 .panel-scroll,
      .conv-list {
        -webkit-mask-image: none !important;
        mask-image: none !important;
      }
    }
