/* @Title static/qbank/inline.css  知识库 ↔ 题库联动：文档里的「练习」悬浮窗
 *
 * 为什么单独一套类名（qb- 前缀）：这个挂件要注入到**文档阅读页**里，而那一页有
 * bootstrap / kancloud / editormd 三套样式。用通用类名（.btn/.card/…）一定会被
 * 覆盖或反向污染正文，所以全部自带前缀 + 尽量少的层叠。
 */

.qb-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .28);
    z-index: 99998;
}

.qb-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 400px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22), 0 0 1px rgba(15, 23, 42, .2);
    z-index: 99999;
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1f2328;
    overflow: hidden;
    animation: qb-in .16s ease-out;
}

@keyframes qb-in {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- 头部 ---------- */
.qb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-bottom: 1px solid #eef1f4;
    background: linear-gradient(180deg, #fbfdff, #fff);
}
.qb-title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qb-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: #8b949e;
    background: #f2f5f8;
    border-radius: 10px;
    padding: 1px 8px;
}
.qb-x {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border: 0; border-radius: 8px;
    background: transparent;
    color: #6b7280;
    font-size: 18px; line-height: 1;
    cursor: pointer;
}
.qb-x:hover { background: #f1f3f5; color: #111; }

/* ---------- 题体 ---------- */
.qb-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px 8px;
    -webkit-overflow-scrolling: touch;
}
.qb-type {
    display: inline-block;
    font-size: 11px;
    color: #2563eb;
    background: #eaf1fe;
    border-radius: 6px;
    padding: 1px 7px;
    margin-bottom: 8px;
}
.qb-stem {
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 12px;
    word-break: break-word;
}
.qb-stem p { margin: 0 0 6px; }
.qb-stem img, .qb-opt .t img, .qb-result img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 6px 0;
    border-radius: 6px;
}
.qb-opt .t img { display: inline-block; vertical-align: middle; margin: 2px 0; }

.qb-opts { list-style: none; margin: 0; padding: 0; }
.qb-opt {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 11px;
    margin-bottom: 8px;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
    word-break: break-word;
}
.qb-opt:hover { border-color: #b9d2f7; background: #fafcff; }
.qb-opt .k {
    flex: 0 0 20px;
    height: 20px;
    border-radius: 6px;
    background: #f1f3f5;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 20px;
}
.qb-opt.is-picked { border-color: #2563eb; background: #f3f8ff; }
.qb-opt.is-picked .k { background: #2563eb; color: #fff; }
.qb-opt.is-right { border-color: #16a34a; background: #f2fdf5; }
.qb-opt.is-right .k { background: #16a34a; color: #fff; }
.qb-opt.is-wrong { border-color: #dc2626; background: #fff5f5; }
.qb-opt.is-wrong .k { background: #dc2626; color: #fff; }
.qb-opt.is-disabled { cursor: default; }
.qb-opt.is-disabled:hover { background: inherit; border-color: inherit; }

.qb-input {
    width: 100%;
    min-height: 66px;
    padding: 9px 11px;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    font: inherit;
    resize: vertical;
    outline: none;
}
.qb-input:focus { border-color: #2563eb; }

.qb-multi-tip { font-size: 12px; color: #8b949e; margin: 0 0 8px; }

/* ---------- 结果 ---------- */
.qb-result {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.7;
}
.qb-result.ok { background: #f2fdf5; border: 1px solid #bbf7d0; }
.qb-result.no { background: #fff5f5; border: 1px solid #fecaca; }
.qb-result.wait { background: #f8fafc; border: 1px solid #e2e8f0; }
.qb-result .tag { font-weight: 600; margin-right: 6px; }
.qb-result.ok .tag { color: #15803d; }
.qb-result.no .tag { color: #b91c1c; }
.qb-result .right { color: #15803d; font-weight: 600; }
.qb-result .an {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(0, 0, 0, .08);
    color: #374151;
}

/* ---------- 底部 ---------- */
.qb-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 12px;
    border-top: 1px solid #eef1f4;
}
.qb-tip { flex: 1 1 auto; font-size: 12px; color: #8b949e; }
.qb-btn {
    height: 32px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.qb-btn:hover { background: #1d4ed8; }
.qb-btn:disabled { background: #c7d2e2; cursor: not-allowed; }
.qb-btn.ghost { background: #f1f3f5; color: #374151; }
.qb-btn.ghost:hover { background: #e6e9ee; }

.qb-state {
    padding: 26px 18px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.8;
}
.qb-state b { color: #111827; }
.qb-state .qb-btn { margin-top: 12px; }

/* ---------- 小屏：底部整宽 ---------- */
@media (max-width: 520px) {
    .qb-panel {
        right: 0; bottom: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 82vh;
        border-radius: 14px 14px 0 0;
    }
}

/* 文档正文里的练习链接：给个小标记，读者一眼看出"这里能练" */
.qb-link::after {
    content: "练习";
    margin-left: 4px;
    font-size: 10px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    background: #eaf1fe;
    color: #2563eb;
    vertical-align: middle;
}
