/* 错题详情单独成页（配合 wrongbook-page.js） */
.wb-detail-backbar { display: none; }

#wrongbookPage.wb-detail-open .wrongbook-header,
.wb-detail-mode > :not(.wrongbook-workspace):not(.study-wrongbook-workspace),
.wb-detail-mode .wrongbook-browser,
.wb-detail-mode .study-wrongbook-browser {
    display: none !important;
}

html[data-ui-theme] .wb-detail-mode .wrongbook-workspace,
html[data-ui-theme] .wb-detail-mode .study-wrongbook-workspace,
.wb-detail-mode .wrongbook-workspace,
.wb-detail-mode .study-wrongbook-workspace {
    display: block;
    grid-template-columns: 1fr;
    min-width: 0;
}

.wb-detail-mode .wb-detail-backbar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 0;
    margin-bottom: 4px;
    background: var(--bg-primary, #fff);
}

.wb-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px 8px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    background: var(--bg-secondary, #fff);
    color: var(--text-primary, #111);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.wb-detail-back:hover { color: var(--primary, #2563eb); border-color: var(--primary, #2563eb); }
.wb-detail-back svg { width: 18px; height: 18px; }

.wb-detail-mode .wrongbook-detail { width: 100%; max-width: 980px; margin: 0 auto; }

/* 学科错题原图 */
.study-artifact-images { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.study-artifact-images a { display: block; max-width: 100%; }
.study-artifact-images img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    border-radius: 10px;
    border: 1px solid var(--border, #e5e7eb);
    background: #fff;
}

/* 学科错题：材料按“题目 / 作答 / 解答”标色，长讲解按二级标题分块 */
.study-artifacts > article { min-width: 0; }
.study-artifacts article header { align-items: center; flex-wrap: wrap; }
.study-artifacts article header strong { flex: 1 1 auto; }
.study-artifacts article header code { font-size: 12px; color: var(--text-secondary, #697084); overflow-wrap: anywhere; }
.study-artifact-role {
    flex: none;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: #64748b;
}
.study-artifact--question { border-left: 4px solid #2563eb !important; }
.study-artifact--question .study-artifact-role { background: #2563eb; }
.study-artifact--question > header { background: rgba(37, 99, 235, .08) !important; }
.study-artifact--attempt { border-left: 4px solid #d97706 !important; }
.study-artifact--attempt .study-artifact-role { background: #d97706; }
.study-artifact--attempt > header { background: rgba(217, 119, 6, .08) !important; }
.study-artifact--answer { border-left: 4px solid #059669 !important; }
.study-artifact--answer .study-artifact-role { background: #059669; }
.study-artifact--answer > header { background: rgba(5, 150, 105, .08) !important; }

.study-rich-content .study-rich-lead { margin: 0 0 12px; font-size: 20px; line-height: 1.45; }
.study-rich-block {
    margin: 0 0 14px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    background: var(--bg-secondary, #fff);
    overflow: hidden;
}
.study-rich-block:last-child { margin-bottom: 0; }
.study-rich-content .study-rich-block-title {
    margin: 0;
    padding: 10px 14px;
    font-size: 17px;
    line-height: 1.5;
    font-weight: 700;
    background: rgba(5, 150, 105, .07);
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.study-rich-block-body { padding: 12px 14px; }
.study-rich-block-body > :first-child { margin-top: 0; }
.study-rich-block-body > :last-child { margin-bottom: 0; }
.study-rich-content h3, .study-rich-content h4 { margin: 16px 0 6px; font-size: 16px; line-height: 1.5; }
.study-rich-content blockquote {
    margin: 10px 0;
    padding: 10px 12px;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    background: rgba(37, 99, 235, .06);
    color: inherit;
}
.study-rich-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.study-rich-content .svg-render-content svg { max-width: 100%; height: auto; }

@media (max-width: 600px) {
    html[data-ui-theme] #wrongbookPage .wb-detail-mode.wrongbook-layout,
    #wrongbookPage .wb-detail-mode.wrongbook-layout { padding: 6px 0 16px; }
    html[data-ui-theme] #wrongbookPage .wb-detail-mode .wrongbook-detail,
    #wrongbookPage .wb-detail-mode .wrongbook-detail { padding: 12px 10px; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
    .wb-detail-mode .wb-detail-backbar { padding: 8px 10px; margin: 0; }
    html[data-ui-theme] #wrongbookPage .wrongbook-detail-head h2,
    #wrongbookPage .wrongbook-detail-head h2 { font-size: 18px; line-height: 1.5; }
    #wrongbookPage .wrongbook-detail-head { gap: 10px; }
    #wrongbookPage .wrongbook-detail-head .admin-refresh-btn { min-height: 34px; padding: 6px 12px; font-size: 13px; box-shadow: none; }
    #wrongbookPage .wrongbook-section-head { flex-wrap: wrap; gap: 2px 10px; }
    #wrongbookPage .wrongbook-section-head span { font-size: 12px; }
    .study-missing-evidence { padding: 10px 12px; font-size: 14px; }
    .study-artifacts article { border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; overflow: visible; }
    .study-artifacts article header { padding: 8px 10px; gap: 4px 8px; border-radius: 0 10px 10px 0; }
    .study-artifacts article header code { display: none; }
    .study-artifacts article > small { padding: 0 10px 8px; font-size: 12px; overflow-wrap: anywhere; }
    .study-artifact-content { padding: 10px 0 10px 8px; font-size: 16px; line-height: 1.8; }
    .study-rich-content .study-rich-lead { font-size: 18px; }
    .study-rich-block { margin-bottom: 12px; border-radius: 10px; }
    .study-rich-content .study-rich-block-title { padding: 9px 12px; font-size: 16px; }
    .study-rich-block-body { padding: 10px 12px; }
    .study-rich-content h3, .study-rich-content h4 { font-size: 15px; }
    .study-rich-content ol, .study-rich-content ul { padding-left: 1.3em; }
    .study-rich-content blockquote { padding: 8px 10px; }
    .study-rich-content .katex-display {
        margin: 8px 0;
        padding-bottom: 6px;
        /* 长公式可左右滑：边缘阴影提示还有内容 */
        background:
            linear-gradient(to right, var(--bg-secondary, #fff) 30%, transparent) left / 24px 100% no-repeat local,
            linear-gradient(to left, var(--bg-secondary, #fff) 30%, transparent) right / 24px 100% no-repeat local,
            radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .2), transparent) left / 10px 100% no-repeat scroll,
            radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .2), transparent) right / 10px 100% no-repeat scroll;
    }
    .study-rich-content .katex { font-size: 1.05em; }
}
