/* ============================================================
   Brachial Plexus Explorer — module styles
   Everything is scoped under .bp so nothing leaks into the platform.
   Module-specific components remain scoped under .bp while shared site
   typography, navigation, disclaimer, and footer come from the platform.
   ============================================================ */

.bp-intro-section,
.bp-evidence-section {
  color: var(--ink);
  background: var(--surface);
}
.bp-intro-section { border-bottom: 1px solid var(--line); }
.bp-intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  padding-block: clamp(28px, 4vw, 44px);
}
.bp-intro-copy h2,
.bp-objectives h2,
.bp-evidence-section h2,
.bp-evidence-section h3 {
  color: var(--ink);
}
.bp-intro-copy h2,
.bp-objectives h2,
.bp-evidence-section h2 {
  font-family: var(--serif);
}
.bp-intro-copy h2 { margin: 14px 0 8px; font-size: clamp(1.3rem, 2vw, 1.65rem); }
.bp-intro-copy p { max-width: 68ch; margin: 0; color: var(--muted); }
.bp-module-meta,
.bp-intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.bp-module-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .72rem;
}
.bp-status {
  padding: 5px 9px;
  color: var(--blue-dark);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 700;
}
.bp-intro-actions { margin-top: 18px; }
.bp-intro-actions a:not(.button) { color: var(--blue); font-size: .82rem; font-weight: 650; text-underline-offset: 3px; }
.bp-intro-actions .button { min-height: 42px; padding: 10px 15px; font-size: .8rem; }
.bp-objectives {
  padding: 0 20px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.bp-objectives summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.bp-objectives summary span { color: var(--muted); font-family: var(--mono); font-size: .7rem; font-weight: 500; }
.bp-objectives ul,
.bp-evidence-grid ul { margin: 0; padding-left: 20px; }
.bp-objectives ul { padding-bottom: 17px; }
.bp-objectives li,
.bp-evidence-grid li { margin: 7px 0; color: var(--muted); }

.bp-evidence-section {
  padding: clamp(48px, 7vw, 78px) 0;
  border-top: 1px solid var(--line);
}
.bp-evidence-shell > .section-heading { margin-bottom: 24px; }
.bp-evidence-shell > .section-heading h2 { margin: 6px 0 0; font-size: clamp(1.75rem, 3vw, 2.4rem); }
.bp-evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.bp-evidence-card {
  padding: 0 20px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.bp-evidence-card summary {
  padding: 18px 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.bp-evidence-card ul,
.bp-evidence-card p { padding-bottom: 16px; }
.bp-evidence-grid p { margin: 0 0 10px; color: var(--muted); }
.bp-evidence-grid a,
.bp-references a { color: var(--blue); }
.bp-references {
  margin-top: 18px;
  padding: 0 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.bp-references summary {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.bp-references summary span { color: var(--muted); font-family: var(--mono); font-size: .72rem; font-weight: 500; }
.bp-references ol { margin: 0 0 18px; padding-left: 22px; }
.bp-references li { margin: 10px 0; color: var(--muted); }
.bp-reference-note { margin: 0 0 20px; color: var(--muted); font-size: .82rem; }

.bp {
  /* palette */
  --bp-ink:          var(--ink);
  --bp-muted:        var(--muted);
  --bp-surface:      var(--surface-subtle);
  --bp-card:         var(--surface);
  --bp-line:         var(--line);
  --bp-accent:       var(--blue);
  --bp-accent-ink:   var(--blue-dark);
  --bp-accent-wash:  var(--wash);
  --bp-verified:     var(--verified);
  --bp-danger:       var(--red);
  --bp-warn:         var(--orange);
  --bp-violet:       var(--purple);
  --bp-teal:         var(--teal);
  --bp-nerve:        #d6ad3f;
  --bp-nerve-posterior: #b88327;

  /* type */
  --bp-sans:  var(--sans);
  --bp-serif: var(--serif);
  --bp-mono:  var(--mono);

  /* shape */
  --bp-radius:    var(--radius-sm);
  --bp-shadow:    var(--shadow-sm);
  --bp-shadow-lg: var(--shadow-md);

  /* wiring tiers — used by both the legend and the SVG canvas */
  --bp-tier-root:     var(--blue);
  --bp-tier-trunk:    var(--orange);
  --bp-tier-division: var(--purple);
  --bp-tier-cord:     var(--teal);
  --bp-tier-nerve:    var(--red);

  width: min(calc(100% - 40px), var(--shell, 1240px));
  margin: 0 auto;
  padding: 34px 0 64px;
  font-family: var(--bp-sans);
  color: var(--bp-ink);
  line-height: 1.55;
}

.bp *,
.bp *::before,
.bp *::after { box-sizing: border-box; }

.bp button { font-family: inherit; cursor: pointer; }
.bp svg    { display: block; }
.bp [hidden] { display: none !important; }

.bp :focus-visible {
  outline: 2px solid var(--bp-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.bp-focused-bar { display: none; }
.bp-tab-compact { display: none; }
.bp-panel-tools { position: relative; }

/* ── Tabs ──────────────────────────────────────────────────── */
.bp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 5px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 12px;
  border-bottom: 1px solid var(--bp-line);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.bp-tabs::-webkit-scrollbar { display: none; }
.bp-tab {
  min-height: 44px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--bp-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: 12px 20px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  scroll-snap-align: nearest;
}
.bp-tab:hover { color: var(--bp-ink); }
.bp-tab.is-active {
  color: #fff;
  background: var(--bp-ink);
  font-weight: 600;
}

.bp-panel { display: none; padding-top: 4px; }
.bp-panel.is-active { display: block; }
.bp-activity-stage { min-width: 0; }
.bp-pan-cue { display: none; }

/* ── Short interactive tutorial ─────────────────────────── */
.bp-tour {
  position: fixed;
  z-index: 1000;
  inset: 0;
  pointer-events: none;
}
.bp-tour-card {
  position: fixed;
  right: clamp(14px, 3vw, 36px);
  bottom: clamp(14px, 3vw, 30px);
  width: min(420px, calc(100vw - 28px));
  padding: 20px;
  pointer-events: auto;
  background: var(--bp-card);
  border: 1px solid var(--bp-line);
  border-top: 4px solid var(--bp-accent);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(22, 32, 43, .28);
}
.bp-tour-progress {
  color: var(--bp-accent);
  font-family: var(--bp-mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.bp-tour-card h2 { margin: 7px 0 6px; font-family: var(--bp-serif); font-size: 1.35rem; }
.bp-tour-card p { margin: 0; color: var(--bp-muted); font-size: .9rem; line-height: 1.55; }
.bp-tour-feedback {
  min-height: 1.5em;
  margin-top: 9px !important;
  color: var(--bp-success, #2f7d32) !important;
  font-weight: 600;
}
.bp-tour-actions { display: flex; align-items: center; gap: 7px; margin-top: 18px; }
.bp-tour-target {
  position: relative;
  z-index: 999;
  outline: 4px solid rgba(27, 79, 160, .28) !important;
  outline-offset: 5px !important;
  border-radius: 8px;
  scroll-margin: 130px;
}
.bp-label.bp-tour-target { outline: none !important; }
.bp-label.bp-tour-target .bp-label-prompt,
.bp-label.bp-tour-target .bp-label-text { filter: drop-shadow(0 0 6px rgba(27, 79, 160, .75)); }

/* ── Toolbar ───────────────────────────────────────────────── */
.bp-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}
.bp-spacer { flex: 1 1 auto; }
.bp-toolbar-note { font-size: .82rem; color: var(--bp-muted); }

.bp-advanced-controls {
  margin-bottom: 10px;
  padding: 0 12px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
}
.bp-advanced-controls summary {
  padding: 10px 2px;
  color: var(--bp-muted);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
}
.bp-advanced-controls > div { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 0 12px; }

.bp-score {
  font-family: var(--bp-mono);
  font-size: .78rem;
  font-weight: 500;
  color: var(--bp-accent-ink);
  margin-right: 6px;
}

.bp-btn {
  min-height: 44px;
  padding: 5px 13px;
  border: 1px solid var(--bp-line);
  border-radius: 8px;
  background: var(--bp-card);
  color: var(--bp-muted);
  font-size: .78rem;
  font-weight: 500;
  transition: color .15s, border-color .15s, background .15s;
}
.bp-btn:hover {
  color: var(--bp-accent);
  border-color: var(--bp-accent);
  background: var(--bp-accent-wash);
}
.bp-btn--primary {
  background: var(--bp-accent);
  border-color: var(--bp-accent);
  color: #fff;
  font-weight: 600;
}
.bp-btn--primary:hover { background: var(--bp-accent-ink); border-color: var(--bp-accent-ink); color: #fff; }

.bp-hint {
  font-size: .78rem;
  font-style: italic;
  color: var(--bp-muted);
  background: var(--bp-accent-wash);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  padding: 8px 14px;
  margin-bottom: 14px;
}

/* ── Anatomy figure ────────────────────────────────────────── */
.bp-figure {
  position: relative;
  display: flex;
  justify-content: center;
  padding: clamp(10px, 2vw, 24px);
  background: var(--bp-card);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
}
.bp-figure #bp-anat-svg {
  width: min(100%, 1120px);
  height: auto;
  overflow: visible;
}
.bp-anat-headings text {
  fill: var(--bp-muted);
  font-family: var(--bp-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.bp-anat-headings line { stroke: var(--bp-line); stroke-width: 1; }
.bp-path-halo-color { flood-color: var(--bp-card); }
.bp-anat-tier,
.bp-anat-network,
.bp-anat-collaterals {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bp-anat-tier path {
  stroke: var(--bp-nerve);
  stroke-width: 6.5;
  opacity: .98;
}
.bp-anat-tier--division path,
.bp-anat-tier--nerve path,
.bp-anat-collaterals path { filter: url(#bp-path-separation); }
.bp-anat-network .bp-path--posterior { stroke: var(--bp-nerve-posterior); }
.bp-anat-tier circle,
.bp-anat-collaterals circle {
  fill: var(--bp-nerve);
  stroke: var(--bp-card);
  stroke-width: 2.5;
}
.bp-anat-junction-caps circle {
  fill: var(--bp-nerve);
  stroke: var(--bp-card);
  stroke-width: 2;
}
.bp-anat-junction-caps .bp-anat-junction-cap--posterior {
  fill: var(--bp-nerve-posterior);
}
.bp-anat-collaterals path {
  stroke: var(--bp-nerve);
  stroke-width: 3;
  opacity: .52;
}
.bp-anat-collaterals circle { opacity: .68; }
.bp-anat-collaterals {
  transition: opacity .18s ease;
}
.bp-anat-collaterals.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.bp-anat-network path {
  transition: opacity .16s ease, stroke-width .16s ease;
}
.bp-anat-network.is-tracing path { opacity: .1; }
.bp-anat-network.is-tracing path.is-traced {
  opacity: 1;
  stroke-width: 8;
}
.bp-anat-network.is-tracing .bp-anat-collaterals path.is-traced {
  stroke-width: 4.5;
}
.bp-label { cursor: pointer; }
.bp-label text { pointer-events: none; }
.bp-label-hit { pointer-events: all; }
.bp-label-selection {
  fill: var(--bp-accent-wash);
  stroke: var(--bp-accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}
.bp-label-prompt { transition: stroke-width .15s, filter .15s; }
.bp-label:hover .bp-label-prompt { filter: brightness(.96); stroke-width: 2; }
.bp-label:hover .bp-label-text { fill: var(--bp-accent); }
.bp-label.is-selected .bp-label-text { font-weight: 700; }

@media (max-width: 700px), (max-height: 500px) and (max-width: 950px) {
  .bp-intro-grid,
  .bp-evidence-grid { grid-template-columns: 1fr; }
  .bp { width: min(calc(100% - 24px), var(--shell, 1240px)); padding-top: 22px; }
  .bp-toolbar { align-items: stretch; }
  .bp-spacer { display: none; }
  .bp-activity-nav {
    position: sticky;
    z-index: 18;
    top: 72px;
    margin: 0 -2px 14px;
    padding-top: 6px;
    background: color-mix(in srgb, var(--bp-card) 94%, transparent);
    backdrop-filter: blur(10px);
  }
  .bp-tabs { margin: 0; }
  .bp-tab { padding: 10px 13px; }
  #module-controls,
  #module-visualization { scroll-margin-top: 142px; }
  .bp-tour-card { right: 12px; bottom: 12px; width: calc(100vw - 24px); padding: 17px; }
  .bp-tour-actions { flex-wrap: wrap; }
  .bp-tour-actions .bp-spacer { display: block; flex: 1 1 24px; }
  .bp-figure { overflow-x: auto; justify-content: flex-start; }
  .bp-figure #bp-anat-svg { min-width: 920px; }
  .bp-pan-cue {
    position: absolute;
    z-index: 8;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    margin: 0;
    padding: 7px 10px;
    color: #fff;
    background: rgba(22, 32, 43, .88);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(22, 32, 43, .18);
    font-family: var(--bp-mono);
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .03em;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  .bp-pan-cue.is-dismissed { opacity: 0; transform: translateY(-4px); }
}

.bp-credit {
  text-align: center;
  padding: 10px 0 0;
  font-size: .68rem;
  font-style: italic;
  color: var(--bp-muted);
}

/* ── Detail card (nerve / branch) ──────────────────────────── */
.bp-detail {
  position: relative;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--bp-line);
  border-left: 3px solid var(--bp-detail-accent, var(--bp-accent));
  border-radius: var(--bp-radius);
  background: var(--bp-card);
  box-shadow: var(--bp-shadow);
}
.bp-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--bp-muted);
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 8px;
  font-size: .72rem;
  font-weight: 600;
}
.bp-detail-close:hover { color: var(--bp-accent); border-color: var(--bp-accent); }
.bp-detail-kicker {
  font-family: var(--bp-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bp-detail-accent, var(--bp-accent));
}
.bp-detail-title {
  font-family: var(--bp-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2px 0 6px;
}
.bp-detail-meta { font-size: .8rem; color: var(--bp-muted); margin-bottom: 14px; }
.bp-detail-meta strong { color: var(--bp-ink); font-weight: 600; }

.bp-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.bp-detail-cell {
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 8px;
  padding: 12px;
}
.bp-detail-cell h4 {
  font-family: var(--bp-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bp-muted);
  margin-bottom: 6px;
}
.bp-detail-cell ul { margin: 0; padding-left: 16px; }
.bp-detail-cell li,
.bp-detail-cell p { font-size: .82rem; line-height: 1.6; margin: 0 0 3px; }

.bp-mnemonic {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bp-accent-wash);
  border: 1px solid var(--bp-line);
  border-radius: 8px;
  font-size: .84rem;
  font-style: italic;
  line-height: 1.7;
}

/* ── Connect the nodes ─────────────────────────────────────── */
.bp-canvas-wrap {
  overflow-x: auto;
  background: var(--bp-card);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  padding: 8px;
  box-shadow: var(--bp-shadow);
}
#bp-connect-svg { margin: 0 auto; min-width: 720px; }
.bp-cnode { cursor: pointer; }
.bp-cnode:hover rect { filter: brightness(.97); }

#bp-connect-result {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--bp-radius);
  font-size: .9rem;
  line-height: 1.7;
  border: 1px solid var(--bp-result-accent, var(--bp-line));
  background: var(--bp-result-wash, var(--bp-surface));
}
#bp-connect-result b { color: var(--bp-result-accent, var(--bp-ink)); font-family: var(--bp-mono); font-size: 1.05rem; }
#bp-connect-result span { color: var(--bp-muted); font-size: .82rem; }

.bp-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--bp-mono);
  font-size: .72rem;
  color: var(--bp-muted);
}
.bp-legend li { display: flex; align-items: center; gap: 6px; }
.bp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bp-accent); }
.bp-dot[data-bp-tier="root"]     { background: var(--bp-tier-root); }
.bp-dot[data-bp-tier="trunk"]    { background: var(--bp-tier-trunk); }
.bp-dot[data-bp-tier="division"] { background: var(--bp-tier-division); }
.bp-dot[data-bp-tier="cord"]     { background: var(--bp-tier-cord); }
.bp-dot[data-bp-tier="nerve"]    { background: var(--bp-tier-nerve); }

/* ── Explorer ──────────────────────────────────────────────── */
.bp-lede { color: var(--bp-muted); font-size: .9rem; margin: 20px 0; }
.bp-rootpicker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.bp-rootbtn {
  padding: 12px 26px;
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  background: var(--bp-card);
  color: var(--bp-muted);
  font-family: var(--bp-mono);
  font-size: 1.05rem;
  font-weight: 600;
  box-shadow: var(--bp-shadow);
  transition: color .15s, border-color .15s, background .15s;
}
.bp-rootbtn:hover { color: var(--bp-accent); border-color: var(--bp-accent); }
.bp-rootbtn.is-active {
  border: 2px solid var(--bp-accent);
  background: var(--bp-accent-wash);
  color: var(--bp-accent-ink);
}

.bp-empty { color: var(--bp-muted); text-align: center; padding: 60px 0; font-size: 1rem; }

.bp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.bp-infocard {
  background: var(--bp-card);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  padding: 18px;
  box-shadow: var(--bp-shadow);
}
.bp-infocard h3 {
  font-family: var(--bp-mono);
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bp-accent);
  margin-bottom: 12px;
}
.bp-infocard p  { font-size: .95rem; margin: 0; }
.bp-infocard ul { margin: 0; padding-left: 16px; }
.bp-infocard li { font-size: .84rem; margin-bottom: 3px; }

.bp-chip {
  display: inline-block;
  padding: 5px 13px;
  margin: 3px;
  border: 1px solid var(--bp-line);
  border-radius: 20px;
  background: var(--bp-accent-wash);
  color: var(--bp-accent-ink);
  font-size: .82rem;
}

/* ── Quiz ──────────────────────────────────────────────────── */
#bp-panel-quiz { max-width: 720px; margin: 0 auto; padding-top: 24px; }

.bp-quiz-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--bp-mono);
  font-size: .78rem;
  color: var(--bp-muted);
  margin-bottom: 14px;
}
.bp-quiz-meta strong { color: var(--bp-accent); }

.bp-progress { height: 5px; background: var(--bp-line); border-radius: 3px; margin-bottom: 24px; }
.bp-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bp-accent), var(--bp-violet));
  transition: width .4s ease;
}

.bp-card {
  background: var(--bp-card);
  border: 1px solid var(--bp-line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--bp-shadow);
}
.bp-q-text { font-family: var(--bp-serif); font-size: 1.05rem; line-height: 1.7; margin: 0; }

.bp-choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 9px;
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  background: var(--bp-card);
  color: var(--bp-ink);
  text-align: left;
  font-size: .92rem;
  box-shadow: var(--bp-shadow);
  transition: border-color .15s, background .15s;
}
.bp-choice:hover:not(:disabled) { border-color: var(--bp-accent); background: var(--bp-accent-wash); }
.bp-choice:disabled { cursor: default; }
.bp-choice.is-correct { background: var(--verified-wash); border-color: var(--bp-verified); color: var(--bp-verified); }
.bp-choice.is-wrong   { background: var(--danger-wash); border-color: var(--bp-danger); color: var(--bp-danger); }
.bp-choice.is-dimmed  { color: var(--bp-muted); opacity: .6; }

.bp-choice-key {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bp-accent-wash);
  color: var(--bp-accent);
  font-family: var(--bp-mono);
  font-size: .72rem;
  font-weight: 600;
}
.bp-choice.is-correct .bp-choice-key { background: var(--bp-verified); color: #fff; }
.bp-choice.is-wrong   .bp-choice-key { background: var(--bp-danger);   color: #fff; }

.bp-pearl {
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-radius);
  background: var(--bp-accent-wash);
  font-size: .88rem;
  line-height: 1.7;
}
.bp-pearl b {
  color: var(--bp-accent);
  font-family: var(--bp-mono);
  font-size: .7rem;
  letter-spacing: .06em;
  margin-right: 8px;
}

.bp-btn--next {
  width: 100%;
  padding: 13px;
  background: var(--bp-accent);
  border-color: var(--bp-accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}
.bp-btn--next:hover { background: var(--bp-accent-ink); border-color: var(--bp-accent-ink); color: #fff; }

#bp-quiz-results { text-align: center; padding: 32px 0; }
.bp-score-ring {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 3px solid var(--bp-result-accent, var(--bp-accent));
  background: var(--bp-result-wash, var(--bp-accent-wash));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.bp-score-pct {
  font-family: var(--bp-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--bp-result-accent, var(--bp-accent));
}
.bp-score-frac { font-family: var(--bp-mono); font-size: .72rem; color: var(--bp-muted); }
#bp-result-label { font-family: var(--bp-serif); font-size: 1.4rem; margin: 0 0 16px; }

#bp-missed-list { text-align: left; margin: 16px 0; }
.bp-missed-head {
  font-family: var(--bp-mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bp-muted);
  margin-bottom: 8px;
}
.bp-missed {
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--danger-wash);
  border: 1px solid var(--danger-line);
  border-radius: var(--bp-radius);
}
.bp-missed-q { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.bp-missed-a { font-size: .85rem; font-weight: 500; color: var(--bp-verified); margin-bottom: 6px; }
.bp-missed-e { font-size: .85rem; line-height: 1.6; color: var(--bp-muted); }
.bp-perfect  { color: var(--bp-verified); font-size: .9rem; }

/* ── Footer ────────────────────────────────────────────────── */
/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bp-intro-grid,
  .bp-evidence-shell { width: min(calc(100% - 24px), var(--shell, 1240px)); }
  .bp { padding: 0 14px 32px; }
  .bp-badge { margin-left: 0; }
  .bp-tab { padding: 10px 14px; font-size: .84rem; }
  .bp-detail-grid { grid-template-columns: 1fr; }
}

/* ── Focused phone workspace ─────────────────────────────── */
@media (max-width: 700px), (max-height: 500px) and (max-width: 950px) {
  .bp.bp-focused-entry-ready:not(.is-focused) {
    display: none;
  }

  body.bp-workspace-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .bp.is-focused {
    position: fixed;
    z-index: 1200;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    color: var(--bp-ink);
    background: var(--bp-surface);
    overflow: hidden;
  }

  .bp.is-focused .bp-focused-bar {
    grid-row: 1;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    min-height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
    color: #fff;
    background: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
  }

  .bp-focused-title {
    min-width: 0;
    text-align: center;
    line-height: 1.15;
  }
  .bp-focused-title strong,
  .bp-focused-title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bp-focused-title strong { font-size: .88rem; }
  .bp-focused-title span {
    margin-top: 3px;
    color: rgba(255, 255, 255, .68);
    font-family: var(--bp-mono);
    font-size: .62rem;
    letter-spacing: .04em;
  }

  .bp-focused-action {
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 9px;
    font-size: .75rem;
    font-weight: 600;
  }
  .bp-focused-action:hover { background: rgba(255, 255, 255, .1); }
  .bp-focused-action:last-child { justify-self: end; }

  .bp.is-focused .bp-activity-nav {
    position: static;
    z-index: 20;
    grid-row: 3;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--bp-card);
    border-top: 1px solid var(--bp-line);
    backdrop-filter: none;
  }
  .bp.is-focused .bp-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    margin: 0;
    padding: 3px;
    overflow: visible;
  }
  .bp.is-focused .bp-tab {
    min-width: 0;
    min-height: 44px;
    padding: 7px 3px;
    font-size: .72rem;
    line-height: 1.1;
  }
  .bp.is-focused .bp-tab-wide { display: none; }
  .bp.is-focused .bp-tab-compact { display: inline; }

  .bp.is-focused .bp-activity-stage {
    position: relative;
    z-index: 1;
    grid-row: 2;
    min-height: 0;
    overflow: hidden;
    background: var(--bp-surface);
  }
  .bp.is-focused .bp-panel.is-active {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .bp.is-focused .bp-panel-tools {
    display: none;
    position: absolute;
    z-index: 12;
    top: 8px;
    left: 8px;
    right: 8px;
    max-height: min(50dvh, 420px);
    padding: 10px 12px;
    overflow: auto;
    background: color-mix(in srgb, var(--bp-card) 97%, transparent);
    border: 1px solid var(--bp-line);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(22, 32, 43, .22);
    backdrop-filter: blur(12px);
  }
  .bp.is-focused .bp-panel-tools.is-open { display: block; }
  .bp.is-focused .bp-panel-tools .bp-toolbar { padding-top: 0; }
  .bp.is-focused .bp-panel-tools .bp-hint { margin-bottom: 0; }

  .bp.is-focused #bp-panel-anat {
    overflow: hidden;
    background: var(--bp-card);
  }
  .bp.is-focused .bp-figure {
    width: 100%;
    height: 100%;
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    scrollbar-width: thin;
  }
  .bp.is-focused .bp-pan-cue {
    top: 10px;
  }
  .bp.is-focused .bp-figure #bp-anat-svg {
    flex: 0 0 auto;
    width: 920px;
    min-width: 920px;
    height: auto;
  }
  .bp.is-focused .bp-credit { display: none; }

  .bp.is-focused #bp-anat-detail:not([hidden]) {
    position: absolute;
    z-index: 15;
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: min(46dvh, 430px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .bp.is-focused #bp-anat-detail .bp-detail {
    margin: 0;
    padding: 18px 16px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 50px rgba(22, 32, 43, .28);
  }
  .bp.is-focused .bp-detail-title { padding-right: 58px; }

  .bp.is-focused #bp-panel-connect { padding: 8px; }
  .bp.is-focused .bp-canvas-wrap {
    width: 100%;
    min-height: calc(100% - 68px);
    overflow: auto;
    touch-action: pan-x pan-y;
  }
  .bp.is-focused #bp-connect-svg { min-width: 760px; }
  .bp.is-focused .bp-legend { padding-bottom: 10px; }

  .bp.is-focused #bp-panel-explorer,
  .bp.is-focused #bp-panel-quiz {
    padding: 16px;
    background: var(--bp-surface);
  }
  .bp.is-focused #bp-panel-quiz { max-width: none; }
  .bp.is-focused .bp-rootpicker {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .bp.is-focused .bp-rootbtn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 4px;
  }

  .bp.is-focused .bp-tour-card {
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-height: min(48dvh, 390px);
    overflow: auto;
  }

  .bp-tour-actions #bp-tour-next:disabled {
    opacity: .72;
    cursor: not-allowed;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bp *,
  .bp *::before,
  .bp *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .bp-tabs, .bp-toolbar, .bp-btn { display: none !important; }
  .bp-panel { display: block !important; page-break-inside: avoid; }
}
