/* ============================================================
   PREVIOUS YEAR PAPERS (PYP)
   Loaded only on /previous-year-papers* pages.

   Colours come from the theme variables that includes/header.php
   injects from Admin > Appearance, so the gold accent follows the
   site setting instead of being hard-coded here.
   ============================================================ */

/* On :root, not on .pyp-page: the similar-question modal is appended to
   <body>, outside the page wrapper, and inside it these would otherwise
   resolve to nothing - which is why its panels and right/wrong colours
   came out unstyled. */
:root {
    --pyp-radius: 16px;
    --pyp-shadow: 0 12px 32px rgba(14, 20, 36, .06);
    --pyp-chip-bg: #e9ebf0;
    --pyp-hint-bg: #faf8f4;
    --pyp-answer-bg: #effaf3;
    --pyp-success: #16a34a;
    --pyp-danger: #dc2626;
}

.pyp-page {
    background: #fff;
    font-family: 'Google Sans', sans-serif;
}

/* ── Dark inner-page hero (matches /student-journeys) ───────── */
.pyp-hero { background: #0d1117; color: #e6e9ef; padding: 28px 0 34px; }
.pyp-hero--short { padding: 26px 0 30px; }

.pyp-breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    font-size: 13px; color: #8b93a7; margin-bottom: 22px;
}
.pyp-breadcrumb a { color: var(--xep-accent-ink); text-decoration: none; }
.pyp-breadcrumb a:hover { color: var(--xep-accent); text-decoration: underline; }
.pyp-breadcrumb i { font-size: 10px; opacity: .6; }

.pyp-hero h1 {
    font-family: 'Google Sans', sans-serif; font-weight: 600;
    font-size: clamp(28px, 4vw, 50px); line-height: 1.06; letter-spacing: -.8px;
    color: #fff; margin: 0 0 16px;
}
.pyp-hero--short h1 { font-size: clamp(26px, 3.4vw, 40px); margin-bottom: 0; }
.pyp-hero p { font-size: 17px; line-height: 1.6; color: #a9b1c2; max-width: 900px; margin: 0; }

/* ── Exam switcher in the hero (Concept-wise page only) ─────── */
/* The row exists so the button lines up with the middle of the H1
   rather than with the breadcrumb above it. */
.pyp-hero-row {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.pyp-hero-row h1 { min-width: 0; }

.pyp-exam-switch { position: relative; flex: 0 0 auto; }
.pyp-exam-btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'Google Sans', sans-serif; font-size: 15px; font-weight: 600;
    color: #fff; background: transparent;
    border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px;
    padding: 10px 18px; cursor: pointer; white-space: nowrap;
    transition: background .18s ease, border-color .18s ease;
}
.pyp-exam-btn i { font-size: 12px; transition: transform .18s ease; }
.pyp-exam-btn:hover,
.pyp-exam-btn:focus-visible {
    background: rgba(255, 255, 255, .10); border-color: rgba(255, 255, 255, .45);
}
.pyp-exam-btn:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }
.pyp-exam-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.pyp-exam-btn[disabled] { cursor: default; opacity: .65; }
.pyp-exam-btn[disabled] i { display: none; }

.pyp-exam-menu {
    /* Above the sticky filter panel (40), which the menu hangs over. */
    position: absolute; top: calc(100% + 4px); right: 0; z-index: 60;
    min-width: 100%; margin: 0; padding: 6px; list-style: none;
    background: #fff; border: 1px solid rgba(14, 20, 36, .10); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(14, 20, 36, .18);
}
.pyp-exam-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    font-family: 'Google Sans', sans-serif; font-size: 14px; color: var(--xep-ink);
    padding: 10px 14px; border-radius: 8px; text-decoration: none; white-space: nowrap;
}
a.pyp-exam-item:hover,
a.pyp-exam-item:focus-visible { background: #f5f6fa; }
a.pyp-exam-item:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: -2px; }
.pyp-exam-item.is-current { color: var(--xep-muted); cursor: default; }
.pyp-exam-item.is-current i { font-size: 12px; color: var(--xep-accent); }

