/* ============================================================
   widgets.css — the two standalone teaching widgets:
   the belief-builder lab and the correction-episode stepper.
============================================================ */

/* ============ Belief builder lab ============ */
.lab-frame {
  margin-top: 40px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-md); overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) { .lab-frame { grid-template-columns: 1fr; } }
.lab-left { padding: 26px; border-right: 1px solid var(--line-soft); }
@media (max-width: 900px) { .lab-left { border-right: none; border-bottom: 1px solid var(--line-soft); } }
.lab-right { padding: 26px; background: #FBFCFE; }
.lab-title { font-family: var(--display); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.lab-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }

.obs-list { display: flex; flex-direction: column; gap: 8px; min-height: 246px; }
.obs-item {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px;
  background: var(--surface); font-size: 13.5px;
  opacity: .32; transition: opacity .4s, border-color .4s, background .4s;
}
.obs-item.on { opacity: 1; border-color: #CBD5E8; }
.obs-item.on.err { background: var(--reject-tint); border-color: #EEC6C3; }
.obs-item .ph { font-family: var(--mono); font-weight: 600; font-size: 13px; min-width: 86px; }
.obs-item .meta { color: var(--muted); font-size: 12px; font-family: var(--mono); flex: 1; }
.obs-item .w { font-family: var(--mono); font-size: 12px; color: var(--primary-deep); font-weight: 600; }

.lab-ctl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 20px; }
.lab-btn {
  font-family: var(--display); font-weight: 600; font-size: 13.5px;
  background: var(--ink); color: #fff; border: none; border-radius: 9px;
  padding: 9px 18px; cursor: pointer; transition: background .16s, transform .16s;
}
.lab-btn:hover { background: #1C2740; transform: translateY(-1px); }
.lab-btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.lab-btn.secondary:hover { background: var(--line-soft); }

.toggle-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-soft); }
.switch { position: relative; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: #CBD5E4;
  transition: background .2s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(17px); }

.alpha-ctl { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.alpha-ctl input[type=range] {
  -webkit-appearance: none; appearance: none; width: 120px; height: 4px; border-radius: 3px;
  background: #CBD5E4; outline: none; cursor: pointer;
}
.alpha-ctl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--geo); cursor: grab;
}
.alpha-ctl input[type=range]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2.5px solid var(--geo); cursor: grab;
}

.concept-rows { display: flex; flex-direction: column; gap: 13px; min-height: 210px; }
.concept-row .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.concept-row .cname { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.concept-row .cname .members { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); }
.concept-row .cval { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.concept-track { height: 12px; border-radius: 6px; background: #EAEEF6; overflow: hidden; }
.concept-fill {
  height: 100%; border-radius: 6px; width: 0;
  transition: width .55s cubic-bezier(.22, .8, .3, 1), background .3s;
}
.concept-fill.win { background: linear-gradient(90deg, var(--primary), var(--geo)); }
.concept-fill.lose { background: #B9C4D8; }
.concept-fill.bad { background: linear-gradient(90deg, var(--reject), #E8887F); }

.lab-verdict {
  margin-top: 18px; border-radius: 10px; padding: 12px 15px; font-size: 13.5px; line-height: 1.55;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
}
.lab-verdict.good { background: var(--ok-tint); border-color: #BFE8D6; color: #0B6E4E; }
.lab-verdict.bad { background: var(--reject-tint); border-color: #EEC6C3; color: #A63430; }
.lab-verdict b { font-family: var(--mono); font-size: 12.5px; }

/* ============ Correction episode stepper ============ */
.ep-frame {
  margin-top: 40px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-md); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
@media (max-width: 900px) { .ep-frame { grid-template-columns: 1fr; } }
.ep-map { background: #0D1529; padding: 22px; display: flex; align-items: center; }
.ep-map svg { width: 100%; height: auto; display: block; }
.ep-side { padding: 26px; display: flex; flex-direction: column; }

.ep-query {
  font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  background: #F2F4FA; border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 10px 14px; display: flex; align-items: center; gap: 9px;
}
.ep-query .qmark { color: var(--primary); font-weight: 600; }
.ep-query .lock {
  margin-left: auto; font-size: 10px; color: var(--geo); background: var(--geo-tint);
  padding: 2px 8px; border-radius: 999px; letter-spacing: .05em; white-space: nowrap;
}

.ep-state { flex: 1; margin-top: 18px; }
.ep-step-label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); }
.ep-step-title { font-family: var(--display); font-weight: 600; font-size: 18px; margin-top: 4px; }
.ep-step-body { margin-top: 9px; font-size: 14.5px; color: var(--muted); line-height: 1.6; min-height: 108px; }
.ep-step-body b { color: var(--ink-soft); }
.ep-check { display: flex; gap: 8px; align-items: baseline; font-family: var(--mono); font-size: 12.5px; margin-top: 6px; }
.ep-check .ic { width: 15px; text-align: center; flex: none; }
.ep-check.pass .ic { color: var(--ok); }
.ep-check.fail .ic { color: var(--reject); }
.ep-check.na { color: #A5B1C6; }
.ep-outcome {
  display: inline-block; margin-top: 10px; font-family: var(--mono); font-size: 12px;
  letter-spacing: .07em; padding: 4px 13px; border-radius: 999px;
}
.ep-outcome.reject { background: var(--reject-tint); color: var(--reject); border: 1px solid #EEC6C3; }
.ep-outcome.confirm { background: var(--ok-tint); color: var(--ok); border: 1px solid #BFE8D6; }
.ep-outcome.neutral { background: var(--primary-tint); color: var(--primary-deep); border: 1px solid #DCD8F6; }

.ep-ctl { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.ep-pips { display: flex; gap: 6px; flex: 1; justify-content: center; }
.ep-pip { width: 8px; height: 8px; border-radius: 50%; background: #D6DEEC; transition: background .25s, transform .25s; }
.ep-pip.on { background: var(--primary); transform: scale(1.25); }

/* map SVG styling */
.m-room { fill: #101B35; stroke: #24324E; stroke-width: 1.5; }
.m-room-label { font-family: var(--mono); font-size: 10px; fill: #5F7196; letter-spacing: .08em; }
.m-obj { fill: #1C2946; stroke: #31426B; }
.m-cand { stroke-width: 1.5; }
.m-cand.hot { fill: rgba(109, 95, 240, .35); stroke: #8B7CF7; }
.m-cand.rejected { fill: rgba(214, 69, 61, .22); stroke: #D6453D; }
.m-cand.confirmed { fill: rgba(14, 159, 110, .3); stroke: #2FCB93; }
.m-path { fill: none; stroke: #6D5FF0; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 5 7; opacity: 0; }
.m-path.draw { opacity: 1; animation: dashmove 1.4s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -24; } }
.m-robot { transition: transform 1.1s cubic-bezier(.5, .05, .3, 1); }
.m-x { stroke: #D6453D; stroke-width: 2.4; stroke-linecap: round; opacity: 0; transition: opacity .3s; }
.m-x.show { opacity: 1; }
