/* PoM 2 - the block pages and their index. Extends the tokens in style.css.
   Each block page sets --q-accent / --q-accent-soft / --q-accent-ink itself;
   the verdict colours below are shared, so right and wrong read the same
   way in every block. */

:root{
    --q-ok:#2b7a4f;
    --q-ok-soft:#e8f2ec;
    --q-bad:#ab3628;
    --q-bad-soft:#fbeae7;
    --q-star:#9c6a15;
    --q-star-soft:#f9efdb;
    --q-warn:#7d5305;
    --q-warn-soft:#f8f0de;
    --on-q-accent:#ffffff;
    /* the letter on a marked option and the clock when time is short: text on
       a verdict colour, which is white while the verdicts are dark */
    --on-q-mark:#ffffff;
    /* The accent where it is set as text on the page itself: an eyebrow, a
       question number, a hover. In the light theme that is the accent as is;
       in the dark theme the accent is too dark for text and the ink, which is
       already lightened to read on the soft wash, stands in for it. Buttons
       keep the accent itself behind white text in both. */
    --q-accent-text:var(--q-accent);
}

/* The dark theme's share of the tokens: the verdicts, the star and the warning
   go light on dark washes, and each pair keeps at least 7:1 (measured 7.9, 7.0,
   7.8 and 8.4). The accent trio is another matter. Every block page sets
   --q-accent, --q-accent-soft and --q-accent-ink inline on its own :root, and
   those pages are not edited by hand, so the soft and the ink are derived here
   from the accent instead: this selector outranks the inline :root, and
   color-mix() turns any accent into a dark wash and a lightened ink that reads
   on it (the ink lands at 7.4:1 or better on the wash and 10:1 or better on the
   bg for every accent in the portal). The accent itself cannot be lightened in
   place, since a custom property may not be defined from its own value, which
   is what --q-accent-text is for.

   Wrapped in "not print" so a PDF gets the light values above; see base.css. */
@media not print{
    :root[data-theme="dark"]{
        --q-ok:#a6efc0;
        --q-ok-soft:#21402f;
        --q-bad:#ffbdb2;
        --q-bad-soft:#4c2622;
        --q-star:#f8d78a;
        --q-star-soft:#443714;
        --q-warn:#fbdc9f;
        --q-warn-soft:#453a1c;
        --on-q-mark:#151012;
        /* buttons keep white text on the accent in the dark theme too */
        --on-q-accent:#ffffff;
        --q-accent-soft:color-mix(in srgb,var(--q-accent) 32%,var(--card-bg));
        --q-accent-ink:color-mix(in srgb,var(--q-accent) 32%,#ffffff);
        --q-accent-text:var(--q-accent-ink);
    }
}

/* What the dark theme has to say about particular components, kept together
   here rather than scattered beside each one. The shadows go deeper because a
   shadow on a dark page is barely there at the light strength; the dialog's
   backdrop likewise. The course cards set --hue inline, one per course or
   block, and those are the light theme's accents: as text on the dark bg they
   would fall below 3:1, so the eyebrow reads through the same lightening the
   ink gets, and the card's top rule gets a little of it. */
@media not print{
    :root[data-theme="dark"] .notedlg{box-shadow:0 24px 60px rgba(0,0,0,.6);}
    :root[data-theme="dark"] .notedlg::backdrop{background:rgba(0,0,0,.62);}
    :root[data-theme="dark"] .msel-pop{box-shadow:0 12px 28px rgba(0,0,0,.5);}
    :root[data-theme="dark"] .block-card .bmeta,
    :root[data-theme="dark"] .qbank-card .bmeta,
    :root[data-theme="dark"] .still-strip .bmeta{color:color-mix(in srgb,var(--hue) 32%,#ffffff);}
    /* The multi tag and the callouts outline themselves in the block's accent
       or in --border; the accent is a dark colour, so the tag's rule takes the
       ink and the callout's left bar takes the muted grey at full strength. */
    :root[data-theme="dark"] .tag.multi{border-color:var(--q-accent-ink);}
    :root[data-theme="dark"] .tag.has-memo{border-color:var(--q-accent-ink);}
    :root[data-theme="dark"] .tag.has-memo.memo-hit,
    :root[data-theme="dark"] .memo-h.memo-hit{
        background:color-mix(in srgb,var(--q-accent) 60%,var(--card-bg));
        box-shadow:inset 0 -2px 0 var(--q-accent-ink);
    }
    :root[data-theme="dark"] .block-card{
        --hue-ink:color-mix(in srgb,var(--hue) 45%,#ffffff);
        border-top-color:var(--hue-ink);
    }
    :root[data-theme="dark"] .block-card:hover{border-color:var(--hue-ink);}
    :root[data-theme="dark"] .block-card.is-empty:hover{border-color:var(--border);}
    /* A search hit. The block's accent is a dark colour, so its wash at the
       light theme's strength barely lifts off the card: the wash is stronger
       here (text on it stays above 8.6:1 for every accent in the portal) and
       the underline is the lightened ink, two pixels of it. The hit you are on
       is the ink itself with the bg's colour as its text (10:1 or better),
       which is the brightest thing in the note. */
    :root[data-theme="dark"] mark.hit{
        background:color-mix(in srgb,var(--q-accent) 60%,var(--card-bg));
        box-shadow:inset 0 -2px 0 var(--q-accent-ink);
    }
    :root[data-theme="dark"] mark.hit.on{
        background:var(--q-accent-ink);
        color:var(--on-q-mark);
        box-shadow:none;
    }
    /* An objectives highlight: gold on a faint amber wash, about 11:1 on the
       card, with the underline carrying the marker's edge. */
    :root[data-theme="dark"] mark.lo{
        background:rgba(255,200,0,.16);
        color:#ffd75e;
        box-shadow:inset 0 -1px 0 rgba(255,200,0,.55);
    }
    :root[data-theme="dark"] mark.lo :is(strong,b,em,i,u,a,span,.wl){color:#ffd75e !important;}
    :root[data-theme="dark"] mark.lo .wl{border-bottom-color:rgba(255,215,94,.5);}
}

/* A block page opens on roughly 600px of chrome - switcher, masthead, tabs,
   how-to, toolbar - and on a 1366x768 laptop that IS the screen: you land on
   a block and the first question is below the fold, every time. Every number
   from here down to the toolbar was cut for that, and the questions tab
   drops the block's blurb as well, since by then you are working rather than
   arriving. */
.pom2-page{
    width:min(1240px,94%);
    margin:auto;
    padding:22px 0 0;
}

/* block switcher */
.blocknav{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:4px;
    padding:5px;
    margin-bottom:16px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
}

/* On a laptop or wider the course nav pins to the top of the window, so another
   block or the question bank is one click away from anywhere on a long page.
   A shadow in the page colour fills the strip above it, so text scrolling up
   disappears behind it instead of showing through the gap. portal.js keeps
   --bn-h at its height (0 when it is not pinned) for the bars and rails
   pinned below it. On a phone it wraps to four rows, too tall to pin. */
@media (min-width:961px){
    .blocknav{
        position:sticky;
        top:8px;
        z-index:16;
        box-shadow:0 -8px 0 8px var(--bg);
    }
}

.blocknav a{
    padding:6px 12px;
    border-radius:4px;
    font-size:.82rem;
    font-weight:500;
    color:var(--muted);
    white-space:nowrap;
    transition:color .15s,background .15s;
}

.blocknav a:hover{
    color:var(--text);
}

.blocknav a.here{
    background:var(--q-accent-soft);
    color:var(--q-accent-ink);
    font-weight:600;
}

/* Every question in the course is on one page, and it sits in the same strip
   as the blocks because that is where someone after a block's questions will
   look. It is not a sixth block, so it is marked rather than numbered. */
/* Not a sixth block card. It spans the grid it follows and drops the tally,
   because the thing it offers is not "more of these" - it is the one place all
   of them meet, and a card the same size would have said otherwise. */
.qbank-card{
    display:block;
    padding:22px 26px;
    margin-bottom:26px;
    background:var(--card-bg);
    border:1px solid var(--q-accent);
    border-radius:10px;
    transition:border-color .15s,transform .15s;
}

.qbank-card:hover{transform:translateY(-1px);}

.qbank-card h2{
    font-family:var(--serif);
    font-size:1.5rem;
    font-weight:600;
    letter-spacing:-.01em;
    color:var(--q-accent-ink);
    margin-bottom:8px;
}

.qbank-card p:last-child{
    max-width:68ch;
    color:var(--muted);
    font-size:.92rem;
    line-height:1.65;
}

/* the nav entry */
.blocknav a.qbank{
    margin-left:6px;
    font-weight:600;
    color:var(--q-accent-text);
}

.blocknav a.qbank::before{
    content:"\2605";
    margin-right:6px;
    font-size:.76rem;
}

.blocknav a.qbank:hover{color:var(--q-accent-ink);}

.blocknav .home{
    margin-right:6px;
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

/* masthead */
.q-masthead{
    display:flex;
    flex-wrap:wrap;
    justify-content:space-between;
    align-items:flex-end;
    gap:16px 28px;
    padding-bottom:16px;
    margin-bottom:20px;
    border-bottom:1px solid var(--border);
}

.q-masthead .eyebrow{
    font-size:.75rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--q-accent-text);
    margin-bottom:6px;
}

.q-masthead h1{
    font-family:var(--serif);
    font-size:clamp(1.65rem,3.3vw,2.25rem);
    font-weight:600;
    letter-spacing:-.02em;
    line-height:1.15;
}

.q-masthead .lead{
    max-width:620px;
    margin-top:8px;
    color:var(--muted);
    font-size:.92rem;
    line-height:1.5;
}

/* The blurb is an arrival note: it says what the block covers, which is worth
   a paragraph the first time and nothing at all once you are answering. The
   questions tab is the working view, so it takes the paragraph back and
   leaves the eyebrow - Schulich PoM 2, block 2, weeks 5 to 8 - to say which
   block this is. */
body[data-tab="questions"] .q-masthead .lead{display:none;}

.scoreboard{
    display:flex;
    flex-wrap:wrap;
    gap:8px 22px;
}

.score b{
    display:block;
    font-family:var(--serif);
    font-size:1.4rem;
    font-weight:600;
    line-height:1.2;
}

.score .of{
    font-size:.88rem;
    font-weight:400;
    color:var(--muted);
}

.score span:last-child{
    display:block;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.07em;
    text-transform:uppercase;
    color:var(--muted);
}

.score.is-bad b{color:var(--q-bad);}
.score.is-star b{color:var(--q-star);}

/* shell */
.q-shell{
    display:grid;
    grid-template-columns:250px 1fr;
    gap:44px;
    align-items:start;
}

/* The notes filter bar: search and the week chips across the top of the notes
   panel, where a reader looks for them, instead of at the top of the rail. It
   stays pinned while the notes scroll, so the filter is always one move away.
   notes.js keeps --nf-h at its height so the rail and note jumps clear it. */
#panel-notes{row-gap:18px;}
.notefilter{
    grid-column:1 / -1;
    min-width:0;
    position:sticky;
    top:var(--bn-h, 0px);
    z-index:15;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px 18px;
    padding:12px 0;
    background:var(--bg);
    border-bottom:1px solid var(--border);
}
.nf-search{flex:0 1 340px;min-width:220px;display:flex;align-items:center;gap:8px;}
.nf-search .notesearch{flex:1;min-width:0;}
.nf-search .nsnav{margin-top:0;flex-shrink:0;}
.nf-weeks{flex:1 1 auto;min-width:0;}
.notefilter .railnote.hits{flex-basis:100%;margin-top:0;}
/* the weeks read as the sections of the block, like a page's own nav, rather
   than as filter pills: plain labels, the open week underlined on the bar's
   bottom rule */
/* balanced end to end: the search box and the week labels share one centre
   line, and the weeks share out the rest of the width evenly instead of
   bunching on the left */
.notefilter{align-items:center;padding:0;}
.nf-search{padding:10px 0;}
.notefilter .nf-weeks{gap:0;align-self:stretch;align-items:stretch;}
.notefilter .nf-weeks .chip{
    flex:1 1 0;
    justify-content:center;
    white-space:nowrap;
    padding:0 10px;
    margin-bottom:-1px;
    font-size:.86rem;
    font-weight:500;
    background:none;
    border:0;
    border-bottom:2px solid transparent;
    border-radius:0;
}
.notefilter .nf-weeks .chip:hover{color:var(--text);border-bottom-color:var(--border);}
.notefilter .nf-weeks .chip[aria-pressed="true"]{
    background:none;
    color:var(--q-accent-ink);
    border-bottom-color:currentColor;
    font-weight:600;
}
.notefilter .railnote.hits{margin-bottom:10px;}
/* beside the sidebar, the bar uses the shell's own columns: the search box is
   exactly as wide as the sidebar under it, and the weeks start where the
   notes start */
@media (min-width:961px){
    .notefilter{display:grid;grid-template-columns:250px 1fr;column-gap:44px;row-gap:0;}
    .notefilter .railnote.hits{grid-column:1 / -1;}
}
#panel-notes > .rail{
    top:calc(var(--bn-h, 0px) + var(--nf-h, 64px) + 16px);
    max-height:calc(100vh - var(--bn-h, 0px) - var(--nf-h, 64px) - 32px);
}
.sr-only{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0 0 0 0);
    white-space:nowrap;
    border:0;
}
/* on a phone seven week chips would wrap to three rows of a pinned bar, so
   they sit on one line that scrolls sideways */
@media (max-width:640px){
    .nf-search{flex-basis:100%;}
    .notefilter .nf-weeks{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding-bottom:2px;}
    .notefilter .nf-weeks::-webkit-scrollbar{display:none;}
    .notefilter .nf-weeks .chip{flex:0 0 auto;padding:10px 12px 9px;}
}
@media (max-width:960px){#panel-notes > .rail{max-height:none;}}
@media print{.notefilter{display:none !important;}}

/* the notes rail, tucked away (notes.js initTuck): the notes take the whole
   width, and a tab on the left edge brings the rail back */
.q-shell.is-tucked{grid-template-columns:1fr;}
.q-shell.is-tucked > .rail{display:none;}
.rail-tuck{
    justify-self:start;
    padding:4px 10px;
    font:inherit;
    font-size:.78rem;
    color:var(--muted);
    background:transparent;
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
}
.rail-tuck:hover,.rail-show:hover{color:var(--text);border-color:var(--muted);}
.rail-show{
    display:none;
    position:fixed;
    left:0;
    top:50%;
    transform:translateY(-50%);
    z-index:20;
    writing-mode:vertical-rl;
    transform-origin:center;
    padding:12px 6px;
    font:inherit;
    font-size:.78rem;
    font-weight:600;
    letter-spacing:.04em;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-left:0;
    border-radius:0 8px 8px 0;
    box-shadow:var(--shadow);
    cursor:pointer;
}
.q-shell.is-tucked > .rail-show{display:block;}
@media (max-width:960px){
    .rail-tuck,.q-shell.is-tucked > .rail-show{display:none;}
    .q-shell.is-tucked > .rail{display:grid;}
}
@media print{.rail-tuck,.rail-show{display:none !important;}}

/* A panel with no rail beside it - the Anki tab until its decks are in.
   One column, so the empty state sits under the tab strip rather than in
   the 1fr track with a 250px hole where the filters would be. */
.q-shell.is-solo{
    grid-template-columns:1fr;
}

.tab-empty{
    border:1px dashed var(--border);
    border-radius:10px;
    padding:56px 32px;
    text-align:center;
    color:var(--muted);
}

.tab-empty h2{
    margin:0 0 10px;
    font-size:1.15rem;
    font-weight:600;
    color:var(--text);
}

.tab-empty p{
    margin:0 auto;
    max-width:46ch;
    font-size:.9rem;
    line-height:1.7;
}

/* the Anki tab, once a block has a deck
   ---------------------------------------------------------------
   The deck is one file and the page's job is to answer the three questions
   asked before downloading 35 MB: what is in it, what happens when I import
   it, and is my own review history at risk. So the counts and the download sit
   together at the top, the import notes follow as prose, and the week-by-week
   listing goes last - it is the reassurance, not the headline.

   The panel is .is-solo, so there is no rail and no 250px track to span. */
.deck{
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--card-bg);
    overflow:hidden;
}

.deck-head{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:16px 24px;
    padding:22px 24px;
    border-bottom:1px solid var(--border);
}

.deck-what{min-width:0;flex:1 1 20ch;}

.deck-what h2{
    margin:0 0 5px;
    font-family:var(--serif);
    font-size:1.2rem;
    font-weight:600;
    color:var(--text);
}

.deck-sum{
    font-size:.85rem;
    line-height:1.6;
    color:var(--muted);
}

.deck-sum b{color:var(--text);font-weight:600;}

/* Where the deck came from, beside what is in it. The question sets each carry
   their provenance; a deck handed down and re-cut against this year's slides
   has exactly the same question behind it - how current is what I am about to
   download - and it is answered here rather than left to be asked. */
.deck-src{
    max-width:60ch;
    margin-top:9px;
    color:var(--muted);
    font-size:.84rem;
    line-height:1.6;
}

/* Same shape as the review CTA on the questions tab. It is the one action on
   the panel, so it carries the block's accent and nothing else does. */
.deck-dl{
    display:inline-flex;
    align-items:center;
    gap:10px;
    padding:10px 18px;
    font-size:.9rem;
    font-weight:600;
    text-decoration:none;
    white-space:nowrap;
    color:var(--on-q-accent);
    background:var(--q-accent);
    border:1px solid var(--q-accent);
    border-radius:6px;
}

.deck-dl:hover{filter:brightness(1.08);}

.deck-dl .sz{
    font-size:.78rem;
    font-weight:500;
    padding:1px 8px;
    border-radius:999px;
    /* a ring in the button's own text colour, so it sits on the accent in
       either theme. It used to be a wash of that colour, which lightened the
       ground under the white text to 4.1:1 on the lighter accents. */
    box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--on-q-accent) 45%,transparent);
}

.deck-how{
    padding:20px 24px;
    border-bottom:1px solid var(--border);
    font-size:.84rem;
    line-height:1.7;
    color:var(--muted);
}

.deck-how p{margin-bottom:11px;}
.deck-how p:last-child{margin-bottom:0;}
.deck-how strong{color:var(--text);font-weight:600;}
.deck-how code{
    font-size:.92em;
    padding:1px 5px;
    border-radius:4px;
    background:var(--bg);
    border:1px solid var(--border);
}

/* A screenshot of Anki's own (light) deck list, so it keeps a light frame in
   either theme and never grows past its real size. */
.deck-preview{margin:16px 0 0;max-width:560px;}
.deck-preview img{
    display:block;
    width:100%;
    height:auto;
    border:1px solid var(--border);
    border-radius:6px;
    background:#f8f8f8;
}
.deck-preview figcaption{margin-top:7px;font-size:.78rem;line-height:1.55;}

/* Three weeks side by side where there is room, stacked where there is not.
   The lecture names are long enough that a fixed column count would either
   clip them or leave a third of the panel empty. */
.deck-weeks{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(100%,270px),1fr));
    gap:8px 28px;
    padding:20px 24px 22px;
}