/* ── Body area under the hero ───────────────────────────────── */
.pyp-body { padding: 36px 0 90px; background: #fff; }
.pyp-body--soft { background: var(--xep-soft); }

/* ── Category pill switcher (same component as the homepage) ──
   Left-aligned so its edge lines up with the exam cards below. */
.pyp-tabs-wrap { display: flex; justify-content: flex-start; margin-bottom: 34px; }
.pyp-tabs {
    display: inline-flex; background: var(--xep-soft); border: 1px solid var(--xep-line);
    border-radius: 999px; padding: 6px; gap: 4px; max-width: 100%;
}
.pyp-tab {
    border: none; background: transparent; cursor: pointer; padding: 8px 22px;
    border-radius: 999px; font-family: 'Google Sans', sans-serif; font-size: 15px;
    font-weight: 600; color: var(--xep-muted); white-space: nowrap;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.pyp-tab.active { background: #fff; color: var(--xep-ink); box-shadow: 0 4px 14px rgba(14, 20, 36, .08); }
.pyp-tab:hover:not(.active) { color: var(--xep-ink); }
.pyp-tab:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }

/* ── Exam rows (Page A) ─────────────────────────────────────── */
.pyp-exams { display: flex; flex-direction: column; gap: 16px; }
.pyp-exam-row {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: #fff; border: 1px solid var(--xep-line); border-radius: var(--pyp-radius);
    box-shadow: var(--pyp-shadow); padding: 20px 24px;
}
.pyp-exam-info { min-width: 0; }
.pyp-exam-name {
    font-family: 'Google Sans', sans-serif; font-size: 20px; font-weight: 600;
    color: var(--xep-ink); margin: 0; letter-spacing: -.2px;
}
.pyp-exam-desc { font-size: 14px; color: var(--xep-muted); margin: 4px 0 0; line-height: 1.5; }
.pyp-exam-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Buttons ────────────────────────────────────────────────── */
.pyp-btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 600;
    padding: 10px 20px; border-radius: 999px; border: 1px solid var(--xep-line);
    background: #fff; color: var(--xep-ink); cursor: pointer; text-decoration: none;
    white-space: nowrap; transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.pyp-btn:hover { border-color: var(--xep-accent-ink); color: var(--xep-accent-ink); }
.pyp-btn:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }
/* An author-set display beats the browser's own [hidden] rule, so say it here. */
.pyp-btn[hidden] { display: none; }
.pyp-btn i { font-size: 13px; }

.pyp-btn-accent { background: var(--xep-accent); border-color: var(--xep-accent); color: #fff; }
.pyp-btn-accent:hover { background: var(--xep-accent-ink); border-color: var(--xep-accent-ink); color: #fff; }

/* Active (expanded) state for the Hint / Answer / Explanation toggles */
.pyp-btn.is-open { border-color: var(--xep-accent); color: var(--xep-accent-ink); background: #fff; }

.pyp-similar-link {
    border: none; background: none; padding: 0; cursor: pointer;
    font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 600;
    color: var(--xep-accent-ink); white-space: nowrap;
}
.pyp-similar-link:hover { text-decoration: underline; }
.pyp-similar-link:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 3px; border-radius: 4px; }

/* ── Empty states ───────────────────────────────────────────── */
.pyp-empty {
    text-align: center; padding: 56px 20px; color: var(--xep-muted); font-size: 16px;
    background: var(--xep-soft); border: 1px dashed var(--xep-line); border-radius: var(--pyp-radius);
}
.pyp-empty .pyp-btn { margin-top: 16px; }

/* ── Toolbar (Page B) ─────────────────────────────────────────
   Year and Section on the left, "Filter Concept-wise" pushed to
   the far right of the same row. */
.pyp-toolbar {
    display: flex; flex-wrap: wrap; align-items: flex-end;
    justify-content: space-between; gap: 16px; margin-bottom: 26px;
}
.pyp-toolbar-left { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.pyp-toolbar-right { display: flex; align-items: flex-end; }
.pyp-field { display: flex; flex-direction: column; gap: 6px; }
.pyp-field label {
    font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--xep-muted);
}
.pyp-select {
    appearance: none; -webkit-appearance: none;
    font-family: 'Google Sans', sans-serif; font-size: 15px; color: var(--xep-ink);
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7384' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
    border: 1px solid var(--xep-line); border-radius: 12px; padding: 11px 42px 11px 16px;
    min-width: 200px; cursor: pointer;
}
.pyp-select:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 1px; }

.pyp-count { font-size: 15px; color: var(--xep-muted); margin: 0 0 18px; }
.pyp-count strong { color: var(--xep-ink); font-weight: 600; }

/* ── Question card ──────────────────────────────────────────── */
.pyp-list { display: flex; flex-direction: column; gap: 20px; }

.pyp-card {
    background: #fff; border: 1px solid var(--xep-line); border-radius: var(--pyp-radius);
    box-shadow: var(--pyp-shadow); padding: 24px;
}

/* "Question 3" on its own line, then one plain meta line under it. */
.pyp-card-head { margin-bottom: 14px; }
.pyp-qno { font-size: 16px; font-weight: 600; color: var(--xep-ink); margin: 0; }
.pyp-meta {
    margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: var(--xep-muted);
}
/* The separating middle dot is drawn here, so the text itself stays clean.
   Set large and spaced, because at 13px it was too faint to read. */
.pyp-meta-item + .pyp-meta-item::before {
    content: "·"; font-size: 20px; line-height: 0; vertical-align: middle;
    color: #9aa1b1; margin: 0 10px;
}
.pyp-meta-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 6px; vertical-align: 0;
}

/* Directions above the question, in ordinary body text. */
.pyp-q-instruction { font-size: 16px; line-height: 1.6; color: var(--xep-body); margin-bottom: 12px; }
.pyp-q-instruction p:first-child { margin-top: 0; }
.pyp-q-instruction p:last-child { margin-bottom: 0; }

/* The question itself sits in a band a shade darker than the card. */
.pyp-q-body {
    font-size: 16px; line-height: 1.6; color: var(--xep-ink);
    background: #eef0f4; border-radius: 12px; padding: 14px 18px;
}
.pyp-q-body p:first-child { margin-top: 0; }
.pyp-q-body p:last-child { margin-bottom: 0; }

.pyp-q-figure { margin: 14px 0 0; }
.pyp-q-figure img { max-width: 100%; height: auto; border-radius: 12px; display: block; }

/* Options */
.pyp-options { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.pyp-option {
    /* Top-aligned, so a multi-line answer starts level with its letter.
       One explicit line-height for the whole row is what makes that work:
       the letter and the answer then share a line box, so they sit on the
       same baseline and the circle can be centred on it exactly. */
    display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
    font-family: 'Google Sans', sans-serif; font-size: 15px; line-height: 1.5;
    color: var(--xep-body);
    background: #fff; border: 1px solid var(--xep-line); border-radius: 12px;
    padding: 12px 16px; cursor: pointer; transition: background .18s ease, border-color .18s ease;
}
.pyp-option:hover { background: var(--xep-soft); }
.pyp-option:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }
.pyp-option-radio {
    /* Half the leftover of one line box centres the circle on that line box,
       then 0.045em lifts it onto the centre of the letter's ink: capitals and
       digits carry no descender, so they sit that much above the line centre. */
    flex: 0 0 auto; width: 18px; height: 18px;
    margin-top: calc((1.5em - 18px) / 2 - 0.045em);
    border-radius: 50%;
    border: 2px solid #c3c8d4; background: #fff; transition: border-color .18s ease;
}
.pyp-option[aria-checked="true"] { border-color: var(--xep-accent); background: #fff; }
.pyp-option[aria-checked="true"] .pyp-option-radio {
    border-color: var(--xep-accent); box-shadow: inset 0 0 0 4px var(--xep-accent);
}
/* Everything on the row takes the row's own size and line box. The theme's
   phone typography tier (below 620px) sets "span" to 13px and "p" to 15px
   with !important, which put the letter and the answer on baselines 2px
   apart; these overrides are scoped to the option row only. */
.pyp-option .pyp-option-label,
.pyp-option .pyp-option-text,
.pyp-option .pyp-option-text p { font-size: inherit !important; line-height: inherit; }
.pyp-option-label {
    flex: 0 0 auto; font-weight: 600; color: var(--xep-ink); min-width: 16px;
}
.pyp-option-text { min-width: 0; flex: 1 1 auto; }
.pyp-option-text p { margin: 0; }
.pyp-option-mark { flex: 0 0 auto; font-weight: 600; font-size: 13px; line-height: inherit; }

/* Graded states (popup) */
.pyp-option.is-correct { border-color: var(--pyp-success); background: var(--pyp-answer-bg); }
.pyp-option.is-correct .pyp-option-mark::after { content: "✓"; color: var(--pyp-success); }
.pyp-option.is-wrong { border-color: var(--pyp-danger); background: #fdf2f2; }
.pyp-option.is-wrong .pyp-option-mark::after { content: "✕"; color: var(--pyp-danger); }

/* Instant right/wrong feedback (A4) */
.pyp-options.is-answered .pyp-option { cursor: default; }
.pyp-options.is-answered .pyp-option:hover { background: #fff; }
.pyp-options.is-answered .pyp-option.is-correct:hover { background: var(--pyp-answer-bg); }
.pyp-options.is-answered .pyp-option.is-wrong:hover { background: #fdeded; }
.pyp-option.is-wrong { border-color: var(--pyp-danger); background: #fdeded; }
.pyp-option.is-correct .pyp-option-radio { border-color: var(--pyp-success); box-shadow: inset 0 0 0 4px var(--pyp-success); }
.pyp-option.is-wrong .pyp-option-radio { border-color: var(--pyp-danger); box-shadow: inset 0 0 0 4px var(--pyp-danger); }

.pyp-answer-summary {
    margin: 10px 0 0; font-size: 13px; color: var(--xep-muted);
}
.pyp-answer-summary b { font-weight: 600; }
.pyp-answer-summary .pyp-sum-right { color: var(--pyp-success); }
.pyp-answer-summary .pyp-sum-wrong { color: var(--pyp-danger); }

/* Short answer */
.pyp-short { margin-top: 18px; }
.pyp-short-label { display: block; font-size: 13px; color: var(--xep-muted); margin-bottom: 6px; }
.pyp-short-input {
    width: 100%; max-width: 360px; font-family: 'Google Sans', sans-serif; font-size: 15px;
    color: var(--xep-ink); border: 1px solid var(--xep-line); border-radius: 12px; padding: 12px 16px;
}
.pyp-short-input:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 1px; }
.pyp-short-input.is-correct { border-color: var(--pyp-success); background: var(--pyp-answer-bg); }
.pyp-short-input.is-wrong { border-color: var(--pyp-danger); background: #fdf2f2; }
/* Printed under the box when "Correct Answer" is opened on a typed question. */
.pyp-short-reveal {
    max-width: 360px; margin: 10px 0 0; padding: 10px 16px;
    font-size: 15px; color: var(--pyp-success);
    background: var(--pyp-answer-bg); border: 1px solid var(--pyp-success); border-radius: 12px;
}
.pyp-short-reveal b { font-weight: 600; }

/* Action row */
.pyp-actions {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 12px; margin-top: 18px;
}
.pyp-actions-left { display: flex; flex-wrap: wrap; gap: 10px; }

/* Expand panels */
.pyp-panels { display: flex; flex-direction: column; }
.pyp-panel { overflow: hidden; }
.pyp-panel[hidden] { display: none !important; }
.pyp-panel-inner {
    margin-top: 16px; border-radius: 12px; padding: 16px 18px;
    font-size: 15px; line-height: 1.65; color: var(--xep-body);
}
.pyp-panel--hint .pyp-panel-inner { background: var(--pyp-hint-bg); border: 1px solid rgba(172, 142, 77, .18); }
.pyp-panel--answer .pyp-panel-inner { background: var(--pyp-answer-bg); border: 1px solid rgba(22, 163, 74, .18); }
/* White, so the white background of a pasted screenshot blends in
   instead of showing as a rectangle on a tinted panel. */
.pyp-panel--explanation .pyp-panel-inner {
    background: #ffffff;
    border: 1px solid rgba(14, 20, 36, 0.10);
    border-radius: 12px;
}

.pyp-panel-title {
    font-family: 'Google Sans', sans-serif; font-size: 13px; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase; color: var(--xep-muted);
    margin: 0 0 8px;
}
.pyp-answer-line { margin: 0; font-size: 16px; color: var(--xep-ink); }
.pyp-answer-line strong { color: var(--pyp-success); }

.pyp-rich p:first-child { margin-top: 0; }
.pyp-rich p:last-child { margin-bottom: 0; }
.pyp-rich img { max-width: 100%; height: auto; border-radius: 10px; }
/* Tables look the same wherever they are written.
   They used to be styled only inside .pyp-rich - the hint, answer and
   explanation panels - so a table typed into the question itself, or into
   an option, came out with no rules and no padding: the columns ran into
   each other and it read as broken text. That is why tables were being
   pasted in as images instead. */
.pyp-rich table,
.pyp-q-instruction table,
.pyp-q-body table,
.pyp-option-text table {
    border-collapse: collapse; width: auto; max-width: 100%; margin: 10px 0;
    font-size: inherit;
}
.pyp-rich th, .pyp-rich td,
.pyp-q-instruction th, .pyp-q-instruction td,
.pyp-q-body th, .pyp-q-body td,
.pyp-option-text th, .pyp-option-text td {
    border: 1px solid rgba(14, 20, 36, .22);
    padding: 8px 12px; text-align: left; vertical-align: top;
}
.pyp-rich th,
.pyp-q-instruction th,
.pyp-q-body th,
.pyp-option-text th { background: #f5f6fa; font-weight: 600; }
/* A table is the one thing in a question that may set its own first and
   last margin, or it sits flush against the text above it. */
.pyp-q-body table:first-child { margin-top: 0; }
.pyp-q-body table:last-child { margin-bottom: 0; }

/* Explanation images sit straight on the white panel: no frame, no fill,
   no shadow, so a snipped screenshot looks like part of the page. */
.pyp-exp-figure { margin: 12px 0; }
.pyp-exp-figure:first-child { margin-top: 0; }
.pyp-exp-figure:last-child { margin-bottom: 0; }
.pyp-exp-figure img {
    max-width: 100%; height: auto; display: block;
    border: none; border-radius: 0; background: none; box-shadow: none;
    cursor: zoom-in;
}
/* Same for images pasted into the explanation HTML. */
.pyp-panel--explanation .pyp-rich img {
    border: none; border-radius: 0; background: none; box-shadow: none;
    margin: 12px 0;
}

/* Rich text can overflow on narrow screens - let the wide bit scroll inside
   itself rather than pushing the whole page sideways. */
.pyp-rich > table,
.pyp-q-instruction > table,
.pyp-q-body > table,
.pyp-option-text > table {
    display: block; overflow-x: auto; width: max-content; max-width: 100%;
}

/* ── Loading skeleton ───────────────────────────────────────── */
.pyp-skeleton { display: flex; flex-direction: column; gap: 20px; }
.pyp-skeleton-card {
    height: 190px; border-radius: var(--pyp-radius); border: 1px solid var(--xep-line);
    background: linear-gradient(90deg, #f3f4f8 25%, #e9ebf0 37%, #f3f4f8 63%);
    background-size: 400% 100%; animation: pyp-shimmer 1.3s ease infinite;
}
@keyframes pyp-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ════════════════════════════════════════════════════════════
   Page C, round 8: filters as one full-width panel above the
   results. The round 7 sidebar styles follow further down and
   are still live behind the PYP_LEGACY_FILTERS flag.
   ════════════════════════════════════════════════════════════ */
.pyp-filterbar {
    display: block; background: #fff;
    border: 1px solid rgba(14, 20, 36, .10); border-radius: 16px;
    padding: 20px 24px; margin-bottom: 24px;
    box-shadow: 0 12px 32px rgba(14, 20, 36, .06);
}

/* Two rows: the window controls alone on top, then the title, "Clear All"
   and - once collapsed - the chosen chips beneath them. */
.pyp-fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pyp-fb-title {
    font-size: 14px; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: var(--xep-ink);
}
.pyp-fb-clear {
    font-family: 'Google Sans', sans-serif; font-size: 12px; font-weight: 600;
    color: var(--xep-muted); background: none; cursor: pointer;
    border: 1px solid rgba(14, 20, 36, .14); border-radius: 8px; padding: 4px 10px;
    transition: color .18s ease, border-color .18s ease;
}
.pyp-fb-clear:hover { color: var(--xep-accent-ink); border-color: var(--xep-accent); }
/* Window-style controls: minimise, full size, hide. Deliberately plain
   grey - no traffic-light colours. */
/* A row of their own at the top left, so they read as window controls on
   the panel rather than as part of the title line. */
.pyp-fb-tools {
    order: -1; flex: 0 0 100%;
    display: flex; align-items: center; gap: 4px;
}
.pyp-fb-tool {
    width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
    display: grid; place-items: center; cursor: pointer; font-size: 10px;
    color: #6b7384; background: #fff; border: 1px solid rgba(14, 20, 36, .14);
    transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.pyp-fb-tool:hover { color: var(--xep-ink); background: #f5f6fa; border-color: rgba(14, 20, 36, .22); }
.pyp-fb-tool:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }
.pyp-fb-tool[hidden] { display: none; }

/* An author-set display beats the browser's own [hidden] rule. */
.pyp-filterbar[hidden] { display: none; }

/* While the panel is easing between its two heights its contents must not
   spill past the rounded edge, and whatever has just appeared fades in
   rather than popping. */
.pyp-filterbar.is-animating { overflow: hidden; }
.pyp-filterbar.is-animating .pyp-fb-rows,
.pyp-filterbar.is-animating .pyp-fb-summary {
    animation: pyp-fb-fade 220ms ease both;
}
@keyframes pyp-fb-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* The chips in the bar arrive just after it, so the eye follows them in. */
.pyp-filterbar.is-animating .pyp-fb-summary .pyp-fchip {
    animation: pyp-fb-fade 200ms ease both; animation-delay: 60ms;
}

@media (prefers-reduced-motion: reduce) {
    .pyp-filterbar.is-animating .pyp-fb-rows,
    .pyp-filterbar.is-animating .pyp-fb-summary,
    .pyp-filterbar.is-animating .pyp-fb-summary .pyp-fchip { animation: none; }
}

/* Minimised: the whole panel becomes one small pill in the same spot. */
.pyp-filterbar.is-min { padding: 10px 12px; width: max-content; margin-left: auto; cursor: pointer; }
.pyp-filterbar.is-min .pyp-fb-rows,
.pyp-filterbar.is-min .pyp-fb-summary,
.pyp-filterbar.is-min .pyp-fb-id { display: none; }
.pyp-filterbar.is-min .pyp-fb-mini { display: inline-flex; }
/* The pill is one short line: nothing left here to put on a row of its own. */
.pyp-filterbar.is-min .pyp-fb-tools { flex: 0 0 auto; }

/* The little "filters are still set" marker shown only while minimised. */
.pyp-fb-mini {
    display: none; align-items: center; gap: 8px; margin-right: 10px;
    font-size: 13px; font-weight: 600; color: var(--xep-ink);
}
.pyp-fb-mini i { font-size: 13px; color: #6b7384; }
.pyp-fb-mini-count {
    min-width: 20px; padding: 1px 6px; border-radius: 99px; text-align: center;
    background: var(--xep-accent); color: #fff; font-size: 12px; font-weight: 600;
}
.pyp-fb-mini-count[hidden] { display: none; }

/* Brought back with a small button where the panel used to be. */
.pyp-fb-restore {
    display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px;
    font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 600;
    color: var(--xep-ink); background: #fff; cursor: pointer;
    border: 1px solid rgba(14, 20, 36, .14); border-radius: 10px; padding: 9px 16px;
    transition: border-color .18s ease, background .18s ease;
}
.pyp-fb-restore:hover { border-color: var(--xep-accent); background: #f5f6fa; }
.pyp-fb-restore:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }
.pyp-fb-restore[hidden] { display: none; }
.pyp-fb-restore i { font-size: 13px; color: #6b7384; }
.pyp-fb-restore-count {
    min-width: 20px; padding: 1px 6px; border-radius: 99px;
    background: var(--xep-accent); color: #fff; font-size: 12px; font-weight: 600;
}
.pyp-fb-restore-count[hidden] { display: none; }

.pyp-fb-toggle {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer; font-size: 13px;
    color: var(--xep-ink); background: #fff; border: 1px solid rgba(14, 20, 36, .14);
    transition: border-color .18s ease, background .18s ease;
}
/* Sitting in the control cluster, it matches the three beside it. */
.pyp-fb-tools .pyp-fb-toggle {
    width: 22px; height: 22px; border-radius: 6px; font-size: 10px; color: #6b7384;
}
.pyp-fb-tools .pyp-fb-toggle:hover { color: var(--xep-ink); background: #f5f6fa; }
.pyp-fb-toggle:hover { border-color: var(--xep-accent); }
.pyp-fb-toggle i { transition: transform .22s ease; }
.pyp-fb-toggle[aria-expanded="false"] i { transform: rotate(180deg); }
.pyp-fb-toggle:focus-visible,
.pyp-fb-clear:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }

/* ── The four boxes ────────────────────────────────────────────
   Year / Section / Difficulty stack down a narrow left column and
   Concept fills the rest. Every box is a fixed height and scrolls
   inside itself, so the panel never grows with its contents. */
.pyp-fb-rows {
    /* Whole pixels on purpose: with "1fr" the three boxes came out
       190.67px tall and their 1px hairline landed on a half pixel, which
       rendered as nothing - the bottom edge looked missing. */
    --pyp-fbox-h: 190px;
    --pyp-panel-h: calc(var(--pyp-fbox-h) * 3 + 28px);
    margin-top: 16px;
    display: grid; grid-template-columns: 200px minmax(0, 1fr);
    grid-template-rows: var(--pyp-panel-h); gap: 14px;
}
.pyp-fb-side {
    display: grid; grid-template-rows: repeat(3, var(--pyp-fbox-h));
    gap: 14px; min-height: 0;
}

.pyp-fbox {
    box-sizing: border-box;
    background: #fff; border: 1px solid rgba(14, 20, 36, .10);
    border-radius: 12px; padding: 12px; min-width: 0; min-height: 0;
    display: flex; flex-direction: column;
}
.pyp-fbox-label {
    flex: 0 0 auto; margin-bottom: 8px;
    font-size: 12px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--xep-muted);
}
/* min-height:0 is what lets the body shrink inside the box and scroll. */
.pyp-fbox-body {
    flex: 1 1 auto; min-height: 0;
    /* One chip per line in the three narrow boxes - Year, Section and
       Difficulty - as asked in round 11. The Concept box is the exception
       and wraps; it sets display:block just below and its chips are laid
       out by .pyp-fgroup-chips. */
    display: flex; flex-direction: column; flex-wrap: nowrap;
    align-items: flex-start; gap: 8px;
    /* Scroll chaining stays on. With "contain" the wheel died inside the
       box even when the box had nothing left to scroll, so the page would
       not move and the panel would not fold while the pointer was over it. */
    overflow-y: scroll; padding-right: 6px;
    /* Keep the gutter even where the list happens to fit, so the boxes do
       not differ in width from one another. */
    scrollbar-gutter: stable;
}
/* A column flex item shrinks by default; these must keep their own height. */
.pyp-fbox-body > * { flex: 0 0 auto; max-width: 100%; }
.pyp-fbox--concept .pyp-fbox-body { display: block; }

/* The scrollbar stays visible rather than appearing on hover: without it
   nothing told the student the box held more than the few chips on show.
   Chrome drops the ::-webkit- styling the moment scrollbar-width or
   scrollbar-color is set, and falls back to the system bar with its arrow
   buttons - so the standard properties are kept for the engines that have
   no ::-webkit-scrollbar of their own. */
@supports not selector(::-webkit-scrollbar) {
    .pyp-fbox-body { scrollbar-width: thin; scrollbar-color: rgba(14, 20, 36, .32) rgba(14, 20, 36, .07); }
}
.pyp-fbox-body::-webkit-scrollbar { width: 8px; }
.pyp-fbox-body::-webkit-scrollbar-thumb {
    background: rgba(14, 20, 36, .32); border-radius: 8px;
    border: 2px solid transparent; background-clip: padding-box;
}
.pyp-fbox-body:hover::-webkit-scrollbar-thumb { background: rgba(14, 20, 36, .45); background-clip: padding-box; }
.pyp-fbox-body::-webkit-scrollbar-track { background: rgba(14, 20, 36, .07); border-radius: 8px; }

/* ── The round 8 full-width rows, kept for rollback ────────── */
.pyp-frow {
    display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px;
    align-items: start; padding: 14px 0; border-top: 1px solid rgba(14, 20, 36, .08);
}
.pyp-fb-rows .pyp-frow:first-child { border-top: none; padding-top: 4px; }

.pyp-frow-label {
    font-size: 12px; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--xep-muted); padding-top: 8px;
}
.pyp-frow-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.pyp-frow-empty { margin: 8px 0 0; font-size: 13px; color: var(--xep-muted); }

/* The "please pick the year first" line sits under its own row label. */
.pyp-lock-note { margin: 6px 0 0; font-size: 12px; font-weight: 500; letter-spacing: 0;
                 text-transform: none; color: var(--pyp-danger); }

/* ── Chips: rectangular with softly rounded corners ────────── */
.pyp-fchip { display: inline-flex; position: relative; cursor: pointer; }
.pyp-fchip input {
    position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: inherit;
}
.pyp-fchip-box {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'Google Sans', sans-serif; font-size: 13px; font-weight: 500;
    color: var(--xep-body); background: #fff;
    border: 1px solid rgba(14, 20, 36, .10); border-radius: 8px; padding: 7px 14px;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.pyp-fchip:hover .pyp-fchip-box { border-color: var(--xep-accent); }
.pyp-fchip input:checked + .pyp-fchip-box {
    background: #faf3e4; border-color: var(--xep-accent); color: var(--xep-ink); font-weight: 600;
}
.pyp-fchip input:focus-visible + .pyp-fchip-box {
    outline: 2px solid var(--xep-accent); outline-offset: 2px;
}
.pyp-fchip-count { color: var(--xep-muted); font-weight: 500; }
.pyp-fchip input:checked + .pyp-fchip-box .pyp-fchip-count { color: var(--xep-ink); }
.pyp-fchip-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* Gated boxes, and chips whose count is zero. Keyed on [data-group] so the
   same rules cover the round 9 boxes and the round 7/8 rows alike. */
[data-group].is-locked .pyp-fchip,
.pyp-fchip.is-empty { opacity: .5; cursor: not-allowed; }
[data-group].is-locked .pyp-fchip input,
.pyp-fchip.is-empty input { cursor: not-allowed; }
[data-group].is-locked .pyp-fchip:hover .pyp-fchip-box,
.pyp-fchip.is-empty:hover .pyp-fchip-box { border-color: rgba(14, 20, 36, .10); }

/* Concept groups: "ARITHMETIC ›" then its children.
   Two columns, so every group's chips begin at the same left edge and a
   wrapped second line lines up under the first chip, not under the name. */
.pyp-fgroup {
    display: grid; grid-template-columns: 124px minmax(0, 1fr);
    gap: 8px 12px; align-items: start; width: 100%;
}
.pyp-fgroup + .pyp-fgroup {
    margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(14, 20, 36, .07);
}
.pyp-fgroup-name {
    font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    color: var(--xep-muted); padding-top: 8px; overflow-wrap: anywhere;
}
/* Concepts wrap along the line and drop to the next only when the row runs
   out: the box is wide, and one per line left most of it empty. */
.pyp-fgroup-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }

/* ── Collapsed: a sticky bar of just what is selected ──────── */
.pyp-filterbar.is-collapsed { position: sticky; top: 72px; z-index: 40; }
.pyp-filterbar.is-collapsed .pyp-fb-rows { display: none; }

/* Two columns rather than two rows: the controls keep their own line above
   "Filters", while the chosen chips run up the full height beside them.
   As stacked rows the controls claimed the whole width and left a dead
   band across the bar, with the chips pushed down below it. */
.pyp-filterbar.is-collapsed .pyp-fb-head {
    display: grid; align-items: start;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "tools summary"
                         "id    summary";
    column-gap: 12px; row-gap: 8px;
}
.pyp-filterbar.is-collapsed .pyp-fb-tools   { grid-area: tools; }
.pyp-filterbar.is-collapsed .pyp-fb-id      { grid-area: id; }
.pyp-filterbar.is-collapsed .pyp-fb-summary { grid-area: summary; }
/* Collapsed: "Filters" over "Clear All" at the far left, then one block per
   category, each holding its chosen chips stacked three to a column. The
   bar scrolls sideways instead of growing taller. */
.pyp-fb-id { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
/* Collapsed, the controls already have the line above to themselves, so the
   title and "Clear All" stay side by side and the bar keeps its height. */

/* Two chip rows tall, and that is the whole height of the bar whatever is
   selected. Nothing scrolls sideways here: the four blocks share the width
   and each scrolls down inside itself. */
.pyp-fb-summary {
    --pyp-sum-row: 34px;
    display: flex; flex-wrap: nowrap; align-items: stretch; gap: 20px;
    flex: 1 1 auto; min-width: 0; cursor: pointer;
    height: calc(var(--pyp-sum-row) * 2 + 6px);
    overflow: hidden;
    /* Set in from the title rather than butting against it. Blank space
       between the two is wanted here, not a fault. */
    margin-left: 24px;
}

/* An author-set display beats the browser's own [hidden] rule, so while the
   panel is open the bar has to be told to go away. */
.pyp-fb-summary[hidden] { display: none; }

/* Packed from the left, each block only as wide as it needs. Sharing the
   width equally pushed the blocks apart and opened gaps between them; the
   leftover space belongs at the end of the row instead. */
/* The blocks share the whole width rather than ending part way across and
   leaving the right of the bar blank. They grow from their own content
   width, not from an equal share: an equal share gave "2026" as much room
   as "Quantitative Ability (Short Answer)" and opened the gaps this
   replaced. */
.pyp-fb-sumgroup { display: flex; flex: 1 1 auto; min-width: 0; }
.pyp-fb-sumgroup + .pyp-fb-sumgroup {
    padding-left: 20px; border-left: 1px solid rgba(14, 20, 36, .08);
}
/* One chip per line, stacked down the column, never side by side: each
   category reads as its own short list. Two are visible and the rest are
   reached by scrolling inside the column. */
.pyp-fb-sumwrap {
    display: flex; flex-direction: column; flex-wrap: nowrap;
    align-items: flex-start; gap: 6px;
    width: 100%; min-width: 0;
    /* Two chips show and the rest are scrolled to, so the bar has to say so.
       "scroll" rather than "auto": on a Mac an auto scrollbar is an overlay
       that fades out the moment it is not being used, and the column then
       looked like a complete list that happened to stop at two.
       Chaining stays on, so the sticky bar never eats the wheel. */
    overflow-y: scroll; overflow-x: hidden;
    scrollbar-gutter: stable;
    padding-right: 4px;
}
/* Chrome and Safari drop every ::-webkit- rule below the moment
   scrollbar-width or scrollbar-color is set, and fall back to the system
   scrollbar - the overlay one that fades. So the standard properties are
   kept only for the engines that have no ::-webkit-scrollbar of their own. */
@supports not selector(::-webkit-scrollbar) {
    .pyp-fb-sumwrap { scrollbar-width: thin; scrollbar-color: rgba(14, 20, 36, .32) rgba(14, 20, 36, .07); }
}
.pyp-fb-sumwrap::-webkit-scrollbar { width: 8px; }
.pyp-fb-sumwrap::-webkit-scrollbar-thumb {
    background: rgba(14, 20, 36, .32); border-radius: 8px;
    border: 2px solid transparent; background-clip: padding-box;
}
.pyp-fb-sumwrap:hover::-webkit-scrollbar-thumb {
    background: rgba(14, 20, 36, .45); background-clip: padding-box;
}
.pyp-fb-sumwrap::-webkit-scrollbar-track { background: rgba(14, 20, 36, .07); border-radius: 8px; }

/* On a narrow screen a long name is trimmed rather than allowed to spill:
   the bar must not scroll sideways at any width. */
.pyp-fb-summary .pyp-fchip { flex: 0 0 auto; max-width: 100%; min-width: 0; }
.pyp-fb-summary .pyp-fchip-box { white-space: nowrap; max-width: 100%; min-width: 0; }
.pyp-fb-summary .pyp-fchip-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* A wider gap marks where one group of chips ends and the next begins. */
.pyp-fb-summary .pyp-fchip-box {
    background: #faf3e4; border-color: var(--xep-accent); color: var(--xep-ink); font-weight: 600;
}
.pyp-fb-summary-none { font-size: 13px; color: var(--xep-muted); }

/* ── Page C: sidebar + results (round 7, behind the flag) ───── */
.pyp-filter-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }

/* Sticky so the filters stay reachable while the results scroll (A7).
   64px is the fixed site header; 16px of breathing room above, 32px below. */
.pyp-sidebar {
    position: sticky; top: 80px; align-self: start;
    max-height: calc(100vh - 96px);
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--xep-line);
    border-radius: var(--pyp-radius); box-shadow: var(--pyp-shadow); overflow: hidden;
}
.pyp-sidebar .pyp-sidebar-head { flex: 0 0 auto; }
.pyp-sidebar .pyp-sidebar-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: #c3cede transparent;
}
.pyp-sidebar .pyp-sidebar-scroll::-webkit-scrollbar { width: 8px; }
.pyp-sidebar .pyp-sidebar-scroll::-webkit-scrollbar-thumb { background: #c3cede; border-radius: 8px; }
.pyp-sidebar .pyp-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.pyp-sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--xep-line);
}
.pyp-sidebar-title { font-size: 15px; font-weight: 600; color: var(--xep-ink); margin: 0; }
.pyp-clear {
    border: none; background: none; padding: 0; cursor: pointer;
    font-family: 'Google Sans', sans-serif; font-size: 13px; font-weight: 600; color: var(--xep-accent-ink);
}
.pyp-clear:hover { text-decoration: underline; }

.pyp-accordion { border-bottom: 1px solid var(--xep-line); }
.pyp-accordion:last-child { border-bottom: none; }
.pyp-acc-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; background: none; border: none; cursor: pointer; padding: 14px 18px;
    font-family: 'Google Sans', sans-serif; font-size: 14px; font-weight: 600; color: var(--xep-ink);
}
.pyp-acc-btn:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: -2px; }
.pyp-acc-btn i { font-size: 12px; color: var(--xep-muted); transition: transform .2s ease; }
.pyp-acc-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.pyp-acc-body { padding: 0 18px 16px; }
.pyp-acc-body[hidden] { display: none !important; }

.pyp-checks { display: flex; flex-direction: column; gap: 9px; }
.pyp-checks--grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }

.pyp-check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--xep-body); cursor: pointer; }
.pyp-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--xep-accent); cursor: pointer; flex: 0 0 auto; }
.pyp-check span { min-width: 0; }
.pyp-check-count { color: var(--xep-muted); font-size: 12px; }
.pyp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }

