/* ============================================================
   THEORIST STAGE REVIEW  (core/stage-review.js, window.QStageReview)

   Lutfi's "Quantum Dawn Stage Review" design, carried over value for value
   (the design scoped its rules to .qd-review; here they live under .qsr so
   none of its short class names can reach the rest of the page). Added for
   the game: the dimmed layer it sits on, the student's own choice on every
   card (Lutfi asked for it, 11 Oct), and a compact layout for a phone held
   sideways, which the design did not cover.
   ============================================================ */
.qsr {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet, 20);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(6, 10, 21, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.qsr[hidden] { display: none !important; }
.qsr.is-entering .qsr-card { animation: qsrIn 0.22s ease-out both; }
@keyframes qsrIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.qsr-card {
  --accent: #78e8dc;
  --muted: #a3b4ce;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #eef4ff;
  background: linear-gradient(135deg, #10202d 0, #0d1626 38%, #0d1524 100%);
  border: 1px solid #344657;
  border-radius: 18px;
  box-shadow: 0 25px 95px #0008;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: min(1160px, 100%);
  max-height: 100%;
  position: relative;
  color-scheme: dark;
  text-align: left;
  line-height: normal;
}
.qsr *, .qsr *::before, .qsr *::after { box-sizing: border-box; }
.qsr [hidden] { display: none !important; }
.qsr button { font: inherit; cursor: pointer; }
.qsr button:focus-visible, .qsr summary:focus-visible, .qsr .qsr-scroll:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }

/* ---- header ---- */
.qsr .qsr-header { padding: 27px 32px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-shrink: 0; }
.qsr .qsr-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 9px; letter-spacing: 1.9px; font-weight: 600; color: var(--accent); }
.qsr .qsr-atom { font-size: 21px; }
.qsr .qsr-divider { color: #4e6b83; margin: 0 2px; }
.qsr .qsr-heading h1 { margin: 10px 0; font-size: 32px; letter-spacing: -1px; font-weight: 550; line-height: 1.15; outline: none; font-family: inherit; text-transform: none; color: inherit; }
.qsr .qsr-heading p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.65; }
.qsr .qsr-score { flex-shrink: 0; min-width: 137px; padding: 14px 18px; border: 1px solid #76e9da29; border-radius: 9px; background: #78e8dc06; text-align: right; }
.qsr .qsr-score > span { display: block; font-size: 8px; letter-spacing: 1.5px; color: #9cafc5; }
.qsr .qsr-score strong { display: block; font-size: 33px; letter-spacing: -1px; color: var(--accent); font-weight: 550; margin: 5px 0; font-variant-numeric: tabular-nums; }
.qsr .qsr-score small { font-size: 10px; color: #a7b8cf; }
.qsr .qsr-score b { color: #f1f6ff; margin-left: 5px; font-weight: 500; }

/* ---- the stage strip ---- */
.qsr .qsr-strip { display: flex; align-items: center; gap: 13px; border-block: 1px solid #ffffff0e; background: #ffffff02; padding: 13px 32px; flex-shrink: 0; }
.qsr .qsr-mark { border: 1px solid #76e9da33; border-radius: 8px; background: #76e9da09; color: var(--accent); font-size: 13px; padding: 9px; font-variant-numeric: tabular-nums; }
.qsr .qsr-strip strong { display: block; font-size: 12px; font-weight: 550; }
.qsr .qsr-strip > div > span { display: block; font-size: 10px; color: #92a7c2; margin-top: 4px; }
.qsr .qsr-path { display: flex; align-items: center; margin-left: 13px; }
.qsr .qsr-path i { width: 7px; height: 7px; border: 1px solid #71909d; border-radius: 50%; }
.qsr .qsr-path i.done { background: var(--accent); border-color: var(--accent); }
.qsr .qsr-path > span { width: 40px; height: 1px; background: #3e6570; margin: 0 !important; }
.qsr .qsr-strip > p { margin: 0 0 0 auto; font-size: 10px; color: #b7c8dc; letter-spacing: 0.5px; }

/* ---- filters and the explanations switch ---- */
.qsr .qsr-tools { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 19px 32px 10px; flex-shrink: 0; }
.qsr .qsr-filters { display: flex; gap: 6px; }
.qsr .qsr-filters button { border: 1px solid transparent; background: transparent; color: #9fb2cd; padding: 9px 12px; border-radius: 6px; font-size: 11px; font-weight: 500; }
.qsr .qsr-filters button[aria-pressed="true"] { background: #78e8dc13; border-color: #78e8dc33; color: #a1f5ec; }
.qsr .qsr-filters button:hover { background: #ffffff09; }
.qsr .qsr-filters span { margin-left: 8px; border-radius: 4px; background: #ffffff08; padding: 2px 5px; font-size: 9px; }
.qsr .qsr-toggle { background: none; border: 0; color: #bdd0e6; font-size: 10px !important; padding: 8px; }
.qsr .qsr-toggle span { margin-left: 8px; color: var(--accent); }

/* ---- the statements ---- */
.qsr .qsr-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 32px 25px; scrollbar-color: #3c596e #0c1524; scrollbar-width: thin; }
.qsr .qsr-note { display: flex; justify-content: space-between; gap: 12px; color: #9aaec9; font-size: 9px; margin: 4px 0 14px; }
.qsr .qsr-note span:last-child { color: #8399b5; }
.qsr .qsr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; align-items: start; }
.qsr .qsr-stmt { border: 1px solid #2d3b51; border-radius: 10px; background: linear-gradient(120deg, #142337, #111c2e); padding: 18px 19px; position: relative; min-width: 0; }
.qsr .qsr-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.qsr .qsr-num { font-size: 9px; letter-spacing: 1.3px; color: #99aec9; }
.qsr .qsr-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qsr .qsr-truth { font-size: 9px; font-weight: 600; letter-spacing: 0.8px; display: inline-flex; gap: 7px; align-items: center; padding: 5px 8px; border-radius: 4px; background: #70e3b414; border: 1px solid #70e3b438; color: #97f1c7; }
.qsr .qsr-truth[data-truth="false"] { color: #ffb4bb; background: #fb839d10; border-color: #fb839d30; }
/* the student's own choice (added for the game) */
.qsr .qsr-you { font-size: 9px; font-weight: 600; letter-spacing: 0.8px; display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 4px; border: 1px solid #ffffff1f; color: #b9c7da; background: #ffffff06; }
.qsr .qsr-you.is-right { color: #a1f5ec; border-color: #78e8dc40; background: #78e8dc10; }
.qsr .qsr-you.is-wrong { color: #ffd08f; border-color: #ffbe6a45; background: #ffbe6a12; }
.qsr .qsr-stmt h2 { font-size: 13px; font-weight: 550; line-height: 1.65; margin: 0 0 14px; letter-spacing: 0.03px; font-family: inherit; text-transform: none; color: inherit; }
.qsr .qsr-stmt details { border-top: 1px solid #ffffff0f; padding-top: 12px; }
.qsr .qsr-stmt summary { cursor: pointer; color: #82ddd6; font-size: 10px; font-weight: 550; list-style: none; display: flex; align-items: center; gap: 8px; }
.qsr .qsr-stmt summary::-webkit-details-marker { display: none; }
.qsr .qsr-stmt summary::before { content: "+"; font-size: 15px; width: 11px; font-weight: 400; }
.qsr .qsr-stmt details[open] summary::before { content: "\2212"; }
.qsr .qsr-stmt details p { margin: 9px 0 0; color: #adbed6; font-size: 11px; line-height: 1.8; }
.qsr .qsr-empty { color: #a6b7ce; text-align: center; padding: 45px 20px; font-size: 13px; }
.qsr .qsr-hint { flex-shrink: 0; text-align: center; color: #8dc8cf; background: #0d1828; font-size: 9px; letter-spacing: 0.5px; padding: 7px 15px; border-top: 1px solid #ffffff08; }

/* ---- footer ---- */
.qsr .qsr-footer { padding: 17px 32px; border-top: 1px solid #ffffff13; background: #0e1928; display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-shrink: 0; flex-wrap: wrap; }
.qsr .qsr-copy { display: flex; align-items: center; gap: 11px; }
.qsr .qsr-copy > span { font-size: 19px; color: var(--accent); }
.qsr .qsr-copy p { font-size: 10px; margin: 0; color: #bbccdf; line-height: 1.65; }
.qsr .qsr-copy small { display: block; color: #8da3c0; font-size: 9px; }
.qsr .qsr-continue { display: flex; gap: 20px; align-items: center; justify-content: space-between; color: #0b2025; background: var(--accent); border: 1px solid var(--accent); border-radius: 7px; padding: 14px 20px; font-size: 11px !important; font-weight: 650 !important; min-width: 216px; }
.qsr .qsr-continue:hover { background: #a0f3e9; }
.qsr .qsr-continue > span:last-child { font-size: 17px; }

/* ---- the design's phone layouts ---- */
@media (max-width: 760px) {
  .qsr { padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px)); }
  .qsr .qsr-card { border-radius: 12px; }
  .qsr .qsr-header { padding: 21px; gap: 12px; }
  .qsr .qsr-heading h1 { font-size: 26px; }
  .qsr .qsr-heading p { font-size: 11px; }
  .qsr .qsr-eyebrow { font-size: 7px; letter-spacing: 1px; gap: 6px; }
  .qsr .qsr-score { min-width: 95px; padding: 10px; }
  .qsr .qsr-score strong { font-size: 27px; }
  .qsr .qsr-score small { font-size: 9px; }
  .qsr .qsr-strip { padding: 12px 21px; }
  .qsr .qsr-path { display: none; }
  .qsr .qsr-tools { padding: 13px 17px 7px; align-items: flex-start; flex-wrap: wrap; }
  .qsr .qsr-filters button { padding: 8px 9px; font-size: 10px; }
  .qsr .qsr-filters span { margin-left: 4px; }
  .qsr .qsr-toggle { padding-left: 4px; }
  .qsr .qsr-scroll { padding: 0 18px 19px; }
  .qsr .qsr-grid { grid-template-columns: 1fr; }
  .qsr .qsr-note { font-size: 8px; flex-wrap: wrap; gap: 5px; }
  .qsr .qsr-footer { padding: 13px 18px; }
  .qsr .qsr-continue { min-width: 190px; }
  .qsr .qsr-copy { display: none; }
}
@media (max-width: 430px) {
  .qsr .qsr-header { padding: 18px 17px; }
  .qsr .qsr-heading h1 { font-size: 23px; }
  .qsr .qsr-heading p { display: none; }
  .qsr .qsr-score { min-width: 83px; }
  .qsr .qsr-score strong { font-size: 25px; }
  .qsr .qsr-score > span { font-size: 7px; }
  .qsr .qsr-eyebrow { flex-wrap: wrap; font-size: 6px; gap: 5px; }
  .qsr .qsr-atom { font-size: 16px; }
  .qsr .qsr-strip { padding: 10px 17px; }
  .qsr .qsr-strip > p { font-size: 9px; max-width: 90px; text-align: right; line-height: 1.6; }
  .qsr .qsr-strip strong { font-size: 11px; }
  .qsr .qsr-tools { gap: 3px; }
  .qsr .qsr-footer .qsr-continue { width: 100%; }
  .qsr .qsr-stmt { padding: 15px; }
  .qsr .qsr-stmt h2 { font-size: 12px; }
}
/* A phone held sideways (not in the design): everything above and below the
   list is made shorter so the statements keep most of the height. */
@media (max-height: 520px) {
  .qsr { padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); }
  .qsr .qsr-header { padding: 10px 20px; }
  .qsr .qsr-heading h1 { font-size: 20px; margin: 3px 0 0; }
  .qsr .qsr-heading p { display: none; }
  .qsr .qsr-score { padding: 6px 12px; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
  .qsr .qsr-score strong { font-size: 20px; margin: 0; }
  .qsr .qsr-score small { display: none; }
  .qsr .qsr-strip { padding: 6px 20px; }
  .qsr .qsr-mark { padding: 4px 6px; font-size: 11px; }
  .qsr .qsr-strip > div > span { margin-top: 1px; }
  .qsr .qsr-tools { padding: 6px 20px 2px; }
  .qsr .qsr-filters button { padding: 6px 9px; }
  .qsr .qsr-scroll { padding: 0 20px 12px; }
  .qsr .qsr-note { margin: 2px 0 8px; }
  .qsr .qsr-hint { padding: 4px 15px; }
  .qsr .qsr-footer { padding: 7px 20px; }
  .qsr .qsr-copy { display: none; }
  .qsr .qsr-continue { padding: 9px 16px; }
  .qsr .qsr-eyebrow, .qsr .qsr-note { display: none; }
}
/* the settings gear sits in the bottom corner of a phone: the card keeps
   clear of it, as the sheets do (style.css body.sheet-open) */
body.stage-review-open[data-layout="portrait"] .qsr { padding-bottom: max(70px, env(safe-area-inset-bottom, 0px)); }
body.stage-review-open[data-layout="landscape"] .qsr { padding-right: 64px; }

/* ---- settings ---- */
body.stage-review-open .touchControls { display: none !important; }
body.a11y-high-contrast .qsr .qsr-card { border-color: #ffffffaa; background: #050a14; }
body.a11y-high-contrast .qsr .qsr-stmt { border-color: #ffffff77; background: #0b1424; }
body.a11y-high-contrast .qsr .qsr-heading p, body.a11y-high-contrast .qsr .qsr-note,
body.a11y-high-contrast .qsr .qsr-stmt details p, body.a11y-high-contrast .qsr .qsr-num { color: #eef3fb; }
body.a11y-large-text .qsr .qsr-stmt h2 { font-size: 15px; }
body.a11y-large-text .qsr .qsr-stmt details p { font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .qsr.is-entering .qsr-card { animation: none; }
  .qsr * { scroll-behavior: auto !important; }
}
body.a11y-reduced-motion .qsr.is-entering .qsr-card { animation: none; }
