/* 题目区：Markdown / KaTeX / 图片 的现场排版 */

/* 题干 + 选项自适应排版：题干占剩余空间（可滚动），选项始终紧接其下 */
#question_body {
    position: absolute;
    top: 2.5rem;
    left: 4rem;
    right: 4rem;
    bottom: 11.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .45rem;
    font-family: FZTianZhenSongS, serif;
    font-size: 2rem;
}

#problem_content {
    flex: 0 1 auto;
    min-height: 3.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.5;
    padding-right: .6rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, .32) transparent;
}

#problem_content::-webkit-scrollbar { width: 8px; }
#problem_content::-webkit-scrollbar-track { background: transparent; }
#problem_content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .28);
    border-radius: 4px;
}

/* 题干较长时在卡片上方显示提示，避免现场误以为题目只有半截 */
#question_scroll_hint {
    position: absolute;
    top: .7rem;
    left: 4rem;
    z-index: 3;
    padding: 1px 9px;
    border-radius: 99px;
    border: 1px solid #eadfb8;
    background: #fff6d8;
    color: #7a5600;
    font: 12px/1.7 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* 内容超出时底部渐隐，明确提示还能继续滚动 */
#problem_content.is-overflowing {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5rem), rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5rem), rgba(0, 0, 0, 0));
}

/* 2×2 选项区：公式选项（分式/根式）较高，单列会挤压题干 */
#question_options {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .3rem 2.5rem;
    align-items: start;
}

.q-option {
    display: flex;
    align-items: flex-start;
    gap: .35em;
    line-height: 1.4;
    padding: .08em 0;
}

.qf-opt-body {
    flex: 1 1 auto;
    min-width: 0;
}

#problem_content p { margin: 0 0 .35em; }
#problem_content p:last-child { margin-bottom: 0; }
#problem_content h1,
#problem_content h2,
#problem_content h3 {
    margin: .15em 0 .3em;
    font-size: 1.15em;
    line-height: 1.3;
}
#problem_content ul,
#problem_content ol { margin: .2em 0 .4em 1.4em; padding: 0; }
#problem_content li { margin: .1em 0; }

/* 选项：字母前缀统一由适配层生成，正文允许公式/加粗 */
#choise_a,
#choise_b,
#choise_c,
#choise_d {
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
}

#choise_a p,
#choise_b p,
#choise_c p,
#choise_d p {
    display: inline;
    margin: 0;
}

.qf-opt-key {
    flex: 0 0 auto;
    font-weight: 700;
}

.qf-opt-body > p:first-child { margin-top: 0; }

/* 图片：题干与选项都限高，保留比例 */
#problem_content img,
#choise_a img,
#choise_b img,
#choise_c img,
#choise_d img,
img.qf-image {
    max-width: 100%;
    max-height: 7.5rem;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 4px;
}

/* 公式 */
#problem_content .katex,
#choise_a .katex,
#choise_b .katex,
#choise_c .katex,
#choise_d .katex {
    font-size: 1.05em;
}

#problem_content .katex-display {
    margin: .3em 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.qf-math-raw {
    font-size: .9em;
    padding: 0 .2em;
    border-radius: 3px;
    background: rgba(0, 0, 0, .06);
}

/* 表格：题目卡片里空间有限，用比正文更小的字号，避免撑出滚动区 */
#problem_content table {
    border-collapse: collapse;
    margin: .3em 0;
    font-size: .72em;
    line-height: 1.35;
}

#problem_content th,
#problem_content td {
    border: 1px solid rgba(0, 0, 0, .25);
    padding: .1em .4em;
}

/* 引用块 */
#problem_content blockquote {
    margin: .3em 0;
    padding: .1em .6em;
    border-left: 3px solid rgba(0, 0, 0, .25);
    color: #444;
}