/* Nested topic tree */
.pyp-tree { display: flex; flex-direction: column; gap: 9px; }
.pyp-tree-children { display: flex; flex-direction: column; gap: 9px; margin: 9px 0 0 22px; padding-left: 10px; border-left: 1px solid var(--xep-line); }

/* Locked filter groups (A5) */
.pyp-accordion.is-locked .pyp-acc-btn { color: var(--xep-muted); cursor: not-allowed; }
.pyp-accordion.is-locked .pyp-acc-btn i { opacity: .4; }
.pyp-lock-note {
    margin: 0 18px 12px; padding: 7px 11px; font-size: 13px; line-height: 1.45;
    color: var(--xep-muted); background: var(--pyp-hint-bg);
    border-left: 3px solid var(--xep-accent); border-radius: 0 8px 8px 0;
}
.pyp-lock-note[hidden] { display: none !important; }

/* First-load prompt (A6) */
.pyp-empty--prompt { padding: 64px 24px; }
.pyp-empty--prompt i { font-size: 30px; color: var(--xep-accent); display: block; margin-bottom: 14px; }
.pyp-empty-title {
    font-family: 'Google Sans', sans-serif; font-size: 18px; font-weight: 600;
    color: var(--xep-ink); margin: 0 auto; max-width: 420px; line-height: 1.5;
}
.pyp-empty-sub { font-size: 14px; color: var(--xep-muted); margin: 6px auto 0; max-width: 420px; }

