/* build_sentence (js/trainers10.js) і tap-the-form у будь-якому медіа (js/tapform.js), 17.10.2026.
   Лише токени теми — працює у світлій і темній. Префікси: bs- і tf- (tf-text, tf-row, tf-list уже зайняті
   іншими тренажерами — тут їх не стилізуємо, крім tf-text усередині бульбашки). */

/* ====================================================================== build_sentence */
.bs-progress { margin: 6px 0 2px; font-weight: 700; color: var(--mag) !important; letter-spacing: .3px; }
.bs-list { display: grid; gap: 18px; margin-top: 12px; }
.bs-item { padding: 16px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); animation: bs-in .3s ease; }
.bs-item.bs-done { opacity: .92; }
.bs-item.bs-done .bs-bank, .bs-item.bs-done .bs-foot .btn { display: none; }
@keyframes bs-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.bs-line { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 12px; }
.bs-me { justify-content: flex-end; }
.bs-ava { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-soft); }
.bs-me .bs-ava { background: var(--mag); border-color: var(--mag); color: var(--on-mag); }
.bs-bubble { position: relative; max-width: 82%; padding: 11px 15px; border-radius: 20px 20px 20px 6px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.bs-bubble .tf-text { font-size: 17px; font-weight: 600; margin: 0; line-height: 1.45; color: var(--ink); }
.bs-who { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.bs-reply { border-radius: 20px 20px 6px 20px; border: 2px solid var(--mag-line); background: var(--mag-soft); min-width: min(320px, 82%); }
.bs-reply .bs-who { color: var(--mag); }
.bs-reply .t-key { display: none; }
:root[data-view="teacher"] .bs-reply .t-key { display: block; margin: 8px 0 0; }

.bs-slots { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 44px; padding: 2px 0; }
.bs-slot { display: inline-flex; align-items: center; min-height: 40px; border-radius: 12px; transition: background-color .15s, border-color .15s; }
.bs-slot.bs-empty { min-width: 62px; border: 2px dashed var(--mag-line); background: var(--surface); }
.bs-slot.bs-fixed { padding: 8px 13px; font-size: 16px; font-weight: 700; color: var(--ink-soft); background: var(--surface); border: 2px solid var(--line);
  border-radius: 12px; cursor: default; }
.bs-slot.bs-fixed::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); margin-right: 7px; opacity: .6; }
.bs-slot.dnd-over { border-color: var(--mag) !important; border-style: solid !important; }

.bs-bank { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; min-height: 58px; padding: 12px; margin: 4px 0 12px;
  border-radius: 18px; border: 2px dashed var(--line-strong); background: var(--surface); }
.bs-bank.dnd-can { outline-offset: -4px; }

.bs-chip { font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); padding: 9px 15px; border-radius: 13px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line-strong); box-shadow: 0 4px 0 var(--depth, var(--line-strong));
  transition: transform .08s ease, box-shadow .08s ease, border-color .15s, background-color .15s; }
