/* blank — a sentence with holes in it.
 *
 * The sentence stays a sentence. Gaps sit on the line with the words around
 * them rather than being pulled out into a list of numbered boxes, because
 * reading the whole sentence is how anybody works out what the missing word
 * has to be.
 */

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

.ba-bl__line {
  margin: 0;
  /* Generous, because the gaps sit inside it and a tight line would have them
     touching the row above. */
  line-height: 2.4;
  font-size: var(--bt-fs-prompt);
  font-weight: 600;
}

/* ── a typed gap ─────────────────────────────────────────────────────── */

.ba-bl__gap {
  display: inline-block;
  width: 7em;
  max-width: 100%;
  min-height: var(--bt-tap);
  margin: 0 0.15em;
  padding: 0 var(--bt-s2);
  font: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--bt-ink);
  background: var(--bt-card);
  border: 0;
  border-bottom: 3px solid var(--bt-line);
  border-radius: var(--bt-radius-sm) var(--bt-radius-sm) 0 0;
  transition: border-color var(--bt-t-quick) var(--bt-ease),
              background var(--bt-t-quick) var(--bt-ease);
}

/* ── a tapped slot, when there is a word bank ────────────────────────── */

.ba-bl__slot {
  display: inline-block;
  min-width: 7em;
  min-height: var(--bt-tap);
  margin: 0 0.15em;
  padding: 0 var(--bt-s3);
  font: inherit;
  font-weight: 700;
  color: var(--bt-ink);
  background: var(--bt-card);
  border: 0;
  border-bottom: 3px solid var(--bt-line);
  border-radius: var(--bt-radius-sm) var(--bt-radius-sm) 0 0;
  cursor: pointer;
  vertical-align: middle;
  transition: border-color var(--bt-t-quick) var(--bt-ease),
              background var(--bt-t-quick) var(--bt-ease);
}

/* Where the sentence is waiting. One gap glows at a time — more than one and
   it stops being an instruction and becomes decoration. */
.ba-bl__gap.is-waiting,
.ba-bl__slot.is-waiting {
  border-bottom-color: var(--bt-saffron);
  background: #FFF6E4;
  animation: baBlGlow 1.6s var(--bt-ease) infinite;
}

@keyframes baBlGlow {
  0%, 100% { box-shadow: 0 2px 0 0 rgb(255 153 51 / 0); }
  50%      { box-shadow: 0 4px 0 0 rgb(255 153 51 / 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  .ba-bl__gap.is-waiting,
  .ba-bl__slot.is-waiting { animation: none; }
}

.ba-bl__gap:focus,
.ba-bl__slot:focus { border-bottom-color: var(--bt-teal); }

.ba-bl__slot.is-full { background: #FFF6E4; border-bottom-color: var(--bt-saffron); }

.ba-bl__gap.is-right,
.ba-bl__slot.is-right {
  border-bottom-color: var(--bt-right);
  background: var(--bt-right-soft);
  color: var(--bt-right);
}

.ba-bl__gap.is-wrong,
.ba-bl__slot.is-wrong {
  border-bottom-color: var(--bt-wrong);
  background: var(--bt-wrong-soft);
  color: var(--bt-wrong);
  text-decoration: line-through;
}

.ba-bl__gap.is-close,
.ba-bl__slot.is-close {
  border-bottom-color: var(--bt-close);
  background: var(--bt-close-soft);
  color: var(--bt-close);
}

/* The word that was wanted, set beside what was written rather than replacing
   it. The comparison is the lesson; a gap silently corrected teaches nothing. */
.ba-bl__truth {
  display: inline-block;
  margin: 0 0.15em;
  padding: 0 var(--bt-s2);
  border-radius: var(--bt-radius-sm);
  background: var(--bt-right-soft);
  color: var(--bt-right);
  font-weight: 700;
}
.ba-bl__truth::before { content: '→ '; }

/* ── the word bank ───────────────────────────────────────────────────── */

.ba-bl__bank {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bt-s2);
  margin-top: var(--bt-s4);
  padding-top: var(--bt-s3);
  border-top: 2px dashed var(--bt-line);
}

.ba-bl__word {
  min-height: var(--bt-tap);
  padding: 0 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-bl__word:not(.is-used):active { transform: translateY(2px); }

/* Used words stay in place rather than disappearing, so the bank does not
   reflow under a finger that is already moving towards the next word. */
.ba-bl__word.is-used {
  opacity: 0.3;
  cursor: default;
  box-shadow: none;
}
