/* 共享组件：手机端知识库底部抽屉（N-back 主页面 / DRM 共用同一份）
   桌面端不显示入口按钮；<768px 才出现，显隐由 kb-drawer.js 按当前视图控制。 */

.kb-drawer-btn { display: none; }
.kb-drawer-mask { display: none; }

@media (max-width: 768px) {
/* 抽屉入口按钮（助手标题栏右侧） */
      .panel-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
      .panel-header .hint { display: none; }          /* 「单击文件夹展开」在手机上没意义 */
      .kb-drawer-btn {
        display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
        background: #fce8ec; color: #ae0b2a; border: none; cursor: pointer;
        padding: 6px 12px 6px 10px; border-radius: 16px;
        font-size: 12.5px; font-weight: bold; font-family: inherit;
        transition: background 0.18s, transform 0.12s;
      }
      .kb-drawer-btn:active { transform: scale(0.94); }
      .kb-drawer-btn::before { content: "📚"; font-size: 14px; line-height: 1; }

      /* 抽屉里的知识库内容：沿用桌面端 .kb-body 的排版，去掉定高 */
      .kb-drawer-body .kb-body { height: auto; flex: none; padding: 8px 12px 16px; }

/* —— 抽屉本体（默认 display:none，只在手机端抽屉打开时生效） —— */
    .kb-drawer-mask {
      display: none;
      position: fixed; inset: 0; z-index: 150;
      background: rgba(20, 22, 26, 0.44);
      opacity: 0; pointer-events: none;
      transition: opacity 0.32s ease;
      align-items: flex-end;
    }
    .kb-drawer {
      background: #fff; width: 100%; height: 61.4%;   /* 抽屉高度 = 屏高 61.4% */
      border-radius: 20px 20px 0 0;
      box-shadow: 0 -8px 30px rgba(0,0,0,0.22);
      display: flex; flex-direction: column; overflow: hidden;
      transform: translate3d(0, 100%, 0);
      transition: transform 0.38s cubic-bezier(.32,.72,0,1), height 0.28s cubic-bezier(.32,.72,0,1);
      will-change: transform;
      touch-action: none;
    }
    .kb-drawer-grip {
      flex-shrink: 0; padding: 9px 0 5px; cursor: grab;
      display: flex; justify-content: center; touch-action: none;
    }
    .kb-drawer-grip i {
      display: block; width: 42px; height: 4.5px; border-radius: 3px;
      background: #d8dde3; transition: background 0.18s, width 0.18s;
    }
    .kb-drawer-grip:active i { background: #b9c0c8; width: 52px; }
    .kb-drawer-head {
      flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
      gap: 8px; padding: 4px 16px 10px; border-bottom: 1px solid #eee;
    }
    .kb-drawer-head .t { font-size: 14px; font-weight: bold; color: #ae0b2a; }
    .kb-drawer-close {
      background: #f2f4f7; border: none; color: #6b7683; cursor: pointer;
      width: 28px; height: 28px; border-radius: 50%; font-size: 15px; line-height: 1;
      display: flex; align-items: center; justify-content: center; font-family: inherit;
      transition: background 0.18s, transform 0.12s; flex-shrink: 0;
    }
    .kb-drawer-close:active { transform: scale(0.9); }
    .kb-drawer-body {
      flex: 1; min-height: 0; overflow-y: auto;
      overscroll-behavior: contain; touch-action: pan-y;
    }
    /* 内容错峰上浮：比面板晚一点，像内容「跟着浮上来」 */
    .kb-drawer-head, .kb-drawer-body {
      opacity: 0; transform: translateY(14px);
      transition: opacity 0.3s ease, transform 0.34s ease;
    }
    .kb-drawer-mask.open { opacity: 1; pointer-events: auto; display: flex; }
    .kb-drawer-mask.open .kb-drawer { transform: translate3d(0, 0, 0); }
    .kb-drawer-mask.open .kb-drawer-head, .kb-drawer-mask.open .kb-drawer-body { opacity: 1; transform: none; }
    .kb-drawer-mask.open .kb-drawer-head { transition-delay: 0.1s; }
    .kb-drawer-mask.open .kb-drawer-body { transition-delay: 0.14s; }
    /* 拖拽中禁用过渡（跟手）；收起时短促下坠 + 内容先淡出 */
    .kb-drawer-mask.dragging { display: flex; opacity: 1; pointer-events: auto; }
    .kb-drawer-mask.dragging .kb-drawer { transition: none; }
    .kb-drawer-mask.closing { display: flex; opacity: 0; pointer-events: none; transition: opacity 0.26s ease; }
    .kb-drawer-mask.closing .kb-drawer {
      transform: translate3d(0, 100%, 0);
      transition: transform 0.26s cubic-bezier(.4,0,1,1);
    }
    .kb-drawer-mask.closing .kb-drawer-head, .kb-drawer-mask.closing .kb-drawer-body {
      opacity: 0; transition: opacity 0.12s ease;
    }
}
