/* Review and recall (index.html's #review panel and its button; review.js). Only on a server run with TUTOR_REVIEW=1:
   without it the page has none of this markup and this file isn't served. Colors come from tokens.css (Versal Ink or Versal
   Paper), square and flat like the rest; the progress bars take their widths from review.js (CSSOM), as Practice's do, since the page allows
   no inline styles. */

.review-open { gap: 8px; min-height: 44px; padding: 0 12px; margin-left: auto; font-size: 14px; white-space: nowrap; }
.review-open svg { width: 16px; height: 16px; flex: none; }
.review-open:not([hidden]) + .acct { margin-left: 0; }
.review-open[aria-expanded="true"] { border-color: var(--ws-accent); background: var(--ws-accent-soft); }
/* The top bar is tight with Review in it. The chats button keeps its size. On a phone the wordmark's class name is cut to
   fit (nothing else gives way there: the account chip is only its avatar); wider, the account chip gives way (its name is
   cut short) before the buttons wrap or the chip slides under Review's column */
.top > #side-open { flex: none; }
@media (max-width: 640px) {
  .top .brand { min-width: 0; }
  .top .brand-mark { flex: none; }
  .top .brand-course { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
/* With both buttons in the bar, a phone narrower than ~390px has no room for the class name beside the wordmark (a name
   cut to "RM 30…" reads as broken), so it goes; the page and the chat still say which class this is */
@media (max-width: 389px) {
  .top:has(.review-open:not([hidden]) ~ .cards-open:not([hidden])) .brand-course { display: none; }
}
@media (min-width: 641px) {
  .review-open:not([hidden]) ~ .acct { min-width: 0; }
  .review-open:not([hidden]) ~ .acct .chip { max-width: min(220px, 100%); }
}
/* The label goes (the icon stays, the label stays for a screen reader) on a phone and a small tablet, and with Review
   beside the chat while the chats column is open on a small laptop screen: the bar is under ~600px wide in both */
@media (max-width: 600px) {
  .review-open { padding: 0 10px; }
  .review-open span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  html.side-open.review-shown .review-open { padding: 0 10px; }
  html.side-open.review-shown .review-open span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Where it sits: a column beside the chat (like the chats column), a drawer over the chat's right edge on a middle
   screen, the whole screen on a phone. Where it covers the chat (under 1100px), the page behind it takes no focus and
   no clicks while it's open (review.js holds it, so Tab stays in Review); on the middle screen a flat dim covers that
   page, so it shows it's out of reach */
.review { display: flex; flex-direction: column; min-height: 0; background: var(--ws-surface); color: var(--ws-text); }
@media (min-width: 1100px) {
  .review { position: sticky; top: 0; flex: none; width: clamp(340px, 34vw, 440px); height: 100dvh; border-left: 1px solid var(--ws-border); }
}
@media (min-width: 900px) and (max-width: 1099px) {
  /* The dim: a flat spread with no blur, in the cards' backdrop colour (a shadow takes no clicks) */
  .review { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(420px, 92vw);
    border-left: 1px solid var(--ws-border-strong); box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.55); }
}
@media (max-width: 899px) {
  .review { position: fixed; inset: 0; z-index: 30; }
  html.review-shown .main { visibility: hidden; }
}

.rv-head { display: flex; align-items: flex-start; gap: 6px; flex: none; padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--ws-border); }
.rv-head #rv-back:not([hidden]) + .rv-titles { margin-left: -2px; }
.rv-head #rv-back { margin: 0 0 0 -6px; flex: none; }
.rv-titles { flex: 1; min-width: 0; padding-top: 4px; }
.rv-titles h2 { margin: 0 0 2px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.rv-titles h2:focus { outline: none; }
.rv-titles p { margin: 0; font-size: 13px; line-height: 1.45; }
.rv-msg { flex: none; margin: 0; padding: 10px 18px 0; color: var(--ws-danger); font-size: 14px; font-weight: 600; }
.rv-msg:empty { display: none; }
.rv-body { flex: 1; min-height: 0; padding: 16px 18px 28px; overflow-y: auto; overscroll-behavior: contain; }

.rv-h { margin: 22px 0 8px; color: var(--ws-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rv-note { margin: 10px 0; color: var(--ws-muted); font-size: 14px; line-height: 1.5; }
.rv-small { margin: 10px 0 0; color: var(--ws-muted); font-size: 12.5px; line-height: 1.45; }
.rv-stat { margin: 0 0 4px; color: var(--ws-muted); font-size: 14px; font-weight: 600; }
.rv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 0; }
.rv-row.end { margin-top: 12px; }
.rv-body .btn.wide { margin-top: 14px; }

/* The two ways in, and the topics */
.rv-choice, .rv-topic { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--ws-border-strong);
  border-radius: 0; background: var(--ws-surface); text-align: left; cursor: pointer; }
.rv-choice { padding: 14px 16px; }
.rv-choice:hover:not([aria-disabled="true"]), .rv-topic:hover { border-color: var(--ws-text); background: var(--ws-surface-2); }
.rv-choice[aria-disabled="true"] { cursor: default; opacity: 0.75; }
.rv-choice-text, .rv-topic-text { flex: 1; min-width: 0; display: block; }
.rv-choice strong { display: block; font-size: 16px; }
.rv-hint { display: block; margin-top: 2px; color: var(--ws-muted); font-size: 13px; line-height: 1.4; }
.rv-pill { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 32px; height: 28px; padding: 0 8px;
  border-radius: 2px; background: var(--ws-accent-btn); color: var(--ws-on-accent); font-size: 13px; font-weight: 600; }
.rv-topics { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rv-week { display: block; color: var(--ws-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rv-name { display: block; margin-top: 1px; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.rv-count { flex: none; color: var(--ws-muted); font-size: 13px; font-weight: 600; text-align: right; }
.rv-count.up { color: var(--ws-text); font-weight: 700; }

/* Everything so far */
.rv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 18px; }
.rv-tile { padding: 12px 14px; border: 1px solid var(--ws-border); border-radius: 0; background: var(--ws-surface-2); }
.rv-tile strong { display: block; font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rv-tile span { color: var(--ws-muted); font-size: 13px; font-weight: 600; }
.rv-rows { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
/* Versal's split bar: learned in ink, later in grey, due in the student's blue, new in the track's own colour */
.rv-meter { display: flex; height: 8px; margin: 6px 0 5px; background: var(--ws-border); overflow: hidden; }
.rv-meter span { display: block; width: 0; height: 100%; }
.rv-meter .learned { background: var(--ws-text); }
.rv-meter .later { background: var(--ws-muted); }
.rv-meter .due { background: var(--ws-student-name); }
.rv-meter .new { background: var(--ws-border); }
.rv-line { margin: 0; color: var(--ws-muted); font-size: 13px; line-height: 1.45; }

/* Taken out */
.rv-out { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rv-out li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--ws-border); }
.rv-out span { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.rv-out .btn { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* A card */
.rv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--ws-muted); font-size: 13px; font-weight: 600; }
.rv-tag { padding: 0 8px; border: 1px solid var(--ws-border-strong); border-radius: 2px; background: var(--ws-surface);
  color: var(--ws-text); font-size: 12px; font-weight: 600; line-height: 22px; }
.rv-q { margin: 4px 0 16px; font-size: 17px; font-weight: 600; line-height: 1.55; overflow-wrap: anywhere; }
.rv-q.small { margin-bottom: 12px; color: var(--ws-muted); font-size: 14.5px; }
.rv-md p { margin: 0 0 8px; }
.rv-md p:last-child { margin-bottom: 0; }
.rv-md ul, .rv-md ol { margin: 0 0 8px; padding-left: 22px; }
/* Code as in the chat: in a sentence, the page's own letters on grey; in a block, monospace in a ruled box, coloured */
.rv-md code { padding: 0 4px; border-radius: 2px; background: var(--ws-code-bg); font-family: var(--ws-display); font-size: 0.92em;
  font-weight: 600; letter-spacing: 0.04em; }
.rv-md .code { margin: 0 0 8px; border: 1px solid var(--ws-border); background: var(--ws-code-bg); }
.rv-md .code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px;
  border-bottom: 1px solid var(--ws-border); color: var(--ws-muted); font-size: 13px; font-weight: 600; }
.rv-md pre { margin: 0; padding: 12px 16px; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.rv-md pre:focus-visible { outline-offset: -2px; }
.rv-md pre code { padding: 0; border-radius: 0; background: none; font: inherit; letter-spacing: 0; }
.rv-md pre .code-kw { color: var(--ws-code-keyword); }
.rv-md pre .code-tbl { color: var(--ws-code-table); }
.rv-md pre, .rv-md .code { max-width: 100%; overflow-x: auto; text-align: left; }
.rv-label { display: block; margin: 0 0 6px; color: var(--ws-muted); font-size: 13px; font-weight: 600; }
.rv-typed { display: block; width: 100%; min-height: 96px; max-height: 45dvh; padding: 10px 12px; border: 1px solid var(--ws-input-border);
  border-radius: 2px; background: var(--ws-surface); font-size: 15px; line-height: 1.5; resize: vertical; }
.rv-typed:hover { border-color: var(--ws-input-border-hover); }
.rv-typed:focus-visible { border-color: var(--ws-focus); }
.rv-row .btn { min-height: 44px; }
.rv-row .link { min-height: 32px; }
.btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }

/* What came back */
.rv-result:focus { outline: none; }
.rv-verdict { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 8px 12px; border: 2px solid transparent; font-size: 15px; font-weight: 600; }
.rv-verdict svg { flex: none; }
.rv-verdict.right { border-color: var(--ws-success); background: var(--ws-success-soft); }
.rv-verdict.right svg { color: var(--ws-success); }
.rv-verdict.missed { border-color: var(--ws-danger); background: var(--ws-danger-soft); }
.rv-verdict.missed svg { color: var(--ws-danger); }
.rv-part { margin: 0 0 12px; }
.rv-part h3 { margin: 0 0 4px; color: var(--ws-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rv-box { padding: 11px 14px; border: 1px solid var(--ws-border); background: var(--ws-surface-2); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.rv-box.why { border-color: var(--ws-note-border); background: var(--ws-note-bg); font-size: 14.5px; }
.rv-next { margin: 14px 0 0; color: var(--ws-muted); font-size: 14px; font-weight: 600; line-height: 1.45; }
.rv-ask { margin: 16px 0 0; font-size: 15px; font-weight: 600; }

/* The end of a sitting */
.rv-big { margin: 6px 0 4px; font-size: 20px; font-weight: 700; line-height: 1.35; }

/* Windows contrast themes drop fills: the bar keeps an edge and draws its parts in system colours */
@media (forced-colors: active) {
  .rv-meter { background: Canvas; border: 1px solid CanvasText; }
  .rv-meter .learned { forced-color-adjust: none; background: CanvasText; }
  .rv-meter .later { forced-color-adjust: none; background: GrayText; }
  .rv-meter .due { forced-color-adjust: none; background: Highlight; }
  .rv-meter .new { forced-color-adjust: none; background: Canvas; }
}
