/* List quizzes (list quizzes spec D8): the control bar, the prompt list (one table, or two halves side by side
   from 1024 px), the result and the page text. Scoped under .q-list. Adapted from US Presidents' layout
   (/quiz/us-presidents/us-presidents.css); existing tokens only, before a design pass. */

.q-list { padding-block: var(--s5) var(--s7); }
.q-list__intro { display: grid; gap: var(--s2); margin-bottom: var(--s5); max-width: 60ch; }
.q-list__intro h1 { font-size: 28px; }

.q-list__game { max-width: none; display: grid; gap: var(--s3); padding: var(--s3); }
.q-list__game:focus { outline: none; }

/* ---------- control bar: sticky on mobile, so the input and the "Last named" line stay in view ---------- */
.q-list__bar {
  position: sticky; top: 0; z-index: 4;
  display: grid; gap: var(--s2);
  margin: calc(-1 * var(--s3)) calc(-1 * var(--s3)) 0; padding: var(--s3);
  background: var(--surface); border-radius: var(--r-card) var(--r-card) 0 0;
  border-bottom: 1px solid var(--line);
}
.q-list__bar > * { min-width: 0; } /* a long "Last named" line ellipsizes instead of widening the bar */
.q-list__row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.q-list__actions { display: flex; gap: var(--s2); margin-left: auto; }
.q-list__input {
  width: 100%; min-height: 48px; padding: 0 var(--s4);
  font-size: 18px; /* 16 px or more keeps iOS from zooming on focus */
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
}
.q-list__input:disabled { opacity: .5; }
/* "Last named: …" / "Already named: …" / feedback: one line, reserved so nothing shifts */
.q-list__feedback {
  min-height: 1.5em; margin-top: var(--s1); padding-inline: var(--s4); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.q-list__result { display: grid; gap: var(--s3); padding-block: var(--s2); }
.q-list__result .fig dd { font-size: 24px; }

/* ---------- the list ---------- */
.q-list__board { position: relative; min-width: 0; }
/* The rows are drawn by JS; their space is reserved so nothing below shifts (CLS): --rows rows of 34 px plus the
   header in one column, the first table's --rows-a rows of 30 px side by side (both set on the element) */
.q-list__lists { display: grid; gap: 0 var(--s5); min-height: calc(var(--rows) * 34px + 35px); }
.q-list__table { width: 100%; border-collapse: collapse; font-size: 15px; }
.q-list__table thead th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: var(--s2); }
.q-list__lists .q-list__table + .q-list__table thead { display: none; } /* one column on mobile: one header */
.q-list__table tbody th, .q-list__table td { padding: 5px var(--s2); border-bottom: 1px solid var(--line); height: 34px; text-align: left; }
/* prompts in the muted ink, the answer column bold */
.q-list__table tbody th { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.q-list__table tbody td:not(:last-child) { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.q-list__table td:last-child { font-weight: 600; width: 50%; }
.q-list__table tr.is-new { background: color-mix(in srgb, var(--state-correct) 16%, var(--surface)); }
.q-list__table tr { transition: background-color 1s var(--ease); }
.q-list__missed { color: var(--state-wrong); font-style: italic; }
.q-list__extra { display: block; font-size: 13px; font-weight: 400; color: var(--ink-2); }

/* ---------- pause: cover the list ---------- */
.q-list__pause { inset: 0; padding: var(--s4); align-content: start; }
.q-list__pause p { font-size: 18px; }
.q-list.is-paused .q-list__lists { visibility: hidden; }

/* ---------- your stats and the page text ---------- */
.q-list__stats { max-width: none; display: grid; gap: var(--s4); margin-top: var(--s5); padding: var(--s4); }
.q-list__stats .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.q-list__stats .fig dd { font-size: 24px; }
.q-list__stats .q-list__table td:last-child { width: auto; }
.q-list__recent { overflow-x: auto; }
.q-list__recent caption { text-align: left; padding-bottom: var(--s2); }
.q-list__about { display: grid; gap: var(--s3); max-width: 72ch; margin-top: var(--s7); }
.q-list__about h2 { margin-top: var(--s4); }
.q-list__about h3 { margin-top: var(--s2); }
.q-list__about ol, .q-list__about ul { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s1); }
.q-list__more { display: grid; gap: var(--s3); }
.q-list__more summary { cursor: pointer; font-weight: 600; padding-block: 10px; } /* about 44 px tall */
.q-list__names th[scope="row"] { width: 45%; font-weight: 600; color: inherit; }
.q-list__names td:last-child { width: auto; font-weight: 400; }

@media (min-width: 720px) {
  .q-list__game { padding: var(--s5); }
  .q-list__bar { margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) 0; padding: var(--s4) var(--s5); }
  .q-list__entry { max-width: 560px; }
}
@media (min-width: 1024px) {
  .q-list__lists--split { grid-template-columns: 1fr 1fr; align-items: start; min-height: calc(var(--rows-a) * 30px + 35px); }
  .q-list__lists--split .q-list__table + .q-list__table thead { display: table-header-group; }
  .q-list__lists--split .q-list__table tbody th, .q-list__lists--split .q-list__table td { height: 30px; padding-block: 3px; }
}