.deck-week .panel-h .tc{
    font-size:.72rem;
    font-weight:400;
    text-transform:none;
    letter-spacing:0;
}

.deck-lecs{list-style:none;}

.deck-lecs li{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:14px;
    padding:5px 0;
    font-size:.82rem;
    line-height:1.45;
    border-bottom:1px solid var(--border);
}

.deck-lecs li:last-child{border-bottom:none;}
.deck-lecs .lc-n{color:var(--text);min-width:0;}

.deck-lecs .lc-c{
    flex:none;
    font-size:.76rem;
    color:var(--muted);
    white-space:nowrap;
}

.deck-lecs .lc-c b{color:var(--text);font-weight:600;}
.deck-lecs .hy{color:var(--q-accent-ink);}

/* A grid item is min-width:auto by default, so one long lecture name in the
   index would stretch the whole rail past its 250px track and slide it under
   the stream. Both the rail and the panels inside it have to be allowed to be
   narrower than their content before text-overflow can clip anything. */
/* A sticky rail is pinned to the viewport, so anything past the bottom of the
   screen is simply unreachable: the page scroll moves the stream underneath it
   and never moves the rail's own content. On a laptop the rail runs past the
   fold, which put Week, Status and the save-progress buttons somewhere you
   could only get to by zooming out. Cap it at the viewport and let it scroll
   itself. On a screen tall enough to fit it, nothing changes. */
.rail{
    position:sticky;
    top:calc(var(--bn-h, 0px) + 24px);
    max-height:calc(100vh - var(--bn-h, 0px) - 48px);
    overflow-y:auto;
    scrollbar-gutter:stable;
    display:grid;
    gap:26px;
    min-width:0;
    /* grid rows are stretch by default, which would spread the sections down a
       rail that is now a fixed height instead of letting it scroll */
    align-content:start;
}
.rail > section{min-width:0;}

.panel-h{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
    margin-bottom:10px;
}

.railnote{
    font-size:.8rem;
    line-height:1.55;
    color:var(--muted);
}

.railnote strong{color:var(--text);font-weight:600;}

/* The notes search. It sits in the filter bar beside the week chips because it
   narrows the same two things they narrow - the stream and the lecture index -
   and a filter beside the other filters reads as one control panel. */
.notesearch{position:relative;display:flex;}

.notesearch input{
    width:100%;
    padding:7px 28px 7px 10px;
    font:inherit;
    font-size:.85rem;
    color:var(--text);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    /* Safari renders a search input as a pill with its own inset shadow and
       ignores most of the above until this is off */
    -webkit-appearance:none;
    appearance:none;
}

.notesearch input::placeholder{color:var(--muted);}
.notesearch input:focus{outline:none;border-color:var(--q-accent);}

/* the browser's own clear button is a search-input-only control that Firefox
   does not draw at all, so the portal supplies its own and hides that one */
.notesearch input::-webkit-search-cancel-button{-webkit-appearance:none;}

.ns-clear{
    position:absolute;
    top:50%;
    right:4px;
    transform:translateY(-50%);
    width:22px;
    height:22px;
    padding:0;
    font:inherit;
    font-size:1.05rem;
    line-height:1;
    color:var(--muted);
    background:none;
    border:0;
    border-radius:4px;
    cursor:pointer;
}

.ns-clear:hover{color:var(--text);}

.railnote.hits{margin-top:8px;font-weight:600;color:var(--q-accent-ink,var(--accent));}

/* Walking the hits. The buttons are small because the keyboard is the real
   interface here - Enter and Shift+Enter, the keys find-in-page has trained
   everyone on - and these are the affordance that says so. */
.nsnav{display:flex;align-items:center;gap:6px;margin-top:8px;}

.ns-step{
    width:26px;
    height:24px;
    padding:0;
    font:inherit;
    font-size:.8rem;
    line-height:1;
    color:var(--q-accent-ink);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:5px;
    cursor:pointer;
}

.ns-step:hover{border-color:var(--q-accent);}

.ns-pos{
    font-size:.76rem;
    color:var(--muted);
    font-variant-numeric:tabular-nums;
}

