/* PYQ Decoder (question bank) styles. Builds on assets/styles.css tokens. */
:root { --qfs: 16px; }

/* ---- personal marks: highlight, bold, italic, strike-through (see qb-mark.js) ---- */
:root { --qbm-c1: #fbe58f; --qbm-c2: #cdedd0; --qbm-c3: #d0e4f8; --qbm-mark: 111 79 173; }
:root[data-theme="dark"] { --qbm-c1: #3a3018; --qbm-c2: #1c3220; --qbm-c3: #1a2c42; --qbm-mark: 185 166 232; }
.qbm-hl { border-radius: 2px; padding: .05em 0; cursor: pointer; }
.qbm-hl.c1 { background: var(--qbm-c1); } .qbm-hl.c2 { background: var(--qbm-c2); } .qbm-hl.c3 { background: var(--qbm-c3); }
.qbm-b { font-weight: 700; color: rgb(var(--qbm-mark)); cursor: pointer; }
.qbm-i { font-style: italic; color: rgb(var(--qbm-mark)); cursor: pointer; }
.qbm-s { text-decoration: line-through; text-decoration-color: rgb(var(--qbm-mark)); color: rgb(var(--qbm-mark)); cursor: pointer; }
.qbm-n { border-bottom: 1.5px dotted rgb(var(--qbm-mark)); cursor: pointer; }
[data-mid].qbm-hasnote { position: relative; }
[data-mid].qbm-hasnote::after { content: ""; position: absolute; top: -.25em; right: -.5em; width: 5px; height: 5px; border-radius: 50%; background: rgb(var(--qbm-mark)); }
#qbm-bar { position: absolute; z-index: 90; display: none; gap: 3px; padding: 5px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 9px; box-shadow: var(--shadow); font-family: var(--sans); }
#qbm-bar button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; background: transparent; display: grid; place-items: center; font-size: 13px; color: rgb(var(--c-ink-2)); padding: 0; font-family: inherit; }
#qbm-bar button:hover { border-color: rgb(var(--c-line)); background: rgb(var(--c-bg)); }
#qbm-bar .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); display: block; }
#qbm-bar .qbm-btn-b { font-weight: 800; color: rgb(var(--qbm-mark)); }
#qbm-bar .qbm-btn-i { font-style: italic; font-weight: 700; color: rgb(var(--qbm-mark)); }
#qbm-bar .qbm-btn-s { text-decoration: line-through; font-weight: 700; color: rgb(var(--qbm-mark)); }
#qbm-bar .qbm-btn-n { font-size: 14px; color: rgb(var(--c-ink-2)); }
#qbm-bar .qbm-btn-n.has { color: rgb(var(--qbm-mark)); font-weight: 800; }
#qbm-bar .sep { width: 1px; background: rgb(var(--c-line)); margin: 3px 2px; }
#qbm-bar .del { display: none; }
#qbm-bar.editing .del { display: grid; }
#qbm-bar.editing .sep.del { display: block; }
#qbm-bar .rm { width: auto; padding: 0 10px; font-size: .78rem; font-weight: 600; color: rgb(var(--c-red-ink)); }
#qbm-bar .rm:hover { background: rgb(var(--c-red-soft)); border-color: rgb(var(--c-red-line)); }
#qbm-note { position: absolute; z-index: 91; display: none; width: 240px; padding: 8px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 9px; box-shadow: var(--shadow); font-family: var(--sans); }
.qbm-note-drag { height: 16px; margin: -8px -8px 6px; border-radius: 9px 9px 0 0; cursor: grab; display: flex; align-items: center; justify-content: center; gap: 3px; touch-action: none; }
.qbm-note-drag:hover { background: rgb(var(--c-bg)); }
.qbm-note-drag:active { cursor: grabbing; background: rgb(var(--c-line-2)); }
.qbm-note-drag i { width: 3px; height: 3px; border-radius: 50%; background: rgb(var(--c-ink-3)); display: block; }
#qbm-note textarea { width: 100%; min-height: 56px; border: 1px solid rgb(var(--c-line)); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: .82rem; color: rgb(var(--c-ink)); background: rgb(var(--c-bg)); resize: vertical; outline: none; box-sizing: border-box; }
#qbm-note textarea:focus { border-color: rgb(var(--qbm-mark)); }
#qbm-note .qbm-note-f { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#qbm-note button { font: inherit; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 5px 12px; cursor: pointer; border: 1px solid rgb(var(--c-line)); background: transparent; color: rgb(var(--c-ink-2)); }
#qbm-note .qbm-note-save { color: rgb(var(--c-bg)); background: rgb(var(--qbm-mark)); border-color: transparent; }
#qbm-note .qbm-note-del { color: rgb(var(--c-red-ink)); }
#qbm-note .qbm-note-del:hover { background: rgb(var(--c-red-soft)); border-color: rgb(var(--c-red-line)); }
@media (max-width: 760px) { #qbm-note { width: min(280px, calc(100vw - 28px)); } }
@media (max-width: 760px) { #qbm-bar button { width: 34px; height: 34px; } }
.qb-hero { padding: 44px 0 28px; }
.qb-hero h1 { font-size: clamp(2rem, 3vw + 1rem, 3rem); margin-bottom: 12px; }
.qb-crumb { font-family: var(--sans); font-size: .85rem; color: rgb(var(--c-ink-3)); margin-bottom: 14px; }
.qb-crumb a { color: rgb(var(--c-ink-2)); }
.qb-beta { display: inline-block; vertical-align: middle; font-family: var(--sans); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: rgb(var(--c-amber-soft)); color: rgb(var(--c-amber)); border: 1px solid rgb(var(--c-amber-line)); margin-left: 8px; }
.qb-sub { font-family: var(--serif); font-size: 1.1rem; color: rgb(var(--c-ink-2)); max-width: 60ch; }
.qb-meta { font-family: var(--sans); font-size: .88rem; color: rgb(var(--c-ink-3)); margin-top: 10px; }
.qb-main { padding: 0 0 72px; border-top: none; }
section.qb-main + section { border-top: none; }

/* chapter hero */
.qb-hero--ch { padding: 36px 0 22px; }
.qb-hero__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 4px; }
.qb-hero__row .qb-meta { margin: 0; }
.qb-switch { display: inline-flex; align-items: center; }
.qb-sel.qb-sel--ch { max-width: 300px; color: rgb(var(--c-ink)); font-weight: 500; }

/* toolbar: one quiet row, aligned with the cards */
.qb-toolbar { position: sticky; top: 61px; z-index: 30; background: rgb(var(--c-bg) / .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid rgb(var(--c-line)); margin-bottom: 22px; }
.qb-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; padding-bottom: 10px; font-family: var(--sans); font-size: .84rem; }
.qb-fpanel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qb-sel { line-height: 1.25; font-family: var(--sans); font-size: .82rem; color: rgb(var(--c-ink-2)); background-color: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 6px 28px 6px 12px; cursor: pointer; max-width: 170px; text-overflow: ellipsis;
  -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.qb-sel--topic { max-width: 180px; }
.qb-sel--sort { max-width: 150px; }
.qb-sel:hover { border-color: rgb(var(--c-ink) / .3); }
.qb-sel:focus-visible, .qb-tb__btn:focus-visible, .qb-chip input:focus-visible + span { outline: 2px solid rgb(var(--c-amber)); outline-offset: 2px; }
.qb-sel.is-on { color: rgb(var(--c-ink)); background-color: rgb(var(--c-amber-soft)); border-color: rgb(var(--c-amber-line)); font-weight: 600; }
.qb-chip { display: inline-flex; cursor: pointer; }
.qb-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qb-chip span { line-height: 1.25; font-size: .82rem; color: rgb(var(--c-ink-2)); background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 6px 12px; }
.qb-chip input:checked + span { color: rgb(var(--c-red-ink)); background: rgb(var(--c-red-soft)); border-color: rgb(var(--c-red-line)); font-weight: 600; }
.qb-clear { font-family: var(--sans); font-size: .8rem; color: rgb(var(--c-accent)); background: none; border: none; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.qb-tb__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.qb-count { color: rgb(var(--c-ink-3)); font-size: .8rem; white-space: nowrap; margin-right: 4px; }
.qb-count:not(.is-on) { display: none; }
.qb-tb__btn { line-height: 1.25; font-family: var(--sans); font-size: .82rem; font-weight: 600; color: rgb(var(--c-ink)); background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 6px 13px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.qb-tb__btn:hover { border-color: rgb(var(--c-ink) / .3); }
#qb-all[aria-pressed="true"], .qb-aa__btn[aria-expanded="true"] { background: rgb(var(--c-amber-soft)); border-color: rgb(var(--c-amber-line)); }
.qb-tb__filters { display: none; }
.qb-tb__filters svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.qb-badge { min-width: 18px; height: 18px; border-radius: 999px; background: rgb(var(--c-amber)); color: rgb(var(--c-bg)); font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.qb-badge[hidden] { display: none; }
.qb-aa { position: relative; }
.qb-aa__btn { font-family: var(--serif); font-size: .92rem; padding: 5px 12px; }
.qb-aa__pop { position: absolute; right: 0; top: calc(100% + 8px); background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.qb-aa__pop[hidden] { display: none; }
.qb-size { display: inline-flex; align-items: center; }
.qb-size button { font-family: var(--sans); font-size: .85rem; font-weight: 700; color: rgb(var(--c-ink)); background: transparent; border: none; border-radius: 6px; padding: 7px 11px; cursor: pointer; }
.qb-size button:hover { background: rgb(var(--c-bg)); }
.qb-size button:disabled { opacity: .35; cursor: default; }
.qb-size b { min-width: 2.2em; text-align: center; font-family: var(--sans); font-weight: 600; font-size: .85rem; color: rgb(var(--c-ink)); cursor: pointer; }

/* entry cards */
.qb-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.qb-entry { min-width: 0; overflow-wrap: break-word; }
.qb-entry { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px; padding: 22px 26px 18px; scroll-margin-top: 130px; }
.qb-entry:target { border-color: rgb(var(--c-amber)); box-shadow: var(--shadow); }
.qb-entry[hidden] { display: none; }
.qb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; font-family: var(--sans); }
.qb-tag { font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid rgb(var(--c-line)); color: rgb(var(--c-ink-2)); background: rgb(var(--c-bg)); white-space: nowrap; }
.qb-tag--att { color: rgb(var(--c-ink)); border-color: rgb(var(--c-ink) / .25); }
.qb-tag--marks { color: rgb(var(--c-green-ink)); background: rgb(var(--c-green-soft)); border-color: rgb(var(--c-green-line)); }
.qb-tag--law { color: rgb(var(--c-red-ink)); background: rgb(var(--c-red-soft)); border-color: rgb(var(--c-red-line)); }
.qb-tag--alt { color: rgb(var(--c-accent)); background: rgb(var(--c-accent-soft)); border-color: rgb(var(--c-accent) / .25); }
.qb-q, .qb-a { font-family: var(--serif); font-size: var(--qfs); line-height: 1.7; color: rgb(var(--c-ink)); }
.qb-q p, .qb-a p { max-width: none; color: rgb(var(--c-ink)); margin: 0 0 .6em; text-align: justify; text-justify: inter-word; hyphens: manual; }
.qb-a p.qb-src { text-align: left; }
.qb-q td, .qb-a td, .qb-q th, .qb-a th { text-align: left; }
.qb-q p.l1, .qb-a p.l1 { padding-left: 1.6em; } .qb-q p.l2, .qb-a p.l2 { padding-left: 3.2em; }
.qb-q p.l3, .qb-a p.l3 { padding-left: 4.8em; } .qb-q p.l4, .qb-a p.l4 { padding-left: 6.4em; }
.qb-q p.b, .qb-a p.b { font-weight: 700; }
/* list items: the marker hangs, the text keeps its own justified block */
.qb-q p.li, .qb-a p.li { display: flex; gap: .5em; align-items: baseline; }
.qb-q p.li > .mk, .qb-a p.li > .mk { flex: none; min-width: 2em; text-align: left; white-space: nowrap; }
.qb-q p.li > .tx, .qb-a p.li > .tx { flex: 1 1 auto; min-width: 0; }
.qb-lead { border-left: 3px solid rgb(var(--c-amber-line)); padding: 2px 0 2px 16px; margin: 0 0 14px; color: rgb(var(--c-ink-2)); }
.qb-lead p { color: rgb(var(--c-ink-2)); }
details.qb-lead > summary { font-family: var(--sans); font-size: .85rem; font-weight: 600; color: rgb(var(--c-accent)); cursor: pointer; margin-bottom: 8px; }
details.qb-lead[open] > summary { margin-bottom: 12px; }
.qb-twrap { overflow-x: auto; margin: 4px 0 12px; }
.qb-table { border-collapse: collapse; font-family: var(--sans); font-size: calc(var(--qfs) * .88); line-height: 1.5; min-width: 60%; }
.qb-table td { border: 1px solid rgb(var(--c-line)); padding: 7px 10px; vertical-align: top; color: rgb(var(--c-ink)); }
.qb-table tr:first-child td { background: rgb(var(--c-line-2)); font-weight: 600; }
.qb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 14px; font-family: var(--sans); font-size: .86rem; }
.qb-toggle { font-family: var(--sans); font-size: .88rem; font-weight: 600; padding: 8px 16px; border-radius: 4px; border: 1.5px solid rgb(var(--c-ink) / .35); background: transparent; color: rgb(var(--c-ink)); cursor: pointer; }
.qb-toggle:hover { border-color: rgb(var(--c-amber)); }
.qb-toggle[aria-expanded="true"] { background: rgb(var(--c-amber-soft)); border-color: rgb(var(--c-amber-line)); }
.qb-links { color: rgb(var(--c-ink-3)); }
.qb-links a { margin-right: 6px; }
.qb-answer { margin-top: 16px; padding-top: 16px; border-top: 1px dashed rgb(var(--c-line)); }
.qb-answer[hidden] { display: none; }
.qb-law { background: rgb(var(--c-red-soft)); border: 1px solid rgb(var(--c-red-line)); border-radius: 4px; padding: 10px 14px; font-family: var(--sans); font-size: .86rem; color: rgb(var(--c-red-ink)); margin: 0 0 14px; }
.qb-law b { font-weight: 700; }
.qb-src { margin-top: 12px; font-family: var(--sans); font-size: .78rem; color: rgb(var(--c-ink-3)); }
.qb-nomatch { display: none; padding: 28px; text-align: center; color: rgb(var(--c-ink-3)); font-family: var(--sans); font-size: .9rem; border: 1px dashed rgb(var(--c-line)); border-radius: 6px; }
.qb-nomatch.is-on { display: block; }
.qb-nomatch button { font: inherit; color: rgb(var(--c-accent)); background: none; border: none; text-decoration: underline; cursor: pointer; }
.qb-empty { padding: 28px; text-align: center; color: rgb(var(--c-ink-3)); font-family: var(--sans); border: 1px dashed rgb(var(--c-line)); border-radius: 6px; }
.qb-xref { margin-top: 40px; }
.qb-xref h2 { font-size: 1.35rem; }
.qb-xref ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-family: var(--sans); font-size: .9rem; }
.qb-xref li { padding: 10px 14px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px; color: rgb(var(--c-ink-2)); }
.qb-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; font-family: var(--sans); font-size: .9rem; flex-wrap: wrap; }

/* index */
.qb-chapters { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; counter-reset: none; }
.qb-chapters li { min-width: 0; }
.qb-chapters a { display: grid; grid-template-columns: 3.2em 1fr auto; align-items: center; gap: 14px; padding: 16px 20px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 6px; text-decoration: none; color: rgb(var(--c-ink)); transition: border-color .2s ease, transform .2s ease; }
.qb-chapters a:hover { border-color: rgb(var(--c-amber-line)); transform: translateY(-1px); }
.qb-chapters .n { font-family: var(--serif); font-weight: 700; color: rgb(var(--c-amber)); font-size: 1.1rem; }
.qb-chapters .t { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.qb-chapters .c { font-family: var(--sans); font-size: .82rem; color: rgb(var(--c-ink-3)); text-align: right; white-space: nowrap; }
.qb-chapters .c .law { color: rgb(var(--c-red-ink)); }
.qb-part { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: rgb(var(--c-ink-3)); margin: 26px 0 10px; }
.qb-attempts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.qb-legal { margin-top: 18px; font-size: .74rem; color: rgb(var(--c-ink-3)); max-width: 90ch; line-height: 1.5; }

/* chapter weightage page */
.qb-wlink { font-family: var(--sans); font-size: .82rem; font-weight: 600; color: rgb(var(--c-ink-2)); text-decoration: none; border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 6px 12px; margin-right: 8px; white-space: nowrap; background: rgb(var(--c-surface)); transition: border-color .2s ease, color .2s ease; }
.qb-wlink:hover { border-color: rgb(var(--c-amber-line)); color: rgb(var(--c-ink)); }
.qw-cta { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 14px; align-items: center; padding: 18px 20px; margin: 0 0 8px; border-radius: 8px; text-decoration: none; color: rgb(var(--c-ink)); background: rgb(var(--c-amber-soft)); border: 1px solid rgb(var(--c-amber-line)); transition: transform .2s ease, box-shadow .2s ease; }
.qw-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.qw-cta__k { grid-row: 1 / 3; font-family: var(--sans); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--c-bg)); background: rgb(var(--c-amber)); border-radius: 999px; padding: 3px 9px; }
.qw-cta__t { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.qw-cta__d { grid-column: 2; font-family: var(--sans); font-size: .86rem; color: rgb(var(--c-ink-2)); }
.qw-cta__go { grid-column: 3; grid-row: 1 / 3; font-size: 1.3rem; color: rgb(var(--c-amber)); transition: transform .2s ease; }
.qw-cta:hover .qw-cta__go { transform: translateX(3px); }
.qw-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; font-family: var(--sans); }
.qw-ctl2 { display: flex; align-items: center; gap: 8px; }
.qw-seg { display: inline-flex; flex-wrap: wrap; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 3px; gap: 2px; }
.qw-seg button { font-family: var(--sans); font-size: .84rem; font-weight: 600; color: rgb(var(--c-ink-2)); background: transparent; border: none; border-radius: 999px; padding: 7px 14px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.qw-seg button small { font-weight: 500; font-size: .72rem; color: rgb(var(--c-ink-3)); margin-left: 3px; }
.qw-seg button:hover { color: rgb(var(--c-ink)); }
.qw-seg button[aria-selected="true"], .qw-seg button[aria-pressed="true"] { background: rgb(var(--c-amber-soft)); color: rgb(var(--c-ink)); box-shadow: inset 0 0 0 1px rgb(var(--c-amber-line)); }
.qw-seg button:focus-visible, .qw-v:focus-visible, .qw-name:focus-visible { outline: 2px solid rgb(var(--c-amber)); outline-offset: 2px; }
.qw-seg--sm button { padding: 6px 12px; font-size: .8rem; }
.qw-note { font-family: var(--sans); font-size: .84rem; color: rgb(var(--c-ink-3)); margin: 0 0 14px; }
.qw-insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.qw-card { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 8px; padding: 14px 16px; font-family: var(--sans); font-size: .84rem; animation: qwIn .35s ease both; }
.qw-card:nth-child(2) { animation-delay: .04s; } .qw-card:nth-child(3) { animation-delay: .08s; } .qw-card:nth-child(4) { animation-delay: .12s; }
@keyframes qwIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.qw-card__k { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--c-ink-3)); margin-bottom: 8px; }
.qw-card__l { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.qw-card__l li { color: rgb(var(--c-ink-2)); line-height: 1.35; }
.qw-card__l a { color: rgb(var(--c-ink)); text-decoration: none; border-bottom: 1px solid rgb(var(--c-line)); }
.qw-card__l a:hover { border-bottom-color: rgb(var(--c-amber)); }
.qw-card__l b { color: rgb(var(--c-ink)); }
.qw-card__l span { color: rgb(var(--c-ink-3)); font-size: .78rem; }
.qw-card__l--t li > span:first-child { color: rgb(var(--c-ink)); font-size: .84rem; font-weight: 600; }
.qw-card__p { margin: 0; color: rgb(var(--c-ink-3)); }
.qw-more { color: rgb(var(--c-ink-3)); font-size: .78rem; }
.qw-wrap { overflow-x: auto; border: 1px solid rgb(var(--c-line)); border-radius: 8px; background: rgb(var(--c-surface)); -webkit-overflow-scrolling: touch; }
.qw-table { border-collapse: separate; border-spacing: 0; width: 100%; font-family: var(--sans); font-size: .84rem; }
.qw-table th, .qw-table td { border-bottom: 1px solid rgb(var(--c-line-2)); padding: 0; text-align: center; }
.qw-table thead th { position: sticky; top: 0; background: rgb(var(--c-surface)); z-index: 2; font-size: .72rem; font-weight: 600; color: rgb(var(--c-ink-3)); padding: 8px 3px; border-bottom: 1px solid rgb(var(--c-line)); vertical-align: bottom; }
.qw-p span { display: block; line-height: 1.2; }
.qw-p span:first-child { color: rgb(var(--c-ink-2)); }
.qw-p em { display: block; font-style: normal; font-size: .64rem; color: rgb(var(--c-ink-3)); }
.qw-ch { position: sticky; left: 0; z-index: 1; background: rgb(var(--c-surface)); text-align: left !important; min-width: 220px; max-width: 260px; border-right: 1px solid rgb(var(--c-line)); }
.qw-table thead .qw-ch { z-index: 3; padding-left: 14px; }
.qw-name { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; font: inherit; color: rgb(var(--c-ink)); background: none; border: none; padding: 9px 10px 9px 14px; cursor: pointer; line-height: 1.3; }
.qw-name b { font-family: var(--serif); color: rgb(var(--c-amber)); min-width: 1.3em; }
.qw-name span { font-weight: 500; }
button.qw-name:hover span { text-decoration: underline; text-decoration-color: rgb(var(--c-amber)); text-underline-offset: 3px; }
.qw-name[aria-expanded="true"] span { font-weight: 700; }
.qw-name--x { cursor: default; color: rgb(var(--c-ink-3)); font-style: italic; }
.qw-c { min-width: 38px; padding: 3px 2px !important; }
.qw-v { font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 32px; padding: 5px 4px; border-radius: 5px; border: 1px solid transparent; cursor: pointer; color: rgb(var(--c-ink)); background: rgb(var(--c-amber) / var(--a)); transition: transform .15s ease, box-shadow .15s ease; }
.qw-v:hover { transform: scale(1.08); box-shadow: 0 1px 4px rgb(0 0 0 / .15); }
.qw-v[aria-expanded="true"] { border-color: rgb(var(--c-ink)); }
.qw-dot { color: rgb(var(--c-ink-3) / .6); }
.qw-s { padding: 4px 10px !important; white-space: nowrap; font-variant-numeric: tabular-nums; color: rgb(var(--c-ink-2)); }
.qw-s b { color: rgb(var(--c-ink)); }
.qw-table thead .qw-s { padding: 8px 10px; }
.qw-tr { text-align: left !important; min-width: 150px; }
.qw-spark { vertical-align: middle; margin-right: 6px; }
.qw-spark path { fill: none; stroke: rgb(var(--c-amber)); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.qw-spark circle { fill: rgb(var(--c-amber)); }
.qw-t { font-size: .76rem; font-weight: 600; }
.qw-up { color: rgb(var(--c-green-ink)); } .qw-down { color: rgb(var(--c-red-ink)); } .qw-flat { color: rgb(var(--c-ink-3)); }
.qw-row--x th, .qw-row--x td { background: rgb(var(--c-line-2) / .5); }
.qw-row--x .qw-v { background: rgb(var(--c-ink-3) / calc(var(--a) * .5)); }
.qw-row:hover > th, .qw-row:hover > td { background-color: rgb(var(--c-amber-soft) / .45); }
.qw-table tfoot th, .qw-table tfoot td { border-bottom: none; border-top: 1px solid rgb(var(--c-line)); }
.qw-tot { font-weight: 600; font-variant-numeric: tabular-nums; color: rgb(var(--c-ink-2)); padding: 8px 2px !important; }
.qw-d > td { text-align: left !important; background: rgb(var(--c-bg)); padding: 0 !important; }
.qw-d__in { position: sticky; left: 0; max-width: min(100%, 92vw); padding: 14px 16px 12px; animation: qwIn .25s ease both; }
.qw-d__h { font-weight: 700; color: rgb(var(--c-ink)); margin-bottom: 8px; }
.qw-qs { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.qw-qs li { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: baseline; }
.qw-qs a, .qw-qs li > span:first-child { font-weight: 600; white-space: nowrap; }
.qw-qs em { font-style: normal; font-weight: 500; color: rgb(var(--c-ink-3)); }
.qw-mk { color: rgb(var(--c-green-ink)); white-space: nowrap; font-size: .78rem; }
.qw-why { color: rgb(var(--c-ink-2)); }
.qw-tops { display: flex; flex-wrap: wrap; gap: 6px; }
.qw-top { font-size: .8rem; font-weight: 600; text-decoration: none; color: rgb(var(--c-ink)); background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 999px; padding: 4px 10px; transition: border-color .2s ease; }
.qw-top:hover { border-color: rgb(var(--c-amber)); }
.qw-top b { color: rgb(var(--c-amber)); margin-left: 3px; }
.qw-d__f { margin: 10px 0 0; font-size: .82rem; }
.qw-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-family: var(--sans); font-size: .78rem; color: rgb(var(--c-ink-3)); margin: 10px 0 22px; }
.qw-legend__scale { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 4px; }
.qw-legend__scale i { width: 16px; height: 12px; border-radius: 3px; background: rgb(var(--c-amber) / var(--a)); }
.qw-how { font-size: .92rem; }
.qw-swipe { display: none; font-family: var(--sans); font-size: .76rem; color: rgb(var(--c-ink-3)); margin: 0 0 6px; }
@media (max-width: 960px) { .qw-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .qw-controls { flex-direction: column; align-items: stretch; }
  .qw-seg { display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; }
  .qw-seg button { border-radius: 9px; }
  .qw-ctl2 { justify-content: space-between; }
  .qw-seg--sm { display: inline-flex; flex-wrap: nowrap; border-radius: 999px; }
  .qw-seg--sm button { border-radius: 999px; }
  .qw-insights { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px 18px; padding: 0 16px 4px; scrollbar-width: none; }
  .qw-insights::-webkit-scrollbar { display: none; }
  .qw-card { flex: 0 0 78%; scroll-snap-align: start; }
  .qw-swipe { display: block; }
  .qw-ch { min-width: 132px; max-width: 150px; }
  .qw-name { padding: 8px 6px 8px 10px; gap: 5px; font-size: .78rem; }
  .qw-name span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .qw-tr { min-width: 120px; }
  .qw-qs li { grid-template-columns: auto 1fr; }
  .qw-why { grid-column: 1 / -1; }
  .qb-switch { flex-wrap: nowrap; }
  .qw-cta { grid-template-columns: 1fr auto; }
  .qw-cta__k { grid-row: auto; justify-self: start; margin-bottom: 6px; }
  .qw-cta__t, .qw-cta__d { grid-column: 1; }
  .qw-cta__go { grid-row: 1 / 4; }
}
@media (prefers-reduced-motion: reduce) { .qw-card, .qw-d__in { animation: none; } .qw-v, .qw-cta { transition: none; } }

@media (max-width: 860px) {
  .qb-entry { padding: 18px 16px 14px; }
  .qb-q p.l1, .qb-a p.l1 { padding-left: 1em; } .qb-q p.l2, .qb-a p.l2 { padding-left: 2em; }
  .qb-q p.l3, .qb-a p.l3 { padding-left: 2.6em; } .qb-q p.l4, .qb-a p.l4 { padding-left: 3.2em; }
  .qb-chapters a { grid-template-columns: 2.4em minmax(0, 1fr); }
  .qb-chapters .c { grid-column: 2; text-align: left; white-space: normal; }
}
@media (max-width: 760px) {
  .qb-toolbar { top: 60px; }
  .qb-tb__filters { display: inline-flex; }
  .qb-fpanel { display: none; order: 3; width: 100%; padding: 8px 0 4px; display: none; grid-template-columns: 1fr 1fr; gap: 8px; }
  .qb-fpanel.is-open { display: grid; }
  .qb-sel, .qb-sel--topic { max-width: none; width: 100%; padding-top: 8px; padding-bottom: 8px; }
  .qb-sel--topic, .qb-sel--sort { grid-column: 1 / -1; }
  .qb-chip span { display: block; padding: 8px 12px; }
  .qb-clear { justify-self: start; }
  .qb-count { margin-right: auto; font-size: .76rem; }
  .qb-count:not(.is-on) { display: none; }
  .qb-tb { gap: 6px; }
  .qb-tb__right { gap: 6px; }
  .qb-tb__btn { padding: 6px 10px; }
  .qb-tb__right { margin-left: 0; flex: 1; justify-content: flex-end; }
  .qb-hero--ch { padding: 26px 0 16px; }
  .qb-hero__row { flex-direction: column; align-items: flex-start; }
  .qb-switch { width: 100%; }
  .qb-sel.qb-sel--ch { flex: 1; min-width: 0; max-width: 100%; }
  .qb-q p, .qb-a p { hyphens: auto; -webkit-hyphens: auto; }
  .qb-q p.li.l1, .qb-a p.li.l1 { padding-left: .35em; } .qb-q p.li.l2, .qb-a p.li.l2 { padding-left: .8em; }
  .qb-q p.li.l3, .qb-a p.li.l3 { padding-left: 1.2em; } .qb-q p.li.l4, .qb-a p.li.l4 { padding-left: 1.6em; }
  .qb-q p.li, .qb-a p.li { gap: .35em; }
  .qb-q p.li > .mk, .qb-a p.li > .mk { min-width: 1.7em; }
}
@media (max-width: 380px) {
  #qb-all { padding: 6px 10px; }
}
@media print {
  .site-nav, .qb-toolbar, .qb-toggle, footer { display: none !important; }
  .qb-answer[hidden] { display: block !important; }
}
body { overflow-x: clip; }
/* the site's off-canvas menu sits to the right of the screen; keep phones from panning sideways to it */
html { overflow-x: clip; }

/* handwritten "thought cloud" hint pointing at Sort & filter: phones only, shown each time a chapter page loads */
.qb-hint { display: none; }
@media (max-width: 760px) {
  .qb-tb { position: relative; }
  .qb-hint { display: block; position: absolute; left: 8px; top: calc(100% + 14px); z-index: 30; max-width: min(232px, calc(100vw - 44px)); cursor: pointer;
    opacity: 0; transform: translateY(-6px) scale(.85); transform-origin: 58px 0; pointer-events: none; transition: opacity .3s ease; }
  .qb-hint[hidden] { display: none; }
  .qb-hint.is-on { opacity: 1; transform: none; pointer-events: auto; animation: qb-hint-pop .55s cubic-bezier(.34,1.56,.64,1) both, qb-hint-bob 3.2s ease-in-out .6s infinite; }
  .qb-hint__t { display: block; position: relative; padding: 9px 14px 10px; border-radius: 20px 24px 22px 18px / 18px 20px 24px 22px; border: 1.5px solid rgb(var(--c-amber)); background: rgb(var(--c-surface)); color: rgb(var(--c-ink));
    font-family: "Bradley Hand", "Segoe Print", "Chalkboard SE", "Comic Neue", "Comic Sans MS", "Marker Felt", cursive; font-size: 1rem; line-height: 1.28; font-weight: 600;
    box-shadow: 0 6px 14px -8px rgb(0 0 0 / .4), 2px 2px 0 rgb(var(--c-amber) / .35); transform: rotate(-1.5deg); }
  .qb-hint__t::after { content: "\2726"; position: absolute; right: -7px; top: -9px; font-size: 1rem; line-height: 1; color: rgb(var(--c-amber)); transform: rotate(12deg); animation: qb-hint-twinkle 2.4s ease-in-out infinite; }
  .qb-hint__x { position: absolute; right: -9px; bottom: -9px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.5px solid rgb(var(--c-amber)); background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); font: 700 15px/1 system-ui, sans-serif; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px -2px rgb(0 0 0 / .4); }
  .qb-hint__x::before { content: ""; position: absolute; inset: -10px; }
  .qb-hint__dots { position: absolute; left: 54px; top: -12px; width: 14px; height: 12px; }
  .qb-hint__dots i { position: absolute; border-radius: 50%; border: 1.5px solid rgb(var(--c-amber)); background: rgb(var(--c-surface)); }
  .qb-hint__dots i:nth-child(1) { width: 5px; height: 5px; left: 1px; top: 0; }
  .qb-hint__dots i:nth-child(2) { width: 8px; height: 8px; left: 4px; top: 4px; }
}
@keyframes qb-hint-pop { 0% { opacity: 0; transform: translateY(-8px) scale(.6) rotate(-4deg); } 100% { opacity: 1; transform: none; } }
@keyframes qb-hint-twinkle { 0%, 100% { transform: rotate(12deg) scale(1); opacity: 1; } 50% { transform: rotate(32deg) scale(.7); opacity: .6; } }
@keyframes qb-hint-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@media (prefers-reduced-motion: reduce) { .qb-hint.is-on, .qb-hint__t::after { animation: none; } .qb-hint { transition: none; } }
@media print { .qb-hint { display: none !important; } }

.qb-copy { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: .86rem; font-weight: 600; padding: 8px 14px; border-radius: 4px; border: 1.5px solid rgb(var(--c-ink) / .2); background: transparent; color: rgb(var(--c-ink-2)); cursor: pointer; }
.qb-copy:hover, .qb-copy:focus-visible { border-color: rgb(var(--c-amber)); color: rgb(var(--c-ink)); }
.qb-copy.is-done { background: rgb(var(--c-green-soft)); border-color: rgb(var(--c-green-line)); color: rgb(var(--c-green-ink)); }
@media print { .qb-copy { display: none !important; } }

/* ---------- Save for revision, Mark solved (qb-me.js) ---------- */
.qb-me { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.qb-me__b { display: inline-flex; white-space: nowrap; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid rgb(var(--c-line)); background: transparent; color: rgb(var(--c-ink-2)); font: 600 .82rem var(--sans); cursor: pointer; transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease; }
.qb-me__b:hover { color: rgb(var(--c-ink)); border-color: rgb(var(--c-ink-3)); }
.qb-me__b:active { transform: scale(.97); }
.qb-me__b:focus-visible { outline: 2px solid rgb(var(--c-amber)); outline-offset: 2px; }
.qb-me__b--rev[aria-pressed="true"] { color: rgb(var(--c-amber)); border-color: rgb(var(--c-amber-line)); background: rgb(var(--c-amber-soft)); }
.qb-me__b--rev[aria-pressed="true"] svg { fill: currentColor; }
.qb-me__b--done[aria-pressed="true"] { color: rgb(var(--c-green-ink)); border-color: rgb(var(--c-green-line)); background: rgb(var(--c-green-soft)); }
.qb-me__b--done[aria-pressed="true"] svg circle { fill: currentColor; stroke: currentColor; }
.qb-me__b--done[aria-pressed="true"] svg path { stroke: rgb(var(--c-green-soft)); }
.qb-entry.is-solved { box-shadow: inset 4px 0 0 rgb(var(--c-green-ink) / .75); }
.qb-entry.is-rev:not(.is-solved) { box-shadow: inset 4px 0 0 rgb(var(--c-amber) / .8); }
.qb-mesum { font: 500 .8rem var(--sans); color: rgb(var(--c-ink-2)); white-space: nowrap; margin-right: 6px; }
.pq-chip.qb-mesum { margin-right: 0; border-color: rgb(var(--c-green-line)); background: rgb(var(--c-green-soft)); color: rgb(var(--c-green-ink)); }
.pq-chip.qb-mesum span { color: rgb(var(--c-green-ink) / .75); }
.qb-mesum b { color: rgb(var(--c-green-ink)); font-weight: 700; }
.qb-mesum span { color: rgb(var(--c-ink-3)); }
.qb-sel--me { max-width: 170px; }
.qbme-dlg { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.qbme-dlg__scrim { position: absolute; inset: 0; background: rgba(16,20,30,.42); opacity: 0; transition: opacity .2s ease; }
.qbme-dlg__box { position: relative; width: min(420px, 100%); padding: 26px 26px 22px; border-radius: 20px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); box-shadow: 0 40px 80px -30px rgba(0,0,0,.45); transform: translateY(10px) scale(.98); opacity: 0; transition: transform .22s cubic-bezier(.22,.61,.36,1), opacity .22s ease; }
.qbme-dlg.is-on .qbme-dlg__scrim { opacity: 1; }
.qbme-dlg.is-on .qbme-dlg__box { transform: none; opacity: 1; }
.qbme-dlg__i { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: rgb(var(--c-amber-soft)); color: rgb(var(--c-amber)); margin-bottom: 12px; }
.qbme-dlg__i svg { width: 22px; height: 22px; }
.qbme-dlg h2 { margin: 0 0 8px; font: 600 1.35rem/1.2 var(--serif); letter-spacing: -.01em; color: rgb(var(--c-ink)); }
.qbme-dlg p { margin: 0 0 18px; font: 400 .92rem/1.55 var(--sans); color: rgb(var(--c-ink-2)); max-width: none; }
.qbme-dlg__a { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qbme-dlg__a button { min-height: 44px; padding: 0 18px; border-radius: 12px; font: 600 .88rem var(--sans); cursor: pointer; border: 1px solid rgb(var(--c-line)); background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); }
.qbme-dlg__a .qbme-go { background: rgb(var(--c-amber)); border-color: rgb(var(--c-amber)); color: #fff; }
:root[data-theme="dark"] .qbme-dlg__a .qbme-go { color: #16181D; }
.qbme-dlg__a .qbme-txt { border-color: transparent; color: rgb(var(--c-ink-2)); margin-left: auto; }
@media (max-width: 760px) {
  .qb-me { width: 100%; }
  .qb-me__b { flex: 1 1 0; min-width: 0; justify-content: center; height: 40px; padding: 0 8px; gap: 5px; font-size: .78rem; white-space: nowrap; }
  .qbme-dlg { align-items: flex-end; padding: 0; }
  .qbme-dlg__box { width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
@media print { .qb-me, .qb-mesum { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .qbme-dlg__box, .qbme-dlg__scrim, .qb-me__b { transition: none; } }
