/* Body Systems Builder: the Body Workshop inside the practice shell's stage (about 1066 x 628 at 1366 x 768).
 * Foundations: every word in the play area is 18 px or more; every tap target is 48 px or more.
 * Pictures sit on a lit cream slide that stays the same in light and dark (the art is drawn for it). */
.bsb { position: absolute; inset: 0; overflow: hidden; display: grid; grid-template-columns: minmax(200px, 30%) minmax(0, 1fr); gap: 14px; padding: 10px 14px; color: #1f2933; font-size: 18px; line-height: 1.3;
  background: linear-gradient(#f6ece6, #ead9cf);
  --bsb-panel: rgba(255, 252, 248, .96); --bsb-line: #c3a596; --bsb-soft: #574239; --bsb-accent: #8a3b32; --bsb-accent-bg: #f7e3df;
  --bsb-ok: #17663a; --bsb-bad: #a3241f; --bsb-slide: #fffaf0; --bsb-held: #fff4d6; }
html[data-theme="dark"] .bsb { color: #eef2f6; background: linear-gradient(#211c22, #18151a);
  --bsb-panel: rgba(36, 31, 38, .97); --bsb-line: #6d5a62; --bsb-soft: #d9cbd0; --bsb-accent: #f0a196; --bsb-accent-bg: #3d2523;
  --bsb-ok: #7fdca0; --bsb-bad: #ffb4a8; --bsb-held: #3a3220; }
.bsb *, .bsb *::before, .bsb *::after { box-sizing: border-box; }
.bsb p, .bsb figure, .bsb ol { margin: 0; padding: 0; }
.bsb button { font: inherit; color: inherit; }
.bsb svg { display: block; }
.bsb-slide { position: relative; display: block; background: var(--bsb-slide); border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .28), 0 1px 3px rgba(0, 0, 0, .14); }
.bsb-slide svg, .bsb-pic { width: 100%; height: 100%; }

/* ── body map (left) ── */
.bsb .bsb-mapbox { min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: var(--bsb-panel); border: 1.5px solid var(--bsb-line); }
.bsb-map { flex: 1 1 auto; min-height: 0; background: var(--bsb-slide); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .25); padding: 6px; }
.bsb-map svg { width: 100%; height: 100%; }
.bsb p.bsb-mapcap { flex: none; display: flex; flex-direction: column; line-height: 1.25; }
.bsb-mapcap b { font-size: 20px; }
.bsb-mapcap span { color: var(--bsb-soft); }
.bsb p.bsb-model { flex: none; color: var(--bsb-soft); font-style: italic; }
.bsb.is-revealed .bsb-mapbox { border-color: var(--bsb-accent); box-shadow: 0 0 0 3px var(--bsb-accent-bg); }

/* ── task (right) ── */
.bsb-task { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.bsb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; min-height: 48px; }
.bsb p.bsb-title { min-width: 0; padding: 6px 14px; border-radius: 12px; background: var(--bsb-panel); border: 1.5px solid var(--bsb-line); }
.bsb-title b { font-size: 20px; }
html .bsb-say { flex: none; min-height: 48px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--bsb-line); background: var(--bsb-panel); font-weight: 700; cursor: pointer; white-space: nowrap; }
.bsb-say[aria-pressed="true"] { border-color: var(--bsb-accent); }
.bsb-say:hover { background: var(--bsb-accent-bg); }
.bsb-k { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.bsb-k span { color: var(--bsb-soft); }
.bsb-msg { font-weight: 700; color: var(--bsb-bad); flex: none; }
.bsb-msg:empty { display: none; }
.bsb button:disabled { opacity: 1; cursor: default; }
.bsb :focus-visible { outline: 4px solid #ffb000; outline-offset: 2px; }

/* organ card */
html .bsb-organ { flex: none; display: flex; align-items: center; gap: 16px; width: 100%; max-width: 620px; min-height: 48px; padding: 8px; border-radius: 14px; border: 2.5px solid var(--bsb-line); background: var(--bsb-panel); cursor: grab; text-align: left; touch-action: none; }
.bsb-organ .bsb-slide { flex: none; width: 190px; height: 150px; }
.bsb-organ-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bsb-organ-t b { font-size: 24px; }
.bsb-organ-t span { color: var(--bsb-soft); }
html .bsb-organ:hover:not(:disabled) { border-color: var(--bsb-accent); }
html .bsb-organ.is-held { border-color: #e0a21c; box-shadow: 0 0 0 4px rgba(255, 196, 61, .55), 0 6px 14px rgba(0, 0, 0, .22); background: var(--bsb-held); }
html .bsb-organ.is-placed { border-style: dashed; }
.bsb.is-dragging, .bsb.is-dragging * { cursor: grabbing; }
.bsb-ghost { position: fixed; z-index: 2147483600; width: 150px; height: 118px; transform: translate(-50%, -60%) rotate(-3deg); pointer-events: none; box-shadow: 0 10px 24px rgba(0, 0, 0, .35); border-radius: 8px; }
.bsb-ghost .bsb-slide { width: 100%; height: 100%; }

/* system bins (tier 1) */
.bsb-bins { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-content: start; }
html .bsb-bin { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 6px 10px; align-items: center; min-height: 48px; padding: 10px; border-radius: 14px; border: 2.5px solid var(--bsb-line); background: var(--bsb-panel); text-align: left; cursor: pointer; }
.bsb-bin .bsb-badge { width: 56px; height: 56px; }
.bsb-bin-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bsb-bin-t b { font-size: 20px; }
.bsb-bin-t span { color: var(--bsb-soft); }
.bsb-drop { grid-column: 1 / -1; min-height: 92px; border-radius: 10px; border: 2px dashed var(--bsb-line); display: grid; place-items: center; padding: 4px; }
.bsb-chip { display: block; width: 110px; height: 82px; background: var(--bsb-slide); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .28); }
.bsb-chip svg { width: 100%; height: 100%; }
html .bsb-bin:hover:not(:disabled), html .bsb-bin.is-over { border-color: var(--bsb-accent); background: var(--bsb-accent-bg); }
html .bsb-bin.is-ready { box-shadow: inset 0 0 0 3px #e0a21c; }
html .bsb-bin.is-chosen { border-color: var(--bsb-accent); box-shadow: 0 0 0 3px var(--bsb-accent); }
html .bsb-bin.is-chosen .bsb-drop { border-style: solid; border-color: var(--bsb-accent); }

/* relay strip (tier 2) */
.bsb .bsb-strip { flex: none; list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 26px; padding: 10px 12px; border-radius: 14px; background: var(--bsb-panel); border: 1.5px solid var(--bsb-line); }
.bsb-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.bsb-step-pic { display: block; width: 72px; height: 72px; }
.bsb-step-pic svg { width: 100%; height: 100%; }
.bsb-step-pic .bsb-organpic { border-radius: 50%; background: #fffaf0; box-shadow: inset 0 0 0 2px #b7a98c; }
.bsb-step-t { line-height: 1.2; overflow-wrap: anywhere; }
.bsb-q { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 3px dashed var(--bsb-accent); font-size: 36px; font-weight: 800; color: var(--bsb-accent); }
.bsb-step.is-q .bsb-step-t { font-weight: 700; color: var(--bsb-accent); }
.bsb-step.is-filled .bsb-step-t { color: var(--bsb-ok); }
.bsb-arrow { position: absolute; right: -24px; top: 26px; width: 20px; height: 20px; }
.bsb-arrow::before { content: ''; position: absolute; left: 0; top: 7px; width: 13px; height: 6px; background: var(--bsb-soft); }
.bsb-arrow::after { content: ''; position: absolute; right: 0; top: 2px; border: 8px solid transparent; border-left: 9px solid var(--bsb-soft); border-right: 0; }

/* picture choices (tier 2) */
.bsb-choices { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-content: start; }
html .bsb-choice { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-height: 48px; padding: 8px; border-radius: 14px; border: 2.5px solid var(--bsb-line); background: var(--bsb-panel); cursor: pointer; text-align: center; }
.bsb-cpic { position: relative; display: block; height: 170px; background: var(--bsb-slide); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .25); }
.bsb-cpic .bsb-sys { width: 100%; height: 100%; }
.bsb-cbadge { position: absolute; right: 6px; bottom: 6px; width: 64px; height: 64px; }
.bsb-choice-t { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
html .bsb-choice:hover:not(:disabled) { border-color: var(--bsb-accent); background: var(--bsb-accent-bg); }
html .bsb-choice.is-chosen { border-color: var(--bsb-accent); box-shadow: 0 0 0 3px var(--bsb-accent); }

/* ✓ / ✗ after Check: in the corner of the choice, never on a picture */
.bsb-mark { display: none; }
.bsb.is-revealed .bsb-mark:not(:empty) { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; font-weight: 800; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.bsb-bin .bsb-mark { position: absolute; right: 18px; bottom: 18px; }
.bsb-choice .bsb-mark { order: -1; align-self: center; }
html .bsb.is-revealed .is-right { border-color: #2f9a5c; box-shadow: 0 0 0 3px #2f9a5c; }
html .bsb.is-revealed .is-wrong { border-color: #c4473d; box-shadow: 0 0 0 3px #c4473d; }
.bsb.is-revealed .is-right .bsb-mark { background: #17663a; }
.bsb.is-revealed .is-wrong .bsb-mark { background: #a3241f; }

/* ── Briefing example and Start art ── */
.bsb-example { display: grid; grid-template-columns: 1fr 0.7fr 1.6fr; gap: 14px; align-items: start; font-size: 18px; }
.bsb-example figure { margin: 0; }
.bsb-example .bsb-slide { height: 170px; background: #fffaf0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .28); }
.bsb-example .bsb-slide svg { width: 100%; height: 100%; display: block; }
.bsb-example figcaption { margin-top: 6px; line-height: 1.3; }
.bsb-ex-strip { display: flex; align-items: center; justify-content: space-between; gap: 4px; height: 170px; padding: 6px; background: #fffaf0; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(60, 40, 30, .28); color: #3a2a24; }
.bsb-ex-strip .bsb-badge { width: 64px; height: 64px; flex: none; }
.bsb-ex-strip .bsb-ex-sys { height: 150px; width: 56px; flex: none; }
.bsb-ex-arrow { font-size: 24px; font-weight: 800; }
.bsb-example.is-drawer, .ps-brief--drawer .bsb-example { grid-template-columns: 1fr 1fr; }
.ps-brief--drawer .bsb-example figure:last-child { grid-column: 1 / -1; }
.bsb-start { width: 100%; height: 100%; display: grid; place-items: center; background: #fffaf0; border-radius: 12px; padding: 10px; box-sizing: border-box; }
.bsb-start svg { height: 100%; max-height: 420px; width: auto; }

/* ── Foundations: 18 px for the shell's words beside the play area too ── */
body[data-activity="body-systems-builder"] .ps-bubble, body[data-activity="body-systems-builder"] .ps-cust-detail, body[data-activity="body-systems-builder"] .ps-feedback,
body[data-activity="body-systems-builder"] .ps-hint, body[data-activity="body-systems-builder"] .ps-gloss, body[data-activity="body-systems-builder"] .ps-cust-who,
body[data-activity="body-systems-builder"] .ps-nudge { font-size: 18px; line-height: 1.3; }
body[data-activity="body-systems-builder"] .ps-cust-detail { color: var(--tlg-text); }
body[data-activity="body-systems-builder"] .ps-say { width: 48px; height: 48px; font-size: 22px; margin: -2px -4px 4px 8px; }
body[data-activity="body-systems-builder"] .ps-hint-btn { min-height: 48px; }
body[data-activity="body-systems-builder"] .ps-hint .ps-hint-note { font-size: 16px; }
body[data-activity="body-systems-builder"] .ps-side:has(.ps-feedback:not([hidden])) .ps-cust-detail,
body[data-activity="body-systems-builder"] .ps-side:has(.ps-feedback:not([hidden])) .ps-hint { display: none; }

/* a narrower right column: bins and choices stack as rows (picture left, words right) */
@container (max-width: 640px) {
  .bsb-bins, .bsb-choices { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  html .bsb-bin { grid-template-columns: 52px minmax(0, 1fr) auto 96px; grid-template-rows: auto; padding: 6px 10px; }
  .bsb-bin .bsb-drop { grid-column: 4; grid-row: 1; }
  .bsb-bin .bsb-badge { width: 52px; height: 52px; }
  .bsb-drop { grid-column: auto; min-height: 64px; }
  .bsb-chip { width: 84px; height: 60px; }
  .bsb-bin .bsb-mark { position: static; grid-column: 3; grid-row: 1; }
  html .bsb-choice { flex-direction: row; align-items: center; text-align: left; padding: 6px 10px; gap: 12px; }
  .bsb-cpic { flex: none; width: 108px; height: 108px; }
  .bsb-cbadge { width: 44px; height: 44px; right: 2px; bottom: 2px; }
  .bsb-choice-t { flex: 1 1 auto; }
  .bsb-choice .bsb-mark { order: 3; flex: none; }
  .bsb-organ .bsb-slide { width: 150px; height: 118px; }
  .bsb .bsb-strip { gap: 22px; padding: 8px; }
  .bsb-step-pic, .bsb-q { width: 56px; height: 56px; }
  .bsb-arrow { right: -21px; top: 18px; }
}
@media (max-width: 1180px) and (min-width: 901px) {
  .bsb { overflow-y: auto; grid-template-columns: minmax(170px, 26%) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .bsb { position: relative; inset: auto; overflow: visible; grid-template-columns: minmax(0, 1fr); padding: 10px 10px 16px; }
  .bsb .bsb-mapbox { display: grid; grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 12px; align-items: center; }
  .bsb-map { grid-row: 1 / span 2; height: 250px; }
  .bsb-head { flex-wrap: wrap; }
  html .bsb-organ { flex-direction: column; align-items: stretch; text-align: center; }
  .bsb-organ .bsb-slide { width: 100%; height: 150px; }
  .bsb .bsb-strip { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .bsb-step { flex-direction: row; text-align: left; gap: 12px; }
  .bsb-arrow { right: auto; left: 22px; top: auto; bottom: -22px; transform: rotate(90deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .bsb-organ, .bsb-bin, .bsb-choice { transition: border-color .12s, background-color .12s, box-shadow .12s; }
  .bsb.is-revealed .bsb-mapbox { animation: bsb-pop .35s ease-out; }
  @keyframes bsb-pop { 0% { transform: scale(.97); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
}
