/* ============ 配器法 · AI 虚拟学伴（课程级共享） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; }
html, body { height: 100%; }
body {
  background: linear-gradient(135deg, #eef1f6 0%, #e4e7eb 100%);
  color: #1E2430;
  height: 100vh;
  overflow: hidden;
  font-size: 15px;
}
a { text-decoration: none; color: inherit; }

/* 整页外壳 */
.xb-page { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 1280px; margin: 0 auto; }

/* 顶部栏 */
.xb-top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  color: #fff; flex-shrink: 0;
}
.xb-brand { display: flex; align-items: center; gap: 12px; }
.xb-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; background: #fff; color: #3a0ca3;
  font-size: 14px; font-weight: 800; letter-spacing: .5px; flex-shrink: 0;
}
.xb-brand h1 { font-size: 17px; font-weight: 600; line-height: 1.2; }
.xb-brand p { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.xb-status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: rgba(255,255,255,.9); margin-left: auto; }
.xb-dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.xb-dot.think { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.25); animation: xbPulse 1s ease infinite; }
@keyframes xbPulse { 50% { opacity: .45; } }
.xb-back {
  padding: 9px 14px; border-radius: 10px; background: rgba(255,255,255,.16);
  color: #fff; font-size: 13px; font-weight: 500; transition: background .15s; white-space: nowrap;
}
.xb-back:hover { background: rgba(255,255,255,.3); }

