/* SOTA Tests: the test page (choosing a mode), the player, results and review, and /attempts/.
   Colours and type sizes come from sota.css (paper, ink, hairlines, red for the current place);
   green and red for right and wrong answers are defined in tests.css. Square corners, no shadows. */

#player,
#attempts { max-width: 1180px; margin-inline: auto; }
/* Parts of the page set aside by the player (some have their own display, which beats [hidden]) */
#player [hidden],
#attempts [hidden] { display: none !important; }

/* ---------- text from the test files (Markdown with KaTeX, tables, figures) ---------- */

.prose { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.prose p, .prose li { hyphens: manual; }
.prose ul, .prose ol { display: grid; gap: 6px; padding-left: 1.4em; margin: 0; }
.prose img { max-width: min(100%, 600px); height: auto; margin-inline: auto; }
.prose hr { width: 100%; border: 0; border-top: 1px solid var(--hairline); }
.prose :not(pre) > code { font-family: var(--mono); font-size: .82em; background: var(--plate); padding: .08em .32em; }
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--text-ui);
  line-height: 1.45;
  font-variant-numeric: lining-nums tabular-nums;
}
.prose th, .prose td { padding: 7px 12px; text-align: left; vertical-align: top; }
.prose thead th { font-weight: 600; white-space: nowrap; border-top: 1.5px solid var(--ink); border-bottom: .8px solid var(--ink); }
.prose tbody tr:last-child > * { border-bottom: 1.5px solid var(--ink); }
.prose table:not(:has(thead)) tbody tr:first-child > * { border-top: 1.5px solid var(--ink); }
.katex { font-size: 1.04em; }
.katex-display { margin: 0; padding-block: 4px; overflow-x: auto; overflow-y: hidden; }

/* ---------- the test page: what the test is ---------- */

.test-hero {
  display: grid;
  gap: 12px;
  padding: 8px 0 28px;
  border-bottom: 1px solid var(--hairline);
}
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--text-small); color: var(--graphite); }
.crumbs a { color: var(--graphite); }
.crumbs a:hover { color: var(--ink); }
.test-hero h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.1; }
.test-lede { max-width: 62ch; font-size: var(--text-body); color: var(--graphite); }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.facts li {
  display: grid;
  gap: 2px;
  padding: 2px 28px 2px 0;
  margin-right: 28px;
  border-right: 1px solid var(--hairline);
}
.facts li:last-child { border-right: 0; margin-right: 0; }
.fact-num { font-size: 22px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.fact-label { font-size: var(--text-small); color: var(--graphite); }

/* ---------- the test page: choosing a mode ---------- */

.mode-picker { padding: 28px 0 8px; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.mode {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 26px 26px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--ink);
}
.mode-serious { border-top-color: var(--red); }
.mode-head { display: grid; gap: 6px; }
.mode-head h2 { font-size: var(--text-h2); line-height: 1.2; }
.mode-head p { color: var(--graphite); font-size: var(--text-ui); line-height: 1.5; }
.rules { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; font-size: var(--text-ui); line-height: 1.45; }
.rules li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.rules li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 4px;
  background: var(--graphite);
  transform: translateY(-2px);
}
.mode-serious .rules li::before { background: var(--red); }
.honest { font-size: var(--text-small); color: var(--graphite); line-height: 1.5; }
.mode-past {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 10px 12px;
  font-size: var(--text-small);
  color: var(--graphite);
  background: var(--plate);
}
.mode-past strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.mode-past a { margin-left: auto; }
.mode-done { font-size: var(--text-ui); color: var(--graphite); }
.mode-done strong { color: var(--ink); }
.mode-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 4px; }
.mode-actions:empty { display: none; }
.mode-note { font-size: var(--text-small); color: var(--graphite); text-align: center; }
.picker-msg { min-height: 1.6em; margin-top: 14px; color: var(--red); font-size: var(--text-ui); }
.picker-msg:empty { min-height: 0; margin: 0; }

/* ---------- the test page: before you start ---------- */