.pyp-results-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.pyp-results-count { font-size: 18px; color: var(--xep-ink); margin: 0; }
.pyp-results-count strong { font-weight: 600; }

.pyp-loadmore-wrap { display: flex; justify-content: center; margin-top: 26px; }

/* Mobile filter drawer */
.pyp-filter-open { display: none; }
.pyp-sheet-backdrop {
    position: fixed; inset: 0; background: rgba(14, 20, 36, .55); z-index: 998;
    opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s ease;
}
.pyp-sheet-backdrop.is-open { opacity: 1; visibility: visible; }

/* ── Similar-question modal ─────────────────────────────────── */
.pyp-modal-backdrop {
    position: fixed; inset: 0; background: rgba(14, 20, 36, .55); z-index: 1200;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s ease;
}
.pyp-modal-backdrop.is-open { opacity: 1; visibility: visible; }

.pyp-modal {
    background: #fff; border-radius: 20px; width: 100%; max-width: 760px;
    max-height: 90vh; display: flex; flex-direction: column; min-height: 0;
    font-family: 'Google Sans', sans-serif;
    box-shadow: 0 30px 80px rgba(14, 20, 36, .3);
    transform: translateY(14px); transition: transform .22s ease;
}
.pyp-modal-backdrop.is-open .pyp-modal { transform: translateY(0); }

