/* Case Builder — 3-column drag-and-drop exercise */
.cb-app { max-width: 1280px !important; }

.cb-subject-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.cb-subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cb-accent, #a855f7) 35%, var(--pm-border));
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 10%, #0f1a2e);
  color: var(--pm-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.cb-subject-pill em {
  font-style: normal;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 22%, transparent);
  color: color-mix(in srgb, var(--cb-accent, #a855f7) 85%, white);
}
.cb-subject-pill:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--cb-accent, #a855f7) 55%, var(--pm-border));
}
.cb-subject-pill.active {
  border-color: var(--cb-accent, #a855f7);
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 20%, #0f1a2e);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cb-accent, #a855f7) 35%, transparent);
}

.cb-empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  border-radius: 14px;
  border: 1px dashed var(--pm-border);
  color: var(--pm-muted);
  font-size: 14px;
  line-height: 1.6;
}
.cb-empty-state i {
  font-size: 28px;
  color: #f59e0b;
  margin-bottom: 10px;
  display: block;
}
.cb-empty-state a { color: var(--pm-accent-light); }

.cb-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.cb-case-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: var(--pm-card);
  border: 1px solid var(--pm-border);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.cb-case-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cb-accent, #a855f7) 55%, var(--pm-border));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.cb-case-card h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.35;
}
.cb-case-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--cb-accent, #a855f7) 35%, transparent);
  color: color-mix(in srgb, var(--cb-accent, #a855f7) 80%, white);
}
.cb-case-card p {
  font-size: 13px;
  color: var(--pm-muted);
  line-height: 1.55;
}

.cb-workspace { display: none; }
.cb-workspace.active { display: block; }

/* Stage 1: narration only — never show drag board */
.cb-workspace.cb-mode-facts #cb-drag-board {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.cb-workspace.cb-mode-facts #cb-facts-panel {
  display: block !important;
}
.cb-workspace.cb-mode-drag #cb-facts-panel {
  display: none !important;
}
.cb-workspace.cb-mode-drag #cb-drag-board {
  display: grid !important;
}