.test-about { display: grid; gap: 14px; padding: 36px 0 12px; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 40px; align-items: start; }
.test-instructions { font-size: var(--text-ui); line-height: 1.6; }
.about-sections { display: grid; gap: 10px; }
.about-by { font-size: var(--text-small); color: var(--graphite); }
.test-sections {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
  font-variant-numeric: tabular-nums;
}
.test-sections th, .test-sections td { padding: 9px 10px 9px 0; text-align: left; vertical-align: baseline; }
.test-sections th:not(:first-child), .test-sections td:not(:first-child) { text-align: right; padding-right: 0; padding-left: 12px; white-space: nowrap; }
.test-sections thead th {
  font-weight: 400;
  font-size: var(--text-label);
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--graphite);
  border-bottom: 1px solid var(--ink);
}
.test-sections tbody td { border-bottom: 1px solid var(--hairline); }
.test-sections tfoot td { font-weight: 600; border-bottom: 1px solid var(--ink); }
.sec-id {
  display: inline-block;
  min-width: 2.4em;
  margin-right: 8px;
  font-size: var(--text-small);
  color: var(--graphite);
}

@media (max-width: 860px) {
  .modes, .about-grid { grid-template-columns: minmax(0, 1fr); }
  .about-grid { gap: 24px; }
}
@media (max-width: 520px) {
  .mode { padding: 20px 18px 22px; }
  .facts li { padding-right: 18px; margin-right: 18px; }
  .fact-num { font-size: 19px; }
}

/* ---------- the running attempt ---------- */

/* The site's top bar and footer step aside; the attempt has its own bar. */
body.is-running .topbar,
body.is-running .footer,
body.is-running .skip { display: none; }
body.is-running .page { padding-top: 0; padding-bottom: 0; }

.run-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 20px;
  padding: 12px 0 10px;
  font-size: var(--text-ui);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.run-name { display: flex; align-items: baseline; gap: 4px 12px; min-width: 0; }
.run-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-tools { display: flex; align-items: center; gap: 10px; }
.run-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 5.5em;
  font-size: var(--text-small);
  color: var(--graphite);
}
.run-save::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--hairline); }
.run-save[data-state="saved"]::before { background: var(--good); }
.run-save[data-state="saving"]::before { background: var(--graphite); }
.run-save[data-state="error"] { color: var(--red); }
.run-save[data-state="error"]::before { background: var(--red); }
.run-timer {
  min-width: 5.2ch;
  padding: 5px 10px 2px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--hairline);
}
.run-timer.is-low { color: var(--red); border-color: var(--red); }
/* How far through: answered questions, under the bar */
.run-progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; font-size: var(--text-small); color: var(--graphite); }
.run-progress .bar { flex: 1; }

.run-body {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 44px;
  padding-top: 26px;
}

/* The palette (and the review map): every question by id, grouped by section */
.palette {
  position: sticky;
  top: 112px;
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
  padding: 2px 4px 12px 2px;
  scrollbar-width: thin;
}
.pal-section .block-title { display: block; margin-bottom: 7px; line-height: 1.35; }
.pal-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.pal {
  position: relative;
  width: 100%;
  height: 36px;
  padding: 3px 0 0;
  font: inherit;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pal:hover { border-color: var(--ink); }
.pal.is-answered { color: var(--paper); background: var(--ink); border-color: var(--ink); }
/* The current question: a red ring drawn inside the box, so the scrolling list never clips it */
.pal[aria-current] { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 4px var(--paper); }
.pal.is-dim[aria-current] { opacity: 1; }
/* Flagged: a red corner */
.pal.is-flagged::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  border-style: solid;
  border-width: 0 11px 11px 0;
  border-color: transparent var(--red) transparent transparent;
}
/* Review map: right, wrong, not answered */
.pal.is-right { color: var(--good); background: var(--good-tint); border-color: var(--good); }
.pal.is-wrong { color: var(--red); background: var(--bad-tint); border-color: var(--red); }
.pal.is-blank { color: var(--graphite); border-style: dashed; }
.pal.is-dim { opacity: .3; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--hairline); list-style: none; font-size: 13.5px; color: var(--graphite); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 13px; height: 13px; border: 1px solid var(--hairline); background: var(--paper); }
.legend i.is-answered { background: var(--ink); border-color: var(--ink); }
.legend i.is-current { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.legend i.is-flagged { position: relative; }
.legend i.is-flagged::after { content: ""; position: absolute; top: -1px; right: -1px; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent var(--red) transparent transparent; }
.legend i.is-right { background: var(--good-tint); border-color: var(--good); }
.legend i.is-wrong { background: var(--bad-tint); border-color: var(--red); }
.legend i.is-blank { border-style: dashed; }

/* One question */
.question { display: grid; align-content: start; gap: 20px; min-width: 0; max-width: 780px; }
.q-where { font-size: var(--text-small); color: var(--graphite); }
.q-where b { font-weight: 600; color: var(--ink); margin-right: 6px; }
.q-instructions { font-size: var(--text-ui); color: var(--graphite); }

/* A case study's background: open by default, can be folded away */
.case { background: var(--plate); border-left: 3px solid var(--ink); }
.case > summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 18px 10px;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-ui);
}
.case > summary::-webkit-details-marker { display: none; }
.case > summary .block-title { color: var(--ink); }
.case-title { font-weight: 600; }
.case-toggle { margin-left: auto; font-size: var(--text-small); color: var(--graphite); white-space: nowrap; }
.case-toggle::after { content: "Hide"; }
.case:not([open]) .case-toggle::after { content: "Show"; }
.case > .prose { padding: 4px 20px 20px; font-size: var(--text-ui); line-height: 1.6; }
/* While answering, a long background scrolls inside its panel, so the question stays in view */
.run .case[open] > .prose { max-height: min(46vh, 520px); overflow-y: auto; scrollbar-width: thin; }

