/* Bone Matcher: museum comparative-anatomy prep lab. Scene drawn by art.js; .pdz-* from shared drag-zones. */
.bm, #bm-defs, .ps-brief, .ps-start {
  --bm-g1: #b23f26; --bm-g2: #2a5fae; --bm-g3: #17784e; --bm-g4: #7d3fa6;
  --bm-ink: #1d2a30; --bm-ink2: #3d4c53; --bm-paper: #fbf6ea; --bm-line: #c9b892;
  --bm-wall1: #2c5f6c; --bm-wall2: #1d4550; --bm-glow1: #fbfeff; --bm-glow2: #d9e9f0;
  --bm-right: #13704a; --bm-wrong: #b3261e;
}
html[data-theme="dark"] .bm, html[data-theme="dark"] #bm-defs, html[data-theme="dark"] .ps-brief, html[data-theme="dark"] .ps-start {
  --bm-wall1: #173840; --bm-wall2: #0f262c; --bm-glow1: #e9f2f5; --bm-glow2: #bfd2da;
  --bm-right: #4fd08c; --bm-wrong: #ff8a80;
}
.bm-c-humerus { color: var(--bm-g1); } .bm-c-radius-ulna { color: var(--bm-g2); }
.bm-c-carpals { color: var(--bm-g3); } .bm-c-phalanges { color: var(--bm-g4); }