.cb-facts-panel {
  border-radius: 16px;
  border: 1px solid var(--pm-border);
  background: linear-gradient(165deg, #152238, #0f1a2e);
  padding: 20px;
  margin-bottom: 8px;
}
.cb-facts-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--pm-border);
}
.cb-facts-hero-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--cb-accent, #a855f7);
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 16%, #0f1a2e);
  border: 1px solid color-mix(in srgb, var(--cb-accent, #a855f7) 35%, transparent);
  flex-shrink: 0;
}
.cb-facts-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cb-accent, #a855f7);
  margin-bottom: 8px;
}
.cb-facts-lead {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--pm-text);
}
.cb-facts-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pm-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cb-facts-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.cb-facts-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cb-accent, #a855f7), #22c55e);
  animation: cb-progress-glow 2.4s ease-in-out infinite;
}
.cb-facts-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cb-fact-beat {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.22), color-mix(in srgb, var(--beat-color, #a855f7) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--beat-color, #a855f7) 28%, var(--pm-border));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03);
  animation: cb-fade-up 0.5s ease both;
  animation-delay: var(--beat-delay, 0s);
}
.cb-fact-beat-scene {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--beat-color, #a855f7), color-mix(in srgb, var(--beat-color, #a855f7) 50%, #000));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--beat-color, #a855f7) 35%, transparent);
}
.cb-narration-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--beat-color, #a855f7) 40%, transparent);
  cursor: default;
  user-select: none;
}
.cb-narration-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.28), transparent 55%);
  pointer-events: none;
}
.cb-narration-icon.anim-float { animation: cb-float 2.8s ease-in-out infinite; }
.cb-narration-icon.anim-pulse { animation: cb-pulse 2s ease-in-out infinite; }
.cb-narration-icon.anim-spin-slow { animation: cb-spin-slow 6s linear infinite; }
.cb-fact-beat-icon .cb-narration-icon {
  width: 52px;
  height: 52px;
  font-size: 22px;
}
.cb-fact-beat-body h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--pm-text);
}
.cb-fact-beat-body p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--pm-muted);
}
.cb-facts-continue-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--pm-muted);
}
.cb-facts-continue-hint i { color: var(--cb-accent, #a855f7); margin-right: 6px; }

@keyframes cb-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cb-progress-glow {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; filter: brightness(1.15); }
}

.cb-stage-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cb-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--pm-border);
  background: var(--pm-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--pm-muted);
}
.cb-stage-pill.done {
  border-color: #22c55e66;
  color: #86efac;
  background: #14532d33;
}
.cb-stage-pill.active {
  border-color: var(--cb-accent, #a855f7);
  color: var(--pm-text);
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 14%, var(--pm-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cb-accent, #a855f7) 35%, transparent);
}
.cb-stage-pill i { font-size: 11px; }

.cb-board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  min-height: 420px;
}
@media (max-width: 960px) {
  .cb-board { grid-template-columns: 1fr; }
}

.cb-panel {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--pm-border);
  background: #152238;
  overflow: hidden;
  min-height: 360px;
}
.cb-panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--pm-border);
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pm-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cb-panel-head i { color: var(--cb-accent, #a855f7); }
.cb-panel-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  min-height: 280px;
}

.cb-drop-zone {
  border: 2px dashed color-mix(in srgb, var(--cb-accent, #a855f7) 45%, var(--pm-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 6%, #0f1a2e);
  transition: border-color 0.2s, background 0.2s;
}
.cb-drop-zone.drag-over {
  border-color: var(--cb-accent, #a855f7);
  background: color-mix(in srgb, var(--cb-accent, #a855f7) 14%, #0f1a2e);
}
.cb-drop-zone.complete {
  border-style: solid;
  border-color: #22c55e66;
}

.cb-drop-hint {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--pm-muted);
  padding: 24px 12px;
  pointer-events: none;
}
.cb-drop-zone.has-items .cb-drop-hint { display: none; }

.cb-token {
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--pm-border);
  background: linear-gradient(160deg, #1e3050, #152238);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.cb-token:active { cursor: grabbing; }
.cb-token:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.cb-token.dragging { opacity: 0.45; transform: scale(0.95); }
.cb-token.reject {
  animation: cb-shake 0.45s ease;
}
.cb-token.placed {
  cursor: default;
  animation: cb-pop 0.35s ease;
}

.cb-token-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cb-token-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.22), transparent 55%);
  pointer-events: none;
}
.cb-token-icon.anim-float { animation: cb-float 2.8s ease-in-out infinite; }
.cb-token-icon.anim-pulse { animation: cb-pulse 2s ease-in-out infinite; }
.cb-token-icon.anim-spin-slow { animation: cb-spin-slow 6s linear infinite; }

.cb-token-label {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  color: var(--pm-text);
  max-width: 80px;
}

.cb-ref-card {
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--pm-muted);
}
.cb-ref-card h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pm-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cb-ref-card strong { color: var(--pm-accent-light); }
.cb-ref-summary {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--pm-border);
}

.cb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}
.cb-progress-text {
  font-size: 13px;
  color: var(--pm-muted);
}
.cb-progress-text strong { color: var(--pm-text); }

.cb-complete-banner {
  display: none;
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #14532d44, #1e293944);
  border: 1px solid #22c55e55;
  color: #bbf7d0;
  font-size: 14px;
  line-height: 1.55;
}
.cb-complete-banner.show { display: block; }

@keyframes cb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes cb-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes cb-spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes cb-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@keyframes cb-pop {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

#cb-fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.cb-fx-particle {
  position: fixed;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: cb-fx-burst 0.7s ease-out forwards;
  box-shadow: 0 0 10px currentColor;
}
.cb-fx-particle.cb-fx-star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.cb-fx-particle.cb-fx-diamond {
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.cb-fx-ring {
  position: fixed;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: cb-fx-ring 0.6s ease-out forwards;
  opacity: 0.85;
}
.cb-fx-spark {
  position: fixed;
  font-size: 22px;
  transform: translate(-50%, -50%);
  animation: cb-fx-spark 0.5s ease-out forwards;
  filter: drop-shadow(0 0 6px currentColor);
}
@keyframes cb-fx-burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.2) rotate(var(--rot));
  }
}
@keyframes cb-fx-ring {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.8); }
}
@keyframes cb-fx-spark {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1.4); }
}