/* P2P Demo - Shared Styles */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-yellow: #eab308;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --border-color: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.app-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 1rem;
}

.app-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-blue);
  color: white;
}

.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1rem;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

/* Main Content */
.content {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.card:hover {
  border-color: var(--accent-blue);
  transform: translateX(4px);
}

.card.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.card-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.card-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.card-badge.doc {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

.card-badge.email {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-purple);
}

.card-badge.approval {
  background: rgba(34, 197, 94, 0.2);
  color: var(--accent-green);
}

.card-badge.issue {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.card-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Detail Panel */
.detail-panel {
  width: 400px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
}

.detail-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.detail-type {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.875rem;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-value {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-value.amount {
  font-family: var(--font-mono);
}

.detail-body {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
}

/* Links List */
.links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.link-chip:hover {
  background: var(--accent-blue);
  color: white;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #475569;
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.625rem 1rem;
  padding-left: 2.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 0.375rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent-blue);
}

.filter-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* Graph Container */
#graph-container {
  width: 100%;
  height: 100%;
  min-height: 600px;
  background: var(--bg-primary);
  border-radius: var(--radius);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
}

.timeline-item.highlighted::before {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.timeline-title {
  font-weight: 600;
  margin: 0.25rem 0;
}

.timeline-type {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Workflow Stages */
.workflow-stages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stage-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.stage-card:hover {
  border-color: var(--accent-blue);
}

.stage-card.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
}

.stage-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}

.stage-card.active .stage-number {
  background: var(--accent-blue);
}

.stage-info {
  flex: 1;
}

.stage-label {
  font-weight: 600;
}

.stage-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.stage-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-backdrop.visible .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

/* Responsive */
@media (max-width: 1200px) {
  .detail-panel {
    width: 350px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 280px;
  }
  
  .detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s;
  }
  
  .detail-panel.open {
    transform: translateX(0);
  }
}

/* Utility Classes */
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-yellow { color: var(--accent-yellow); }
.text-red { color: var(--accent-red); }
.text-purple { color: var(--accent-purple); }
.text-cyan { color: var(--accent-cyan); }

.bg-blue { background: rgba(59, 130, 246, 0.2); }
.bg-green { background: rgba(34, 197, 94, 0.2); }
.bg-yellow { background: rgba(234, 179, 8, 0.2); }
.bg-red { background: rgba(239, 68, 68, 0.2); }
.bg-purple { background: rgba(168, 85, 247, 0.2); }
.bg-cyan { background: rgba(6, 182, 212, 0.2); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.9375rem;
}

/* Workflow - header actions */
.section-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tour-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Story panel */
.story-panel {
  width: 420px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
}

.story-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.story-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.story-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.story-section {
  margin-bottom: 1.25rem;
}

.story-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.story-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.story-callout {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius);
  padding: 0.75rem;
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.story-cast {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.story-actor {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.story-actor-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  background: var(--accent-purple);
  flex: 0 0 auto;
}

.story-actor-main {
  min-width: 0;
}

.story-actor-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.125rem;
}

.story-actor-meta {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.story-actor-meta code {
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

/* Tour highlight */
.stage-card.tour-focus {
  border-color: var(--accent-yellow);
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.25);
}

@media (max-width: 1400px) {
  .story-panel {
    width: 380px;
  }
}

@media (max-width: 1200px) {
  .story-panel {
    width: 340px;
  }
}

/* ============================================
   COMIC-STYLE STORYTELLING UX
   ============================================ */

/* Avatar System */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #1a1a2e;
  text-transform: uppercase;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.25rem;
}

.avatar-speaking {
  animation: avatar-pulse 1.5s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Comic Panel Redesign */
.comic-panel {
  width: 440px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, #1a2744 100%);
  border-left: 3px solid var(--accent-cyan);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.comic-header {
  padding-bottom: 0.75rem;
  border-bottom: 2px dashed var(--border-color);
}

.comic-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.comic-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.comic-subtitle {
  font-size: 0.875rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* Progress Dots */
.comic-progress {
  display: flex;
  gap: 6px;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.progress-dot:hover {
  background: var(--accent-blue);
  transform: scale(1.2);
}

.progress-dot.past {
  background: var(--accent-green);
}

.progress-dot.active {
  background: var(--accent-yellow);
  box-shadow: 0 0 8px var(--accent-yellow);
  transform: scale(1.3);
}

/* Scene Box (Caption style) */
.comic-scene-box {
  background: linear-gradient(135deg, #2d3a4f 0%, #1e293b 100%);
  border: 2px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 1rem;
  position: relative;
  box-shadow: 4px 4px 0 rgba(6, 182, 212, 0.2);
}

.comic-scene-label {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--accent-cyan);
  color: #0f172a;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 4px;
  letter-spacing: 0.1em;
}

.comic-scene-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.comic-scene-text.animate-in {
  animation: fadeSlideIn 0.4s ease-out;
}

/* Speech Bubble Section */
.comic-speech-section {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.comic-speaker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.comic-speaker-avatar {
  position: relative;
}

.comic-speaker-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Speech Bubble */
.comic-speech-bubble {
  --bubble-color: var(--accent-blue);
  background: var(--bg-primary);
  border: 2px solid var(--bubble-color);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 0.875rem 1rem;
  position: relative;
  flex: 1;
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--bubble-color) 30%, transparent);
}

.comic-speech-bubble::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 16px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid var(--bubble-color);
}

.comic-speech-bubble::after {
  content: '';
  position: absolute;
  left: -8px;
  top: 18px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 10px solid var(--bg-primary);
}

.comic-quote {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
  font-style: italic;
}

.comic-quote.animate-in {
  animation: fadeSlideIn 0.5s ease-out;
}

/* Cast Section */
.comic-cast-section {
  padding-top: 0.5rem;
}

.comic-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.625rem;
  text-transform: uppercase;
}

.comic-cast-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.comic-cast-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  cursor: default;
  transition: transform 0.2s ease;
}

.comic-cast-avatar:hover {
  transform: translateY(-2px);
}

.comic-cast-avatar.is-speaker .avatar {
  animation: avatar-pulse 1.5s ease-in-out infinite;
}

.comic-cast-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Thought Bubble (Why it matters) */
.comic-thought-section {
  padding-top: 0.25rem;
}

.comic-thought-bubble {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border: 1px dashed var(--accent-cyan);
  border-radius: 20px;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
  position: relative;
}

.comic-thought-bubble::before,
.comic-thought-bubble::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px dashed var(--accent-cyan);
}