/* The hit you are standing on, as distinct from the 800 you are not. */
mark.hit.on{
    background:var(--q-accent);
    color:var(--on-q-accent,#fff);
    box-shadow:none;
}

/* A hit inside a note. Underlined as well as tinted, because the accent behind
   it is the one thing on the page that changes colour per block and a wash
   alone would be near-invisible on the paler ones. */
mark.hit{
    background:var(--q-accent-soft);
    color:inherit;
    border-radius:2px;
    box-shadow:inset 0 -1px 0 var(--q-accent);
    padding:0 1px;
}

/* What a lecture's learning objectives ask for, highlighted in its note. It is
   meant to shout: a marker-pen yellow with dark text on it, links and
   wikilinks included. The dark theme turns it into gold text on an amber wash
   (with the other dark-theme rules, above), since a solid yellow block glares
   on a dark page. A print always gets the marker, since the PDF is what people
   take into a study session. */
mark.lo{
    background:#ffe03d;
    color:#1d1700;
    border-radius:3px;
    padding:1px 3px;
    box-shadow:inset 0 -2px 0 #e0a800;
    -webkit-box-decoration-break:clone;
    box-decoration-break:clone;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
}
/* Important because the note's own rules (.ct td strong, .prose p strong,
   .framing strong) set bold to the theme's text colour at the same
   specificity and later in the file, which on the dark theme put white text
   on the yellow. A search hit inside a highlight keeps its own colours. */
mark.lo :is(strong,b,em,i,u,a,span,.wl){color:#1d1700 !important;}
mark.lo .wl{border-bottom-color:#9a7a00;}

.fams{display:grid;gap:6px;}

.fam-btn{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    width:100%;
    padding:9px 12px;
    font:inherit;
    font-size:.85rem;
    text-align:left;
    color:var(--text);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
    transition:border-color .15s;
}

.fam-btn:hover:not(:disabled){border-color:var(--q-accent);}

.fam-btn[aria-pressed="true"]{
    background:var(--q-accent-soft);
    border-color:var(--q-accent);
    color:var(--q-accent-ink);
    font-weight:600;
}

.fam-btn:disabled{color:var(--muted);cursor:default;}

.fam-btn .fc{
    font-size:.75rem;
    color:var(--muted);
    flex-shrink:0;
}

.fam-btn[aria-pressed="true"] .fc{color:var(--q-accent-ink);}

.chips{display:flex;flex-wrap:wrap;gap:6px;}

.chip{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 11px;
    font:inherit;
    font-size:.8rem;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
    transition:border-color .15s,color .15s;
}

.chip:hover{color:var(--text);border-color:var(--muted);}

.chip[aria-pressed="true"]{
    background:var(--q-accent-soft);
    border-color:var(--q-accent);
    color:var(--q-accent-ink);
    font-weight:600;
}

.chip .n{font-size:.72rem;font-variant-numeric:tabular-nums;}
.chip.wrongish[aria-pressed="true"]{background:var(--q-bad-soft);border-color:var(--q-bad);color:var(--q-bad);}
.chip.starish[aria-pressed="true"]{background:var(--q-star-soft);border-color:var(--q-star);color:var(--q-star);}

/* the family rows have always greyed out at zero; the chips never did, so
   "Wrong 0" was a live button to an empty page. Faded towards the card
   rather than towards white, so the fade holds in the dark theme too. */
.chip:disabled{
    color:color-mix(in srgb,var(--muted) 55%,var(--card-bg));
    border-color:color-mix(in srgb,var(--border) 60%,var(--card-bg));
    cursor:default;
}
.chip:disabled .n{opacity:.6;}

/* the lecture index

   The week chips narrow the stream but cannot get you to a named lecture, and
   a block runs to 36 notes of a page or more each. The index is the way in.

   It is deliberately the quietest thing in the rail: no box, no rule and no
   count per row, just a line of text, because at 36 rows anything more reads
   as clutter. The note you are on is the only row carrying colour or weight. */
.lecindex{
    /* the rows' offsetTop is read to keep the marked one in view, and that is
       measured against the nearest positioned ancestor - without this it lands
       on the sticky rail on a laptop and on the page itself once the rail goes
       static, which scrolls this panel to a meaningless place */
    position:relative;
    max-height:min(44vh,400px);
    overflow-y:auto;
    overscroll-behavior:contain;
    margin-left:-9px;
    padding-right:2px;
}

.lecrow{
    display:flex;
    gap:9px;
    width:100%;
    max-width:100%;
    padding:5px 8px 5px 7px;
    font:inherit;
    font-size:.8rem;
    line-height:1.45;
    text-align:left;
    color:var(--muted);
    background:none;
    border:0;
    border-left:2px solid transparent;
    border-radius:0 4px 4px 0;
    cursor:pointer;
    transition:color .12s,background .12s;
}

.lecrow:hover{color:var(--text);background:var(--card-bg);}

.lecrow .ln{
    flex-shrink:0;
    padding-top:1px;
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.04em;
    font-variant-numeric:tabular-nums;
}

/* one line each, clipped - the full name is on the row's title attribute, and
   the note itself is one click away, so nothing is actually lost */
.lecrow .lt{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.lecrow[aria-current="true"]{
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    border-left-color:var(--q-accent);
    font-weight:600;
}

/* a live in-class session, told apart from a recorded lecture - in the list
   and on the note's own heading */
.inclass-tag{
    flex-shrink:0;
    align-self:center;
    padding:0 5px;
    font-size:.6rem;
    font-weight:600;
    line-height:1.6;
    letter-spacing:.06em;
    text-transform:uppercase;
    font-style:normal;
    color:var(--q-accent-ink);
    border:1px solid var(--q-accent);
    border-radius:4px;
}
.lecrow .inclass-tag{margin-right:-3px;}

/* a lecture with no note yet is listed, but not pretending to be one */
/* told apart by the italic alone: the row is already muted, and dimming it
   further with opacity put it under 4.5:1 when it still has to be read */
.lecrow.is-gap .lt{font-style:italic;}

/* the week heading inside the index earns its line only on All, where the
   numbering restarts at 01 once per week and would otherwise be unreadable */
.lecgroup{
    padding:12px 8px 4px 7px;
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}
.lecgroup:first-child{padding-top:2px;}

/* the three filters are independent, and until this line existed nothing in
   the rail said which of them had emptied the stream */
.rail-groups{display:grid;gap:26px;}

.applied{
    display:grid;
    gap:8px;
    padding-bottom:16px;
    border-bottom:1px solid var(--border);
}

/* a grid display would beat the UA's [hidden] rule on its own */
.applied[hidden]{display:none;}

.applied-h{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:8px;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

.applied-h .res{
    letter-spacing:0;
    text-transform:none;
    color:var(--text);
    font-variant-numeric:tabular-nums;
}

.applied-list{display:flex;flex-wrap:wrap;gap:6px;align-items:center;}

.fchip{
    display:inline-flex;
    align-items:center;
    gap:7px;
    padding:4px 6px 4px 10px;
    font:inherit;
    font-size:.76rem;
    font-weight:600;
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    border:1px solid var(--q-accent);
    border-radius:999px;
    cursor:pointer;
}

.fchip .x{
    display:grid;
    place-items:center;
    width:15px;
    height:15px;
    border-radius:50%;
    background:color-mix(in srgb,var(--q-accent) 16%,transparent);
    font-size:.72rem;
    line-height:1;
}

.fchip:hover .x{background:color-mix(in srgb,var(--q-accent) 34%,transparent);}

.clear-all{
    font:inherit;
    font-size:.76rem;
    color:var(--muted);
    background:none;
    border:0;
    padding:4px 2px;
    cursor:pointer;
    text-decoration:underline;
    text-underline-offset:2px;
}

.clear-all:hover{color:var(--q-bad);}

.resets{display:grid;gap:6px;}

.danger,.backup-btn{
    width:100%;
    padding:9px 12px;
    font:inherit;
    font-size:.82rem;
    text-align:left;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
    transition:border-color .15s,color .15s;
}

.danger:hover:not(:disabled){color:var(--q-bad);border-color:var(--q-bad);}
.backup-btn:hover{color:var(--q-accent-text);border-color:var(--q-accent);}
.danger:disabled{opacity:.5;cursor:default;}

.danger.armed{
    color:var(--q-bad);
    background:var(--q-bad-soft);
    border-color:var(--q-bad);
    font-weight:600;
}

.storenote{
    font-size:.78rem;
    line-height:1.5;
    color:var(--q-warn);
    background:var(--q-warn-soft);
    border:1px solid var(--q-warn);
    border-radius:6px;
    padding:9px 11px;
    margin-bottom:8px;
}

/* stream */
.stream{min-width:0;}

.family{margin-bottom:36px;}

/* The pooled page nests the question sets inside the block they came from, so
   the stream still reads block by block and week by week the way the term was
   taught. A block page has one block and never draws this. */
.blockgroup{margin-bottom:52px;}
.blockgroup[hidden]{display:none;}

.blockbar{
    padding:14px 18px;
    margin-bottom:22px;
    background:var(--q-accent-soft);
    border-radius:9px;
}

.block-n{
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.09em;
    text-transform:uppercase;
    color:var(--q-accent-text);
    margin-bottom:5px;
}

.blockbar h2{
    font-family:var(--serif);
    font-size:1.85rem;
    font-weight:600;
    letter-spacing:-.015em;
    color:var(--q-accent-ink);
}

/* Sixteen empty question sets would be sixteen dashed panels on one page, so
   on the pooled page a block's gaps are one line instead. The panel is still
   what the block page draws, where a gap is the thing you went to look at. */
.fam-gap{
    padding:11px 14px;
    color:var(--muted);
    font-size:.82rem;
    font-style:italic;
    background:var(--card-bg);
    border:1px dashed var(--border);
    border-radius:7px;
}

.fam-gap[hidden]{display:none;}

/* the MSK body map under the notes' heading (notes.js bodyMap) */
.bodymap{margin-bottom:28px;}

.fam-head{
    padding-bottom:11px;
    margin-bottom:16px;
    border-bottom:2px solid var(--q-accent-soft);
}

.fam-meta{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--q-accent-text);
    margin-bottom:8px;
}

.fam-head h2,
.fam-head h3{
    font-family:var(--serif);
    font-size:1.6rem;
    font-weight:600;
    letter-spacing:-.01em;
    margin-bottom:8px;
}

.fam-head p:last-child{
    max-width:660px;
    color:var(--muted);
    font-size:.9rem;
    line-height:1.6;
}

/* the notes' key: the high-yield line, and the objectives line under it */
.fam-head p.fam-key{max-width:660px;color:var(--muted);font-size:.9rem;line-height:1.6;}
.fam-head p.fam-key + p.fam-key{margin-top:6px;}

.fam-empty{
    padding:22px;
    color:var(--muted);
    font-size:.9rem;
    background:var(--card-bg);
    border:1px dashed var(--border);
    border-radius:8px;
}

.weekbar{margin:26px 0 14px;}

.weekbar h3,
.weekbar h4{
    font-family:var(--sans);
    font-size:.78rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
    padding-bottom:8px;
    border-bottom:1px solid var(--border);
}

.lecbar{margin:20px 0 10px;}

.lecbar h4,
.lecbar h5{
    font-family:var(--serif);
    font-size:1.12rem;
    font-weight:600;
}

.lecbar p{
    margin-top:4px;
    color:var(--muted);
    font-size:.82rem;
    line-height:1.5;
}

/* one question */
/* ---------------------------------------------------------------
   The shuffled stream.

   Bank order groups the cards under a family, a week and a lecture,
   and those headings are the thing shuffling destroys - so the cards
   move out into this flat list and each one carries its own week and
   lecture instead. Hidden in bank order, where the heading three
   lines up already said it.
   --------------------------------------------------------------- */
.shuffled[hidden]{display:none;}

.shuffle-note{
    margin-bottom:14px;
    padding:9px 13px;
    font-size:.8rem;
    line-height:1.5;
    color:var(--muted);
    background:var(--card-bg);
    border:1px dashed var(--border);
    border-radius:7px;
}

.qwhere{display:none;}

#stream[data-order="shuffle"] .qwhere{
    display:block;
    margin:-7px 0 12px;
    font-size:.76rem;
    font-weight:600;
    letter-spacing:.03em;
    color:var(--muted);
}

/* content-visibility is doing real work here, not micro-tuning. The engine
   builds every card once and hides what the filters exclude - which is what
   makes filtering instant, and what makes first paint expensive, because the
   browser lays out and paints all of them before anyone has scrolled. This
   hands the off-screen ones back: they stay in the DOM, keep their ids, and
   answer querySelector, but cost nothing until they approach the viewport.

   Measured on a 4x-throttled CPU, navigation to a painted stream:
     endo block page,  611 cards   3315 ms -> 886 ms
     pooled PoM 2,   1,487 cards   5775 ms -> 1399 ms
     pooled FoM,     1,979 cards   6183 ms -> 1517 ms

   contain-intrinsic-size is the height guessed for a card not yet laid out.
   It only has to be close: `auto` remembers the real height once a card has
   been rendered, so the guess matters on the first pass down the page and
   never again. Too small and the scrollbar lurches as cards are measured. */
.q{
    position:relative;
    padding:16px 22px 12px 26px;
    margin-bottom:10px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
    content-visibility:auto;
    contain-intrinsic-size:auto 420px;
}

/* Printing walks the whole document, and a card the browser has skipped has
   no laid-out contents to put on the page. Both PDF paths - a single note and
   the print-everything button - depend on this. */
@media print{
    .q{content-visibility:visible;}
}

.q::before{
    content:"";
    position:absolute;
    left:0;
    top:14px;
    bottom:14px;
    width:3px;
    border-radius:0 3px 3px 0;
    background:var(--border);
}

.q[data-state="correct"]::before{background:var(--q-ok);}
.q[data-state="wrong"]::before{background:var(--q-bad);}
.q[data-kind="broken"]::before{background:var(--muted);}

.qhead{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:7px;
    margin-bottom:14px;
}

.qnum{
    font-family:var(--serif);
    font-size:.95rem;
    font-weight:600;
    color:var(--q-accent-text);
}

.tag{
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--muted);
    padding:2px 7px;
    border:1px solid var(--border);
    border-radius:999px;
}

.tag.reasoned,.tag.errflag{color:var(--q-warn);border-color:var(--q-warn);}
.tag.kind,.tag.retired{color:var(--muted);background:var(--bg);}
.tag.multi{color:var(--q-accent-ink);border-color:var(--q-accent);}
.tag.fixed{color:var(--q-accent-ink);border-color:var(--q-accent);}

.qhead .spacer{flex:1;}

/* a question back in the review queue: asked fresh, and tagged so it is
   clear why something already answered is open again */
.tag.due-tag{display:none;color:var(--q-accent-ink);border-color:var(--q-accent);background:var(--q-accent-soft);}
.q.is-due .tag.due-tag{display:inline-block;}
/* the note tag, the report link and the star wrap as one unit */
.qhead-end{margin-left:auto;display:inline-flex;align-items:center;gap:7px;flex:none;}

.star-btn{
    font-size:1rem;
    line-height:1;
    padding:4px 6px;
    color:var(--border);
    background:none;
    border:none;
    border-radius:4px;
    cursor:pointer;
    transition:color .15s;
}

.star-btn:hover{color:var(--q-star);}
.star-btn[aria-pressed="true"]{color:var(--q-star);}

.preamble{
    padding:12px 14px;
    margin-bottom:14px;
    font-size:.9rem;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
}

.preamble .pt{
    display:block;
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.06em;
    text-transform:uppercase;
    color:var(--muted);
    margin-bottom:6px;
}

.stem{font-size:.98rem;line-height:1.65;}
.stem p{margin-bottom:10px;}
.stem p:last-child{margin-bottom:0;}
.stem strong{font-weight:600;}
/* the reset in base.css zeroes list padding, which pushed a stem's list numbers
   out of sight; a numbered statement list needs its numbers (#45) */
.stem ol,.stem ul{margin:8px 0 10px 0;padding-left:26px;}

/* A matching question's items are cited by roman numeral in its own options
   ("A. i, ii, iv"), so they have to be numbered the way they are cited. The
   default arabic numbering left the options pointing at nothing. */
.stem ol.match-items{list-style:lower-roman;margin:8px 0 10px 0;padding-left:26px;}
.stem ol.match-items li{margin-bottom:3px;}
.stem ol.match-items li:last-child{margin-bottom:0;}

.opts{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:7px;}

.opt{
    display:flex;
    align-items:flex-start;
    gap:11px;
    width:100%;
    padding:11px 13px;
    font:inherit;
    font-size:.94rem;
    line-height:1.5;
    text-align:left;
    color:var(--text);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
    transition:border-color .15s,background .15s;
}

.opt:hover:not(:disabled){border-color:var(--q-accent);background:var(--q-accent-soft);}
.opt:disabled{cursor:default;}

.opt .L{
    flex-shrink:0;
    width:22px;
    height:22px;
    display:grid;
    place-items:center;
    font-size:.75rem;
    font-weight:600;
    color:var(--muted);
    background:var(--bg);
    border-radius:4px;
}

.opt .t{flex:1;}
.opt .t p{margin:0;}

.opt .verdict{
    flex-shrink:0;
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--muted);
    padding-top:3px;
}

/* an option and its cross-out button share a row */
.opts li{display:flex;align-items:stretch;gap:6px;}
.opt-x{
    flex:none;
    width:30px;
    font:inherit;
    font-size:.78rem;
    line-height:1;
    color:var(--border);
    background:none;
    border:1px solid transparent;
    border-radius:6px;
    cursor:pointer;
    transition:color .15s,border-color .15s;
}
.opt-x:hover{color:var(--q-bad);border-color:var(--border);}
.opt-x[aria-pressed="true"]{color:var(--q-bad);}
.opt[data-struck="on"] .t{text-decoration:line-through;text-decoration-thickness:1.5px;opacity:.5;}
.opt[data-struck="on"] .L{opacity:.5;}
@media print{.opt-x{display:none;}}

.opt[data-pick="on"]{border-color:var(--q-accent);background:var(--q-accent-soft);}
.opt[data-pick="on"] .L{background:var(--q-accent);color:var(--on-q-accent);}

.opt[data-mark="hit"]{border-color:var(--q-ok);background:var(--q-ok-soft);}
.opt[data-mark="hit"] .L{background:var(--q-ok);color:var(--on-q-mark);}
.opt[data-mark="hit"] .verdict{color:var(--q-ok);}

.opt[data-mark="miss"]{border-color:var(--q-bad);background:var(--q-bad-soft);}
.opt[data-mark="miss"] .L{background:var(--q-bad);color:var(--on-q-mark);}
.opt[data-mark="miss"] .verdict{color:var(--q-bad);}

.opt[data-mark="key"]{border-color:var(--q-ok);}
.opt[data-mark="key"] .L{background:var(--q-ok);color:var(--on-q-mark);}
.opt[data-mark="key"] .verdict{color:var(--q-ok);}

.actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:16px;}

