/* Libri additions for the Real Exam, Past Papers, Soalan, Search, Overview, Settings, Home and account additions.
   Loaded after app.css. Style new classes here; change existing classes only inside
   phone media queries (max-width 820px / 560px), so the desktop design is unchanged. */

/* ==== Real Exam and Past Papers (screens 28-34) ============================================ */

/* Exam dialogs (screens/exam.js Overlay): the panel scrolls when its content is taller than
   the screen. Its heading takes focus when it opens on a phone (or when it scrolls), so a
   focus ring is shown for the keyboard only. */
.lx-overlay { max-height: calc(100vh - 32px); overflow-y: auto; }
.lx-overlay__title:focus:not(:focus-visible) { outline: none; }

/* The exam bar's navigator button is for phones; elsewhere the navigator is in the rail. */
.lx-barbtn { display: none; }
.lx-barbtn .num { font-weight: var(--weight-bold); }

/* The question navigator in a bottom sheet (ui/shells.js MenuSheet). */
.lx-sheetnav { display: flex; flex-direction: column; gap: var(--space-3); padding: 0 var(--space-2) var(--space-2); }
.lx-sheetnav .setmap { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lx-sheetnav .setmap__cell:not(.setmap__cell--key) { aspect-ratio: auto; height: 44px; font-size: var(--text-sm); }
.lx-sheetnav .seg { align-self: flex-start; }

/* 30a on phones: a bar fixed to the bottom of the screen with the submit count, the
   question list and Submit Kertas 2 (rendered on phones only). */
.lx-k2bar { display: none; }

/* A rail card folded into one line (phones): the title is the summary. */
.lx-acc { display: block; }
.lx-acc > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px;
  margin: calc(-1 * var(--space-2)) 0; list-style: none; cursor: pointer; }
.lx-acc > summary::-webkit-details-marker { display: none; }
.lx-acc > summary svg { flex: none; width: 16px; height: 16px; color: var(--fg-muted); transform: rotate(90deg); transition: transform var(--dur) var(--ease); }
.lx-acc[open] > summary svg { transform: rotate(-90deg); }
.lx-acc__body { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }

/* "Show all" under a list folded on phones. */
.lx-more { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); }
.panel .k2list + .lx-more { margin-top: calc(-1 * var(--space-2)); }

/* Past Papers on phones: the tally above the list. */
.lx-pptally { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.lx-pptally .pp-tally { margin: 0; }

/* ==== Soalan (screen 35) ===================================================================== */

/* "Other sections Libri searched": closed until the student opens it. */
.lx-searched { display: flex; flex-direction: column; gap: var(--space-2); }
.lx-searched.is-open > .collapse__btn svg { transform: rotate(-90deg); }
.lx-searched__body { display: flex; flex-direction: column; gap: var(--space-3); }

/* ==== Search (screen 37) ===================================================================== */

/* A photo's label shows three lines at most until it is tapped or clicked (the grid
   stays even); where it is in the textbook goes on its own line. */
.lx-photo figcaption { display: flex; flex-direction: column; gap: 2px; }
.lx-photo__label { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
button.lx-photo__label { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lx-photo__label.is-full { display: block; -webkit-line-clamp: unset; line-clamp: none; }
.lx-photo__where { color: var(--fg-subtle); }
/* Phones: the photos in a strip above the sections, swiped side to side. */
.lx-strip { list-style: none; margin: 0; display: flex; gap: var(--space-3); overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--space-4); padding: var(--space-3) var(--space-4) var(--space-4); }
.lx-strip__item { flex: 0 0 min(220px, 66%); scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; min-width: 0; }
.lx-strip .lx-photo { margin: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.lx-strip .lx-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); border-radius: var(--radius-md); }
.lx-strip .lx-photo figcaption { font-size: var(--text-xs); line-height: 1.4; color: var(--fg-muted); }
.lx-strip .lx-photo__label { color: var(--fg); }

/* ==== Overview (screen 41) =================================================================== */

/* Kertas 1 in counts, under the tiles (no overall percentage). */
.lx-k1line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-5); padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--fg-muted); }
.lx-k1line strong { color: var(--brand-ink); }
.lx-k1line b { margin-left: 0.3em; color: var(--fg); font-weight: var(--weight-bold); }
/* Accuracy bars: what each percentage is made of; the Bab's name where there is no hover. */
.lx-abars .abars__row { grid-template-columns: 72px minmax(0, 1fr) auto; }
.lx-abars .abars__val { white-space: nowrap; }
.lx-abars__of { font-weight: var(--weight-semi); color: var(--fg-muted); }
.lx-abars__name { display: none; }
/* Status map on a touch screen: the Bab tapped, named under the grid. */
.sgrid__cell.is-picked { box-shadow: inset 0 0 0 2px currentColor; }
.lx-picked { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); min-height: 44px; padding: var(--space-3);
  border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--text-sm); }
