:root {
  --bg: #f8fafc;
  --bg-deep: #f1f5f9;
  --fg: #0f172a;
  --muted: #64748b;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-border: #e2e8f0;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-glow: rgba(16, 185, 129, 0.22);
  --accent-text: #047857;
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.1);
  --zone-a: rgba(59, 130, 246, 0.22);
  --zone-b: rgba(16, 185, 129, 0.22);
  --zone-ab: rgba(13, 148, 136, 0.38);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --motion: 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-drag: 0 16px 32px rgba(15, 23, 42, 0.18);
  --stage-border: 1px solid rgba(255, 255, 255, 0.08);
  --stage-elev: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  --card-pad: 1rem 1.25rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1100px 560px at 8% -8%, rgba(16, 185, 129, 0.16), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(14, 165, 233, 0.1), transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 40%, #e2e8f0 100%);
  color: var(--fg);
  font-family: var(--font-body);
}

.hidden { display: none !important; }
.app-shell, .admin-shell { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.admin-shell--app { max-width: 1280px; padding: 0.65rem 0.85rem 1.25rem; }
.app-shell[data-mode="studio"],
.app-shell[data-mode="community"] {
  max-width: 1120px;
  padding: 0.75rem 1rem 1.5rem;
}
.app-shell[data-mode="diagram"] {
  max-width: min(1680px, 100%);
  padding: 0.65rem 1rem 0.75rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.topbar {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end;
  margin-bottom: 1.25rem;
}
.admin-topbar {
  align-items: center;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  gap: 0.65rem;
}
.brand {
  font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); font-weight: 700;
  color: #064e3b; text-decoration: none;
}
.brand--sm { font-size: 1.35rem; }
.app-shell[data-mode="studio"] .brand,
.app-shell[data-mode="community"] .brand,
.app-shell[data-mode="diagram"] .brand {
  font-size: 1.55rem;
}
.app-shell[data-mode="studio"] .tagline,
.app-shell[data-mode="community"] .tagline,
.app-shell[data-mode="diagram"] .tagline {
  font-size: 0.82rem;
}
.app-shell[data-mode="studio"] .topbar,
.app-shell[data-mode="community"] .topbar,
.app-shell[data-mode="diagram"] .topbar {
  margin-bottom: 0.75rem;
  align-items: center;
}
.app-shell[data-mode="studio"] .mode-btn,
.app-shell[data-mode="studio"] .lang-btn,
.app-shell[data-mode="community"] .mode-btn,
.app-shell[data-mode="community"] .lang-btn,
.app-shell[data-mode="diagram"] .mode-btn,
.app-shell[data-mode="diagram"] .lang-btn {
  min-height: 34px;
  min-width: 0;
  padding: 0.28rem 0.7rem;
  font-size: 0.85rem;
}
.tagline { margin: 0.15rem 0 0; color: var(--muted); letter-spacing: 0.02em; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.admin-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.admin-link:hover { color: var(--accent); }

.mode-toggle, .lang-switch, .view-toggle {
  display: inline-flex; border: 1px solid var(--panel-border); border-radius: 999px; overflow: hidden;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mode-btn, .lang-btn, .view-btn {
  border: 0; background: transparent; color: var(--muted); padding: 0.45rem 0.9rem; cursor: pointer; font: inherit;
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-actions button, .view-toggle button, .mode-toggle button, .lang-switch button {
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mode-btn.is-active, .lang-btn.is-active, .view-btn.is-active {
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}

.panel {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 1rem; padding: 1rem 1.1rem;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}
.panel-head h2, .panel-head h3 { margin: 0; font-family: var(--font-display); color: #0f172a; }
.panel-head p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.92rem; }
.panel-head.row { display: flex; justify-content: space-between; gap: 0.75rem 1rem; align-items: flex-start; flex-wrap: wrap; }
.panel-head-copy { min-width: 0; flex: 1 1 14rem; }
.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  max-width: 100%;
}
.panel-head-actions.form-actions { margin-top: 0; }
.panel-head-actions.view-toggle { flex-wrap: nowrap; }
.play-left-head {
  align-items: flex-start;
  gap: 0.65rem;
}
.play-left-titles { min-width: 0; flex: 1; }
.reset-inline {
  flex-shrink: 0;
  margin-top: 0;
  opacity: 0.72;
  font-size: 0.82rem;
  min-height: 2rem;
  min-width: auto;
  padding: 0.3rem 0.65rem;
}
.reset-inline:hover { opacity: 1; }

/* Completion progress — top of #play-left */
.play-progress {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  background: var(--surface-muted);
  border: 1px solid var(--panel-border);
  animation: stageEnter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.play-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.play-progress-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}
.play-progress-pct {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.play-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.play-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.play-progress.is-complete .play-progress-fill {
  background: linear-gradient(90deg, #059669, #10b981);
}
.play-progress.is-complete .play-progress-label {
  color: var(--accent-text);
}

/* First-visit onboarding banner */
.stage-onboard {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(14, 165, 233, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.12);
  animation: stageEnter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stage-onboard.hidden { display: none !important; }
.stage-onboard-text {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.4;
  color: #064e3b;
}
.stage-onboard-dismiss {
  flex-shrink: 0;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: #fff;
  color: var(--accent-text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: transform var(--motion), background var(--motion);
}
.stage-onboard-dismiss:hover {
  transform: translateY(-2px);
  background: #ecfdf5;
}

/* Stage entrance transitions */
@keyframes stageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
#archetype-stage.is-entering,
#candidate-grid.is-entering,
#flowchart.is-entering {
  animation: stageEnter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
#archetype-stage.is-entering > * {
  animation: stageEnter 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
#archetype-stage.is-entering > *:nth-child(1) { animation-delay: 40ms; }
#archetype-stage.is-entering > *:nth-child(2) { animation-delay: 80ms; }
#archetype-stage.is-entering > *:nth-child(3) { animation-delay: 120ms; }

/* Student Play: hide research jargon — plain classroom names only */
.app-shell[data-mode="play"] .jargon-badge,
.app-shell[data-mode="play"] .sample-jargon {
  display: none !important;
}

/* Active dichotomous test — prominent step at top of left panel */
.active-test-step {
  margin: 0 0 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.1);
  animation: stageEnter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.active-test-step.hidden { display: none !important; }
.active-test-step.is-done {
  background: #f8fafc;
  border-color: var(--panel-border);
  box-shadow: none;
}
.active-test-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 0.4rem;
}
.active-test-q {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.4;
  color: #0f172a;
  margin: 0 0 0.7rem;
}
.active-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.active-test-actions .btn {
  min-width: 5.5rem;
}
.clue.is-active-test {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
  background: #ecfdf5;
}

.activity-tabs {
  display: inline-flex;
  gap: 0.25rem;
  margin: 0.55rem 0 0.65rem;
  padding: 0.2rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--surface);
}
.activity-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  min-height: 40px;
}
.activity-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.activity-pane { min-height: 0; }
.activity-pane.hidden { display: none !important; }

.play-layout {
  display: grid;
  grid-template-columns: minmax(200px, 248px) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 72vh;
  align-items: stretch;
  width: 100%;
}
.play-stage {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* Play mode: use more of the viewport for the interaction stage */
.app-shell[data-mode="play"] {
  max-width: min(1680px, 100%);
  padding-left: 1rem;
  padding-right: 1rem;
}
.app-shell[data-mode="play"] .sample-gallery {
  max-width: none;
}
.panel.investigation {
  padding: 0.7rem 0.75rem;
  min-width: 0;
}
.panel.investigation .panel-head h2 {
  font-size: 1.05rem;
}
.panel.investigation .panel-head p {
  font-size: 0.8rem;
  margin-top: 0.2rem;
  line-height: 1.35;
}
.panel.investigation .scoreboard {
  margin: 0.55rem 0;
  gap: 0.35rem;
}
.panel.investigation .score-card {
  padding: 0.4rem 0.45rem;
}
.panel.investigation .score-card .value {
  font-size: 0.98rem;
}
.panel.investigation .clue-list {
  max-height: 36vh;
}
.panel.candidates-panel {
  min-width: 0;
  padding: 0.85rem 1rem 1.1rem;
}
.studio-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .play-layout, .studio-layout { grid-template-columns: 1fr; }
}

.scoreboard {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.9rem 0;
}
.score-card {
  background: var(--surface-muted); border: 1px solid var(--panel-border); border-radius: 0.75rem; padding: 0.55rem 0.65rem;
}
.score-card .label { color: var(--muted); font-size: 0.75rem; }
.score-card .value { font-weight: 700; font-size: 1.1rem; margin-top: 0.15rem; color: #0f172a; }
.score-card.win { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); background: #ecfdf5; }

.clue-list { display: flex; flex-direction: column; gap: 0.55rem; max-height: 42vh; overflow: auto; }
.clue {
  border: 1px solid var(--panel-border); border-radius: 0.8rem; padding: 0.7rem; background: var(--surface);
}
.clue.is-used { opacity: 0.55; }
.clue-q { font-size: 0.95rem; margin-bottom: 0.55rem; }
.clue-actions { display: flex; gap: 0.4rem; }
.btn {
  border: 1px solid var(--panel-border); background: var(--surface); color: var(--fg); border-radius: 0.65rem;
  padding: 0.5rem 0.85rem; cursor: pointer; font: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn:hover { border-color: #94a3b8; background: var(--surface-muted); }
.btn.primary {
  background: linear-gradient(180deg, #10b981, #059669); border-color: transparent; color: #fff; font-weight: 700;
}
.btn.primary:hover { filter: brightness(1.03); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.yes { background: var(--accent-soft); border-color: #34d399; color: var(--accent-text); }
.btn.no { background: var(--danger-soft); border-color: #fb7185; color: #be123c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.observation-log {
  min-height: 120px; max-height: 42vh; overflow: auto; margin: 0;
  display: flex; flex-direction: column; gap: 0.45rem;
  scroll-behavior: smooth; padding-right: 0.15rem;
}
.log-empty { color: var(--muted); font-size: 0.9rem; }
.log-item {
  border-left: 3px solid var(--accent); padding: 0.55rem 0.7rem; background: #ecfdf5;
  border-radius: 0 0.65rem 0.65rem 0; font-size: 0.9rem;
  box-shadow: 0 1px 0 rgba(16, 185, 129, 0.12);
  animation: logIn 220ms ease-out;
}
@keyframes logIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.log-item .meta { color: var(--accent-text); font-size: 0.75rem; margin-bottom: 0.25rem; font-weight: 700; }

.candidate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; margin-top: 0.9rem;
}
.candidate-card, .sample-card {
  position: relative; border: 1px solid rgba(226, 232, 240, 0.9); border-radius: 0.9rem; padding: 0.9rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  min-height: 120px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.28s ease, filter 0.28s ease;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  touch-action: pan-y;
  -webkit-user-drag: none;
  user-select: none;
}
.sample-card {
  touch-action: manipulation;
}
.candidate-card:hover, .sample-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.18);
}
.candidate-card .cat { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.candidate-card .name { font-weight: 700; margin: 0.35rem 0; font-family: var(--font-display); }
.candidate-card .detail { color: #334155; font-size: 0.95rem; }
.candidate-card.eliminated, .candidate-card.is-eliminated {
  opacity: 0.35;
  filter: grayscale(0.8);
  transform: scale(0.96);
  background: linear-gradient(135deg, #f8fafc, rgba(244, 63, 94, 0.1));
  border-color: #fecdd3;
  pointer-events: none;
}
.candidate-card.eliminated .name, .candidate-card.is-eliminated .name {
  text-decoration: line-through;
  text-decoration-color: #e11d48;
  text-decoration-thickness: 2px;
  color: #94a3b8;
}
.candidate-card.eliminated::before, .candidate-card.is-eliminated::before {
  content: "";
  position: absolute; left: 10%; right: 10%; top: 52%;
  height: 2px; background: rgba(225, 29, 72, 0.55);
  transform: rotate(-8deg);
  pointer-events: none;
}
.candidate-card.eliminated::after, .candidate-card.is-eliminated::after {
  content: "✕"; position: absolute; inset: auto 0.7rem 0.55rem auto; color: var(--danger); font-size: 1.4rem; font-weight: 800;
}
.candidate-card.winner {
  border-color: var(--accent); background: rgba(236, 253, 245, 0.92);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
  animation: emeraldPulse 1.4s ease-in-out infinite alternate;
}
.candidate-card.just-eliminated {
  animation: eliminateRedFade 0.85s ease-out forwards;
}
@keyframes eliminateRedFade {
  0% {
    opacity: 1;
    filter: none;
    transform: scale(1);
    background: rgba(225, 29, 72, 0.42);
    border-color: #e11d48;
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.35);
  }
  55% {
    opacity: 0.7;
    background: rgba(225, 29, 72, 0.22);
    border-color: #fb7185;
  }
  100% {
    opacity: 0.35;
    filter: grayscale(0.8);
    transform: scale(0.96);
    background: linear-gradient(135deg, #f8fafc, rgba(244, 63, 94, 0.1));
    border-color: #fecdd3;
    box-shadow: none;
  }
}

/* Drag / drop touch safety — prevents iOS/Android scroll stealing gestures */
.sample-card, .candidate-card, .draggable-tile,
.venn-chip, .sort-card, .spectrum-tile, .action-chip, .nest-chip,
.logic-tile, .mind-node, .bin-drop, .item-pool, .venn-pool,
.venn-circle, .venn-intersection, .action-drop, .nest-drop, .spectrum-track {
  touch-action: none;
  -webkit-user-drag: none;
}
.candidate-card.is-selected, .is-selected.logic-tile {
  outline: 2px solid var(--accent); outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-md);
}

@keyframes emeraldPulse {
  from { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm); }
  to { box-shadow: 0 0 0 6px var(--accent-glow), var(--shadow-md); }
}
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
}
@keyframes flowDash {
  to { stroke-dashoffset: -24; }
}
.animate-shake { animation: shakeX 300ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.logic-tile {
  transition: transform var(--motion), box-shadow var(--motion), opacity var(--motion), border-color var(--motion);
}
.logic-tile.dragging {
  opacity: 0.72; transform: scale(1.05); box-shadow: var(--shadow-drag); cursor: grabbing; z-index: 5;
}
.logic-tile.locked {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.45), var(--shadow-md);
  animation: emeraldPulse 0.85s ease-out 1;
}
.combo-chip {
  align-self: end; padding: 0.45rem 0.75rem; border-radius: 999px;
  background: #f1f5f9; border: 1px solid #e2e8f0; color: var(--muted); font-size: 0.85rem;
}
.combo-chip.on {
  background: #ecfdf5; border-color: #6ee7b7; color: #047857; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.drop-target-hot {
  outline: 2px solid var(--accent); outline-offset: 2px;
  box-shadow: inset 0 0 0 2px var(--accent-soft), 0 0 24px var(--accent-glow);
  transform: scale(1.02);
  transition: transform var(--motion), box-shadow var(--motion);
}

/* Classic flowchart shapes (diagrams.net-style, simplified) */
.flowchart {
  position: relative;
  margin-top: 0.9rem;
  min-height: 420px;
  border: 1px solid #cbd5e1;
  border-radius: 0.9rem;
  background: #f8fafc;
  overflow: auto;
}
.flow-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
}
.flow-wrap > .flow-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.flow-begin-btn { flex-shrink: 0; }
.flow-coach-msg {
  margin: 0;
  flex: 1;
  min-width: 14rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
}
.flow-prog-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

/* Shape legend */
.flow-shape-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  padding: 0.35rem 0.15rem;
  font-size: 0.78rem;
  color: #475569;
  font-weight: 600;
}
.flow-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.flow-leg-swatch {
  display: inline-block;
  width: 1.35rem;
  height: 0.85rem;
  border: 2px solid #64748b;
  background: #fff;
  flex-shrink: 0;
}
.flow-leg-oval { border-radius: 999px; border-color: #0284c7; background: #e0f2fe; }
.flow-leg-rect { border-radius: 0.2rem; border-color: #475569; background: #f1f5f9; }
.flow-leg-diamond {
  width: 0.85rem;
  height: 0.85rem;
  transform: rotate(45deg);
  border-color: #7c3aed;
  background: #f3e8ff;
}
.flow-leg-para {
  transform: skewX(-18deg);
  border-color: #047857;
  background: #d1fae5;
}
.flow-leg-arrow {
  width: 1.4rem;
  height: 0;
  border: 0;
  border-top: 2px solid #334155;
  position: relative;
  background: transparent;
}
.flow-leg-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  border: 4px solid transparent;
  border-left: 6px solid #334155;
}

.flow-board {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(180px, 0.65fr);
  gap: 0.85rem;
  align-items: start;
}
@media (max-width: 860px) {
  .flow-board { grid-template-columns: 1fr; }
}

.flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 1rem 0.5rem 1.25rem;
  min-width: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.35) 1px, transparent 0);
  background-size: 16px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
}

.flow-shape-kind {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

/* Oval — Terminator */
.flow-oval {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  max-width: 14rem;
  padding: 0.65rem 1.6rem;
  border-radius: 999px;
  border: 2.5px solid #0284c7;
  background: #e0f2fe;
  text-align: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.flow-oval-start { border-color: #0284c7; }
.flow-oval-end { border-color: #0f766e; background: #ccfbf1; }
.flow-oval-text {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f172a;
}

/* Rectangle — Process */
.flow-rect {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 8rem;
  max-width: min(22rem, 92%);
  padding: 0.55rem 1rem;
  border-radius: 0.25rem;
  border: 2.5px solid #475569;
  background: #f8fafc;
  text-align: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.flow-rect .flow-shape-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: #334155;
}

/* Diamond — Decision (readable box with diamond silhouette) */
.flow-diamond {
  position: relative;
  display: block;
  width: min(28rem, 94%);
  margin: 0.35rem 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
}
.flow-diamond-box {
  position: relative;
  display: block;
  padding: 1.15rem 1.5rem;
  background: #faf5ff;
  border: 2.5px solid #7c3aed;
  /* True rhombus decision diamond (flowchart convention) */
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}
.flow-diamond.is-selected .flow-diamond-box {
  background: #f3e8ff;
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.28);
}
.flow-diamond.is-locked { opacity: 0.55; cursor: not-allowed; }
.flow-diamond-text {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #0f172a;
  overflow-wrap: anywhere;
  padding: 0 0.75rem;
}
.flow-selected-tag {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #047857;
}

/* Parallelogram — Input/Output (Yes outcomes) */
.flow-para {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 7rem;
  max-width: 14rem;
  padding: 0.55rem 1.1rem 0.55rem 1.35rem;
  border: 2.5px solid #047857;
  background: #ecfdf5;
  transform: skewX(-12deg);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.flow-para > * { transform: skewX(12deg); }
.flow-para-empty {
  cursor: default;
  opacity: 0.75;
  border-style: dashed;
  color: #64748b;
  font-size: 0.82rem;
  font-style: italic;
}
.flow-para.is-ok { border-color: #059669; background: #d1fae5; }
.flow-para.is-bad { border-color: #e11d48; background: #ffe4e6; }
.flow-para .detail { font-size: 0.75rem; color: #64748b; }
.flow-chip-x { align-self: flex-end; color: #94a3b8; font-size: 0.75rem; }

/* Flowlines / Arrows */
.flow-flowline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 1.6rem;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.flow-flowline-down .flow-arrow-shaft {
  display: block;
  width: 2.5px;
  height: 18px;
  background: #334155;
  border-radius: 2px;
}
.flow-flowline-down .flow-arrow-head {
  display: block;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #334155;
}
.flow-flowline-yes,
.flow-flowline-no {
  flex-direction: row;
  gap: 0.35rem;
  min-height: 1.25rem;
}
.flow-flowline-yes .flow-arrow-shaft,
.flow-flowline-no .flow-arrow-shaft {
  display: block;
  height: 2.5px;
  width: 28px;
  background: currentColor;
  border-radius: 2px;
}
.flow-flowline-yes .flow-arrow-head,
.flow-flowline-no .flow-arrow-head {
  display: block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}
.flow-flowline-yes { color: #047857; }
.flow-flowline-no { color: #be123c; }
.flow-arrow-label { font-size: 0.72rem; }

.flow-branch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: min(36rem, 96%);
  margin: 0.35rem 0 0.15rem;
  align-items: start;
}
.flow-yes-col,
.flow-no-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.35rem;
  border-radius: 0.65rem;
}
.flow-yes-col.is-active {
  background: rgba(16, 185, 129, 0.1);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.35);
}
.flow-outcomes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
}
.flow-no-note {
  font-size: 0.8rem;
  font-weight: 600;
  color: #be123c;
  text-align: center;
}

.flow-palette {
  position: sticky;
  top: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  min-width: 0;
}
.flow-palette-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-family: var(--font-display);
}
.flow-palette-hint { margin: 0 0 0.55rem; font-size: 0.8rem; }
.flow-palette-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(60vh, 520px);
  overflow: auto;
}
.flow-palette-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.flow-palette-chip:hover:not(:disabled) {
  border-color: #34d399;
  background: #ecfdf5;
}
.flow-palette-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.flow-palette-chip.is-assigned {
  border-color: #059669;
  background: #d1fae5;
}
.flow-palette-chip .name { font-weight: 700; font-size: 0.88rem; }
.flow-palette-chip .detail { font-size: 0.78rem; color: #64748b; }

.flow-edge-tools { margin-top: 0.1rem; }
.flow-edge-tools .edge-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.flow-link-chip,
.flow-edge-tools .edge-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
}
.flow-link-chip.is-ok { border-color: #6ee7b7; background: #ecfdf5; }
.flow-link-chip.is-bad { border-color: #fda4af; background: #fff1f2; }
.flow-empty { width: 100%; border-style: dashed; }

@media (max-width: 700px) {
  .flow-branch-row { grid-template-columns: 1fr; width: 100%; }
  .flow-palette { position: static; }
  .flow-diamond-box {
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  }
}

.studio-form label, .editor-panel label, .admin-login label {
  display: flex; flex-direction: column; gap: 0.35rem; margin: 0.75rem 0; font-size: 0.9rem; color: var(--muted);
}
input, textarea, select {
  background: var(--surface); border: 1px solid #cbd5e1; border-radius: 0.65rem; color: var(--fg);
  padding: 0.55rem 0.7rem; font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(16, 185, 129, 0.35); border-color: #34d399;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.template-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }
.chip {
  border: 1px solid #cbd5e1; background: var(--surface); color: #334155; border-radius: 999px;
  padding: 0.3rem 0.7rem; cursor: pointer; font-size: 0.8rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.status { min-height: 1.2rem; color: var(--accent-text); font-size: 0.9rem; }
.status.error { color: #be123c; }

.answer-check-panel {
  margin-top: 0.85rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid var(--panel-border, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.answer-check-title,
.explain-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: #0f172a;
}
.explain-heading { margin-top: 0.25rem; }
.answer-check-panel:has(.why-list:not(:empty)) .explain-empty-hint { display: none; }
.dichotomous-guess-row {
  align-items: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.dichotomous-guess-row .grow { flex: 1 1 12rem; }
.dichotomous-guess-row .btn { align-self: flex-end; }
.hint { color: var(--muted); font-size: 0.82rem; }
.banner.error { background: var(--danger-soft); border: 1px solid #fb7185; color: #9f1239; padding: 0.7rem 1rem; border-radius: 0.75rem; margin-bottom: 1rem; }

.editor-block {
  border: 1px solid var(--panel-border); border-radius: 0.8rem; padding: 0.75rem; margin: 0.7rem 0; background: var(--surface-muted);
}
.editor-block h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: #0f172a; }
.elim-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.elim-chip {
  border: 1px solid #cbd5e1; border-radius: 999px; padding: 0.2rem 0.55rem; font-size: 0.75rem; cursor: pointer;
  background: var(--surface); color: var(--muted);
}
.elim-chip.on { background: var(--accent-soft); color: var(--accent-text); border-color: #34d399; }

.label-with-link {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
  flex-wrap: wrap;
}
.text-link {
  border: 0; background: transparent; color: var(--accent-text); cursor: pointer;
  font: inherit; font-size: 0.82rem; text-decoration: underline; padding: 0;
  flex-shrink: 0;
}
.text-link:hover { color: #047857; }
.share-modal::backdrop { background: rgba(15, 23, 42, 0.35); }
dialog.archetype-help-modal {
  max-width: 96vw;
  width: fit-content;
  border: 0;
  padding: 0;
  background: transparent;
}
.share-card {
  background: #fff; color: var(--fg); border: 1px solid var(--panel-border); border-radius: 1rem; padding: 1.2rem;
  width: min(420px, 92vw); display: flex; flex-direction: column; gap: 0.75rem; align-items: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

/* Must follow .share-card so width override wins (both classes are on the same node) */
.share-card.archetype-help-card {
  width: fit-content;
  max-width: min(1200px, 96vw);
  min-width: min(960px, 96vw);
  align-items: stretch;
  max-height: min(90vh, 920px);
  overflow: auto;
  padding: 1.35rem 1.5rem;
}
.archetype-help-card h2 { margin: 0; font-family: var(--font-display); }
.archetype-table-wrap {
  margin: 0.5rem 0 0.75rem;
  overflow-x: auto;
  width: 100%;
}
.archetype-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: auto;
}
.archetype-table th, .archetype-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  line-height: 1.4;
  white-space: normal;
}
.archetype-table th:nth-child(1),
.archetype-table td:nth-child(1) { min-width: 11rem; }
.archetype-table th:nth-child(2),
.archetype-table td:nth-child(2) { min-width: 14rem; }
.archetype-table th:nth-child(3),
.archetype-table td:nth-child(3) { min-width: 12rem; }
.archetype-table th:nth-child(4),
.archetype-table td:nth-child(4) { min-width: 14rem; }
.archetype-table th { color: var(--muted); font-weight: 600; background: #f8fafc; position: sticky; top: 0; }
.archetype-table tr:hover td { background: #f0fdf4; }
.archetype-help-card form { display: flex; justify-content: flex-end; margin-top: 0.35rem; }
.share-link-row { display: flex; gap: 0.4rem; width: 100%; }
.share-link-row input { flex: 1; }

.admin-tabs {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 1rem;
}
.tab-btn {
  border: 1px solid var(--panel-border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer; font: inherit;
}
.tab-btn.is-active { background: var(--accent-soft); color: var(--accent-text); border-color: #6ee7b7; font-weight: 600; }
.tab-panel { display: block; }
.hidden-role { display: none !important; }
.crud-form { margin: 0.75rem 0 1rem; padding: 0.85rem; border: 1px solid var(--panel-border); border-radius: 0.85rem; background: var(--surface-muted); }
.stats-row { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.admin-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.admin-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
@media (max-width: 960px) {
  .admin-grid, .stats-row { grid-template-columns: 1fr; }
}
.table-wrap { overflow: auto; margin-top: 0.6rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.inline-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.inline-form input { flex: 1; }

/* Compact admin: vertical expandable nav */
.admin-dashboard {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}
.admin-sidebar {
  position: sticky;
  top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: var(--shadow-sm);
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
}
.admin-nav .tab-btn {
  width: 100%;
  justify-content: flex-start;
  border-radius: 8px;
  padding: 0.38rem 0.55rem;
  min-height: 0;
  min-width: 0;
  text-align: left;
  font-size: 0.84rem;
  border: 0;
  background: transparent;
}
.admin-nav .tab-btn:hover { background: #f1f5f9; color: var(--fg); }
.admin-nav .tab-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 0;
}
.admin-nav-group {
  border: 0;
  margin: 0.15rem 0;
  padding: 0;
}
.admin-nav-group > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.35rem 0.5rem 0.2rem;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.admin-nav-group > summary::-webkit-details-marker { display: none; }
.admin-nav-group > summary::after {
  content: "▾";
  opacity: 0.7;
  flex-shrink: 0;
}
.admin-nav-group:not([open]) > summary::after { content: "▸"; }
.admin-nav-group .tab-btn { padding-left: 0.75rem; }
.admin-content { min-width: 0; }
.admin-page-title {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
  font-family: var(--font-display);
}
.admin-toolbar.compact { margin: 0 0 0.35rem; }
.admin-me-inline { font-size: 0.8rem; margin-right: 0.35rem; }
.admin-shell--app .panel {
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
}
.admin-shell--app .panel h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.admin-shell--app .crud-form {
  margin: 0.4rem 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
}
.admin-shell--app .form-row { gap: 0.45rem; }
.admin-shell--app label { font-size: 0.82rem; gap: 0.2rem; }
.admin-shell--app input,
.admin-shell--app select,
.admin-shell--app textarea {
  padding: 0.35rem 0.45rem;
  font-size: 0.86rem;
}
.admin-shell--app .stats-row.compact {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.admin-shell--app .score-card { padding: 0.45rem 0.55rem; }
.admin-shell--app .score-card .label { font-size: 0.68rem; }
.admin-shell--app .score-card .value { font-size: 1.15rem; }
.admin-shell--app th, .admin-shell--app td { padding: 0.3rem 0.28rem; font-size: 0.8rem; }
.admin-shell--app .hint { font-size: 0.78rem; margin: 0.2rem 0; }

/* Curriculum RAG form alignment */
.curriculum-form .curriculum-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.85rem;
  align-items: start;
}
.curriculum-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0;
  min-width: 0;
}
.curriculum-form .field-span-2 {
  grid-column: 1 / -1;
}
.curriculum-form .field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
}
.curriculum-form .field-hint {
  font-weight: 500;
  opacity: 0.85;
}
.curriculum-form .field input,
.curriculum-form .field select,
.curriculum-form .field textarea {
  width: 100%;
  min-height: 2.15rem;
  margin: 0;
  box-sizing: border-box;
}
.curriculum-form .field textarea {
  min-height: 5.5rem;
  resize: vertical;
}
.curriculum-form .field input[type="file"] {
  min-height: 0;
  padding: 0.35rem 0;
}
.curriculum-form-subtitle {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}
.curriculum-form .form-actions {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--panel-border);
}
@media (max-width: 700px) {
  .curriculum-form .curriculum-fields {
    grid-template-columns: 1fr;
  }
  .curriculum-form .field-span-2 {
    grid-column: auto;
  }
}

/* Admin list pattern: table + checkboxes + batch bar + modal */
.list-panel { padding-top: 0.55rem; }
.list-hint { margin: 0 0 0.55rem; }
.list-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.list-toolbar-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  flex: 0 1 auto;
  padding-top: 0.35rem;
}
.list-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-left: auto;
  max-width: 100%;
}
.list-toolbar-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.data-table .col-check {
  width: 2rem;
  text-align: center;
  vertical-align: middle;
}
.data-table .col-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.data-table .col-actions {
  white-space: normal;
  text-align: right;
  min-width: 6.5rem;
}
.data-table .col-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.12rem 0 0.12rem 0.2rem;
  vertical-align: middle;
}
.list-panel .table-wrap { margin-top: 0.25rem; }

dialog.admin-modal {
  border: 0;
  padding: 0;
  border-radius: 12px;
  max-width: min(640px, calc(100vw - 1.5rem));
  width: 100%;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  background: var(--surface);
  color: var(--fg);
}
dialog.admin-modal::backdrop {
  background: rgba(15, 23, 42, 0.4);
}
.admin-modal-inner { display: flex; flex-direction: column; max-height: min(90vh, 820px); }
.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--panel-border);
}
.admin-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display);
}
.admin-modal-body {
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
}
.admin-modal .modal-form {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.admin-modal .modal-form.hidden { display: none; }
.admin-modal .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--panel-border);
}

@media (max-width: 860px) {
  .admin-dashboard { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-nav-group { width: 100%; }
}

/* Compact teacher studio */
.app-shell[data-mode="studio"] .studio-layout {
  display: grid;
  gap: 0.75rem;
}
.app-shell[data-mode="studio"] .studio-form .panel-head h2,
.app-shell[data-mode="studio"] .editor-panel .panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.app-shell[data-mode="studio"] .studio-form .panel-head p,
.app-shell[data-mode="studio"] .editor-panel .panel-head p {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
}
.app-shell[data-mode="studio"] .studio-form label,
.app-shell[data-mode="studio"] .editor-panel label {
  margin-bottom: 0.45rem;
  font-size: 0.84rem;
}
.app-shell[data-mode="studio"] textarea#notes-input { min-height: 7.5rem; }
.app-shell[data-mode="studio"] .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem;
  align-items: start;
}
.app-shell[data-mode="studio"] .form-actions { gap: 0.4rem; margin-top: 0.45rem; }
.app-shell[data-mode="studio"] .archetype-picker { gap: 0.35rem; }
.app-shell[data-mode="studio"] .wizard-extract-panel {
  margin: 0.55rem 0;
  padding: 0.65rem;
}
.app-shell[data-mode="studio"] .wizard-grid { gap: 0.5rem; }
.app-shell[data-mode="community"] .panel { padding: 0.75rem 0.9rem; }

@media (max-width: 960px) {
  .admin-grid, .stats-row { grid-template-columns: 1fr; }
}
.table-wrap { overflow: auto; margin-top: 0.6rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.inline-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.inline-form input { flex: 1; }

canvas { pointer-events: none; }
#qr-canvas { pointer-events: none; background: #fff; border-radius: 0.5rem; padding: 0.5rem; }
.formula-text .katex { font-size: 1em; color: inherit; }
/* Dark stage shells: keep chem/math readable */
.spectrum-container .katex,
.causal-network-stage .katex,
.concept-map-container .katex,
.mindmap-stage .katex,
.venn-canvas .katex,
.bin-stage .katex,
.nest-stage .katex,
.transform-lab .katex {
  color: inherit;
}
.misconception-toast .katex { font-size: 0.95em; color: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* Wave A: Spectrum + Rule/Exception */
.archetype-stage { margin-top: 0.9rem; }
.archetype-instructions { margin: 0.75rem 0; color: var(--muted); font-size: 0.92rem; }
.btn.tiny { padding: 0.15rem 0.45rem; font-size: 0.75rem; }

/* Shared sleek stage shells — soft translucent borders + elevation */
#archetype-stage .spectrum-container,
#archetype-stage .bin-stage,
#archetype-stage .causal-network-stage,
#archetype-stage .nest-stage,
#archetype-stage .venn-canvas,
#archetype-stage .process-stage,
#archetype-stage .concept-map-container,
#archetype-stage .concept-canvas-container,
#archetype-stage .mindmap-stage,
.process-stage,
.concept-map-container,
.concept-canvas-container {
  border: var(--stage-border);
  box-shadow: var(--stage-elev);
}

/* Spacious touch-friendly cards & drop zones inside stages */
#archetype-stage .spectrum-tile:not(.element-chip),
#archetype-stage .sort-card,
#archetype-stage .pipeline-step,
#archetype-stage .sort-bin,
#archetype-stage .bin-drop,
#archetype-stage .item-pool,
#archetype-stage .nest-box,
#archetype-stage .nest-drop,
#archetype-stage .nest-chip,
#archetype-stage .nest-leaf,
#archetype-stage .action-chip,
#archetype-stage .transform-slot,
#archetype-stage .baseline-card,
#archetype-stage .action-drop,
#archetype-stage .action-palette,
#archetype-stage .sim-slider-card,
#archetype-stage .venn-chip,
#archetype-stage .causal-node,
.process-stage .action-chip,
.process-stage .transform-slot,
.process-stage .baseline-card,
.process-stage .action-drop,
.process-stage .action-palette {
  padding: var(--card-pad);
}

/* Hover lift + grab cues for actionable / draggable stage items */
#archetype-stage .spectrum-tile,
#archetype-stage .sort-card,
#archetype-stage .pipeline-step,
#archetype-stage .nest-chip,
#archetype-stage .nest-leaf,
#archetype-stage .action-chip,
#archetype-stage .venn-chip,
#archetype-stage .causal-node,
.process-stage .action-chip,
.concept-map-wrapper .concept-node,
.concept-canvas-container .concept-node {
  cursor: grab;
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion), background var(--motion), opacity var(--motion);
}
#archetype-stage .btn:not(:disabled),
.process-stage .btn:not(:disabled) {
  cursor: pointer;
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion), background var(--motion), opacity var(--motion), filter var(--motion);
}
#archetype-stage .spectrum-tile:hover,
#archetype-stage .sort-card:hover,
#archetype-stage .pipeline-step:hover,
#archetype-stage .nest-chip:hover,
#archetype-stage .nest-leaf:hover,
#archetype-stage .action-chip:hover,
#archetype-stage .causal-node:hover,
#archetype-stage .btn:not(:disabled):hover,
.process-stage .action-chip:hover,
.process-stage .btn:not(:disabled):hover,
.concept-map-wrapper .concept-node:hover {
  transform: translateY(-2px);
}
#archetype-stage .venn-chip:hover {
  transform: translateY(-2px) scale(1.03);
}
#archetype-stage .venn-chip:active,
#archetype-stage .venn-chip.dragging {
  cursor: grabbing;
  transform: scale(0.94);
}
#archetype-stage .venn-chip.locked:hover,
#archetype-stage .venn-chip.is-correct:hover {
  transform: none;
}
#archetype-stage .spectrum-tile:active,
#archetype-stage .sort-card:active,
#archetype-stage .pipeline-step:active,
#archetype-stage .nest-chip:active,
#archetype-stage .nest-leaf:active,
#archetype-stage .action-chip:active,
#archetype-stage .venn-chip:active,
#archetype-stage .causal-node:active,
.process-stage .action-chip:active,
.concept-map-wrapper .concept-node:active,
.concept-map-wrapper .concept-node.dragging,
#archetype-stage .spectrum-tile.dragging,
#archetype-stage .sort-card.dragging,
#archetype-stage .pipeline-step.dragging,
#archetype-stage .action-chip.dragging,
#archetype-stage .logic-tile.dragging {
  cursor: grabbing;
}
#archetype-stage .sort-card.locked,
#archetype-stage .spectrum-tile.locked,
#archetype-stage .nest-chip.locked,
#archetype-stage .venn-chip.locked,
#archetype-stage .btn:disabled {
  cursor: default;
}
#archetype-stage .sort-card.locked:hover,
#archetype-stage .spectrum-tile.locked:hover,
#archetype-stage .nest-chip.locked:hover,
#archetype-stage .venn-chip.locked:hover,
#archetype-stage .btn:disabled:hover {
  transform: none;
}

/* Spectrum — element pool + discrete snap slots on gradient rail */
.spectrum-wrap,
.spectrum-stage-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.spectrum-wrap.spectrum-full { max-width: 1100px; width: 100%; }
.spectrum-label {
  margin: 0;
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem;
  color: #0f172a;
}

.spectrum-pool-panel {
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}
.spectrum-pool-panel .pool-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.spectrum-pool-panel .pool-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
}
.spectrum-pool-panel .pool-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}
.chip-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  min-height: 4.5rem;
  padding: 0.75rem;
  border-radius: 0.85rem;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  background: rgba(241, 245, 249, 0.7);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.chip-pool.drag-over {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}
.pool-empty { width: 100%; }

.element-chip,
.spectrum-tile.element-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  box-sizing: border-box;
  width: auto;
  min-width: 3.75rem;
  max-width: 6.75rem;
  min-height: 4.1rem;
  height: auto;
  padding: 0.4rem 0.45rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.75rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}
.chip-pool .element-chip:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  border-color: rgba(56, 189, 248, 0.45);
}
.element-chip:active,
.element-chip.dragging {
  cursor: grabbing;
  transform: scale(0.96);
  opacity: 0.92;
  z-index: 4;
}
.element-num {
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1;
  flex-shrink: 0;
}
.element-symbol {
  display: block;
  width: 100%;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0284c7;
  font-family: var(--font-display, Georgia, serif);
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.element-oxide {
  display: block;
  width: 100%;
  font-size: 0.58rem;
  color: #64748b;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.element-chip .katex,
.element-oxide .katex,
.element-symbol .katex {
  font-size: 0.85em !important;
  max-width: none;
  display: inline-block;
}
.element-chip .katex-display {
  margin: 0 !important;
  overflow-x: visible;
  overflow-y: hidden;
  max-width: none;
}
/* Keep chemical formulas intact; do not wrap letter-by-letter */
.element-chip .base,
.element-chip .mord,
.element-chip .katex-html {
  white-space: nowrap !important;
}
.element-chip.correct,
.element-chip.is-exact,
.element-chip.locked {
  border-color: #6ee7b7;
  background: rgba(209, 250, 229, 0.95);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.28);
  cursor: default;
}
.element-chip.correct:hover,
.element-chip.locked:hover { transform: none; }
.element-chip.near,
.element-chip.is-near {
  border-color: #fcd34d;
  background: rgba(254, 243, 199, 0.95);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.28);
}
.element-chip.incorrect,
.element-chip.is-far {
  border-color: #fca5a5;
  background: rgba(254, 226, 226, 0.95);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.22);
}
.element-chip.shake {
  animation: spectrumShake 0.45s ease;
}
@keyframes spectrumShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.spectrum-toolbar {
  display: flex;
  justify-content: flex-end;
}
.spectrum-trend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.spectrum-trend-toggle input { accent-color: #0284c7; }

.spectrum-rail-container {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1rem;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.axis-endpoint {
  display: flex;
  flex-direction: column;
  width: 7.5rem;
  flex-shrink: 0;
  text-align: center;
  gap: 0.3rem;
}
.endpoint-badge {
  display: inline-block;
  padding: 0.35rem 0.5rem;
  border-radius: 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}
.badge-metallic {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.28);
}
.badge-acidic {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.endpoint-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  line-height: 1.3;
}

.spectrum-track-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 1.75rem 0.25rem 0.35rem;
}
.track-gradient-line {
  position: absolute;
  top: 50%;
  left: 0.35rem;
  right: 0.35rem;
  height: 10px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 32%, #f59e0b 68%, #ef4444 100%);
  border-radius: 999px;
  z-index: 1;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15);
}
.trend-guides {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 0.15rem;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
}
.trend-arrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
}
.trend-en { color: #b45309; }
.trend-radius { color: #1d4ed8; }

.track-slots-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--slot-count, 8), minmax(0, 1fr));
  gap: 0.4rem;
}
.spectrum-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.slot-number {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.slot-droparea {
  position: relative;
  width: 100%;
  max-width: 6.85rem;
  min-height: 4.5rem;
  height: auto;
  aspect-ratio: auto;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  padding-bottom: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.slot-droparea .element-chip {
  width: 100%;
  height: auto;
  min-height: 3.75rem;
  max-width: none;
  border-radius: 10px;
  box-shadow: none;
}
.slot-placeholder {
  font-size: 0.65rem;
  font-weight: 700;
  color: #cbd5e1;
  text-align: center;
  padding: 0.25rem;
  pointer-events: none;
  line-height: 1.2;
}
.spectrum-slot.drag-over .slot-droparea,
.slot-droparea.drag-over,
.spectrum-slot.is-drop-target .slot-droparea {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.spectrum-slot.correct .slot-droparea {
  border-color: #10b981;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22), 0 0 14px rgba(16, 185, 129, 0.25);
}
.spectrum-slot.near .slot-droparea {
  border-color: #f59e0b;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
.spectrum-slot.incorrect .slot-droparea {
  border-color: #ef4444;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2), 0 0 12px rgba(239, 68, 68, 0.2);
}
.spectrum-shift-hint {
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  transform: translateX(-50%);
  z-index: 3;
  white-space: nowrap;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  pointer-events: none;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
}
.spectrum-shift-hint.is-left {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.spectrum-shift-hint.is-right {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.spectrum-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.spectrum-check-btn { min-width: 11.5rem; font-weight: 700; }
.why-item.near { border-color: #fcd34d; background: #fffbeb; color: #92400e; }

@media (max-width: 900px) {
  .spectrum-rail-container {
    flex-direction: column;
    align-items: stretch;
  }
  .axis-endpoint {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    text-align: left;
  }
  .track-slots-grid {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .slot-droparea { max-width: 6.5rem; }
}

.sortbins-wrap { display: flex; flex-direction: column; gap: 0.85rem; }
.rule-banner {
  background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 0.85rem; padding: 0.8rem 1rem;
}
.rule-banner .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.bin-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  padding: 1.15rem 1.2rem;
  min-height: min(48vh, 420px);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.88));
  border-radius: 12px;
  border: var(--stage-border);
  box-shadow: var(--stage-elev);
}
.bins-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 700px) {
  .bins-row, .bin-stage { grid-template-columns: 1fr; }
}
.bin h3 { margin: 0 0 0.45rem; font-size: 0.95rem; font-family: var(--font-display); }
.sort-bin {
  min-height: 240px;
  padding: 0.85rem;
  border-radius: 12px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: var(--stage-elev);
}
.bin-rule {
  border-color: rgba(96, 165, 250, 0.55);
  background: linear-gradient(165deg, rgba(30, 58, 138, 0.35), rgba(30, 41, 59, 0.55));
}
.bin-exception {
  border-color: rgba(251, 191, 36, 0.65);
  background: linear-gradient(165deg, rgba(120, 53, 15, 0.4), rgba(30, 41, 59, 0.55));
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), var(--stage-elev);
}
.sort-bin-header {
  font-weight: 700;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-display);
}
.sort-bin-titles { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.sort-bin-eyebrow {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  opacity: 0.85;
}
.sort-bin-name { font-size: 0.95rem; line-height: 1.25; color: #f8fafc; }
.sort-bin-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.bin-rule .sort-bin-eyebrow { color: #93c5fd; }
.bin-exception .sort-bin-eyebrow { color: #fcd34d; }
.bin-exception .sort-bin-name { color: #fde68a; }

.sort-bin.is-drag-over,
.bin-drop.is-drag-over,
.item-pool.is-drag-over {
  border-style: solid;
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}
.sort-bin.drop-target-hot {
  transform: scale(1.01);
}
.bin-drop, .item-pool {
  min-height: 140px; border: 1.5px dashed rgba(148, 163, 184, 0.35); border-radius: 0.85rem; padding: var(--card-pad);
  display: flex; flex-wrap: wrap; gap: 0.55rem; align-content: flex-start;
  background: rgba(15, 23, 42, 0.35);
  flex: 1; touch-action: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.bin-rule .bin-drop { border-color: rgba(96, 165, 250, 0.4); background: rgba(15, 23, 42, 0.28); }
.bin-exception .bin-drop {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(69, 26, 3, 0.25);
}
.bin-drop.drag-over, .item-pool.drag-over { outline: 2px solid var(--accent); }
.pool-title { margin: 0; font-size: 0.95rem; }

.sort-card, .formula-chip {
  width: 148px;
  background: rgba(51, 65, 85, 0.92);
  border: 1.5px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: var(--card-pad);
  box-shadow: var(--stage-elev);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  color: #f8fafc;
  transition: transform 180ms cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}
.sort-card:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }
.sort-card:active, .sort-card.is-grabbing { cursor: grabbing; transform: scale(1.06) rotate(-1deg); }
.sort-card.dragging {
  opacity: 0.55;
  transform: scale(0.96);
  cursor: grabbing;
}
.sort-card .name { font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; color: #f8fafc; }
.sort-card .detail { font-size: 0.72rem; color: #94a3b8; margin: 0.15rem 0; }
.sort-card .hot-note { font-size: 0.72rem; color: #fde68a; margin-top: 0.25rem; line-height: 1.3; }
.sort-card.is-selected { outline: 2px solid #34d399; outline-offset: 2px; }
.sort-card.is-correct {
  border-color: #6ee7b7; background: rgba(16, 185, 129, 0.28);
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.25);
}
.sort-card.is-incorrect, .sort-flash-bad {
  border-color: #fca5a5 !important;
  background: rgba(254, 202, 202, 0.18) !important;
  box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.35);
}

@keyframes sortSnapIn {
  0% { transform: scale(0.86); opacity: 0.7; }
  55% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes sortShakeSoft {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.sort-card.sort-snap-in {
  animation: sortSnapIn 380ms cubic-bezier(0.34, 1.45, 0.64, 1);
}
.sort-card.animate-shake {
  animation: sortShakeSoft 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.sort-quick { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.35rem; }
.sort-quick .btn.tiny { color: #e2e8f0; border-color: rgba(255,255,255,0.2); }
.sort-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.sort-verify-btn { min-width: 11rem; font-weight: 700; }
.sort-stats { font-weight: 600; color: var(--accent-text, #047857); }
.why-list { display: flex; flex-direction: column; gap: 0.4rem; }
.why-item { font-size: 0.88rem; padding: 0.45rem 0.6rem; border-radius: 0.55rem; background: #f8fafc; border: 1px solid #e2e8f0; }
.why-item.ok { background: #ecfdf5; border-color: #6ee7b7; }
.why-item.bad { background: #fff1f2; border-color: #fda4af; }

/* Sample gallery — collapsible tray above play-view */
.sample-gallery {
  margin: 0 auto 1rem;
  width: 100%;
  max-width: 1280px;
}
.sample-gallery-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  margin: 0 0 0.55rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.85rem;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion), background var(--motion);
}
.sample-gallery-toggle:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: #ecfdf5;
}
.sample-gallery-toggle-label { text-align: left; }
.sample-gallery-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform var(--motion);
  flex-shrink: 0;
}
.sample-gallery:not(.is-collapsed) .sample-gallery-chevron {
  transform: rotate(225deg);
  margin-top: 0.25rem;
}
.sample-gallery-panel {
  overflow: hidden;
  max-height: 1200px;
  opacity: 1;
  transition: max-height 280ms ease, opacity 200ms ease, margin 200ms ease, padding 200ms ease, border-width 200ms ease;
}
.sample-gallery.is-collapsed .sample-gallery-panel {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  pointer-events: none;
}
.sample-gallery.is-collapsed .sample-gallery-toggle {
  margin-bottom: 0;
}
.sample-gallery.is-direct-play.is-collapsed {
  margin-bottom: 0.55rem;
}
/* Direct play URLs (/play/a1000001): keep tray collapsed so the lab owns vertical space */
.sample-gallery.is-direct-play.is-collapsed {
  margin-bottom: 0.55rem;
}
.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.sample-card.is-active {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  background: #ecfdf5;
}
.sample-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.9rem 1rem; text-decoration: none; color: inherit;
  min-height: 0;
  border: 1px solid rgba(226, 232, 240, 0.95); border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.sample-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.18);
}
.jargon-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.35rem;
  padding: 0.12rem 0.4rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
/* Re-assert after base .jargon-badge so Student Play never shows research labels */
.app-shell[data-mode="play"] .jargon-badge,
.app-shell[data-mode="play"] .sample-jargon {
  display: none !important;
}
.sample-jargon { margin: 0.1rem 0 0.15rem; align-self: flex-start; }
.sample-arch {
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--accent-text);
  font-weight: 700;
}
.sample-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
}

.archetype-field { display: flex; flex-direction: column; gap: 0.35rem; }
.archetype-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
  max-height: 320px;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.85rem;
  background: #f8fafc;
}
.arch-pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
  text-align: left; padding: 0.65rem 0.75rem; cursor: pointer;
  border: 1px solid #e2e8f0; border-radius: 0.7rem; background: #fff;
  font: inherit; color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.arch-pick:hover { border-color: #6ee7b7; }
.arch-pick.is-selected {
  border-color: #34d399; background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25);
}
.arch-pick-teacher {
  font-weight: 700; font-family: var(--font-display); font-size: 0.92rem; line-height: 1.25;
}
.archetype-picker-hint { margin: 0; }

.archetype-table th:nth-child(1),
.archetype-table td:nth-child(1) { min-width: 12rem; }
.archetype-table th:nth-child(2),
.archetype-table td:nth-child(2) { min-width: 11rem; }
.archetype-table th:nth-child(3),
.archetype-table td:nth-child(3) { min-width: 12rem; }
.archetype-table th:nth-child(4),
.archetype-table td:nth-child(4) { min-width: 11rem; }
.archetype-table th:nth-child(5),
.archetype-table td:nth-child(5) { min-width: 10rem; }
.sample-subject { font-size: 0.78rem; color: var(--muted); }
.sample-blurb { font-size: 0.86rem; color: #334155; line-height: 1.35; }

/* Sequential pipeline — pool + numbered timeline */
.seq-wrap { display: flex; flex-direction: column; gap: 0.85rem; max-width: none; margin: 0; width: 100%; }
.seq-board {
  display: grid;
  grid-template-columns: minmax(14rem, 0.95fr) minmax(18rem, 1.25fr);
  gap: 1rem 1.25rem;
  align-items: start;
  width: 100%;
}
@media (max-width: 820px) {
  .seq-board { grid-template-columns: 1fr; }
}
.seq-pool-col,
.seq-timeline-col {
  min-width: 0;
  padding: 0.85rem 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.seq-col-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  font-family: var(--font-display, Georgia, serif);
}
.seq-col-hint { margin: 0 0 0.75rem; font-size: 0.8rem; }
.seq-pool {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 8rem;
  padding: 0.55rem;
  border-radius: 0.85rem;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  background: rgba(241, 245, 249, 0.65);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.seq-pool.drag-over {
  border-color: #10b981;
  border-style: dashed;
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
.seq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.pipeline-stage {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
  padding: 0.35rem 0.15rem 0.35rem 0;
}
.pipeline-stage::before {
  content: "";
  position: absolute;
  top: 1.35rem;
  bottom: 1.35rem;
  left: 1.7rem;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #10b981 0%, #06b6d4 100%);
  opacity: 0.45;
  z-index: 0;
}
.pipeline-slot {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.65rem;
  align-items: stretch;
  min-height: 4.25rem;
}
.pipeline-slot-index {
  width: 3.5rem;
  min-height: 2.75rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border: 2px solid #10b981;
  color: #6ee7b7;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.15;
  padding: 0.35rem 0.2rem;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.seq-step-label { display: block; }
.pipeline-slot-drop,
.seq-slot-drop {
  position: relative;
  min-height: 4.25rem;
  border-radius: 0.85rem;
  border: 2px dashed rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.65);
  padding: 0.35rem;
  transition: border-color var(--motion), background var(--motion), box-shadow var(--motion);
}
.pipeline-slot.drag-over .pipeline-slot-drop,
.pipeline-slot.is-drop-target .pipeline-slot-drop,
.seq-slot-drop.drag-over {
  border-color: #10b981;
  border-style: dashed;
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.pipeline-slot.drag-over .pipeline-slot-index,
.pipeline-slot.is-drop-target .pipeline-slot-index {
  border-color: #34d399;
  color: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.28);
}
.pipeline-slot.correct .pipeline-slot-drop,
.seq-slot.correct .seq-slot-drop {
  border-color: #10b981;
  border-style: solid;
  background: rgba(209, 250, 229, 0.55);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28), 0 0 18px rgba(16, 185, 129, 0.35);
}
.pipeline-slot.incorrect .pipeline-slot-drop,
.seq-slot.incorrect .seq-slot-drop {
  border-color: #ef4444;
  border-style: solid;
  background: rgba(254, 226, 226, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22), 0 0 16px rgba(239, 68, 68, 0.28);
}
.pipeline-slot.correct .pipeline-slot-index {
  border-color: #34d399;
  color: #34d399;
}
.pipeline-slot.incorrect .pipeline-slot-index {
  border-color: #f87171;
  color: #fecaca;
}
.seq-slot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.4rem;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
}
.seq-hint-pill {
  position: absolute;
  right: 0.45rem;
  bottom: 0.4rem;
  z-index: 3;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}
.seq-hint-pill.is-earlier {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.seq-hint-pill.is-later {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.pipeline-step {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  height: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.7rem;
  cursor: grab;
  box-shadow: var(--stage-elev);
  transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion), background var(--motion);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.pipeline-grip {
  width: 0.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 20%, #94a3b8 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 50%, #94a3b8 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 80%, #94a3b8 0 1.5px, transparent 2px);
  opacity: 0.85;
}
.pipeline-step:hover { transform: translateY(-2px); }
.pipeline-step:active { cursor: grabbing; border-color: #10b981; }
.pipeline-step.dragging {
  opacity: 0.88;
  transform: scale(1.02);
  box-shadow: var(--shadow-drag);
  border-color: #10b981;
  z-index: 4;
  cursor: grabbing;
}
.pipeline-step.step-correct,
.pipeline-step.correct {
  border-color: #6ee7b7;
  background: rgba(209, 250, 229, 0.92);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.28);
}
.pipeline-step.step-wrong,
.pipeline-step.incorrect {
  border-color: #fca5a5;
  background: rgba(254, 226, 226, 0.9);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.22);
}
.pipeline-step.locked {
  cursor: default;
}
.pipeline-step.locked:hover { transform: none; }
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border: 2px solid #10b981;
  color: #10b981;
  font-weight: 700;
  font-size: 0.875rem;
}
.pipeline-body { flex: 1; min-width: 0; }
.pipeline-body .name { font-weight: 650; font-family: var(--font-display); line-height: 1.3; }
.pipeline-move { display: flex; flex-direction: column; gap: 0.2rem; }
.pipeline-move .btn.tiny { min-width: 2.25rem; min-height: 2rem; }
.seq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.25rem;
  padding-top: 0.35rem;
}
.seq-check-btn {
  min-width: 10rem;
  font-weight: 700;
}
.seq-item {
  display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.6rem; align-items: center;
  padding: 0.65rem 0.75rem; background: #fff; border: 1px solid var(--panel-border);
  border-radius: 0.75rem; cursor: grab; box-shadow: 0 1px 4px rgba(15,23,42,0.05);
}
.seq-item.dragging { opacity: 0.55; }
.seq-num {
  width: 1.75rem; height: 1.75rem; border-radius: 999px; display: grid; place-items: center;
  background: #ecfdf5; color: var(--accent-text); font-weight: 700; font-size: 0.85rem;
}
.why-item {
  font-size: 0.86rem; line-height: 1.4; padding: 0.55rem 0.7rem; border-radius: 0.55rem;
  border: 1px solid #e2e8f0; background: #f8fafc;
}
.why-item.ok { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.why-item.bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

/* Matrix */
.matrix-wrap { display: flex; flex-direction: column; gap: 0.75rem; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.matrix-table th, .matrix-table td { border: 1px solid #e2e8f0; padding: 0.45rem; text-align: center; }
.matrix-table th { background: #f8fafc; font-weight: 600; }
.matrix-table td:first-child, .matrix-table th:first-child { text-align: left; }
.matrix-cell {
  min-width: 2.4rem; min-height: 2.2rem; border-radius: 0.45rem; border: 1px solid #cbd5e1;
  background: #fff; cursor: pointer; font-weight: 700; color: var(--muted);
}
.matrix-cell.on { background: #ecfdf5; border-color: #6ee7b7; color: var(--accent-text); }

/* Causal — SVG cause–effect web */
.causal-wrap { display: flex; flex-direction: column; gap: 0.85rem; }
.causal-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.causal-legend { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.causal-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}
.leg-primary::before, .leg-secondary::before, .leg-trigger::before,
.leg-underlying::before, .leg-effect::before {
  content: ""; display: inline-block; width: 1.1rem; height: 3px; margin-right: 0.3rem; vertical-align: middle; border-radius: 2px;
}
.leg-primary::before { background: #6366f1; height: 4px; }
.leg-secondary::before { background: #94a3b8; border-top: 0; background: repeating-linear-gradient(90deg, #64748b 0 4px, transparent 4px 7px); height: 3px; }
.leg-trigger::before { background: #d97706; height: 8px; width: 8px; border-radius: 2px; }
.leg-underlying::before { background: #059669; height: 8px; width: 8px; border-radius: 2px; }
.leg-effect::before { background: #dc2626; height: 8px; width: 8px; border-radius: 2px; }
.causal-network-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
  height: auto;
  max-height: none;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(16, 185, 129, 0.08), transparent 42%),
    radial-gradient(ellipse at 80% 85%, rgba(239, 68, 68, 0.07), transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.causal-canvas-inner {
  position: relative;
  width: 100%;
  height: 100%;
}
.causal-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
  z-index: 1;
}
.causal-svg-layer .causal-edge {
  pointer-events: none; fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 180ms ease, stroke-width 180ms ease, opacity 180ms ease;
}
.causal-svg-layer .causal-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 32px;
  pointer-events: stroke;
  cursor: pointer;
}
.causal-strength-pill {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: min(22rem, calc(100% - 1.5rem));
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}
.causal-strength-pill.hidden { display: none !important; }
.causal-pill-opt {
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: background var(--motion), color var(--motion);
}
.causal-pill-opt:hover { background: rgba(255, 255, 255, 0.08); }
.causal-pill-opt.is-active {
  background: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
}
.causal-mobile { display: none; margin-top: 0.5rem; }
@media (max-width: 700px) {
  .causal-network-stage:not(.causal-network-presenter) { display: none; }
  .causal-mobile { display: block; }
  .causal-mobile details {
    margin: 0.35rem 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--panel-border);
    border-radius: 0.65rem;
    background: #fff;
  }
  .causal-mobile summary { font-weight: 700; cursor: pointer; }
  .causal-mobile .btn { margin-top: 0.35rem; width: 100%; }
}
.causal-nodes-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.causal-node {
  position: absolute;
  display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; justify-content: center;
  padding: 0.65rem 0.75rem; border-radius: 10px; font-weight: 600; font-size: 0.88rem;
  box-shadow: var(--stage-elev); cursor: pointer; user-select: none; text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: auto;
  transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion); touch-action: manipulation;
}
.causal-node:hover { transform: translateY(-2px); }
.causal-node[data-kind="cause"], .causal-node.cause {
  background: #ecfdf5;
  border: 2px solid #34d399;
  color: #065f46;
}
.causal-node.role-trigger, .causal-node[data-directness="immediate"] {
  background: #fffbeb;
  border: 2px solid #fbbf24;
  color: #92400e;
}
.causal-node[data-kind="effect"], .causal-node.effect {
  background: #fef2f2;
  border: 2px solid #f87171;
  color: #991b1b;
}
.causal-node.selected, .causal-node.is-selected {
  outline: 2px solid #059669; outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
}
.causal-node .cat { font-size: 0.65rem; text-transform: uppercase; opacity: 0.8; letter-spacing: 0.04em; }
.causal-node .name {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: inherit;
}
.causal-edge.strength-primary { stroke: #4f46e5; stroke-width: 4px; stroke-dasharray: none; }
.causal-edge.strength-secondary { stroke: #64748b; stroke-width: 2.5px; stroke-dasharray: 7 5; }
.causal-edge.is-active { filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.55)); }
.causal-edge.state-ok { stroke: #059669 !important; stroke-width: 4px; stroke-dasharray: none; }
.causal-edge.state-bad { stroke: #dc2626 !important; stroke-width: 3.25px; }
.causal-edge.causal-edge-missing {
  stroke: #dc2626;
  stroke-width: 2.75px;
  stroke-dasharray: 5 6;
  opacity: 0.85;
}
.edge-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.edge-list li, .edge-item {
  font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.5rem; border-radius: 0.5rem; background: #f8fafc; border: 1px solid #e2e8f0;
}
.edge-item.state-ok { border-color: #6ee7b7; background: rgba(209, 250, 229, 0.65); }
.edge-item.state-bad { border-color: #fca5a5; background: rgba(254, 226, 226, 0.7); }
.edge-toggle {
  flex: 1; text-align: left; background: transparent; border: 0; cursor: pointer; font: inherit; padding: 0.2rem;
}
.causal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.causal-validate-btn { min-width: 11rem; font-weight: 700; }
.causal-stats { font-weight: 600; color: var(--accent-text, #047857); }

/* Nest — nested category boxes (color-coded ranks) */
.nest-wrap { display: flex; flex-direction: column; gap: 0.85rem; }
.nest-stage {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.15rem 1.25rem;
  min-height: min(58vh, 560px);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.88));
  border-radius: 12px; border: var(--stage-border);
  box-shadow: var(--stage-elev);
  overflow: auto;
}
.nest-tree {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}
.nest-box {
  --nest-accent: #94a3b8;
  --nest-fill: rgba(30, 41, 59, 0.45);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: var(--nest-pad, 0.75rem);
  border-radius: calc(12px - min(4px, var(--nest-depth, 0) * 1px));
  background: var(--nest-fill);
  border: 2px solid var(--nest-accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 0 1px color-mix(in srgb, var(--nest-accent) 25%, transparent),
    var(--stage-elev);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.nest-rank-domain { --nest-accent: #c4b5fd; --nest-fill: rgba(91, 33, 182, 0.18); }
.nest-rank-kingdom { --nest-accent: #6ee7b7; --nest-fill: rgba(6, 95, 70, 0.28); }
.nest-rank-phylum { --nest-accent: #67e8f9; --nest-fill: rgba(14, 116, 144, 0.22); }
.nest-rank-class { --nest-accent: #93c5fd; --nest-fill: rgba(30, 64, 175, 0.22); }
.nest-rank-order { --nest-accent: #fcd34d; --nest-fill: rgba(146, 64, 14, 0.2); }
.nest-rank-family { --nest-accent: #fdba74; --nest-fill: rgba(154, 52, 18, 0.2); }
.nest-rank-genus { --nest-accent: #f9a8d4; --nest-fill: rgba(157, 23, 77, 0.18); }
.nest-rank-species { --nest-accent: #e2e8f0; --nest-fill: rgba(51, 65, 85, 0.35); }
.nest-rank-taxon { --nest-accent: #a5b4fc; --nest-fill: rgba(49, 46, 129, 0.22); }

.nest-box-header {
  font-weight: 700; font-size: 0.9rem; color: var(--nest-accent);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-family: var(--font-display);
  user-select: none;
  padding: 0.15rem 0.1rem;
}
.nest-box-root > .nest-box-header { cursor: default; }
.nest-box-movable > .nest-box-header { cursor: grab; }
.nest-box-movable.dragging > .nest-box-header { cursor: grabbing; }
.nest-rank {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--nest-accent) 85%, #fff);
  font-weight: 800;
  opacity: 0.9;
  flex-shrink: 0;
}
.nest-box-name { color: #f1f5f9; flex: 1; min-width: 0; }
.nest-count {
  color: #94a3b8; font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.nest-drop {
  min-height: 4.25rem;
  border: 1.5px dashed color-mix(in srgb, var(--nest-accent) 45%, transparent);
  border-radius: 0.75rem;
  padding: calc(0.55rem + var(--nest-depth, 0) * 0.15rem);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.65rem;
  align-items: stretch;
  background: rgba(15, 23, 42, 0.28);
  touch-action: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

/* Chips for leaves sit in a wrapping row inside the column drop */
.nest-drop > .nest-chip {
  align-self: flex-start;
}
.nest-drop:has(> .nest-chip):not(:has(> .nest-box)) {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
}

@keyframes nestValidPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35), 0 0 16px rgba(16, 185, 129, 0.2);
    border-color: #34d399;
  }
  50% {
    box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.2), 0 0 28px rgba(16, 185, 129, 0.35);
    border-color: #6ee7b7;
  }
}
.nest-box.is-valid-target,
.nest-drop.is-valid-target {
  animation: nestValidPulse 1.05s ease-in-out infinite;
  background: rgba(16, 185, 129, 0.14);
  border-style: solid;
}
.nest-box.is-drag-over:not(.is-valid-target),
.nest-drop.is-drag-over:not(.is-valid-target),
.nest-pool.is-drag-over {
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.65);
  background: rgba(148, 163, 184, 0.08);
}
.nest-drop.is-invalid-target {
  border-color: rgba(252, 165, 165, 0.45);
}

.nest-chip, .nest-leaf {
  display: inline-flex; flex-direction: column; gap: 0.1rem;
  padding: var(--card-pad);
  background: rgba(99, 102, 241, 0.22);
  border: 1.5px solid rgba(129, 140, 248, 0.55);
  border-radius: 8px; color: #e0e7ff;
  font-size: 0.85rem; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; min-height: 44px;
  box-shadow: var(--stage-elev);
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion), background var(--motion);
}
.nest-chip.nest-rank-phylum { border-color: rgba(103, 232, 249, 0.55); background: rgba(14, 116, 144, 0.28); }
.nest-chip.nest-rank-class { border-color: rgba(147, 197, 253, 0.55); background: rgba(30, 64, 175, 0.28); }
.nest-chip.nest-rank-order { border-color: rgba(252, 211, 77, 0.55); background: rgba(146, 64, 14, 0.28); }
.nest-chip.nest-rank-family { border-color: rgba(253, 186, 116, 0.55); background: rgba(154, 52, 18, 0.28); }
.nest-chip.nest-rank-genus { border-color: rgba(249, 168, 212, 0.55); background: rgba(157, 23, 77, 0.28); }
.nest-chip.nest-rank-species { border-color: rgba(226, 232, 240, 0.5); background: rgba(51, 65, 85, 0.4); }

.nest-chip:hover, .nest-leaf:hover { transform: translateY(-2px); }
.nest-chip:active, .nest-leaf:active { cursor: grabbing; }
.nest-chip .name, .nest-leaf .name { font-weight: 700; font-family: var(--font-display); color: #e0e7ff; }
.nest-rank-mini { font-size: 0.62rem; text-transform: uppercase; color: #a5b4fc; }
.nest-chip.is-selected { outline: 2px solid #34d399; outline-offset: 2px; }
.nest-chip.is-correct, .nest-box.is-correct {
  border-color: #6ee7b7 !important;
  background: rgba(16, 185, 129, 0.22);
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.25);
}
.nest-chip.is-incorrect,
.nest-box.is-incorrect,
.nest-flash-bad {
  border-color: #fca5a5 !important;
  background: rgba(254, 202, 202, 0.18) !important;
  box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.35);
}
.nest-pool { min-height: 72px; }
.nest-pool-container { border-style: dashed; }
.nest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.nest-validate-btn { min-width: 12rem; font-weight: 700; }
.nest-stats { font-weight: 600; color: var(--accent-text, #047857); }

@keyframes nestShakeSoft {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.nest-box.animate-shake,
.nest-chip.animate-shake {
  animation: nestShakeSoft 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* Action & Result Lab — reagent → observation */
.transform-wrap { display: flex; flex-direction: column; gap: 0.85rem; }
.process-stage, .lab-stage {
  display: flex; flex-direction: column; gap: 1.15rem;
  padding: 1.15rem 1.2rem;
  min-height: min(52vh, 520px);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.88));
  border-radius: 12px; border: var(--stage-border);
  box-shadow: var(--stage-elev);
}
.action-palette, .reagent-rack {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center;
  padding: var(--card-pad); background: rgba(30, 41, 59, 0.7);
  border-radius: 10px; border: 1.5px solid rgba(96, 165, 250, 0.35);
  box-shadow: var(--stage-elev);
}
.palette-label {
  width: 100%; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #94a3b8; font-weight: 700;
}

.lab-bench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.85fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 860px) {
  .lab-bench { grid-template-columns: 1fr; }
}
.lab-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}
.lab-col-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-family: var(--font-display);
  color: #e2e8f0;
}
.lab-col-head .hint { margin: 0; font-size: 0.8rem; }
.lab-observations {
  padding: 0.75rem;
  border-radius: 12px;
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  background: rgba(69, 26, 3, 0.22);
}
.lab-observations .lab-col-head h3 { color: #fde68a; }

.baseline-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.85rem;
}
.transform-layout {
  display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 0.9rem; align-items: start;
}
@media (max-width: 800px) { .transform-layout { grid-template-columns: 1fr; } }
.transform-actions-col h3, .transform-stage-col h3 {
  margin: 0 0 0.45rem; font-size: 0.95rem; font-family: var(--font-display);
}
.action-pool { display: flex; flex-direction: column; gap: 0.45rem; }
.action-chip {
  display: inline-flex; flex-direction: column; gap: 0.15rem; text-align: left;
  padding: var(--card-pad); border-radius: 8px; border: 1.5px solid rgba(147, 197, 253, 0.45);
  background: linear-gradient(160deg, #1d4ed8, #2563eb); color: #fff; cursor: grab; font: inherit;
  box-shadow: var(--stage-elev);
  user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform 180ms cubic-bezier(0.34, 1.4, 0.64, 1), background-color var(--motion), box-shadow var(--motion);
}
.action-chip:hover { transform: translateY(-2px) scale(1.02); }
.action-chip:active, .action-chip.is-grabbing { cursor: grabbing; transform: scale(1.05); }
.action-chip.dragging { opacity: 0.65; transform: scale(0.96); }
.action-chip.is-selected { outline: 2px solid #34d399; outline-offset: 2px; }
.action-chip .name { font-weight: 700; font-size: 0.88rem; color: #fff; }
.action-chip .hint { color: #bfdbfe; font-size: 0.72rem; }

.observation-palette {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(58vh, 520px);
  overflow: auto;
  padding-right: 0.15rem;
}
.obs-chip {
  display: flex; flex-direction: column; gap: 0.2rem; text-align: left;
  padding: 0.65rem 0.75rem; border-radius: 8px;
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  background: rgba(30, 41, 59, 0.75);
  color: #f8fafc; cursor: pointer; font: inherit;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.obs-chip:hover { transform: translateY(-1px); border-color: #fbbf24; }
.obs-chip.is-selected {
  outline: 2px solid #fbbf24; outline-offset: 1px;
  background: rgba(120, 53, 15, 0.45);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}
.obs-chip .name { font-weight: 700; font-size: 0.82rem; font-family: var(--font-display); color: #fde68a; }
.obs-chip .hint { color: #cbd5e1; font-size: 0.72rem; }

.transform-slots { display: flex; flex-direction: column; gap: 0.65rem; }
.lab-baselines .transform-slots,
.lab-baselines .baseline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.transform-slot, .baseline-card, .tube-card {
  position: relative;
  overflow: hidden;
  min-height: 200px; padding: var(--card-pad);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.55), rgba(15, 23, 42, 0.65));
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 0.55rem; justify-content: space-between;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  color: #e2e8f0;
  box-shadow: var(--stage-elev);
}
.baseline-card.is-target-hover, .action-drop.drag-over {
  border-color: #34d399; background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  transform: scale(1.015);
}
.baseline-card.has-transformation {
  border-style: solid; border-color: #60a5fa; background: rgba(37, 99, 235, 0.16);
}
.baseline-card.is-correct {
  border-style: solid; border-color: #6ee7b7 !important;
  background: rgba(16, 185, 129, 0.2) !important;
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.3);
}
.baseline-card.is-incorrect {
  border-color: #fca5a5 !important;
  background: rgba(254, 202, 202, 0.14) !important;
  box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.35);
}
.slot-head strong { font-family: var(--font-display); font-size: 0.95rem; color: #f8fafc; }
.action-drop, .result-pick {
  border-radius: 0.65rem; padding: var(--card-pad);
  border: 1.5px dashed rgba(148, 163, 184, 0.4); background: rgba(15, 23, 42, 0.35);
  display: flex; flex-direction: column; gap: 0.25rem; min-height: 64px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.action-drop.filled { border-style: solid; border-color: #60a5fa; }
.result-pick.filled { border-style: solid; border-color: #fbbf24; background: rgba(120, 53, 15, 0.2); }
.action-drop .placeholder, .result-pick .placeholder { color: #94a3b8; font-size: 0.82rem; }
.result-pick select {
  width: 100%; font: inherit; border-radius: 0.45rem; border: 1px solid #475569;
  background: #0f172a; color: #e2e8f0; padding: 0.35rem;
}
.transform-slot .cat {
  font-size: 0.65rem; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.03em;
}
.transform-slot .arrow { display: none; }
.transform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.transform-verify-btn { min-width: 11rem; font-weight: 700; }
.transform-stats { font-weight: 600; color: var(--accent-text, #047857); }

/* Chemical reaction splash on reagent drop */
@keyframes reactionSplashFade {
  0% { opacity: 0; transform: scale(0.7); }
  25% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.35); }
}
@keyframes reactionBubble {
  0% { transform: translateY(8px) scale(0.4); opacity: 0; }
  30% { opacity: 0.95; }
  100% { transform: translateY(-42px) scale(1); opacity: 0; }
}
.reaction-splash-fx {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  background: radial-gradient(circle at 50% 60%, rgba(110, 231, 183, 0.35), transparent 60%);
  animation: reactionSplashFade 0.7s ease-out forwards;
}
.reaction-splash-fx span {
  position: absolute;
  bottom: 28%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(167, 243, 208, 0.9);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: reactionBubble 0.65s ease-out forwards;
}
.reaction-splash-fx span:nth-child(1) { left: 22%; animation-delay: 0.02s; }
.reaction-splash-fx span:nth-child(2) { left: 38%; width: 7px; height: 7px; animation-delay: 0.08s; background: rgba(147, 197, 253, 0.95); }
.reaction-splash-fx span:nth-child(3) { left: 52%; animation-delay: 0.12s; }
.reaction-splash-fx span:nth-child(4) { left: 66%; width: 8px; height: 8px; animation-delay: 0.05s; background: rgba(253, 230, 138, 0.9); }
.reaction-splash-fx span:nth-child(5) { left: 78%; width: 6px; height: 6px; animation-delay: 0.15s; }
.baseline-card.reaction-splash {
  border-color: #6ee7b7;
}
.baseline-card.animate-shake {
  animation: sortShakeSoft 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* Concept map — palette + stage anchors + relation chips */
.concept-wrap,
.concept-map-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.concept-palette-panel {
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}
.palette-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
}
.palette-sub {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}
.node-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
  min-height: 3.5rem;
  padding: 0.65rem;
  border-radius: 0.85rem;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  background: rgba(241, 245, 249, 0.7);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.node-pool.drag-over {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.concept-node,
.concept-node.mind-node {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  text-align: left;
}
.concept-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}
.concept-node:active,
.concept-node.dragging,
.concept-node.is-grabbing {
  cursor: grabbing;
  transform: scale(0.97);
  opacity: 0.92;
  z-index: 5;
}
.node-category {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.node-title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #0f172a;
  font-family: var(--font-display, Georgia, serif);
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.category-structure { border-color: rgba(16, 185, 129, 0.4); background: #ecfdf5; }
.category-structure .node-category { color: #047857; }
.category-process { border-color: rgba(14, 165, 233, 0.4); background: #f0f9ff; }
.category-process .node-category { color: #0369a1; }
.category-molecule { border-color: rgba(168, 85, 247, 0.35); background: #faf5ff; }
.category-molecule .node-category { color: #7e22ce; }
.category-factor { border-color: rgba(245, 158, 11, 0.4); background: #fffbeb; }
.category-factor .node-category { color: #b45309; }
.concept-node.is-root {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}
.concept-node.is-selected,
.concept-node.selected {
  outline: 2px solid #10b981;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}
.concept-node.correct {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}
.concept-node.incorrect {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
.concept-node.is-dimmed { opacity: 0.28; }
.concept-node.is-path-lit {
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35), 0 8px 20px rgba(2, 132, 199, 0.15);
}

.concept-canvas-container {
  position: relative;
  min-height: 420px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 1.1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.svg-connections-layer,
.concept-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 1;
}
.canvas-anchors-grid {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 1rem;
  min-height: 360px;
}
.canvas-anchors-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.canvas-anchors-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 860px) {
  .canvas-anchors-grid.cols-2,
  .canvas-anchors-grid.cols-3 { grid-template-columns: 1fr; }
}
.canvas-anchor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.85rem;
  border-radius: 12px;
  border: 2px dashed rgba(148, 163, 184, 0.4);
  background: rgba(248, 250, 252, 0.9);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.canvas-anchor.drag-over,
.anchor-slot.drag-over {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}
.anchor-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #334155;
  text-align: center;
  margin-bottom: 0.25rem;
  font-family: var(--font-display, Georgia, serif);
}
.anchor-hint {
  display: block;
  text-align: center;
  margin: 0 0 0.55rem;
  font-size: 0.72rem !important;
}
.anchor-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 10rem;
  padding: 0.45rem;
  border-radius: 10px;
}
.anchor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.concept-edge {
  fill: none;
  stroke: #64748b;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease;
}
.concept-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 26px;
  pointer-events: stroke;
  cursor: pointer;
}
.concept-edge.state-ok,
.concept-edge.is-valid { stroke: #059669 !important; stroke-width: 3px; }
.concept-edge.state-bad,
.concept-edge.is-invalid { stroke: #e11d48 !important; stroke-width: 3px; }
.concept-edge.pending { stroke: #94a3b8; stroke-dasharray: 7 5; }
.concept-edge-missing {
  stroke: #e11d48;
  stroke-width: 2.25px;
  stroke-dasharray: 5 6;
  opacity: 0.75;
}
.concept-edge.is-path-lit {
  stroke: #0284c7 !important;
  stroke-width: 3.25px;
  filter: drop-shadow(0 0 4px rgba(2, 132, 199, 0.45));
}
.concept-edge.is-dimmed { opacity: 0.18; }

.relation-picker-popover,
.concept-rel-pill {
  position: absolute;
  z-index: 12;
  min-width: 12rem;
  max-width: min(22rem, calc(100% - 1rem));
  padding: 0.75rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}
.relation-picker-popover.hidden,
.concept-rel-pill.hidden { display: none !important; }
.popover-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.concept-rel-head { margin: 0 0 0.45rem; font-size: 0.8rem !important; }
.relation-chips,
.concept-rel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.rel-chip,
.concept-rel-chip {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.35rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}
.rel-chip:hover,
.concept-rel-chip:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: scale(1.04);
}
.rel-chip.is-active,
.concept-rel-chip.is-active {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}
.concept-rel-cancel {
  display: block;
  margin-top: 0.5rem;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.edge-label-badge,
.mind-badge {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.mind-badge.valid { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }
.mind-badge.invalid { background: #fff1f2; color: #be123c; border-color: #fda4af; }
.mind-badge.is-path-lit { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25); }
.badge-x { margin-left: 0.25rem; opacity: 0.55; }

.concept-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.concept-verify-btn { min-width: 11.5rem; font-weight: 700; }
.concept-stats { font-weight: 600; color: var(--accent-text, #047857); }
.concept-mobile { display: none; }

/* Keep legacy absolute mindmap styles from fighting the new flow layout */
.mindmap-stage .concept-node.mind-node { position: relative; left: auto !important; top: auto !important; width: auto !important; }
.mindmap-stage .concept-nodes-layer { display: none; }

/* Venn Diagram — trait pool + set-column drop zones */
.venn-wrap,
.venn-matrix-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.venn-tap-hint { margin-top: -0.45rem; }
.venn-stats { font-weight: 600; color: var(--accent-text, #047857); }

.trait-pool-section {
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--stage-elev, 0 8px 24px rgba(15, 23, 42, 0.06));
}
.pool-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}
.pool-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
}
.pool-counter {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.trait-cards-pool,
.venn-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
  min-height: 3.25rem;
  padding: 0.65rem;
  border-radius: 0.85rem;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  background: rgba(241, 245, 249, 0.65);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.trait-cards-pool.drag-over,
.venn-pool.drag-over,
.trait-cards-pool.is-drag-over {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}
.pool-empty,
.drop-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.5rem;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  text-align: center;
}

.venn-zones-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem 1.15rem;
  align-items: stretch;
}
.venn-zones-container.is-three {
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
}
@media (max-width: 860px) {
  .venn-zones-container.is-two {
    grid-template-columns: 1fr;
  }
}

.venn-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.venn-zone.zone-center {
  border: 2px solid #7c3aed;
  background: linear-gradient(165deg, #ede9fe 0%, #f5f3ff 42%, #faf5ff 100%);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.12);
}
.venn-zone.zone-left {
  border: 2px solid #059669;
  background: linear-gradient(165deg, #6ee7b7 0%, #a7f3d0 28%, #ecfdf5 72%, #fff 100%);
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.14);
}
.venn-zone.zone-right {
  border: 2px solid #1d4ed8;
  background: linear-gradient(165deg, #60a5fa 0%, #93c5fd 28%, #dbeafe 72%, #fff 100%);
  box-shadow: 0 8px 22px rgba(29, 78, 216, 0.14);
}
.zone-header {
  margin-bottom: 0.7rem;
  text-align: center;
}
.zone-header h3 {
  margin: 0.35rem 0 0;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
  font-family: var(--font-display, Georgia, serif);
}
.zone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.badge-green { background: #059669; color: #ecfdf5; }
.badge-purple { background: #7c3aed; color: #f5f3ff; }
.badge-blue { background: #1d4ed8; color: #eff6ff; }
.badge-amber { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.badge-slate { background: rgba(100, 116, 139, 0.16); color: #334155; }

.zone-droparea {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 11rem;
  padding: 0.65rem;
  border-radius: 10px;
  border: 2px dashed rgba(148, 163, 184, 0.4);
  background: rgba(248, 250, 252, 0.85);
  transition: min-height 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.venn-zone.drag-over,
.venn-zone.is-drag-over,
.venn-zone.drop-target-hot {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}
.zone-left .zone-droparea.drag-over,
.zone-left.drag-over .zone-droparea {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  min-height: 12.5rem;
}
.zone-center .zone-droparea.drag-over,
.zone-center.drag-over .zone-droparea {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
  min-height: 12.5rem;
}
.zone-right .zone-droparea.drag-over,
.zone-right.drag-over .zone-droparea {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
  min-height: 12.5rem;
}
.zone-extra .zone-droparea.drag-over,
.zone-extra.drag-over .zone-droparea {
  border-color: #64748b;
  background: rgba(100, 116, 139, 0.1);
  min-height: 12.5rem;
}

.trait-card,
.venn-chip {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  min-height: 44px;
  box-sizing: border-box;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.trait-card.has-hint,
.venn-chip.has-hint,
.trait-card.incorrect,
.venn-chip.is-incorrect {
  margin-bottom: 0.85rem;
}
.trait-cards-pool .trait-card:hover,
.venn-pool .trait-card:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}
.trait-card:active,
.trait-card.dragging,
.venn-chip:active,
.venn-chip.dragging {
  cursor: grabbing;
  transform: scale(0.96);
  opacity: 0.92;
}
.drag-handle,
.venn-chip-handle {
  flex-shrink: 0;
  width: 1rem;
  margin-top: 0.15rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.75rem;
  letter-spacing: -0.08em;
  line-height: 1;
}
.trait-text,
.venn-chip-label {
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.trait-text .katex,
.venn-chip-label .katex {
  font-size: 0.95em !important;
}
.pipeline-body .name,
.pipeline-body .hint {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.pipeline-body .name .katex,
.pipeline-body .hint .katex {
  font-size: 0.95em !important;
}
.trait-zone-tag {
  flex-shrink: 0;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
}
.trait-card.just-placed,
.trait-card.snap-in,
.venn-chip.just-placed {
  animation: vennSnapIn 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes vennSnapIn {
  from { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35); }
  to { transform: scale(1); }
}
.trait-card.is-selected,
.venn-chip.is-selected {
  outline: 2px solid #34d399;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.28);
}
.trait-card.correct,
.trait-card.is-correct,
.trait-card.locked,
.venn-chip.is-correct,
.venn-chip.locked {
  border-color: #6ee7b7;
  background: rgba(209, 250, 229, 0.95);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.28);
  cursor: default;
}
.trait-card.correct:hover,
.trait-card.locked:hover,
.venn-chip.is-correct:hover,
.venn-chip.locked:hover { transform: none; }
.trait-card.incorrect,
.trait-card.is-incorrect,
.venn-chip.is-incorrect {
  border-color: #fca5a5;
  background: rgba(254, 226, 226, 0.95);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.22);
}
.trait-card.shake {
  animation: vennShake 0.45s ease;
}
@keyframes vennShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.venn-move-hint {
  position: absolute;
  right: 0.35rem;
  bottom: -0.55rem;
  z-index: 2;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}
.venn-move-hint.is-left {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}
.venn-move-hint.is-right {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.venn-move-hint.is-neutral {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.venn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.15rem;
}
.venn-verify-btn {
  min-width: 11rem;
  font-weight: 700;
}

/* Legacy circle selectors kept harmless if an older snapshot is restored */
.venn-container,
.venn-canvas,
.venn-circle,
.venn-intersection { display: none !important; }

/* Legacy free-form mindmap shell retired — concept map uses .concept-canvas-container */
.mindmap-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: auto; }
.mind-path { stroke-linecap: round; transition: opacity 200ms ease; }

.spectrum-tile.logic-tile, .sort-card.logic-tile {
  transition: transform var(--motion), box-shadow var(--motion), opacity var(--motion);
}
.bin-drop.drop-target-hot, .item-pool.drop-target-hot { outline: 2px solid var(--accent); }
.edge-list li.valid-link { color: var(--accent-text); }
.edge-list li.invalid-link { color: #be123c; }

/* Finger-following drag ghost (place-based players) */
.logic-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.92;
  padding: 0.4rem 0.65rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border: 1px solid rgba(52, 211, 153, 0.55);
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 220px;
  will-change: transform;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* Touch-first (HKDSE commute / smartphone) — primary controls only */
.btn:not(.btn-sm):not(.tiny), .chip, .elim-chip, .arch-pick, .mode-btn, .lang-btn, .view-btn,
.venn-chip, .sort-card, .spectrum-tile, .action-chip, .nest-chip,
.concept-node, .causal-node, .matrix-cell, .flow-port {
  min-height: 48px;
  min-width: 48px;
}
.flow-port {
  min-height: 44px;
  min-width: 44px;
}
/* Compact buttons must not inherit 48px square — that overlaps table/toolbar text */
.btn.btn-sm,
.btn.tiny,
.list-toolbar-actions .btn,
.data-table .col-actions .btn,
.feat-actions .btn,
.panel-head-actions .btn.btn-sm,
.panel-head-actions .btn.tiny,
.admin-modal-head .btn,
.pathway-controls .btn,
.teacher-solution-actions .btn {
  min-height: 2rem;
  min-width: 0;
  padding: 0.28rem 0.6rem;
  line-height: 1.25;
}
.btn.tiny {
  padding: 0.22rem 0.5rem;
  font-size: 0.78rem;
}
.item-pool, .bin-drop, .venn-pool, .action-drop, .nest-drop {
  min-height: 56px;
  padding: 0.55rem;
}
.spectrum-tile, .sort-card, .venn-chip, .action-chip, .nest-chip {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Misconception toast */
.misconception-toast {
  margin-top: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.misconception-toast.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.misconception-toast.error {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid #fda4af;
  color: #9f1239;
}
.misconception-toast.ok {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #047857;
}

/* Auto-detect studio */
.check-inline {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 0.5rem;
  margin: 0.35rem 0 !important; color: var(--fg); font-size: 0.9rem;
}
.check-inline input { width: 1.1rem; height: 1.1rem; min-width: 1.1rem; min-height: 1.1rem; }
.archetype-field.is-dimmed { opacity: 0.45; pointer-events: none; }
.detect-preview { min-height: 1.2rem; color: var(--accent-text); font-weight: 600; }
.editor-block {
  transition: box-shadow var(--motion), border-color var(--motion);
}
.editor-block:focus-within {
  border-color: #34d399;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Mobile: stack / accordion for wide canvases */
@media (max-width: 700px) {
  .play-layout { min-height: auto; }
@media (max-width: 700px) {
  .venn-zones-container.is-two,
  .venn-zones-container.is-three {
    grid-template-columns: 1fr;
  }
  .zone-droparea { min-height: 7.5rem; }
}
  .transform-layout { grid-template-columns: 1fr; }
  .transform-slot { grid-template-columns: 1fr; }
  .transform-slot .arrow { display: none; }
  .concept-wrap, .causal-wrap, .nest-wrap {
    max-height: none;
  }
  .mobile-accordion details {
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    padding: 0.55rem 0.7rem;
    margin: 0.4rem 0;
    background: var(--surface);
  }
  .mobile-accordion summary {
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  .flowchart {
    max-height: 70vh;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y pinch-zoom;
  }
  .flow-canvas {
    transform-origin: 0 0;
  }
  .archetype-picker {
    max-height: 240px;
    grid-template-columns: 1fr;
  }
  .sample-grid { grid-template-columns: 1fr; }
}
.concept-mobile { display: none; }
@media (max-width: 700px) {
  .concept-nodes.desktop-canvas { display: none; }
  .concept-mobile { display: block; }
}


/* —— Interactive Dichotomous Lab (default decision flowchart canvas) —— */
.dichotomous-lab-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: none;
  margin: 0 auto;
}
.test-focus-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, #ecfdf5, #f0f9ff);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 12px;
}
.step-badge {
  font-weight: 800;
  font-size: 0.9rem;
  color: #047857;
  letter-spacing: 0.02em;
}
.elimination-tracker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  flex: 1;
  justify-content: flex-end;
}
.tracker-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}
.elim-trail {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #0f172a;
}
.trail-num { font-size: 0.95rem; opacity: 0.55; }
.trail-num.is-current { opacity: 1; color: #047857; font-size: 1.05rem; }
.trail-arrow { color: #94a3b8; font-size: 0.85rem; }
.candidate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.candidate-chips .chip {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  cursor: default;
  transition: transform 0.25s ease, opacity 0.3s ease, background 0.3s ease, color 0.3s ease;
}
.candidate-chips .chip.active { cursor: default; }
.candidate-chips .chip.eliminated {
  background: rgba(225, 29, 72, 0.08);
  color: rgba(190, 18, 60, 0.55);
  border-color: rgba(225, 29, 72, 0.22);
  text-decoration: line-through;
  transform: scale(0.92);
  cursor: pointer;
}
.candidate-chips .chip.just-out {
  animation: labChipOut 0.55s ease;
}
.candidate-chips .chip.is-winner {
  background: #10b981;
  color: #fff;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28);
}
@keyframes labChipOut {
  0% { transform: scale(1.08); background: rgba(225, 29, 72, 0.25); }
  100% { transform: scale(0.92); }
}
.lab-elim-tooltip {
  position: absolute;
  z-index: 10000;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.lab-elim-tooltip strong { display: block; margin-bottom: 0.25rem; color: #6ee7b7; }
.lab-elim-tooltip p { margin: 0; }

.dichotomous-main-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.active-rule-card {
  text-align: center;
  padding: 1.35rem 1.25rem 1.5rem;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}
.lab-focus-kicker,
.lab-done-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #047857;
}
.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 1.15rem;
  color: #0f172a;
  line-height: 1.4;
}
.observation-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 640px) {
  .observation-choices { grid-template-columns: 1fr; }
  .elimination-tracker { justify-content: flex-start; }
}
.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.1rem 0.9rem;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, background 0.2s ease;
}
.choice-yes {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}
.choice-yes:hover {
  background: rgba(16, 185, 129, 0.16);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}
.choice-no {
  background: rgba(225, 29, 72, 0.06);
  border-color: rgba(225, 29, 72, 0.3);
}
.choice-no:hover {
  background: rgba(225, 29, 72, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.15);
}
.choice-btn.is-pressed { transform: scale(0.98); opacity: 0.85; }
.choice-tag {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.choice-yes .choice-tag { color: #047857; }
.choice-no .choice-tag { color: #be123c; }
.obs-desc {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.35;
}
.lab-winner-pill {
  display: inline-flex;
  margin-top: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  font-weight: 800;
}

/* Live decision tree */
.flowchart-tree-canvas {
  padding: 0.65rem 0.5rem 0.85rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.28) 1px, transparent 0);
  background-size: 14px 14px;
  background-color: #f8fafc;
  min-height: min(62vh, 40rem);
  display: flex;
  flex-direction: column;
}
.flowchart-tree-canvas > .fc-chart-wrap {
  flex: 1;
  min-height: 0;
}
.lab-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.lab-tree-stem {
  width: 3px;
  height: 18px;
  background: #cbd5e1;
  border-radius: 2px;
}
.lab-tree-stem.is-lit {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
}
.lab-tree-shape.oval {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.45rem 1.25rem;
  border-radius: 999px;
  border: 2.5px solid #0284c7;
  background: #e0f2fe;
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a;
}
.lab-tree-shape.oval.end { border-color: #0f766e; background: #ccfbf1; }
.lab-tree-step {
  width: min(40rem, 100%);
  margin: 0.15rem 0;
  padding: 0.85rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #fff;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
}
.lab-tree-step.is-active {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}
.lab-tree-step.is-done {
  border-color: rgba(16, 185, 129, 0.45);
  background: #f0fdf4;
}
.lab-tree-step.is-future {
  opacity: 0.42;
  filter: grayscale(0.25);
}
.lab-tree-stepnum {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7c3aed;
  margin-bottom: 0.25rem;
}
.lab-tree-q {
  font-weight: 700;
  font-size: 0.92rem;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 0.65rem;
}
.lab-tree-branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (max-width: 640px) {
  .lab-tree-branches { grid-template-columns: 1fr; }
}
.lab-branch {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1.5px dashed #cbd5e1;
  background: #f8fafc;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.25s ease, border-color 0.25s ease;
}
.lab-branch.yes.is-live { border-color: rgba(16, 185, 129, 0.45); }
.lab-branch.no.is-live { border-color: rgba(225, 29, 72, 0.35); }
.lab-branch.is-taken {
  border-style: solid;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.lab-branch.no.is-taken {
  border-color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.12);
}
.lab-branch.is-folded {
  opacity: 0.28;
  transform: scale(0.96);
  filter: grayscale(0.5);
}
.lab-branch-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.lab-branch.yes .lab-branch-label { color: #047857; }
.lab-branch.no .lab-branch-label { color: #be123c; }
.lab-branch-obs { font-size: 0.8rem; color: #475569; line-height: 1.35; }
.lab-tree-end-cands {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.55rem;
}
.lab-end-chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  font-size: 0.85rem;
}
.lab-end-chip.is-winner {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}
.lab-footer-actions { margin-top: 0.15rem; }
.play-layout.is-dichotomous-lab {
  grid-template-columns: 1fr;
}
.play-layout.is-dichotomous-lab #play-left {
  display: none !important;
}

/* Pathway Presenter default — no student puzzle chrome */
.play-layout.is-pathway-presenter {
  grid-template-columns: 1fr;
}
.play-layout.is-pathway-presenter #play-left,
.play-layout.is-pathway-presenter #play-progress,
.play-layout.is-pathway-presenter .scoreboard,
.play-layout.is-pathway-presenter #play-right-head,
.play-layout.is-pathway-presenter .stage-onboard {
  display: none !important;
}
.play-layout.is-pathway-presenter .candidates-panel {
  padding: 0.75rem 0.9rem 1rem;
}
.play-layout.is-pathway-presenter #archetype-stage {
  display: block !important;
  min-height: 70vh;
}

/* Lock drag / verify / check interactions inside presenter stages */
.pathway-presenter-locked {
  --presenter-lock: 1;
}
.pathway-presenter-locked .venn-chip,
.pathway-presenter-locked .spectrum-tile,
.pathway-presenter-locked .sort-card,
.pathway-presenter-locked .seq-step,
.pathway-presenter-locked .nest-chip,
.pathway-presenter-locked .nest-box-header,
.pathway-presenter-locked .action-chip,
.pathway-presenter-locked .concept-node,
.pathway-presenter-locked .causal-node,
.pathway-presenter-locked .item-pool,
.pathway-presenter-locked .bin-drop,
.pathway-presenter-locked .venn-pool,
.pathway-presenter-locked .zone-droparea,
.pathway-presenter-locked .seq-slot,
.pathway-presenter-locked .seq-pool,
.pathway-presenter-locked .spectrum-pool,
.pathway-presenter-locked .slot-droparea,
.pathway-presenter-locked input[type="range"] {
  pointer-events: none !important;
  cursor: default !important;
}
/* Mind-map presenter: teachers may drag nodes to rearrange */
.pathway-presenter-locked .concept-web-stage .concept-node,
.pathway-presenter-locked .concept-web-stage .concept-node.is-draggable {
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none;
}
.pathway-presenter-locked .concept-web-stage .concept-node.is-dragging {
  cursor: grabbing !important;
  z-index: 8;
  opacity: 0.96;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}
.pathway-presenter-locked .causal-network-presenter .causal-node,
.pathway-presenter-locked .causal-network-presenter .causal-node.is-draggable {
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none;
}
.pathway-presenter-locked .causal-network-presenter .causal-node.is-dragging {
  cursor: grabbing !important;
  z-index: 8;
}
/* Teacher edit chrome + resize */
.presenter-edit-text-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(32rem, 94vw);
  width: 100%;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}
.presenter-edit-text-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.pe-text-form {
  padding: 1.1rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pe-text-form h3 {
  margin: 0;
  font-size: 1.1rem;
}
.pe-text-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}
.pe-text-field select {
  font: inherit;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
}
.pe-text-field textarea {
  font: inherit;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  resize: vertical;
  min-height: 2.5rem;
}
.pe-text-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.25rem;
}
.pathway-presenter-locked .presenter-edit-chrome,
.pathway-presenter-locked .presenter-edit-chrome * {
  pointer-events: auto !important;
}
.pathway-presenter-locked .pe-resize-handle,
.pathway-presenter-locked .pe-resize-handle-svg {
  pointer-events: auto !important;
  cursor: nwse-resize !important;
}
.presenter-edit-chrome {
  margin: 0 0 0.65rem;
}
.presenter-edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
}
.presenter-edit-hint {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  flex: 1 1 12rem;
}
.presenter-edit-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pe-resizable {
  position: relative;
}
.pe-resize-handle {
  position: absolute;
  right: -0.2rem;
  bottom: -0.2rem;
  width: 0.85rem;
  height: 0.85rem;
  padding: 0;
  border: 2px solid #0f172a;
  border-radius: 2px;
  background: #38bdf8;
  cursor: nwse-resize;
  z-index: 12;
}
.pe-resize-handle-svg {
  fill: #38bdf8;
  stroke: #0f172a;
  stroke-width: 1.5;
}
.is-pe-selected {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}
.fc-svg-node.is-pe-selected .fc-svg-diamond,
.fc-svg-node.is-pe-selected .fc-svg-para,
.fc-svg-node.is-pe-selected .fc-svg-oval {
  stroke: #0ea5e9 !important;
  stroke-width: 3 !important;
}
/* Dichotomous flowchart: teachers may drag decision / process boxes */
.pathway-presenter-locked .fc-svg-node.is-draggable {
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none;
}
.pathway-presenter-locked .fc-svg-node.is-draggable.is-dragging {
  cursor: grabbing !important;
}
.pathway-presenter-locked .fc-zoom-controls,
.pathway-presenter-locked .fc-zoom-controls *,
.pathway-presenter-locked .pathway-presenter-chrome,
.pathway-presenter-locked .pathway-presenter-chrome * {
  pointer-events: auto !important;
  cursor: pointer;
}
.pathway-presenter-locked .pathway-step-meta,
.pathway-presenter-locked .pathway-step-meta * {
  cursor: default !important;
  pointer-events: none !important;
}
.pathway-presenter-locked .pathway-controls,
.pathway-presenter-locked .pathway-controls * {
  pointer-events: auto !important;
  cursor: pointer !important;
}
.play-layout.is-dichotomous-lab #view-toggle,
.play-layout.is-dichotomous-lab #candidate-grid,
.play-layout.is-dichotomous-lab #flowchart,
.play-layout.is-dichotomous-lab #active-test-step,
.play-layout.is-dichotomous-lab #activity-pane-tests,
.play-layout.is-dichotomous-lab .activity-tabs {
  display: none !important;
}
.play-layout.is-dichotomous-lab #activity-pane-log {
  display: none !important;
}
.play-layout.is-dichotomous-lab #play-right-head {
  display: none !important;
}
.play-layout.is-dichotomous-lab .candidates-panel {
  padding: 0.75rem 0.9rem 1rem;
}
.play-layout.is-dichotomous-lab #archetype-stage {
  display: block !important;
  min-height: 70vh;
}

/* Dichotomous presentation header (title + steps) */
.lab-presentation-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: linear-gradient(135deg, #ecfdf5, #f8fafc);
}
.lab-presentation-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  font-weight: 750;
  color: #0f172a;
  line-height: 1.3;
  max-width: 42rem;
}
.lab-presentation-subtitle {
  margin: 0;
  color: #334155;
  font-size: 1.02rem;
  line-height: 1.45;
  font-weight: 550;
  max-width: 40rem;
}
.lab-step-outline {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  max-width: 48rem;
}
.lab-step-outline li {
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.4;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.lab-step-outline li.is-current {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
  font-weight: 650;
}
.lab-step-index {
  font-weight: 700;
  color: #047857;
  margin-right: 0.25rem;
}
.lab-presentation-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.75rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  width: 100%;
}
.lab-steps-below {
  margin-top: 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
}
.lab-steps-heading {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.fc-chart-toolbar {
  justify-content: flex-end;
}


/* Classic dichotomous flowchart — full key dimmed; path lights on Yes/No */


/* —— Classic flowchart stage (SVG shapes: oval / diamond / parallelogram) —— */
.fc-chart-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.45rem;
}
.fc-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
}
.fc-node-drag-hint {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}
.fc-svg-node.is-draggable {
  cursor: grab;
  touch-action: none;
}
.fc-svg-node.is-draggable .fc-fo {
  pointer-events: none;
}
.fc-svg-node.is-draggable.is-dragging {
  cursor: grabbing;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.2));
}
.fc-svg-node.is-draggable.is-dragging .fc-svg-diamond,
.fc-svg-node.is-draggable.is-dragging .fc-svg-para,
.fc-svg-node.is-draggable.is-dragging .fc-svg-oval {
  stroke-width: 2.5;
}
.fc-chart-toolbar .fc-diagram-hint {
  flex: 1 1 14rem;
  margin: 0;
  font-size: 0.82rem;
}
.fc-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.2rem;
  border-radius: 0.65rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.fc-zoom-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.fc-zoom-btn:hover:not(:disabled) {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}
.fc-zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.fc-zoom-fit {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.fc-zoom-pct {
  min-width: 3.1rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #334155;
}
.fc-chart-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: min(58vh, 36rem);
  max-height: min(72vh, 48rem);
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.2) 1px, transparent 0);
  background-size: 16px 16px;
  background-color: #f8fafc;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.fc-chart-viewport.is-panning {
  cursor: grabbing;
}
.fc-chart-viewport.is-panning * {
  cursor: grabbing !important;
}
.fc-chart-scaler {
  position: relative;
  margin: 0 auto;
}
.fc-chart-stage {
  position: relative;
  transform-origin: 0 0;
  background: transparent;
  border: none;
  border-radius: 0;
}
.fc-chart-svg {
  display: block;
  overflow: visible;
}
.fc-svg-path {
  fill: none;
  stroke: #64748b;
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.fc-svg-edge.is-on-path .fc-svg-path {
  stroke: #059669;
  stroke-width: 2.75;
}
.fc-svg-oval {
  fill: #e0f2fe;
  stroke: #0284c7;
  stroke-width: 2.5;
}
.fc-svg-start.is-on-path .fc-svg-oval {
  filter: drop-shadow(0 0 0.35rem rgba(2, 132, 199, 0.35));
}
.fc-svg-diamond {
  fill: #faf5ff;
  stroke: #7c3aed;
  stroke-width: 2.5;
}
.fc-svg-decision.is-on-path .fc-svg-diamond {
  fill: #ecfdf5;
  stroke: #059669;
}
.fc-svg-decision.is-active .fc-svg-diamond {
  fill: #d1fae5;
  stroke: #047857;
  filter: drop-shadow(0 0 0.45rem rgba(16, 185, 129, 0.45));
}
.fc-svg-para {
  fill: #ecfdf5;
  stroke: #047857;
  stroke-width: 2.5;
}
.fc-svg-leaf.is-on-path .fc-svg-para,
.fc-svg-leaf.is-winner .fc-svg-para {
  fill: #a7f3d0;
  stroke: #047857;
}
.fc-svg-leaf.is-elim .fc-svg-para {
  opacity: 0.55;
}
.fc-svg-node-text {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
  fill: #0f172a;
  pointer-events: none;
}
.fc-svg-badge {
  fill: #ecfdf5;
  stroke: #059669;
  stroke-width: 1.5;
}
.fc-svg-badge.is-no {
  fill: #fff1f2;
  stroke: #e11d48;
}
.fc-svg-badge.is-hot {
  stroke-width: 2.25;
  filter: drop-shadow(0 0 0.25rem rgba(16, 185, 129, 0.35));
}
.fc-svg-label {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  fill: #047857;
  pointer-events: none;
}
.fc-svg-label.no { fill: #be123c; }
.fc-fo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  overflow: hidden;
  pointer-events: none;
  box-sizing: border-box;
}
.fc-fo-decision {
  padding: 0.15rem 0.25rem;
  font-size: 0.76rem;
  hyphens: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.fc-fo-leaf {
  font-size: 0.8rem;
  padding: 0.15rem 0.2rem;
  overflow-wrap: anywhere;
}
.fc-fo .katex { font-size: 0.92em; }
.fc-measure {
  display: block !important;
  width: 100%;
  height: auto !important;
  text-align: center;
  font-weight: 700;
  line-height: 1.25;
  overflow: visible !important;
}
.fc-chart-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fc-chart-ui .fc-chart-yn {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  z-index: 4;
}
.fc-chart-ui .fc-chart-yn:hover { transform: translateY(-1px); }
.fc-chart-ui .fc-chart-yn.yes {
  border-color: rgba(16, 185, 129, 0.55);
  background: #ecfdf5;
}
.fc-chart-ui .fc-chart-yn.no {
  border-color: rgba(225, 29, 72, 0.45);
  background: #fff1f2;
}
.fc-chart-ui .yn-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fc-chart-ui .fc-chart-yn.yes .yn-tag { color: #047857; }
.fc-chart-ui .fc-chart-yn.no .yn-tag { color: #be123c; }
.fc-chart-ui .yn-obs {
  font-size: 0.7rem;
  line-height: 1.3;
  color: #334155;
}
.fc-legend { margin-bottom: 0.65rem; }


.key-flowchart {
  overflow: hidden;
  padding: 0.65rem 0.5rem 0.85rem;
}
.fc-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}
.fc-diagram-hint {
  align-self: stretch;
  margin: 0 0 0.65rem;
  text-align: center;
}
.fc-legend { margin-bottom: 0.75rem; }
.fc-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: opacity 0.35s ease, filter 0.35s ease, box-shadow 0.25s ease;
}
/* Full flowchart stays readable — no heavy dimming */
.fc-diagram.is-fullmap .fc-node,
.fc-diagram.is-fullmap .fc-arm,
.fc-diagram.is-fullmap .fc-flowline {
  opacity: 1;
  filter: none;
}
.fc-arm.is-choosable {
  opacity: 1 !important;
  filter: none !important;
}
.fc-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.55rem 0.75rem;
  border-radius: 0.85rem;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.fc-choice-yes {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}
.fc-choice-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.16);
}
.fc-choice-no {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.06);
}
.fc-choice-no:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(225, 29, 72, 0.18);
  background: rgba(225, 29, 72, 0.12);
}
.fc-choice.is-pressed { transform: scale(0.98); opacity: 0.9; }
.fc-choice .fc-flowline { margin: 0; }
.fc-choice-obs {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #334155;
  max-width: 15rem;
}
.fc-choice-cta {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #047857;
}
.fc-choice-no .fc-choice-cta { color: #be123c; }
.fc-choice-subtree.is-preview { display: none; }
.fc-decision.is-active {
  scroll-margin: 4rem;
}
.fc-diamond.is-clickable-target .flow-diamond-box {
  animation: fcPulse 1.6s ease-in-out infinite;
}
@keyframes fcPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.12); }
}
.lab-click-chart-hint { margin: 0.35rem 0 0; }

.fc-diagram.is-solution .fc-arm {
  opacity: 1;
  filter: none;
  border-color: #e2e8f0;
  background: #fff;
}
.fc-arm.is-not-taken {
  opacity: 0.78;
  border-style: dashed;
}
.fc-node.is-on-path > .fc-diamond .flow-diamond-box,
.fc-start.is-on-path .flow-oval,
.fc-leaf.is-on-path > .flow-para {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28);
}
.fc-arm.is-taken {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
  border-style: solid;
}
.fc-arm.no.is-taken {
  border-color: rgba(225, 29, 72, 0.35);
  background: rgba(225, 29, 72, 0.05);
}
.fc-flowline.is-on-path .fc-flowline-shaft {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
.fc-flowline.is-on-path .fc-arrow-head { border-top-color: #10b981; }
.fc-arm.no .fc-flowline.is-on-path .fc-flowline-shaft {
  background: #e11d48;
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.25);
}
.fc-arm.no .fc-flowline.is-on-path .fc-arrow-head { border-top-color: #e11d48; }
.fc-decision.is-active .fc-diamond .flow-diamond-box {
  background: #ecfdf5;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}
.fc-start.is-on-path .flow-oval {
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}
.fc-leaf.is-winner .flow-para,
.fc-leaf.is-on-path.is-winner .fc-outcome {
  border-color: #059669;
  background: #d1fae5;
}
.fc-leaf.is-elim .flow-para {
  opacity: 0.7;
  text-decoration: line-through;
}
.fc-diamond {
  width: min(26rem, 96%);
  margin: 0.15rem 0;
  cursor: default;
}
.fc-diamond .flow-diamond-box {
  pointer-events: none;
}
.fc-outcome {
  min-width: 6.5rem;
  max-width: 11rem;
  margin: 0.2rem auto;
}
.fc-flowline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0.2rem 0 0.35rem;
  transition: opacity 0.35s ease;
}
/* dim disabled for fullmap learning */
.fc-flowline.is-dim { opacity: 1; }
/* Fullmap: entire distinguish key stays readable for learning */
.fc-diagram.is-fullmap .fc-node,
.fc-diagram.is-fullmap .fc-arm,
.fc-diagram.is-fullmap .fc-flowline {
  opacity: 1;
  filter: none;
}
.fc-arm.is-not-taken {
  /* still readable — only a soft cue that this branch was not chosen */
  opacity: 0.72;
  border-style: dashed;
}
.fc-node.is-on-path > .flow-diamond .flow-diamond-box,
.fc-node.is-on-path > .flow-oval,
.fc-leaf.is-on-path > .flow-para {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28);
}
.fc-arm.is-taken {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
  border-style: solid;
}
.fc-arm.no.is-taken {
  border-color: rgba(225, 29, 72, 0.35);
  background: rgba(225, 29, 72, 0.05);
}
.fc-flowline.is-lit { opacity: 1; }
.fc-flowline-shaft {
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: #94a3b8;
}
.fc-flowline.is-lit .fc-flowline-shaft {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
.fc-flowline-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
.fc-arm.no .fc-flowline-label {
  color: #be123c;
  background: #fff1f2;
  border-color: rgba(225, 29, 72, 0.3);
}
.fc-arrow-head {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #94a3b8;
}
.fc-flowline.is-lit .fc-arrow-head { border-top-color: #10b981; }
.fc-arm.no .fc-flowline.is-lit .fc-arrow-head { border-top-color: #e11d48; }
.fc-arm.no .fc-flowline.is-lit .fc-flowline-shaft {
  background: #e11d48;
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.25);
}
.fc-fork {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
  width: 100%;
  margin-top: 0.25rem;
  align-items: start;
}
@media (max-width: 720px) {
  .fc-fork { grid-template-columns: 1fr; }
}
.fc-arm {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0.35rem 0.4rem 0.55rem;
  border-radius: 0.75rem;
  border: 1px dashed transparent;
  transition: opacity 0.35s ease, filter 0.35s ease, background 0.25s ease, border-color 0.25s ease;
}
.fc-arm.is-lit {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.04);
}
.fc-arm.no.is-lit {
  border-color: rgba(225, 29, 72, 0.28);
  background: rgba(225, 29, 72, 0.03);
}
.fc-obs {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #475569;
  text-align: center;
  max-width: 16rem;
}

.fc-arm.is-choosable {
  opacity: 1 !important;
  filter: none !important;
}
.fc-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.55rem 0.75rem;
  border-radius: 0.85rem;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.fc-choice-yes {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}
.fc-choice-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.16);
}
.fc-choice-no {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.06);
}
.fc-choice-no:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(225, 29, 72, 0.18);
  background: rgba(225, 29, 72, 0.12);
}
.fc-choice.is-pressed { transform: scale(0.98); opacity: 0.9; }
.fc-choice .fc-flowline { margin: 0; }
.fc-choice-obs {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #334155;
  max-width: 15rem;
}
.fc-choice-cta {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #047857;
}
.fc-choice-no .fc-choice-cta { color: #be123c; }
.fc-choice-subtree.is-preview { display: none; }
.fc-decision.is-active {
  scroll-margin: 4rem;
}
.fc-diamond.is-clickable-target .flow-diamond-box {
  animation: fcPulse 1.6s ease-in-out infinite;
}
@keyframes fcPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.12); }
}
.lab-click-chart-hint { margin: 0.35rem 0 0; }

.fc-diagram.is-solution .fc-arm {
  opacity: 1;
  filter: none;
  border-color: #e2e8f0;
  background: #fff;
}

.play-layout.is-dichotomous-lab #archetype-instructions {
  display: none !important;
}

/* Teacher solution actions */
.teacher-solution-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.35rem;
  max-width: 100%;
}
.teacher-solution-actions .btn {
  min-height: 2rem;
  min-width: 0;
}
.spectrum-actions .teacher-solution-actions,
.sort-actions .teacher-solution-actions,
.causal-actions .teacher-solution-actions,
.nest-actions .teacher-solution-actions,
.transform-actions .teacher-solution-actions,
.concept-actions .teacher-solution-actions,
.venn-actions .teacher-solution-actions {
  margin-top: 0;
  width: 100%;
}
.candidate-card.solution-highlight {
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.45);
}

/* Teacher solution: show the archetype diagram, hide tip / howto text dumps */
body.solution-revealed .why-list,
body.solution-revealed #dichotomous-tips,
body.solution-revealed .flow-howto,
body.solution-revealed .flow-toolbar,
body.solution-revealed .flow-shape-legend,
body.solution-revealed .flow-palette,
body.solution-revealed .flow-edge-tools,
body.solution-revealed .explain-empty-hint {
  display: none !important;
}

body.solution-revealed .flow-node.solution-highlight,
body.solution-revealed .flow-node.candidate {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

/* Print answer sheet — hidden on screen */
.print-answer-sheet {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 12mm 14mm;
  }

  html, body {
    background: #fff !important;
    color: #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide the live app shell; print sheet lives outside #app */
  body.is-printing-answers #app,
  body.is-printing-answers .sample-gallery,
  body.is-printing-answers .share-modal,
  body.is-printing-answers .misconception-toast,
  body.is-printing-answers dialog {
    display: none !important;
  }

  body.is-printing-answers .print-answer-sheet {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #0f172a;
    font-size: 11pt;
    line-height: 1.45;
    background: #fff !important;
  }

  /* Zoom/pan viewport must not clip the chart when printing a live clone */
  .print-stage-clone .fc-chart-viewport,
  .print-stage-clone .flowchart-tree-canvas,
  .print-stage-clone .key-flowchart,
  .print-flowchart-frame {
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    transform: none !important;
    border: none !important;
    background: #fff !important;
    cursor: default !important;
    touch-action: auto !important;
  }
  .print-stage-clone .fc-chart-stage,
  .print-stage-clone .fc-chart-scaler {
    transform: none !important;
    width: auto !important;
    height: auto !important;
  }
  .print-flowchart-frame,
  .print-stage-frame .fc-print-svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  .fc-print-svg {
    background: #f8fafc !important;
  }
  .fc-print-fo-text,
  .print-answer-sheet .fc-svg-node-text {
    fill: #0f172a !important;
    font-size: 11px;
    font-weight: 700;
    font-family: system-ui, sans-serif;
  }
  .print-answer-sheet .fc-svg-diamond {
    fill: #faf5ff !important;
    stroke: #6d28d9 !important;
  }
  .print-answer-sheet .fc-svg-para {
    fill: #ecfdf5 !important;
    stroke: #047857 !important;
  }
  .print-answer-sheet .fc-svg-oval {
    fill: #e0f2fe !important;
    stroke: #0284c7 !important;
  }
  .print-answer-sheet .fc-svg-path {
    stroke: #475569 !important;
  }
  .print-answer-sheet .fc-svg-edge.is-on-path .fc-svg-path {
    stroke: #047857 !important;
  }

  .print-sheet-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 0.65rem;
    margin-bottom: 1rem;
  }
  .print-brand {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
  }
  .print-sheet-header h1 {
    margin: 0.2rem 0;
    font-size: 1.45rem;
    font-family: var(--font-display, Georgia, serif);
  }
  .print-meta, .print-sub {
    margin: 0.15rem 0;
    color: #475569;
    font-size: 0.9rem;
  }
  .print-visual {
    margin: 1rem 0 1.25rem;
  }
  .print-answers {
    break-inside: auto;
    page-break-inside: auto;
    margin: 1rem 0 1.25rem;
  }
  .print-visual h2,
  .print-answers h2,
  .print-block h3 {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
    font-family: var(--font-display, Georgia, serif);
  }
  .print-stage-frame {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.5rem;
    overflow: visible;
    background: #f8fafc !important;
  }
  .print-stage-clone,
  #print-stage-clone {
    transform: none;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    background: #f8fafc !important;
    color: #0f172a !important;
  }
  .print-stage-clone {
    color: #0f172a !important;
    text-shadow: none !important;
  }
  /* Force readable ink on white paper (stages are often light-on-dark on screen) */
  .print-stage-clone *:not(svg):not(path):not(line):not(circle):not(rect) {
    color: #0f172a !important;
    text-shadow: none !important;
  }
  .print-answer-sheet .katex,
  .print-stage-clone .katex,
  .print-answer-sheet .katex *,
  .print-stage-clone .katex * {
    color: #0f172a !important;
    border-color: currentColor !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-answer-sheet .katex,
  .print-stage-clone .katex {
    font-size: 1.05em;
  }
  .print-answer-sheet .formula-text,
  .print-answers .formula-text {
    color: #0f172a;
  }
  .print-stage-clone .flow-canvas,
  .print-stage-clone .causal-canvas,
  .print-stage-clone .concept-canvas,
  .print-stage-clone .venn-board,
  .print-stage-clone .bins-board,
  .print-stage-clone .nest-board,
  .print-stage-clone .spectrum-track,
  .print-stage-clone .pipeline-list,
  .print-stage-clone .transform-lab,
  .print-stage-clone .flow-node,
  .print-stage-clone .candidate-card,
  .print-stage-clone .bin-zone,
  .print-stage-clone .spectrum-tile,
  .print-stage-clone .pipeline-step {
    background: #fff !important;
    border: 1px solid #94a3b8 !important;
    color: #0f172a !important;
  }
  .print-stage-clone svg path.ok,
  .print-stage-clone .flow-svg path.ok {
    stroke: #0f766e !important;
  }
  .print-stage-clone svg path.bad {
    stroke: #b91c1c !important;
  }
  .print-answers ul,
  .print-answers ol {
    margin: 0.25rem 0 0.75rem;
    padding-left: 1.2rem;
  }
  .print-answers li {
    margin: 0.28rem 0;
  }
  .print-block {
    margin-bottom: 0.85rem;
  }
  .print-sheet-footer {
    margin-top: 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #cbd5e1;
    font-size: 0.75rem;
    color: #64748b;
  }
}

/* PRD v2 — presentation, live, community, wizard, worksheets */
body.presentation-mode .topbar,
body.presentation-mode #sample-gallery,
body.presentation-mode .play-left-head .panel-head-actions,
body.presentation-mode .play-left-head .reset-inline,
body.presentation-mode #live-from-play-btn,
body.presentation-mode #play-progress,
body.presentation-mode .scoreboard,
body.presentation-mode .mode-toggle,
body.presentation-mode .lang-switch,
body.presentation-mode .admin-link,
body.presentation-mode .pathway-presenter-chrome,
body.presentation-mode .presenter-edit-chrome,
body.presentation-mode .lab-steps-below,
body.presentation-mode .fc-chart-toolbar,
body.presentation-mode .fc-zoom-controls,
body.presentation-mode .candidates-panel > .panel-head,
body.presentation-mode #play-right-head,
body.presentation-mode .stage-onboard,
body.presentation-mode .lab-presentation-legend,
body.presentation-mode .nest-chart-legend,
body.presentation-mode .simdiff-legend-bar {
  display: none !important;
}
body.presentation-mode .play-layout {
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
body.presentation-mode #play-left { display: none; }
body.presentation-mode .app-shell,
body.presentation-mode main,
body.presentation-mode #play-view,
body.presentation-mode .candidates-panel,
body.presentation-mode .play-right {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  max-width: none !important;
  background: #f8fafc;
}
body.presentation-mode #archetype-stage,
body.presentation-mode .pathway-presenter-locked {
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0.65rem 0.85rem 3.5rem !important;
}
body.presentation-mode .presentation-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 3.5rem);
  gap: 0.5rem;
}
body.presentation-mode .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
  flex-shrink: 0;
}
body.presentation-mode .lab-presentation-title {
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
}
body.presentation-mode .lab-presentation-subtitle {
  font-size: 0.95rem;
}
body.presentation-mode .presentation-stage,
body.presentation-mode .presentation-stage-inner,
body.presentation-mode .dichotomous-lab-wrapper,
body.presentation-mode .dichotomous-main-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.presentation-mode .fc-chart-viewport,
body.presentation-mode .concept-web-stage,
body.presentation-mode .causal-network-stage,
body.presentation-mode .nest-circle-stage,
body.presentation-mode .simdiff-wrap,
body.presentation-mode .venn-wrap,
body.presentation-mode .spectrum-container,
body.presentation-mode .seq-wrap,
body.presentation-mode .process-stage {
  flex: 1 1 auto;
  min-height: min(78vh, 900px);
}

/* Floating exit control */
.presentation-exit-bar {
  position: fixed;
  z-index: 10050;
  right: 0.85rem;
  bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
}
.presentation-exit-bar .presentation-exit-btn {
  color: #0f172a;
  background: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 650;
}
.presentation-exit-hint {
  font-size: 0.72rem;
  opacity: 0.85;
  padding-right: 0.45rem;
  white-space: nowrap;
}
body:not(.presentation-mode) .presentation-exit-bar {
  display: none !important;
}

/* Teaching hover: raise + tip */
.presentation-tip {
  position: fixed;
  z-index: 10060;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.7rem 0.85rem 0.55rem;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.35);
  pointer-events: none;
  animation: present-tip-in 140ms ease-out;
}
.presentation-tip.is-soft {
  opacity: 0.97;
}
.presentation-tip-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #a7f3d0;
}
.presentation-tip-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}
.presentation-tip-foot {
  margin: 0.4rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}
@keyframes present-tip-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

body.presentation-mode .pathway-presenter-locked .venn-chip,
body.presentation-mode .pathway-presenter-locked .trait-card,
body.presentation-mode .pathway-presenter-locked .spectrum-tile,
body.presentation-mode .pathway-presenter-locked .seq-step,
body.presentation-mode .pathway-presenter-locked .pipeline-step,
body.presentation-mode .pathway-presenter-locked .sort-card,
body.presentation-mode .pathway-presenter-locked .nest-orb,
body.presentation-mode .pathway-presenter-locked .nest-chip,
body.presentation-mode .pathway-presenter-locked .nest-leaf,
body.presentation-mode .pathway-presenter-locked .causal-node,
body.presentation-mode .pathway-presenter-locked .concept-node,
body.presentation-mode .pathway-presenter-locked .simdiff-item,
body.presentation-mode .pathway-presenter-locked .action-chip,
body.presentation-mode .pathway-presenter-locked .baseline-card,
body.presentation-mode .pathway-presenter-locked .trial-card,
body.presentation-mode .pathway-presenter-locked .chip {
  pointer-events: auto !important;
  cursor: pointer !important;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
body.presentation-mode .pathway-presenter-locked .fc-svg-node {
  pointer-events: auto !important;
  cursor: pointer !important;
  transition: filter 160ms ease;
}
body.presentation-mode .is-present-hover.venn-chip,
body.presentation-mode .is-present-hover.trait-card,
body.presentation-mode .is-present-hover.spectrum-tile,
body.presentation-mode .is-present-hover.seq-step,
body.presentation-mode .is-present-hover.pipeline-step,
body.presentation-mode .is-present-hover.sort-card,
body.presentation-mode .is-present-hover.nest-orb,
body.presentation-mode .is-present-hover.nest-chip,
body.presentation-mode .is-present-hover.nest-leaf,
body.presentation-mode .is-present-hover.causal-node,
body.presentation-mode .is-present-hover.concept-node,
body.presentation-mode .is-present-hover.simdiff-item,
body.presentation-mode .is-present-hover.action-chip,
body.presentation-mode .is-present-hover.baseline-card,
body.presentation-mode .is-present-hover.trial-card,
body.presentation-mode .is-present-hover.chip {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
  z-index: 6;
  position: relative;
  filter: brightness(1.03);
}
body.presentation-mode .fc-svg-node.is-present-hover {
  filter: drop-shadow(0 10px 14px rgba(15, 23, 42, 0.28)) brightness(1.05);
}

@media (prefers-reduced-motion: reduce) {
  body.presentation-mode .is-present-hover,
  .presentation-tip {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

body.presentation-mode .simdiff-tip,
body.presentation-mode .why-list,
body.presentation-mode .explain-heading,
body.presentation-mode .explain-empty-hint {
  display: none !important;
}

.live-pin-display {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  margin: 0.5rem 0 1rem;
}
.live-heatmap { margin: 0.75rem 0; min-height: 3rem; }
.live-heatmap ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.join-layout {
  max-width: 520px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.join-choices { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.75rem; }
.join-choice { min-width: 7rem; }
.community-layout { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.diagram-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  width: 100%;
  height: calc(100dvh - 5.5rem);
}
.diagram-studio-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 5.5rem);
  border: 0;
  border-radius: 1rem;
  background: transparent;
}
.community-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.community-toolbar input,
.community-toolbar select { min-height: 44px; }
.community-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}
.community-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: #fff;
}
.community-card h4 { margin: 0 0 0.35rem; }
.wizard-actions { margin: 0.75rem 0; }
.wizard-extract-panel {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.wizard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 720px) {
  .wizard-grid { grid-template-columns: 1fr; }
}
.join-step-focus {
  margin: 0.85rem 0 1rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: linear-gradient(160deg, #ecfdf5 0%, #f8fafc 70%);
  border: 1px solid #bbf7d0;
}
.join-focus-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #047857;
  font-weight: 700;
}
.join-focus-title {
  margin: 0;
  font-size: 1.25rem;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
}
.join-focus-detail { margin: 0.45rem 0 0; }
.join-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.ws-blank, .ws-box {
  margin-top: 0.35rem;
  min-height: 2rem;
  border: 1.5px dashed #94a3b8;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.ws-box.tall { min-height: 6rem; }
.ws-cutouts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.ws-chip {
  display: inline-block;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  background: #f8fafc;
}
.ws-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.75rem 0; }
.print-page-break { break-before: page; page-break-before: always; }

/* Pathway Presenter shell */
.pathway-presenter-chrome {
  margin-bottom: 0.85rem;
}
.pathway-presenter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.pathway-presenter-bar--controls {
  align-items: center;
}
.pathway-presenter-bar--controls .pathway-step-meta {
  flex: 0 0 auto;
}
.pathway-step-meta { flex: 1 1 220px; min-width: 0; }
.presentation-shell {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}
.presentation-stage {
  min-width: 0;
}
.presentation-stage-inner {
  min-width: 0;
}
/* Presenter: single-column timeline / filled visual */
.presentation-shell .seq-board {
  grid-template-columns: 1fr;
}
.presentation-shell .seq-pool-col,
.presentation-shell .trait-pool-section {
  display: none !important;
}
.presentation-shell .seq-col-title,
.presentation-shell .seq-col-hint,
.presentation-shell .seq-wrap > .hint {
  display: none !important;
}
/* Timeline & Process — centered, larger step copy */
.presentation-shell .seq-presenter,
.presentation-shell .seq-timeline {
  max-width: 42rem;
  margin-inline: auto;
  width: 100%;
}
.presentation-shell .seq-presenter .pipeline-stage::before {
  left: 2.25rem;
  transform: none;
  display: block;
}
.presentation-shell .seq-presenter .pipeline-slot {
  grid-template-columns: 4.5rem 1fr;
  justify-items: stretch;
  align-items: stretch;
  text-align: left;
  gap: 0.75rem;
}
.presentation-shell .seq-presenter .pipeline-slot-index {
  margin-top: 0.35rem;
  width: 4.5rem;
  min-width: 4.5rem;
  font-size: 0.78rem;
  align-self: center;
}
.presentation-shell .seq-presenter .pipeline-slot-drop {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.presentation-shell .seq-presenter .seq-slot-placeholder {
  display: none !important;
}
.presentation-shell .seq-presenter .pipeline-step {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  padding: 1.1rem 1.35rem;
  box-shadow: none;
  width: 100%;
  text-align: center;
}
.presentation-shell .seq-presenter .pipeline-grip {
  display: none;
}
.presentation-shell .seq-presenter .pipeline-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.presentation-shell .seq-presenter .pipeline-body .name,
.presentation-shell .seq-presenter .pipeline-body .hint,
.presentation-shell .seq-presenter .pipeline-body .formula-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center !important;
  width: 100%;
  margin-inline: auto;
}
.presentation-shell .seq-presenter .pipeline-body .hint {
  font-size: 1.05rem;
  font-weight: 550;
  margin-top: 0.25rem;
}
.presentation-shell:has(.seq-presenter) .lab-step-outline {
  max-width: 42rem;
  margin-inline: auto;
  text-align: center;
  list-style: none;
  padding: 0;
}
.presentation-shell:has(.seq-presenter) .lab-step-outline li {
  font-size: 1.15rem;
  line-height: 1.45;
  justify-content: center;
}
.presentation-shell .seq-actions,
.presentation-shell .venn-actions,
.presentation-shell .spectrum-actions,
.presentation-shell .sort-actions,
.presentation-shell .nest-actions,
.presentation-shell .causal-actions,
.presentation-shell .transform-actions,
.presentation-shell .concept-actions,
.presentation-shell .teacher-solution-actions,
.presentation-shell .explain-heading,
.presentation-shell .explain-empty-hint,
.presentation-shell .why-list {
  display: none !important;
}
/* Concept / Mind Map presenter — hub web (not drag-palette columns) */
.presentation-shell:has(.concept-presenter) {
  gap: 0.55rem;
}
.presentation-shell:has(.concept-presenter) .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
}
.presentation-shell:has(.concept-presenter) .lab-presentation-title {
  max-width: none;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
}
.presentation-shell:has(.concept-presenter) .lab-presentation-subtitle {
  max-width: 52rem;
}
.presentation-shell:has(.concept-presenter) .lab-step-outline {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.35rem 0.75rem;
}
.presentation-shell:has(.concept-presenter) .lab-step-outline li {
  font-size: 0.9rem;
  padding: 0.3rem 0.45rem;
}
.presentation-shell .concept-wrap.concept-presenter,
.presentation-shell .concept-presenter {
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0.55rem;
}
.presentation-shell .concept-palette-panel,
.presentation-shell .concept-wrap > .hint,
.presentation-shell .concept-map-wrapper > .hint {
  display: none !important;
}
.concept-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  justify-content: center;
  align-items: center;
}
.concept-leg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}
.concept-leg::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.25rem;
  border: 2px solid currentColor;
  background: currentColor;
  opacity: 0.35;
}
.concept-leg-structure { color: #047857; }
.concept-leg-structure::before { background: #ecfdf5; opacity: 1; border-color: #059669; }
.concept-leg-process { color: #0369a1; }
.concept-leg-process::before { background: #f0f9ff; opacity: 1; border-color: #0284c7; }
.concept-leg-molecule { color: #7e22ce; }
.concept-leg-molecule::before { background: #faf5ff; opacity: 1; border-color: #a855f7; }
.concept-leg-factor { color: #b45309; }
.concept-leg-factor::before { background: #fffbeb; opacity: 1; border-color: #f59e0b; }

.concept-web-stage {
  position: relative;
  width: 100%;
  max-height: min(68vh, 40rem);
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(14, 165, 233, 0.07), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.concept-web-stage .concept-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.concept-nodes-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.concept-web-stage .concept-node {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.12rem;
  padding: 0.45rem 0.55rem;
  margin: 0;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.concept-web-stage .concept-node:hover {
  transform: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
.concept-web-stage .concept-node.is-dragging {
  cursor: grabbing;
  z-index: 8;
}
.concept-drag-hint {
  margin: 0;
  font-size: 0.78rem !important;
  font-weight: 600;
  color: #64748b;
}
.concept-web-stage .concept-node.is-root {
  border-width: 2.5px;
  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.2),
    0 10px 28px rgba(14, 165, 233, 0.14);
}
.concept-web-stage .concept-node.is-root .node-title {
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
}
.concept-web-stage .node-title {
  font-size: clamp(0.88rem, 1.35vw, 1.05rem);
  overflow-wrap: break-word;
  word-break: normal;
}
.concept-web-stage .edge-label-badge.is-presenter,
.concept-web-stage .mind-badge.is-presenter {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: 0.72rem;
  font-weight: 750;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}
.concept-web-stage .edge-label-badge.is-presenter .badge-x {
  display: none;
}
.concept-web-stage .edge-label-badge.is-dimmed,
.concept-web-stage .concept-node.is-dimmed {
  opacity: 0.28;
}
.concept-web-stage .concept-edge.is-path-lit {
  stroke: #0284c7 !important;
  stroke-width: 3.5px;
}
.concept-web-stage .edge-label-badge.is-path-lit {
  border-color: #38bdf8;
  background: #e0f2fe;
  color: #075985;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

/* Action & Result presenter — Baseline → Action → Observation trials */
.presentation-shell:has(.transform-presenter) {
  gap: 0.55rem;
}
.presentation-shell:has(.transform-presenter) .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
}
.presentation-shell:has(.transform-presenter) .lab-presentation-title {
  max-width: none;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
}
.presentation-shell:has(.transform-presenter) .lab-step-outline {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.35rem 0.75rem;
}
.presentation-shell:has(.transform-presenter) .lab-step-outline li {
  font-size: 0.88rem;
  padding: 0.3rem 0.45rem;
}
.presentation-shell .transform-wrap.transform-presenter {
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0.55rem;
}
.presentation-shell .transform-wrap > .hint,
.presentation-shell .action-palette,
.presentation-shell .lab-observations {
  display: none !important;
}
.transform-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  justify-content: center;
  align-items: center;
}
.transform-leg {
  font-size: 0.78rem;
  font-weight: 750;
  color: #475569;
}
.transform-leg-arrow { color: #94a3b8; font-weight: 700; }
.transform-leg-base { color: #0369a1; }
.transform-leg-act { color: #1d4ed8; }
.transform-leg-res { color: #b45309; }
.transform-trial-board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}
.transform-trial {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  padding: 0.85rem 1rem 0.95rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.transform-trial.is-current {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25), 0 8px 22px rgba(15, 23, 42, 0.08);
}
.transform-trial.is-dragging {
  cursor: grabbing;
  opacity: 0.92;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  z-index: 3;
}
.transform-trial-index {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.45rem;
}
.transform-trial-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.15fr);
  gap: 0.55rem 0.45rem;
  align-items: stretch;
}
@media (max-width: 820px) {
  .transform-trial-flow { grid-template-columns: 1fr; }
  .transform-trial-flow .trial-arrow { display: none; }
}
.trial-step {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  min-width: 0;
}
.trial-step .cat {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
.trial-step strong {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.98rem;
  color: #0f172a;
  line-height: 1.3;
}
.trial-step .hint {
  margin: 0;
  font-size: 0.78rem !important;
  color: #64748b;
}
.trial-step .placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
}
.trial-baseline { border-color: rgba(14, 165, 233, 0.35); background: #f0f9ff; }
.trial-baseline .cat { color: #0369a1; }
.trial-action { border-color: rgba(37, 99, 235, 0.35); background: #eff6ff; }
.trial-action .cat { color: #1d4ed8; }
.trial-result { border-color: rgba(245, 158, 11, 0.4); background: #fffbeb; }
.trial-result .cat { color: #b45309; }
.trial-step.is-empty { opacity: 0.55; border-style: dashed; }
.trial-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #64748b;
  padding: 0 0.1rem;
}
.transform-trial-tip {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: #065f46;
  font-size: 0.88rem;
  line-height: 1.4;
}
.pathway-presenter-locked .transform-trial {
  pointer-events: auto !important;
  cursor: grab !important;
}

/* Spectrum presenter — full-width cards + axis footer with trend arrow */
.presentation-shell .spectrum-pool-panel,
.presentation-shell .spectrum-label,
.presentation-shell .spectrum-toolbar,
.presentation-shell .spectrum-pool-hint {
  display: none !important;
}
.presentation-shell .spectrum-wrap,
.presentation-shell .spectrum-stage-wrapper,
.presentation-shell .spectrum-wrap.spectrum-full {
  max-width: none;
  width: 100%;
  margin: 0;
}
.presentation-shell .spectrum-rail-presenter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.15rem;
  width: 100%;
  max-width: none;
  padding: 1.35rem 1.25rem 1.45rem;
}
.presentation-shell .spectrum-rail-presenter .spectrum-track-wrapper {
  width: 100%;
  flex: none;
  padding: 0.85rem 0.15rem 0.25rem;
}
.presentation-shell .spectrum-rail-presenter .track-gradient-line {
  height: 14px;
  top: auto;
  bottom: 0.35rem;
  transform: none;
}
.presentation-shell .spectrum-rail-presenter .track-slots-grid {
  width: 100%;
  gap: 0.55rem;
}
.presentation-shell .spectrum-rail-presenter .spectrum-slot {
  width: 100%;
}
.presentation-shell .spectrum-rail-presenter .slot-droparea {
  max-width: none;
  width: 100%;
  min-height: 7.5rem;
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.35);
  padding: 0.35rem;
}
.presentation-shell .spectrum-rail-presenter .element-chip,
.presentation-shell .spectrum-rail-presenter .spectrum-tile.element-chip {
  width: 100%;
  max-width: none;
  min-width: 3.5rem;
  min-height: 6.75rem;
  padding: 0.7rem 0.45rem;
  gap: 0.35rem;
  cursor: default;
  overflow: visible;
}
.presentation-shell .spectrum-rail-presenter .element-num {
  font-size: 0.85rem;
}
.presentation-shell .spectrum-rail-presenter .element-symbol {
  width: 100%;
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  line-height: 1.3;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
}
.presentation-shell .spectrum-rail-presenter .element-oxide {
  width: 100%;
  font-size: clamp(0.72rem, 1.05vw, 0.92rem);
  line-height: 1.3;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
}
.presentation-shell .spectrum-rail-presenter .element-chip .katex,
.presentation-shell .spectrum-rail-presenter .element-oxide .katex,
.presentation-shell .spectrum-rail-presenter .element-symbol .katex {
  font-size: 1em !important;
  display: inline-block;
  max-width: 100%;
}
.presentation-shell .spectrum-rail-presenter .element-chip .base,
.presentation-shell .spectrum-rail-presenter .element-chip .mord,
.presentation-shell .spectrum-rail-presenter .element-chip .katex-html {
  white-space: nowrap !important;
}
.presentation-shell .spectrum-rail-presenter .slot-number {
  font-size: 0.85rem;
}
.presentation-shell .spectrum-axis-footer {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(8rem, 1.4fr) minmax(10rem, 1fr);
  gap: 0.85rem 1rem;
  align-items: center;
  width: 100%;
}
.presentation-shell .spectrum-axis-footer .axis-endpoint {
  width: 100%;
  max-width: none;
  align-items: stretch;
}
.presentation-shell .spectrum-axis-footer .endpoint-badge {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(0.85rem, 1.35vw, 1.05rem);
  padding: 0.55rem 0.7rem;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  text-align: center;
  line-height: 1.35;
}
.presentation-shell .spectrum-axis-footer .endpoint-sub {
  font-size: 0.88rem;
  color: #64748b;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
  line-height: 1.35;
}
.presentation-shell .spectrum-character-arrow {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}
.presentation-shell .spectrum-arrow-track {
  position: relative;
  flex: 1;
  min-height: 0.85rem;
  padding: 0;
}
.presentation-shell .spectrum-arrow-track::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  right: 0.15rem;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 35%, #f59e0b 70%, #ef4444 100%);
  z-index: 0;
}
.presentation-shell .spectrum-arrow-head {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-style: solid;
}
.presentation-shell .spectrum-arrow-head--left {
  border-width: 0.55rem 0.85rem 0.55rem 0;
  border-color: transparent #3b82f6 transparent transparent;
}
.presentation-shell .spectrum-arrow-head--right {
  border-width: 0.55rem 0 0.55rem 0.85rem;
  border-color: transparent transparent transparent #ef4444;
}
@media (max-width: 820px) {
  .presentation-shell .spectrum-rail-presenter .track-slots-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .presentation-shell .spectrum-axis-footer {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .presentation-shell .spectrum-character-arrow {
    order: 2;
  }
  .presentation-shell .spectrum-axis-footer .right-endpoint {
    order: 3;
  }
}
/* Causal presenter — full-width scaled canvas, no puzzle chrome */
.presentation-shell .causal-wrap > .hint,
.presentation-shell .causal-toolbar,
.presentation-shell .edge-list,
.presentation-shell .causal-mobile {
  display: none !important;
}
.presentation-shell:has(.causal-presenter) {
  gap: 0.55rem;
}
.presentation-shell:has(.causal-presenter) .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
}
.presentation-shell:has(.causal-presenter) .lab-step-outline {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.35rem 0.65rem;
}
.presentation-shell:has(.causal-presenter) .lab-step-outline li {
  font-size: 0.88rem;
  padding: 0.3rem 0.45rem;
}
.presentation-shell .causal-wrap,
.presentation-shell .causal-presenter {
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0.65rem;
}
.presentation-shell .causal-network-presenter {
  display: block !important;
  width: 100%;
  max-width: none;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
  padding: 0;
  aspect-ratio: auto; /* set inline from JS */
}
.presentation-shell .causal-legend-bar {
  color: #334155;
  font-size: 0.88rem;
}
.presentation-shell .causal-legend-bar .leg-primary,
.presentation-shell .causal-legend-bar .leg-secondary,
.presentation-shell .causal-legend-bar .leg-trigger,
.presentation-shell .causal-legend-bar .leg-underlying,
.presentation-shell .causal-legend-bar .leg-effect {
  color: #334155;
}
.presentation-shell .causal-network-presenter .causal-node {
  cursor: default;
  padding: 0.8rem 0.9rem;
}
.presentation-shell .causal-network-presenter .causal-node .cat {
  font-size: 0.72rem;
}
.presentation-shell .causal-network-presenter .causal-node .name {
  font-size: 1.08rem;
  line-height: 1.3;
}
.presentation-shell .causal-network-presenter .causal-node:hover {
  transform: none;
}
/* Nest presenter — light classification chart */
.presentation-shell .nest-wrap > .hint,
.presentation-shell .pool-title,
.presentation-shell .nest-pool,
.presentation-shell .item-pool.nest-pool {
  display: none !important;
}
.presentation-shell:has(.nest-presenter) {
  gap: 0.55rem;
}
.presentation-shell:has(.nest-presenter) .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
}
.presentation-shell:has(.nest-presenter) .lab-step-outline {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.35rem 0.65rem;
}
.presentation-shell:has(.nest-presenter) .lab-step-outline li {
  font-size: 0.88rem;
  padding: 0.3rem 0.45rem;
}
.presentation-shell .nest-wrap,
.presentation-shell .nest-presenter {
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0.65rem;
}
.nest-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  justify-content: center;
  align-items: center;
  font-size: 0.78rem;
}
.nest-leg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nest-leg::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.nest-leg-kingdom::before { background: #059669; }
.nest-leg-phylum::before { background: #0891b2; }
.nest-leg-class::before { background: #2563eb; }
.nest-leg-order::before { background: #d97706; }
.nest-leg-family::before { background: #ea580c; }
.nest-leg-species::before { background: #64748b; }

.nest-circle-stage {
  width: 100%;
  padding: 0.85rem 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: auto;
  max-height: min(78vh, 48rem);
}
.nest-circle-field {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  align-items: stretch;
  justify-content: stretch;
  min-height: min(52vh, 28rem);
  width: 100%;
}
.nest-circle-field--proportional > .nest-orb {
  /* width/flex set inline from subtree weight */
  width: auto;
  min-height: 100%;
}
.nest-orb {
  --orb-border: #94a3b8;
  --orb-fill: #f8fafc;
  position: relative;
  box-sizing: border-box;
  border-radius: 0.95rem;
  aspect-ratio: auto;
  min-height: 0;
  border: 2.5px solid var(--orb-border);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.95), transparent 42%),
    var(--orb-fill);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0.75rem 0.8rem 0.9rem;
  gap: 0.35rem;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 6px 16px rgba(15, 23, 42, 0.06);
}
.nest-orb-label {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  text-align: center;
  gap: 0.3rem 0.55rem;
  z-index: 2;
  max-width: 100%;
  flex-shrink: 0;
  padding: 0.15rem 0.2rem 0.4rem;
}
.nest-orb-rank {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
  line-height: 1.2;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}
.nest-orb-name {
  font-family: var(--font-display, Georgia, serif);
  font-weight: 750;
  color: #0f172a;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.nest-orb-kids {
  flex: 1 1 auto;
  width: 100%;
  min-height: 4.5rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: stretch;
  align-content: stretch;
  gap: 0.65rem;
  margin-top: 0.15rem;
}
.nest-orb-d0 {
  min-height: min(50vh, 26rem);
}
.nest-orb-d0 .nest-orb-name { font-size: clamp(1.1rem, 1.7vw, 1.45rem); }
.nest-orb-d1 {
  min-height: 12rem;
}
.nest-orb-d1 .nest-orb-name { font-size: clamp(0.98rem, 1.4vw, 1.2rem); }
.nest-orb-d2 {
  min-height: 8.5rem;
}
.nest-orb-d2 .nest-orb-name { font-size: clamp(0.9rem, 1.2vw, 1.08rem); }
.nest-orb-d3 {
  min-height: 6rem;
}
.nest-orb-d3 .nest-orb-name { font-size: 0.95rem; }
.nest-orb-d4,
.nest-orb-d5 {
  min-height: 4.25rem;
  padding: 0.65rem 0.7rem 0.75rem;
}
.nest-orb-d4 .nest-orb-name,
.nest-orb-d5 .nest-orb-name { font-size: 0.88rem; }
.nest-orb-d4 .nest-orb-rank,
.nest-orb-d5 .nest-orb-rank { font-size: 0.6rem; }
.nest-orb-leaf {
  justify-content: center;
  min-height: 4rem !important;
  padding: 0.7rem 0.75rem;
}

.nest-orb-kingdom { --orb-border: #059669; --orb-fill: #ecfdf5; }
.nest-orb-kingdom > .nest-orb-label .nest-orb-rank { color: #047857; }
.nest-orb-phylum { --orb-border: #0891b2; --orb-fill: #ecfeff; }
.nest-orb-phylum > .nest-orb-label .nest-orb-rank { color: #0e7490; }
.nest-orb-class { --orb-border: #2563eb; --orb-fill: #eff6ff; }
.nest-orb-class > .nest-orb-label .nest-orb-rank { color: #1d4ed8; }
.nest-orb-order { --orb-border: #d97706; --orb-fill: #fffbeb; }
.nest-orb-order > .nest-orb-label .nest-orb-rank { color: #b45309; }
.nest-orb-family { --orb-border: #ea580c; --orb-fill: #fff7ed; }
.nest-orb-family > .nest-orb-label .nest-orb-rank { color: #c2410c; }
.nest-orb-species { --orb-border: #475569; --orb-fill: #f8fafc; }
.nest-orb-species > .nest-orb-label .nest-orb-rank { color: #334155; }
.nest-orb-taxon { --orb-border: #6366f1; --orb-fill: #eef2ff; }

/* Single child fills parent width */
.nest-orb-kids:has(> .nest-orb:only-child) {
  flex-wrap: nowrap;
}
.nest-orb-kids:has(> .nest-orb:only-child) > .nest-orb {
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 100% !important;
  min-width: 0 !important;
}
@media (max-width: 820px) {
  .nest-circle-field {
    flex-wrap: wrap;
  }
  .nest-circle-field--proportional > .nest-orb {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .nest-orb-kids {
    flex-wrap: wrap;
  }
}
/* Venn presenter: transparent AB overlap + max one-screen diagram */
.presentation-shell:has(.venn-wrap) {
  gap: 0.55rem;
}
.presentation-shell:has(.venn-wrap) .lab-presentation-header {
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.85rem;
}
.presentation-shell:has(.venn-wrap) .lab-presentation-title {
  max-width: none;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
}
.presentation-shell:has(.venn-wrap) .lab-presentation-subtitle {
  max-width: 56rem;
}
.presentation-shell:has(.venn-wrap) .lab-steps-below {
  margin-top: 0.35rem;
}
.presentation-shell:has(.venn-wrap) .lab-step-outline {
  max-width: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.35rem 0.65rem;
}
.presentation-shell:has(.venn-wrap) .lab-step-outline li {
  font-size: 0.88rem;
  padding: 0.3rem 0.45rem;
}
.presentation-shell .venn-wrap > .hint,
.presentation-shell .venn-tap-hint {
  display: none !important;
}
.presentation-shell .venn-wrap,
.presentation-shell .venn-matrix-wrapper {
  max-width: none;
  width: 100%;
  margin: 0;
}
.presentation-shell .venn-zones-container.is-two {
  gap: 0;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: clamp(22rem, 58vh, 40rem);
}
.presentation-shell .venn-zones-container.is-two .venn-zone {
  position: relative;
  min-height: inherit;
}
.presentation-shell .venn-zones-container.is-two .zone-left {
  z-index: 1;
  margin-right: -4.5rem;
  padding-right: 5rem;
}
.presentation-shell .venn-zones-container.is-two .zone-center {
  z-index: 3;
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  /* See A/B through the AB box */
  background: rgba(124, 58, 237, 0.22) !important;
  border: 2px solid rgba(109, 40, 217, 0.55) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 12px 32px rgba(91, 33, 182, 0.16);
  backdrop-filter: none;
}
.presentation-shell .venn-zones-container.is-two .zone-right {
  z-index: 1;
  margin-left: -4.5rem;
  padding-left: 5rem;
}
.presentation-shell .venn-zones-container.is-two .zone-header,
.presentation-shell .venn-zones-container.is-two .zone-droparea {
  position: relative;
  z-index: 2;
}
.presentation-shell .venn-zones-container.is-two .zone-droparea {
  min-height: clamp(16rem, 42vh, 28rem);
  flex: 1;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(15, 23, 42, 0.12);
}
.presentation-shell .venn-zones-container.is-two .zone-center .zone-droparea {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(109, 40, 217, 0.28);
}
.presentation-shell .venn-chip,
.presentation-shell .trait-card {
  font-size: clamp(1.05rem, 1.45vw, 1.28rem);
  font-weight: 700;
  padding: 0.9rem 1.1rem;
  line-height: 1.4;
  width: 100%;
  justify-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
}
.presentation-shell .venn-chip-handle,
.presentation-shell .drag-handle,
.presentation-shell .trait-zone-tag {
  display: none;
}
.presentation-shell .venn-chip-label,
.presentation-shell .trait-text {
  font-size: inherit;
  text-align: center;
}
.presentation-shell .zone-header h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
}
.presentation-shell .zone-badge {
  font-size: 0.78rem;
  padding: 0.22rem 0.65rem;
}
@media (max-width: 860px) {
  .presentation-shell .venn-zones-container.is-two {
    gap: 0.85rem;
    min-height: 0;
  }
  .presentation-shell .venn-zones-container.is-two .zone-left,
  .presentation-shell .venn-zones-container.is-two .zone-right,
  .presentation-shell .venn-zones-container.is-two .zone-center {
    margin: 0;
    padding: 0.9rem;
    z-index: auto;
  }
  .presentation-shell .venn-zones-container.is-two .zone-center {
    background: rgba(124, 58, 237, 0.28) !important;
  }
  .presentation-shell .venn-zones-container.is-two .zone-droparea {
    min-height: 10rem;
  }
}
.pathway-step-meta { flex: 1 1 220px; min-width: 0; }
.pathway-step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.35rem;
}
.pathway-step-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
  line-height: 1.35;
}
.pathway-step-detail { margin: 0.35rem 0 0; }
.pathway-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.pathway-presenter-mode .fc-svg-node.is-pathway-dim {
  opacity: 0.28;
}
.pathway-presenter-mode .fc-svg-node.is-pathway-spotlight .fc-svg-diamond,
.pathway-presenter-mode .fc-svg-node.is-pathway-spotlight .fc-svg-oval,
.pathway-presenter-mode .fc-svg-node.is-pathway-spotlight polygon {
  stroke: #059669 !important;
  stroke-width: 3px;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.45));
}

/* Feature backlog (/features) */
.features-shell { max-width: 1200px; }
.features-intro h1 { margin: 0 0 0.4rem; }
.features-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0.85rem;
}
.features-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: flex-end;
}
.features-filters label,
.features-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.features-filters select,
.features-filters input,
.features-form input,
.features-form select,
.features-form textarea {
  min-width: 9rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}
.features-search input { min-width: 14rem; }
.features-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.features-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.features-table th,
.features-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.7rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.features-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fafc;
  position: sticky;
  top: 0;
}
.features-table .col-built,
.features-table .col-checked {
  width: 5.5rem;
  text-align: center;
}
.features-table td.col-built,
.features-table td.col-checked {
  text-align: center;
  vertical-align: middle;
}
.features-table tr.is-built td { background: #f0fdf4; }
.features-table tr.is-checked td { background: #ecfdf5; }
.feat-title { font-weight: 650; color: #0f172a; }
.feat-desc { margin-top: 0.25rem; max-width: 42rem; }
.feat-notes { margin-top: 0.2rem; font-style: italic; }
.feat-actions {
  white-space: normal;
  text-align: right;
  min-width: 6rem;
}
.feat-actions .btn {
  display: inline-flex;
  margin: 0.1rem 0 0.1rem 0.2rem;
  vertical-align: middle;
}
.btn-sm {
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
  min-height: 2rem;
  min-width: 0;
  line-height: 1.25;
}

/* Stack panel-head text above actions on narrow viewports */
@media (max-width: 720px) {
  .panel-head.row {
    flex-direction: column;
    align-items: stretch;
  }
  .panel-head-actions {
    justify-content: flex-start;
  }
  .topbar {
    align-items: flex-start;
  }
  .topbar-actions {
    width: 100%;
  }
  .features-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .features-toolbar-actions {
    justify-content: flex-start;
  }
}
.btn.danger { color: #b91c1c; }
.check-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.check-cell input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #059669;
  cursor: pointer;
}
.check-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  color: #0f172a !important;
}
.features-check-row { gap: 1.25rem; }
.prio-badge {
  display: inline-block;
  min-width: 2.2rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  background: #e2e8f0;
  color: #334155;
}
.prio-badge.prio-1 { background: #dbeafe; color: #1d4ed8; }
.prio-badge.prio-2 { background: #e2e8f0; color: #334155; }
.prio-badge.prio-3 { background: #f1f5f9; color: #64748b; }
.prio-badge.prio-9 { background: #fef3c7; color: #92400e; }
.area-chip {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}
.features-form { margin-bottom: 1rem; padding: 0.85rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }
.syllabus-badge {
  display: inline-block;
  margin: 0 0 0.35rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  vertical-align: middle;
}
.syllabus-badge.syllabus-in { background: #d1fae5; color: #065f46; }
.syllabus-badge.syllabus-out { background: #fee2e2; color: #991b1b; }
.syllabus-badge.syllabus-uncertain { background: #fef3c7; color: #92400e; }
.syllabus-note { margin: 0.25rem 0 0; font-style: italic; }

/* Similarity & Difference — triangle: similarities apex, differences base */
.simdiff-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}
.simdiff-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}
.simdiff-leg::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: -0.05rem;
}
.simdiff-leg-diff::before { background: #0ea5e9; }
.simdiff-leg-sim::before { background: #10b981; }

.simdiff-triangle {
  position: relative;
  width: 100%;
  isolation: isolate;
  filter: drop-shadow(0 12px 28px rgba(15, 23, 42, 0.08));
}
.simdiff-outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.simdiff-board {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: clamp(28rem, 64vh, 42rem);
}

.simdiff-shared {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 1.6rem clamp(18%, 22vw, 26%) 0.75rem;
  min-height: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.simdiff-shared-head {
  margin-bottom: 0.5rem;
}
.simdiff-base {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 0.15rem 1.4rem;
  align-items: start;
  padding: 0.55rem clamp(3%, 4vw, 5%) 1.5rem;
  min-height: 0;
}
.simdiff-base-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin: 0 0 0.35rem;
  z-index: 2;
}
.simdiff-base-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  letter-spacing: 0.02em;
  color: #0f172a;
  line-height: 1.15;
  text-align: center;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.15rem 0.85rem;
  border-radius: 0.55rem;
}
.simdiff-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.55rem 0.2rem 0.35rem;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.simdiff-side-left {
  padding-right: 0.85rem;
  padding-left: clamp(0.5rem, 4%, 1.4rem);
}
.simdiff-side-right {
  padding-left: 0.85rem;
  padding-right: clamp(0.5rem, 4%, 1.4rem);
}
.simdiff-side-head,
.simdiff-shared-head {
  margin-bottom: 0.5rem;
}
.simdiff-side-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}
.simdiff-side-head h3,
.simdiff-shared-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-display, Georgia, serif);
  color: #0f172a;
  line-height: 1.3;
}
.simdiff-shared-head h3 {
  font-size: 1.15rem;
  color: #047857;
}
.simdiff-leg-diff {
  font-size: 0.92rem;
  color: #0f172a;
}
.simdiff-side-left .simdiff-side-head h3 { color: #0369a1; }
.simdiff-side-right .simdiff-side-head h3 { color: #be123c; }

.simdiff-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  flex: 1;
  width: 100%;
}
.simdiff-list-shared {
  width: 100%;
  max-width: 20rem;
  margin-inline: auto;
}
.simdiff-item {
  padding: 0.62rem 0.78rem;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  gap: 0.26rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  text-align: left;
}
.simdiff-list-shared .simdiff-item {
  text-align: center;
  border-color: rgba(167, 243, 208, 0.9);
  background: rgba(255, 255, 255, 0.95);
}
.simdiff-item.is-current {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
  transform: translateY(-1px);
}
.simdiff-item .formula-text {
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.4;
  color: #0f172a;
}
.simdiff-tip {
  font-size: 0.78rem;
  font-weight: 550;
  color: #475569;
  line-height: 1.35;
}
.simdiff-empty {
  padding: 0.7rem 0.35rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
}

.presentation-shell .simdiff-wrap {
  max-width: min(980px, 100%);
  width: 100%;
  margin: 0 auto;
}
.presentation-shell .simdiff-board {
  min-height: clamp(30rem, 66vh, 44rem);
}
.presentation-shell .simdiff-item .formula-text {
  font-size: 1.02rem;
}
.presentation-shell .simdiff-tip {
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .simdiff-wrap { max-width: 100%; }
  .simdiff-outline { display: none; }
  .simdiff-triangle { filter: none; }
  .simdiff-board {
    min-height: 0;
    gap: 0.75rem;
  }
  .simdiff-shared {
    flex: none;
    padding: 0.9rem 0.85rem;
    border-radius: 14px;
    border: 1px solid #a7f3d0;
    background: linear-gradient(180deg, #ecfdf5 0%, #fff 70%);
  }
  .simdiff-base {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0;
  }
  .simdiff-base-head {
    margin-bottom: 0.15rem;
  }
  .simdiff-base-title {
    font-size: 1.35rem;
  }
  .simdiff-side {
    padding: 0.9rem 0.95rem !important;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
  }
  .simdiff-side-left {
    border-color: #bae6fd;
    background: linear-gradient(180deg, #f0f9ff 0%, #fff 60%);
  }
  .simdiff-side-right {
    border-color: #fecdd3;
    background: linear-gradient(180deg, #fff1f2 0%, #fff 60%);
  }
  .simdiff-list-shared { max-width: none; }
}

@media (max-width: 800px) {
  .features-table .feat-desc { display: none; }
  .features-search input { min-width: 10rem; }
}