.btn{
    padding:8px 15px;
    font:inherit;
    font-size:.85rem;
    font-weight:600;
    color:var(--on-q-accent);
    background:var(--q-accent);
    border:1px solid var(--q-accent);
    border-radius:6px;
    cursor:pointer;
}

.btn.ghost{color:var(--text);background:var(--card-bg);border-color:var(--border);}
.btn.ghost:hover{border-color:var(--q-accent);}
.btn:disabled{opacity:.45;cursor:default;}

.actions .hint{font-size:.8rem;color:var(--muted);}

.banner{
    padding:11px 13px;
    margin-bottom:14px;
    font-size:.85rem;
    line-height:1.55;
    color:var(--q-warn);
    background:var(--q-warn-soft);
    border:1px solid var(--q-warn);
    border-radius:6px;
}

.banner b{display:block;font-weight:600;margin-bottom:3px;}
.banner.pre{margin:16px 0 0;}

.answer{display:none;margin-top:18px;padding-top:16px;border-top:1px solid var(--border);}
.q.revealed .answer{display:block;}

.ans-h{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
    margin-bottom:8px;
}

.ans-body{font-size:.92rem;line-height:1.65;}
.ans-body p{margin-bottom:10px;}
.ans-body p:last-child{margin-bottom:0;}
.ans-body ul,.ans-body ol{margin:0 0 10px 20px;}
.ans-body li{margin-bottom:5px;}
/* a matching question puts its two columns in the stem, so the stem needs the
   same table the answer body already had */
/* a wide lab table scrolls inside its own box on a phone rather than pushing
   the whole page sideways; the extractors wrap every table in .tw */
.ans-body .tw,.stem .tw{overflow-x:auto;margin-bottom:10px;}
.ans-body .tw table,.stem .tw table{margin-bottom:0;}
.ans-body table,.stem table{border-collapse:collapse;width:100%;font-size:.86rem;margin-bottom:10px;}
.ans-body th,.ans-body td,.stem th,.stem td{border:1px solid var(--border);padding:6px 9px;text-align:left;vertical-align:top;}
.ans-body th,.stem th{background:var(--bg);font-weight:600;}
.ans-body img{border:1px solid var(--border);border-radius:6px;}

/* The lecture to go back to. It closes the explanation rather than opening it,
   so it is set quiet - the answer is the thing being read, and this is the
   pointer out of it. */
.ans-src{
    display:flex;
    flex-wrap:wrap;
    align-items:baseline;
    gap:8px;
    margin-top:14px;
    padding-top:11px;
    border-top:1px dashed var(--border);
    font-size:.82rem;
    line-height:1.5;
}

.ans-src .sl{
    flex:none;
    font-size:.68rem;
    font-weight:700;
    letter-spacing:.09em;
    text-transform:uppercase;
    color:var(--q-accent-ink);
}

/* .sw is also the weak-spots panel's 11px colour square; undo its box here,
   or the review line wraps a letter at a time inside it */
.ans-src .sw{display:inline;width:auto;height:auto;border-radius:0;vertical-align:baseline;color:var(--muted);font-weight:500;}

/* Each lecture on the review line opens its note. Set as a quiet link rather
   than a button: the line is the pointer out of the answer and should read
   as one, with the dotted rule saying it can be followed. */
.ans-src .sw-lec{
    font:inherit;
    color:var(--q-accent-ink);
    background:none;
    border:0;
    padding:0;
    margin:0;
    cursor:pointer;
    text-decoration:underline;
    text-decoration-style:dotted;
    text-underline-offset:2px;
}
.ans-src .sw-lec:hover,.ans-src .sw-lec:focus-visible{
    color:var(--q-accent-text);
    text-decoration-style:solid;
}

/* A term the explanation shares with a lecture note (tools/note_links.py).
   Quieter than an ordinary link, since a paragraph can carry several: the
   accent's colour and a dotted underline, solid on hover. */
.ans-body a.kt{
    color:var(--q-accent-ink);
    text-decoration:underline;
    text-decoration-style:dotted;
    text-decoration-thickness:1px;
    text-underline-offset:2px;
}
/* a wiki-link from the vault that now opens its note keeps one underline */
.ans-body .wl:has(> a.kt){border-bottom:0;}
.ans-body a.kt:hover,.ans-body a.kt:focus-visible{
    color:var(--q-accent-text);
    text-decoration-style:solid;
}
/* the term a link opened the note at. Orchid, not the highlighter yellow
   the notes already use for their own marks, so it cannot be mistaken for
   one; white on it reads in either theme. One pulse to catch the eye. */
.notedlg-body .kt-hit{
    background:#8f55e0;
    color:#fff;
    border-radius:3px;
    box-shadow:0 0 0 2px #8f55e0;
    animation:kt-hit 1.6s ease-out 1;
}
.notedlg-body .kt-hit *{color:inherit;}
@keyframes kt-hit{
    0%{box-shadow:0 0 0 2px #8f55e0,0 0 0 2px rgba(143,85,224,.6);}
    100%{box-shadow:0 0 0 2px #8f55e0,0 0 0 14px rgba(143,85,224,0);}
}
@media (prefers-reduced-motion:reduce){
    .notedlg-body .kt-hit{animation:none;}
}

/* The learner's own note on a question. It sits in the answer, under the
   review line, so it shows exactly when the answer does and a sat paper hides
   it with everything else. Set like the review line: the answer is what is
   being read, and this is the learner's margin. */
.memo{
    margin-top:14px;
    padding-top:11px;
    border-top:1px dashed var(--border);
}
.memo-head{
    display:flex;
    flex-wrap:wrap;
    align-items:baseline;
    gap:10px;
    margin-bottom:6px;
}
.memo-h{
    margin:0;
    font-size:.68rem;
    font-weight:700;
    letter-spacing:.09em;
    text-transform:uppercase;
    color:var(--q-accent-ink);
}
.memo-status{font-size:.78rem;color:var(--muted);}
.memo-text{
    display:block;
    width:100%;
    field-sizing:content;
    min-height:4.5em;
    font:inherit;
    /* 1rem, not the report box's .9rem: under 16px, iOS Safari zooms the
       whole page on focus */
    font-size:1rem;
    line-height:1.5;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
    padding:8px 10px;
    resize:vertical;
}
.memo-text:focus{outline:2px solid var(--q-accent-text);outline-offset:1px;}
.memo-count{display:block;margin-top:4px;font-size:.75rem;color:var(--muted);text-align:right;}
.memo-off{margin:0;font-size:.82rem;color:var(--muted);}

/* The tag that says a memo exists. Gone once the memo itself shows, and
   while a paper is being sat, where "you wrote a note here" would cue that
   this question caught you before. */
.tag.has-memo{color:var(--q-accent-ink);border-color:var(--q-accent);}
.q.revealed .tag.has-memo,
#panel-questions[data-mode="test"][data-submitted="false"] .tag.has-memo{display:none;}
/* a search word found in the memo, shown on the tag and the heading the way
   mark.hit shows one in the stem */
.tag.has-memo.memo-hit,.memo-h.memo-hit{
    background:var(--q-accent-soft);
    box-shadow:inset 0 -1px 0 var(--q-accent);
}

/* The note dialog: one lecture's note, read without leaving the question.
   Sized to the note's own column so tables and pathways lay out as they do
   on the block page; the body scrolls, the head stays. */
.notedlg{
    width:min(860px,calc(100vw - 32px));
    max-height:calc(100vh - 48px);
    /* the universal reset in base.css zeroes the margin the browser centres a
       modal dialog with, so it is asked for again here */
    margin:auto;
    padding:0;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--card-bg);
    color:var(--text);
    box-shadow:0 24px 60px rgba(0,0,0,.28);
}
.notedlg[open]{display:flex;flex-direction:column;}
.notedlg::backdrop{background:rgba(20,10,12,.45);}
body.has-dialog{overflow:hidden;}

.notedlg-head{
    display:flex;
    align-items:flex-start;
    gap:14px;
    padding:16px 20px 12px;
    border-bottom:1px solid var(--border);
    flex:none;
}
.notedlg-text{flex:1;min-width:0;}
.notedlg-head h2{
    font-family:var(--serif);
    font-size:1.15rem;
    line-height:1.25;
    margin:2px 0 6px;
    text-wrap:balance;
}
.notedlg-where{
    font-size:.75rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--q-accent-text);
    margin:0;
}
.notedlg-full{font-size:.8rem;color:var(--muted);}
.notedlg-close{
    flex:none;
    width:32px;
    height:32px;
    border:1px solid var(--border);
    border-radius:50%;
    background:var(--card-bg);
    color:var(--muted);
    font-size:1.2rem;
    line-height:1;
    cursor:pointer;
}
.notedlg-close:hover,.notedlg-close:focus-visible{color:var(--q-accent-text);border-color:var(--q-accent);}

.notedlg-body{
    overflow-y:auto;
    padding:18px 20px 24px;
    min-height:0;
}
.notedlg-body .note{border:0;padding:0;margin:0;box-shadow:none;}
/* the dialog's own head already gives the lecture's number and title, so
   only the note's Report button is kept from its head */
.notedlg-body .note-head{justify-content:flex-end;}
.notedlg-body .note-head > :not(.report-q){display:none;}
.notedlg-state{color:var(--muted);margin:0;}

.callout{
    padding:11px 13px;
    margin-top:12px;
    font-size:.86rem;
    line-height:1.55;
    background:var(--bg);
    border:1px solid var(--border);
    border-left:3px solid var(--muted);
    border-radius:0 6px 6px 0;
}

.callout .ct{
    display:block;
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.06em;
    text-transform:uppercase;
    color:var(--muted);
    margin-bottom:5px;
}

.callout p{margin-bottom:8px;}
.callout p:last-child{margin-bottom:0;}
.callout table{border-collapse:collapse;width:100%;font-size:.84rem;}
.callout th,.callout td{border:1px solid var(--border);padding:5px 8px;text-align:left;vertical-align:top;}

.callout.k-warning,.callout.k-bug,.callout.k-red{
    color:var(--q-warn);
    background:var(--q-warn-soft);
    border-color:var(--q-warn);
}
.callout.k-warning .ct,.callout.k-bug .ct,.callout.k-red .ct{color:var(--q-warn);}
/* a reader's report, merged from the pull request the Report button opens:
   warning-coloured, but without the head tag a source error carries */
.callout.k-report{color:var(--q-warn);background:var(--q-warn-soft);border-color:var(--q-warn);}
.callout.k-report .ct{color:var(--q-warn);}

.qfoot{
    display:flex;
    align-items:center;
    gap:10px;
    margin-top:14px;
    padding-top:10px;
    border-top:1px solid var(--border);
}

.qid{
    font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
    font-size:.68rem;
    letter-spacing:.02em;
    color:var(--muted);
}

.qfoot .attempts{margin-right:auto;}

/* the Report control is a link where dialogs are missing, hence the underline reset */
.reset-q,.report-q{
    font:inherit;
    font-size:.72rem;
    color:var(--muted);
    background:none;
    border:none;
    border-bottom:1px dashed var(--muted);
    cursor:pointer;
    padding:0;
    text-decoration:none;
    /* tall enough for a finger: 24px is WCAG 2.5.8's floor */
    min-height:24px;
}

.reset-q:hover{color:var(--q-bad);border-color:var(--q-bad);}
.report-q:hover{color:var(--q-accent);border-color:var(--q-accent);}
/* on a note it sits in the head beside the PDF button, and is not printed */
.note-head .report-q{align-self:center;flex-shrink:0;}
@media print{.note-head .report-q{display:none;}}

/* The report dialog: the note dialog's frame at a form's width. Its
   declarations are its own rather than shared, so the two can drift apart
   without touching each other. */
.reportdlg{
    width:min(560px,calc(100vw - 32px));
    max-height:calc(100vh - 48px);
    margin:auto;
    padding:0;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--card-bg);
    color:var(--text);
    box-shadow:0 24px 60px rgba(0,0,0,.28);
}
.reportdlg[open]{display:flex;flex-direction:column;}
.reportdlg::backdrop{background:rgba(20,10,12,.45);}
.reportdlg-head{
    display:flex;
    align-items:flex-start;
    gap:14px;
    padding:16px 20px 12px;
    border-bottom:1px solid var(--border);
    flex:none;
}
.reportdlg-text{flex:1;min-width:0;}
.reportdlg-head h2{
    font-family:var(--serif);
    font-size:1.15rem;
    line-height:1.25;
    margin:2px 0 0;
}
.reportdlg-where{
    font-size:.75rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--q-accent);
    margin:0;
    overflow-wrap:anywhere;
}
.reportdlg-close{
    flex:none;
    width:32px;
    height:32px;
    border:1px solid var(--border);
    border-radius:50%;
    background:var(--card-bg);
    color:var(--muted);
    font-size:1.2rem;
    line-height:1;
    cursor:pointer;
}
.reportdlg-close:hover,.reportdlg-close:focus-visible{color:var(--q-accent);border-color:var(--q-accent);}
.reportdlg-body{
    overflow-y:auto;
    min-height:0;
    padding:16px 20px 20px;
    display:flex;
    flex-direction:column;
    gap:10px;
}
.reportdlg-body[hidden]{display:none;}
.reportdlg-stem{color:var(--muted);font-size:.86rem;margin:0;}
.reportdlg label{font-size:.8rem;font-weight:600;margin-bottom:-4px;}
.reportdlg select,.reportdlg textarea{
    font:inherit;
    font-size:.9rem;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
    padding:8px 10px;
    width:100%;
}
.reportdlg textarea{min-height:120px;resize:vertical;}
.report-count{font-size:.72rem;color:var(--muted);margin:0;text-align:right;}
.report-public{font-size:.78rem;color:var(--muted);margin:0;}
.report-hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0;}
.reportdlg-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px;}
.report-send{text-decoration:none;}
.report-send[disabled],.report-send[aria-disabled="true"]{opacity:.45;pointer-events:none;}
.report-error{color:var(--q-bad);font-size:.84rem;margin:0;}
.report-result p{margin:0;overflow-wrap:anywhere;}