.lx-picked__name { flex: 1 1 100%; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lx-picked__name strong { color: var(--brand-ink); }
.next-item .lx-sub2 { display: block; }
/* "Delete progress saved in this browser" (Overview, under the note; Settings, Learning). */
.lx-stub { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.lx-clear { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.lx-clear--compact .link-btn { font-size: var(--text-xs); }
.lx-clear__done { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--weight-semi); color: var(--correct); }
.lx-clear__done svg { flex: none; width: 16px; height: 16px; }
.lx-clear__body { display: flex; flex-direction: column; gap: var(--space-2); }

/* ==== Accounts (ui/shells.js, app.js, screens/account.js) =================================== */

/* Log out in the top bars (desktop); on phones it is the last row of the More / Menu sheet. */
.lx-logout { display: inline-flex; }
.lx-sheet-logout { margin-top: var(--space-2); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.lx-sheet-logout[disabled] { cursor: progress; opacity: 0.7; }
/* "Bring the progress saved in this browser into your account?": what is in this browser. */
.lx-import__counts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.lx-import__counts li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--fg); }
.lx-import__counts svg { flex: none; width: 16px; height: 16px; color: var(--brand-blue); }
/* A session message over every screen (Log out could not reach the server). */
.lx-notice { position: fixed; z-index: 60; left: 50%; bottom: var(--space-6); transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--incorrect-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  color: var(--incorrect); font-size: var(--text-sm); font-weight: var(--weight-semi); }
.lx-notice > svg { flex: none; width: 18px; height: 18px; }
.lx-notice p { flex: 1; min-width: 0; margin: 0; }
.lx-notice .icon-btn { flex: none; }

@media (hover: none) {
  .lx-abars__name { display: block; grid-column: 2 / -1; margin-top: -4px; font-size: var(--text-xs); line-height: 1.3; color: var(--fg-muted); text-align: left; }
}
@media (pointer: coarse) {
  .lx-clear--compact .link-btn { min-height: 44px; }
}

@media (max-width: 820px) {
  .lx-logout { display: none; }
  .lx-notice { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .lx-overlay { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  /* The action row stays at the bottom of a long sheet. It covers the sheet's bottom
     padding (the sticky area stops at that padding, hence the negative offset), so at
     the end of the sheet, or in a short one, nothing moves. */
  .lx-overlay__acts { position: sticky; bottom: calc(-1 * (var(--space-6) + env(safe-area-inset-bottom))); z-index: 1; align-self: stretch;
    width: auto !important; margin: 0 calc(-1 * var(--space-5)) calc(-1 * (var(--space-6) + env(safe-area-inset-bottom)));
    padding: var(--space-3) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); }

  .lx-barbtn { display: inline-flex; flex: none; gap: 6px; padding: 0 var(--space-3); }

  .lx-k2bar { display: flex; align-items: center; gap: var(--space-3);
    position: sticky; bottom: 0; z-index: 4;
    margin: 0 calc(-1 * var(--space-4)) calc(-1 * (var(--space-12) + env(safe-area-inset-bottom)));
    padding: var(--space-2) var(--space-4) calc(var(--space-2) + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-md); }
  .lx-k2bar__count { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--weight-bold);
    line-height: 1.25; color: var(--correct); }
  .lx-k2bar__count svg { flex: none; width: 18px; height: 18px; }
  .lx-k2bar__count.is-warn { color: var(--warning); }
  .lx-k2bar__acts { flex: none; display: flex; gap: var(--space-2); }

  /* Real Exam Kertas 2 papers: the name, then the status and the buttons on one line. */
  .k2list li { grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); row-gap: var(--space-2); }
  .k2list li > .k2list__name { grid-column: 1 / -1; }
  .k2list li > .k2list__name small { display: none; }
  .k2list li > .status { grid-column: 1; grid-row: 2; justify-self: start; }
  .k2list li > .lx-rowacts { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .k2list li > span.muted { grid-column: 1 / -1; grid-row: 3; }
  .k2list li > span.muted:empty { display: none; }

  /* Past Papers sets: the set's name on one line, then one line per Kertas with its
     status and its button. */
  .pp-table.lx-pptable tr { padding: var(--space-3); }
  .pp-table.lx-pptable td { padding: 4px 0; }
  .pp-table.lx-pptable td:first-child { padding-bottom: var(--space-2); }
  .lx-pptable .pp-name small { display: none; }
  .lx-pptable .pp-badge { min-width: 32px; height: 32px; }
  .pp-table.lx-pptable td[data-label] { display: flex; align-items: center; gap: var(--space-2); }
  .pp-table.lx-pptable td[data-label]::before { flex: none; width: 56px; margin: 0; }
  .lx-pptable .pp-cell { flex: 1; min-width: 0; justify-content: space-between; }
  .lx-pptable .pp-cell .btn { margin-left: auto; }
  .lx-pptable .pp-cell .btn > svg { display: none; }

  /* Search: the photos' lead in smaller type, so the strip starts higher. */
  .lx-photos .panel__head p { font-size: var(--text-sm); }

  /* Sejarah home: a shorter hero photo. */
  .hero__photo { min-height: 140px; height: 140px; }
}

@media (max-width: 560px) {
  .lx-barbtn--count .lx-barbtn__label { display: none; }
  .lx-k2bar__lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* Question footers wrap (css/app.css); in "Choose 3 questions" the note goes first,
     on its own row, above the buttons. */
  .lx-foot > .lx-foot__note { order: -1; flex: 1 1 100%; }

  /* Kertas 2 results: each question is a card; each cell carries its column heading. */
  .lx-p2res, .lx-p2res tbody, .lx-p2res tr, .lx-p2res td { display: block; width: 100%; }
  .lx-p2res thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lx-p2res tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
  .lx-p2res tr:last-child { border-bottom: 0; }
  .p2table.lx-p2res td { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); padding: 4px 0; border: 0; text-align: left; }
  .p2table.lx-p2res td.lx-p2res__q { padding-bottom: var(--space-2); }
  .lx-p2res td[data-label]::before { content: attr(data-label); flex: 0 0 96px; font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--fg-subtle); }

  /* Sejarah home: the Continue card's set name and count, then the bar at full width. */
  .lx-continue .continue__meta { flex-wrap: wrap; column-gap: var(--space-3); row-gap: 6px; }
  .lx-continue .continue__meta .progress { order: 2; flex: 1 1 100%; width: auto; }
}