.q-card { display: grid; gap: 18px; }
.q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; outline: none; }
.q-id {
  padding: 4px 9px 1px;
  font-size: var(--text-ui);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--ink);
}
.q-title { font-size: var(--text-h3); font-weight: 600; line-height: 1.3; }
.q-head .r-badge { margin-left: auto; }
.q-points { margin-left: auto; font-size: var(--text-small); color: var(--graphite); white-space: nowrap; }
.q-prompt { font-size: var(--text-body); line-height: 1.6; }

.options { display: grid; gap: 10px; }
.option {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  font: inherit;
  font-size: var(--text-body);
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: var(--graphite); background: var(--plate); }
.option:focus-visible { outline: 2px solid var(--graphite); outline-offset: 2px; }
.opt-letter {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding-top: 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--graphite);
  border: 1px solid var(--hairline);
}
.opt-text { min-width: 0; overflow-x: auto; overflow-y: hidden; }
.option.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--plate); }
.option.is-on .opt-letter { color: var(--paper); background: var(--ink); border-color: var(--ink); }

/* Select all that apply: the same buttons, each with a tick box on the right */
.multi-note { margin: 0 0 2px; font-size: var(--text-small); font-weight: 600; color: var(--ink); }
.option.is-multi { grid-template-columns: 32px minmax(0, 1fr) 22px; }
.opt-check {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: transparent;
  border: 1.5px solid var(--graphite);
}
.opt-check svg { width: 16px; height: 16px; }
.option.is-on .opt-check { color: var(--paper); background: var(--ink); border-color: var(--ink); }

/* Number: the box, then the unit */
.num-row { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; max-width: 100%; }
.num-answer input { width: 240px; }
.num-answer input[aria-invalid="true"] { border-color: var(--red); }
.num-unit { font-size: 22px; }
.int-hint.is-bad { color: var(--red); font-weight: 600; }

.int-answer { display: grid; gap: 8px; justify-items: start; }
.int-answer .block-title { color: var(--ink); }
.int-answer input {
  width: 200px;
  max-width: 100%;
  height: 56px;
  padding: 4px 16px 0;
  font: inherit;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
}
.int-answer input:focus { outline: 2px solid var(--graphite); outline-offset: 2px; }
.int-answer input::placeholder { color: var(--graphite); opacity: .6; font-size: 18px; }
.int-hint { font-size: var(--text-small); color: var(--graphite); }

/* Previous / flag / next, kept in view at the bottom */
.q-nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 0 16px;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
}
.q-nav .spacer { flex: 1; }
.flag.is-on { color: var(--red); border-color: var(--red); }
.keys { font-size: 13.5px; color: var(--graphite); white-space: nowrap; }