.empty{padding:60px 20px;text-align:center;color:var(--muted);font-size:.9rem;}

/* a screen tall, so the footer starts below the fold rather than being
   shoved off it when the notes or questions arrive */
.q-loading{min-height:100vh;padding:60px 20px;text-align:center;color:var(--muted);font-size:.9rem;}

/* the block index */
.block-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
    gap:20px;
    margin-bottom:56px;
}

/* The hub's four course cards, fixed two-up so the two years read as two rows
   (FoM + PoM 1, then PoM 2 + T2C) rather than reflowing three-and-one at wide
   widths. Block pages keep the auto-fill grid above, where the count varies. */
.block-grid.hub-grid{grid-template-columns:repeat(2,minmax(0,1fr));}

/* Clinical Skills runs beside both years rather than in either, so on a wide
   screen it is a third column as tall as the two course rows. */
@media (min-width:1000px){
    .block-grid.hub-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
    .block-grid.hub-grid .block-card.is-side{grid-column:3;grid-row:1 / span 2;}
}

@media (max-width:680px){
    .block-grid.hub-grid{grid-template-columns:1fr;}
}

/* Still, under the course cards and as wide as both columns: the one thing
   on the hub that is not a course, so it is a slim row rather than a fifth
   card. It opens Ash's study music player in its own tab (tools/portal.py). */
.still-strip{
    grid-column:1/-1;
    display:flex;
    align-items:center;
    gap:18px;
    padding:18px 22px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
    --hue:var(--western-purple);
    transition:border-color .2s,transform .2s cubic-bezier(.2,.7,.3,1),box-shadow .2s;
}
.still-strip:hover{transform:translateY(-2px);border-color:var(--orchid);box-shadow:var(--shadow);}
.still-mark{
    display:flex;align-items:center;justify-content:center;flex:none;
    width:46px;height:46px;border-radius:12px;
    color:#ffffff;background:var(--hero);
}
.still-mark svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.still-copy{display:block;flex:1;min-width:0;}
.still-copy .bmeta{display:block;margin-bottom:4px;}
.still-h{display:block;font-family:var(--serif);font-size:1.15rem;line-height:1.3;font-weight:600;color:var(--text);margin-bottom:4px;}
.still-p{display:block;font-size:.88rem;line-height:1.55;color:var(--muted);max-width:72ch;}
.still-go{flex:none;font-size:.85rem;font-weight:600;color:var(--western-purple);white-space:nowrap;}
:root[data-theme="dark"] .still-go{color:color-mix(in srgb,var(--orchid) 55%,#ffffff);}

@media (max-width:680px){
    .still-strip{flex-wrap:wrap;align-items:flex-start;gap:12px 16px;padding:18px;}
    .still-mark{width:40px;height:40px;border-radius:10px;}
    .still-go{width:100%;}
}

.block-card{
    display:block;
    padding:24px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
    border-top:3px solid var(--hue);
    transition:border-color .2s,transform .2s cubic-bezier(.2,.7,.3,1),box-shadow .2s;
}

/* a card lifts toward the pointer and casts the theme's soft purple shadow */
.block-card:hover{transform:translateY(-3px);border-color:var(--hue);box-shadow:var(--shadow);}

/* A course with nothing behind it yet. It is a div rather than a link, so it
   cannot be clicked into an empty page, and it is dimmed rather than hidden:
   the hub is meant to show the shape of pre-clerkship, gaps included, the same
   way the notes tab still lists a lecture nobody has written up. */
.block-card.is-empty{
    background:transparent;
    border-style:dashed;
    border-top-style:solid;
    opacity:.62;
}

.block-card.is-empty:hover{transform:none;border-color:var(--border);box-shadow:none;}

.block-card.is-empty .tally span{font-style:italic;}

.block-card .bmeta,
.qbank-card .bmeta,
.still-strip .bmeta{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--hue);
    margin-bottom:10px;
}

.block-card h2{
    font-family:var(--serif);
    font-size:1.3rem;
    font-weight:600;
    margin-bottom:8px;
}

.block-card p{color:var(--muted);font-size:.88rem;line-height:1.55;}

/* both halves carry the same weight - a block is notes and questions, and
   leading with one count made the page read as a quiz */
.tally{
    display:flex;
    flex-wrap:wrap;
    gap:6px 20px;
    margin-top:16px;
    padding-top:14px;
    border-top:1px solid var(--border);
    font-size:.82rem;
    color:var(--muted);
}

.tally b{color:var(--text);font-weight:600;}


.prose{max-width:680px;}
.prose h2{
    font-family:var(--serif);
    font-size:1.6rem;
    font-weight:600;
    margin:44px 0 14px;
}
.prose p{margin-bottom:16px;color:var(--muted);line-height:1.7;}
.prose p strong{color:var(--text);font-weight:600;}
.prose ul{margin:0 0 16px 22px;color:var(--muted);line-height:1.7;}
.prose li{margin-bottom:8px;}
.prose li strong{color:var(--text);font-weight:600;}
/* the syllabus, quoted verbatim - marked as somebody else's words rather than
   folded into the page's own voice */
.prose blockquote{
    margin:0 0 18px;
    padding:2px 0 2px 20px;
    border-left:2px solid var(--q-accent-soft);
}

.prose blockquote p{
    font-size:.95rem;
    line-height:1.65;
    margin-bottom:12px;
}

.prose blockquote p:last-child{margin-bottom:0;}
.prose blockquote strong{color:var(--text);font-weight:600;}

.prose a{color:var(--accent);text-decoration:underline;text-underline-offset:2px;}

.prose code{
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size:.86em;
    padding:1px 5px;
    border-radius:4px;
    background:var(--bg);
    border:1px solid var(--border);
    color:var(--text);
}

/* a prompt to copy whole into Claude Code. Monospace so it reads as something
   to paste rather than something to skim. */
.prose .prompt{
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size:.82rem;
    line-height:1.65;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-left:2px solid var(--q-accent-soft);
    border-radius:6px;
    padding:13px 15px;
    margin:0 0 18px;
}

/* the landing page's folded sections. Same +/- affordance as .howto, but the
   summary is carrying the weight of the h2 it replaced, so it is set in the
   serif at heading size rather than shrunk to a rail note. */
.fold{border-bottom:1px solid var(--border);}
.fold:first-of-type{border-top:1px solid var(--border);}

.fold summary{
    display:flex;
    align-items:baseline;
    gap:16px;
    padding:22px 2px;
    font-family:var(--serif);
    font-size:1.35rem;
    font-weight:600;
    color:var(--text);
    cursor:pointer;
    list-style:none;
    transition:color .15s;
}

.fold summary::-webkit-details-marker{display:none;}
.fold summary:hover{color:var(--accent);}

.fold summary::after{
    content:"+";
    margin-left:auto;
    font-family:var(--sans);
    font-size:1.15rem;
    font-weight:400;
    color:var(--muted);
}

.fold[open] summary::after{content:"\2212";}
.fold[open] summary{color:var(--accent);}

.fold .body{padding:2px 2px 30px;}
.fold .body > :last-child{margin-bottom:0;}

/* the h2 rule above still applies to anything left outside a fold */
.prose > .fold + .fold{margin-top:0;}


/* tabs

   the panels are display:grid, and a UA's [hidden]{display:none} loses to any
   author display rule - so hiding a tab needs the !important below or the two
   panels stack on top of each other */
[hidden]{display:none !important;}

.tabs{
    display:inline-flex;
    gap:2px;
    padding:5px;
    margin-bottom:18px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
}

/* The two real tabs sit in their own tablist inside the strip, so the third,
   which is a link and not a tab, is not a child of it: a tablist may hold only
   tabs, and a screen reader announcing "tab 3 of 3" for something that leaves
   the page is the lie the arrow below avoids saying. */
.tabset{display:flex;gap:2px;}

/* the link's short label, for a phone; the long one stays for a screen reader */
.tab-out .tab-narrow{display:none;}

.tabs button,
.tabs .tab-out{
    display:inline-flex;
    align-items:baseline;
    gap:7px;
    padding:8px 16px;
    font:inherit;
    font-size:.85rem;
    font-weight:500;
    color:var(--muted);
    background:none;
    border:none;
    border-radius:4px;
    cursor:pointer;
    transition:color .15s,background .15s;
}

.tabs button:hover,
.tabs .tab-out:hover{color:var(--text);}

.tabs button[aria-selected="true"]{
    background:var(--q-accent-soft);
    color:var(--q-accent-ink);
    font-weight:600;
}

/* full strength: at .75 the count fell under 4.5:1 on the lighter block washes */
.tabs .tc{font-size:.75rem;font-weight:400;}

/* one note

   a note is a discrimination tool, so the grid is the loudest thing in the
   card and everything else sits quietly around it */
.note{
    padding:22px 24px 18px;
    margin-bottom:16px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:8px;
}

/* The same hand-back the question cards get (see .q), for the same reason: a
   block's notes tab builds every note at once, 10,000 to 14,000 elements, and
   the browser laid all of them out before painting the first. A written note
   is long - 3,400px at the median on a laptop, 5,900px on a phone - so the
   guesses below are those medians, and `auto` swaps in the real height once a
   note has been on screen. The one-line gap and covered rows are cheap and
   left as they are.

   Measured on a 4x-throttled CPU at phone width, navigation to a painted
   notes tab:
     PoM 2 endo   2,180 ms -> 790 ms
     PoM 2 msk    2,520 ms -> 780 ms
     PoM 1 cardio 2,940 ms -> 980 ms
     FoM block 1  1,090 ms -> 560 ms

   goTo() in notes.js already re-aims once a scroll comes to rest, which is
   what lets a jump to a far note land even though the notes in between were
   only estimates when it set off. Print renders everything (below). */
@media screen{
    .note:not(.is-gap):not(.is-covered){
        content-visibility:auto;
        contain-intrinsic-size:auto 3400px;
    }
}
@media screen and (max-width:640px){
    .note:not(.is-gap):not(.is-covered){contain-intrinsic-size:auto 5900px;}
}

.note-head{
    display:flex;
    align-items:baseline;
    gap:10px;
    margin-bottom:4px;
}

.note-num{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.06em;
    color:var(--muted);
    flex-shrink:0;
}

.note-head h4{
    font-family:var(--serif);
    font-size:1.12rem;
    font-weight:600;
}

.note-title{
    font-family:var(--serif);
    font-size:1.3rem;
    font-weight:600;
    color:var(--q-accent-ink);
    margin-bottom:8px;
}

/* the lectures a note also holds: one quiet line under the heading */
.covers{
    font-size:.82rem;
    line-height:1.5;
    color:var(--muted);
    margin:-2px 0 10px;
}
.covers-label{
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.06em;
    text-transform:uppercase;
    margin-right:8px;
}
.covers-sep{margin:0 6px;}
.covers-num{font-weight:600;letter-spacing:.04em;}

/* PDFs pinned to a note: pills under the heading, each opening in a new tab */
.note-pdfs{display:flex;flex-wrap:wrap;gap:6px;margin:-2px 0 10px;}
.note-pdf{
    padding:4px 10px;
    font-size:.78rem;
    font-weight:600;
    color:var(--q-accent-text);
    background:var(--q-accent-soft);
    border:1px solid var(--q-accent);
    border-radius:999px;
    text-decoration:none;
}
.note-pdf::before{content:"PDF \2197  ";font-size:.68rem;letter-spacing:.04em;opacity:.8;}
.note-pdf:hover{text-decoration:underline;}

.framing{
    font-size:.92rem;
    line-height:1.6;
    color:var(--muted);
    margin-bottom:18px;
}

.framing strong{color:var(--text);font-weight:600;}

/* the parts of a note that are not a table: a lead-in above one, a loose
   supporting line, a bullet run */
.tblock{margin-bottom:18px;}

.tlead,.cnote,.clist{
    font-size:.9rem;
    line-height:1.6;
}

.tlead{margin-bottom:8px;}
.cnote,.clist{margin-bottom:16px;}

.tlead p,.cnote p{margin-bottom:6px;}
.tlead p:last-child,.cnote p:last-child{margin-bottom:0;}

.clist ul,.clist ol,.cnote ul,.cnote ol{margin:0 0 0 20px;}
.clist li,.cnote li{margin-bottom:6px;}
.clist p{margin-bottom:6px;}
.clist ul+p,.clist p+ul,.cnote ul+p,.cnote p+ul{margin-top:6px;}

/* A note lifted from a study document keeps that document's own sub-heads, so
   the block needs a heading level inside it. Small and set in the accent, so a
   sub-head reads as a turn in the argument rather than as a second title.
   The hand-cleaned FoM and PoM 1 notes use the same sub-heads in prose blocks. */
.clist h5,.cnote h5{
    font-family:var(--serif);
    font-size:.94rem;
    font-weight:600;
    color:var(--q-accent-ink);
    margin:14px 0 6px 0;
}
.clist h5:first-child,.cnote h5:first-child{margin-top:0;}

.tlead strong,.cnote strong,.clist strong{font-weight:600;}

.note .callout{margin-bottom:18px;}

.wl{color:var(--q-accent-ink);border-bottom:1px dotted var(--border);}

/* a vault $$formula$$, drawn as text by charts_from_vault.py */
.formula{display:block;margin:10px 0;text-align:center;font-size:1.15em;overflow-x:auto;}
.frac{display:inline-flex;flex-direction:column;vertical-align:middle;text-align:center;margin:0 .15em;}
.frac>span{padding:0 .3em;}
.frac>span:first-child{border-bottom:1px solid currentColor;}

/* An answer choice is never a link. A wikilink carried in from the vault note
   would tint one option and leave the rest plain, which reads as the key. */
.opt .wl{color:inherit;border-bottom:0;}

/* the grid, and the smaller companion tables under it */
.ct-wrap{overflow-x:auto;margin-bottom:18px;}

.ct{
    border-collapse:collapse;
    width:100%;
    font-size:.85rem;
    line-height:1.5;
}

.ct th,.ct td{
    border:1px solid var(--border);
    padding:7px 10px;
    text-align:left;
    vertical-align:top;
}

.ct th{
    background:var(--bg);
    font-size:.75rem;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--muted);
    white-space:nowrap;
}