/* ---- Sejarah home: next steps (ui/nextsteps.js) ---------------------------------------- */
.next-steps { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.next-steps__head h2 { font-size: var(--text-md); }
.next-steps__head p { font-size: var(--text-sm); color: var(--fg-muted); }
.next-steps__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.next-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.next-step__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--brand-blue-soft); color: var(--brand-blue); }
.next-step__icon svg { width: 18px; height: 18px; }
.next-step__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-step__body strong { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.next-step__body span { font-size: var(--text-sm); color: var(--fg-muted); }
@media (max-width: 560px) {
  .next-steps { padding: var(--space-4); }
  .next-step { grid-template-columns: auto minmax(0, 1fr); }
  .next-step > .btn { grid-column: 2; justify-self: start; }
}

/* ---- Question banks (screens/banks.js, ui/blocks.js) ---------------------------------- */
.qb-blocks { display: flex; flex-direction: column; gap: var(--space-3); font-family: var(--font-exam); font-size: var(--text-md); line-height: var(--leading-snug); color: var(--fg); max-width: 68ch; }
.qb-blocks p { margin: 0; white-space: pre-line; }
.qb-ask { font-weight: var(--weight-semi); }
.qb-box { display: flex; flex-direction: column; gap: var(--space-2); }
.qb-box__title { font-family: var(--font-ui); font-size: var(--text-sm); }
.qb-lines, .qb-statements { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-1, 4px); }
.qb-statements li { padding-left: var(--space-2); }
.qb-quote { margin: 0; font-style: italic; }
.qb-table-wrap { overflow-x: auto; max-width: 100%; }
.qb-table { border-collapse: collapse; font-size: var(--text-base); min-width: 100%; }
.qb-table th, .qb-table td { border: 1px solid var(--line-strong); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.qb-table th { background: var(--surface-2); font-weight: var(--weight-semi); }
.qb-figure { margin: 0; padding: var(--space-3) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: var(--space-1, 4px); }
.qb-figure__label { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.qb-pick { display: flex; flex-direction: column; gap: var(--space-4); align-items: flex-start; }
.qb-pick__bab { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; max-width: 640px; min-width: 0; font-size: var(--text-sm); font-weight: var(--weight-semi); }
.qb-start { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.qb-entry { margin: 0; }
/* The set step (ui/sets.js): "Soalan rawak", then a grid of "Set n", ticked when done. */
.qb-random { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-4); border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--fg); text-align: left; font: inherit; cursor: pointer; }
.qb-random > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qb-random .muted { font-size: var(--text-sm); }
.qb-random svg { flex: none; width: 20px; height: 20px; color: var(--brand-blue); }
.qb-random.is-on, .qb-set.is-on { border-color: var(--brand-blue); background: var(--brand-blue-soft); }
.qb-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--space-2); }
.qb-set { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 var(--space-3); border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--fg); font: inherit; font-weight: var(--weight-semi); cursor: pointer; white-space: nowrap; }
.qb-set svg { width: 16px; height: 16px; color: var(--correct); }
.qb-set.is-done { border-style: dashed; }
@media (hover: hover) { .qb-random:hover, .qb-set:hover { border-color: var(--line-strong); } .qb-random.is-on:hover, .qb-set.is-on:hover { border-color: var(--brand-blue); } }
@media (max-width: 720px) { .qb-sets { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); } }
/* A long set list's "Show all (n)" (ui/sets.js SetsMore): full width on a phone, a quiet link-like button. */
.sets-more { display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: flex-start; min-height: 44px; margin-top: var(--space-2); padding: 0 var(--space-4); border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--brand-blue); font: inherit; font-weight: var(--weight-semi); cursor: pointer; }
.sets-more svg { width: 16px; height: 16px; }
@media (hover: hover) { .sets-more:hover { border-color: var(--line-strong); } }
@media (max-width: 720px) { .sets-more { width: 100%; } }
@media (max-width: 720px) {
  .qb-pick .seg { width: 100%; }
  .qb-pick .seg button { flex: 1; }
}