.bs-chip:not(:disabled):hover { border-color: var(--mag-line); transform: translateY(-2px); box-shadow: 0 6px 0 var(--depth, var(--line-strong)); }
.bs-chip:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--depth, var(--line-strong)); }
.bs-chip:focus-visible { outline: 3px solid var(--mag-line); outline-offset: 2px; }
.bs-chip.bs-placed { border-color: var(--mag); color: var(--mag); background: var(--surface); box-shadow: 0 3px 0 var(--depth-mag, var(--mag-line)); animation: bs-pop .22s ease; }
.bs-chip:disabled { cursor: default; opacity: .5; }
.bs-chip.bs-placed:disabled { opacity: 1; }
@keyframes bs-pop { 0% { transform: scale(.9); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }

.bs-slots.bs-ok .bs-chip, .bs-slots.bs-ok .bs-fixed { border-color: var(--ok); background: var(--ok-soft); color: var(--ink); box-shadow: 0 3px 0 var(--depth-ok, var(--ok-line)); }
.bs-slots.bs-ok { animation: bs-pop .35s ease; }
.bs-slots.bs-bad .bs-chip { border-color: var(--bad); background: var(--bad-soft); }
.bs-slots.bs-bad { animation: bs-shake .35s ease; }
.bs-slots.bs-revealed .bs-chip { opacity: .75; border-style: dashed; color: var(--ink-soft); border-color: var(--line-strong); box-shadow: none; animation: none; }
@keyframes bs-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.bs-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bs-foot .btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.bs-msg { font-size: 14px !important; font-weight: 600; color: var(--ink) !important; }
.bs-msg .hit { color: var(--ok); }

@media (max-width: 560px) {
  .bs-item { padding: 12px; }
  .bs-bubble { max-width: 88%; }
  .bs-reply { min-width: 0; flex: 1; }
  .bs-ava { width: 28px; height: 28px; font-size: 12px; }
  .bs-chip { font-size: 15px; padding: 8px 12px; }
  .bs-foot .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bs-item, .bs-chip.bs-placed, .bs-slots.bs-ok, .bs-slots.bs-bad { animation: none; }
}

/* ====================================================================== tap-the-form */
.tf-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin: 14px 0 10px;
  padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 2px solid var(--mag-line); box-shadow: var(--shadow-1); }
.tf-ins { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.tf-ic { flex: none; width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--mag-soft); border: 1px solid var(--mag-line); }
.tf-ic svg { width: 17px; height: 17px; fill: none; stroke: var(--mag); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tf-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-count { font-size: 13px; font-weight: 700; color: var(--mag); padding: 6px 11px; border-radius: 999px; background: var(--mag-soft); }
.tf-count:empty { display: none; }
.tf-btn { font: inherit; font-size: 14px; font-weight: 800; padding: 9px 16px; border-radius: 12px; cursor: pointer; border: 2px solid var(--line-strong);
  background: var(--surface); color: var(--ink); box-shadow: 0 3px 0 var(--depth, var(--line-strong)); transition: transform .08s, box-shadow .08s; }
.tf-btn.tf-check { background: var(--mag); border-color: var(--mag); color: var(--on-mag); box-shadow: 0 3px 0 var(--depth-mag, var(--mag-line)); }
.tf-btn:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.tf-btn:disabled { opacity: .45; cursor: default; }
.tf-msg { flex-basis: 100%; font-size: 14px; font-weight: 600; color: var(--ink); padding: 10px 12px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line); animation: bs-in .25s ease; }
.tf-msg[hidden] { display: none !important; }
.tf-bar.tf-done { border-color: var(--ok-line); }
.tf-bar.tf-done .tf-count { color: var(--ok); background: var(--ok-soft); }
.tf-bar.tf-shake { animation: bs-shake .35s ease; }

.tf-w { cursor: pointer; padding: 1px 2px; margin: 0 -2px; border-radius: 6px; transition: background-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; }
.tf-locked .tf-w { cursor: default; }
.tf-on .tf-w:not(.on):hover { background: var(--mag-soft); }
.tf-w.on { background: linear-gradient(transparent 10%, color-mix(in srgb, var(--mag) 28%, transparent) 10% 90%, transparent 90%); }
.tf-w.ok { background: var(--ok-soft); box-shadow: inset 0 -3px 0 var(--ok); }
.tf-w.no { background: var(--bad-soft); text-decoration: line-through 2px var(--bad); }
.tf-w.miss { outline: 2px dashed var(--mag); outline-offset: 1px; }
.tf-w.tf-shown { opacity: .85; }
/* підказка викладачу: замість крапки — тиха магентова риска під ціллю */
:root[data-view="teacher"] .tf-w[data-answer] { box-shadow: inset 0 -2px 0 var(--mag-line); }
:root[data-view="teacher"] .tf-w[data-answer]::after { display: none; }
:root[data-view="teacher"] .tf-w[data-answer].ok { box-shadow: inset 0 -3px 0 var(--ok); }

@media (max-width: 560px) {
  .tf-bar { padding: 10px 12px; }
  .tf-ctl { width: 100%; }
  .tf-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .tf-bar.tf-shake, .tf-msg { animation: none; } }