/* A heading long enough to be prose has to wrap, or it sets the column's width
   on its own: one 143-character cell in FoM's ADHD note made the first column
   a few thousand pixels wide, and since the first column is sticky it then sat
   over the whole table while the real content scrolled away off the right.
   notes.js marks any header past a short measure. */
.ct th.wide{white-space:normal;min-width:16em;}

.ct td strong{font-weight:600;color:var(--text);}
.ct td u{text-decoration:none;font-weight:600;color:var(--q-accent-ink);}

/* the row label has to stay readable while a wide grid scrolls under it */
.ct th:first-child,.ct td.rowlab{
    position:sticky;
    left:0;
    background:var(--card-bg);
    font-weight:600;
}

.ct th:first-child{background:var(--bg);}

.micro{margin-bottom:18px;}

.micro .cap{
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
    margin-bottom:7px;
}

/* mermaid draws into here once the library has loaded */
/* a pathway, and the way out of the column

   The diagram is capped at the column width, which is what makes a wide one
   unreadable, so the block carries a button that hands it a whole tab. */
.pwblock{
    position:relative;
    margin:0 0 18px;
}

.pwblock.is-openable .pathway{cursor:zoom-in;}

.pw-open{
    position:absolute;
    right:8px;
    bottom:8px;
    padding:4px 10px;
    font:inherit;
    font-size:.72rem;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
    opacity:.75;
    transition:opacity .15s,color .15s,border-color .15s;
}

.pwblock:hover .pw-open{opacity:1;}
.pw-open:hover{color:var(--q-accent-text);border-color:var(--q-accent);}

.pathway{
    margin:0;
    padding:16px;
    overflow-x:auto;
    text-align:center;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
}

.pathway svg{max-width:100%;height:auto;}

/* a figure, on the same terms as a pathway

   The axis diagrams are the shared mental model the grid below then
   subdivides, so a figure sits in the note like any other block: framed,
   inset against --bg, and with the same way out to a tab of its own. */
.figblock{
    position:relative;
    margin:0 0 18px;
}

.fig{
    margin:0;
    padding:16px;
    text-align:center;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
}

/* height:auto overrides the intrinsic height attribute, which is there to
   reserve the space before the file arrives, not to fix the drawn size */
.fig img{
    max-width:100%;
    /* A figure is read beside the text, not instead of it. Unbounded, a tall
       slide crop filled the screen; 360px keeps it an illustration, and the
       zoom-in click opens it at full size. A width written in the vault
       (![[x.png|900]]) lifts this cap and sizes the figure to that width. */
    max-height:360px;
    width:auto;
    height:auto;
    display:block;
    margin:auto;
}

.figblock.is-diagram .fig img{max-height:none;width:100%;}
.figblock.is-openable .fig img{cursor:zoom-in;}

