#history-view { max-width: 1080px; padding-bottom: 64px; min-width: 0; zoom: var(--fs, 1); }
.qh-entry-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qh-retake { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 20px 0; border-block: 1px solid var(--line); margin-bottom: 20px; }
.qh-retake > div:first-child { flex: 1 1 300px; min-width: 0; }
.qh-retake p { margin: 6px 0 0; font-size: 14px; color: var(--text2); line-height: 1.6; }
.qh-retake-error { flex-basis: 100%; color: var(--bad) !important; }
.qh-retake [data-history-action="retake-start"] { background: var(--accent); color: var(--on-accent, #fff); }
#history-view * { box-sizing: border-box; letter-spacing: 0; }
#history-view :is(h2,h3,h4,p,span,a,time) { overflow-wrap: anywhere; }
#history-view :is(button,select):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#history-view :is(button,select) { min-height: 44px; font: inherit; }
#history-view button { white-space: normal; }
#history-view button:disabled { opacity: .45; cursor: not-allowed; }
#history-view h2 { font-size: 28px; line-height: 1.25; margin: 0 0 8px; }
#history-view h3 { font-size: 19px; line-height: 1.35; margin: 0 0 6px; }
#history-view :is(h2,h3) { scroll-margin-top: 100px; }
#history-view h4 { font-size: 16px; margin: 0 0 10px; }
.qh-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 24px 0; }
.qh-head p { margin: 0; color: var(--text2); }
.qh-filters,.qh-review-toolbar { display: flex; gap: 16px; flex-wrap: wrap; padding: 16px 0; border-block: 1px solid var(--line); }
.qh-filters label,.qh-review-toolbar label { display: grid; gap: 8px; flex: 1 1 180px; min-width: 0; color: var(--text2); font-size: 13px; font-weight: 600; }
#history-view select { width: 100%; min-width: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 10px 32px 10px 12px; }
.qh-note { font-size: 13px; line-height: 1.6; color: var(--text2); margin: 16px 0; }
.qh-status { color: var(--text2); font-size: 14px; padding: 8px 0; min-height: 36px; }
.qh-row { display: grid; grid-template-columns: minmax(0,1fr) 150px auto; gap: 24px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.qh-row time,.qh-row p { font-size: 13px; line-height: 1.5; color: var(--text2); margin: 4px 0 0; }
.qh-score { display: grid; gap: 4px; }
.qh-score strong { font-size: 27px; line-height: 1.2; color: var(--text); }
.qh-score span,.qh-score small { font-size: 12px; line-height: 1.4; color: var(--text2); }
.qh-empty { padding: 32px 0; line-height: 1.6; color: var(--text2); }
.qh-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 0; }
.qh-pagination span { font-size: 13px; color: var(--text2); text-align: center; }
.qh-question { max-width: 800px; padding: 28px 0 0; margin: 0 auto; line-height: 1.65; }
.qh-question-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text2); margin: 8px 0 20px; }
.qh-result { font-weight: 700; }
.qh-result.is-correct { color: var(--grade-ok, var(--accent)); }
.qh-result.is-incorrect { color: var(--grade-bad, var(--bad)); }
.qh-revision { border-left: 3px solid var(--warn); padding: 12px 16px; background: var(--panel); font-size: 14px; margin-bottom: 22px; }
.qh-revision p { margin: 6px 0 0; }
.qh-stem { font-size: 17px; line-height: 1.7; }
.qh-figure { display: block; max-width: 100%; height: auto; margin: 20px auto; }
.qh-choices { list-style: none; margin: 24px 0; padding: 0; }
.qh-choice { margin: 12px 0; border: 1px solid var(--line); border-radius: 6px; padding: 16px; background: var(--panel); }
.qh-choice.is-key { border-left: 4px solid var(--grade-ok, var(--accent)); }
.qh-choice.is-selected { border-left: 4px solid var(--grade-bad, var(--bad)); }
.qh-choice-head { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 12px; font-weight: 600; }
.qh-letter { font-size: 14px; color: var(--text2); }
.qh-choice-label { font-size: 12px; color: var(--text2); margin-top: 4px; font-weight: 600; }
.qh-rationale { font-size: 14px; color: var(--text2); margin: 12px 0 0 36px; }
.qh-explanation,.qh-sources { padding: 24px 0; border-top: 1px solid var(--line); }
.qh-sources ul { margin: 0; padding-left: 20px; }
.qh-sources li { margin-bottom: 12px; }
.qh-sources a { color: var(--accent); text-decoration: underline; }
.qh-review-toolbar { scroll-margin-top: 100px; }
@media (max-width: 600px) {
    #history-view { padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right)); }
    .qh-row { grid-template-columns: minmax(0,1fr) 105px; gap: 14px; }
    .qh-row > .qh-entry-actions { grid-column: 1 / -1; width: 100%; }
    .qh-row .qh-entry-actions button,.qh-retake .qh-entry-actions button { flex: 1 1 120px; }
    .qh-retake .qh-entry-actions { width: 100%; }
    .qh-head { align-items: flex-start; gap: 14px; }
    #history-view h2 { font-size: 24px; }
    .qh-filters label,.qh-review-toolbar label { flex-basis: 100%; }
    .qh-rationale { margin-left: 0; }
    .qh-choice { padding: 14px; }
    .qh-score strong { font-size: 24px; }
}
@media (max-width: 380px) {
    .qh-retake .qh-entry-actions { flex-direction: column; }
    .qh-retake .qh-entry-actions button { flex: auto; width: 100%; }
}