.pyp-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 20px 24px; border-bottom: 1px solid var(--xep-line); flex: 0 0 auto;
}
.pyp-modal-title { font-size: 17px; font-weight: 600; color: var(--xep-ink); margin: 0; }
.pyp-modal-close {
    border: none; background: var(--xep-soft); cursor: pointer; width: 34px; height: 34px;
    border-radius: 50%; color: var(--xep-ink); font-size: 15px; display: grid; place-items: center;
    flex: 0 0 auto;
}
.pyp-modal-close:hover { background: #e4e6ee; }
.pyp-modal-close:focus-visible { outline: 2px solid var(--xep-accent); outline-offset: 2px; }

/* Only this part scrolls. min-height:0 is what lets a flex child shrink
   below its content, without which overflow-y never takes effect. */
.pyp-modal-body {
    flex: 1 1 auto; min-height: 0;
    padding: 20px 24px 24px;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
/* Inside the modal the card is the whole surface - drop its own frame. */
.pyp-modal-body .pyp-card { border: none; box-shadow: none; padding: 0; }

.pyp-modal-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    padding: 16px 24px; border-top: 1px solid var(--xep-line); flex: 0 0 auto;
}

.pyp-modal-loading { padding: 50px 0; text-align: center; color: var(--xep-muted); }

/* ── End of the practice set ────────────────────────────────── */
.pyp-done { text-align: center; padding: 30px 12px 26px; }
.pyp-done-icon {
    width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%;
    display: grid; place-items: center; font-size: 24px;
    background: var(--pyp-answer-bg); color: var(--pyp-success);
}
.pyp-done-title {
    font-size: 20px; font-weight: 600; color: var(--xep-ink); margin: 0 0 6px;
}
.pyp-done-sub {
    font-size: 15px; color: #444c5e; margin: 0 auto 22px; max-width: 420px; line-height: 1.6;
}

/* ── Image lightbox ─────────────────────────────────────────── */
.pyp-lightbox {
    position: fixed; inset: 0; background: rgba(14, 20, 36, .88); z-index: 1300;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.pyp-lightbox.is-open { opacity: 1; visibility: visible; }
.pyp-lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; display: block; }
.pyp-lightbox-close {
    position: absolute; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, .14); color: #fff; font-size: 17px;
    cursor: pointer; display: grid; place-items: center;
}
.pyp-lightbox-close:hover { background: rgba(255, 255, 255, .24); }