.fig figcaption{
    margin-top:10px;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

.fig-open{
    position:absolute;
    right:8px;
    bottom:8px;
    padding:4px 10px;
    font:inherit;
    font-size:.72rem;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
    transition:color .15s,border-color .15s;
}

.figblock:hover .fig-open{border-color:var(--muted);}
.fig-live{right:auto;left:8px;text-decoration:none;}
.fig-open:hover{color:var(--q-accent-text);border-color:var(--q-accent);}

.workup{
    font-size:.88rem;
    line-height:1.6;
    margin-bottom:18px;
}

.workup strong{font-weight:600;}

.cline{
    font-size:.88rem;
    line-height:1.6;
    margin-bottom:8px;
}

.cline b{font-weight:600;}

.keypoints{
    margin-top:18px;
    padding:14px 16px;
    background:var(--q-accent-soft);
    border-radius:6px;
    font-size:.88rem;
    line-height:1.6;
    color:var(--q-accent-ink);
}

.keypoints .kt{
    display:block;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    margin-bottom:7px;
}

.keypoints p{margin-bottom:6px;}
.keypoints p:last-child{margin-bottom:0;}
.keypoints strong{font-weight:600;}

/* the way from the end of a note to that lecture's questions in the bank */
.note-qbank{margin:14px 0 0;text-align:right;}
.note-qbank a{
    display:inline-block;
    padding:5px 12px;
    font-size:.82rem;
    font-weight:600;
    color:var(--q-accent-text);
    background:var(--q-accent-soft);
    border:1px solid var(--q-accent);
    border-radius:999px;
    text-decoration:none;
}
.note-qbank a::after{content:" \2192";}
.note-qbank a:hover{text-decoration:underline;}
@media print{.note-qbank{display:none;}}

/* saving to PDF

   a static page has no PDF writer of its own, so this is the browser's print
   dialogue - which is the right tool anyway: it hands back a normal PDF that
   any annotator can mark up */
.pdf-btn{
    padding:4px 10px;
    font:inherit;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.03em;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
    white-space:nowrap;
    transition:color .15s,border-color .15s;
}

.pdf-btn:hover{color:var(--q-accent-text);border-color:var(--q-accent);}

.note-head .spacer{flex:1;}

.weekbar{display:flex;align-items:baseline;gap:12px;}
.weekbar h3,.weekbar h4{flex:1;}

.print-cta{
    width:100%;
    padding:9px 12px;
    font:inherit;
    font-size:.82rem;
    text-align:left;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
    transition:color .15s,border-color .15s;
}

.print-cta:hover:not(:disabled){color:var(--q-accent-text);border-color:var(--q-accent);}
.print-cta:disabled{opacity:.5;cursor:default;}

/* how progress is kept - folded away under the filter bar, because it only
   matters once and the questions matter every time. It sat above the bar until
   the bar itself became the first thing on the panel; a warning that reads once
   should not be what stands between the tab and its filters. The panel is a
   two-track grid, so it has to be told to span both. */
.q-shell > .howto{grid-column:1 / -1;margin-bottom:18px;}

/* It hangs off the bar above it rather than floating between the two, so the
   gap above is closed and the 18px is spent below, against the stream. */
.qbar + .howto{margin-top:-10px;}

/* The third tab leads somewhere rather than opening a panel, so it reads as a
   tab and behaves as a link: same box and baseline as its two neighbours, with
   an arrow saying it leaves the page. Faking a panel it does not have would be
   the worse lie. */
.tab-out::after{
    content:"\2192";
    font-size:.9em;
    opacity:.55;
}

.tab-out:hover::after{opacity:1;}

/* How many of this block's questions are already answered. Hidden at zero:
   before you have started, a nought is noise. */
.tab-out .done{
    padding:2px 7px;
    font-size:.72rem;
    font-weight:600;
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    border-radius:999px;
}

.tab-out .done[hidden]{display:none;}

.howto{
    font-size:.8rem;
    line-height:1.6;
    color:var(--muted);
    border:1px solid var(--q-bad);
    border-radius:6px;
    background:var(--q-bad-soft);
}

/* This is the only warning anywhere that progress lives on one device and
   can be wiped by clearing site data. It reads as an instruction, so it is
   worded as one and carries the portal's existing red rather than a new
   colour invented for the job. */
.howto summary{
    padding:9px 12px;
    font-size:.82rem;
    font-weight:600;
    color:var(--q-bad);
    cursor:pointer;
    list-style:none;
}

.howto summary:hover{text-decoration:underline;text-underline-offset:2px;}

.howto summary::-webkit-details-marker{display:none;}

.howto summary::before{
    content:"+";
    display:inline-block;
    width:14px;
    color:var(--q-bad);
    font-weight:400;
}

.howto[open] summary::before{content:"\2212";}

.howto .body{padding:0 12px 12px;}

/* The buttons sit with the paragraph that explains them, which is where
   they were always described. They are full-width by design - fine in a
   250px rail, absurd across the page - so they get a column of their own. */
.howto .resets{
    max-width:340px;
    margin-top:14px;
    padding-top:13px;
    border-top:1px solid var(--border);
}

.howto .storenote{margin-top:12px;}
.howto p{margin-bottom:9px;}
.howto p:last-child{margin-bottom:0;}
.howto strong{color:var(--text);font-weight:600;}

/* a lecture with no note yet - a visible gap, same as an empty question set */
.note.is-gap{
    display:flex;
    align-items:baseline;
    gap:10px;
    padding:14px 20px;
    background:none;
    border-style:dashed;
}

.note.is-gap .note-head{margin-bottom:0;}
.note.is-gap h4{font-size:1rem;font-weight:500;color:var(--muted);}
.note.is-gap .gapnote{margin-left:auto;font-size:.78rem;color:var(--muted);flex-shrink:0;}

/* a lecture whose material is written up under a neighbouring lecture

   Not a gap: the note exists, it is just filed one heading further down,
   because the upper-year notes chart two or three lectures on one page. A
   dashed box saying "no note yet" sent you looking for something already
   there, so this points at it instead. */
.note.is-covered{
    display:flex;
    align-items:baseline;
    gap:10px;
    padding:14px 20px;
    background:none;
    border-style:dotted;
}

.note.is-covered .note-head{margin-bottom:0;}
.note.is-covered h4{font-size:1rem;font-weight:500;color:var(--muted);}

.note.is-covered .covernote{
    margin-left:auto;
    font-size:.78rem;
    color:var(--muted);
    flex-shrink:0;
}

.coverlink{
    font:inherit;
    color:var(--q-accent-ink);
    background:none;
    text-align:left;
    text-decoration:underline;
    text-underline-offset:3px;
    border:0;
    padding:0;
    cursor:pointer;
}

.coverlink:hover{color:var(--text);}

/* On a phone the title and the pointer do not fit on one line, and the
   pointer would not shrink, so it ran off the right edge (a 375px screen
   scrolled sideways to 620px on FoM block 1). There it drops under the title
   and wraps like text. */
@media (max-width:640px){
    .note.is-gap,.note.is-covered{flex-wrap:wrap;row-gap:4px;}
    .note.is-gap .gapnote,.note.is-covered .covernote{flex-shrink:1;min-width:0;margin-left:0;}
    /* a note's head - number, in-class tag, title, Report and PDF - cannot fit
       one line at 375px, so it wraps and the buttons drop under the title */
    .note-head{flex-wrap:wrap;row-gap:6px;}
    .note-head h4{flex:1 1 8em;min-width:0;overflow-wrap:anywhere;}
    /* "Questions" instead of "Practice questions", so the three tabs fit */
    .tab-out .tab-wide{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;}
    .tab-out .tab-narrow{display:inline;}
}

/* Fingers are bigger than cursors. The small text buttons keep their look but
   get a larger invisible hit area, near the 44px a touch target wants. */
@media (pointer:coarse){
    .reset-q,.report-q,.coverlink{position:relative;}
    .reset-q::after,.report-q::after,.coverlink::after{
        content:"";
        position:absolute;
        inset:-12px -6px;
    }
    .pdf-btn,.fig-open{min-height:32px;}
}


/* where you are in the stream

   The only thing on the portal that floats over content, and so the only fixed
   position in the file: it is the one control that has to stay put while
   several hundred questions scroll past it. Flat like everything else, a solid
   card and a 1px border, no shadow to set it apart. */
/* the last question would otherwise end its scroll underneath the bar */
#panel-questions{padding-bottom:56px;}

.posbar{
    position:fixed;
    left:50%;
    bottom:18px;
    transform:translateX(-50%);
    z-index:20;
    display:flex;
    align-items:center;
    gap:14px;
    width:max-content;
    max-width:min(760px,92vw);
    padding:8px 8px 8px 16px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
}

/* the lecture name is the part that gives, since the count and the way back
   are the parts you cannot guess from the page behind the bar */
.pb-where{
    flex:1;
    min-width:0;
    font-size:.82rem;
    color:var(--text);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.pb-count{
    flex-shrink:0;
    font-size:.75rem;
    font-variant-numeric:tabular-nums;
    color:var(--muted);
    white-space:nowrap;
}

.pb-steps{display:flex;gap:4px;flex-shrink:0;}

.pb-step{
    width:28px;
    height:28px;
    font:inherit;
    font-size:.8rem;
    line-height:1;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:999px;
    cursor:pointer;
    transition:border-color .15s,color .15s;
}

.pb-step:hover:not(:disabled){color:var(--q-accent-text);border-color:var(--q-accent);}
.pb-step:disabled{opacity:.4;cursor:default;}

/* the way back to the top, on both tabs. Wider than the arrows because it
   carries a word - "top" is not a direction anyone should have to infer */
.pb-top{width:auto;padding:0 11px;}

/* the ? on the bar, and the list of keys it opens. Only where there is a
   keyboard: a phone has nothing to press. */
.pb-keys{font-weight:600;}
@media (hover:none),(pointer:coarse){
    .pb-keys{display:none;}
}
.keyhelp{
    position:fixed;
    right:max(18px,calc(50% - 380px));
    bottom:74px;
    z-index:21;
    width:300px;
    padding:14px 16px 12px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:14px;
    box-shadow:0 18px 40px -18px rgba(32,20,54,.45);
}
.keyhelp[hidden]{display:none;}
.keyhelp-h{
    margin:0 0 8px;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}
.keyhelp dl{display:grid;grid-template-columns:auto 1fr;gap:7px 12px;margin:0;align-items:center;}
.keyhelp dt{margin:0;}
.keyhelp dd{margin:0;font-size:.84rem;color:var(--text);}
.keyhelp kbd{
    display:inline-block;
    min-width:24px;
    padding:2px 7px;
    font:600 .76rem/1.4 Inter,system-ui,sans-serif;
    text-align:center;
    color:var(--q-accent-text);
    background:var(--q-accent-soft);
    border:1px solid color-mix(in srgb,var(--q-accent) 35%,transparent);
    border-bottom-width:2px;
    border-radius:6px;
}

/* the notes tab runs the same pill with that one control on it */
.notebar{padding:8px;gap:0;}

/* the one filled control on the bar - it is the whole reason the bar is here */
.pb-mark{
    flex-shrink:0;
    padding:7px 14px;
    font:inherit;
    font-size:.8rem;
    font-weight:600;
    white-space:nowrap;
    color:var(--on-q-accent);
    background:var(--q-accent);
    border:1px solid var(--q-accent);
    border-radius:999px;
    cursor:pointer;
}


/* ---------------------------------------------------------------
   The question toolbar.

   The filters used to live in a 250px rail down the left. They get
   touched twice a session and cost the stream a quarter of its width
   the whole time - and the stems here run to five clinical vignettes,
   which is the difference between an option on one line and on four.
   Four dropdowns put the same facets in a strip and give the width
   back.

   The applied-chip row underneath is not decoration. A closed dropdown
   hides its count, so without the chips a filtered view can look
   unfiltered - the one failure the rail never had, and the reason the
   chips are the condition on the whole change rather than a nicety.

   The notes tab keeps its rail: its lecture index IS the navigation,
   so it is doing a different job there.
   --------------------------------------------------------------- */
.q-flow{
    grid-template-columns:1fr;
    gap:0;
}

/* Filters and the two segments were stacked rows with a rule between them,
   costing about 65px of a screen that did not have it. They are one wrapping
   flex row now, so the segments sit beside the dropdowns wherever there is
   room and drop to their own line where there is not - at 1366 they wrap, on
   a wide monitor they do not. The rule between them is gone either way: it
   was drawing a boundary that is no longer always there. */
.qbar{
    display:flex;
    flex-wrap:wrap;
    align-items:flex-end;
    gap:10px 14px;
    padding:12px 14px;
    margin-bottom:18px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:9px;
}

.qbar-filters{
    display:flex;
    flex-wrap:wrap;
    gap:9px;
    align-items:flex-end;
    flex:1 1 100%;
    min-width:0;
}

.qsel{
    display:grid;
    gap:4px;
    flex:1 1 168px;
    min-width:0;
}

.qsel > span{
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

.qsel[hidden]{display:none;}

/* The search facet borrows the notes tab's box and is sized to sit level with
   the dropdowns beside it; a query is usually where narrowing starts, so it
   gets the first slot and a little more room than a facet with a caret. */
.qsearch{flex:1.4 1 200px;}
.qsearch .notesearch input{background:var(--bg);font-size:.86rem;line-height:1.3;}

/* Each facet is a button over a panel of checkboxes, not a <select>: weeks 1
   AND 2 is a real request and a select can only answer one of them. A native
   <select multiple> can, but it is a permanently-open scrolling list box that
   wants ctrl-click, which would cost the toolbar the height the toolbar was
   built to win back.

   So the closed button is styled to be the select it replaced - same box,
   same count after the middot - and the change only shows up on opening it. */
.msel{position:relative;min-width:0;}

.msel-btn{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    width:100%;
    padding:7px 9px;
    font:inherit;
    font-size:.86rem;
    line-height:1.3;
    text-align:left;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
}

.msel-btn:hover,
.msel-btn[aria-expanded="true"]{border-color:var(--q-accent);}
.msel-val{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.msel-caret{flex:0 0 auto;font-size:.66rem;color:var(--muted);}

/* Absolutely placed, so opening a panel never reflows the bar and shoves the
   stream down the page; capped and scrollable, because a twelve-week block
   would otherwise run off the bottom of the screen. */
.msel-pop{
    position:absolute;
    z-index:40;
    top:calc(100% + 5px);
    left:0;
    right:0;
    min-width:205px;
    max-height:290px;
    overflow-y:auto;
    display:grid;
    gap:1px;
    padding:5px;
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:7px;
    box-shadow:0 12px 28px rgba(0,0,0,.16);
}

.msel-pop[hidden]{display:none;}

.msel-opt{
    display:flex;
    align-items:center;
    gap:9px;
    width:100%;
    padding:7px 9px;
    font:inherit;
    font-size:.84rem;
    text-align:left;
    color:var(--text);
    background:none;
    border:0;
    border-radius:5px;
    cursor:pointer;
}

.msel-opt:hover{background:var(--q-accent-soft);}
.msel-opt .t{flex:1 1 auto;min-width:0;}

.msel-opt .n{
    flex:0 0 auto;
    font-size:.75rem;
    color:var(--muted);
    font-variant-numeric:tabular-nums;
}

.msel-opt input{
    flex:0 0 auto;
    width:15px;
    height:15px;
    margin:0;
    accent-color:var(--q-accent);
    cursor:pointer;
}

.msel-opt[data-on="1"]{
    color:var(--q-accent-ink);
    font-weight:600;
    background:var(--q-accent-soft);
}

.msel-opt[data-on="1"] .n{color:var(--q-accent-ink);}

/* an option worth nothing stays readable and stops being clickable */
.msel-opt[data-off="1"]{color:var(--muted);opacity:.5;cursor:default;}
.msel-opt[data-off="1"]:hover{background:none;}

/* The clear row. Nothing ticked already means everything, so this is a button
   that unticks, not a fifth checkbox - and it indents to the same text column
   as the rows below so the list still reads as one column of names. */
.msel-any{
    padding-left:33px;
    margin-bottom:3px;
    border-bottom:1px solid var(--border);
    border-radius:5px 5px 0 0;
}

/* View and Mode: two framed segments rather than four loose buttons,
   because each is one decision and the label inside the frame says
   which decision it is. */
.qbar-modes{
    display:flex;
    flex-wrap:wrap;
    gap:8px 18px;
    align-items:center;
    flex:0 1 auto;
}

/* View and Mode caption their controls the same way the filters do, so the
   whole bar reads as one row of labelled fields rather than two dropdowns
   and a pair of unexplained button pairs. */
.qseg-field{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
}

.qseg-field > span{
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

.qseg{
    display:flex;
    align-items:center;
    gap:3px;
    padding:3px;
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:7px;
}

.qseg button{
    padding:6px 11px;
    font:inherit;
    font-size:.81rem;
    line-height:1.25;
    font-weight:500;
    color:var(--muted);
    background:none;
    border:0;
    border-radius:5px;
    cursor:pointer;
    white-space:nowrap;
    transition:color .15s,background .15s;
}

.qseg button:hover{color:var(--text);}

.qseg button[aria-pressed="true"]{
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    font-weight:600;
}

/* the applied row lives inside the bar, under everything else, because
   it is the one thing here that has to survive a glance */
.qbar .applied{
    flex:1 1 100%;
    padding-top:11px;
    padding-bottom:0;
    border-top:1px solid var(--border);
    border-bottom:0;
}

/* ---- matching, as dropdown pairing ---- */
/* These used to render as a stem, the word "(matching)", and three self-mark
   buttons - the pairings themselves only appeared once you gave up and hit
   Show answer. The grid below IS the question: one row per item, one select
   per row, marked on Check like any other answer. */
.pairing{
    display:grid;
    gap:6px;
    margin:16px 0 4px;
}

.pair-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);
    gap:14px;
    align-items:center;
    padding:9px 12px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--card-bg);
}

.pair-row .pl{font-size:.93rem;line-height:1.45;}

.pair-row .pr{
    display:flex;
    flex-direction:column;
    gap:4px;
    min-width:0;
}

.pair-head{
    background:transparent;
    border:0;
    padding:0 12px 2px;
}

.pair-head .pl,.pair-head .pr{
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

select.ps{
    width:100%;
    padding:7px 9px;
    font:inherit;
    font-size:.88rem;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
}

select.ps:hover:not(:disabled){border-color:var(--q-accent);}
select.ps:disabled{cursor:default;opacity:1;}

.pmark{font-size:.78rem;line-height:1.4;}
.pmark:empty{display:none;}

.pair-row[data-mark="hit"]{border-color:var(--q-ok);background:var(--q-ok-soft);}
.pair-row[data-mark="hit"] .pmark{color:var(--q-ok);font-weight:600;}
.pair-row[data-mark="hit"] select.ps{border-color:var(--q-ok);}

.pair-row[data-mark="miss"]{border-color:var(--q-bad);background:var(--q-bad-soft);}
.pair-row[data-mark="miss"] .pmark{color:var(--q-bad);font-weight:600;}
.pair-row[data-mark="miss"] select.ps{border-color:var(--q-bad);}

/* a phone cannot hold two columns of clinical text side by side */
@media (max-width:620px){
    .pair-row{grid-template-columns:1fr;gap:7px;}
    .pair-head{display:none;}
    /* on a phone the dialog is the screen */
    .notedlg{width:100vw;max-width:100vw;height:100vh;max-height:100vh;margin:0;border:0;border-radius:0;}
    .reportdlg{width:100vw;max-width:100vw;height:100vh;max-height:100vh;margin:0;border:0;border-radius:0;}
}

/* ---- the sat block ---- */
.testbar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:12px;
    padding:13px 16px;
    margin-bottom:24px;
    font-size:.87rem;
    color:var(--q-warn);
    background:var(--q-warn-soft);
    border:1px solid var(--q-warn);
    border-radius:9px;
}

.testbar[hidden]{display:none;}
.testbar b{font-weight:600;}

/* A block shrunk to fit the pool has to say so here, beside the count.
   Clamping silently reads as a broken control. */
.testbar .tb-note{flex-basis:100%;font-size:.8rem;font-style:italic;opacity:.9;}

.tb-time{display:flex;align-items:center;gap:8px;margin-left:auto;}
.tb-time label{font-size:.83rem;font-weight:600;white-space:nowrap;}

.tb-time input{
    width:92px;
    padding:6px 9px;
    font:inherit;
    font-size:.87rem;
    font-weight:600;
    color:var(--q-warn);
    background:var(--card-bg);
    border:1px solid var(--q-warn);
    border-radius:5px;
    font-variant-numeric:tabular-nums;
}

/* The placeholder carries the default - an empty field is "no limit" - so it
   has to read as a value rather than as a hint fading into the border. */
.tb-time input::placeholder{color:var(--q-warn);opacity:.72;font-weight:500;}

.tb-unit{font-size:.83rem;font-weight:600;opacity:.85;margin-left:-3px;}

/* Tabular figures, or the whole bar shifts sideways once a second. */
.tb-clock{
    padding:5px 11px;
    font-size:1rem;
    font-weight:600;
    font-variant-numeric:tabular-nums;
    color:var(--q-warn);
    background:var(--card-bg);
    border:1px solid var(--q-warn);
    border-radius:5px;
}

.tb-clock[data-low="1"]{color:var(--on-q-mark);background:var(--q-warn);}

.tb-size{display:flex;align-items:center;gap:8px;}
.tb-size label{font-size:.83rem;font-weight:600;white-space:nowrap;}

.tb-size input{
    width:76px;
    padding:6px 9px;
    font:inherit;
    font-size:.87rem;
    font-weight:600;
    color:var(--q-warn);
    background:var(--card-bg);
    border:1px solid var(--q-warn);
    border-radius:5px;
    font-variant-numeric:tabular-nums;
}

.tb-btn{
    padding:8px 15px;
    font:inherit;
    font-size:.85rem;
    font-weight:600;
    color:var(--on-q-accent);
    background:var(--q-accent);
    border:1px solid var(--q-accent);
    border-radius:6px;
    cursor:pointer;
}

.tb-btn.ghost{
    color:var(--q-warn);
    background:transparent;
    border-color:var(--q-warn);
    font-weight:500;
}

/* the one number a sat block exists to produce */
.tb-result{
    display:grid;
    gap:9px;
    padding:18px 20px;
    margin-bottom:24px;
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    border:1px solid var(--q-accent);
    border-radius:10px;
}

.tb-result[hidden]{display:none;}

.tb-result h3{
    margin:0;
    font-family:var(--serif);
    font-size:1.25rem;
    font-weight:600;
}

.tb-result .big{
    font-family:var(--serif);
    font-size:2.2rem;
    font-weight:600;
    line-height:1;
    font-variant-numeric:tabular-nums;
}

.tb-result p{font-size:.9rem;line-height:1.6;}
.tb-result ul{margin:0;padding-left:18px;font-size:.87rem;line-height:1.6;}

.tb-cut{
    margin-top:12px;
    margin-bottom:4px;
    font-size:.7rem;
    font-weight:600;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--muted);
}

/* ---- one at a time ---- */
/* The stream already builds every question into the DOM once and filters
   by hiding them. Paging is that same trick with a narrower predicate,
   so progress, stars, the keyboard steps and the resume point all keep
   working without a second render path to maintain. */
.q-flow[data-view="paged"] .fam-head,
.q-flow[data-view="paged"] .fam-empty,
.q-flow[data-view="paged"] .fam-gap,
.q-flow[data-view="paged"] .blockbar,
.q-flow[data-view="paged"] .weekbar{display:none;}

/* One card on screen, so every margin meant to separate it from its
   neighbours is dead space you have to scroll past to reach the pager.
   The section, the lecture heading and the card itself all collapse. */
.q-flow[data-view="paged"] .family{margin-bottom:0;}
.q-flow[data-view="paged"] .blockgroup{margin-bottom:0;}
.q-flow[data-view="paged"] .lecbar{margin:0 0 10px;}
.q-flow[data-view="paged"] .q{margin-bottom:0;}
.q-flow[data-view="paged"] .stream{margin-bottom:0;}

/* in a sat block the lecture name hands you the topic, so it waits for
   the submit along with the answers */
.q-flow[data-mode="test"][data-submitted="false"] .lecbar{display:none;}

.pagebar{
    display:flex;
    align-items:center;
    gap:12px;
    padding-top:14px;
    margin-top:16px;
    border-top:1px solid var(--border);
}

.pagebar[hidden]{display:none;}

.pagebar .pg-pos{
    margin-inline:auto;
    font-size:.85rem;
    color:var(--muted);
    font-variant-numeric:tabular-nums;
}

.pg-btn{
    padding:8px 15px;
    font:inherit;
    font-size:.85rem;
    font-weight:500;
    color:var(--muted);
    background:var(--card-bg);
    border:1px solid var(--border);
    border-radius:6px;
    cursor:pointer;
}

.pg-btn:hover:not(:disabled){color:var(--text);border-color:var(--muted);}
.pg-btn:disabled{opacity:.45;cursor:default;}

.pg-btn.primary{
    color:var(--on-q-accent);
    background:var(--q-accent);
    border-color:var(--q-accent);
    font-weight:600;
}

@media (max-width:960px){
    .q-shell{grid-template-columns:1fr;gap:32px;}
    /* not sticky any more, so it scrolls with the page and must not be capped */
    .rail{position:static;max-height:none;overflow:visible;}

    /* the rail now sits on top of the stream instead of following it, so the
       index is capped harder - about eight lectures, then it scrolls */
    .lecindex{max-height:230px;}
    .q-masthead{align-items:flex-start;gap:24px;}
    .scoreboard{gap:22px;flex-wrap:wrap;}
    .tabs{width:100%;}
    .tabset{flex:2 1 0;min-width:0;}
    .tabs button,
    .tabs .tab-out{flex:1 1 0;min-width:0;justify-content:center;}

    /* The phone filter accordion used to live here: below 960px the rail
       stopped being sticky and sat on top of the stream, sixteen controls
       deep, so it folded behind a button. The toolbar needs none of that -
       it is four dropdowns that wrap - so that second filter UI is gone. */
    .qbar-filters{flex-basis:100%;}
    .qbar-filters .qsel{flex-basis:100%;}
    .qbar-modes{gap:10px;flex:1 1 100%;}
    .qseg-field{flex:1 1 100%;}
    .qseg{justify-content:center;}
    .qseg button{flex:1;}
}

@media (max-width:560px){
    .score b{font-size:1.4rem;}
    /* no room for the lecture name; the count and the way back still fit */
    .pb-where{display:none;}
    .posbar{gap:10px;padding:8px;}
    .q{padding:16px 16px 12px 20px;}
    .note{padding:16px 16px 14px;}
}

@media (prefers-reduced-motion:reduce){
    *{transition:none !important;animation:none !important;}
}

/* a note is a one-pager by design, so printing gives one per sheet and drops
   every control - the gaps go too, they are screen bookkeeping */
@media print{
    .uplink,.blocknav,.tabs,.rail,.qbar,.testbar,.pagebar,.scoreboard,.storenote,footer,.pdf-btn,.pw-open,.fig-open,.posbar,.keyhelp,.deck-dl{display:none !important;}

    /* one note, one week, or the lot: whatever was marked survives the print
       and everything else steps out of the way */
    body[data-printing] .note:not(.print-me),
    body[data-printing] .weekbar:not(.print-me){display:none !important;}
    body[data-printing] .weekbar.print-me{display:block;}
    .q-shell{display:block;}
    .pom2-page{width:100%;padding:0;}
    .q-masthead{margin-bottom:20px;padding-bottom:12px;}
    .note{border:none;padding:0;margin:0;break-after:page;page-break-after:always;}
    .note:last-child{break-after:auto;page-break-after:auto;}
    .note.is-gap,.note.is-covered{display:none !important;}
    .ct-wrap{overflow:visible;}
    .ct{font-size:8.5pt;}
    .pathway{border:none;background:none;padding:0;}
    .fig{border:none;background:none;padding:0;}
    /* a note prints one to a sheet, so a tall figure must not push the
       chart under it onto a second page */
    .fig img{max-height:9cm;width:auto;}
    a{color:inherit;text-decoration:none;}
    .note{background:none;}

    /* A big chart (portal.js marks it) gets a page to itself, turned sideways
       when it is wider than tall, and is scaled to fill that page: squeezed in
       beside the note its text printed at about 5pt. The heights fit both
       Letter and A4 inside the 10mm margins. */
    .figblock.is-big{page:chart-tall;break-before:page;break-after:page;margin:0;}
    .figblock.is-big.is-wide{page:chart-wide;}
    .figblock.is-big .fig img{width:auto;max-width:100%;}
    .figblock.is-big.is-wide .fig img{max-height:185mm;}
    .figblock.is-big.is-tall .fig img{max-height:250mm;}
}
@page chart-wide{size:landscape;margin:10mm;}
@page chart-tall{size:portrait;margin:10mm;}

/* the one-line description under a set's heading, for the sets portal.py flags */
.fam-head p.fam-blurb{max-width:660px;color:var(--muted);font-size:.9rem;line-height:1.6;}

/* ---------------------------------------------------------------
   Your weak spots: the panel under the filter bar that reads the
   progress store back as lectures to revisit, recent work and a map of
   every lecture. Folded like the howto beneath it, in the block's own
   accent rather than the warning red, because it is a tool, not a
   caution. Gone while a paper is sat, where a running score would be
   a distraction, and from print.
   --------------------------------------------------------------- */
.insights{
    margin:0 0 14px;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--card-bg);
}

