/* MatricMap Predictor: the Grade 12 Maths predictor (predictor-maths.html), on top of css/predictor.css. Phone first: the practice
   question leads, its images edge to edge, and a slim bar at the bottom keeps the predicted range in view; on wide screens the
   prediction sits beside the practice. */
.pm-page [hidden] { display: none !important; }
.pm-hero { background: var(--brand); color: #fff; padding: 22px 0 28px; }
.pm-hero h1 { color: #fff; margin: 10px 0 10px; }
.pm-hero h1 span { color: var(--accent); }
.pm-lead { color: rgba(255, 255, 255, .9); font-size: 1.05rem; line-height: 1.55; max-width: 38em; margin: 0 0 18px; }
.pm-start { min-height: 46px; padding: 8px 20px; font-size: .98rem; }
.pm-start:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.pm-layout { display: grid; gap: 18px; padding-top: 18px; align-items: start; }
.pm-side { display: grid; gap: 16px; align-content: start; }
.pm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; scroll-margin-top: var(--pr-head); }
.pm-card h2 { font-size: 1.2rem; margin: 0 0 4px; }

/* The prediction: the range in words, then on a 0 to 100% bar with the middle estimate and the goal */
.pm-range { font: 700 2.1rem/1.15 var(--serif); color: var(--brand); margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.pm-level { margin: 0 0 12px; color: var(--ink-2); }
.pm-bar { position: relative; height: 18px; border-radius: 9px; background: var(--tint); overflow: hidden; }
.pm-band { position: absolute; top: 0; bottom: 0; background: #9fcbbb; border-radius: 9px; transition: left .35s ease, width .35s ease; }
.pm-mid { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--brand); transition: left .35s ease; }
.pm-goal { position: absolute; top: 0; bottom: 0; width: 0; margin-left: -1px; border-left: 2px dashed #9a6700; }
.pm-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(15, 61, 62, .2); }
.pm-scale { position: relative; height: 18px; margin-top: 2px; font-size: .75rem; color: var(--ink-3); }
.pm-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.pm-scale span:first-child { left: 0; transform: none; }
.pm-scale .pm-end { left: auto; right: 0; transform: none; }
.pm-based { margin: 8px 0 0; font-size: .9rem; color: var(--ink-3); }
.pm-goal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pm-goal-row label { font-weight: 650; }
.pm-goal-row input { width: 5.6em; min-height: 42px; padding: 6px 10px; border: 1px solid #b9b5a6; border-radius: 10px; font: inherit; background: #fff; }
.pm-goal-row input:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 1px; }
.pm-chance { flex-basis: 100%; margin: 0; color: var(--ink-2); }
.pm-chance:empty { display: none; }
.pm-fold { margin-top: 12px; }
.pm-fold > summary { cursor: pointer; font-weight: 650; color: var(--brand-2); padding: 6px 0; }
.pm-chart { margin-top: 6px; }
.pm-chart svg { display: block; width: 100%; height: auto; }
.pm-chart .pm-grid { stroke: var(--line); stroke-width: 1; }
.pm-chart .pm-axis { fill: var(--ink-3); font: 10px var(--font); }
.pm-chart .pm-area { fill: #9fcbbb; opacity: .75; }
.pm-chart .pm-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.pm-chart .pm-goal-line { stroke: #9a6700; stroke-width: 1.5; stroke-dasharray: 5 4; }
.pm-chart .pm-dot-ok { fill: var(--brand); stroke: #fff; stroke-width: 1; }
.pm-chart .pm-dot-no { fill: #fff; stroke: #b25a00; stroke-width: 1.5; }

/* Sections to work on */
.pm-work { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: work; }
.pm-work li { counter-increment: work; position: relative; padding: 10px 0 10px 36px; border-top: 1px solid var(--line); }
.pm-work li::before { content: counter(work); position: absolute; left: 0; top: 11px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fbf1da; color: #6b4a00; font-weight: 700; font-size: .85rem; }
.pm-work b { display: block; }
.pm-fact { display: block; font-size: .93rem; color: var(--ink-2); }
.pm-practise { display: inline-flex; align-items: center; min-height: 40px; margin-top: 8px; padding: 6px 14px; border: 1px solid var(--brand-2); border-radius: 999px; background: #fff; color: var(--brand-2); font: 650 .9rem var(--font); cursor: pointer; }
.pm-practise:hover { background: var(--brand-soft); }
.pm-practise:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pm-untried { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tint); font-size: .93rem; color: var(--ink-2); }
.pm-scroll { overflow-x: auto; }
.pm-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: .9rem; }
.pm-table th, .pm-table td { padding: 6px 0 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-table th:first-child, .pm-table td:first-child { padding-left: 0; text-align: left; white-space: normal; }
.pm-table thead th { color: var(--ink-2); font-weight: 650; }
.pm-table tbody th { font-weight: 600; }
.pm-table small { color: var(--ink-3); font-weight: 400; }

/* Whole papers, in a fold under the practice */
.pm-papers { padding-top: 22px; }
.pm-whole { margin: 0; padding: 4px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pm-whole > summary { font-size: 1.05rem; padding: 10px 0; }
.pm-how { color: var(--ink-2); margin: 0 0 12px; }
.pm-whole .pm-list { margin-bottom: 14px; }
.pm-list { display: grid; gap: 10px; }
.pm-list > .pm-paper { margin: 0; } /* not the site's FAQ spacing (css/style.css details) */
.pm-paper-body p { max-width: none; padding-right: 0; padding-bottom: 0; padding-left: 0; }
.pm-paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: var(--pr-head); }
.pm-paper > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 12px 16px; min-height: 56px; cursor: pointer; list-style: none; }
.pm-paper > summary::-webkit-details-marker { display: none; }
.pm-paper > summary::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 9px; height: 9px; margin: 0 4px 5px 0; border-right: 2px solid var(--brand-2); border-bottom: 2px solid var(--brand-2); transform: rotate(45deg); }
.pm-paper[open] > summary::after { content: ""; margin: 5px 4px 0 0; transform: rotate(-135deg); }
.pm-paper[open] > summary { border-bottom: 1px solid var(--line); }
.pm-paper > summary:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: var(--radius); }
.pm-paper-name { font-weight: 700; }
.pm-paper-status { grid-column: 1; font-size: .88rem; color: var(--ink-3); }
.pm-paper-body { padding: 2px 16px 14px; }
.pm-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.pm-links a { display: inline-flex; align-items: center; min-height: 42px; padding: 6px 16px; border: 1px solid var(--brand-2); border-radius: 999px; color: var(--brand-2); font-weight: 650; text-decoration: none; }
.pm-links a::after { content: "↗"; margin-left: 6px; font-size: .85em; }
.pm-links a:hover { background: var(--brand-soft); }
.pm-links-note { margin: 0 0 6px; }

.pm-q { padding: 12px 0 6px; border-top: 1px solid var(--line); scroll-margin-top: var(--pr-head); }
.pm-links-note + .pm-q { border-top: 0; }
.pm-q-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin: 0 0 6px; font-size: 1rem; }
.pm-q-meta { font-size: .86rem; font-weight: 400; color: var(--ink-3); }
.pm-q-score { margin-left: auto; color: var(--brand); font-variant-numeric: tabular-nums; }
.pm-row { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); align-items: start; column-gap: 6px; padding: 3px 0; }
.pm-part { padding-top: 9px; font-size: .88rem; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pm-row.is-marked .pm-part { color: var(--ink); }
.pm-taps { display: flex; flex-wrap: wrap; gap: 5px; }
.pm-taps button { min-width: 38px; height: 38px; padding: 0 6px; border: 1px solid #c9c5b6; border-radius: 10px; background: #fff; font: 600 .98rem var(--font); font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; }
.pm-taps button:hover { border-color: var(--brand-2); }
.pm-taps button[aria-pressed="true"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.pm-taps button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pm-paper-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: .92rem; color: var(--ink-2); }
.pm-text-btn { padding: 6px 0; border: 0; background: none; color: var(--brand-2); font: 600 .9rem var(--font); text-decoration: underline; cursor: pointer; }
.pm-saved { margin-top: 12px; }

/* Practice: one question at a time */
.pm-practice { padding: 16px 18px 18px; }
.pm-practice-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.pm-practice-top h2 { margin: 0; font-size: 1.35rem; }
.pm-phase { margin: 2px 0 0; color: var(--ink-3); font-size: .92rem; font-weight: 600; }
.pm-pick { display: grid; gap: 2px; font-size: .82rem; font-weight: 650; color: var(--ink-3); }
.pm-pick select { min-height: 42px; max-width: 100%; padding: 6px 10px; border: 1px solid #b9b5a6; border-radius: 10px; background: #fff; font: 600 .95rem var(--font); color: var(--ink); }
.pm-pick select:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 1px; }
.pm-found { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: .95rem; }
.pm-step { margin-top: 14px; }
.pm-intro { margin: 0 0 6px; color: var(--ink-2); }
.pm-qhead { margin-bottom: 12px; }
.pm-qtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font: 700 1.4rem/1.2 var(--serif); }
.pm-chip { display: inline-block; padding: 1px 10px; border-radius: 999px; font: 700 .78rem/1.7 var(--font); }
.pm-chip-easier { background: #e3f1e8; color: #1d5b33; }
.pm-chip-medium { background: #fbf1da; color: #6b4a00; }
.pm-chip-harder { background: #fde4d3; color: #8a3a0c; }
.pm-chip-hardest { background: #f9dcdc; color: #8a1c1c; }
.pm-qfacts { margin: 4px 0 0; color: var(--ink-2); font-size: .95rem; }
.pm-qavg { margin: 2px 0 0; color: var(--ink-3); font-size: .9rem; }
.pm-imgs { display: grid; gap: 4px; margin: 0 -18px; padding: 4px 0; border-block: 1px solid var(--line); background: #fff; }
.pm-slice { position: relative; display: block; width: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in; }
.pm-slice img { display: block; width: 100%; height: auto; }
.pm-slice:focus-visible { outline: 3px solid var(--brand-2); outline-offset: -3px; }
.pm-hl { position: absolute; left: 0; right: 0; border-left: 5px solid var(--accent); background: rgba(237, 182, 75, .14); pointer-events: none; }
.pm-credit { margin: 8px 0 0; font-size: .82rem; color: var(--ink-3); }
.pm-note { margin: 6px 0 0; font-size: .9rem; color: var(--ink-2); }
.pm-do { margin: 14px 0 0; font-weight: 600; }
.pm-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 12px 0 0; }
.pm-acts .pr-btn[disabled] { opacity: .55; cursor: not-allowed; }
.pm-memo { margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--line); }
.pm-memo h4 { margin: 0 0 10px; font: 700 1.2rem/1.2 var(--serif); scroll-margin-top: var(--pr-head); }
.pm-memo h4:focus { outline: none; }
.pm-markbox { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--tint); }
.pm-mark-h { margin: 0 0 6px; font-size: .95rem; font-weight: 600; }
.pm-got { margin: 8px 0 0; font-weight: 650; color: var(--brand); }
.pm-got:empty { display: none; }

/* A question or memo image, large: wider than a phone's screen, to pan */
.pm-zoom { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #fff; }
.pm-zoom::backdrop { background: rgba(10, 30, 31, .6); }
.pm-zoom-scroll { width: 100%; height: 100%; overflow: auto; }
.pm-zoom-scroll img { display: block; width: max(100%, 980px); max-width: none; height: auto; margin: 0 auto; }
.pm-zoom-close { position: fixed; top: 10px; right: 10px; z-index: 2; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; font: 400 1.7rem/1 var(--font); cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.pm-zoom-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.pm-about { padding-top: 26px; max-width: 760px; }
.pm-about details { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pm-about p { margin: 8px 0 0; color: var(--ink-2); }

/* Phones: the range stays in view at the bottom while the prediction card is off screen */
.pm-mini { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 10; display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto; padding: 10px 18px; border-radius: 999px; background: var(--brand); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: .95rem; }
.pm-mini b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pm-mini a { margin-left: auto; color: var(--accent); font-weight: 700; }
.pm-page .pr-foot { padding-bottom: 96px; }

/* Phones: the practice card edge to edge, so the question images are as large as the screen allows */
@media (max-width: 640px) {
  .pm-practice { margin: 0 -20px; border-inline: 0; border-radius: 0; }
}
/* Small phones: up to 7 mark buttons (a 6-mark sub-question) on one line beside the sub-question number */
@media (max-width: 400px) {
  .pm-lead { font-size: 1rem; }
  .pm-paper-body { padding: 2px 12px 14px; }
  .pm-paper > summary { padding: 12px; }
  .pm-taps { gap: 4px; }
  .pm-taps button { min-width: 34px; padding: 0 4px; }
}
@media (min-width: 960px) {
  .pm-hero { padding: 28px 0 34px; }
  .pm-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; padding-top: 24px; }
  .pm-practice { grid-column: 1; grid-row: 1; }
  .pm-side { grid-column: 2; grid-row: 1; position: sticky; top: var(--pr-head); max-height: calc(100vh - var(--pr-head) - 16px); overflow-y: auto; }
  .pm-zoom-scroll img { width: min(1200px, 100%); }
  .pm-mini { display: none !important; }
  .pm-page .pr-foot { padding-bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-band, .pm-mid { transition: none; }
}
