.immunology-moodle-mode .test1-heading { max-width: 65%; line-height: 1.25; }
.immunology-moodle-mode .anki-imported-html.is-very-long { font-size: 1.12rem; }
.immunology-moodle-mode .test1-answer li { margin-bottom: 0.5em; }
.immunology-moodle-mode .test1-answer li::marker { color: #a9d6c0; }
.immunology-moodle-mode .card-content .anki-imported-html { max-height: none; overflow: visible; }
.immunology-moodle-mode .quiz-card { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.moodle-term { color: inherit; font: inherit; text-decoration: none; border: 0; background: none; cursor: help; }
.moodle-term:focus-visible { outline: 1px solid #a9c9e8; outline-offset: 3px; }
.moodle-term-tooltip {
    position: fixed;
    z-index: 10000;
    width: 380px;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    box-sizing: border-box;
    overflow: auto;
    padding: 18px;
    border: 1px solid #637482;
    border-radius: 8px;
    background: #202a30;
    color: #eef2f5;
    box-shadow: 0 8px 24px #0005;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: 0;
    text-align: left;
    overflow-wrap: anywhere;
}
.moodle-term-tooltip[hidden] { display: none; }
.moodle-term-tooltip > strong { display: block; padding-right: 32px; font-size: 1rem; line-height: 1.4; }
.moodle-term-tooltip > p { margin: 10px 0 0; }
.moodle-term-tooltip > button {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #bfcbd4;
    cursor: pointer;
}
.moodle-term-tooltip > button:hover, .moodle-term-tooltip > button:focus-visible { background: #ffffff12; color: white; }
.moodle-term-tooltip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.immunology-moodle-mode .card-hover-meta .pill,
.immunology-moodle-mode .card-hover-meta .topic-tag {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 28px;
}
.immunology-moodle-mode .card-surface.is-interactive-question {
    cursor: default;
    align-content: start;
    padding-top: 72px;
}
.immunology-moodle-mode .is-interactive-question .card-content { display: block; min-width: 0; }
.immunology-moodle-mode .exam-grade-actions [hidden],
.moodle-question [hidden] { display: none !important; }
.moodle-question { width: 100%; max-width: 940px; margin: 0 auto; text-align: left; letter-spacing: 0; }
.moodle-question-mode { margin: 0 0 12px; color: #a9c9e8; font-size: 0.88rem; font-weight: 600; }
.moodle-question-prompt { margin: 0 0 24px; font-size: 1.5rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.moodle-choice {
    display: grid;
    grid-template-columns: 22px 24px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 15px 12px;
    border-bottom: 1px solid #ffffff20;
    font-size: 1.08rem;
    line-height: 1.5;
    cursor: pointer;
}
.moodle-choice:has(input:checked) { background: #a9c9e813; }
.moodle-choice:has(input:focus-visible) { outline: 2px solid #a9c9e8; outline-offset: -2px; }
.moodle-choice input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: #a9c9e8; }
.moodle-choice-letter { color: #b5c5d2; }
.moodle-choice-text, .moodle-order-text { min-width: 0; overflow-wrap: anywhere; }
.moodle-question .is-correct { background: #a9d6c010; border-color: #a9d6c065; }
.moodle-question .is-wrong { background: #e5b5cb12; border-color: #e5b5cb65; }
.moodle-choice small { grid-column: 3; min-height: 1.3em; line-height: 1.3; font-size: 0.84rem; font-weight: 600; }
.moodle-question .is-correct > small, .moodle-question.is-correct .moodle-result h3 { color: #a9d6c0; }
.moodle-question .is-wrong > small, .moodle-question.is-wrong .moodle-result h3 { color: #e5b5cb; }
.moodle-question-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 24px 0 0; }
.moodle-check {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; border: 1px solid #a9c9e8; border-radius: 6px;
    padding: 10px 18px; background: #a9c9e8; color: #1e2932; font: inherit; font-weight: 700; cursor: pointer;
}
.moodle-check:disabled { opacity: 0.4; cursor: default; }
.moodle-response-status { color: #bcc6cd; font-size: 0.9rem; }
.moodle-result { padding-top: 20px; margin-top: 12px; border-top: 1px solid #ffffff26; font-size: 1.04rem; line-height: 1.6; }
.moodle-result h3 { margin: 0; font-size: 1.2rem; }
.moodle-key-label { margin: 16px 0 6px; color: #bcc6cd; font-size: 0.9rem; }
.moodle-result ul, .moodle-result ol { margin: 8px 0; padding-left: 24px; }
.moodle-result li { margin-bottom: 8px; }
.moodle-match-bank { padding-left: 30px; margin: 0 0 24px; font-size: 1.04rem; line-height: 1.55; }
.moodle-match-bank li { padding: 8px 0 8px 8px; }
.moodle-match-bank li::marker { color: #d4c09c; font-weight: 700; }
.moodle-match-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; align-items: center; padding: 12px; border-bottom: 1px solid #ffffff20; }
.moodle-match-row label { font-weight: 600; }
.moodle-match-row small { grid-column: 1 / -1; min-height: 1.6em; }
.moodle-match-row select { width: 100%; min-height: 44px; background: #293138; color: #e7edf3; border: 1px solid #71808b; border-radius: 4px; padding: 8px; font: inherit; }
.moodle-order-list { list-style: none; margin: 0; padding: 0; }
.moodle-order-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) 88px; gap: 10px; padding: 12px 8px; align-items: center; border-bottom: 1px solid #ffffff20; font-size: 1.04rem; line-height: 1.5; }
.moodle-order-grip { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #a9c9e8; cursor: grab; touch-action: none; }
.moodle-order-grip svg { width: 20px; height: 20px; }
.moodle-order-grip:hover:not(:disabled) { background: #a9c9e813; }
.moodle-order-grip:active { cursor: grabbing; }
.moodle-order-grip:disabled { opacity: 0.3; cursor: default; }
.moodle-order-ghost { background: #a9c9e813; opacity: 0.4; }
.moodle-order-drag { color: #e7edf3; background: #343d45; border: 1px solid #a9c9e8; box-shadow: 0 8px 24px #0004; pointer-events: none; }
.moodle-order-number { color: #d4c09c; font-weight: 600; }
.moodle-order-controls { display: flex; }
.moodle-order-controls button { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid #71808b; border-radius: 4px; color: #a9c9e8; background: #ffffff06; cursor: pointer; }
.moodle-order-controls button:disabled { opacity: 0.3; cursor: default; }
.moodle-question button:focus-visible, .moodle-question select:focus-visible { outline: 2px solid #a9c9e8; outline-offset: 3px; }
@media (max-width: 600px) {
    .immunology-moodle-mode .card-surface.is-interactive-question { padding: 20px 14px; min-height: 0; }
    .moodle-question-prompt { font-size: 1.15rem; margin-bottom: 16px; }
    .moodle-choice { padding: 12px 2px; grid-template-columns: 20px 20px minmax(0, 1fr); gap: 7px; font-size: 1rem; }
    .moodle-order-item { grid-template-columns: 44px minmax(0, 1fr); padding: 12px 0; font-size: 1rem; }
    .moodle-order-controls { grid-column: 2; justify-self: end; gap: 6px; }
    .moodle-result, .moodle-match-bank { font-size: 1rem; }
    .moodle-match-row { grid-template-columns: minmax(0, 1fr) 108px; padding: 12px 2px; }
    .immunology-moodle-mode .test1-heading { max-width: 100%; }
    .immunology-moodle-mode .anki-imported-html.is-very-long { font-size: 1.04rem; }
    .immunology-moodle-mode .card-frame { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; width: 100%; }
    .immunology-moodle-mode .card-hover-meta,
    .immunology-moodle-mode .card-hover-tools { position: static; opacity: 1; pointer-events: auto; transform: none; }
    .immunology-moodle-mode .card-hover-meta {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        gap: 4px;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
    }
    .immunology-moodle-mode .card-hover-meta #topic-pill,
    .immunology-moodle-mode .card-hover-meta #subtopic-pill { display: none; }
    .immunology-moodle-mode .card-hover-meta .card-meta-label { max-width: 100%; }
    .immunology-moodle-mode .card-hover-tools { flex: 0 0 auto; }
    .immunology-moodle-mode .card-surface { flex: 1 0 100%; min-width: 0; }
}
