/* ============================================================
   exam.css — the competition simulator.

   Everything here is new UI the drills never needed: multiple-choice
   buttons, a whole-paper navigator, a band colour, and the read-back.
   It sits in its own file because css/interactive.css is already long
   and none of this is reachable from a drill.

   Two rules carried over from the rest of the dojo:
     · earned and unearned states never share a colour
     · the thing under time pressure is the loudest thing on screen
   ============================================================ */

/* ---------------- shared bits ---------------- */

/* A digit with a bar over it is worth MINUS that digit. The overline has
   to sit close, or a competitor reads 2̄ as 2 and loses the question. */
.vinc {
  position: relative;
  padding-top: 1px;
  border-top: 2px solid currentColor;
  margin: 0 0.5px;
}

/* Band colours. Used on the sit screen, the navigator and the read-back,
   so a student always knows which part of the paper they are in. */
.band {
  font-size: var(--t-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  border: 1px solid currentColor;
}
.band--easy {
  color: var(--ok);
}
.band--average {
  color: var(--warn);
}
.band--hard {
  color: var(--bad);
}

/* ---------------- the menu ---------------- */

.exam-intro {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
}

.exam-intro p {
  margin: 0 0 var(--s-2);
  max-width: var(--measure);
}

.exam-intro p:last-child {
  margin-bottom: 0;
}

.exam-intro__small {
  font-size: var(--t-sm);
  color: var(--ink-3);
  line-height: 1.6;
}

.mode--exam .mode__best b {
  color: var(--accent);
}

/* ---------------- the briefing ---------------- */

.brief__eyebrow {
  font-size: var(--t-sm);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.brief p {
  max-width: var(--measure);
  color: var(--ink-2);
  margin: 0;
}

.brief__paces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  width: 100%;
}

.pace {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.pace:hover {
  border-color: var(--line-strong);
}

.pace.is-on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.pace__label {
  font-weight: 800;
}

.pace__time {
  font-family: var(--mono);
  font-size: var(--t-lg);
  font-weight: 800;
  color: var(--accent);
}

.pace__why {
  font-size: var(--t-xs);
  color: var(--ink-3);
  line-height: 1.55;
}

/* ---------------- sitting the paper ---------------- */

.sit {
  display: grid;
  gap: var(--s-4);
}

.sit__bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(10px);
}

/* The clock is the loudest thing on the bar, and it gets louder. */
.sit__clock {
  font-family: var(--mono);
  font-size: var(--t-lg);
  font-weight: 800;
  color: var(--ink);
}
.sit__clock.is-warm {
  color: var(--warn);
}
.sit__clock.is-hot {
  color: var(--bad);
  animation: sitPulse 1s steps(2) infinite;
}

@keyframes sitPulse {
  50% {
    opacity: 0.45;
  }
}

.sit__count {
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin-right: auto;
}

.sit__count b {
  color: var(--ink);
  font-family: var(--mono);
}

.sit__q {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  padding: var(--s-5);
  display: grid;
  gap: var(--s-4);
}

.sit__meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.sit__num {
  font-size: var(--t-sm);
  color: var(--ink-3);
  font-weight: 700;
}

.sit__flag {
  font-size: var(--t-xs);
  color: var(--accent);
  font-weight: 700;
}

.sit__stem {
  font-size: var(--t-lg);
  line-height: 1.55;
  font-weight: 600;
}

.sit__choices {
  display: grid;
  gap: var(--s-2);
}

.choice {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: var(--s-3);
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    transform 120ms var(--ease);
}

.choice:hover {
  border-color: var(--line-strong);
}

.choice:active {
  transform: translateY(1px);
}

.choice.is-picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.choice__k {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-weight: 800;
  font-size: var(--t-sm);
}

.choice.is-picked .choice__k {
  background: var(--accent);
  border-color: var(--accent);
  color: #17110a;
}

.choice__v {
  font-family: var(--mono);
  font-size: var(--t-md);
}

.sit__nav {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.sit__nav .btn:last-child {
  margin-left: auto;
}

/* The navigator. Answered, flagged and blank must be tellable apart at a
   glance and without relying on colour alone — a flag adds a ring. */
.sit__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
}

.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms var(--ease);
}

