:root { color-scheme: dark; --bg: #292d32; --panel: #31363d; --well: #272c32; --line: #49515b; --text: #edf1f5; --muted: #b1bcc8; --blue: #a6c5e8; --green: #b0d5bd; --gold: #dec38f; --rose: #e3b0b5; --accent: var(--blue); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.skip-link { visibility: hidden; position: fixed; top: 12px; left: 12px; z-index: 20; color: var(--text); background: var(--well); padding: 10px; }
.skip-link:focus { visibility: visible; }
.innate-shell { position: relative; z-index: 1; width: min(1376px, calc(100% - 48px)); margin: auto; padding: 24px 0 40px; }
.masthead { display: flex; align-items: center; gap: 18px; margin-bottom: 25px; }
.page-title { flex: 1; min-width: 0; }
.page-title > span { font-size: 12px; color: var(--green); }
h1 { font-size: 27px; font-weight: 650; margin: 4px 0 0; line-height: 1.25; }
h1 svg { margin-left: 5px; color: var(--green); width: 25px; height: 25px; vertical-align: -3px; }
.icon-button { flex: 0 0 44px; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--well); color: var(--muted); text-decoration: none; transition: transform 160ms, background 160ms, color 160ms, border-color 160ms; }
.icon-button:hover:not(:disabled), .command:hover:not(:disabled) { color: var(--text); border-color: var(--blue); background: #3b434d; transform: translateY(-1px); }
.icon-button:active:not(:disabled), .command:active:not(:disabled) { transform: translateY(0) scale(.97); }
.icon-button.active, .icon-button[aria-pressed="true"] { color: var(--blue); background: #3b4756; border-color: #7c99b8; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.segmented { display: flex; gap: 4px; padding-right: 8px; border-right: 1px solid var(--line); }
.toolbar-space { flex: 1; }
.search-box { width: 0; min-width: 0; opacity: 0; overflow: hidden; transition: width 240ms ease, opacity 180ms; }
.search-box.open { width: 258px; opacity: 1; }
input[type="search"] { height: 44px; width: 100%; color: var(--text); background: var(--well); border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; }
.categories { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; }
.category { background: var(--well); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 9px 14px; line-height: 1.3; transition: border-color 150ms, background 150ms, color 150ms; }
.category:hover { color: var(--accent); border-color: var(--accent); }
.category.active { background: color-mix(in srgb, var(--accent) 16%, var(--well)); color: var(--accent); border-color: var(--accent); }
.category span { font-size: 12px; opacity: .8; margin-left: 6px; }
[data-category="Neutrophils"] { --accent: var(--blue); }
[data-category="Recognition"] { --accent: var(--gold); }
[data-category="Signalling"] { --accent: var(--rose); }
[data-category="Defence mechanisms"] { --accent: var(--green); }
.position-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; padding: 8px 0; min-height: 32px; }
.deck-progress { height: 3px; background: var(--line); margin-bottom: 20px; }
.deck-progress span { display: block; height: 100%; background: var(--accent); transition: width 240ms; }
.question { position: relative; padding: 22px 28px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 380px; }
.question-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.metadata { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--accent); opacity: .4; transition: opacity 180ms; }
.question:hover .metadata, .question:focus-within .metadata { opacity: 1; }
.metadata span { padding: 6px 10px; background: var(--well); border: 1px solid var(--line); border-radius: 5px; }
.question h2 { font-size: 25px; line-height: 1.4; font-weight: 620; max-width: 1050px; margin: 14px 0 8px; text-wrap: pretty; }
.question-kind { color: var(--muted); font-size: 13px; margin: 0 0 23px; }
#exercise { display: grid; gap: 10px; }
.choice { display: flex; gap: 15px; align-items: center; background: var(--well); border: 1px solid var(--line); border-radius: 7px; padding: 17px 20px; color: var(--text); min-height: 62px; font-size: 16px; line-height: 1.55; transition: background 180ms, border-color 180ms, transform 180ms; cursor: pointer; }
.choice:hover:not(.locked) { background: #363e46; border-color: var(--accent); transform: translateX(2px); }
.choice:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, var(--well)); border-color: var(--accent); }
.choice input { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex: 0 0 20px; }
.choice.locked { cursor: default; }
.choice.correct, .sort-item.correct, .match-row.correct { border-color: #8cbd9e; background: #303f37; }
.choice.incorrect, .sort-item.incorrect, .match-row.incorrect { border-color: #c08e94; background: #42353a; }
.answer-mark { color: var(--muted); margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; flex-shrink: 0; }
.correct .answer-mark { color: var(--green); }
.incorrect .answer-mark { color: var(--rose); }
.order-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.sort-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); background: var(--well); padding: 12px 14px; border-radius: 6px; min-height: 66px; transition: border-color 180ms, background 180ms; }
.sort-item:hover { border-color: var(--accent); }
.sort-item .item-text { flex: 1; min-width: 0; line-height: 1.5; font-size: 15px; }
.grip { width: 30px; flex-basis: 30px; border: none; background: transparent; cursor: grab; touch-action: none; color: #91a0b1; }
.grip:active { cursor: grabbing; }
.ordinal { color: var(--accent); font-size: 12px; min-width: 20px; font-variant-numeric: tabular-nums; }
.reorder { display: flex; flex-direction: column; gap: 2px; }
.reorder .icon-button { height: 25px; width: 30px; flex-basis: 25px; border-color: transparent; background: transparent; }
.reorder svg { width: 17px; height: 17px; }
.sort-ghost { opacity: .25; background: var(--accent); }
.sort-drag { box-shadow: 0 16px 44px #10141966; border-color: var(--accent); }
.match-row { display: grid; grid-template-columns: 125px 1fr 40px; align-items: center; gap: 16px; background: var(--well); padding: 14px; border: 1px solid var(--line); border-radius: 6px; min-height: 78px; }
.match-term { font-size: 18px; color: var(--accent); padding-left: 8px; font-weight: 600; }
.match-answer { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; color: var(--text); background: #333b44; border: 1px solid var(--line); padding: 13px 16px; border-radius: 5px; line-height: 1.5; font-size: 15px; }
.match-answer:hover { border-color: var(--accent); }
.match-answer:disabled { opacity: 1; }
.match-answer .placeholder { color: var(--muted); }
.match-options { display: grid; gap: 9px; }
.classify-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.classify-pool { grid-column: 1 / -1; }
.group-header { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 0 14px; margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--accent); }
.group-header small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.tlr-list { display: grid; gap: 8px; min-height: 98px; align-content: start; }
.classify-pool .tlr-list { display: flex; flex-wrap: wrap; align-content: start; min-height: 80px; }
.tlr-list .sort-item { min-height: 56px; padding: 8px; gap: 7px; }
.classify-pool .sort-item { min-width: 125px; }
.tlr-list:empty::after { content: "No receptors"; align-self: center; color: var(--muted); font-size: 13px; padding: 24px 12px; border: 1px dashed var(--line); border-radius: 6px; }
.feedback { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); animation: reveal 240ms ease-out; }
.result-title { display: flex; align-items: center; gap: 10px; color: var(--green); margin: 0 0 20px; font-size: 19px; font-weight: 600; }
.result-title.wrong { color: var(--rose); }
.explanations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; row-gap: 18px; margin: 22px 0 0; }
.explanations dt { color: var(--accent); font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.explanations dd { margin: 0; font-size: 15px; line-height: 1.7; color: #d2dae2; }
.answer-key { font-size: 14px; line-height: 1.65; color: #dce5e0; border-left: 2px solid var(--green); padding-left: 20px; }
.answer-key h3 { color: var(--green); font-size: 14px; margin: 0 0 10px; }
.answer-key ol { padding-left: 20px; }
.answer-key li { margin: 8px 0; }
.answer-key dl { display: grid; grid-template-columns: minmax(70px, 150px) 1fr; gap: 8px 15px; }
.answer-key dd { margin: 0; }
.actions { position: sticky; bottom: 12px; z-index: 4; width: fit-content; max-width: 100%; display: flex; justify-content: center; gap: 10px; margin: 20px auto 0; padding: 10px; border: 1px solid var(--line); background: #292e35ed; backdrop-filter: blur(14px); border-radius: 8px; box-shadow: 0 8px 24px #10141944; }
.command { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 24px; border: 1px solid var(--line); color: var(--text); background: var(--well); border-radius: 6px; transition: transform 160ms, background 160ms, border-color 160ms; }
.command.primary { background: #a6c5e8; border-color: #b9d4f1; color: #202a36; font-weight: 600; min-width: 200px; }
.command.primary:hover { background: #b9d4f1; color: #202a36; }
.message, .written-stats-status { min-height: 20px; color: var(--muted); font-size: 12px; text-align: center; margin: 12px 0; }
.written-stats-status[data-state="error"] { color: var(--rose); }
.exam-daily-counter { width: 242px; display: flex; flex-direction: column; gap: 5px; padding: 12px 16px; border-radius: 7px; box-shadow: none; flex-shrink: 0; }
.daily-label { display: flex; width: 100%; align-items: center; gap: 10px; color: var(--green); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-caption { display: flex; width: 100%; justify-content: space-between; gap: 12px; font-size: 10px; color: var(--muted); }
.exam-daily-bar { width: 100%; margin-top: 4px; background: #20252b; height: 3px; border-radius: 2px; }
.exam-daily-bar span { height: 3px; background: var(--green); width: var(--daily-pct, 0%); }
.is-loading #daily-count { font-size: 0; min-height: 25px; }
.is-loading #daily-count::after, .spinner { display: inline-block; content: ""; width: 19px; height: 19px; border: 2px solid #ffffff28; border-top-color: #f7fcff; border-radius: 50%; box-shadow: 0 0 9px #f8fcff24; animation: spin 800ms linear infinite; vertical-align: middle; }
#activity-mount { display: none; }
.empty-state { padding: 50px 0; text-align: center; }
.empty-state h3 { font-size: 22px; font-weight: 600; }
.empty-state .command { margin: 25px auto; }
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 26px 30px; width: min(1160px, calc(100% - 40px)); max-height: calc(100dvh - 50px); overscroll-behavior: contain; box-shadow: 0 22px 90px #080c1466; }
dialog::backdrop { background: #11161dbf; backdrop-filter: blur(7px); }
dialog[open] { animation: reveal 200ms ease-out; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: 0; background: var(--panel); padding: 18px 0; border-bottom: 1px solid var(--line); margin: 0 0 20px; z-index: 1; }
.dialog-header h2 { margin: 0; font-size: 22px; font-weight: 600; }
#reference-search { margin-bottom: 22px; }
#match-dialog { width: min(760px, calc(100% - 32px)); }
#match-options { display: grid; gap: 10px; }
#match-options button { min-height: 60px; }
.reference-chapter { border-bottom: 1px solid var(--line); padding: 18px 0; }
.reference-chapter summary { cursor: pointer; color: var(--accent); font-size: 17px; font-weight: 600; line-height: 1.5; }
.reference-chapter .answer-key { margin-top: 22px; }
.figure-reference { margin-top: 24px; }
.figure-reference summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.figure-reference figure { margin: 16px 0 0; }
.figure-reference img { display: block; max-width: 900px; width: 100%; height: auto; border-radius: 5px; }
.figure-reference figcaption { margin-top: 8px; color: var(--muted); font-size: 11px; }
.glossary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; margin-top: 28px; }
.glossary-grid dt { color: var(--blue); font-weight: 600; margin-bottom: 7px; }
.glossary-grid dd { margin: 0; line-height: 1.7; color: #d2dae2; font-size: 14px; }
.term { cursor: help; }
.term:hover, .term:focus-visible { color: var(--blue); }
.term-tooltip, .control-tooltip { position: fixed; z-index: 100; max-width: min(355px, calc(100vw - 24px)); border: 1px solid #687887; border-radius: 6px; background: #1c2229; color: #e2eaf2; box-shadow: 0 10px 30px #0005; padding: 12px 15px; font-size: 13px; line-height: 1.6; pointer-events: none; }
.term-tooltip strong { color: var(--blue); display: block; margin-bottom: 5px; }
.control-tooltip { font-size: 12px; padding: 8px 12px; }
.stats-summary { display: flex; gap: 25px; flex-wrap: wrap; margin-bottom: 22px; }
.stats-summary div { display: flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 600; }
.stats-summary svg { color: var(--green); }
.stats-summary span { color: var(--muted); font-size: 12px; font-weight: 400; }
.stats-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.stats-table th { color: var(--blue); font-weight: 600; text-align: left; }
.stats-table th, .stats-table td { border-bottom: 1px solid var(--line); padding: 13px 10px; }
.stats-table td:first-child { min-width: 140px; }
.stats-table td a { color: inherit; text-decoration: none; }
.stats-table td a:hover { color: var(--blue); }
.stats-table td:not(:first-child), .stats-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 850px) {
    .toolbar { gap: 6px; }
    .search-box.open { flex: 1 1 100%; width: 100%; }
    .explanations { grid-template-columns: 1fr; }
    .match-row { grid-template-columns: 90px 1fr 36px; gap: 10px; }
    .match-term { padding-left: 0; }
}
@media (max-width: 600px) {
    .innate-shell { width: calc(100% - 24px); padding-top: 14px; }
    .masthead { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
    h1 { font-size: 22px; }
    h1 svg { display: none; }
    .exam-daily-counter { width: 100%; display: grid; grid-template-columns: 1fr 1fr; padding: 10px 14px; }
    .daily-label { font-size: 17px; }
    .daily-caption { flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10px; }
    .exam-daily-bar { grid-column: 1 / -1; }
    .toolbar { padding: 7px; gap: 4px; }
    .toolbar .icon-button { width: 38px; height: 40px; flex-basis: 38px; }
    .toolbar .segmented { padding-right: 4px; gap: 2px; }
    .toolbar-space { display: none; }
    .categories { gap: 6px; }
    .category { padding: 8px 10px; font-size: 12px; }
    .question { padding: 14px 12px 20px; }
    .question h2 { font-size: 21px; }
    .question-kind { font-size: 12px; }
    .metadata { font-size: 10px; gap: 4px; opacity: 1; }
    .metadata span { padding: 5px 6px; }
    .choice { padding: 14px 12px; gap: 10px; font-size: 15px; }
    .answer-mark { flex-direction: column; gap: 2px; font-size: 9px; }
    .sort-item { gap: 5px; padding: 8px; }
    .sort-item .item-text { font-size: 14px; }
    .grip { width: 25px; flex-basis: 25px; }
    .ordinal { min-width: 13px; font-size: 10px; }
    .reorder .icon-button { width: 30px; height: 33px; flex-basis: 33px; }
    .match-row { grid-template-columns: 1fr 36px; gap: 10px; padding: 12px; }
    .match-term { grid-column: 1 / -1; font-size: 17px; }
    .match-answer { padding: 10px; font-size: 14px; }
    .classify-layout { grid-template-columns: 1fr; }
    .classify-pool { grid-column: auto; }
    .actions { gap: 6px; bottom: 6px; padding: 7px; }
    .command { padding: 10px 14px; font-size: 14px; }
    .command.primary { min-width: 160px; }
    dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); padding: 0 15px 25px; }
    .glossary-grid { grid-template-columns: 1fr; gap: 20px; }
    .answer-key dl { grid-template-columns: 85px 1fr; gap: 10px; }
    .stats-table { font-size: 12px; }
    .stats-table th, .stats-table td { padding: 12px 5px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
