/* Builder */
.builder { max-width: 760px; margin: 0 auto; padding: 26px 22px 120px; }

.b-title-input { font-family: var(--display); font-weight: 600; font-size: 15px; width: 320px; }

.b-head { margin-bottom: 14px; }

.b-block {
  display: flex; gap: 4px;
  padding: 16px 16px 10px 6px;
  margin-bottom: 14px;
  position: relative;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.b-block:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.b-block.dragging { opacity: .45; }
.b-block.drag-over { border-color: var(--cobalt); box-shadow: 0 -2px 0 var(--cobalt); }
.b-block.b-control { background: var(--paper); border-style: dashed; }

.b-block-rail {
  width: 34px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-top: 4px;
}
.b-grip { color: var(--faint); cursor: grab; font-size: 13px; visibility: hidden; }
.b-block:hover .b-grip { visibility: visible; }
.b-num { font-size: 12px; color: var(--faint); }

.b-block-main { flex: 1; min-width: 0; }

.b-qtitle { font-family: var(--display); font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.b-qdesc { font-size: 13px; color: var(--dim); margin-bottom: 8px; }

.b-choices { display: flex; flex-direction: column; gap: 2px; margin: 4px 0; }
.b-choice { display: flex; align-items: center; gap: 8px; }
.b-ckey {
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 5px;
  font-size: 11px; color: var(--dim); background: var(--surface);
}
.b-cdel { visibility: hidden; }
.b-choice:hover .b-cdel { visibility: visible; }

.b-correct {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--faint); cursor: pointer; font-size: 12px; flex-shrink: 0;
}
.b-correct.on { background: var(--good); border-color: var(--good); color: #fff; }

.b-scale-preview { padding: 6px 0; color: var(--warn); letter-spacing: 2px; }
.b-npsrow { display: inline-flex; gap: 4px; letter-spacing: 0; }
.b-npscell {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 6px; font-size: 12px; color: var(--dim); background: var(--surface);
}
.b-scale-ends { display: flex; justify-content: space-between; margin-top: 4px; max-width: 370px; letter-spacing: 0; color: var(--dim); }

.b-input-preview {
  border-bottom: 1px dashed var(--line-strong);
  padding: 6px 2px; max-width: 380px; font-size: 14px; margin: 4px 0 8px;
}

.b-statement { width: 100%; border: none; background: transparent; resize: vertical; min-height: 44px; font-size: 14px; color: var(--ink-soft); }

.b-matrix { overflow-x: auto; margin: 6px 0; }
.b-matrix table { border-collapse: collapse; font-size: 13px; }
.b-matrix th, .b-matrix td { padding: 4px 8px; text-align: center; }
.b-matrix th:first-child, .b-matrix td:first-child { text-align: left; min-width: 170px; }
.b-matrix th .inline-edit { font-weight: 500; font-size: 12px; text-align: center; width: 82px; }
.b-mx-dot { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.b-matrix td .iconbtn { visibility: hidden; }
.b-matrix tr:hover td .iconbtn { visibility: visible; }

.b-block-foot {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 10px; padding-top: 7px;
}
.b-block-foot .spacer { flex: 1; }
.b-block-foot .iconbtn { visibility: hidden; }
.b-block:hover .b-block-foot .iconbtn, .b-block:focus-within .b-block-foot .iconbtn { visibility: visible; }

.b-addrow { display: flex; align-items: center; gap: 12px; padding: 6px 0 0 40px; }

.b-palette { max-height: 70vh; overflow-y: auto; width: 250px; padding-bottom: 6px; }

.b-popbody { padding: 14px; max-height: 74vh; overflow-y: auto; }
.b-problems { padding-left: 18px; font-size: 13px; color: var(--bad); }
.b-problems li { margin-bottom: 5px; }

/* logic rules */
.b-logic { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.b-rule { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.b-rule .select, .b-rule .input { width: auto; max-width: 170px; padding: 4px 8px; font-size: 13px; }
.b-rule .b-rv { max-width: 120px; }

/* settings sheet */
.b-sheet {
  position: fixed; top: 54px; right: 0; bottom: 0; width: 360px;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px; overflow-y: auto; z-index: 60;
}
.b-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* experiment block */
.b-exp { margin-top: 4px; }
.b-exp-grid { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.b-attr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; background: var(--paper); }
.b-attr-flags { display: flex; gap: 14px; color: var(--dim); margin: 2px 0 6px 4px; }
.b-attr-flags label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.b-attr-levels { padding-left: 4px; }
.b-level .mono.faint { width: 24px; flex-shrink: 0; font-size: 10px; }
.b-level-val { max-width: 70px; text-align: right; }
.b-exp-designbar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; padding: 8px 10px;
  background: var(--paper); border-radius: var(--radius-sm);
}
.b-exp-designbar .spacer { flex: 1; }
.b-exp-table { overflow: auto; max-height: 300px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.b-exp-table table { border-collapse: collapse; width: 100%; }
.b-exp-table th, .b-exp-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.b-exp-table thead th { position: sticky; top: 0; background: var(--surface); }

@media (max-width: 700px) {
  .b-exp-grid { grid-template-columns: 1fr; }
  .b-sheet { width: 100%; }
}