.comic-thought-bubble::before {
  width: 12px;
  height: 12px;
  left: -6px;
  bottom: -8px;
}

.comic-thought-bubble::after {
  width: 8px;
  height: 8px;
  left: -14px;
  bottom: -16px;
}

/* Evidence Section */
.comic-evidence-section {
  padding-top: 0.25rem;
}

.comic-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comic-evidence-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  animation: slideInRight 0.3s ease-out backwards;
}

.comic-evidence-chip:hover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  transform: translateX(4px);
}

.comic-evidence-chip:hover .evidence-arrow {
  transform: translateX(4px);
  color: var(--accent-blue);
}

.evidence-icon {
  font-size: 1rem;
}

.evidence-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-arrow {
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.2s ease;
}

/* Arrow Indicator */
.comic-arrow-indicator {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--accent-blue);
  color: white;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
}

.comic-arrow-indicator svg {
  width: 20px;
  height: 20px;
}

.comic-arrow-indicator.arrow-animate {
  animation: arrowPulse 0.5s ease-out 3;
}

@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

/* Tour Controls Redesign */
.tour-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-tour {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tour-icon {
  font-size: 1rem;
}

.btn-tour-start {
  background: linear-gradient(135deg, var(--accent-green) 0%, #16a34a 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.btn-tour-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-tour-nav {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-tour-nav:hover:not(:disabled) {
  background: var(--accent-blue);
  color: white;
}

.btn-tour-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-tour-next {
  background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
  color: white;
}

.btn-tour-stop {
  background: var(--bg-tertiary);
  color: var(--accent-red);
}

.btn-tour-stop:hover {
  background: var(--accent-red);
  color: white;
}

/* Item Card Redesign */
.item-card {
  display: flex;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--card-accent, var(--accent-blue));
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.item-card:hover {
  border-color: var(--card-accent, var(--accent-blue));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.item-card.card-animated {
  animation: cardSlideIn 0.4s ease-out backwards;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-card-avatar {
  flex-shrink: 0;
  padding-top: 2px;
}

.item-card-content {
  flex: 1;
  min-width: 0;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.item-number {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.item-type {
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  white-space: nowrap;
}

.item-parties {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  flex-wrap: wrap;
}

.party-arrow {
  color: var(--text-muted);
}

.item-subject {
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Spotlight/Highlight Effect */
.item-card.card-highlighted {
  border-color: var(--accent-yellow) !important;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: scale(1.02);
  z-index: 10;
  position: relative;
}

.item-card.card-dimmed {
  opacity: 0.35;
  filter: blur(1px);
}

/* Tour Active State */
body.tour-active .stages-panel .stage-card:not(.active) {
  opacity: 0.5;
}

body.tour-active .stage-card.active {
  border-color: var(--accent-yellow);
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.25), inset 0 0 20px rgba(234, 179, 8, 0.05);
}

body.tour-active .stage-card.active .stage-number {
  background: var(--accent-yellow);
  color: #1a1a2e;
}

/* Animations */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .avatar-speaking,
  .comic-scene-text.animate-in,
  .comic-quote.animate-in,
  .comic-evidence-chip,
  .item-card.card-animated,
  .comic-arrow-indicator.arrow-animate {
    animation: none !important;
  }
  
  .item-card:hover,
  .comic-cast-avatar:hover,
  .comic-evidence-chip:hover {
    transform: none !important;
  }
}

/* Responsive adjustments for comic panel */
@media (max-width: 1400px) {
  .comic-panel {
    width: 400px;
  }
}

@media (max-width: 1200px) {
  .comic-panel {
    width: 360px;
    padding: 1rem;
  }
  
  .comic-scene-box {
    padding: 0.875rem;
  }
  
  .comic-speech-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .comic-speaker {
    flex-direction: row;
    gap: 0.75rem;
  }
  
  .comic-speech-bubble {
    border-radius: 16px;
    border-top-left-radius: 4px;
  }
  
  .comic-speech-bubble::before {
    left: 16px;
    top: -12px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid var(--bubble-color);
    border-top: none;
  }
  
  .comic-speech-bubble::after {
    left: 18px;
    top: -8px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--bg-primary);
    border-top: none;
  }
}

/* ============================================
   GRAPH STORYTELLING STYLES
   ============================================ */

/* Graph Story Panel (inherits from comic-panel) */
.graph-story-panel {
  transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease, padding 0.3s ease, border 0.3s ease;
}

.graph-story-panel.hidden {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

/* Tour progress bar */
.tour-progress-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
}

.tour-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.tour-progress-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Story node info card */
.story-node-info {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

.story-node-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.story-node-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.story-node-type {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  white-space: nowrap;
}

.story-node-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Path selector cards */
.path-card {
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.path-card:hover {
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}

.path-card.active {
  border-color: var(--accent-yellow);
  background: rgba(234, 179, 8, 0.1);
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

.path-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.path-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.path-card-steps {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.path-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.path-icon {
  font-size: 1.125rem;
  margin-right: 0.375rem;
}

/* Graph tour active state */
body.tour-active .graph-sidebar {
  opacity: 0.7;
  width: 300px !important;
  min-width: 300px !important;
  max-width: 300px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

body.tour-active .graph-sidebar:hover {
  opacity: 1;
}

body.tour-active .graph-story-panel:not(.hidden) {
  width: 420px !important;
  min-width: 420px !important;
  max-width: 420px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

/* Graph node highlight animations */
@keyframes graphNodePulse {
  0%, 100% { 
    filter: drop-shadow(0 0 0 rgba(234, 179, 8, 0));
  }
  50% { 
    filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.8));
  }
}

@keyframes graphEdgeFlow {
  0% { 
    stroke-dashoffset: 20;
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% { 
    stroke-dashoffset: 0;
    opacity: 0.5;
  }
}

/* Responsive for graph story panel */
@media (max-width: 1600px) {
  .graph-story-panel:not(.hidden) {
    width: 380px;
    min-width: 380px;
    max-width: 380px;
  }
  
  body.tour-active .graph-story-panel:not(.hidden) {
    width: 380px !important;
    min-width: 380px !important;
    max-width: 380px !important;
  }
}

@media (max-width: 1400px) {
  .graph-story-panel:not(.hidden) {
    width: 360px;
    min-width: 360px;
    max-width: 360px;
  }
  
  body.tour-active .graph-story-panel:not(.hidden) {
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
  }
  
  .story-node-info {
    padding: 0.75rem;
  }
}

@media (max-width: 1200px) {
  .graph-story-panel {
    position: fixed;
    right: 0;
    top: 80px;
    bottom: 0;
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    z-index: 100;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  }
  
  body.tour-active .graph-story-panel:not(.hidden) {
    width: 400px !important;
    min-width: 400px !important;
    max-width: 400px !important;
  }
  
  .graph-story-panel.hidden {
    transform: translateX(100%);
    width: 400px;
    padding: 1.25rem;
  }
}