/* ── KaTeX sizing inside our cards ──────────────────────────── */
.pyp-card .katex { font-size: 1.04em; }
.pyp-card .katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
    .pyp-filter-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 900px) {
    /* Page C: sidebar becomes a bottom sheet. The button that opens it sits
       at the top of the results, sticky under the fixed 64px site header, so
       it is the first thing seen and never lands on top of the footer. */
    .pyp-filter-layout { grid-template-columns: minmax(0, 1fr); }
    .pyp-filter-open {
        display: flex; width: 100%; justify-content: center;
        position: sticky; top: 72px; z-index: 997; margin: 0 0 18px;
        padding: 13px 20px; font-size: 15px;
        background: var(--xep-ink); border-color: var(--xep-ink); color: #fff;
        box-shadow: 0 6px 18px rgba(14, 20, 36, .18);
    }
    .pyp-filter-open:hover { background: var(--xep-ink); border-color: var(--xep-ink); color: #fff; }

    .pyp-sidebar {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 999;
        border-radius: 20px 20px 0 0; max-height: 82vh; display: flex; flex-direction: column;
        transform: translateY(102%); transition: transform .26s ease; box-shadow: 0 -18px 50px rgba(14, 20, 36, .22);
    }
    .pyp-sidebar.is-open { transform: translateY(0); }
    .pyp-sidebar-scroll { overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
    .pyp-sheet-foot {
        display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--xep-line);
        flex: 0 0 auto; background: #fff;
    }
    .pyp-sheet-foot .pyp-btn { flex: 1 1 auto; justify-content: center; }
}

@media (min-width: 901px) {
    .pyp-sheet-foot { display: none; }
}

@media (max-width: 768px) {
    /* Filter panel: the four boxes stack, Concept last and a little taller. */
    .pyp-filterbar { padding: 16px; border-radius: 14px; }
    .pyp-fb-rows { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
    .pyp-fb-side { grid-template-rows: repeat(3, 150px); }
    .pyp-fbox--concept { height: 300px; }
    /* The concept name goes above its chips when there is no room beside. */
    .pyp-fgroup { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .pyp-fgroup-name { padding-top: 0; }

    /* Round 7 rows, still here behind the legacy flag. */
    .pyp-frow { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 0; }
    .pyp-frow-label { padding-top: 0; }
    .pyp-filterbar.is-collapsed { top: 64px; }
    /* Too narrow for the chips to sit beside the controls: one column. */
    .pyp-filterbar.is-collapsed .pyp-fb-head {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "tools" "id" "summary";
    }
    .pyp-filterbar.is-collapsed .pyp-fb-summary { margin-left: 0; }
    /* Too narrow for one row: the chips drop under the title, still on a
       single scrolling line of their own. */
    .pyp-fb-head { flex-wrap: wrap; row-gap: 10px; }
    /* Full width on its own line here, so the desktop indent would only
       eat into it. */
    .pyp-fb-summary { order: 3; flex: 1 1 100%; margin-left: 0; }

    /* On a phone the bar is one line that scrolls sideways. Split into four
       columns at this width each chip was cut to a character or two - "2…",
       "Q." - and told the student nothing. */
    .pyp-fb-summary {
        height: auto; align-items: center; gap: 8px;
        overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        /* Room for the scrollbar without it sitting on the chips. */
        padding-bottom: 4px;
        scrollbar-width: thin; scrollbar-color: rgba(14, 20, 36, .25) transparent;
    }
    .pyp-fb-summary::-webkit-scrollbar { height: 4px; }
    .pyp-fb-summary::-webkit-scrollbar-thumb { background: rgba(14, 20, 36, .25); border-radius: 4px; }
    .pyp-fb-summary::-webkit-scrollbar-track { background: transparent; }

    /* Blocks and chips keep their natural width and never wrap or shrink. */
    .pyp-fb-sumgroup { flex: 0 0 auto; max-width: none; }
    .pyp-fb-sumgroup + .pyp-fb-sumgroup { padding-left: 8px; }
    .pyp-fb-sumwrap {
        flex-direction: row; align-items: center; gap: 8px;
        width: auto; overflow: visible; padding-right: 0;
    }
    .pyp-fb-sumwrap > .pyp-fchip { flex: 0 0 auto; scroll-snap-align: start; }
    /* Full names again: there is room along the line, unlike in a column. */
    .pyp-fb-summary .pyp-fchip,
    .pyp-fb-summary .pyp-fchip-box { max-width: none; }
    .pyp-fb-summary .pyp-fchip-label { overflow: visible; text-overflow: clip; }
    .pyp-fb-toggle { order: 2; }

    .pyp-hero { padding: 22px 0 28px; }
    .pyp-hero p { font-size: 16px; }
    .pyp-body { padding: 28px 0 70px; }

    /* Exam switcher drops below the H1 and spans the content column */
    .pyp-hero-row { flex-direction: column; align-items: stretch; gap: 16px; }
    .pyp-exam-switch { width: 100%; }
    .pyp-exam-btn { width: 100%; justify-content: space-between; }
    /* Above the sticky "Filters" button (997), which would otherwise be
       painted across the open menu. */
    .pyp-exam-menu { left: 0; right: 0; z-index: 998; }

    /* Exam rows stack: name on top, buttons full width */
    .pyp-exam-row { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 18px; }
    .pyp-exam-actions { flex-direction: column; align-items: stretch; }
    .pyp-exam-actions .pyp-btn { justify-content: center; width: 100%; }

    .pyp-card { padding: 16px; }

    /* Dropdowns share the first line, the button goes full width beneath */
    .pyp-toolbar { gap: 12px; }
    .pyp-toolbar-left { flex: 1 1 100%; gap: 12px; }
    .pyp-toolbar-left .pyp-field { flex: 1 1 0; min-width: 0; }
    .pyp-toolbar-right { flex: 1 1 100%; }
    .pyp-toolbar-right .pyp-btn { width: 100%; justify-content: center; }
    .pyp-select { min-width: 0; width: 100%; }

    /* The tab strip scrolls sideways rather than wrapping */
    .pyp-tabs-wrap { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
    .pyp-tabs-wrap::-webkit-scrollbar { display: none; }

    .pyp-modal-backdrop { padding: 0; align-items: flex-end; }
    .pyp-modal { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
    .pyp-modal-body { padding: 18px 16px 22px; }
    .pyp-modal-head, .pyp-modal-foot { padding-inline: 16px; }
}

@media (max-width: 560px) {
    /* Hint / Correct Answer / Explanation each get their own line on a phone,
       with the icon and label together at the left edge. */
    .pyp-actions { align-items: flex-start; }
    /* Each button hugs its own label, so none carries empty space. */
    .pyp-actions-left { flex-direction: column; align-items: flex-start; width: 100%; }
    .pyp-actions-left .pyp-btn { width: auto; max-width: 100%; justify-content: flex-start; }
}

@media (max-width: 420px) {
    /* Below 420px a 50/50 split truncates the section name, so stack them */
    .pyp-toolbar-left { flex-direction: column; align-items: stretch; }
    .pyp-toolbar-left .pyp-field { width: 100%; }

    .pyp-qno { font-size: 15px; }
    .pyp-meta { font-size: 12px; }
    .pyp-q-instruction { font-size: 15px; }
    .pyp-q-body { font-size: 15px; padding: 12px 14px; }
    .pyp-option { padding: 11px 13px; font-size: 14px; gap: 10px; }
    .pyp-actions-left { gap: 8px; }
    .pyp-btn { padding: 9px 15px; font-size: 13px; }
    .pyp-checks--grid { grid-template-columns: 1fr; }
}

/* Users who prefer reduced motion get no slide/shimmer */
@media (prefers-reduced-motion: reduce) {
    .pyp-modal, .pyp-sidebar, .pyp-modal-backdrop, .pyp-sheet-backdrop, .pyp-lightbox { transition: none; }
    .pyp-skeleton-card { animation: none; }
}
