/* ============================================================
   Pipeline Player — Multi-phase teaching pipeline
   ============================================================ */

.pl-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Progress Bar ─── */
.pl-progress-track {
  height: 3px;
  background: #e5e7eb;
  flex-shrink: 0;
}
.pl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transition: width 0.3s ease;
}

/* ─── Top Bar ─── */
.pl-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.pl-back {
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.pl-back:hover { background: #334155; color: #fff; }
.pl-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-step-info {
  background: #334155;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ─── Phase Tabs ─── */
.pl-phase-tabs {
  display: flex;
  gap: 0;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  flex-shrink: 0;
  overflow-x: auto;
}
.pl-phase-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
}
.pl-phase-tab:hover { color: #334155; background: #f1f5f9; }
.pl-phase-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
}
.pl-phase-done {
  color: #22c55e;
}
.pl-phase-done::after {
  content: ' ✓';
}
.pl-phase-count {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
}

/* ─── Slide Area ─── */
.pl-slide-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  background: #fafbfc;
}
.pl-slide-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.pl-slide {
  animation: pl-fadeIn 0.3s ease;
}

@keyframes pl-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pl-fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Phase Indicator ─── */
.pl-phase-indicator {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 16px;
  padding: 4px 12px;
  background: #f1f5f9;
  border-radius: 6px;
  display: inline-block;
}

/* ─── Slide Title ─── */
.pl-slide-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
  line-height: 1.3;
}

/* ─── Narration ─── */
.pl-narration {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.6;
}

/* ─── Sentence Highlighting ─── */
.pl-sentence {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #1f2937;
  opacity: 0;
  animation: pl-fadeInUp 0.4s ease forwards;
}
.pl-sent-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 8px;
}
.pl-keyword {
  color: #dc2626;
  font-weight: 600;
  border-bottom: 2px solid #fca5a5;
  padding: 0 2px;
}
.pl-annotation {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #6b7280;
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 4px;
  border-left: 2px solid #d1d5db;
}
.pl-tip {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #92400e;
  line-height: 1.5;
}

/* ─── Modeling Board ─── */
.pl-modeling-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 600px) {
  .pl-modeling-board { grid-template-columns: 1fr; }
}
.pl-model-col {
  padding: 16px;
  border-radius: 8px;
}
.pl-model-givens { background: #f0fdf4; border: 1px solid #bbf7d0; }
.pl-model-targets { background: #eff6ff; border: 1px solid #bfdbfe; }
.pl-model-col-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.pl-model-item {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #374151;
  padding: 2px 0;
}
.pl-model-bullet {
  color: #2563eb;
  font-weight: 700;
  margin-right: 4px;
}
.pl-model-bridge {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #78350f;
}

/* ─── Constraint Analysis ─── */
.pl-constraint-table {
  margin-bottom: 16px;
}
.pl-constraint-row {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
  align-items: center;
}
.pl-constraint-row:last-child { border-bottom: none; }
.pl-constraint-key {
  font-weight: 600;
  color: #374151;
}
.pl-constraint-val {
  font-family: 'SF Mono', monospace;
  color: #2563eb;
  font-weight: 600;
}
.pl-constraint-note {
  color: #6b7280;
  font-size: 0.85rem;
}
.pl-complexity-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}
.pl-complexity-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 8px;
}
.pl-complexity-content {
  font-size: 0.9rem;
  line-height: 1.6;
}
.pl-comp-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed #e5e7eb;
}
.pl-comp-bad {
  color: #dc2626;
  font-weight: 600;
}
.pl-comp-good {
  color: #16a34a;
  font-weight: 600;
}
.pl-comp-conclusion {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f0fdf4;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #166534;
}
.pl-edge-cases {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}
.pl-edge-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #991b1b;
  margin-bottom: 6px;
}
.pl-edge-item {
  font-size: 0.88rem;
  color: #7f1d1d;
  padding: 2px 0;
  line-height: 1.5;
}

/* ─── Knowledge Cards ─── */
.pl-kp-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.pl-kp-code-box {
  background: #f8fafc;
}
.pl-kp-section {
  line-height: 1.6;
}
.pl-kp-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.pl-kp-body {
  font-size: 0.93rem;
  color: #374151;
  line-height: 1.7;
}
.pl-kp-body code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'SF Mono', monospace;
  font-size: 0.85rem;
}
.pl-kp-code {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #24292e;
  font-family: 'Consolas', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
}

/* ─── Solution Steps ─── */
.pl-solution-steps {
  margin-bottom: 16px;
}
.pl-solution-step {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.pl-solution-step:target,
.pl-solution-step:hover { border-color: #93c5fd; box-shadow: 0 1px 3px rgba(37,99,235,0.1); }
.pl-solution-step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.pl-solution-step-body { flex: 1; min-width: 0; }
.pl-solution-step-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 4px;
}
.pl-solution-step-detail {
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.6;
}
.pl-solution-formula {
  margin-top: 6px;
  padding: 6px 10px;
  background: #f0fdf4;
  border-radius: 4px;
  font-family: 'SF Mono', monospace;
  font-size: 0.85rem;
  color: #166534;
}
.pl-pseudocode {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.pl-pseudocode-title {
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.pl-pseudocode-body {
  margin: 0;
  color: #24292e;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  font-family: 'Consolas', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
}

/* ─── Summary ─── */
.pl-summary-list {
  margin-bottom: 16px;
}
.pl-summary-item {
  padding: 8px 14px;
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.5;
  border-left: 3px solid #2563eb;
  margin-bottom: 4px;
  background: #f9fafb;
  border-radius: 0 4px 4px 0;
}
.pl-summary-next {
  padding: 12px 16px;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 1rem;
  color: #2563eb;
  font-weight: 500;
}

/* ─── Bottom Bar ─── */
.pl-bottom-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pl-bottom-left { flex: 1; }
.pl-bottom-center { flex: 0 0 auto; }
.pl-bottom-right { flex: 1; text-align: right; }

.pl-ctrl {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.pl-ctrl:hover:not(:disabled) {
  background: #e5e7eb;
  border-color: #9ca3af;
}
.pl-ctrl:disabled { opacity: 0.35; cursor: default; }
.pl-ctrl-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.pl-ctrl-primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.pl-slide-progress {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ─── Empty / Loading / Error ─── */
.pl-empty {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-size: 0.95rem;
}
.pl-page-root {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-page-loading, .pl-page-error { text-align: center; color: #6b7280; max-width: 480px; }
.pl-page-error h2 { font-size: 1.2rem; margin-bottom: 8px; }
.pl-page-error p { margin-bottom: 16px; }

/* ─── Code Trace Entry ─── */
.pl-code-trace-entry {
  text-align: center;
  padding: 40px 20px;
}
.pl-codetrace-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: pl-bounce 2s ease infinite;
}
@keyframes pl-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.pl-codetrace-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}
.pl-codetrace-desc {
  font-size: 0.95rem;
  color: #6b7280;
  max-width: 500px;
  margin: 0 auto 16px;
  line-height: 1.6;
}
.pl-codetrace-progress {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 20px;
}
.pl-codetrace-btn {
  display: inline-block;
  padding: 12px 32px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pl-codetrace-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* ─── Media ─── */
@media (max-width: 640px) {
  .pl-slide-container { padding: 16px 12px; }
  .pl-phase-tab { padding: 8px 12px; font-size: 0.8rem; }
  .pl-constraint-row {
    grid-template-columns: 1fr 80px;
    gap: 8px;
  }
}