/* ---- Kertas 2 from the question banks (screens/banks2.js) ----------------------- */
.band-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 12px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-bold); white-space: nowrap; }
.band-tag svg { width: 16px; height: 16px; flex: none; }
.band-tag--good { background: var(--correct-soft); color: var(--correct); }
.band-tag--mid { background: var(--warning-soft); color: var(--warning); }
.band-tag--low { background: var(--incorrect-soft); color: var(--incorrect); }
.band-tag--lg { font-size: var(--text-base); padding: 6px 14px; }
/* Paper 2 estimated marks ("Markah anggaran", ui/core.js MarkTag / MarkNote) */
.mark-tag { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-2); font-size: var(--text-sm); white-space: nowrap; }
.mark-tag__label { color: var(--fg-muted); }
.mark-tag__value { font-weight: var(--weight-bold); color: var(--fg); }
.mark-tag--lg { font-size: var(--text-base); padding: 6px 14px; }
.mark-note { margin: 0; font-size: var(--text-xs); }
.mark-note a { color: var(--brand-blue); font-weight: var(--weight-semi); white-space: nowrap; }
.k2b-fb__band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.k2b-fb--flat { border: 0; border-radius: 0; padding: var(--space-4) var(--space-6); }
.k2b-total { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.p2fb__band { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.lx-k2total { gap: var(--space-3); border-top: 1px solid var(--line); }
@media (max-width: 560px) { .k2b-fb--flat { padding: var(--space-4); } .mark-tag { white-space: normal; } }
/* "Bagaimana Kertas 2 ditanda" (screens/support.js K2MarkingHelp) */
.k2help { display: flex; flex-direction: column; gap: var(--space-5); max-width: 72ch; }
.k2help section { display: flex; flex-direction: column; gap: var(--space-2); }
.k2help h2 { font-size: var(--text-lg); }
.k2help p, .k2help li { line-height: var(--leading-body); }
.k2help ul { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; }
.k2help__bands { display: flex; flex-direction: column; gap: var(--space-2); }
.k2help__bands > div { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.k2b-q .panel__head { align-items: flex-start; }
.k2b-q__right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.k2b-q__choose:empty { display: none; }
.k2b-choose { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.k2b-choose .link-btn { background: none; border: 0; padding: 0; color: var(--brand-blue); font: inherit; text-decoration: underline; cursor: pointer; }
.k2b-sec { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--text-sm); }
.k2b-sec .num { margin-left: auto; font-weight: var(--weight-semi); color: var(--brand-blue); }
.k2b-locked { border: 1px solid var(--line); border-radius: var(--radius-md); }
.k2b-fb { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.k2b-fb--failed { flex-direction: row; flex-wrap: wrap; align-items: center; background: var(--warning-soft); border-color: var(--warning-line); }
.k2b-fb--failed > svg { width: 20px; height: 20px; color: var(--warning); flex: none; }
.k2b-fb--failed p { flex: 1; min-width: 12ch; margin: 0; }
.k2b-page { display: inline-block; font-size: var(--text-xs); color: var(--fg-subtle); white-space: nowrap; }
.k2b-crit { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--line); }
.k2b-note { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); margin: 0; }
.k2b-note svg { width: 16px; height: 16px; flex: none; }
.k2b-model { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.k2b-model .p2pts__toggle { padding: var(--space-3) var(--space-4); }
.k2b-model.is-open .p2pts__chev { transform: rotate(90deg); }
.k2b-model__text { margin: 0; padding: var(--space-4); font-family: var(--font-exam); font-size: var(--text-md); line-height: var(--leading-body); white-space: pre-line; border-top: 1px solid var(--line); }
.k2b-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.k2b-foot .spacer { flex: 1; }
.k2b-overall { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.k2b-soft { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.k2b-hero { grid-template-columns: 1fr; }
.k2b-tally { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.k2b-tally__item { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--weight-semi); }
.k2b-rows { list-style: none; margin: 0; padding: 0; }
.k2b-rows li + li { border-top: 1px solid var(--line); }
.k2b-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: var(--space-4); width: 100%; padding: var(--space-4) var(--space-6); border: 0; background: none; text-align: left; font: inherit; color: var(--fg); cursor: pointer; }
.k2b-row > svg { width: 18px; height: 18px; color: var(--fg-subtle); }
.k2b-row__no { display: flex; flex-direction: column; font-weight: var(--weight-bold); }
.k2b-row__no small { font-weight: var(--weight-regular, 400); font-size: var(--text-xs); color: var(--fg-muted); }
.k2b-row__where { font-size: var(--text-sm); min-width: 0; }
@media (hover: hover) { .k2b-row:hover { background: var(--surface-2); } }
@media (max-width: 720px) {
  .k2b-q .panel__head { flex-direction: column; }
  .k2b-q__right { justify-content: flex-start; }
  .k2b-row { grid-template-columns: 1fr auto; padding: var(--space-3) var(--space-4); gap: var(--space-2) var(--space-3); }
  .k2b-row__where { grid-column: 1 / -1; grid-row: 2; }
  .k2b-row > svg { display: none; }
  .k2b-foot > .btn { flex: 1 1 auto; }
}

/* Bab page: bank chooser and the bank's Ikut Bab sets (ui/babbanks.js) */
.bb { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.bb__step { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.bb__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.bb__h { margin: 0; font-size: var(--text-base); font-weight: var(--weight-semi); }
.bb__sets { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.qb-random:disabled { opacity: .6; cursor: default; }

/* Count-up clocks (lib/clock.js, ui/core.js CountUpClock) and time on summaries */
.session-head__right .timer, .k2b-soft .timer { padding: 4px 10px; gap: var(--space-2); }
.session-head__right .timer .timer__label { font-size: var(--text-xs); }
.time-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: var(--text-sm); }
.time-sum svg { width: 15px; height: 15px; flex: none; color: var(--brand-blue); }

/* Kertas 2 status per Bab (ui/core.js K2StatusTag) */
.k2st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); white-space: nowrap; }
.k2st__lbl { font-weight: var(--weight-semi); color: var(--fg-muted, inherit); }
.bablist-row__status { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 720px) { .bablist-row__status { align-items: flex-start; } }

/* Improvement over time (ui/history.js) */
.wk { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); }
.wk__row { display: grid; grid-template-columns: 84px minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wk__row:last-child { border-bottom: 0; }
.wk__row--head { font-size: var(--text-xs); color: var(--fg-muted); font-weight: var(--weight-semi); }
.wk__row--head span { display: inline-flex; align-items: center; gap: 6px; }
.wk__week { display: flex; flex-direction: column; line-height: 1.2; }
.wk__week small { font-size: var(--text-xs); color: var(--fg-muted); }
.wk__cell { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.wk__track { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; min-width: 24px; }
.wk__fill { display: block; height: 100%; border-radius: inherit; }
.wk__fill--k1, .wk__key--k1 { background: var(--brand-blue); }
.wk__fill--k2, .wk__key--k2 { background: var(--correct); }
.wk__key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.wk__val { width: 3.2em; text-align: right; font-weight: var(--weight-semi); }
.ph .recent__date { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ph__clock { width: 13px; height: 13px; }
@media (max-width: 520px) { .wk__row { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); } }
