/* order — a list to be put right.
 *
 * Rows are a fixed comfortable height and the same height as each other, which
 * is what lets the drag work out where a finger is by arithmetic rather than by
 * measuring every row on every pointer move.
 */

.ba-or__how,
.ba-or__truthHow {
  margin: 0 0 var(--bt-s3);
  font-size: var(--bt-fs-small);
  font-weight: 700;
  color: var(--bt-ink-soft);
}

.ba-or__truthHow { margin-top: var(--bt-s4); }

.ba-or {
  display: flex;
  flex-direction: column;
  gap: var(--bt-s2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.ba-or__row {
  display: flex;
  align-items: center;
  gap: var(--bt-s3);
  min-height: calc(var(--bt-tap) + var(--bt-s3));
  padding: var(--bt-s2) var(--bt-s3);
  background: var(--bt-card);
  border: 2px solid var(--bt-line);
  border-radius: var(--bt-radius-sm);
  font-size: var(--bt-fs-body);
  font-weight: 600;
  transition: border-color var(--bt-t-quick) var(--bt-ease),
              background var(--bt-t-quick) var(--bt-ease),
              box-shadow var(--bt-t-quick) var(--bt-ease);
}

/* The position, so the list reads as a sequence rather than as a pile. */
.ba-or__row::before {
  counter-increment: step;
  content: counter(step);
  flex: 0 0 auto;
  width: 1.7em;
  height: 1.7em;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bt-cream);
  color: var(--bt-ink-soft);
  font-size: var(--bt-fs-small);
  font-weight: 700;
}

.ba-or__body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: var(--bt-s2);
  min-width: 0;
}

.ba-or__body img {
  width: 2.6rem;
  height: 2.6rem;
  object-fit: contain;
  border-radius: var(--bt-radius-sm);
}

/* ── the grip ────────────────────────────────────────────────────────────
   The only part that starts a drag, and therefore the only part that has to
   take the browser's touch gestures away. A finger anywhere else on the list
   still scrolls the page. */
.ba-or__grip {
  flex: 0 0 auto;
  width: var(--bt-tap);
  min-height: var(--bt-tap);
  display: grid;
  place-items: center;
  margin: calc(var(--bt-s2) * -1) 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--bt-ink-soft);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.ba-or__row.is-dragging {
  border-color: var(--bt-saffron);
  background: #FFF6E4;
  box-shadow: var(--bt-shadow-lift);
  position: relative;
  z-index: 2;
  cursor: grabbing;
}

.ba-or__row:focus-visible {
  outline: 3px solid var(--bt-saffron);
  outline-offset: 2px;
}

.ba-or__row.is-right {
  border-color: var(--bt-right);
  background: var(--bt-right-soft);
}

.ba-or__row.is-wrong {
  border-color: var(--bt-wrong);
  background: var(--bt-wrong-soft);
}

/* ── tap-in-sequence ─────────────────────────────────────────────────── */

/* The built list keeps a visible empty space, so it is obvious that answers
   go here rather than the pool simply emptying into nothing. */
.ba-or--built {
  min-height: 3.5rem;
  padding: var(--bt-s2);
  border: 2px dashed var(--bt-line);
  border-radius: var(--bt-radius);
  background: var(--bt-cream);
}

.ba-or__pool {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bt-s2);
  margin-top: var(--bt-s3);
}

.ba-or__chip {
  display: flex;
  align-items: center;
  gap: var(--bt-s2);
  min-height: var(--bt-tap);
  padding: var(--bt-s1) var(--bt-s4);
  font: inherit;
  font-weight: 700;
  color: var(--bt-ink);
  background: var(--bt-card);
  border: 2px solid var(--bt-line);
  border-radius: var(--bt-radius-pill);
  box-shadow: var(--bt-shadow);
  cursor: pointer;
  transition: opacity var(--bt-t) var(--bt-ease),
              transform var(--bt-t-quick) var(--bt-ease);
}

.ba-or__chip:not(.is-used):active { transform: translateY(2px); }

/* Used chips stay put rather than vanishing, so the pool does not reflow under
   a thumb already travelling to the next one. */
.ba-or__chip.is-used {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
}

.ba-or__chip img {
  width: 1.8rem;
  height: 1.8rem;
  object-fit: contain;
}

.ba-or__undo {
  flex: 0 0 auto;
  width: var(--bt-tap);
  min-height: var(--bt-tap);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--bt-ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* ── the order it should have been ───────────────────────────────────── */

.ba-or--truth .ba-or__row {
  border-style: dashed;
  border-color: var(--bt-right);
  background: var(--bt-right-soft);
}