/* ── layout ── */
.bm { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.bm-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; padding: 14px 14px 12px;
  background: linear-gradient(#fbf6ea, #f1e7d2); color: var(--bm-ink); border: 3px solid #6c4325; border-radius: 14px;
  box-shadow: inset 0 0 0 2px #e3d4b4, 0 3px 8px rgba(0,0,0,.18); }
html[data-theme="dark"] .bm-panel { background: linear-gradient(#2b2722, #221f1b); color: #f1e9da; border-color: #8a5a34; box-shadow: inset 0 0 0 2px #3a332b; }
.bm-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #6c4325; }
html[data-theme="dark"] .bm-kicker { color: #e4b98a; }
.bm-species { margin: -4px 0 0; font-size: 23px; line-height: 1.15; }
.bm-step { display: grid; gap: 7px; }
.bm-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.bm-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #21576b; color: #fff;
  font-size: 16px; font-weight: 800; }
.bm-step.is-done .bm-n { background: var(--bm-right); color: #fff; }
html[data-theme="dark"] .bm-step.is-done .bm-n { color: #0b1f16; }

/* tag roll (drag-zones tokens: reusable label dispensers) */
.bm-tray { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.bm-tag { display: flex; align-items: center; gap: 6px; min-height: 46px; padding: 4px 8px; font: inherit; font-size: 16px; font-weight: 800;
  color: var(--bm-ink); background: #fffdf7; border: 2px solid currentColor; border-radius: 8px 18px 18px 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,.18); cursor: grab; text-align: left; }
.bm-tag .bm-tag-t { color: var(--bm-ink); }
html[data-theme="dark"] .bm-tag { background: #f6efe0; }
.bm-tag:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,.2); }
.bm-tag:focus-visible, .bm-chip:focus-visible, .bm-why:focus-visible, .bm-stamp:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.bm-tag:disabled, .bm-tag.is-disabled { cursor: default; opacity: .75; }
.bm-sw { flex: none; display: block; }
.bm-sw-l { stroke: currentColor; stroke-width: 7; stroke-linecap: round; fill: none; }

.bm-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bm-chip, .bm-why { font: inherit; font-size: 16px; color: var(--bm-ink); background: #fffdf7; border: 2px solid #9c8a66; border-radius: 10px;
  cursor: pointer; text-align: center; }
.bm-chip { min-height: 46px; padding: 4px 2px; font-weight: 800; }
.bm-whys { display: grid; gap: 6px; }
.bm-why { min-height: 48px; padding: 5px 10px 5px 34px; text-align: left; line-height: 1.22; position: relative; }
.bm-why::before { content: ''; position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; margin-top: -9px; border: 2px solid #6d5d40; border-radius: 50%; }
.bm-chip[aria-pressed="true"], .bm-why[aria-pressed="true"] { background: #21576b; border-color: #21576b; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.bm-why[aria-pressed="true"]::before { background: #fff; border-color: #fff; box-shadow: inset 0 0 0 3px #21576b; }
html[data-theme="dark"] .bm-chip, html[data-theme="dark"] .bm-why { background: #3a342c; color: #f6efe0; border-color: #8f7d5c; }
html[data-theme="dark"] .bm-why::before { border-color: #d8c8a6; }
html[data-theme="dark"] .bm-chip[aria-pressed="true"], html[data-theme="dark"] .bm-why[aria-pressed="true"] { background: #7fc6d8; border-color: #7fc6d8; color: #0e2329; box-shadow: inset 0 0 0 2px #0e2329; }
.bm-chip:disabled, .bm-why:disabled { cursor: default; opacity: 1; }
.bm-chip.is-key, .bm-why.is-key { outline: 3px solid var(--bm-right); outline-offset: 1px; }
.bm-chip.is-key::after, .bm-why.is-key::after { content: ' ✓'; }
.bm-chip.is-wrong, .bm-why.is-wrong { outline: 3px dashed var(--bm-wrong); outline-offset: 1px; }
.bm-chip.is-wrong::after, .bm-why.is-wrong::after { content: ' ✗'; }
.bm-msg { margin: 0; min-height: 0; font-size: 16px; color: var(--bm-wrong); }
.bm-msg:empty { display: none; }

/* ── scene ── */
.bm-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.bm-scene { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.bm-svg { display: block; width: 100%; height: 100%; }
.bm-st-wall1 { stop-color: var(--bm-wall1); } .bm-st-wall2 { stop-color: var(--bm-wall2); }
.bm-st-glow1 { stop-color: var(--bm-glow1); } .bm-st-glow2 { stop-color: var(--bm-glow2); }
.bm-panel-line { stroke: rgba(255,255,255,.07); stroke-width: 2; fill: none; }
.bm-gridline { stroke: rgba(40,90,110,.12); stroke-width: 1; }
.bm-light-edge { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 2; }
.bm-t { font-family: var(--tlg-font, system-ui, sans-serif); fill: var(--bm-ink); }
.bm-t-h { font-size: 21px; font-weight: 800; }
.bm-t-s { font-size: 18px; fill: var(--bm-ink2); font-style: italic; }
.bm-t-n { font-size: 18px; font-weight: 800; fill: var(--bm-ink2); }
.bm-t-b { font-size: 18px; font-weight: 800; }
.bm-t-p { font-weight: 400; fill: var(--bm-ink2); }
.bm-t-k { font-size: 18px; font-weight: 800; letter-spacing: .05em; fill: #7a4b22; }
.bm-t-f { font-size: 18px; font-weight: 700; }
.bm-t-c { font-size: 18px; fill: var(--bm-ink2); }
.bm-t-r { font-size: 18px; font-weight: 800; fill: #21576b; }
.bm-t-rim { font-size: 18px; fill: #f6e7cf; }
.bm-key-card { fill: #6c4325; } .bm-key-inner { fill: var(--bm-paper); } .bm-key-shadow { fill: rgba(0,0,0,.28); }
.bm-pin { fill: #c79a3a; stroke: #6c4a16; stroke-width: 1.5; }
.bm-key-line { stroke: currentColor; stroke-width: 9; stroke-linecap: round; fill: none; }
.bm-ex-card { stroke: #b9a375; stroke-width: 2; }
.bm-clip { stroke: #6c4a16; stroke-width: 1.5; }

/* bones */
.bm-bo { fill: #6f5a3a; stroke: #6f5a3a; stroke-width: 3; }
.bm-bh { stroke: rgba(255,255,255,.75); fill: rgba(255,255,255,.55); stroke-linecap: round; }
path.bm-bh { fill: none; }
.bm-bone--meta .bm-bo { fill: #6c6a66; stroke: #6c6a66; }
.bm-grp { transition: filter .3s; }
.bm-grp.is-pulse { filter: drop-shadow(0 0 6px #ffd84d) drop-shadow(0 0 2px #ffd84d); }
.bm-soft--skin line, .bm-soft--skin circle { stroke: #e7b892; fill: #e7b892; stroke-linecap: round; opacity: .38; }
.bm-soft--skin circle { stroke: none; }
.bm-soft--flipper { fill: #6f8796; opacity: .38; stroke: #4f6674; stroke-width: 2; }
.bm-soft--membrane { fill: #7d5a46; opacity: .34; stroke: #5b3f2f; stroke-width: 2; }
.bm-feather { fill: #e3e7e9; stroke: #8d999f; stroke-width: 1.5; }
.bm-soft--feathers { opacity: .85; }
.bm-rachis { stroke: #9aa6ab; stroke-width: 1.6; }
.bm-hoof { fill: #3f3a35; stroke: #1f1c19; stroke-width: 2; }
.bm-halo line { stroke: currentColor; stroke-linecap: round; opacity: .55; }
.bm-halo circle { fill: currentColor; opacity: .55; }

/* markers + leader lines */
.bm-leader { fill: none; stroke: #5d6b70; stroke-width: 3; stroke-linecap: round; }
.bm-leader.is-set { stroke: currentColor; stroke-width: 4.5; }
.bm-marker circle { fill: #21576b; stroke: #fff; stroke-width: 3; }
.bm-marker text { font: 800 18px var(--tlg-font, system-ui, sans-serif); fill: #fff; }
.bm-marker.is-right circle { fill: var(--bm-right); }
.bm-marker.is-wrong circle { fill: var(--bm-wrong); }
html[data-theme="dark"] .bm-marker.is-right circle, html[data-theme="dark"] .bm-marker.is-wrong circle { fill: #1d2a30; stroke: currentColor; }
html[data-theme="dark"] .bm-marker.is-right { color: var(--bm-right); } html[data-theme="dark"] .bm-marker.is-wrong { color: var(--bm-wrong); }
.bm-match-line { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; }

/* exhibit art */
.bm-rv { opacity: 0; }
.bm-rv-line { fill: none; stroke: #21576b; stroke-width: 3.5; stroke-linecap: round; }
.bm-rv-node { fill: #21576b; }
.bm-rv-gap { stroke: var(--bm-wrong); stroke-width: 3.5; stroke-linecap: round; }
.bm-insect-body { fill: #4f5b3a; }
.bm-insect-wing { fill: rgba(170,210,225,.55); stroke: #5d7c88; stroke-width: 2; }
.bm-insect-vein { fill: none; stroke: #5d7c88; stroke-width: 1.4; }
.bm-whale { fill: #5d7584; stroke: #3b4f5b; stroke-width: 2; }
.bm-whale-eye { fill: #18252c; }
.bm-whale-fin { fill: #4b6170; stroke: #3b4f5b; stroke-width: 2; }
.bm-whale-line { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 2; }
.bm-pelvis path { stroke: #fbf3df; stroke-width: 5; stroke-linecap: round; }
.bm-ring { fill: none; stroke: #7a4b22; stroke-width: 2.5; stroke-dasharray: 5 4; }
.bm-ghost-leg path { fill: none; stroke: #9a8662; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }

/* slots (drag-zones zones) over the light table */
.bm-slots { position: absolute; inset: 0; pointer-events: none; }
.bm-slot { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: 2px;
  padding: 4px 6px 5px; pointer-events: auto; background: rgba(255,253,246,.94); color: var(--bm-ink); border: 2px solid #8a7550;
  border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,.2); }
.bm-slot-h { display: flex; gap: 6px; align-items: flex-start; }
.bm-badge { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #21576b; color: #fff; font-size: 16px; font-weight: 800; }
.bm-clue { font-size: 16px; line-height: 1.12; color: var(--bm-ink2); }
.bm-slot-tag { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.bm-empty { flex: 1; text-align: center; font-size: 16px; color: #6d5d40; border: 2px dashed #b5a27a; border-radius: 7px; padding: 1px 4px; }
.bm-stamp { flex: 1; display: flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 6px; font: inherit; font-size: 16px; font-weight: 800;
  color: inherit; background: #fff; border: 2px solid currentColor; border-radius: 7px; cursor: pointer; }
.bm-stamp-t { color: var(--bm-ink); flex: 1; text-align: left; white-space: nowrap; }
.bm-x { color: var(--bm-ink2); font-size: 16px; }
.bm-stamp:disabled { cursor: default; }
.bm-stamp:disabled .bm-x { display: none; }
.bm-hold { display: none; }
.bm-right { font-size: 16px; font-weight: 800; line-height: 1.12; color: var(--bm-wrong); }
.bm-slot.is-right { border-color: var(--bm-right); box-shadow: 0 0 0 3px var(--bm-right); }
.bm-slot.is-wrong { border-color: var(--bm-wrong); border-style: dashed; box-shadow: 0 0 0 3px var(--bm-wrong); animation: bm-shake .45s 1; }
.bm-slot.is-right .bm-badge { background: var(--bm-right); } .bm-slot.is-wrong .bm-badge { background: var(--bm-wrong); }
html[data-theme="dark"] .bm-slot { --bm-right: #13704a; --bm-wrong: #b3261e; }
.bm-slot [hidden] { display: none !important; }
html.pdz-armed .bm-slot.pdz-zone { outline: 3px dashed #21576b; outline-offset: 2px; }
.bm-slot.pdz-zone.is-over { outline: 4px solid #f0a830 !important; outline-offset: 2px; }
@keyframes bm-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Briefing example */
.bm-ex-svg { display: block; width: 100%; height: auto; }
.bm-ex-svg .bm-t { fill: var(--tlg-text); }

/* narrow: stack; slots drop below the drawing as a list */
@media (max-width: 900px) {
  .bm { position: static; grid-template-columns: 1fr; }
  .bm-panel { overflow: visible; }
  .bm-view { display: block; }
  .bm-scene { width: 100% !important; height: auto !important; overflow: visible; box-shadow: none; }
  .bm-svg { height: auto; border-radius: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  .bm-slots { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; pointer-events: auto; }
  .bm-slot { position: static !important; width: auto !important; height: auto !important; min-height: 86px; }
}
@media (max-width: 480px) { .bm-slots { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .bm *, .bm *::before { transition: none !important; animation: none !important; }
}
