#podcast-map-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* Loading */
.pm-loading { text-align: center; padding: 60px 20px; color: #64748b; }
.pm-spinner { width: 28px; height: 28px; border: 3px solid #e2e8f0; border-top-color: #0f4c5c; border-radius: 50%; animation: pm-spin 0.7s linear infinite; margin: 0 auto 10px; }
@keyframes pm-spin { to { transform: rotate(360deg); } }
.pm-error { text-align: center; padding: 40px; color: #94a3b8; font-size: 14px; }

/* Breadcrumb */
#pm-breadcrumb {
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}
.pm-bc-item { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.pm-bc-item:hover { background: #f1f5f9; }
.pm-bc-item.active { color: #ffffff; font-weight: 600; cursor: default; }
.pm-bc-item.active:hover { background: none; }
.pm-bc-sep { margin: 0 4px; color: #cbd5e1; }

/* Main layout */
#pm-main {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

#pm-svg-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #1b4965;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  touch-action: pan-y; /* Allow vertical scroll on touch */
}

#pm-svg { display: block; background: #0a2e38; touch-action: pan-y; }

/* Zoom out button */
#pm-zoom-out {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  background: rgba(10,46,56,0.9);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s, transform 0.1s;
}
#pm-zoom-out:hover { background: var(--wpcasterpro-btn-background-color--default--hover); transform: translateX(-2px); }
#pm-zoom-out.hidden { display: none; }

/* Back to Map button (graph mode) */
#pm-back-map {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  background: rgba(10,46,56,0.9);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s, transform 0.1s;
}
#pm-back-map:hover { background: var(--wpcasterpro-btn-background-color--default--hover); transform: translateX(-2px); }
#pm-back-map.hidden { display: none; }

/* Tooltip */
#pm-tooltip {
  position: absolute;
  background: #1e293b;
  color: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  max-width: 200px;
  transition: opacity 0.15s;
}
#pm-tooltip.hidden { opacity: 0; pointer-events: none; }
#pm-tooltip strong { color: #ffffff; }
#pm-tooltip em { color: #94a3b8; font-size: 10px; }

/* Onboarding overlay */
#pm-onboarding {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: rgba(10,46,56,0.92);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  padding: 14px 18px;
  color: #e2e8f0;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  transition: opacity 0.3s;
}
#pm-onboarding p { margin: 0 0 4px; }
#pm-onboarding strong { color: #ffffff; }
.pm-onboard-hint { color: #67e8f9; font-size: 11px; font-weight: 600; }

/* Nodes */
.pm-node-cluster { transition: stroke 0.15s, stroke-width 0.15s, opacity 0.3s; }
.pm-node-topic { transition: stroke 0.15s, stroke-width 0.15s, transform 0.15s, opacity 0.3s; }

/* Glassmorphism labels */
.pm-glass-bg, .pm-cluster-glass {
  pointer-events: none;
}

/* Relation lines */
.pm-rel-line {
  pointer-events: none;
}

/* Panel */
#pm-panel {
  width: 300px;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  max-height: 600px;
  overflow-y: auto;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain; /* Prevent scroll chaining */
}

#pm-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: #ffffff;
  border-radius: 12px 12px 0 0;
  z-index: 1;
  border-left: 4px solid #0f4c5c;
}

.pm-panel-badge {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.pm-panel-title {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  display: block;
}

.pm-panel-subtitle {
  font-size: 11px;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

/* Legend */
#pm-panel-legend {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.pm-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  color: #475569;
}

.pm-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pm-legend-count {
  margin-left: auto;
  color: #94a3b8;
  font-size: 11px;
}

/* Episode list */
#pm-panel-list {
  padding: 0;
  margin: 0;
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

/* Section headers in panel */
.pm-section-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f1f5f9;
  list-style: none;
}

/* Related topic items */
.pm-rel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.12s;
  list-style: none;
}
.pm-rel-item:hover { background: #f0f9ff; }

.pm-rel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pm-rel-name {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.pm-rel-shared {
  font-size: 10px;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 10px;
}

.pm-ep-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pm-ep-item:last-child { border-bottom: none; }
.pm-ep-item:hover { background: #f8fafc; }

.pm-ep-empty {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 30px 16px;
}

.pm-ep-title {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
}

.pm-ep-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #0f4c5c;
  color: #ffffff !important;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none !important;
  transition: opacity 0.15s, transform 0.1s;
  align-self: flex-start;
}
.pm-ep-btn:hover { opacity: 0.85; transform: translateX(2px); }
.pm-ep-btn:focus-visible { outline: 2px solid #0f4c5c; outline-offset: 2px; }

/* Responsive */
@media (max-width: 900px) {
  #pm-main { flex-direction: column; }
  #pm-panel { width: 100%; max-height: 280px; }
  #pm-svg-wrap { min-height: 350px; }
}

@media (max-width: 600px) {
  #pm-onboarding { font-size: 11px; padding: 10px 14px; }
  .pm-ep-btn { width: 100%; text-align: center; }
  #pm-breadcrumb { font-size: 11px; }
  #pm-panel-header .pm-panel-title { font-size: 13px; }
  #pm-panel-header .pm-panel-subtitle { font-size: 10px; }
  .pm-ep-title { font-size: 12px; }
  .pm-rel-name { font-size: 11px; }
  #pm-svg-wrap { min-height: 300px; }
  #pm-zoom-out, #pm-back-map { font-size: 11px; padding: 6px 10px; }
}

/* Episode mode panel - no related topics section */
.pm-ep-item-final {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pm-ep-item-final:last-child { border-bottom: none; }
.pm-ep-item-final:hover { background: #f0f9ff; }

.pm-ep-thumb-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0f4c5c;
  flex-shrink: 0;
}

.pm-ep-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #0f4c5c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
}

.pm-ep-final-info {
  flex: 1;
  min-width: 0;
}

.pm-ep-final-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  margin-bottom: 4px;
}

.pm-ep-final-btn {
  display: inline-block;
  padding: 4px 10px;
  background: #0f4c5c;
  color: #ffffff !important;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none !important;
  transition: opacity 0.15s;
}
.pm-ep-final-btn:hover { opacity: 0.8; }

/* Depth indicator */
.pm-depth-indicator {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  align-items: center;
  z-index: 5;
}

.pm-depth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.3s;
}

.pm-depth-dot--active {
  background: #f0ad4e;
  border-color: #f0ad4e;
}

.pm-depth-dot--final {
  background: #67e8f9;
  border-color: #67e8f9;
}