.q-flow[data-mode="test"] .insights{display:none;}

.ins-sum{
    display:flex;
    flex-wrap:wrap;
    align-items:baseline;
    gap:4px 12px;
    padding:11px 14px;
    cursor:pointer;
    list-style:none;
}

.ins-sum::-webkit-details-marker{display:none;}

.ins-sum::before{
    content:"+";
    width:12px;
    color:var(--q-accent-text);
    font-weight:400;
}

.insights[open] .ins-sum::before{content:"\2212";}

.ins-title{
    font-size:.86rem;
    font-weight:600;
    color:var(--q-accent-text);
}

.ins-sum:hover .ins-title{text-decoration:underline;text-underline-offset:2px;}

.ins-line{
    font-size:.8rem;
    color:var(--muted);
}

.ins-body{
    display:grid;
    gap:14px;
    padding:0 14px 14px;
}

.ins-top{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:14px;
}

.ins-card{
    min-width:0;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--bg);
}

.ins-h{
    margin-bottom:8px;
    font-size:.72rem;
    font-weight:600;
    letter-spacing:.07em;
    text-transform:uppercase;
    color:var(--muted);
}

.ins-empty{
    font-size:.82rem;
    line-height:1.5;
    color:var(--muted);
}

.ins-nums{
    margin-bottom:8px;
    font-size:.82rem;
    color:var(--muted);
}

.ins-nums b{
    font-family:var(--serif);
    font-size:1.15rem;
    font-weight:600;
    color:var(--text);
}

/* the review queue line */
.ins-queue{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:8px 14px;
    padding:10px 14px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--bg);
}

.ins-queue.has-due{border-color:var(--q-accent-text);}

.ins-qtxt{
    flex:1 1 260px;
    font-size:.84rem;
    line-height:1.5;
    color:var(--muted);
}

.ins-qtxt b{
    font-family:var(--serif);
    font-size:1.15rem;
    font-weight:600;
    color:var(--text);
}

/* review next */
.ins-list{
    display:grid;
    gap:8px;
    list-style:none;
}

.ins-list li{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:6px 10px;
}

.ins-txt{display:grid;min-width:0;flex:1 1 180px;}

.ins-lec{
    font-size:.84rem;
    font-weight:600;
    line-height:1.3;
    overflow-wrap:anywhere;
}

.ins-meta{
    font-size:.74rem;
    color:var(--muted);
    font-variant-numeric:tabular-nums;
}

.ins-acts{display:flex;gap:6px;flex-shrink:0;}

.ins-go{
    padding:5px 10px;
    font:inherit;
    font-size:.74rem;
    font-weight:600;
    color:#fff;
    background:var(--q-accent);
    border:1px solid var(--q-accent);
    border-radius:6px;
    cursor:pointer;
    min-height:32px;
}

.ins-go.is-quiet{
    color:var(--q-accent-text);
    background:transparent;
    border-color:var(--border);
}

.ins-go:hover{filter:brightness(1.08);}
.ins-go.is-quiet:hover{border-color:var(--q-accent-text);filter:none;}

/* the activity bars */
.ins-bars{display:block;width:100%;height:auto;}
.ins-bars .ins-axis{stroke:var(--border);stroke-width:1;}
.ins-bars .ins-right{fill:var(--q-ok);}
.ins-bars .ins-wrong{fill:var(--q-bad);}
.ins-bars .ins-tick{fill:var(--muted);font-size:11px;font-family:var(--sans);}

.ins-key{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:4px 6px;
    margin:6px 0 0;
    font-size:.72rem;
    color:var(--muted);
}

.ins-heat .ins-key{margin:0 0 10px;}

.sw{
    display:inline-block;
    width:11px;
    height:11px;
    border-radius:3px;
    vertical-align:-1px;
}

.sw-right{background:var(--q-ok);}
.sw-wrong{background:var(--q-bad);}

/* the lecture map: a row per week, a square per lecture */
.ins-grid{display:grid;gap:5px;}

.ins-blk{
    margin:8px 0 2px;
    font-size:.74rem;
    font-weight:600;
    color:var(--text);
}

.ins-blk:first-child{margin-top:0;}

.ins-row{
    display:flex;
    align-items:flex-start;
    gap:10px;
}

.ins-wk{
    flex:0 0 46px;
    padding-top:7px;
    white-space:nowrap;
    font-size:.72rem;
    font-weight:600;
    color:var(--muted);
    font-variant-numeric:tabular-nums;
}

.ins-cells{display:flex;flex-wrap:wrap;gap:5px;}

.ins-cell{
    width:34px;
    height:30px;
    padding:0;
    font:inherit;
    font-size:.7rem;
    font-weight:600;
    font-variant-numeric:tabular-nums;
    border-radius:5px;
    border:1px solid transparent;
    cursor:pointer;
}

.ins-cell:hover{outline:2px solid var(--q-accent-text);outline-offset:1px;}

.ins-cell.is-good,.sw.is-good{background:var(--q-ok);color:var(--bg);}
.ins-cell.is-mid,.sw.is-mid{background:var(--q-star-soft);color:var(--q-star);border-color:var(--q-star);}
.ins-cell.is-bad,.sw.is-bad{background:var(--q-bad);color:var(--bg);}
.ins-cell.is-unseen,.sw.is-unseen{background:transparent;color:var(--muted);border-color:var(--border);}
.sw.is-unseen{border:1px solid var(--muted);}

@media (max-width:600px){
    .ins-wk{flex-basis:42px;}
    .ins-cell{width:32px;height:32px;}
    .ins-body{padding:0 10px 10px;}
    .ins-card{padding:10px;}
}

@media print{
    .insights{display:none !important;}
}

/* ---------- the landing page's search of the whole portal (search.js) ---------- */

.hub-search{margin:0 0 24px;}
/* the placeholder says what the box is; the label stays for screen readers */
.hs-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
.hub-search input[type="search"]{
    width:100%;
    padding:11px 14px;
    font:inherit;
    font-size:1rem;
    color:var(--text);
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:8px;
}
.hub-search input[type="search"]:focus{border-color:var(--q-accent);outline:none;box-shadow:0 0 0 3px var(--q-accent-soft);}
.hs-filters{display:flex;flex-wrap:wrap;align-items:flex-start;gap:14px 26px;margin-top:16px;}
.hs-group[hidden]{display:none;}
.hs-group .panel-h{margin-bottom:6px;}
.hs-group .chip[hidden]{display:none;}
.hs-reset{
    align-self:flex-end;
    padding:6px 0;
    font:inherit;
    font-size:.8rem;
    color:var(--q-accent-text);
    background:none;
    border:0;
    text-decoration:underline;
    cursor:pointer;
}
.hs-reset[hidden]{display:none;}
.hs-count{margin:14px 0 0;color:var(--muted);font-size:.85rem;}
.hs-count:empty{display:none;}
.hs-results{list-style:none;margin:10px 0 0;padding:0;}
.hs-hit + .hs-hit{border-top:1px solid var(--border);}
.hs-hit a{display:block;padding:11px 4px;color:var(--text);text-decoration:none;}
.hs-hit a:hover .hs-title{color:var(--q-accent-text);text-decoration:underline;}
.hs-meta{display:block;font-size:.75rem;color:var(--muted);margin-bottom:3px;}
.hs-src{
    display:inline-block;
    padding:1px 7px;
    margin-right:4px;
    font-size:.68rem;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--q-accent-ink);
    background:var(--q-accent-soft);
    border-radius:999px;
}
.hs-title{display:block;font-weight:600;line-height:1.35;}
.hs-snip{display:block;margin-top:3px;font-size:.86rem;line-height:1.5;color:var(--muted);overflow-wrap:anywhere;}
.hs-hit mark{background:var(--q-accent-soft);color:inherit;padding:0 1px;border-radius:2px;}
.hs-more{margin-top:12px;text-align:center;}
.hs-more[hidden]{display:none;}

/* the question a link from the landing page's search landed on */
.q.is-linked{box-shadow:0 0 0 2px var(--q-accent);}

/* "Save every note as one PDF", in the corner of the notes' heading */
.fam-title{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px 14px;}
.fam-title h2{flex:1;}