/* 双栏主体 */
.xb-body { flex: 1; display: grid; grid-template-columns: 1fr 320px; min-height: 0; gap: 16px; padding: 16px; }
.xb-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; border-radius: 16px; box-shadow: 0 6px 24px rgba(20,29,43,.06); overflow: hidden; }
.xb-kb { display: flex; flex-direction: column; border-radius: 16px; background: #fff; box-shadow: 0 6px 24px rgba(20,29,43,.06); min-width: 0; min-height: 0; }

/* 乐器速选 */
.xb-insts { display: flex; gap: 8px; padding: 14px 18px 0; flex-wrap: wrap; }
.xb-inst {
  padding: 8px 14px; border: 1px solid #E2E6F0; border-radius: 999px; background: #F5F7FC;
  font-size: 13px; color: #4A5265; cursor: pointer; transition: all .15s; font-weight: 500;
}
.xb-inst:hover { border-color: #4361ee; color: #4361ee; background: #F2F5FF; }

/* 消息流 */
.xb-msgs { flex: 1; overflow-y: auto; padding: 16px 18px 8px; background: #F7F8FC; display: flex; flex-direction: column; gap: 14px; }
.xb-msg { display: flex; gap: 10px; max-width: 92%; }
.xb-msg.ai { align-self: flex-start; }
.xb-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.xb-ava { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.xb-msg.me .xb-ava { background: #C9A227; }
.xb-bub { padding: 11px 15px; border-radius: 14px; font-size: 14px; line-height: 1.85; color: #1E2430; background: #fff; border: 1px solid #E6E9F2; box-shadow: 0 2px 8px rgba(20,29,43,.04); word-break: break-word; white-space: pre-wrap; }
.xb-msg.me .xb-bub { background: #4361ee; border-color: #4361ee; color: #fff; }
.xb-bub .xb-caret { display: inline-block; width: 2px; height: 1em; background: #4361ee; vertical-align: -2px; animation: xbPulse .8s steps(1) infinite; }

/* 视频卡片（对话内） */
.xb-vids { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 2px; }
.xb-vid { display: flex; align-items: center; gap: 14px; padding: 11px 14px; background: #fff; border: 1px solid #E4E9F5; border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.xb-vid:hover { border-color: #4361ee; box-shadow: 0 6px 18px rgba(67,97,238,.14); transform: translateY(-1px); }
.xb-vid-ic { flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(135deg, #4361ee, #764ba2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; }
.xb-vid-tx { flex: 1; min-width: 0; }
.xb-vid-tx b { display: block; font-size: 13.5px; color: #1E2430; }
.xb-vid-tx span { font-size: 12px; color: #8B94A8; line-height: 1.6; }
.xb-vid-go { color: #4361ee; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* 预设问题 */
.xb-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px 4px; }
.xb-chip { padding: 7px 13px; border: 1px solid #D9DEEB; border-radius: 999px; background: #fff; font-size: 12.5px; color: #3F4756; cursor: pointer; transition: all .15s; }
.xb-chip:hover { border-color: #4361ee; color: #4361ee; background: #F2F5FF; }

/* 模式按钮 */
.xb-funcs { display: flex; gap: 8px; padding: 8px 18px; flex-wrap: wrap; }
.xb-fbtn { padding: 7px 14px; border: 1px solid #E2E6F0; border-radius: 999px; background: #F5F7FC; font-size: 12.5px; color: #4A5265; cursor: pointer; transition: all .15s; }
.xb-fbtn:hover { border-color: #4361ee; color: #4361ee; }
.xb-fbtn.active { background: #4361ee; border-color: #4361ee; color: #fff; }

/* 输入 */
.xb-input { display: flex; gap: 10px; padding: 12px 18px 16px; }
.xb-input input { flex: 1; min-width: 0; padding: 11px 16px; border: 1px solid #DFE4EF; border-radius: 12px; font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s; }
.xb-input input:focus { border-color: #4361ee; }
.xb-send { flex-shrink: 0; padding: 0 20px; border: none; border-radius: 12px; background: linear-gradient(135deg, #4361ee, #3a0ca3); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s; }
.xb-send:hover { opacity: .9; }
.xb-send:disabled { opacity: .45; cursor: default; }

/* 右侧知识库 */
.xb-kb .xb-khead { padding: 16px 18px; background: linear-gradient(135deg, #4C6FFF 0%, #7A4DFF 100%); color: #fff; flex-shrink: 0; }
.xb-kb .xb-khead h2 { font-size: 15px; font-weight: 600; }
.xb-tabs { display: flex; gap: 8px; padding: 14px 14px 8px; }
.xb-tab { flex: 1; padding: 9px 6px; border: 1px solid #E6E9F2; border-radius: 11px; background: #F7F8FC; text-align: center; cursor: pointer; transition: all .15s; }
.xb-tab .t-ic { font-size: 15px; }
.xb-tab .t-lb { font-size: 11.5px; color: #5A6274; margin-top: 3px; font-weight: 600; }
.xb-tab .t-ct { font-size: 10.5px; color: #9AA3B5; margin-top: 1px; }
.xb-tab.active { background: #EEF2FF; border-color: #4361ee; }
.xb-tab.active .t-lb { color: #4361ee; }
.xb-src { padding: 6px 14px 14px; overflow-y: auto; flex: 1; }
.xb-src-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #5A6274; padding: 8px 2px 10px; }
.xb-sitem { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border: 1px solid #EDF0F6; border-radius: 11px; margin-bottom: 8px; cursor: pointer; background: #fff; transition: all .15s; }
.xb-sitem:hover { border-color: #4361ee; background: #F7F9FF; }
.xb-sitem.no-hover { cursor: default; }
.xb-sitem.no-hover:hover { border-color: #EDF0F6; background: #fff; }
.xb-sitem .s-ic { flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; background: linear-gradient(135deg, #4361ee, #764ba2); }
.xb-sitem .s-nm { flex: 1; min-width: 0; font-size: 12.5px; color: #2A3140; line-height: 1.5; }
.xb-sitem .s-nm b { color: #1E2430; }
.xb-sitem .s-ct { font-size: 11.5px; color: #9AA3B5; margin-top: 1px; white-space: normal; line-height: 1.7; }
.xb-sitem .s-go { color: #4361ee; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.xb-grp { font-size: 11.5px; font-weight: 700; color: #7A4DFF; padding: 12px 2px 6px; letter-spacing: .5px; }
.xb-ref-hub { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid #4361ee; background: linear-gradient(135deg,#EEF2FF,#F7F9FF); border-radius: 12px; margin-bottom: 14px; cursor: pointer; transition: all .15s; }
.xb-ref-hub:hover { box-shadow: 0 6px 18px rgba(67,97,238,.18); transform: translateY(-1px); }

/* 视频弹层 */
.xb-video-modal { display: none; position: fixed; inset: 0; background: rgba(10,12,20,.92); z-index: 99998; justify-content: center; align-items: center; padding: 14px; }
.xb-video-modal.show { display: flex; }
.xb-video-modal .xb-vwrap { position: relative; width: 100%; max-width: 980px; }
.xb-video-modal .xb-vclose { position: absolute; top: -38px; right: 0; color: #fff; font-size: 26px; cursor: pointer; z-index: 10; }
.xb-video-modal video { width: 100%; max-height: 82vh; border-radius: 12px; background: #000; }
.xb-video-modal .xb-vcap { color: #fff; text-align: center; padding: 12px; font-size: 14px; }

/* 响应式 */
@media (max-width: 900px) {
  body { overflow-y: auto; }
  .xb-page { height: auto; min-height: 100vh; }
  .xb-body { grid-template-columns: 1fr; gap: 14px; }
  .xb-left { height: 78vh; }
  .xb-kb { min-height: 420px; height: auto; }
  .xb-back { display: none; }
}
