/* Certificate CBT: exam page (/cbt/<exam>/) and reading page (/cbt/<exam>/<key>/).
   Neutral surfaces, one filled action per page, everything else grey or outlined. */
.cx {
    max-width: 1080px;
    margin: 0 auto;
    padding: 8px 0 56px;
    color: var(--wq-text, #e8edf3);
    line-height: 1.6;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
.cx [hidden] { display: none !important; }
.cx :where(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
.cx :where(ul, ol) { list-style: none; }
html.dark .cx a { color: inherit; text-decoration: none; }
.cx :is(a, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--wq-accent, #4da3f7); outline-offset: 2px; }
.cx section { margin-top: 44px; scroll-margin-top: 84px; }
.cx-small { color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; line-height: 1.6; }
.cx-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 20px; margin-bottom: 14px; }
.cx-head h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }

.cx-crumb { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: .875rem; color: var(--wq-text-muted, #a8b5c5); }
.cx-crumb > * { display: inline-flex; align-items: center; min-height: 32px; }
.cx-crumb [aria-current] { color: var(--wq-text-soft, #c9d3df); }

html.dark .cx a.cx-btn, .cx button.cx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 18px;
    border: 1px solid var(--wq-border-strong, #516983);
    border-radius: 10px;
    background: transparent;
    color: var(--wq-text, #e8edf3);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}
html.dark .cx a.cx-btn--solid, .cx button.cx-btn--solid { border-color: transparent; background: var(--wq-surface-3, #333e4b); }
html.dark .cx a.cx-btn--primary { border-color: var(--wq-primary, #2873dc); background: var(--wq-primary, #2873dc); color: #fff; }

/* Exam header */
.cx-hero { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px 48px; align-items: start; margin-top: 18px; padding-bottom: 36px; border-bottom: 1px solid var(--wq-border, #374351); }
.cx-hero__main { display: grid; gap: 16px; padding-top: 6px; }
.cx-hero__title { display: flex; align-items: center; gap: 18px; }
.cx-hero h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.28; letter-spacing: -.035em; text-wrap: balance; }
.cx-hero__summary { max-width: 44ch; color: var(--wq-text-soft, #c9d3df); font-size: 1.02rem; line-height: 1.7; text-wrap: pretty; }
.cx-hero h1 span { display: inline-block; }
.cx-nowrap { white-space: nowrap; }
.cx-facts { display: flex; flex-wrap: wrap; gap: 12px 0; padding: 4px 0 !important; }
.cx-facts > div { padding-inline: 22px; border-left: 1px solid var(--wq-border, #374351); }
.cx-facts > div:first-child { padding-left: 0; border-left: 0; }
.cx-facts dt { color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; }
.cx-facts dd { font-size: 1.2rem; font-weight: 700; line-height: 1.4; letter-spacing: -.02em; }
.cx-hero__meta { color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; }
.cx-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
html.dark .cx .cx-hero__actions a.cx-btn { min-height: 50px; padding-inline: 22px; font-size: 1rem; }

.cx section.cx-info { margin: 0; padding: 18px 20px; border: 1px solid var(--wq-border, #374351); border-radius: 14px; background: var(--wq-surface, #20262e); }
.cx-info h2 { margin-bottom: 8px; font-size: 1rem; font-weight: 700; }
.cx-info__table { display: table; width: 100%; border-collapse: collapse; font-size: .92rem; overflow: visible; background: none; }
html.dark .cx .cx-info__table :is(th, td) { padding: 9px 0; border: 0; border-top: 1px solid var(--wq-border, #374351); background: transparent !important; color: var(--wq-text-soft, #c9d3df); text-align: left; vertical-align: top; font-weight: 400; line-height: 1.55; }
html.dark .cx .cx-info__table thead th { padding: 6px 0; border-top: 0; color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; }
html.dark .cx .cx-info__table tbody th { width: 62px; padding-right: 12px; color: var(--wq-text, #e8edf3); font-weight: 600; white-space: nowrap; }
html.dark .cx .cx-info__table :is(th, td):last-child { padding-left: 14px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
html.dark .cx .cx-info__table tfoot :is(th, td) { color: var(--wq-text, #e8edf3); font-weight: 700; }
.cx-info__subject { display: block; }
.cx-info__subject small { color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; white-space: nowrap; }
html.dark .cx .cx-info__table--mock :is(th, td):nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
html.dark .cx .cx-info__table--mock tbody th { width: auto; }
.cx-info .cx-small { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--wq-border, #374351); }

/* Resume and my progress */
.cx section.cx-resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 24px; padding: 16px 20px; border: 1px solid var(--wq-border-strong, #516983); border-left: 4px solid var(--wq-accent, #4da3f7); border-radius: 12px; background: var(--wq-surface, #20262e); }
.cx-resume h2 { font-size: 1rem; }
.cx-resume p { margin-top: 2px; color: var(--wq-text-soft, #c9d3df); font-size: .92rem; font-variant-numeric: tabular-nums; }
.cx-progress__card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 28px; align-items: center; padding: 20px; border: 1px solid var(--wq-border, #374351); border-radius: 14px; background: var(--wq-surface, #20262e); }
.cx-stats { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); justify-content: start; gap: 12px 44px; }
.cx-stats dt { color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; }
.cx-stats dd { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.cx-stats dd small { margin-left: 3px; color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; font-weight: 500; letter-spacing: 0; }
.cx-bars { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px 32px; padding-top: 18px !important; border-top: 1px solid var(--wq-border, #374351); }
.cx-bars:empty { display: none; }
.cx-bars__row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.cx-bars__row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cx-bars__row span { flex: 0 0 auto; color: var(--wq-text-muted, #a8b5c5); font-variant-numeric: tabular-nums; }
.cx-bars__track { height: 6px; margin-top: 7px; border-radius: 3px; background: var(--wq-surface-3, #333e4b); overflow: hidden; }
.cx-bars__track span { display: block; height: 100%; background: #35a56f; }
.cx-bars__track span.is-weak { background: #d9814a; }

/* Papers by year */
.cx-rounds { border: 1px solid var(--wq-border, #374351); border-radius: 14px; background: var(--wq-surface, #20262e); }
.cx-rounds li { display: grid; grid-template-columns: 190px 150px minmax(0, 1fr) auto; align-items: center; gap: 8px 20px; padding: 14px 20px; }
.cx-rounds li + li { border-top: 1px solid var(--wq-border, #374351); }
.cx-rounds__name { display: flex; align-items: baseline; gap: 8px; }
.cx-rounds__name strong { font-size: 1.12rem; font-weight: 700; letter-spacing: -.02em; }
.cx-rounds__name span, .cx-rounds__meta { color: var(--wq-text-soft, #c9d3df); font-size: .92rem; font-variant-numeric: tabular-nums; }
.cx-rounds__last { color: var(--wq-text-dim, #91a0b2); font-size: .9rem; }
.cx-rounds__last.is-set { color: var(--wq-text, #e8edf3); font-weight: 600; }
.cx-rounds__last em { font-style: normal; }
.cx-rounds__last em.is-pass { color: #57c48e; }
.cx-rounds__last em.is-fail { color: #f0877d; }
.cx-rounds__actions { display: grid; grid-template-columns: 116px 116px; gap: 8px; }
html.dark .cx .cx-rounds__actions a.cx-btn { padding-inline: 8px; }

/* Subject by year */
.cx-matrix { display: table; width: 100%; border: 1px solid var(--wq-border, #374351); border-radius: 14px; border-spacing: 0; border-collapse: separate; background: var(--wq-surface, #20262e); overflow: hidden; }
html.dark .cx .cx-matrix :is(th, td) { border: 0; background: transparent !important; color: inherit; text-align: left; vertical-align: middle; font-weight: 400; }
html.dark .cx .cx-matrix thead th { padding: 12px 20px; color: var(--wq-text-soft, #c9d3df); font-size: .9rem; font-weight: 600; }
html.dark .cx .cx-matrix thead th + th { width: 132px; padding-inline: 12px; text-align: center; }
html.dark .cx .cx-matrix tbody :is(th, td) { border-top: 1px solid var(--wq-border, #374351); }
html.dark .cx .cx-matrix tbody th { padding: 16px 24px 16px 20px; }
.cx-matrix h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.45; }
.cx-matrix tbody p { margin-top: 3px; color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; line-height: 1.6; text-wrap: pretty; }
html.dark .cx .cx-matrix tbody td { height: 1px; padding: 0; border-left: 1px solid var(--wq-border, #374351); }
.cx-matrix td a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 84px; height: 100%; padding: 10px 8px 14px; text-align: center; }
.cx-matrix__year { display: none; }
.cx-matrix td strong { font-size: .98rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-cell-state { color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; font-variant-numeric: tabular-nums; }
.cx-cell-state.is-set { color: var(--wq-text, #e8edf3); }
.cx-cell-bar { position: absolute; left: 12px; right: 12px; bottom: 9px; height: 4px; border-radius: 2px; background: var(--wq-surface-3, #333e4b); overflow: hidden; visibility: hidden; }
.cx-cell-bar i { display: block; height: 100%; background: #35a56f; }
.is-started .cx-cell-bar { visibility: visible; }

/* Question bank types */
.cx-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cx-type { display: grid; grid-template-rows: auto 1fr; gap: 16px; padding: 16px; border: 1px solid var(--wq-border, #374351); border-radius: 14px; background: var(--wq-surface, #20262e); }
.cx-type--wide { grid-column: 1 / -1; grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: auto; gap: 22px; }
.cx-type__body { display: flex; flex-direction: column; min-width: 0; }
.cx-type .cx-ranges { margin-top: auto !important; padding-top: 14px !important; }
.cx-type__sample { aspect-ratio: 8 / 5; border-radius: 10px; overflow: hidden; background: var(--wq-bg, #15191f); }
.cx-type__sample img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cx-type__sample.is-sign { background: #fff; }
.cx-type__sample.is-sign img { padding: 14px; object-fit: contain; }
.cx-type__sample.is-text { aspect-ratio: auto; align-self: stretch; padding: 18px; border: 1px solid var(--wq-border, #374351); }
.cx-type__sample.is-text strong { display: block; font-size: 1rem; font-weight: 600; line-height: 1.6; }
.cx-type__sample.is-text li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: center; margin-top: 9px; color: var(--wq-text-soft, #c9d3df); font-size: .9rem; line-height: 1.5; }
.cx-type__sample.is-text li i { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--wq-border-strong, #516983); border-radius: 50%; font-size: .8rem; font-style: normal; line-height: 1; }
.cx-type__sample.is-text li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-type h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.02em; }
.cx-type p { margin-top: 4px; color: var(--wq-text-soft, #c9d3df); font-size: .94rem; line-height: 1.65; text-wrap: pretty; }
.cx-ranges { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 224px), 1fr)); gap: 8px; }
.cx-ranges li { display: grid; grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--wq-border-strong, #516983); border-radius: 10px; overflow: hidden; }
.cx-ranges a { display: flex; align-items: center; min-height: 48px; font-size: .92rem; }
.cx-ranges__run { position: relative; justify-content: space-between; gap: 8px; padding: 6px 12px; }
.cx-ranges .cx-cell-state { white-space: nowrap; }
.cx-ranges__run strong { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-ranges .cx-cell-bar { left: 14px; right: 14px; bottom: 4px; height: 3px; }
html.dark .cx a.cx-ranges__read { padding: 6px 11px; border-left: 1px solid var(--wq-border, #374351); color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; white-space: nowrap; }

/* Sources and other exams */
.cx section.cx-sources { padding: 18px 20px 8px; border: 1px solid var(--wq-border, #374351); border-radius: 14px; }
.cx-sources > p { color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; line-height: 1.7; text-wrap: pretty; }
.cx-sources summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-top: 8px; border-top: 1px solid var(--wq-border, #374351); list-style: none; cursor: pointer; }
.cx-sources summary::-webkit-details-marker { display: none; }
.cx-sources summary::after { content: ""; width: 8px; height: 8px; margin-right: 6px; border-right: 2px solid var(--wq-text-muted, #a8b5c5); border-bottom: 2px solid var(--wq-text-muted, #a8b5c5); transform: translateY(-2px) rotate(45deg); }
.cx-sources details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.cx-sources h2 { font-size: .98rem; font-weight: 600; }
.cx-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; padding-bottom: 8px !important; }
.cx-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; border-top: 1px solid var(--wq-border, #374351); font-size: .92rem; line-height: 1.45; }
html.dark .cx .cx-links a { color: var(--wq-text-soft, #c9d3df); }
.cx-links a::after { content: "↗"; flex: 0 0 auto; color: var(--wq-text-muted, #a8b5c5); }
.cx-others { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cx-others a { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border: 1px solid var(--wq-border, #374351); border-radius: 12px; background: var(--wq-surface, #20262e); font-size: .96rem; font-weight: 600; line-height: 1.4; }

@media (hover: hover) {
    html.dark .cx a.cx-btn:hover, .cx button.cx-btn:hover, .cx-others a:hover { border-color: var(--wq-accent, #4da3f7); }
    html.dark .cx a.cx-btn--primary:hover { background: var(--wq-primary-hover, #3480e6); }
    .cx-matrix td a:hover, .cx-ranges a:hover { background: var(--wq-surface-2, #29313b); }
    .cx-crumb a:hover, .cx-links a:hover { text-decoration: underline !important; text-underline-offset: 3px; }
}
@media (max-width: 1023px) {
    .cx-hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .cx-hero__summary { max-width: none; }
    .cx-rounds li { grid-template-columns: auto minmax(0, 1fr) auto; }
    .cx-rounds__name { grid-column: 1; grid-row: 1; }
    .cx-rounds__meta { grid-column: 2; grid-row: 1; }
    .cx-rounds__last { grid-column: 1 / 3; grid-row: 2; }
    .cx-rounds__actions { grid-column: 3; grid-row: 1 / 3; }
    .cx-progress__card { grid-template-columns: minmax(0, 1fr); }
    .cx-type--wide { grid-template-columns: 240px minmax(0, 1fr); }
    .cx-progress__card .cx-btn { grid-row: 2; }
    .cx-bars { grid-row: 3; }
}
@media (max-width: 720px) {
    .cx { padding-top: 0; }
    .cx section { margin-top: 36px; }
    .cx-hero { margin-top: 8px; padding-bottom: 28px; }
    .cx-hero__title { gap: 14px; }
    .cx-hero__title .cbt-tile--lg { width: 52px; height: 52px; border-radius: 13px; }
    .cx-hero__actions { display: grid; grid-template-columns: 1fr 1fr; }
    html.dark .cx .cx-hero__actions a.cx-btn { padding-inline: 10px; font-size: .96rem; }
    .cx section.cx-info { padding: 16px; }
    .cx-head { margin-bottom: 10px; }
    .cx section.cx-resume .cx-btn { width: 100%; }
    .cx-progress__card { padding: 16px; }
    .cx-stats { grid-template-columns: 1fr 1fr; justify-content: stretch; gap: 12px 20px; }
    .cx-rounds li { grid-template-columns: auto 1fr; padding: 16px; gap: 4px 12px; }
    .cx-rounds__meta { justify-self: end; }
    .cx-rounds__last { grid-column: 1 / -1; }
    .cx-rounds__actions { grid-column: 1 / -1; grid-row: auto; grid-template-columns: 1fr 1fr; margin-top: 10px; }
    .cx-matrix, .cx-matrix tbody { display: block; }
    .cx-matrix thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .cx-matrix tbody tr { display: grid; grid-template-columns: repeat(var(--cx-years, 3), minmax(0, 1fr)); gap: 12px 8px; padding: 16px; }
    .cx-matrix tbody tr + tr { border-top: 1px solid var(--wq-border, #374351); }
    html.dark .cx .cx-matrix tbody th { grid-column: 1 / -1; padding: 0; border: 0; }
    html.dark .cx .cx-matrix tbody td { height: auto; border: 1px solid var(--wq-border-strong, #516983) !important; border-radius: 10px; overflow: hidden; }
    .cx-matrix__year { display: block; font-size: .95rem; font-weight: 600; }
    .cx-matrix td strong { color: var(--wq-text-soft, #c9d3df); font-size: .875rem; font-weight: 500; }
    .cx-matrix td .cx-cell-state:not(.is-set) { display: none; }
    .cx-matrix td a { min-height: 64px; }
    .cx-types { grid-template-columns: minmax(0, 1fr); }
    .cx-type, .cx-type--wide { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
    .cx-facts { display: grid; grid-auto-flow: column; grid-auto-columns: auto; justify-content: space-between; }
    .cx-facts > div { padding-inline: 14px; }
    .cx-facts > div:last-child { padding-right: 0; }
    .cx-facts dd { font-size: 1.06rem; }
    .cx-type__sample { aspect-ratio: 16 / 8; }
    .cx-ranges { grid-template-columns: minmax(0, 1fr); }
    .cx-links { grid-template-columns: minmax(0, 1fr); }
    .cx-others { grid-template-columns: 1fr 1fr; gap: 8px; }
    .cx-others a { padding: 10px; gap: 10px; font-size: .92rem; }
    .cx-others .cbt-tile--sm { width: 32px; height: 32px; }
    .cx-others .cbt-tile--sm svg { width: 18px; height: 18px; }
}

/* Reading page */
/* The shell clips horizontal overflow, which turns sticky off. Clip instead, and let the site header scroll away. */
html:has(body.is-cbt-read), body.is-cbt-read { overflow: visible !important; overflow-x: clip !important; }
body.is-cbt-read .top-header { position: relative; }
.cx-read__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; margin: 12px 0 18px; }
.cx-read__title h1 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.35; letter-spacing: -.03em; text-wrap: balance; }
.cx-read__title p { margin-top: 2px; color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; }
.cx-tabs { display: flex; padding: 4px; border: 1px solid var(--wq-border, #374351); border-radius: 10px; background: var(--wq-surface, #20262e); }
.cx-tabs > * { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 16px; border-radius: 7px; font-size: .92rem; font-variant-numeric: tabular-nums; }
html.dark .cx .cx-tabs a { color: var(--wq-text-muted, #a8b5c5); }
.cx-tabs [aria-current] { background: var(--wq-surface-3, #333e4b); color: var(--wq-text, #e8edf3); font-weight: 700; }

.cx-bar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 20px; padding: 10px 0; border-block: 1px solid var(--wq-border, #374351); background: var(--wq-bg, #15191f); }
.cx-bar__toc { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.cx-bar__toc::-webkit-scrollbar { display: none; }
.cx-bar__toc a { position: relative; flex: 0 0 auto; display: block; max-width: 250px; padding: 0 12px; font-size: .94rem; line-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .cx .cx-bar__toc a { color: var(--wq-text-muted, #a8b5c5); }
.cx-bar__toc a:first-child { padding-left: 2px; }
html.dark .cx .cx-bar__toc a[aria-current] { color: var(--wq-text, #e8edf3); font-weight: 700; }
.cx-bar__toc a[aria-current]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--wq-accent, #4da3f7); }
.cx-bar__toc a:first-child[aria-current]::after { left: 2px; }
.cx-bar__name { font-weight: 700; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-bar__tools { display: flex; gap: 8px; }
html.dark .cx .cx-bar a.cx-btn, .cx .cx-bar button.cx-btn { min-height: 44px; padding: 6px 14px; font-size: .9rem; white-space: nowrap; }
.cx-bar button[aria-pressed="true"] { background: var(--wq-surface-3, #333e4b); }
.cx .cx-bar button.cx-bar__index { display: none; }

.cx-read__grid { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 56px; align-items: start; }
.cx section.cx-subject { margin-top: 32px; scroll-margin-top: 90px; }
.cx-subject + .cx-subject { margin-top: 56px !important; }
.cx-subject__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--wq-border-strong, #516983); }
.cx-subject__head h2 { font-size: 1.25rem; letter-spacing: -.02em; line-height: 1.4; }
html.dark .cx .cx-subject__head a.cx-btn { flex: 0 0 auto; min-height: 44px; padding: 6px 14px; font-size: .9rem; }
.cx-q { padding: 28px 0 22px; border-bottom: 1px solid var(--wq-border, #374351); scroll-margin-top: 66px; }
.cx-q h3 { display: grid; grid-template-columns: 40px minmax(0, 1fr); font-size: 1.08rem; font-weight: 600; line-height: 1.65; letter-spacing: -.01em; }
.cx-q__no { font-size: 1.15rem; font-weight: 800; line-height: 1.55; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.cx-q > :not(h3) { margin-left: 40px !important; }
.cx-read.has-long-numbers .cx-q h3 { grid-template-columns: 58px minmax(0, 1fr); }
.cx-read.has-long-numbers .cx-q > :not(h3) { margin-left: 58px !important; }
.cx-fig { width: fit-content; max-width: 100%; margin-top: 16px !important; padding: 10px !important; border-radius: 10px; background: #fff; }
.cx-fig img { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; }
.cx-fig.is-photo { padding: 0 !important; background: none; overflow: hidden; }
.cx-fig.is-photo img { width: min(100%, 600px); border-radius: 10px; }
.cx-fig.is-sign img { max-height: 260px; }
.cx-fig__open { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.cx-passage { display: grid; gap: 6px; margin-top: 16px; padding: 16px 18px; border: 1px solid var(--wq-border, #374351); border-radius: 10px; background: var(--wq-surface, #20262e); font-size: 1rem; line-height: 1.75; }
.cx-passage .is-mark { padding-left: 1.55em; text-indent: -1.55em; }
.cx-passage .is-dot, .cx-passage .is-sub { position: relative; padding-left: 1.15em; }
.cx-passage .is-dot::before { content: ""; position: absolute; left: 2px; top: .68em; width: 7px; height: 7px; border: 1.5px solid var(--wq-text-muted, #a8b5c5); border-radius: 50%; }
.cx-passage .is-sub { margin-left: 1.15em; padding-left: .9em; }
.cx-passage .is-sub::before { content: ""; position: absolute; left: 0; top: .85em; width: 6px; height: 1.5px; background: var(--wq-text-muted, #a8b5c5); }
.cx-q__pick { margin-top: 14px !important; color: var(--wq-text-muted, #a8b5c5); font-size: .9rem; }
.cx-options { display: grid; gap: 2px; margin-top: 14px; counter-reset: option; }
.cx-options li { position: relative; counter-increment: option; border-radius: 9px; padding: 8px 12px 8px 44px; font-size: 1rem; line-height: 1.65; }
.cx-options li:has(> button) { padding: 0; }
.cx-options li::before { content: counter(option); position: absolute; left: 8px; top: 9px; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--wq-border-strong, #516983); border-radius: 50%; font-size: .875rem; font-weight: 600; line-height: 1; color: var(--wq-text-soft, #c9d3df); pointer-events: none; }
.cx-option { display: block; width: 100%; min-height: 44px; padding: 8px 12px 8px 44px; border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; line-height: 1.65; text-align: left; cursor: pointer; }
.cx-option:disabled { cursor: default; }
.cx-options li.is-picked { box-shadow: inset 0 0 0 2px var(--wq-accent, #4da3f7); }
.cx-options li.is-right, .cx-q:has(.cx-answer[open]) li.is-answer { box-shadow: inset 0 0 0 1px #35a56f; }
.cx-options li.is-right::before, .cx-q:has(.cx-answer[open]) li.is-answer::before { border-color: #23845a; background: #23845a; color: #fff; }
.cx-options li.is-wrong { box-shadow: inset 0 0 0 1px #d8574c; }
.cx-options li.is-wrong::before { border-color: #c2463c; background: #c2463c; color: #fff; }
.cx-answer { margin-top: 10px; }
.cx-answer summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px; color: var(--wq-text-muted, #a8b5c5); font-size: .92rem; font-weight: 600; list-style: none; cursor: pointer; }
.cx-answer summary::-webkit-details-marker { display: none; }
.cx-answer summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.cx-answer[open] summary::after { transform: translateY(2px) rotate(225deg); }
.cx-answer__line { font-weight: 700; color: #57c48e; }
.cx-answer__text { margin-top: 8px; padding: 14px 16px; border-left: 3px solid #35a56f; background: var(--wq-surface, #20262e); font-size: .96rem; line-height: 1.75; color: var(--wq-text-soft, #c9d3df); }
.cx-answer__text p + p { margin-top: 8px; }

.cx-index { position: sticky; top: 90px; display: flex; flex-direction: column; max-height: calc(100vh - 114px); margin-top: 32px; padding: 14px 16px; border: 1px solid var(--wq-border, #374351); border-radius: 14px; background: var(--wq-surface, #20262e); }
.cx-index__head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; font-size: .95rem; }
.cx-index__close { display: none; }
.cx-index__list { flex: 1 1 auto; overflow-y: auto; margin-right: -8px; padding-right: 8px; scrollbar-width: thin; scrollbar-color: var(--wq-surface-3, #333e4b) transparent; }
.cx .cx-index__name { margin: 12px 0 6px; color: var(--wq-text-muted, #a8b5c5); font-size: .875rem; line-height: 1.45; }
.cx-index ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; margin-top: 8px; }
.cx-index a { display: grid; place-items: center; min-height: 36px; border: 1px solid transparent; border-radius: 7px; font-size: .875rem; font-variant-numeric: tabular-nums; }
html.dark .cx .cx-index a { color: var(--wq-text-soft, #c9d3df); }
html.dark .cx .cx-index a[aria-current] { border-color: var(--wq-accent, #4da3f7); color: var(--wq-text, #e8edf3); font-weight: 700; }
html.dark .cx .cx-index a.is-right { background: #23845a; color: #fff; }
html.dark .cx .cx-index a.is-wrong { background: #b8443b; color: #fff; }
.cx-index__tally { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--wq-border, #374351); font-size: .9rem; font-variant-numeric: tabular-nums; }
.cx-index__tally button, .cx-index__close { min-height: 40px; padding: 4px 10px; border: 1px solid var(--wq-border-strong, #516983); border-radius: 8px; background: none; color: var(--wq-text, #e8edf3); font: inherit; font-size: .875rem; cursor: pointer; }

.cx-pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 28px; }
.cx-pager__next { margin-left: auto; }
.cx-siblings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.cx-siblings > * { display: flex; align-items: center; min-height: 48px; padding: 6px 14px; border: 1px solid var(--wq-border, #374351); border-radius: 10px; background: var(--wq-surface, #20262e); font-size: .92rem; font-variant-numeric: tabular-nums; }
.cx-siblings [aria-current] { border-color: var(--wq-accent, #4da3f7); font-weight: 700; }
.cx-links a[data-internal]::after { content: "›"; }
.cx-zoom { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 16px; border: 0; background: rgba(8, 11, 15, .94); }
.cx-zoom[open] { display: grid; place-items: center; overflow: auto; cursor: zoom-out; }
.cx-zoom img { max-width: 100%; max-height: calc(100dvh - 90px); min-width: min(900px, 100%); object-fit: contain; border-radius: 8px; background: #fff; }
.cx-zoom button { min-height: 44px; padding: 6px 24px; border: 1px solid #f4f8fd; border-radius: 10px; background: none; color: #f4f8fd; font: inherit; cursor: pointer; }

@media (hover: hover) {
    .cx-option:not(:disabled):hover { background: var(--wq-surface, #20262e); }
    .cx-index a:not(.is-right, .is-wrong):hover { background: var(--wq-surface-3, #333e4b); }
    html.dark .cx .cx-bar__toc a:hover, html.dark .cx .cx-tabs a:hover { color: var(--wq-text, #e8edf3); }
    .cx-siblings a:hover { border-color: var(--wq-accent, #4da3f7); }
}
@media (max-width: 1023px) {
    .cx-read__grid { grid-template-columns: minmax(0, 1fr); }
    .cx .cx-bar button.cx-bar__index:not([hidden]) { display: inline-flex; }
    .cx-index { display: none; }
    .cx-index.is-open { position: fixed; inset: auto 0 0; top: auto; z-index: 60; display: flex; max-height: min(70dvh, 620px); margin: 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; border-inline: 0; border-bottom: 0; border-top-color: var(--wq-border-strong, #516983); }
    .cx-index__close { display: inline-block; }
    .cx-index a { min-height: 44px; }
    .cx-index ol { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
}
@media (max-width: 720px) {
    .cx-read__head { grid-template-columns: auto minmax(0, 1fr); margin: 6px 0 14px; gap: 12px; }
    .cx-tabs { grid-column: 1 / -1; }
    .cx-tabs > * { flex: 1 1 0; }
    .cx-bar { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 6px 0 10px; }
    .cx-bar__name { display: none; }
    .cx-bar__tools { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); }
    .cx-bar__extra { display: none !important; }
    html.dark .cx .cx-bar a.cx-btn, .cx .cx-bar button.cx-btn { padding-inline: 12px; }
    .cx section.cx-subject { margin-top: 24px; scroll-margin-top: 124px; }
    .cx-q { padding: 24px 0 16px; scroll-margin-top: 112px; }
    .cx-q h3 { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; font-size: 1.05rem; }
    .cx-read.has-long-numbers .cx-q h3 { grid-template-columns: auto minmax(0, 1fr); }
    .cx-q > :not(h3), .cx-read.has-long-numbers .cx-q > :not(h3) { margin-left: 0 !important; }
    .cx-passage { padding: 14px; }
    .cx-options { margin-inline: -6px 0 !important; }
    .cx-options li::before { left: 6px; }
    .cx-option, .cx-options li { padding-left: 42px; }
    .cx-siblings { grid-template-columns: 1fr 1fr; }
    .cx-subject__head h2 { font-size: 1.15rem; }
}
@media print {
    .cx-crumb, .cx-bar, .cx-index, .cx-tabs, .cx-pager, .cx-siblings, .cx-subject__head .cx-btn, .cx-answer:not([open]), .cx-sources details { display: none !important; }
    .cx, .cx-passage, .cx-option { color: #000; background: none; }
    .cx-read__grid { display: block; }
    .cx-q { break-inside: avoid; }
}

/* Catalog page (/cbt/) base styles. */
.cbt-catalog {
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 16px 52px;
    color: #e8edf3;
}

.cbt-catalog a {
    color: #a6cffa;
}

.cbt-catalog a:focus-visible {
    outline: 2px solid #a6cffa;
    outline-offset: 4px;
}

.cbt-breadcrumb,
.cbt-jumps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
}

.cbt-breadcrumb {
    font-size: .875rem;
}

.cbt-header {
    margin: 24px 0 32px;
    padding: clamp(20px, 4vw, 36px);
    background: #20262e;
    border: 1px solid #364353;
    border-radius: 16px;
}

.cbt-header h1 {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 4vw, 2.7rem);
    line-height: 1.25;
    letter-spacing: -.04em;
}

.cbt-header p,
.cbt-catalog section p {
    max-width: 72ch;
    margin: 8px 0 0;
    line-height: 1.65;
}

.cbt-jumps {
    margin-top: 12px;
}

.cbt-catalog section {
    margin-top: 32px;
    scroll-margin-top: 84px;
}

.cbt-catalog h2 {
    margin: 0 0 12px;
    font-size: 1.35rem;
}

.cbt-catalog .cbt-note,
.cbt-card > span {
    color: #becbd9;
    font-size: .9rem;
}

.cbt-grid,
.cbt-subjects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cbt-subjects {
    margin-top: 14px;
}

.cbt-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px;
    border: 1px solid #364353;
    border-radius: 12px;
    background: #20262e;
    text-decoration: none;
}

.cbt-card h3,
.cbt-card strong {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #e8edf3;
    line-height: 1.45;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

a.cbt-card:hover,
.cbt-round-links a:hover {
    border-color: #80b8eb;
}

.cbt-card .cbt-action {
    margin-top: auto;
    padding-top: 8px;
    color: #a6cffa;
}

.cbt-round-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: auto 0 0;
    padding: 8px 0 0;
}

.cbt-round-links a,
.cbt-jumps a,
.cbt-archive summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    gap: 5px;
}

.cbt-round-links a {
    padding: 6px 10px;
    border: 1px solid #405167;
    border-radius: 8px;
    text-decoration: none;
}

.cbt-source-links {
    display: grid;
    gap: 7px;
    padding-left: 20px;
    margin: 12px 0 0;
}

.cbt-archive {
    margin-top: 12px;
}

.cbt-archive summary {
    display: list-item;
    padding: 10px 0;
    cursor: pointer;
}

