/* Reference question shell. The extra ID specificity isolates this shell from legacy reader rules. */
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) {
    --reader-line: #efefef;
    --reader-muted: #737373;
    --reader-ink: #171717;
    --reader-purple: #348de8;
    --reader-toolbar-height: 68px;
    --reader-footer-height: 64px;
    position: relative;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    padding: var(--reader-toolbar-height) 0 var(--reader-footer-height) !important;
    box-sizing: border-box;
    background: #fff;
    color: var(--reader-ink);
    font-family: var(--font-ui);
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalDetail {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    overflow: hidden !important;
    padding: 0;
    position: static !important;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalQuestionView {
    display: flex;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden;
    padding: 0;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalQuestionView > .topical-view-header {
    position: absolute !important;
    inset: 0 0 auto !important;
    z-index: 8;
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    height: var(--reader-toolbar-height);
    min-height: 0 !important;
    padding: 8px 16px !important;
    border-bottom: 1px solid var(--reader-line) !important;
    background: #fff;
    box-sizing: border-box;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) button,
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) summary { font-family: inherit; cursor: pointer; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) button:disabled { cursor: default; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .icon {
    width: 16px; height: 16px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto;
}
.question-reader-navigation { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-reader-home-button {
    display: inline-flex !important; align-items: center; gap: 6px;
    width: auto; height: 32px; padding: 0 4px; border: 0; border-radius: 8px;
    color: var(--reader-muted); background: transparent; font-size: 14px; font-weight: 400;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-primary { flex: 1; min-width: 0; padding: 0; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-title-row { justify-content: flex-end; gap: 6px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalViewTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; color: #737373; font-size: 12px; font-weight: 400; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-meta-button { color: #737373; border: 0; background: transparent; }
.question-reader-document-actions { display: flex; align-items: center; gap: 8px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-document-switcher {
    display: flex !important; flex: 0 0 auto; gap: 0; height: 36px; padding: 0;
    border: 0; border-radius: 12px; background: #f5f5f5;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-document-switcher button {
    min-height: 0; padding: 0 14px; border: 0; border-radius: 12px;
    font-size: 14px; font-weight: 500; color: #737373; background: transparent; white-space: nowrap;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-document-switcher button.active { background: #ededed; color: #171717; box-shadow: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-document-actions .topical-pdf-toolbar { display: none !important; }
.question-reader-timer {
    position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    color: #0a0a0a; font-variant-numeric: tabular-nums;
}
.question-reader-timer output { font-size: 16px; font-weight: 600; line-height: 20px; }
.question-reader-timer output { display: flex; width: 4.4ch; flex-shrink: 0; text-align: center; }
.question-reader-timer .timer-digit { position: relative; width: 1ch; flex: 0 0 1ch; }
.question-reader-timer .timer-separator { width: .4ch; flex: 0 0 .4ch; }
.question-reader-timer.is-concealed output { user-select: none; }
.question-reader-timer.is-concealed .timer-digit { color: transparent; }
.question-reader-timer.is-concealed .timer-digit::after { content: ""; position: absolute; width: 70%; height: 12px; left: 15%; top: 4px; border-radius: 1px; background: #c5c5c5; }
.question-reader-timer.is-concealed .timer-separator { color: #b5b5b5; }
#questionReaderTimerHide { box-sizing: border-box; width: 56px; min-width: 56px; max-width: 56px; flex: 0 0 56px; padding: 0; }
.question-reader-timer > div { display: flex; align-items: center; gap: 8px; }
.question-reader-timer button { height: 26px; padding: 0 12px; border: 1px solid #efefef; border-radius: 20px; background: #fff; color: #737373; font-size: 12px; }
.question-reader-timer button:first-child { display: grid; place-items: center; width: 26px; padding: 0; }
.question-reader-timer .icon { width: 12px !important; height: 12px !important; }
.question-reader-timer-show { width: 36px; height: 36px; border: 0; border-radius: 12px; background: #f5f5f5; color: #a3a3a3; }
.question-reader-timer[hidden], .question-reader-timer-show[hidden] { display: none; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalQuestionView > .topical-pdf-stage {
    flex: 1 1 auto !important; height: 100% !important; min-height: 0 !important;
    overflow-y: auto !important; overflow-x: hidden !important;
    padding: 18px 16px 28px !important; box-sizing: border-box;
    background: #fff; scrollbar-width: thin; scrollbar-color: #a3a3a3 transparent;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-pdf-page-stack { min-height: 0; margin: 0 auto; }
.question-reader-footer {
    position: absolute; inset: auto 0 0; z-index: 8; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; height: 64px;
    padding: 12px max(24px, calc((100% - 1160px) / 2));
    border-top: 1px solid var(--reader-line); box-sizing: border-box; background: #fff;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-picker-dock { position: static !important; inset: auto; transform: none; flex: 0 0 auto; display: flex; margin: 0; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-question-picker-trigger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 144px; height: 36px; padding: 0 20px; border: 0; border-radius: 12px;
    background: #171717; color: #fafafa; font-size: 14px; font-weight: 500; box-shadow: none;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-question-picker-trigger .icon { width: 12px; height: 12px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions { display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 8px; margin-left: auto; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > button,
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav button {
    position: static; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: auto; height: 36px; min-height: 36px; padding: 0 16px; margin: 0;
    border: 0; border-radius: 12px; background: #f5f5f5; color: #737373;
    font-size: 14px; font-weight: 500; line-height: 1; box-shadow: none; white-space: nowrap;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > .question-reader-chat { background: #348de8; color: #fff; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > .question-reader-info { width: 36px; padding: 0; background: #fff; border: 1px solid #efefef; color: #a3a3a3; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > .topical-check-button { background: #171717; color: #fafafa; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > .topical-check-button:disabled { background: #f5f5f5; color: #a3a3a3; opacity: 1; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-assistant-trigger[aria-expanded="true"] { background: #eaeaea; color: #171717; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode {
    display: flex; align-items: center; flex: 0 0 auto; gap: 0;
    min-height: 36px; height: 36px; padding: 0; border: 0; border-radius: 12px; background: #eaf3ff;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode[hidden] { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode button {
    min-width: 0; height: 36px; min-height: 0; padding: 0 12px;
    border: 0; border-radius: 12px; font-size: 13px; font-weight: 500; color: #348de8; background: transparent; box-shadow: none;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode button.active { background: #d6e9ff; color: #1e67bd; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav {
    position: static !important; display: flex !important; flex: 0 0 auto; gap: 8px;
    transform: none; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav button { background: #fff; border: 1px solid #efefef; font-weight: 400; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav button:disabled { opacity: .45; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer button[hidden] { display: none; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer #topicalAnswerBooklet {
    position: static !important; inset: auto; transform: none; display: block;
    flex: 0 0 auto; width: auto !important; max-width: none; height: auto; min-height: 0;
    margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer #topicalAnswerBooklet[hidden] { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .answer-booklet-question { margin: 0; padding: 0 8px; border: 1px solid #efefef; border-radius: 12px; min-height: 36px; }
.question-reader-backdrop { position: fixed; inset: 0; z-index: 30; background: #0008; }
.question-reader-backdrop[hidden] { display: none; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace):not(.question-reader-assistant-pinned):has(#topicalAssistantPanel) {
    grid-template-columns: minmax(0, 1fr) !important;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalAssistantPanel {
    position: fixed !important; inset: 12px 12px 12px auto !important; z-index: 31;
    display: flex; flex-direction: column; grid-column: auto !important; grid-row: auto !important;
    width: min(448px, calc(100vw - 24px)) !important; height: auto !important;
    min-height: 0; padding: 0; overflow: hidden; border: 1px solid #e5e5e5 !important;
    border-radius: 16px; background: #fff; color: #171717; box-shadow: 0 2px 6px #00000014;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalAssistantPanel[hidden] { display: none; }
.question-reader-assistant-header { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; padding: 8px 12px 4px; }
.question-reader-assistant-header button { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; color: #737373; background: transparent; font-size: 14px; }
.question-reader-assistant-header button:last-child { width: 32px; padding: 0; justify-content: center; color: #a3a3a3; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tabs {
    display: flex; align-items: end; flex: 0 0 auto; gap: 16px; min-height: 0;
    margin: 0; padding: 8px 16px 0; border: 0; border-bottom: 1px solid #efefef;
    border-radius: 0; background: #fff;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tabs button {
    position: relative; display: flex; align-items: center; gap: 8px;
    min-height: 0; padding: 0 4px 8px; border: 0; border-bottom: 2px solid transparent;
    border-radius: 0; font-size: 14px; font-weight: 500; color: #737373; background: #fff; box-shadow: none;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tabs button.active { color: #171717; border-bottom-color: #171717; background: #fff; box-shadow: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tab-icon { width: 16px; height: 16px; margin: 0; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-body { flex: 1; min-height: 0; padding: 0; background: #fff; scrollbar-width: thin; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-section-heading { padding: 16px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalAssistantExplanationHeading { font-size: 14px; font-weight: 500; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalAssistantInfoPanel { padding: 20px 16px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-resizer { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .conversation { padding: 24px 16px 140px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome { gap: 0; width: 100%; padding: 22px 0; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-assistant-mark { width: 64px; height: 64px; margin: 0 auto 16px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-quick-chat-mascot { width: 64px; height: 64px; border-radius: 0; object-fit: contain; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-heading { margin: 0; justify-content: center; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-heading > span { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-heading h1 { margin: 0; color: #171717; font-size: 20px; font-weight: 500; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-cards { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 28px 0; width: 100%; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card { display: flex; flex: 0 0 auto; justify-content: center; gap: 6px; width: auto; min-height: 0; height: 28px; padding: 0 12px; border: 0; border-radius: 20px; color: #737373; background: #f5f5f5; box-shadow: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card__icon { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card__copy { flex: 0 0 auto; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card__copy strong { color: #737373; font-size: 13px; font-weight: 400; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card__chevron { width: 14px; height: 14px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .prompt-card:nth-child(4) { display: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .welcome-usage { margin: 0; color: #737373; font-size: 12px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .composer-wrap { padding: 8px 12px 12px; border: 0; background: #fff; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .composer { display: grid; grid-template-columns: 32px minmax(0, 1fr) 36px; grid-template-rows: minmax(42px, auto) 36px; gap: 6px; width: 100%; padding: 12px; border: 0; border-radius: 16px; background: #f5f5f5; box-shadow: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .composer-input-wrap { grid-column: 1 / -1; grid-row: 1; width: 100%; padding: 0; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .math-editor { width: 100%; min-height: 42px; max-height: 150px; padding: 4px; background: transparent; color: #171717; font-size: 14px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .composer-tool-button { position: static; grid-column: 1; grid-row: 2; width: 32px; height: 36px; margin: 0; padding: 6px; border: 0; border-radius: 8px; color: #a3a3a3; background: transparent; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .send-button { position: static; display: grid; place-items: center; grid-column: 3; grid-row: 2; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 50%; background: #171717 !important; clip-path: none; filter: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .send-button .icon { fill: #fff; transform: none; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .paper-reader-quick-chat-mount .composer-expand-button { display: none; }
/* Whole-paper practice keeps its full answer sheet beside the PDF. */
.app-shell #topicalWorkspace.topical-question-open.practice-reader-mode:is(#topicalWorkspace) #topicalQuestionView:has(> #topicalAnswerBooklet:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); }
.app-shell #topicalWorkspace.topical-question-open.practice-reader-mode:is(#topicalWorkspace) #topicalQuestionView > .topical-pdf-stage { grid-column: 1; grid-row: 1; }
.app-shell #topicalWorkspace.topical-question-open.practice-reader-mode:is(#topicalWorkspace) #topicalQuestionView > #topicalAnswerBooklet:not([hidden]) { position: static; grid-column: 2; grid-row: 1; align-self: stretch; width: auto; max-width: none; height: 100%; max-height: none; overflow: auto; margin: 0; padding: 12px; transform: none; border-left: 1px solid #efefef; border-radius: 0; background: #fff; }
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace).question-reader-assistant-pinned {
    grid-template-columns: minmax(0, 1fr) var(--topical-assistant-width, 420px) !important;
}
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace).question-reader-assistant-pinned #topicalAssistantPanel {
    position: relative !important; inset: auto !important; z-index: 6;
    grid-column: 2 !important; grid-row: 1 !important;
    width: 100% !important; height: 100% !important; border: 0 !important;
    border-left: 1px solid #efefef !important; border-radius: 0; box-shadow: none;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace).question-reader-assistant-pinned .topical-assistant-resizer { display: block; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) button:focus-visible,
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) summary:focus-visible { outline: 2px solid var(--reader-purple); outline-offset: 2px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-reader-home-button:hover,
.question-reader-directions summary:hover,
.question-reader-assistant-header button:hover { background: #f5f5f5; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-answer-section { display: none; }
/* Feedback remains readable above the fixed action bar after grading. */
.app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalQuestionView .topical-answer-section:has(#topicalFeedback:not([hidden])) {
    display: block !important; flex: 0 0 auto; max-height: 28vh; margin: 0; padding: 12px 20px;
    border-top: 1px solid #efefef; overflow: auto; background: #fff;
}
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-answer-heading { display: none; }
@media (max-width: 1200px) {
    .question-reader-footer { gap: 8px; padding: 12px 20px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > button,
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav button { padding: 0 12px; font-size: 13px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-question-picker-trigger { min-width: 116px; padding: 0 14px; }
}
@media (max-width: 1000px) {
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalViewTitle { display: none; }
    .question-reader-footer { flex-wrap: wrap; justify-content: flex-start; height: auto; min-height: 64px; padding: 10px 16px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) { --reader-footer-height: 108px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions { margin-left: auto; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav { margin-left: auto; }
}
@media (max-width: 820px) {
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #questionReaderPin { display: none; }
    .question-reader-assistant-header { justify-content: flex-end; }
    .app-shell #topicalWorkspace.topical-question-open.practice-reader-mode:is(#topicalWorkspace) #topicalQuestionView:has(> #topicalAnswerBooklet:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 32vh); }
    .app-shell #topicalWorkspace.topical-question-open.practice-reader-mode:is(#topicalWorkspace) #topicalQuestionView > #topicalAnswerBooklet:not([hidden]) { grid-column: 1; grid-row: 2; border-left: 0; border-top: 1px solid #efefef; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace).question-reader-assistant-pinned { grid-template-columns: minmax(0, 1fr) !important; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace).question-reader-assistant-pinned #topicalAssistantPanel {
        position: fixed !important; inset: 12px 12px 12px auto !important;
        width: min(448px, calc(100vw - 24px)) !important; height: auto !important;
        z-index: 31; border: 1px solid #e5e5e5 !important; border-radius: 16px;
    }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-resizer { display: none !important; }
}
@media (max-width: 600px) {
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) { --reader-toolbar-height: 100px; --reader-footer-height: 144px; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalQuestionView > .topical-view-header { align-content: center; align-items: flex-start; flex-wrap: wrap; padding: 8px 12px !important; gap: 4px 6px; }
    .question-reader-navigation { gap: 4px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-reader-home-button { font-size: 12px; }
    .question-reader-timer { top: 25px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-primary { display: flex; order: 2; margin-left: auto; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-navigation { order: 1; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-document-actions { order: 3; justify-content: flex-end; width: 100%; margin-left: 0; gap: 6px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-document-switcher { height: 32px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-document-switcher button { padding: 0 8px; font-size: 11px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode { min-height: 32px; height: 32px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-header .topical-input-mode button { height: 32px; padding: 0 8px; font-size: 11px; }
    .question-reader-footer { gap: 8px; padding: 10px 12px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions { flex-wrap: wrap; width: 100%; gap: 6px; order: 2; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-view-actions > button { font-size: 12px; padding: 0 10px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .question-reader-info { width: 30px; padding: 0; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer #topicalAnswerBooklet { margin-left: auto; }
    .app-shell #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-footer .topical-question-nav { order: 3; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tabs { gap: 12px; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-assistant-tabs button { font-size: 13px; }
}
/* Embedded note questions use their containing dialog rather than the viewport. */
.problem-popup #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-timer,
.problem-popup #topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-directions { display: none; }

/* Keep the menu anchored to its toolbar button, outside the scrolling PDF. */
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalViewTitle { display: none !important; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .topical-view-primary { order: 3; flex: 0 0 auto; position: static; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) .question-reader-document-actions { margin-left: auto; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaButton { width: 36px; height: 36px; border: 1px solid #efefef; border-radius: 12px; background: #fff; color: #737373; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaButton:hover,
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaButton[aria-expanded="true"] { background: #ededed; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover { position: fixed; inset: auto; z-index: 40; width: 256px; max-width: calc(100vw - 24px); max-height: calc(100vh - 84px); overflow: auto; padding: 12px 8px; border: 1px solid #e9e9e9; border-radius: 12px; color: #404040; background: #fff; box-shadow: 0 2px 4px #0000001a; box-sizing: border-box; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover h3 { margin: 8px 12px 6px; font-size: 12px; line-height: 18px; font-weight: 400; color: #737373; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: inherit; text-align: left; font-size: 14px; font-weight: 400; line-height: 20px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover button:hover { background: #f5f5f5; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover button > span:first-child { display: grid; place-items: center; width: 18px; color: #a3a3a3; font-size: 20px; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalMetaPopover button[aria-pressed="true"]::after { content: '✓'; margin-left: auto; }
#topicalWorkspace.topical-question-open:is(#topicalWorkspace) #topicalViewMeta[hidden] { display: none !important; }
#topicalWorkspace.reader-hide-correct-answers .topical-explanation-answer { display: none !important; }
#topicalWorkspace.topical-question-open.reader-dark { --reader-line: #333; --reader-muted: #a3a3a3; --reader-ink: #ededed; background: #171717 !important; color: #ededed; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark .topical-view-header,
#topicalWorkspace.topical-question-open.reader-dark .question-reader-footer,
#topicalWorkspace.topical-question-open.reader-dark #topicalMetaPopover,
#topicalWorkspace.topical-question-open.reader-dark #topicalMetaButton { background: #222 !important; color: #ededed !important; border-color: #333 !important; }
#topicalWorkspace.topical-question-open.reader-dark .question-reader-timer { color: #ededed; }
#topicalWorkspace.topical-question-open.reader-dark .topical-pdf-stage { background: #171717; }
.question-reader-help { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 24px; border: 1px solid #e5e5e5; border-radius: 16px; background: #fff; color: #171717; font: 14px/1.5 Inter, system-ui, sans-serif; }
.question-reader-help::backdrop { background: #0006; }
.question-reader-help h2 { margin: 0 0 16px; font-size: 20px; font-weight: 500; }
.question-reader-help > button { float: right; border: 0; background: transparent; color: #737373; font-size: 24px; cursor: pointer; }
.question-reader-help dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; }
.question-reader-help dd { margin: 0; color: #737373; }
.question-reader-help textarea { width: 100%; min-height: 120px; padding: 12px; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px; font: inherit; }
.question-reader-help form button { margin-top: 12px; padding: 8px 14px; border: 1px solid #ddd; border-radius: 8px; background: #f5f5f5; font: inherit; cursor: pointer; }
.question-reader-first-stats { position: absolute; bottom: calc(var(--reader-footer-height) + 10px); right: 16px; z-index: 7; padding: 8px 12px; border: 1px solid #e5e5e5; border-radius: 8px; background: #fff; color: #737373; font-size: 12px; }
#topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalMetaPopover button:hover { background: #333; }
#topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalMetaPopover h3 { color: #a3a3a3; }
#topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) .question-reader-first-stats { background: #222; color: #ededed; border-color: #333; }

/* Question navigation keeps readable status colors in the dark reader. */
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser { background:#222 !important; color:#eaeaea; border-color:#383838 !important; box-shadow:none; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser :is(.topical-browser-header,.topical-browser-title h1,.topical-question-legend,.topical-legend-item) { color:#d4d4d4; border-color:#383838; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item { background:#303030; color:#eaeaea; border-color:#484848; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item.has-explanation { background:#443c22; color:#f3dfa0; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item--correct { background:#213c2c; color:#a6e3bd; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item--incorrect { background:#44262a; color:#f4b2bb; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item--review { background:#233b48; color:#add8f0; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item--retry { background:#3c2b49; color:#d6b6ed; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-item.active { border-color:#91b6ef; box-shadow:inset 0 0 0 1px #91b6ef; }
.app-shell #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) #topicalQuestionBrowser .topical-question-number { color:inherit; }

/* Consistent pointer feedback across reader controls and study tools. */
@media (hover: hover) {
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) button:not(:disabled) { transition: filter 140ms ease, background-color 140ms ease; }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) button:not(:disabled):hover { filter: brightness(.92); }
    #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) button:not(:disabled):hover { filter: brightness(1.18); }
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) :is(.topical-meta-button,.topical-assistant-tabs button,.composer-tool-button,.question-reader-assistant-header button):not(:disabled):hover { background-color: #ededed !important; }
    #topicalWorkspace.topical-question-open.reader-dark:is(#topicalWorkspace) :is(.topical-meta-button,.topical-assistant-tabs button,.composer-tool-button,.question-reader-assistant-header button):not(:disabled):hover { background-color: #383838 !important; }
}
@media (prefers-reduced-motion: reduce) {
    #topicalWorkspace.topical-question-open:is(#topicalWorkspace) button { transition: none; }
}