/* Covers: paused (hides the questions completely), confirm submit, ended */
.run-cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(2px);
}
.run-cover[hidden] { display: none; }
.run-cover.is-paused,
.run-cover.is-busy { background: var(--paper); backdrop-filter: none; }
.cover-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 460px);
  padding: 32px 30px 30px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--ink);
}
.cover-box h2 { font-size: var(--text-h2); line-height: 1.2; }
.cover-box p { color: var(--graphite); font-size: var(--text-ui); }
.cover-label { font-size: var(--text-h2); color: var(--ink) !important; }
.cover-time { font-size: 56px; font-weight: 600; line-height: 1; color: var(--ink) !important; font-variant-numeric: tabular-nums; }
.cover-sub { margin-top: -6px; }
.cover-stats { display: flex; justify-content: center; gap: 22px; width: 100%; padding: 12px 0; border-block: 1px solid var(--hairline); }
.cover-stats div { display: grid; gap: 2px; }
.cover-stats b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--ink); }
.cover-stats span { font-size: var(--text-small); color: var(--graphite); }
.cover-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cover-msg { color: var(--red) !important; }
.cover-msg:empty { display: none; }

/* Serious mode: no selecting text (except in the answer box), no printing */
body.is-serious { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.is-serious input { -webkit-user-select: text; user-select: text; }
@media print {
  body.is-serious > * { display: none !important; }
  body.is-serious::before { content: "Printing is off during a serious attempt."; }
}

@media (max-width: 860px) {
  .run-bar { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 0 8px; }
  .run-tools { flex-wrap: wrap; }
  .run-save { margin-right: auto; }
  .run-timer { font-size: 19px; }
  .run-body { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 14px; }
  /* The palette becomes one scrolling row under the bar */
  .palette {
    position: static;
    display: flex;
    gap: 16px;
    max-height: none;
    overflow-x: auto;
    padding: 2px 2px 12px;
    border-bottom: 1px solid var(--hairline);
  }
  .pal-section { flex: none; }
  .pal-section .block-title { white-space: nowrap; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; }
  .pal-list { display: flex; }
  .pal { width: 44px; }
  .legend { display: none; }
  .keys { display: none; }
  .case > summary { padding: 10px 14px 8px; }
  .case > .prose { padding: 2px 14px 16px; }
  .option { gap: 10px; padding: 9px 12px; }
  .option.is-multi { grid-template-columns: 30px minmax(0, 1fr) 22px; }
  .q-nav .btn { flex: 1; padding-inline: 10px; }
  .q-nav .spacer { display: none; }
}

/* ---------- results ---------- */

.result { display: grid; gap: 28px; padding-top: 8px; }
.res-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 24px 48px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline);
}
.res-main { display: grid; gap: 10px; align-content: start; }
.res-main h1 { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.12; }
.res-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--text-small); color: var(--graphite); }
.res-meta .mode-chip { padding-top: 1px; }
.score { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.score-num { font-size: 72px; font-weight: 700; line-height: .95; font-variant-numeric: tabular-nums; }
.score-of { font-size: 26px; color: var(--graphite); font-variant-numeric: tabular-nums; }
.score-pct { margin-left: 4px; padding: 3px 10px 1px; font-size: var(--text-ui); font-variant-numeric: tabular-nums; border: 1px solid var(--hairline); }
.res-main .bar { height: 8px; max-width: 520px; margin-top: 6px; }
.res-notice { max-width: 560px; padding: 10px 14px; font-size: var(--text-ui); color: var(--red); background: var(--bad-tint); border-left: 3px solid var(--red); }
.res-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; border-top: 1px solid var(--ink); }
.res-stats div { display: grid; gap: 2px; padding: 14px 0 12px; border-bottom: 1px solid var(--hairline); }
.res-stats div:nth-child(odd) { padding-right: 16px; }
.res-stats div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--hairline); }
.res-stats b { font-size: 26px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.res-stats span { font-size: var(--text-small); color: var(--graphite); }
.res-stats .is-right b { color: var(--good); }
.res-stats .is-wrong b { color: var(--red); }

.res-sections { display: grid; gap: 12px; }
.sec-rows { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.sec-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(120px, 1fr) 5.5em;
  align-items: center;
  gap: 18px;
  padding: 11px 0;
  font-size: var(--text-ui);
  border-bottom: 1px solid var(--hairline);
}
.sec-row:first-child { border-top: 1px solid var(--ink); }
.sec-row .bar { height: 6px; }
.sec-row .num { text-align: right; font-weight: 600; }
.res-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Review: the map on the left, one question at a time on the right */
.review { display: grid; gap: 16px; padding-top: 28px; border-top: 1px solid var(--ink); scroll-margin-top: 16px; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.review-head h2 { font-size: var(--text-h2); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  height: 34px;
  padding: 3px 12px 0;
  font: inherit;
  font-size: var(--text-small);
  color: var(--graphite);
  background: var(--paper);
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.filter b { font-weight: 600; font-variant-numeric: tabular-nums; }
.review-body { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 44px; }
.review .palette { top: 16px; max-height: calc(100vh - 32px); }

.r-badge svg, .r-tag svg { width: 14px; height: 14px; flex: none; margin-top: -2px; }
.r-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 1px;
  font-size: var(--text-small);
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.r-badge.is-right { color: var(--good); background: var(--good-tint); }
.r-badge.is-wrong { color: var(--red); background: var(--bad-tint); }
.r-badge.is-blank { color: var(--graphite); border-style: dashed; }

.r-options { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.r-option {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 9px 16px;
  font-size: var(--text-body);
  border: 1px solid var(--hairline);
}
.r-option.is-right { border-color: var(--good); background: var(--good-tint); box-shadow: inset 0 0 0 1px var(--good); }
.r-option.is-right .opt-letter { color: #fff; background: var(--good); border-color: var(--good); }
:root[data-theme="dark"] .r-option.is-right .opt-letter { color: var(--paper); }
.r-option.is-wrong { border-color: var(--red); background: var(--bad-tint); }
.r-option.is-wrong .opt-letter { color: var(--red); border-color: var(--red); }
.r-tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-small); white-space: nowrap; }
.r-option.is-right .r-tag { color: var(--good); font-weight: 600; }
.r-option.is-wrong .r-tag { color: var(--red); font-weight: 600; }

.r-integer { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.r-integer > div { display: grid; gap: 4px; min-width: 11rem; padding: 12px 16px 10px; border: 1px solid var(--hairline); }
.r-integer dt { font-size: var(--text-small); color: var(--graphite); }
.r-integer dd { margin: 0; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.r-integer .is-right { border-color: var(--good); background: var(--good-tint); }
.r-integer .is-right dd { color: var(--good); }
.r-integer .is-wrong { border-color: var(--red); background: var(--bad-tint); }
.r-integer .is-wrong dd { color: var(--red); }
.r-integer dd .r-unit, .r-integer dd .r-tol { font-size: 18px; font-weight: 400; }
.r-options + .r-options, .r-integer + .r-options { margin-top: 2px; }

.r-solution { display: grid; gap: 10px; padding: 18px 20px 20px; background: var(--plate); border-left: 3px solid var(--good); }
.r-solution .block-title { color: var(--ink); }
.r-solution .prose { font-size: var(--text-ui); line-height: 1.6; }
.review .q-nav { margin-top: 4px; }
.r-pos { font-size: var(--text-small); color: var(--graphite); font-variant-numeric: tabular-nums; }
.review-empty { padding: 24px 0; color: var(--graphite); }

@media (max-width: 860px) {
  .res-hero { grid-template-columns: minmax(0, 1fr); }
  .score-num { font-size: 56px; }
  .sec-row { grid-template-columns: minmax(0, 1fr) 5em; gap: 6px 12px; }
  .sec-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .review-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .r-option { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 9px 12px; }
  .r-tag { grid-column: 2; }
}

/* ---------- /attempts/ ---------- */

.att-list { display: grid; margin: 24px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.att {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 220px) auto;
  align-items: center;
  gap: 8px 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}
.att-name { display: grid; gap: 4px; min-width: 0; }
.att-name a { font-size: var(--text-h3); font-weight: 600; color: var(--ink); }
.att-name a:hover { color: var(--red); text-decoration: none; }
.att-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--text-small); color: var(--graphite); }
.att-score { display: grid; gap: 6px; }
.att-score b { font-size: var(--text-ui); font-variant-numeric: tabular-nums; }
.att-score .bar { height: 5px; }
.attempts-empty, .attempts-msg { padding: 28px 0; color: var(--graphite); }
.attempts-msg { color: var(--red); }
@media (max-width: 640px) {
  .att { grid-template-columns: minmax(0, 1fr) auto; }
  .att-score { grid-column: 1 / -1; grid-row: 2; }
}