.cell:hover {
  transform: scale(1.08);
}

.cell.is-done {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.cell.is-flag {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cell.is-cur {
  border-color: var(--accent);
  background: var(--accent);
  color: #17110a;
}

.cell--easy.is-done {
  border-bottom: 3px solid var(--ok);
}
.cell--average.is-done {
  border-bottom: 3px solid var(--warn);
}
.cell--hard.is-done {
  border-bottom: 3px solid var(--bad);
}

.sit__hint {
  font-size: var(--t-xs);
  color: var(--ink-3);
  margin: 0;
  text-align: center;
}

@media (max-width: 720px) {
  .sit__hint {
    display: none; /* no physical keyboard to hint about */
  }
  .sit__stem {
    font-size: var(--t-md);
  }
}

/* ---------------- diagnosis ---------------- */

.diag {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: var(--s-4);
}

.diag h4 {
  margin: 0 0 2px;
}

.diag__lede {
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin: 0 0 var(--s-3);
}

.diag__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-top: 1px solid var(--line);
}

.diag__ico {
  font-size: 22px;
}

.diag__body {
  display: grid;
  margin-right: auto;
}

.diag__sub {
  font-size: var(--t-xs);
  color: var(--ink-3);
}

.diag__locked {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-style: italic;
}

/* ---------------- the read-back ---------------- */

.review h3 {
  margin-bottom: var(--s-2);
}

.review__filter {
  display: flex;
  gap: var(--s-2);
  margin: var(--s-4) 0;
}

.review__filter .chip {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.review__filter .chip.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.rev {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
}

.rev--ok {
  border-left-color: var(--ok);
}

.rev--bad {
  border-left-color: var(--bad);
}

.rev__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}

.rev__n {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-weight: 800;
  font-size: var(--t-xs);
}

.rev__topic {
  font-weight: 700;
  font-size: var(--t-sm);
}

.rev__sutra {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-style: italic;
}

.rev__mark {
  margin-left: auto;
  font-weight: 800;
  font-family: var(--mono);
}

.rev--ok .rev__mark {
  color: var(--ok);
}

.rev--bad .rev__mark {
  color: var(--bad);
}

.rev__stem {
  font-size: var(--t-md);
  line-height: 1.55;
  margin-bottom: var(--s-3);
}

.rev__ans {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: var(--t-sm);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  margin-bottom: var(--s-3);
}

.rev__yours--ok {
  color: var(--ok);
}
.rev__yours--bad {
  color: var(--bad);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.rev__yours--blank {
  color: var(--ink-3);
  font-style: italic;
}

.rev__right b {
  color: var(--ok);
}

/* The worked solution is the point of the whole screen, so it gets the
   numbered-list treatment rather than a paragraph. */
.rev__work {
  margin: 0 0 var(--s-3);
  padding-left: 1.4em;
  display: grid;
  gap: var(--s-1);
}

.rev__work li {
  line-height: 1.7;
  color: var(--ink-2);
}

.rev__work li b {
  color: var(--ink);
}

.rev__foot {
  display: flex;
  justify-content: flex-end;
}

/* ---------------- free-form drill answers ---------------- */

/* A mixed fraction or a negative coefficient cannot be typed on a numeric
   pad, so the extra row appears only for the questions that need it. */
.keypad--alt {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
}

.run.is-free .keypad--alt {
  display: grid;
}

.key--alt {
  font-size: var(--t-sm);
}

.run__note {
  text-align: center;
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin-top: calc(var(--s-2) * -1);
}

@media (max-width: 720px) {
  .keypad--alt {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 721px) {
  .keypad--alt {
    display: none !important; /* a physical keyboard already has these */
  }
}
