/* Discriminação Livre: quadro grande (grade montada pelo terapeuta) que ocupa a área do treino. */
body[data-active-module="freeDiscrimination"] .trainer {grid-template-columns:minmax(0,1fr)!important}
body[data-active-module="freeDiscrimination"] .trainer > .feedback:empty {display:none}
.choices.free-discrimination-host {display:block;width:100%;max-width:none;height:100%;min-height:0;padding:0;margin:0}
.fd-workspace {display:grid;grid-template-rows:auto auto minmax(0,1fr);gap:10px;height:100%;min-height:clamp(320px,60vh,760px);box-sizing:border-box}
.fd-workspace:not(.is-editing) {grid-template-rows:auto minmax(0,1fr)}

.fd-toolbar {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-radius:18px;background:#f1f6fb;border:1px solid #dbe6f0}
.fd-toolbar.is-training {background:transparent;border-color:transparent}
.fd-toolbar-group {display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.fd-stepper {display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:14px;background:#fff;border:1px solid #d7e2ec}
.fd-stepper span {padding:0 4px;color:#51657a;font-size:13px;font-weight:800}
.fd-stepper button {width:34px;height:34px;border:0;border-radius:10px;background:#e6f0fa;color:#1f4f82;font-size:20px;font-weight:900;cursor:pointer}
.fd-stepper button:disabled {opacity:.4;cursor:default}
.fd-stepper output {min-width:22px;text-align:center;font-weight:900;color:#172b45}
.fd-order {display:flex;padding:3px;border-radius:14px;background:#fff;border:1px solid #d7e2ec}
.fd-order button {min-height:34px;padding:0 14px;border:0;border-radius:11px;background:transparent;color:#51657a;font-weight:800;cursor:pointer}
.fd-order button.is-active {background:#ff9a2e;color:#fff;box-shadow:inset 0 -3px 0 #d9700c}
.fd-clear-button {min-height:36px;padding:0 14px;border:1px solid #e3cfd4;border-radius:12px;background:#fff;color:#924353;font-weight:800;cursor:pointer}
.fd-clear-button:disabled {opacity:.45;cursor:default}
.fd-mode-button {min-height:44px;padding:0 18px;border:0;border-radius:14px;background:#e8f0ff;color:#2352a0;font-weight:900;font-size:15px;cursor:pointer;box-shadow:inset 0 -3px 0 #bfd3f7}
.fd-mode-button.is-start {background:#1f9d57;color:#fff;box-shadow:inset 0 -4px 0 #157a43}
.fd-mode-button:disabled {opacity:.5;cursor:default}
.fd-order-chip {padding:6px 12px;border-radius:999px;background:#eef4fa;color:#51657a;font-size:13px;font-weight:800}
.fd-help {margin:0;color:#64748b;font-size:14px;font-weight:700;text-align:center}

.fd-board {display:grid;grid-template-columns:repeat(var(--fd-columns,3),minmax(0,1fr));grid-template-rows:repeat(var(--fd-rows,2),minmax(0,1fr));gap:clamp(8px,1.4vw,16px);min-height:0;padding:clamp(8px,1.2vw,14px);border-radius:24px;background:#f7f3ea;border:1px solid #eadfca}
.fd-cell {min-width:0;min-height:0;width:100%;height:100%;box-sizing:border-box}
.fd-blank-cell {pointer-events:none}
.fd-empty-cell {display:grid;place-items:center;align-content:center;gap:2px;border:3px dashed #cdbb97;border-radius:18px;background:#fffdf8;color:#a38d63;cursor:pointer}
.fd-empty-cell span {font-size:clamp(28px,4vw,44px);font-weight:900;line-height:1}
.fd-empty-cell small {font-size:13px;font-weight:800}
.fd-edit-cell {position:relative;display:grid;grid-template-rows:minmax(0,1fr) auto;gap:4px;padding:8px;border:3px solid #d8b365;border-radius:18px;background:#fff;cursor:pointer;overflow:hidden}
.fd-edit-cell .fd-cell-picture {position:relative;display:grid;place-items:center;min-height:0;overflow:hidden;font-size:clamp(2rem,5vw,3.6rem);font-weight:900}
.fd-edit-cell .fd-cell-picture img {position:absolute;inset:0;width:100%!important;height:100%!important;max-width:none;max-height:none;object-fit:contain}
.fd-edit-cell strong {font-size:12px;color:#51657a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fd-edit-cell::after {content:"✎";position:absolute;top:6px;right:8px;color:#a38d63;font-size:14px}
.fd-board .selection-choice.wrong {animation:fdShake .35s ease}
@keyframes fdShake {25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}
@media (hover: hover) and (pointer: fine) {
  .fd-empty-cell:hover,.fd-edit-cell:hover {border-color:#3b82f6}
}

/* Janela de escolha da figura de uma célula. */
.fd-picker-panel {width:min(880px,80vw);max-height:86vh;max-height:86dvh;display:grid;grid-template-rows:auto auto auto minmax(0,1fr);gap:10px;padding:clamp(14px,2vw,24px);border-radius:24px;background:#f8fafc;overflow:hidden}
.fd-picker-panel #fdPickerTitle {text-transform:uppercase;letter-spacing:.02em}
.fd-picker-tools {display:flex;gap:8px}
.fd-picker-tools input {flex:1;min-height:42px;padding:0 14px;border:1px solid #cbd5e1;border-radius:12px;font-size:15px;background:#fff}
.fd-picker-empty {min-height:42px;padding:0 14px;border:1px solid #e3cfd4;border-radius:12px;background:#fff;color:#924353;font-weight:800;cursor:pointer}
.fd-picker-categories {display:flex;gap:6px;overflow-x:auto;padding-bottom:4px;scrollbar-width:thin}
.fd-picker-categories button {flex:none;min-height:34px;padding:0 12px;border:1px solid #d7e2ec;border-radius:999px;background:#fff;color:#51657a;font-weight:800;text-transform:uppercase;font-size:12px;cursor:pointer}
.fd-picker-categories button.is-active {background:#2563eb;border-color:#2563eb;color:#fff}
.fd-picker-list {display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;overflow-y:auto;overscroll-behavior:contain;padding:2px 4px 8px 2px;align-content:start}
.fd-option {display:grid;grid-template-rows:auto auto auto;gap:4px;padding:10px;border:2px solid #e2e8f0;border-radius:14px;background:#fff;text-align:center;cursor:pointer}
.fd-option.is-selected {border-color:#3b82f6;background:#eff6ff}
.fd-option-picture {position:relative;display:grid;place-items:center;aspect-ratio:4/3;font-size:2.4rem;font-weight:900;overflow:hidden}
.fd-option-picture img {position:absolute;inset:4px;width:calc(100% - 8px)!important;height:calc(100% - 8px)!important;max-width:none;max-height:none;object-fit:contain}
.fd-option strong {font-size:13px;color:#172b45;overflow-wrap:anywhere}
.fd-option small {font-size:11px;color:#64748b}
@media (max-width:600px) {.fd-picker-panel {width:calc(100vw - 16px)} .fd-picker-list {grid-template-columns:repeat(2,minmax(0,1fr))}}
/* No modo montar não há enunciado nem barra de progresso: o quadro ocupa toda a altura. */
body[data-active-module="freeDiscrimination"] .trainer:has(.free-discrimination-host.is-editing) {grid-template-rows:minmax(0,1fr)!important}

/* Instrução baixa: a prioridade é o espaço dos cartões. */
body[data-design] .trainer:has(.free-discrimination-host) {gap:8px}
body[data-design] .trainer:has(.free-discrimination-host) .prompt-zone {min-height:0!important;padding:6px 14px!important;border-width:4px}
body[data-design] .trainer:has(.free-discrimination-host) .prompt-zone.no-model #promptText {font-size:clamp(1.02rem,1.9vw,1.4rem)}
body[data-design] .trainer:has(.free-discrimination-host) .stage-strip {padding-block:6px}
.fd-workspace:not(.is-editing) {gap:6px}
.fd-toolbar.is-training {padding:0 4px}
.fd-toolbar.is-training .fd-mode-button {min-height:34px;padding:0 14px;font-size:13px}
.fd-toolbar.is-training .fd-order-chip {padding:4px 10px;font-size:12px}
/* Em tela cheia só ficam os cartões (sem o botão de montar). */
body.training-fullscreen .fd-toolbar.is-training {display:none}
body.training-fullscreen .fd-workspace:not(.is-editing) {grid-template-rows:minmax(0,1fr)}

/* Arrastar no modo montar. */
.fd-empty-cell,.fd-edit-cell {touch-action:none;user-select:none;-webkit-user-select:none}
.fd-edit-cell.is-drag-source {opacity:.35}
.fd-cell.is-drop-target {border-color:#2563eb!important;border-style:solid!important;background:#eff6ff!important;box-shadow:0 0 0 4px #2563eb33}
.fd-drag-ghost {position:fixed;left:0;top:0;z-index:10000;pointer-events:none;opacity:.92;box-shadow:0 18px 40px #0f172a40;transition:none}
