/* Коробка урока 2: box_train и box_retrain (steps/box.js) и строки пульта (host/panels-box.js).
   Подключается в index.html и host.html. Картинки — через гейт stepKit.image (css/media.css):
   рамки фиксированной пропорции, перерисовка шага не прыгает по высоте. */

/* ---------- общее ---------- */
.box-progress { margin: 12px 4px 6px; font-weight: 700; color: #4a5270; }
.box-bar { height: 10px; border-radius: 999px; background: #e3e8f7; overflow: hidden; margin-top: 10px; }
.box-bar i { display: block; height: 100%; width: 0; background: #3450d2; border-radius: 999px; transition: width .2s; }
.box-loading { margin: 14px 4px; color: #4a5270; font-size: 16px; font-weight: 600; }
.box-training { background: #fff; border-radius: 18px; padding: 28px 20px; margin-top: 16px; text-align: center;
  box-shadow: 0 4px 16px rgba(28,35,64,.06); }
.box-training-text { font-size: 22px; font-weight: 800; color: #3450d2; }
.box-error { background: #fff4f2; border-radius: 18px; padding: 18px; margin-top: 16px; text-align: center; }
.box-error-text { font-size: 20px; font-weight: 800; color: #b03a2e; margin-bottom: 12px; }
.box-fix { background: #fff8ec; border-left: 5px solid #f5a623; border-radius: 12px; padding: 12px 14px;
  margin: 10px 0; font-weight: 700; color: #6b4a00; }
.box-fix-hint { margin-top: 6px; font-weight: 600; }
.box-gate, .box-note { margin: 12px 4px; font-weight: 700; color: #6b4a00; text-align: center; }
.box-ok, .box-saved { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: #e8f6ee; color: #1d5e36;
  font-weight: 700; text-align: center; }
.box-intro { margin: 16px 4px 10px; font-size: 20px; font-weight: 700; text-align: center; }
.btn-big:disabled { opacity: .45; cursor: default; }
.box-train-btn, .box-check-btn, .box-more, .box-retry { margin-top: 16px; }

/* ---------- раскладка ---------- */
.box-stage { display: flex; justify-content: center; margin: 8px 0 4px; }
.box-card-pic { width: min(100%, 300px); border-radius: 16px; box-shadow: 0 4px 16px rgba(28,35,64,.14);
  touch-action: none; user-select: none; }
.box-card-pic.dragging { position: relative; z-index: 40; box-shadow: 0 12px 28px rgba(28,35,64,.3); pointer-events: none; }
.box-buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.box-bucket { min-height: 110px; border: 3px dashed #b9c4e8; border-radius: 18px; padding: 8px; background: #fafbff; }
.box-bucket.target { border-color: #f5a623; background: #fff8ec; cursor: pointer; }
.box-bucket-head { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 10px; font-size: 19px; font-weight: 800; color: #3450d2; background: #eef2ff; border-radius: 12px; }
.box-bucket.target .box-bucket-head { background: #3450d2; color: #fff; }
.box-bucket.target .box-bucket-head .b-count { background: #fff; color: #3450d2; }
.box-bucket-head:disabled { opacity: 1; cursor: default; }
.box-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; margin-top: 8px; }
.box-thumb { padding: 0; background: none; border: 3px solid transparent; border-radius: 10px; }
.box-thumb .img-box { border-radius: 7px; }
.box-thumb.wrong { border-color: #e67e22; box-shadow: 0 0 0 3px #ffd9a8; animation: box-pulse 1s ease-in-out 3; }
.box-thumb.sending { opacity: .5; }
@keyframes box-pulse { 50% { transform: scale(1.08); } }
.box-move, .box-basket { display: grid; grid-template-columns: 96px 1fr; gap: 10px 14px; align-items: center;
  background: #fff; border-radius: 16px; padding: 12px; margin: 8px 0; box-shadow: 0 4px 16px rgba(28,35,64,.08); }
.box-move-q { font-size: 19px; font-weight: 800; }
.box-move-buttons { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.box-move-buttons .btn-big { flex: 1 1 120px; width: auto; }

/* ---------- проба ---------- */
.box-verdict { margin: 14px 4px 6px; font-size: 24px; font-weight: 800; color: #1c2340; text-align: center; }
.box-verdict.wait { color: #7a839f; }
.box-judge-q { text-align: center; font-size: 18px; font-weight: 700; color: #4a5270; margin-top: 6px; }
.box-judge-buttons { display: flex; gap: 10px; margin-top: 10px; }
.box-judge-buttons .btn-big { flex: 1; width: auto; }
.box-judge.no { background: #e67e22; }
.box-judged { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.box-judged-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: #fff;
  border-radius: 12px; padding: 6px 10px; font-size: 16px; }
.box-judged-answer { color: #3450d2; white-space: nowrap; }

/* ---------- доучивание ---------- */
.box-fixed { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; background: #eef2ff;
  border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; font-size: 16px; }
.box-fixed-text b { color: #3450d2; }
.box-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.box-tile { position: relative; padding: 5px; background: #fff; border: 3px solid transparent; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(28,35,64,.1); text-align: center; }
.box-tile .img-box { border-radius: 11px; }
.box-tile.picked { border-color: #27ae60; }
.box-tile.trained { border-color: #27ae60; background: #f0fbf4; }
.box-tile.decoy .img-box { opacity: .35; filter: grayscale(1); }
.box-tile.wrong { border-color: #e67e22; }
.box-tile.sending { opacity: .5; }
.box-tile-badge { display: block; margin-top: 4px; font-size: 13px; font-weight: 800; color: #1d5e36; }
.box-tile-note { display: block; margin-top: 4px; font-size: 12px; line-height: 1.25; font-weight: 700; color: #6b4a00; }
.box-buckets-small .box-bucket { min-height: 70px; border-style: solid; }
.box-buckets-small .box-bucket-head { font-size: 16px; padding: 6px; }
.box-measure-head { margin: 16px 4px 4px; font-size: 26px; font-weight: 900; text-align: center; color: #1c2340; }
.box-branch { text-align: center; font-size: 20px; font-weight: 800; margin: 6px 0; }
.box-branch.ideal, .box-branch.better { color: #1d7a45; }
.box-branch.same { color: #6b4a00; }
.box-residual { background: #fff8ec; border-radius: 12px; padding: 10px 14px; margin: 8px 0; font-weight: 600; }
.box-strip-head { margin: 16px 4px 8px; font-weight: 800; color: #4a5270; }
.box-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.box-strip-cell { background: #fff; border-radius: 12px; padding: 4px 4px 6px; border: 3px solid transparent; }
.box-strip-cell.residual { border-color: #e67e22; }
.box-strip-cell .img-box { border-radius: 8px; }
.box-mark { font-size: 12px; line-height: 1.3; margin-top: 3px; color: #7a839f; }
.box-mark b { font-weight: 800; }
.box-mark.ok b { color: #1d7a45; }
.box-mark.bad b { color: #c0392b; }
.box-anchor { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; background: #fff;
  border-radius: 14px; padding: 10px 12px; margin-top: 14px; font-size: 17px; font-weight: 600; }
@media (max-width: 480px) {
  .box-strip { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .box-mark { font-size: 10px; }
  .box-tiles { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
  .box-verdict { font-size: 21px; }
  .box-measure-head { font-size: 22px; }
  .box-branch { font-size: 18px; }
  .box-move, .box-basket { grid-template-columns: 72px 1fr; }
}

/* ---------- пульт (host/panels-box.js) ---------- */
.box-host-lines { display: flex; flex-direction: column; gap: 6px; }
.box-host-line { background: #fff; border-radius: 12px; padding: 8px 12px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; box-shadow: 0 2px 8px rgba(28,35,64,.06); }
.box-host-line.warn { background: #fff6d6; color: #7a5a00; }
.box-host-line.red { background: #fdecea; color: #7b1d12; border-left: 5px solid #c0392b; }
.box-host-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: #eef1fa; vertical-align: middle; }
.review-panel .box-host-thumb { width: 44px; height: 44px; margin-right: 4px; }
